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 Read 8bit character from debug stream.
51 Block until character is read.
53 @return 8bit character read from debug stream.
58 PlatformDebugPortGetChar8 (
63 Find free spi protect register and write to it to protect a flash region.
65 @param DirectValue Value to directly write to register.
66 if DirectValue == 0 the use Base & Length below.
67 @param BaseAddress Base address of region in Flash Memory Map.
68 @param Length Length of region to protect.
70 @retval EFI_SUCCESS Free spi protect register found & written.
71 @retval EFI_NOT_FOUND Free Spi protect register not found.
72 @retval EFI_DEVICE_ERROR Unable to write to spi protect register.
77 PlatformWriteFirstFreeSpiProtect (
78 IN CONST UINT32 DirectValue
,
79 IN CONST UINT32 BaseAddress
,
80 IN CONST UINT32 Length
84 Lock legacy SPI static configuration information.
86 Function will assert if unable to lock config.
91 PlatformFlashLockConfig (
96 Lock regions and config of SPI flash given the policy for this platform.
98 Function will assert if unable to lock regions or config.
100 @param PreBootPolicy If TRUE do Pre Boot Flash Lock Policy.
105 PlatformFlashLockPolicy (
106 IN CONST BOOLEAN PreBootPolicy
109 /** Check if System booted with recovery Boot Stage1 image.
111 @retval TRUE If system booted with recovery Boot Stage1 image.
112 @retval FALSE If system booted with normal stage1 image.
117 PlatformIsBootWithRecoveryStage1 (
122 Clear SPI Protect registers.
124 @retval EFI_SUCESS SPI protect registers cleared.
125 @retval EFI_ACCESS_DENIED Unable to clear SPI protect registers.
130 PlatformClearSpiProtect (
135 Determine if an SPI address range is protected.
137 @param SpiBaseAddress Base of SPI range.
138 @param Length Length of SPI range.
140 @retval TRUE Range is protected.
141 @retval FALSE Range is not protected.
145 PlatformIsSpiRangeProtected (
146 IN CONST UINT32 SpiBaseAddress
,
147 IN CONST UINT32 Length
151 Set Legacy GPIO Level
153 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
154 @param GpioNum GPIO bit to change.
155 @param HighLevel If TRUE set GPIO High else Set GPIO low.
160 PlatformLegacyGpioSetLevel (
161 IN CONST UINT32 LevelRegOffset
,
162 IN CONST UINT32 GpioNum
,
163 IN CONST BOOLEAN HighLevel
167 Get Legacy GPIO Level
169 @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
170 @param GpioNum GPIO bit to check.
172 @retval TRUE If bit is SET.
173 @retval FALSE If bit is CLEAR.
178 PlatformLegacyGpioGetLevel (
179 IN CONST UINT32 LevelRegOffset
,
180 IN CONST UINT32 GpioNum
184 Set the direction of Pcal9555 IO Expander GPIO pin.
186 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
187 @param GpioNum Gpio direction to configure - values 0-7 for Port0
189 @param CfgAsInput If TRUE set pin direction as input else set as output.
194 PlatformPcal9555GpioSetDir (
195 IN CONST UINT32 Pcal9555SlaveAddr
,
196 IN CONST UINT32 GpioNum
,
197 IN CONST BOOLEAN CfgAsInput
201 Set the level of Pcal9555 IO Expander GPIO high or low.
203 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
204 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
206 @param HighLevel If TRUE set pin high else set pin low.
211 PlatformPcal9555GpioSetLevel (
212 IN CONST UINT32 Pcal9555SlaveAddr
,
213 IN CONST UINT32 GpioNum
,
214 IN CONST BOOLEAN HighLevel
219 Enable pull-up/pull-down resistors of Pcal9555 GPIOs.
221 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
222 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
228 PlatformPcal9555GpioEnablePull (
229 IN CONST UINT32 Pcal9555SlaveAddr
,
230 IN CONST UINT32 GpioNum
235 Disable pull-up/pull-down resistors of Pcal9555 GPIOs.
237 @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
238 @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
244 PlatformPcal9555GpioDisablePull (
245 IN CONST UINT32 Pcal9555SlaveAddr
,
246 IN CONST UINT32 GpioNum
251 PlatformPcal9555GpioGetState (
252 IN CONST UINT32 Pcal9555SlaveAddr
,
253 IN CONST UINT32 GpioNum
257 Init platform LEDs into known state.
259 @param PlatformType Executing platform type.
261 @retval EFI_SUCCESS Operation success.
267 IN CONST EFI_PLATFORM_TYPE Type
271 Turn on or off platform flash update LED.
273 @param PlatformType Executing platform type.
274 @param TurnOn If TRUE turn on else turn off.
276 @retval EFI_SUCCESS Operation success.
281 PlatformFlashUpdateLed (
282 IN CONST EFI_PLATFORM_TYPE Type
,
283 IN CONST BOOLEAN TurnOn
286 #endif // #ifndef __PLATFORM_HELPER_LIB_H__