TianoCore EDK2 master
Loading...
Searching...
No Matches
SpiCommon.h
Go to the documentation of this file.
1
9#ifndef SPI_COMMON_LIB_H_
10#define SPI_COMMON_LIB_H_
11
12#include <PiDxe.h>
13#include <Uefi/UefiBaseType.h>
15#include <Library/IoLib.h>
16#include <Library/DebugLib.h>
18#include <Library/SpiFlashLib.h>
20#include <Library/BaseLib.h>
21#include <Library/HobLib.h>
22#include <Library/TimerLib.h>
24#include "RegsSpi.h"
25
31#define WAIT_TIME 6000000
32#define WAIT_PERIOD 10
33
37typedef enum {
38 FlashCycleRead,
39 FlashCycleWrite,
40 FlashCycleErase,
41 FlashCycleReadSfdp,
42 FlashCycleReadJedecId,
43 FlashCycleWriteStatus,
44 FlashCycleReadStatus,
45 FlashCycleMax
47
51typedef enum {
52 FlashComponent0,
53 FlashComponent1,
54 FlashComponentMax
56
60#define SC_SPI_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'S', 'P', 'I')
61
62typedef struct {
63 UINTN Signature;
64 EFI_HANDLE Handle;
65 UINT32 AcpiTmrReg;
66 UINTN PchSpiBase;
67 UINT16 RegionPermission;
68 UINT32 SfdpVscc0Value;
69 UINT32 SfdpVscc1Value;
70 UINT32 StrapBaseAddress;
71 UINT8 NumberOfComponents;
72 UINT16 Flags;
73 UINT32 Component1StartAddr;
75
84UINT32
86 IN UINTN PchSpiBase
87 );
88
97VOID
99 IN UINTN PchSpiBase
100 );
101
113EFIAPI
115 IN UINTN PchSpiBase,
116 IN UINT8 CpuSmmBwp
117 );
118
128VOID
129EFIAPI
131 IN UINTN PchSpiBase,
132 IN UINT8 CpuSmmBwp
133 );
134
144UINT8
146 IN UINTN PchSpiBase
147 );
148
158VOID
160 IN UINTN PchSpiBase,
161 IN UINT8 BiosCtlValue
162 );
163
180 IN FLASH_REGION_TYPE FlashRegionType,
181 IN FLASH_CYCLE_TYPE FlashCycleType,
182 IN UINT32 Address,
183 IN UINT32 ByteCount,
184 IN OUT UINT8 *Buffer
185 );
186
197BOOLEAN
199 IN UINT32 PchSpiBar0,
200 IN BOOLEAN ErrorCheck
201 );
202
203#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
BOOLEAN WaitForSpiCycleComplete(IN UINT32 PchSpiBar0, IN BOOLEAN ErrorCheck)
Definition: SpiFlashLib.c:774
UINT8 SaveAndDisableSpiPrefetchCache(IN UINTN PchSpiBase)
Definition: PchSpi.c:139
VOID EFIAPI EnableBiosWriteProtect(IN UINTN PchSpiBase, IN UINT8 CpuSmmBwp)
Definition: PchSpi.c:114
EFI_STATUS EFIAPI DisableBiosWriteProtect(IN UINTN PchSpiBase, IN UINT8 CpuSmmBwp)
Definition: PchSpi.c:83
FLASH_CYCLE_TYPE
Definition: SpiCommon.h:37
VOID SetSpiBiosControlRegister(IN UINTN PchSpiBase, IN UINT8 BiosCtlValue)
Definition: PchSpi.c:164
EFI_STATUS SendSpiCmd(IN FLASH_REGION_TYPE FlashRegionType, IN FLASH_CYCLE_TYPE FlashCycleType, IN UINT32 Address, IN UINT32 ByteCount, IN OUT UINT8 *Buffer)
Definition: SpiFlashLib.c:419
FLASH_COMPONENT_NUM
Definition: SpiCommon.h:51
UINT32 AcquireSpiBar0(IN UINTN PchSpiBase)
Definition: PchSpi.c:18
VOID ReleaseSpiBar0(IN UINTN PchSpiBase)
Definition: PchSpi.c:32
FLASH_REGION_TYPE
Definition: SpiFlashLib.h:15
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33