2 PlatformHelperLib function prototype definitions.
4 Copyright (c) 2013 - 2016 Intel Corporation.
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __PLATFORM_HELPER_LIB_H__
17 #define __PLATFORM_HELPER_LIB_H__
22 // Function prototypes for routines exported by this library.
26 Find pointer to RAW data in Firmware volume file.
28 @param FvNameGuid Firmware volume to search. If == NULL search all.
29 @param FileNameGuid Firmware volume file to search for.
30 @param SectionData Pointer to RAW data section of found file.
31 @param SectionDataSize Pointer to UNITN to get size of RAW data.
33 @retval EFI_SUCCESS Raw Data found.
34 @retval EFI_INVALID_PARAMETER FileNameGuid == NULL.
35 @retval EFI_NOT_FOUND Firmware volume file not found.
36 @retval EFI_UNSUPPORTED Unsupported in current enviroment (PEI or DXE).
41 PlatformFindFvFileRawDataSection (
42 IN CONST EFI_GUID
*FvNameGuid OPTIONAL
,
43 IN CONST EFI_GUID
*FileNameGuid
,
44 OUT VOID
**SectionData
,
45 OUT UINTN
*SectionDataSize
49 Find free spi protect register and write to it to protect a flash region.
51 @param DirectValue Value to directly write to register.
52 if DirectValue == 0 the use Base & Length below.
53 @param BaseAddress Base address of region in Flash Memory Map.
54 @param Length Length of region to protect.
56 @retval EFI_SUCCESS Free spi protect register found & written.
57 @retval EFI_NOT_FOUND Free Spi protect register not found.
58 @retval EFI_DEVICE_ERROR Unable to write to spi protect register.
63 PlatformWriteFirstFreeSpiProtect (
64 IN CONST UINT32 DirectValue
,
65 IN CONST UINT32 BaseAddress
,
66 IN CONST UINT32 Length
70 Lock legacy SPI static configuration information.
72 Function will assert if unable to lock config.
77 PlatformFlashLockConfig (
82 Lock regions and config of SPI flash given the policy for this platform.
84 Function will assert if unable to lock regions or config.
86 @param PreBootPolicy If TRUE do Pre Boot Flash Lock Policy.
91 PlatformFlashLockPolicy (
92 IN CONST BOOLEAN PreBootPolicy
95 /** Check if System booted with recovery Boot Stage1 image.
97 @retval TRUE If system booted with recovery Boot Stage1 image.
98 @retval FALSE If system booted with normal stage1 image.
103 PlatformIsBootWithRecoveryStage1 (
108 Clear SPI Protect registers.
110 @retval EFI_SUCESS SPI protect registers cleared.
111 @retval EFI_ACCESS_DENIED Unable to clear SPI protect registers.
116 PlatformClearSpiProtect (
121 Determine if an SPI address range is protected.
123 @param SpiBaseAddress Base of SPI range.
124 @param Length Length of SPI range.
126 @retval TRUE Range is protected.
127 @retval FALSE Range is not protected.
131 PlatformIsSpiRangeProtected (
132 IN CONST UINT32 SpiBaseAddress
,
133 IN CONST UINT32 Length
137 Set Legacy GPIO Level
139 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
140 @param GpioNum GPIO bit to change.
141 @param HighLevel If TRUE set GPIO High else Set GPIO low.
146 PlatformLegacyGpioSetLevel (
147 IN CONST UINT32 LevelRegOffset
,
148 IN CONST UINT32 GpioNum
,
149 IN CONST BOOLEAN HighLevel
153 Get Legacy GPIO Level
155 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
156 @param GpioNum GPIO bit to check.
158 @retval TRUE If bit is SET.
159 @retval FALSE If bit is CLEAR.
164 PlatformLegacyGpioGetLevel (
165 IN CONST UINT32 LevelRegOffset
,
166 IN CONST UINT32 GpioNum
170 Set the direction of Pcal9555 IO Expander GPIO pin.
172 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
173 @param GpioNum Gpio direction to configure - values 0-7 for Port0
175 @param CfgAsInput If TRUE set pin direction as input else set as output.
180 PlatformPcal9555GpioSetDir (
181 IN CONST UINT32 Pcal9555SlaveAddr
,
182 IN CONST UINT32 GpioNum
,
183 IN CONST BOOLEAN CfgAsInput
187 Set the level of Pcal9555 IO Expander GPIO high or low.
189 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
190 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
192 @param HighLevel If TRUE set pin high else set pin low.
197 PlatformPcal9555GpioSetLevel (
198 IN CONST UINT32 Pcal9555SlaveAddr
,
199 IN CONST UINT32 GpioNum
,
200 IN CONST BOOLEAN HighLevel
205 Enable pull-up/pull-down resistors of Pcal9555 GPIOs.
207 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
208 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
214 PlatformPcal9555GpioEnablePull (
215 IN CONST UINT32 Pcal9555SlaveAddr
,
216 IN CONST UINT32 GpioNum
221 Disable pull-up/pull-down resistors of Pcal9555 GPIOs.
223 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
224 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
230 PlatformPcal9555GpioDisablePull (
231 IN CONST UINT32 Pcal9555SlaveAddr
,
232 IN CONST UINT32 GpioNum
237 PlatformPcal9555GpioGetState (
238 IN CONST UINT32 Pcal9555SlaveAddr
,
239 IN CONST UINT32 GpioNum
243 Init platform LEDs into known state.
245 @param PlatformType Executing platform type.
247 @retval EFI_SUCCESS Operation success.
253 IN CONST EFI_PLATFORM_TYPE Type
257 Turn on or off platform flash update LED.
259 @param PlatformType Executing platform type.
260 @param TurnOn If TRUE turn on else turn off.
262 @retval EFI_SUCCESS Operation success.
267 PlatformFlashUpdateLed (
268 IN CONST EFI_PLATFORM_TYPE Type
,
269 IN CONST BOOLEAN TurnOn
272 #endif // #ifndef __PLATFORM_HELPER_LIB_H__