12. SMM SPI Protocol Stack
12.1. Design
The design of the SPI protocol stack is almost identical between SMM and DXE. See the section on SPI Protocol Stack in Volume 5 for more details. The differences are described in this section.
SMM SPI support is primarily used to support SPI flash devices. Since SMM does not support device paths, there is no mechanism to identify a SPI controller and properly connect it to the corresponding bus in the board database. As such, only a single SPI host controller is allowed in SMM. The SMM version of the SPI bus driver connects to the first and only SPI host controller identified by gEfiSpiSmmHcProtocolGuid.
A separate SMM specific SPI configuration database is provided by the board layer. The SMM SPI bus driver connects to the SMM version of the SPI configuration database identified by gEfiSpiSmmConfigurationProtocolGuid. The SMM version of the SPI bus driver verifies that there is a single bus in the SMM version of the board database and connects this to the SPI controller.
The SPI protocol declarations are identical between SMM and DXE but SMM uses different GUIDs to identify the SPI protocols for SMM.
12.2. SMM SPI Protocols
12.2.1. EFI_LEGACY_SPI_SMM_FLASH_PROTOCOL_GUID
// {Se3848d4-0db5-4fc0-9729-3f353d4f879f}
#define EFI_LEGACY_SPI_SMM_FLASH_PROTOCOL \
{ 0x5e3848d4, 0x0db5, 0x4fc0, { 0x97, 0x29, 0x3f, 0x35, \
0x3d, 0x4f, 0x87, 0x9f }}
12.2.2. EFI_SPI_SMM_NOR_FLASH_PROTOCOL_GUID
// {aab18f19-fe14-4666-8604-87ff6d662c9a}
#define EFI_SPI_SMM_NOR_FLASH_PROTOCOL \
{ 0xaab18f19, 0xfe14, 0x4666, { 0x86, 0x04, 0x87, 0xff, \ 0x6d, 0x66, 0x2c, 0x9a }}
SSM Flash Driver GUID
Use a pointer to gEfiSpiSmmNorFlashDriverGuid in the EFI_SPI_PERIPHERAL structure to connect a SPI NOR flash part to the SMM SPI flash driver.
12.2.3. EFI_SPI_SMM_CONFIGURATION_PROTOCOL_GUID
// {995c6eca-171b-45fd-a3aa-fd4c9c9def59}
#define EFI_SPI_SMM_CONFIGURATION_PROTOCOL \
{ 0x995c6eca, 0x171b, 0x45fd, { 0xa3, 0xaa, 0xfd, 0x4c, \
0x9c, 0x9d, 0xef, 0x59 }}
12.2.4. EFI_SPI_SMM_HC_PROTOCOL_GUID
// {e9f02217-2093-4470-8a54-5c2cffe73ecb}
#define EFI_SPI_SMM_HC_PROTOCOL \
{ 0xe9f02217, 0x2093, 0x4470, { 0x8a, 0x54, 0x5c, 0x2c, \ 0xff, 0xe7, 0x3e, 0xcb }}
12.2.5. EFI LEGACY_SPI_SMM_CONTROLLER_PROTOCOL_GUID
// {62331b78-d8d0-4c8c-8ccb-d27dfe32db9b}
#define EFI_LEGACY_SPI_SMM_CONTROLLER_GUID \
{ 0x62331b78, 0xd8d0, 0x4c8c, { 0x8c, 0xcb, 0xd2, 0x7d, \ 0xfe, 0x32, 0xdb, 0x9b }}
12.2.6. EFI_LEGACY_SPI_SMM_CONTROLLER_PROTOCOL_GUID
// {62331b78-d8d0-4c8c-8ccb-d27dfe32db9b}
#define EFI_LEGACY_SPI_SMM_CONTROLLER_GUID \
{ 0x62331b78, 0xd8d0, 0x4c8c, { 0x8c, 0xcb, 0xd2, 0x7d, \
0xfe, 0x32, 0xdb, 0x9b }}
12.2.7. EFI_SPI_SMM_NOR_FLASH_BLOCK_MAP_PROTOCOL_GUID
// {ADB71277-4754-4FFE-9836-0623BFA9DF77}
#define EFI_SPI_SMM_NOR_FLASH_BLOCK_MAP_GUID \
{ 0xADB71277, 0x4754, 0x4FFE, { 0x98, 0x36, 0x06, 0x23, 0xBF, 0xA9, 0xDF, 0x77 } }