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

Go to the source code of this file.

Data Structures

struct  _EFI_SWAP_ADDRESS_RANGE_PROTOCOL
 

Macros

#define EFI_SWAP_ADDRESS_RANGE_PROTOCOL_GUID
 
#define EFI_UNSUPPORT_LOCK   0
 
#define EFI_SOFTWARE_LOCK   1
 
#define EFI_HARDWARE_LOCK   2
 

Typedefs

typedef struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL EFI_SWAP_ADDRESS_RANGE_PROTOCOL
 
typedef UINT8 EFI_SWAP_LOCK_CAPABILITY
 
typedef EFI_STATUS(EFIAPI * EFI_GET_RANGE_LOCATION) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT EFI_PHYSICAL_ADDRESS *BootBlockBase, OUT UINTN *BootBlockSize, OUT EFI_PHYSICAL_ADDRESS *BackupBlockBase, OUT UINTN *BackupBlockSize)
 
typedef EFI_STATUS(EFIAPI * EFI_GET_SWAP_STATE) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT BOOLEAN *SwapState)
 
typedef EFI_STATUS(EFIAPI * EFI_SET_SWAP_STATE) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, IN BOOLEAN NewSwapState)
 
typedef EFI_STATUS(EFIAPI * EFI_GET_RTC_POWER_STATUS) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT BOOLEAN *RtcPowerFailed)
 
typedef EFI_STATUS(EFIAPI * EFI_GET_SWAP_LOCK_CAPABILITY) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT EFI_SWAP_LOCK_CAPABILITY *LockCapability)
 
typedef EFI_STATUS(EFIAPI * EFI_SET_SWAP_LOCK) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, IN EFI_SWAP_LOCK_CAPABILITY LockCapability, IN BOOLEAN NewLockState)
 

Variables

EFI_GUID gEfiSwapAddressRangeProtocolGuid
 

Detailed Description

The EFI_SWAP_ADDRESS_RANGE_PROTOCOL is used to abstract the swap operation of boot block and backup block of FV. This swap is especially needed when updating the boot block of FV. If a power failure happens during the boot block update, the swapped backup block (now the boot block) can boot the machine with the old boot block backed up in it. The swap operation is platform dependent, so other protocols such as FTW (Fault Tolerant Write) should use this protocol instead of handling hardware directly.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SwapAddressRange.h.

Macro Definition Documentation

◆ EFI_HARDWARE_LOCK

#define EFI_HARDWARE_LOCK   2

Definition at line 28 of file SwapAddressRange.h.

◆ EFI_SOFTWARE_LOCK

#define EFI_SOFTWARE_LOCK   1

Definition at line 27 of file SwapAddressRange.h.

◆ EFI_SWAP_ADDRESS_RANGE_PROTOCOL_GUID

#define EFI_SWAP_ADDRESS_RANGE_PROTOCOL_GUID
Value:
{ \
0x1259f60d, 0xb754, 0x468e, {0xa7, 0x89, 0x4d, 0xb8, 0x5d, 0x55, 0xe8, 0x7e } \
}

Definition at line 16 of file SwapAddressRange.h.

◆ EFI_UNSUPPORT_LOCK

#define EFI_UNSUPPORT_LOCK   0

Definition at line 26 of file SwapAddressRange.h.

Typedef Documentation

◆ EFI_GET_RANGE_LOCATION

typedef EFI_STATUS(EFIAPI * EFI_GET_RANGE_LOCATION) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT EFI_PHYSICAL_ADDRESS *BootBlockBase, OUT UINTN *BootBlockSize, OUT EFI_PHYSICAL_ADDRESS *BackupBlockBase, OUT UINTN *BackupBlockSize)

This function gets the address range location of boot block and backup block.

Parameters
ThisIndicates the calling context.
BootBlockBaseThe base address of current boot block.
BootBlockSizeThe size (in bytes) of current boot block.
BackupBlockBaseThe base address of current backup block.
BackupBlockSizeThe size (in bytes) of current backup block.
Return values
EFI_SUCCESSThe call was successful.

Definition at line 50 of file SwapAddressRange.h.

◆ EFI_GET_RTC_POWER_STATUS

typedef EFI_STATUS(EFIAPI * EFI_GET_RTC_POWER_STATUS) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT BOOLEAN *RtcPowerFailed)

This service checks if a Real Time Clock (RTC) power failure happened.

If parameter RtcPowerFailed is true after the function returns, RTC power supply failed or was removed. It is recommended to check RTC power status before calling GetSwapState().

Parameters
ThisIndicates the calling context.
RtcPowerFailedTrue if the RTC (Real Time Clock) power failed or was removed.
Return values
EFI_SUCCESSThe call was successful.

Definition at line 109 of file SwapAddressRange.h.

◆ EFI_GET_SWAP_LOCK_CAPABILITY

typedef EFI_STATUS(EFIAPI * EFI_GET_SWAP_LOCK_CAPABILITY) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT EFI_SWAP_LOCK_CAPABILITY *LockCapability)

This service returns all lock methods for swap operations that the current platform supports. Could be software lock, hardware lock, or unsupport lock. Note that software and hardware lock methods can be used simultaneously.

Parameters
ThisIndicates the calling context.
LockCapabilityThe current lock method for swap operations.
Return values
EFI_SUCCESSThe call was successful.

Definition at line 127 of file SwapAddressRange.h.

◆ EFI_GET_SWAP_STATE

typedef EFI_STATUS(EFIAPI * EFI_GET_SWAP_STATE) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, OUT BOOLEAN *SwapState)

This service checks if the boot block and backup block has been swapped.

Parameters
ThisIndicates the calling context.
SwapStateTrue if the boot block and backup block has been swapped. False if the boot block and backup block has not been swapped.
Return values
EFI_SUCCESSThe call was successful.

Definition at line 70 of file SwapAddressRange.h.

◆ EFI_SET_SWAP_LOCK

typedef EFI_STATUS(EFIAPI * EFI_SET_SWAP_LOCK) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, IN EFI_SWAP_LOCK_CAPABILITY LockCapability, IN BOOLEAN NewLockState)

This service is used to acquire or release appointed kind of lock for Swap Address Range operations.

Note that software and hardware lock mothod can be used simultaneously.

Parameters
ThisIndicates the calling context.
LockCapabilityIndicates which lock to acquire or release.
NewLockStateTrue to acquire lock; False to release lock.
Return values
EFI_SUCCESSThe call was successful.

Definition at line 146 of file SwapAddressRange.h.

◆ EFI_SET_SWAP_STATE

typedef EFI_STATUS(EFIAPI * EFI_SET_SWAP_STATE) (IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, IN BOOLEAN NewSwapState)

This service swaps the boot block and backup block, or swaps them back.

It also acquires and releases software swap lock during operation. The setting of the new swap state is not affected by the old swap state.

Parameters
ThisIndicates the calling context.
NewSwapStateTrue to swap real boot block and backup block, False to swap them back.
Return values
EFI_SUCCESSThe call was successful.
EFI_ABORTEDSet swap state error.

Definition at line 90 of file SwapAddressRange.h.

◆ EFI_SWAP_ADDRESS_RANGE_PROTOCOL

◆ EFI_SWAP_LOCK_CAPABILITY

typedef UINT8 EFI_SWAP_LOCK_CAPABILITY

Definition at line 30 of file SwapAddressRange.h.