]> git.proxmox.com Git - mirror_edk2.git/blob - UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h
UefiPayloadPkg: Add SpiFlashLib
[mirror_edk2.git] / UefiPayloadPkg / Library / SpiFlashLib / RegsSpi.h
1 /** @file
2 Register names for SPI device.
3
4 Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef REGS_SPI_H_
10 #define REGS_SPI_H_
11
12 #define R_SPI_BASE 0x10 ///< 32-bit Memory Base Address Register
13 #define B_SPI_BAR0_MASK 0x0FFF
14 #define R_SPI_BCR 0xDC ///< BIOS Control Register
15 #define B_SPI_BCR_SRC (BIT3 | BIT2) ///< SPI Read Configuration (SRC)
16 #define V_SPI_BCR_SRC_PREF_DIS_CACHE_DIS 0x04 ///< Prefetch Disable, Cache Disable
17 #define B_SPI_BCR_SYNC_SS BIT8
18 #define B_SPI_BCR_BIOSWE BIT0 ///< Write Protect Disable (WPD)
19
20 ///
21 /// SPI Host Interface Registers
22 #define R_SPI_HSFS 0x04 ///< Hardware Sequencing Flash Status and Control Register(32bits)
23 #define B_SPI_HSFS_FDBC_MASK 0x3F000000 ///< Flash Data Byte Count ( <= 64), Count = (Value in this field) + 1.
24 #define N_SPI_HSFS_FDBC 24
25 #define B_SPI_HSFS_CYCLE_MASK 0x001E0000 ///< Flash Cycle.
26 #define N_SPI_HSFS_CYCLE 17
27 #define V_SPI_HSFS_CYCLE_READ 0 ///< Flash Cycle Read
28 #define V_SPI_HSFS_CYCLE_WRITE 2 ///< Flash Cycle Write
29 #define V_SPI_HSFS_CYCLE_4K_ERASE 3 ///< Flash Cycle 4K Block Erase
30 #define V_SPI_HSFS_CYCLE_64K_ERASE 4 ///< Flash Cycle 64K Sector Erase
31 #define V_SPI_HSFS_CYCLE_READ_SFDP 5 ///< Flash Cycle Read SFDP
32 #define V_SPI_HSFS_CYCLE_READ_JEDEC_ID 6 ///< Flash Cycle Read JEDEC ID
33 #define V_SPI_HSFS_CYCLE_WRITE_STATUS 7 ///< Flash Cycle Write Status
34 #define V_SPI_HSFS_CYCLE_READ_STATUS 8 ///< Flash Cycle Read Status
35 #define B_SPI_HSFS_CYCLE_FGO BIT16 ///< Flash Cycle Go.
36 #define B_SPI_HSFS_FDV BIT14 ///< Flash Descriptor Valid
37 #define B_SPI_HSFS_SCIP BIT5 ///< SPI Cycle in Progress
38 #define B_SPI_HSFS_FCERR BIT1 ///< Flash Cycle Error
39 #define B_SPI_HSFS_FDONE BIT0 ///< Flash Cycle Done
40
41
42 #define R_SPI_FADDR 0x08 ///< SPI Flash Address
43 #define B_SPI_FADDR_MASK 0x07FFFFFF ///< SPI Flash Address Mask (0~26bit)
44
45
46 #define R_SPI_FDATA00 0x10 ///< SPI Data 00 (32 bits)
47
48 #define R_SPI_FRAP 0x50 ///< SPI Flash Regions Access Permissions Register
49 #define B_SPI_FRAP_BRWA_PLATFORM BIT12 //< Region write access for Region4 PlatformData
50 #define B_SPI_FRAP_BRWA_GBE BIT11 //< Region write access for Region3 GbE
51 #define B_SPI_FRAP_BRWA_SEC BIT10 ///< Region Write Access for Region2 SEC
52 #define B_SPI_FRAP_BRWA_BIOS BIT9 ///< Region Write Access for Region1 BIOS
53 #define B_SPI_FRAP_BRWA_FLASHD BIT8 ///< Region Write Access for Region0 Flash Descriptor
54 #define B_SPI_FRAP_BRRA_PLATFORM BIT4 ///< Region read access for Region4 PlatformData
55 #define B_SPI_FRAP_BRRA_GBE BIT3 ///< Region read access for Region3 GbE
56 #define B_SPI_FRAP_BRRA_SEC BIT2 ///< Region Read Access for Region2 SEC
57 #define B_SPI_FRAP_BRRA_BIOS BIT1 ///< Region Read Access for Region1 BIOS
58 #define B_SPI_FRAP_BRRA_FLASHD BIT0 ///< Region Read Access for Region0 Flash Descriptor
59
60
61 #define R_SPI_FREG0_FLASHD 0x54 ///< Flash Region 0 (Flash Descriptor) (32bits)
62 #define B_SPI_FREG0_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
63 #define N_SPI_FREG0_LIMIT 4 ///< Bit 30:16 identifies address bits [26:12]
64 #define B_SPI_FREG0_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
65 #define N_SPI_FREG0_BASE 12 ///< Bit 14:0 identifies address bits [26:2]
66
67 #define R_SPI_FREG1_BIOS 0x58 ///< Flash Region 1 (BIOS) (32bits)
68 #define B_SPI_FREG1_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
69 #define N_SPI_FREG1_LIMIT 4 ///< Bit 30:16 identifies address bits [26:12]
70 #define B_SPI_FREG1_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
71 #define N_SPI_FREG1_BASE 12 ///< Bit 14:0 identifies address bits [26:2]
72
73 #define R_SPI_FREG2_SEC 0x5C ///< Flash Region 2 (SEC) (32bits)
74 #define B_SPI_FREG2_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
75 #define N_SPI_FREG2_LIMIT 4 //< Bit 30:16 identifies address bits [26:12]
76 #define B_SPI_FREG2_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
77 #define N_SPI_FREG2_BASE 12 //< Bit 14:0 identifies address bits [26:2]
78
79 #define R_SPI_FREG3_GBE 0x60 //< Flash Region 3(GbE)(32bits)
80 #define B_SPI_FREG3_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
81 #define N_SPI_FREG3_LIMIT 4 //< Bit 30:16 identifies address bits [26:12]
82 #define B_SPI_FREG3_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
83 #define N_SPI_FREG3_BASE 12 //< Bit 14:0 identifies address bits [26:2]
84
85 #define R_SPI_FREG4_PLATFORM_DATA 0x64 ///< Flash Region 4 (Platform Data) (32bits)
86 #define B_SPI_FREG4_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
87 #define N_SPI_FREG4_LIMIT 4 ///< Bit 30:16 identifies address bits [26:12]
88 #define B_SPI_FREG4_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
89 #define N_SPI_FREG4_BASE 12 ///< Bit 14:0 identifies address bits [26:2]
90
91
92 #define S_SPI_FREGX 4 ///< Size of Flash Region register
93 #define B_SPI_FREGX_LIMIT_MASK 0x7FFF0000 ///< Flash Region Limit [30:16] represents [26:12], [11:0] are assumed to be FFFh
94 #define N_SPI_FREGX_LIMIT 16 ///< Region limit bit position
95 #define N_SPI_FREGX_LIMIT_REPR 12 ///< Region limit bit represents position
96 #define B_SPI_FREGX_BASE_MASK 0x00007FFF ///< Flash Region Base, [14:0] represents [26:12]
97
98
99 #define R_SPI_FDOC 0xB4 ///< Flash Descriptor Observability Control Register (32 bits)
100 #define B_SPI_FDOC_FDSS_MASK (BIT14 | BIT13 | BIT12) ///< Flash Descriptor Section Select
101 #define V_SPI_FDOC_FDSS_FSDM 0x0000 ///< Flash Signature and Descriptor Map
102 #define V_SPI_FDOC_FDSS_COMP 0x1000 ///< Component
103 #define B_SPI_FDOC_FDSI_MASK 0x0FFC ///< Flash Descriptor Section Index
104
105 #define R_SPI_FDOD 0xB8 ///< Flash Descriptor Observability Data Register (32 bits)
106
107
108 #define R_SPI_LVSCC 0xC4 ///<Vendor Specific Component Capabilities for Component 0 (32 bits)
109 #define B_SPI_LVSCC_EO_64K BIT29 ///<< 64k Erase valid (EO_64k_valid)
110
111 #define R_SPI_UVSCC 0xC8 ///< Vendor Specific Component Capabilities for Component 1 (32 bits)
112
113
114 #define R_SPI_FDBAR_FLASH_MAP0 0x14 ///< Flash MAP 0
115 #define N_SPI_FDBAR_NC 8 ///<< Number Of Components
116 #define B_SPI_FDBAR_NC 0x00000300 ///< Number Of Components
117
118 #define R_SPI_FDBAR_FLASH_MAP1 0x18 ///< Flash MAP 1
119 #define B_SPI_FDBAR_FPSBA 0x00FF0000 ///< Flash Strap Base Address
120
121
122 //
123 // Flash Component Base Address (FCBA) from Flash Region 0
124 //
125 #define R_SPI_FCBA_FLCOMP 0x00 ///< Flash Components Register
126 #define B_SPI_FLCOMP_COMP1_MASK 0x0F ///< Flash Component 1 Density
127
128
129 #endif