TianoCore EDK2 master
|
Go to the source code of this file.
Enumerations | |
enum | FLASH_REGION_TYPE { FlashRegionDescriptor , FlashRegionBios , FlashRegionMe , FlashRegionGbE , FlashRegionPlatformData , FlashRegionDer , FlashRegionAll , FlashRegionMax } |
Functions | |
EFI_STATUS EFIAPI | SpiFlashReadSfdp (IN UINT8 ComponentNumber, IN UINT32 ByteCount, OUT UINT8 *SfdpData) |
EFI_STATUS EFIAPI | SpiFlashReadJedecId (IN UINT8 ComponentNumber, IN UINT32 ByteCount, OUT UINT8 *JedecId) |
EFI_STATUS EFIAPI | SpiFlashWriteStatus (IN UINT32 ByteCount, IN UINT8 *StatusValue) |
EFI_STATUS EFIAPI | SpiFlashReadStatus (IN UINT32 ByteCount, OUT UINT8 *StatusValue) |
EFI_STATUS EFIAPI | SpiReadPchSoftStrap (IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT UINT8 *SoftStrapValue) |
EFI_STATUS EFIAPI | SpiFlashRead (IN FLASH_REGION_TYPE FlashRegionType, IN UINT32 Address, IN UINT32 ByteCount, OUT UINT8 *Buffer) |
EFI_STATUS EFIAPI | SpiFlashErase (IN FLASH_REGION_TYPE FlashRegionType, IN UINT32 Address, IN UINT32 ByteCount) |
EFI_STATUS EFIAPI | SpiFlashWrite (IN FLASH_REGION_TYPE FlashRegionType, IN UINT32 Address, IN UINT32 ByteCount, IN UINT8 *Buffer) |
EFI_STATUS EFIAPI | SpiConstructor (VOID) |
EFI_STATUS EFIAPI | SpiGetRegionAddress (IN FLASH_REGION_TYPE FlashRegionType, OUT UINT32 *BaseAddress OPTIONAL, OUT UINT32 *RegionSize OPTIONAL) |
PCH SPI Common Driver implements the SPI Host Controller Compatibility Interface.
Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SpiFlashLib.h.
enum FLASH_REGION_TYPE |
Flash Region Type
Definition at line 15 of file SpiFlashLib.h.
EFI_STATUS EFIAPI SpiConstructor | ( | VOID | ) |
Initialize an SPI library.
EFI_SUCCESS | The protocol instance was properly initialized |
EFI_NOT_FOUND | The expected SPI info could not be found |
Definition at line 42 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiFlashErase | ( | IN FLASH_REGION_TYPE | FlashRegionType, |
IN UINT32 | Address, | ||
IN UINT32 | ByteCount | ||
) |
Erase some area on the flash part.
[in] | FlashRegionType | The Flash Region type for flash cycle which is listed in the Descriptor. |
[in] | Address | The Flash Linear Address must fall within a region for which BIOS has access permissions. |
[in] | ByteCount | Number of bytes in the data portion of the SPI cycle. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 221 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiFlashRead | ( | IN FLASH_REGION_TYPE | FlashRegionType, |
IN UINT32 | Address, | ||
IN UINT32 | ByteCount, | ||
OUT UINT8 * | Buffer | ||
) |
Read data from the flash part.
[in] | FlashRegionType | The Flash Region type for flash cycle which is listed in the Descriptor. |
[in] | Address | The Flash Linear Address must fall within a region for which BIOS has access permissions. |
[in] | ByteCount | Number of bytes in the data portion of the SPI cycle. |
[out] | Buffer | The Pointer to caller-allocated buffer containing the dada received. It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Read data from the flash part.
[in] | FlashRegionType | The Flash Region type for flash cycle which is listed in the Descriptor. |
[in] | Address | The Flash Linear Address must fall within a region for which BIOS has access permissions. |
[in] | ByteCount | Number of bytes in the data portion of the SPI cycle. |
[out] | Buffer | The Pointer to caller-allocated buffer containing the data received. It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 168 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiFlashReadJedecId | ( | IN UINT8 | ComponentNumber, |
IN UINT32 | ByteCount, | ||
OUT UINT8 * | JedecId | ||
) |
Read Jedec Id from the flash part.
[in] | ComponentNumber | The Component Number for chip select |
[in] | ByteCount | Number of bytes in JedecId data portion of the SPI cycle, the data size is 3 typically |
[out] | JedecId | The Pointer to caller-allocated buffer containing JEDEC ID received It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 290 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiFlashReadSfdp | ( | IN UINT8 | ComponentNumber, |
IN UINT32 | ByteCount, | ||
OUT UINT8 * | SfdpData | ||
) |
Read SFDP data from the flash part.
[in] | ComponentNumber | The Component Number for chip select |
[in] | ByteCount | Number of bytes in SFDP data portion of the SPI cycle, the max number is 64 |
[out] | SfdpData | The Pointer to caller-allocated buffer containing the SFDP data received It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 247 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiFlashReadStatus | ( | IN UINT32 | ByteCount, |
OUT UINT8 * | StatusValue | ||
) |
Read status register in the flash part.
[in] | ByteCount | Number of bytes in Status data portion of the SPI cycle, the data size is 1 typically |
[out] | StatusValue | The Pointer to caller-allocated buffer containing the value of Status register received. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 354 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiFlashWrite | ( | IN FLASH_REGION_TYPE | FlashRegionType, |
IN UINT32 | Address, | ||
IN UINT32 | ByteCount, | ||
IN UINT8 * | Buffer | ||
) |
Write data to the flash part.
[in] | FlashRegionType | The Flash Region type for flash cycle which is listed in the Descriptor. |
[in] | Address | The Flash Linear Address must fall within a region for which BIOS has access permissions. |
[in] | ByteCount | Number of bytes in the data portion of the SPI cycle. |
[in] | Buffer | Pointer to caller-allocated buffer containing the data sent during the SPI cycle. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 195 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiFlashWriteStatus | ( | IN UINT32 | ByteCount, |
IN UINT8 * | StatusValue | ||
) |
Write the status register in the flash part.
[in] | ByteCount | Number of bytes in Status data portion of the SPI cycle, the data size is 1 typically |
[in] | StatusValue | The Pointer to caller-allocated buffer containing the value of Status register writing |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 331 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiGetRegionAddress | ( | IN FLASH_REGION_TYPE | FlashRegionType, |
OUT UINT32 *BaseAddress | OPTIONAL, | ||
OUT UINT32 *RegionSize | OPTIONAL | ||
) |
Get the SPI region base and size, based on the enum type
[in] | FlashRegionType | The Flash Region type for for the base address which is listed in the Descriptor. |
[out] | BaseAddress | The Flash Linear Address for the Region 'n' Base |
[out] | RegionSize | The size for the Region 'n' |
EFI_SUCCESS | Read success |
EFI_INVALID_PARAMETER | Invalid region type given |
EFI_DEVICE_ERROR | The region is not used |
Definition at line 820 of file SpiFlashLib.c.
EFI_STATUS EFIAPI SpiReadPchSoftStrap | ( | IN UINT32 | SoftStrapAddr, |
IN UINT32 | ByteCount, | ||
OUT UINT8 * | SoftStrapValue | ||
) |
Read SC Soft Strap Values
[in] | SoftStrapAddr | SC Soft Strap address offset from FPSBA. |
[in] | ByteCount | Number of bytes in SoftStrap data portion of the SPI cycle |
[out] | SoftStrapValue | The Pointer to caller-allocated buffer containing SC Soft Strap Value. It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read. |
EFI_SUCCESS | Command succeed. |
EFI_INVALID_PARAMETER | The parameters specified are not valid. |
EFI_DEVICE_ERROR | Device error, command aborts abnormally. |
Definition at line 379 of file SpiFlashLib.c.