2 PlatformHelperLib function prototype definitions.
4 Copyright (c) 2013 - 2016 Intel Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __PLATFORM_HELPER_LIB_H__
11 #define __PLATFORM_HELPER_LIB_H__
16 // Function prototypes for routines exported by this library.
20 Find pointer to RAW data in Firmware volume file.
22 @param FvNameGuid Firmware volume to search. If == NULL search all.
23 @param FileNameGuid Firmware volume file to search for.
24 @param SectionData Pointer to RAW data section of found file.
25 @param SectionDataSize Pointer to UNITN to get size of RAW data.
27 @retval EFI_SUCCESS Raw Data found.
28 @retval EFI_INVALID_PARAMETER FileNameGuid == NULL.
29 @retval EFI_NOT_FOUND Firmware volume file not found.
30 @retval EFI_UNSUPPORTED Unsupported in current enviroment (PEI or DXE).
35 PlatformFindFvFileRawDataSection (
36 IN CONST EFI_GUID
*FvNameGuid OPTIONAL
,
37 IN CONST EFI_GUID
*FileNameGuid
,
38 OUT VOID
**SectionData
,
39 OUT UINTN
*SectionDataSize
43 Find free spi protect register and write to it to protect a flash region.
45 @param DirectValue Value to directly write to register.
46 if DirectValue == 0 the use Base & Length below.
47 @param BaseAddress Base address of region in Flash Memory Map.
48 @param Length Length of region to protect.
50 @retval EFI_SUCCESS Free spi protect register found & written.
51 @retval EFI_NOT_FOUND Free Spi protect register not found.
52 @retval EFI_DEVICE_ERROR Unable to write to spi protect register.
57 PlatformWriteFirstFreeSpiProtect (
58 IN CONST UINT32 DirectValue
,
59 IN CONST UINT32 BaseAddress
,
60 IN CONST UINT32 Length
64 Lock legacy SPI static configuration information.
66 Function will assert if unable to lock config.
71 PlatformFlashLockConfig (
76 Lock regions and config of SPI flash given the policy for this platform.
78 Function will assert if unable to lock regions or config.
80 @param PreBootPolicy If TRUE do Pre Boot Flash Lock Policy.
85 PlatformFlashLockPolicy (
86 IN CONST BOOLEAN PreBootPolicy
89 /** Check if System booted with recovery Boot Stage1 image.
91 @retval TRUE If system booted with recovery Boot Stage1 image.
92 @retval FALSE If system booted with normal stage1 image.
97 PlatformIsBootWithRecoveryStage1 (
102 Clear SPI Protect registers.
104 @retval EFI_SUCESS SPI protect registers cleared.
105 @retval EFI_ACCESS_DENIED Unable to clear SPI protect registers.
110 PlatformClearSpiProtect (
115 Determine if an SPI address range is protected.
117 @param SpiBaseAddress Base of SPI range.
118 @param Length Length of SPI range.
120 @retval TRUE Range is protected.
121 @retval FALSE Range is not protected.
125 PlatformIsSpiRangeProtected (
126 IN CONST UINT32 SpiBaseAddress
,
127 IN CONST UINT32 Length
131 Set Legacy GPIO Level
133 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
134 @param GpioNum GPIO bit to change.
135 @param HighLevel If TRUE set GPIO High else Set GPIO low.
140 PlatformLegacyGpioSetLevel (
141 IN CONST UINT32 LevelRegOffset
,
142 IN CONST UINT32 GpioNum
,
143 IN CONST BOOLEAN HighLevel
147 Get Legacy GPIO Level
149 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
150 @param GpioNum GPIO bit to check.
152 @retval TRUE If bit is SET.
153 @retval FALSE If bit is CLEAR.
158 PlatformLegacyGpioGetLevel (
159 IN CONST UINT32 LevelRegOffset
,
160 IN CONST UINT32 GpioNum
164 Set the direction of Pcal9555 IO Expander GPIO pin.
166 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
167 @param GpioNum Gpio direction to configure - values 0-7 for Port0
169 @param CfgAsInput If TRUE set pin direction as input else set as output.
174 PlatformPcal9555GpioSetDir (
175 IN CONST UINT32 Pcal9555SlaveAddr
,
176 IN CONST UINT32 GpioNum
,
177 IN CONST BOOLEAN CfgAsInput
181 Set the level of Pcal9555 IO Expander GPIO high or low.
183 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
184 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
186 @param HighLevel If TRUE set pin high else set pin low.
191 PlatformPcal9555GpioSetLevel (
192 IN CONST UINT32 Pcal9555SlaveAddr
,
193 IN CONST UINT32 GpioNum
,
194 IN CONST BOOLEAN HighLevel
199 Enable pull-up/pull-down resistors of Pcal9555 GPIOs.
201 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
202 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
208 PlatformPcal9555GpioEnablePull (
209 IN CONST UINT32 Pcal9555SlaveAddr
,
210 IN CONST UINT32 GpioNum
215 Disable pull-up/pull-down resistors of Pcal9555 GPIOs.
217 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
218 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
224 PlatformPcal9555GpioDisablePull (
225 IN CONST UINT32 Pcal9555SlaveAddr
,
226 IN CONST UINT32 GpioNum
231 PlatformPcal9555GpioGetState (
232 IN CONST UINT32 Pcal9555SlaveAddr
,
233 IN CONST UINT32 GpioNum
237 Init platform LEDs into known state.
239 @param PlatformType Executing platform type.
241 @retval EFI_SUCCESS Operation success.
247 IN CONST EFI_PLATFORM_TYPE Type
251 Turn on or off platform flash update LED.
253 @param PlatformType Executing platform type.
254 @param TurnOn If TRUE turn on else turn off.
256 @retval EFI_SUCCESS Operation success.
261 PlatformFlashUpdateLed (
262 IN CONST EFI_PLATFORM_TYPE Type
,
263 IN CONST BOOLEAN TurnOn
266 #endif // #ifndef __PLATFORM_HELPER_LIB_H__