QuarkPlatformPkg/PlatformHelperLib: Remove PlatformDebugPortGetChar8()
[mirror_edk2.git] / QuarkPlatformPkg / Include / Library / PlatformHelperLib.h
CommitLineData
b303605e
MK
1/** @file\r
2PlatformHelperLib function prototype definitions.\r
3\r
8ac69667 4Copyright (c) 2013 - 2016 Intel Corporation.\r
b303605e
MK
5\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __PLATFORM_HELPER_LIB_H__\r
17#define __PLATFORM_HELPER_LIB_H__\r
18\r
19#include "Platform.h"\r
20\r
21//\r
22// Function prototypes for routines exported by this library.\r
23//\r
24\r
25/**\r
26 Find pointer to RAW data in Firmware volume file.\r
27\r
28 @param FvNameGuid Firmware volume to search. If == NULL search all.\r
29 @param FileNameGuid Firmware volume file to search for.\r
30 @param SectionData Pointer to RAW data section of found file.\r
31 @param SectionDataSize Pointer to UNITN to get size of RAW data.\r
32\r
33 @retval EFI_SUCCESS Raw Data found.\r
34 @retval EFI_INVALID_PARAMETER FileNameGuid == NULL.\r
35 @retval EFI_NOT_FOUND Firmware volume file not found.\r
36 @retval EFI_UNSUPPORTED Unsupported in current enviroment (PEI or DXE).\r
37\r
38**/\r
39EFI_STATUS\r
40EFIAPI\r
41PlatformFindFvFileRawDataSection (\r
42 IN CONST EFI_GUID *FvNameGuid OPTIONAL,\r
43 IN CONST EFI_GUID *FileNameGuid,\r
44 OUT VOID **SectionData,\r
45 OUT UINTN *SectionDataSize\r
46 );\r
47\r
b303605e
MK
48/**\r
49 Find free spi protect register and write to it to protect a flash region.\r
50\r
51 @param DirectValue Value to directly write to register.\r
52 if DirectValue == 0 the use Base & Length below.\r
53 @param BaseAddress Base address of region in Flash Memory Map.\r
54 @param Length Length of region to protect.\r
55\r
56 @retval EFI_SUCCESS Free spi protect register found & written.\r
57 @retval EFI_NOT_FOUND Free Spi protect register not found.\r
58 @retval EFI_DEVICE_ERROR Unable to write to spi protect register.\r
59\r
60**/\r
61EFI_STATUS\r
62EFIAPI\r
63PlatformWriteFirstFreeSpiProtect (\r
64 IN CONST UINT32 DirectValue,\r
65 IN CONST UINT32 BaseAddress,\r
66 IN CONST UINT32 Length\r
67 );\r
68\r
69/**\r
70 Lock legacy SPI static configuration information.\r
71\r
72 Function will assert if unable to lock config.\r
73\r
74**/\r
75VOID\r
76EFIAPI\r
77PlatformFlashLockConfig (\r
78 VOID\r
79 );\r
80\r
81/**\r
82 Lock regions and config of SPI flash given the policy for this platform.\r
83\r
84 Function will assert if unable to lock regions or config.\r
85\r
86 @param PreBootPolicy If TRUE do Pre Boot Flash Lock Policy.\r
87\r
88**/\r
89VOID\r
90EFIAPI\r
91PlatformFlashLockPolicy (\r
92 IN CONST BOOLEAN PreBootPolicy\r
93 );\r
94\r
b303605e
MK
95/** Check if System booted with recovery Boot Stage1 image.\r
96\r
97 @retval TRUE If system booted with recovery Boot Stage1 image.\r
98 @retval FALSE If system booted with normal stage1 image.\r
99\r
100**/\r
101BOOLEAN\r
102EFIAPI\r
103PlatformIsBootWithRecoveryStage1 (\r
104 VOID\r
105 );\r
106\r
107/**\r
108 Clear SPI Protect registers.\r
109\r
110 @retval EFI_SUCESS SPI protect registers cleared.\r
111 @retval EFI_ACCESS_DENIED Unable to clear SPI protect registers.\r
112**/\r
113\r
114EFI_STATUS\r
115EFIAPI\r
116PlatformClearSpiProtect (\r
117 VOID\r
118 );\r
119\r
120/**\r
121 Determine if an SPI address range is protected.\r
122\r
123 @param SpiBaseAddress Base of SPI range.\r
124 @param Length Length of SPI range.\r
125\r
126 @retval TRUE Range is protected.\r
127 @retval FALSE Range is not protected.\r
128**/\r
129BOOLEAN\r
130EFIAPI\r
131PlatformIsSpiRangeProtected (\r
132 IN CONST UINT32 SpiBaseAddress,\r
133 IN CONST UINT32 Length\r
134 );\r
135\r
136/**\r
137 Set Legacy GPIO Level\r
138\r
139 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.\r
140 @param GpioNum GPIO bit to change.\r
141 @param HighLevel If TRUE set GPIO High else Set GPIO low.\r
142\r
143**/\r
144VOID\r
145EFIAPI\r
146PlatformLegacyGpioSetLevel (\r
147 IN CONST UINT32 LevelRegOffset,\r
148 IN CONST UINT32 GpioNum,\r
149 IN CONST BOOLEAN HighLevel\r
150 );\r
151\r
152/**\r
153 Get Legacy GPIO Level\r
154\r
155 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.\r
156 @param GpioNum GPIO bit to check.\r
157\r
158 @retval TRUE If bit is SET.\r
159 @retval FALSE If bit is CLEAR.\r
160\r
161**/\r
162BOOLEAN\r
163EFIAPI\r
164PlatformLegacyGpioGetLevel (\r
165 IN CONST UINT32 LevelRegOffset,\r
166 IN CONST UINT32 GpioNum\r
167 );\r
168\r
169/**\r
170 Set the direction of Pcal9555 IO Expander GPIO pin.\r
171\r
172 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.\r
173 @param GpioNum Gpio direction to configure - values 0-7 for Port0\r
174 and 8-15 for Port1.\r
175 @param CfgAsInput If TRUE set pin direction as input else set as output.\r
176\r
177**/\r
178VOID\r
179EFIAPI\r
180PlatformPcal9555GpioSetDir (\r
181 IN CONST UINT32 Pcal9555SlaveAddr,\r
182 IN CONST UINT32 GpioNum,\r
183 IN CONST BOOLEAN CfgAsInput\r
184 );\r
185\r
186/**\r
187 Set the level of Pcal9555 IO Expander GPIO high or low.\r
188\r
189 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.\r
190 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15\r
191 for Port1.\r
192 @param HighLevel If TRUE set pin high else set pin low.\r
193\r
194**/\r
195VOID\r
196EFIAPI\r
197PlatformPcal9555GpioSetLevel (\r
198 IN CONST UINT32 Pcal9555SlaveAddr,\r
199 IN CONST UINT32 GpioNum,\r
200 IN CONST BOOLEAN HighLevel\r
201 );\r
202\r
203/**\r
204\r
205 Enable pull-up/pull-down resistors of Pcal9555 GPIOs.\r
206\r
207 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.\r
208 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15\r
209 for Port1.\r
210\r
211**/\r
212VOID\r
213EFIAPI\r
214PlatformPcal9555GpioEnablePull (\r
215 IN CONST UINT32 Pcal9555SlaveAddr,\r
216 IN CONST UINT32 GpioNum\r
217 );\r
218\r
219/**\r
220\r
221 Disable pull-up/pull-down resistors of Pcal9555 GPIOs.\r
222\r
223 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.\r
224 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15\r
225 for Port1.\r
226\r
227**/\r
228VOID\r
229EFIAPI\r
230PlatformPcal9555GpioDisablePull (\r
231 IN CONST UINT32 Pcal9555SlaveAddr,\r
232 IN CONST UINT32 GpioNum\r
233 );\r
234\r
235BOOLEAN\r
236EFIAPI\r
237PlatformPcal9555GpioGetState (\r
238 IN CONST UINT32 Pcal9555SlaveAddr,\r
239 IN CONST UINT32 GpioNum\r
240 );\r
241\r
242/**\r
243 Init platform LEDs into known state.\r
244\r
245 @param PlatformType Executing platform type.\r
246\r
247 @retval EFI_SUCCESS Operation success.\r
248\r
249**/\r
250EFI_STATUS\r
251EFIAPI\r
252PlatformLedInit (\r
253 IN CONST EFI_PLATFORM_TYPE Type\r
254 );\r
255\r
256/**\r
257 Turn on or off platform flash update LED.\r
258\r
259 @param PlatformType Executing platform type.\r
260 @param TurnOn If TRUE turn on else turn off.\r
261\r
262 @retval EFI_SUCCESS Operation success.\r
263\r
264**/\r
265EFI_STATUS\r
266EFIAPI\r
267PlatformFlashUpdateLed (\r
268 IN CONST EFI_PLATFORM_TYPE Type,\r
269 IN CONST BOOLEAN TurnOn\r
270 );\r
271\r
272#endif // #ifndef __PLATFORM_HELPER_LIB_H__\r