TianoCore EDK2 master
Loading...
Searching...
No Matches
SpiNorFlashJedecSfdpInternal.h
Go to the documentation of this file.
1
10#ifndef SPI_NOR_FLASH_INSTANCE_H_
11#define SPI_NOR_FLASH_INSTANCE_H_
12
13#include <PiDxe.h>
15#include <Protocol/SpiIo.h>
17
18#define SPI_NOR_FLASH_SIGNATURE SIGNATURE_32 ('s', 'n', 'f', 'm')
19
20#define SPI_NOR_FLASH_FROM_THIS(a) CR (a, SPI_NOR_FLASH_INSTANCE, Protocol, SPI_NOR_FLASH_SIGNATURE)
21
22typedef struct {
25 UINT8 ModeClocks;
26 UINT8 WaitStates;
28
29typedef struct {
31 UINT16 EraseType;
37 UINT64 EraseTimeout;
39
40typedef enum {
41 SearchEraseTypeByType = 1,
42 SearchEraseTypeByCommand,
43 SearchEraseTypeBySize,
44 SearchEraseTypeBySmallestSize,
45 SearchEraseTypeByBiggestSize
46} SFDP_SEARCH_ERASE_TYPE;
47
48typedef struct {
57
58typedef struct {
63 UINT32 SectorSize;
65 UINT8 SupportedEraseType[SFDP_ERASE_TYPES_NUMBER];
69
70typedef struct {
76
77typedef struct {
78 UINTN Signature;
79 EFI_HANDLE Handle;
82 UINT32 SfdpBasicFlashByteCount;
83 UINT32 SfdpSectorMapByteCount;
84 SFDP_BASIC_FLASH_PARAMETER *SfdpBasicFlash;
85 SFDP_SECTOR_MAP_TABLE *SfdpFlashSectorMap;
86 UINT8 *SpiTransactionWriteBuffer;
87 UINT32 SpiTransactionWriteBufferIndex;
88 //
89 // SFDP information.
90 //
94
95 //
96 // This is a linked list in which the Fast Read capability tables
97 // are linked from the low performance transfer to higher performance
98 // transfer. The SPI read would use the first Fast Read entry for
99 // SPI read operation.
100 //
101 LIST_ENTRY FastReadTableList;
102
107 //
108 // Below is the linked list of flash device sector
109 // map configuration detection command and map descriptors.
110 //
121
139 IN SPI_NOR_FLASH_INSTANCE *Instance,
140 IN OUT UINT8 *FastReadInstruction,
141 IN OUT UINT8 *FastReadOperationClock,
142 IN OUT UINT8 *FastReadDummyClocks
143 );
144
160 IN SPI_NOR_FLASH_INSTANCE *Instance
161 );
162
178 IN SPI_NOR_FLASH_INSTANCE *Instance
179 );
180
191UINT32
193 IN SPI_NOR_FLASH_INSTANCE *Instance
194 );
195
209ReadSfdp (
210 IN SPI_NOR_FLASH_INSTANCE *Instance
211 );
212
225 IN SPI_NOR_FLASH_INSTANCE *Instance
226 );
227
252 IN SPI_NOR_FLASH_INSTANCE *Instance,
253 IN SFDP_SECTOR_REGION_RECORD *FlashRegion,
254 IN UINT32 FlashAddress,
255 IN UINT32 RemainingSize,
256 IN OUT UINT32 *BlockSizeToErase,
257 IN OUT UINT32 *BlockCountToErase,
258 OUT UINT8 *BlockEraseCommand,
259 OUT UINT32 *TypicalTime,
260 OUT UINT64 *MaximumTimeout
261 );
262
278 IN SPI_NOR_FLASH_INSTANCE *Instance,
279 IN UINT32 FlashAddress,
280 OUT SFDP_SECTOR_REGION_RECORD **FlashRegion
281 );
282
296 IN SPI_NOR_FLASH_INSTANCE *Instance
297 );
298
299#endif // SPI_NOR_FLASH_INSTANCE_H_
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
SPDF_CONFIGURATION_COMMAND_ADDR_LENGTH
UINT32 SfdpGetFlashSize(IN SPI_NOR_FLASH_INSTANCE *Instance)
EFI_STATUS InitialSpiNorFlashSfdpInstance(IN SPI_NOR_FLASH_INSTANCE *Instance)
EFI_STATUS ReadSfdpSectorMapParameterTable(IN SPI_NOR_FLASH_INSTANCE *Instance)
EFI_STATUS ReadSfdpBasicParameterTable(IN SPI_NOR_FLASH_INSTANCE *Instance)
EFI_STATUS ReadSfdp(IN SPI_NOR_FLASH_INSTANCE *Instance)
EFI_STATUS SetSectorEraseBlockSize(IN SPI_NOR_FLASH_INSTANCE *Instance)
EFI_STATUS GetFastReadParameter(IN SPI_NOR_FLASH_INSTANCE *Instance, IN OUT UINT8 *FastReadInstruction, IN OUT UINT8 *FastReadOperationClock, IN OUT UINT8 *FastReadDummyClocks)
EFI_STATUS GetEraseBlockAttribute(IN SPI_NOR_FLASH_INSTANCE *Instance, IN SFDP_SECTOR_REGION_RECORD *FlashRegion, IN UINT32 FlashAddress, IN UINT32 RemainingSize, IN OUT UINT32 *BlockSizeToErase, IN OUT UINT32 *BlockCountToErase, OUT UINT8 *BlockEraseCommand, OUT UINT32 *TypicalTime, OUT UINT64 *MaximumTimeout)
EFI_STATUS GetRegionByFlashAddress(IN SPI_NOR_FLASH_INSTANCE *Instance, IN UINT32 FlashAddress, OUT SFDP_SECTOR_REGION_RECORD **FlashRegion)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
LIST_ENTRY NextCommand
Link list to next detection command.
UINT8 CommandInstruction
Detection command instruction.
UINT8 LatencyInClock
Command latency in clocks.
UINT32 CommandAddress
Address to issue the command.
SPDF_CONFIGURATION_COMMAND_ADDR_LENGTH CommandAddressLength
Adddress length of detection command.
UINT8 RegionCount
The regions of this sector map configuration.
LIST_ENTRY RegionList
The linked list of the regions.
UINT8 ConfigurationId
The ID of this configuration.
LIST_ENTRY NextDescriptor
Link list to next flash map descriptor.
LIST_ENTRY NextRegion
Link list to the next region.
UINT32 RegionSectors
Sectors in this region.
UINT32 RegionAddress
Region starting address.
UINT8 SupportedEraseTypeNum
Number of erase type supported.
UINT32 SectorSize
Sector size in byte (Minimum blcok erase size)
UINT32 RegionTotalSize
Region total size in bytes.
UINT64 EraseTimeout
Maximum typical erase timeout.
UINT16 EraseType
Erase type this flash device supports.
LIST_ENTRY NextEraseType
Link list to next erase type.
UINT8 FastReadInstruction
Fast read instruction.
UINT8 WaitStates
Fast read wait dummy clocks.
LIST_ENTRY NextFastReadCap
Link list to next Fast read capability.
BOOLEAN WriteEnableLatchRequired
Wether Write Enable Latch is supported.
BOOLEAN Uniform4KEraseSupported
The flash device supoprts uniform 4K erase.
UINT32 FlashDeviceSize
The total size of this flash device.
SFDP_HEADER SfdpHeader
SFDP header.
UINT8 WriteEnableLatchCommand
Write Enable Latch command.
SFDP_SECTOR_MAP_RECORD * CurrentSectorMap
UINT8 CurrentAddressBytes
The current address bytes.
LIST_ENTRY SupportedEraseTypes
The linked list of supported erase types.