123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- /** @file
- PlatformHelperLib function prototype definitions.
- Copyright (c) 2013 - 2016 Intel Corporation.
- SPDX-License-Identifier: BSD-2-Clause-Patent
- **/
- #ifndef __PLATFORM_HELPER_LIB_H__
- #define __PLATFORM_HELPER_LIB_H__
- #include "Platform.h"
- //
- // Function prototypes for routines exported by this library.
- //
- /**
- Find pointer to RAW data in Firmware volume file.
- @param FvNameGuid Firmware volume to search. If == NULL search all.
- @param FileNameGuid Firmware volume file to search for.
- @param SectionData Pointer to RAW data section of found file.
- @param SectionDataSize Pointer to UNITN to get size of RAW data.
- @retval EFI_SUCCESS Raw Data found.
- @retval EFI_INVALID_PARAMETER FileNameGuid == NULL.
- @retval EFI_NOT_FOUND Firmware volume file not found.
- @retval EFI_UNSUPPORTED Unsupported in current enviroment (PEI or DXE).
- **/
- EFI_STATUS
- EFIAPI
- PlatformFindFvFileRawDataSection (
- IN CONST EFI_GUID *FvNameGuid OPTIONAL,
- IN CONST EFI_GUID *FileNameGuid,
- OUT VOID **SectionData,
- OUT UINTN *SectionDataSize
- );
- /**
- Find free spi protect register and write to it to protect a flash region.
- @param DirectValue Value to directly write to register.
- if DirectValue == 0 the use Base & Length below.
- @param BaseAddress Base address of region in Flash Memory Map.
- @param Length Length of region to protect.
- @retval EFI_SUCCESS Free spi protect register found & written.
- @retval EFI_NOT_FOUND Free Spi protect register not found.
- @retval EFI_DEVICE_ERROR Unable to write to spi protect register.
- **/
- EFI_STATUS
- EFIAPI
- PlatformWriteFirstFreeSpiProtect (
- IN CONST UINT32 DirectValue,
- IN CONST UINT32 BaseAddress,
- IN CONST UINT32 Length
- );
- /**
- Lock legacy SPI static configuration information.
- Function will assert if unable to lock config.
- **/
- VOID
- EFIAPI
- PlatformFlashLockConfig (
- VOID
- );
- /**
- Lock regions and config of SPI flash given the policy for this platform.
- Function will assert if unable to lock regions or config.
- @param PreBootPolicy If TRUE do Pre Boot Flash Lock Policy.
- **/
- VOID
- EFIAPI
- PlatformFlashLockPolicy (
- IN CONST BOOLEAN PreBootPolicy
- );
- /** Check if System booted with recovery Boot Stage1 image.
- @retval TRUE If system booted with recovery Boot Stage1 image.
- @retval FALSE If system booted with normal stage1 image.
- **/
- BOOLEAN
- EFIAPI
- PlatformIsBootWithRecoveryStage1 (
- VOID
- );
- /**
- Clear SPI Protect registers.
- @retval EFI_SUCESS SPI protect registers cleared.
- @retval EFI_ACCESS_DENIED Unable to clear SPI protect registers.
- **/
- EFI_STATUS
- EFIAPI
- PlatformClearSpiProtect (
- VOID
- );
- /**
- Determine if an SPI address range is protected.
- @param SpiBaseAddress Base of SPI range.
- @param Length Length of SPI range.
- @retval TRUE Range is protected.
- @retval FALSE Range is not protected.
- **/
- BOOLEAN
- EFIAPI
- PlatformIsSpiRangeProtected (
- IN CONST UINT32 SpiBaseAddress,
- IN CONST UINT32 Length
- );
- /**
- Set Legacy GPIO Level
- @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
- @param GpioNum GPIO bit to change.
- @param HighLevel If TRUE set GPIO High else Set GPIO low.
- **/
- VOID
- EFIAPI
- PlatformLegacyGpioSetLevel (
- IN CONST UINT32 LevelRegOffset,
- IN CONST UINT32 GpioNum,
- IN CONST BOOLEAN HighLevel
- );
- /**
- Get Legacy GPIO Level
- @param LevelRegOffset GPIO level register Offset from GPIO Base Address.
- @param GpioNum GPIO bit to check.
- @retval TRUE If bit is SET.
- @retval FALSE If bit is CLEAR.
- **/
- BOOLEAN
- EFIAPI
- PlatformLegacyGpioGetLevel (
- IN CONST UINT32 LevelRegOffset,
- IN CONST UINT32 GpioNum
- );
- /**
- Set the direction of Pcal9555 IO Expander GPIO pin.
- @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
- @param GpioNum Gpio direction to configure - values 0-7 for Port0
- and 8-15 for Port1.
- @param CfgAsInput If TRUE set pin direction as input else set as output.
- **/
- VOID
- EFIAPI
- PlatformPcal9555GpioSetDir (
- IN CONST UINT32 Pcal9555SlaveAddr,
- IN CONST UINT32 GpioNum,
- IN CONST BOOLEAN CfgAsInput
- );
- /**
- Set the level of Pcal9555 IO Expander GPIO high or low.
- @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
- @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
- for Port1.
- @param HighLevel If TRUE set pin high else set pin low.
- **/
- VOID
- EFIAPI
- PlatformPcal9555GpioSetLevel (
- IN CONST UINT32 Pcal9555SlaveAddr,
- IN CONST UINT32 GpioNum,
- IN CONST BOOLEAN HighLevel
- );
- /**
- Enable pull-up/pull-down resistors of Pcal9555 GPIOs.
- @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
- @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
- for Port1.
- **/
- VOID
- EFIAPI
- PlatformPcal9555GpioEnablePull (
- IN CONST UINT32 Pcal9555SlaveAddr,
- IN CONST UINT32 GpioNum
- );
- /**
- Disable pull-up/pull-down resistors of Pcal9555 GPIOs.
- @param Pcal9555SlaveAddr I2c Slave address of Pcal9555 Io Expander.
- @param GpioNum Gpio to change values 0-7 for Port0 and 8-15
- for Port1.
- **/
- VOID
- EFIAPI
- PlatformPcal9555GpioDisablePull (
- IN CONST UINT32 Pcal9555SlaveAddr,
- IN CONST UINT32 GpioNum
- );
- BOOLEAN
- EFIAPI
- PlatformPcal9555GpioGetState (
- IN CONST UINT32 Pcal9555SlaveAddr,
- IN CONST UINT32 GpioNum
- );
- /**
- Init platform LEDs into known state.
- @param PlatformType Executing platform type.
- @retval EFI_SUCCESS Operation success.
- **/
- EFI_STATUS
- EFIAPI
- PlatformLedInit (
- IN CONST EFI_PLATFORM_TYPE Type
- );
- /**
- Turn on or off platform flash update LED.
- @param PlatformType Executing platform type.
- @param TurnOn If TRUE turn on else turn off.
- @retval EFI_SUCCESS Operation success.
- **/
- EFI_STATUS
- EFIAPI
- PlatformFlashUpdateLed (
- IN CONST EFI_PLATFORM_TYPE Type,
- IN CONST BOOLEAN TurnOn
- );
- #endif // #ifndef __PLATFORM_HELPER_LIB_H__
|