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

Go to the source code of this file.

Data Structures

struct  _EFI_LEGACY_SPI_CONTROLLER_PROTOCOL
 

Macros

#define EFI_LEGACY_SPI_CONTROLLER_GUID
 

Typedefs

typedef struct _EFI_LEGACY_SPI_CONTROLLER_PROTOCOL EFI_LEGACY_SPI_CONTROLLER_PROTOCOL
 
typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_ERASE_BLOCK_OPCODE) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT8 EraseBlockOpcode)
 
typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_WRITE_STATUS_PREFIX) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT8 WriteStatusPrefix)
 
typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_BIOS_BASE_ADDRESS) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT32 BiosBaseAddress)
 
typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_CLEAR_SPI_PROTECT) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This)
 
typedef BOOLEAN(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_IS_RANGE_PROTECTED) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT32 BiosAddress, IN UINT32 BlocksToProtect)
 
typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_PROTECT_NEXT_RANGE) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT32 BiosAddress, IN UINT32 BlocksToProtect)
 
typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_LOCK_CONTROLLER) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This)
 

Variables

EFI_GUID gEfiLegacySpiControllerProtocolGuid
 

Detailed Description

This file defines the Legacy SPI Controller 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 LegacySpiController.h.

Macro Definition Documentation

◆ EFI_LEGACY_SPI_CONTROLLER_GUID

#define EFI_LEGACY_SPI_CONTROLLER_GUID
Value:
{ 0x39136fc7, 0x1a11, 0x49de, \
{ 0xbf, 0x35, 0x0e, 0x78, 0xdd, 0xb5, 0x24, 0xfc }}

Note: The UEFI PI 1.6 specification uses the character 'l' in the GUID definition. This definition assumes it was supposed to be '1'.

Global ID for the Legacy SPI Controller Protocol

Definition at line 21 of file LegacySpiController.h.

Typedef Documentation

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_BIOS_BASE_ADDRESS

typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_BIOS_BASE_ADDRESS) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT32 BiosBaseAddress)

Set the BIOS base address.

This routine must be called at or below TPL_NOTIFY. The BIOS base address works with the protect range registers to protect portions of the SPI NOR flash from erase and write operat ions. The BIOS calls this API prior to passing control to the OS loader.

Parameters
[in]ThisPointer to an EFI_LEGACY_SPI_CONTROLLER_PROTOCOL structure.
[in]BiosBaseAddressThe BIOS base address.
Return values
EFI_SUCCESSThe BIOS base address was properly set
EFI_ACCESS_ERRORThe SPI controller is locked
EFI_INVALID_PARAMETERThe BIOS base address is greater than This->Maxi.mumOffset
EFI_UNSUPPORTEDThe BIOS base address was already set

Definition at line 98 of file LegacySpiController.h.

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_CLEAR_SPI_PROTECT

typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_CLEAR_SPI_PROTECT) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This)

Clear the SPI protect range registers.

This routine must be called at or below TPL_NOTIFY. The BIOS uses this routine to set an initial condition on the SPI protect range registers.

Parameters
[in]ThisPointer to an EFI_LEGACY_SPI_CONTROLLER_PROTOCOL structure.
Return values
EFI_SUCCESSThe registers were successfully cleared
EFI_ACCESS_ERRORThe SPI controller is locked

Definition at line 118 of file LegacySpiController.h.

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_ERASE_BLOCK_OPCODE

typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_ERASE_BLOCK_OPCODE) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT8 EraseBlockOpcode)

Set the erase block opcode.

This routine must be called at or below TPL_NOTIFY. The menu table contains SPI transaction opcodes which are accessible after the legacy SPI flash controller's configuration is locked. The board layer specifies the erase block size for the SPI NOR flash part. The SPI NOR flash peripheral driver selects the erase block opcode which matches the erase block size and uses this API to load the opcode into the opcode menu table.

Parameters
[in]ThisPointer to an EFI_LEGACY_SPI_CONTROLLER_PROTOCOL structure.
[in]EraseBlockOpcodeErase block opcode to be placed into the opcode menu table.
Return values
EFI_SUCCESSThe opcode menu table was updated
EFI_ACCESS_ERRORThe SPI controller is locked

Definition at line 48 of file LegacySpiController.h.

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_IS_RANGE_PROTECTED

typedef BOOLEAN(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_IS_RANGE_PROTECTED) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT32 BiosAddress, IN UINT32 BlocksToProtect)

Determine if the SPI range is protected.

This routine must be called at or below TPL_NOTIFY. The BIOS uses this routine to verify a range in the SPI is protected.

Parameters
[in]ThisPointer to an EFI_LEGACY_SPI_CONTROLLER_PROTOCOL structure.
[in]BiosAddressAddress within a 4 KiB block to start protecting.
[in]BytesToProtectThe number of 4 KiB blocks to protect.
Return values
TRUEThe range is protected
FALSEThe range is not protected

Definition at line 139 of file LegacySpiController.h.

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_LOCK_CONTROLLER

typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_LOCK_CONTROLLER) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This)

Lock the SPI controller configuration.

This routine must be called at or below TPL_NOTIFY. This routine locks the SPI controller's configuration so that the software is no longer able to update: Prefix table Opcode menu Opcode type table BIOS base address Protect range registers

Parameters
[in]ThisPointer to an EFI_LEGACY_SPI_CONTROLLER_PROTOCOL structure.
Return values
EFI_SUCCESSThe SPI controller was successfully locked
EFI_ALREADY_STARTEDThe SPI controller was already locked

Definition at line 197 of file LegacySpiController.h.

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_PROTECT_NEXT_RANGE

typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_PROTECT_NEXT_RANGE) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT32 BiosAddress, IN UINT32 BlocksToProtect)

Set the next protect range register.

This routine must be called at or below TPL_NOTIFY. The BIOS sets the protect range register to prevent write and erase operations to a portion of the SPI NOR flash device.

Parameters
[in]ThisPointer to an EFI_LEGACY_SPI_CONTROLLER_PROTOCOL structure.
[in]BiosAddressAddress within a 4 KiB block to start protecting.
[in]BlocksToProtectThe number of 4 KiB blocks to protect.
Return values
EFI_SUCCESSThe register was successfully updated
EFI_ACCESS_ERRORThe SPI controller is locked
EFI_INVALID_PARAMETERBiosAddress < This->BiosBaseAddress, or BlocksToProtect * 4 KiB > This->MaximumRangeBytes, or BiosAddress - This->BiosBaseAddress
  • (BlocksToProtect * 4 KiB) > This->MaximumRangeBytes
EFI_OUT_OF_RESOURCESNo protect range register available
EFI_UNSUPPORTEDCall This->SetBaseAddress because the BIOS base address is not set

Definition at line 172 of file LegacySpiController.h.

◆ EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_WRITE_STATUS_PREFIX

typedef EFI_STATUS(EFIAPI * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL_WRITE_STATUS_PREFIX) (IN CONST EFI_LEGACY_SPI_CONTROLLER_PROTOCOL *This, IN UINT8 WriteStatusPrefix)

Set the write status prefix opcode.

This routine must be called at or below TPL_NOTIFY. The prefix table contains SPI transaction write prefix opcodes which are accessible after the legacy SPI flash controller's configuration is locked. The board layer specifies the write status prefix opcode for the SPI NOR flash part. The SPI NOR flash peripheral driver uses this API to load the opcode into the prefix table.

Parameters
[in]ThisPointer to an EFI_LEGACY_SPI_CONTROLLER_PROTOCOL structure.
[in]WriteStatusPrefixPrefix opcode for the write status command.
Return values
EFI_SUCCESSThe prefix table was updated
EFI_ACCESS_ERRORThe SPI controller is locked

Definition at line 73 of file LegacySpiController.h.