TianoCore EDK2 master
Loading...
Searching...
No Matches
SpiNorFlash.h File Reference

Go to the source code of this file.

Data Structures

struct  _EFI_SPI_NOR_FLASH_PROTOCOL
 

Macros

#define EFI_SPI_NOR_FLASH_PROTOCOL_GUID
 

Typedefs

typedef struct _EFI_SPI_NOR_FLASH_PROTOCOL EFI_SPI_NOR_FLASH_PROTOCOL
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_GET_FLASH_ID) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, OUT UINT8 *Buffer)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_READ_DATA) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 FlashAddress, IN UINT32 LengthInBytes, OUT UINT8 *Buffer)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_READ_STATUS) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 LengthInBytes, OUT UINT8 *FlashStatus)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_WRITE_STATUS) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 LengthInBytes, IN UINT8 *FlashStatus)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_WRITE_DATA) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 FlashAddress, IN UINT32 LengthInBytes, IN UINT8 *Buffer)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_ERASE) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 FlashAddress, IN UINT32 BlockCount)
 

Variables

EFI_GUID gEfiSpiNorFlashProtocolGuid
 

Detailed Description

This file defines the SPI NOR Flash Protocol.

Copyright (c) 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Revision Reference:
This Protocol was introduced in UEFI PI Specification 1.6.

Definition in file SpiNorFlash.h.

Macro Definition Documentation

◆ EFI_SPI_NOR_FLASH_PROTOCOL_GUID

#define EFI_SPI_NOR_FLASH_PROTOCOL_GUID
Value:
{ 0xb57ec3fe, 0xf833, 0x4ba6, \
{ 0x85, 0x78, 0x2a, 0x7d, 0x6a, 0x87, 0x44, 0x4b }}

Global ID for the SPI NOR Flash Protocol

Definition at line 20 of file SpiNorFlash.h.

Typedef Documentation

◆ EFI_SPI_NOR_FLASH_PROTOCOL

Definition at line 24 of file SpiNorFlash.h.

◆ EFI_SPI_NOR_FLASH_PROTOCOL_ERASE

typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_ERASE) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 FlashAddress, IN UINT32 BlockCount)

Efficiently erases one or more 4KiB regions in the SPI flash.

This routine must be called at or below TPL_NOTIFY. This routine uses a combination of 4 KiB and larger blocks to erase the specified area.

Parameters
[in]ThisPointer to an EFI_SPI_NOR_FLASH_PROTOCOL data structure.
[in]FlashAddressAddress within a 4 KiB block to start erasing
[in]BlockCountNumber of 4 KiB blocks to erase
Return values
EFI_SUCCESSThe erase was completed successfully.
EFI_INVALID_PARAMETERFlashAddress >= This->FlashSize, or BlockCount * 4 KiB > This->FlashSize - FlashAddress

Definition at line 172 of file SpiNorFlash.h.

◆ EFI_SPI_NOR_FLASH_PROTOCOL_GET_FLASH_ID

typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_GET_FLASH_ID) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, OUT UINT8 *Buffer)

Read the 3 byte manufacture and device ID from the SPI flash.

This routine must be called at or below TPL_NOTIFY. This routine reads the 3 byte manufacture and device ID from the flash part filling the buffer provided.

Parameters
[in]ThisPointer to an EFI_SPI_NOR_FLASH_PROTOCOL data structure.
[out]BufferPointer to a 3 byte buffer to receive the manufacture and device ID.
Return values
EFI_SUCCESSThe manufacture and device ID was read successfully.
EFI_INVALID_PARAMETERBuffer is NULL
EFI_DEVICE_ERRORInvalid data received from SPI flash part.

Definition at line 46 of file SpiNorFlash.h.

◆ EFI_SPI_NOR_FLASH_PROTOCOL_READ_DATA

typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_READ_DATA) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 FlashAddress, IN UINT32 LengthInBytes, OUT UINT8 *Buffer)

Read data from the SPI flash.

This routine must be called at or below TPL_NOTIFY. This routine reads data from the SPI part in the buffer provided.

Parameters
[in]ThisPointer to an EFI_SPI_NOR_FLASH_PROTOCOL data structure.
[in]FlashAddressAddress in the flash to start reading
[in]LengthInBytesRead length in bytes
[out]BufferAddress of a buffer to receive the data
Return values
EFI_SUCCESSThe data was read successfully.
EFI_INVALID_PARAMETERBuffer is NULL, or FlashAddress >= This->FlashSize, or LengthInBytes > This->FlashSize - FlashAddress

Definition at line 71 of file SpiNorFlash.h.

◆ EFI_SPI_NOR_FLASH_PROTOCOL_READ_STATUS

typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_READ_STATUS) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 LengthInBytes, OUT UINT8 *FlashStatus)

Read the flash status register.

This routine must be called at or below TPL_NOTIFY. This routine reads the flash part status register.

Parameters
[in]ThisPointer to an EFI_SPI_NOR_FLASH_PROTOCOL data structure.
[in]LengthInBytesNumber of status bytes to read.
[out]FlashStatusPointer to a buffer to receive the flash status.
Return values
EFI_SUCCESSThe status register was read successfully.

Definition at line 94 of file SpiNorFlash.h.

◆ EFI_SPI_NOR_FLASH_PROTOCOL_WRITE_DATA

typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_WRITE_DATA) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 FlashAddress, IN UINT32 LengthInBytes, IN UINT8 *Buffer)

Write data to the SPI flash.

This routine must be called at or below TPL_NOTIFY. This routine breaks up the write operation as necessary to write the data to the SPI part.

Parameters
[in]ThisPointer to an EFI_SPI_NOR_FLASH_PROTOCOL data structure.
[in]FlashAddressAddress in the flash to start writing
[in]LengthInBytesWrite length in bytes
[in]BufferAddress of a buffer containing the data
Return values
EFI_SUCCESSThe data was written successfully.
EFI_INVALID_PARAMETERBuffer is NULL, or FlashAddress >= This->FlashSize, or LengthInBytes > This->FlashSize - FlashAddress
EFI_OUT_OF_RESOURCESInsufficient memory to copy buffer.

Definition at line 145 of file SpiNorFlash.h.

◆ EFI_SPI_NOR_FLASH_PROTOCOL_WRITE_STATUS

typedef EFI_STATUS(EFIAPI * EFI_SPI_NOR_FLASH_PROTOCOL_WRITE_STATUS) (IN CONST EFI_SPI_NOR_FLASH_PROTOCOL *This, IN UINT32 LengthInBytes, IN UINT8 *FlashStatus)

Write the flash status register.

This routine must be called at or below TPL_N OTIFY. This routine writes the flash part status register.

Parameters
[in]ThisPointer to an EFI_SPI_NOR_FLASH_PROTOCOL data structure.
[in]LengthInBytesNumber of status bytes to write.
[in]FlashStatusPointer to a buffer containing the new status.
Return values
EFI_SUCCESSThe status write was successful.
EFI_OUT_OF_RESOURCESFailed to allocate the write buffer.

Definition at line 117 of file SpiNorFlash.h.