2009-03-04 02:05:31 +01:00
|
|
|
/** @file
|
|
|
|
The EFI_SWAP_ADDRESS_RANGE_PROTOCOL is used to abstract the swap operation of boot block
|
2010-03-17 21:48:52 +01:00
|
|
|
and backup block of FV. This swap is especially needed when updating the boot block of FV. If a
|
2009-06-11 16:17:23 +02:00
|
|
|
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.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
2010-04-24 11:49:11 +02:00
|
|
|
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
2010-03-17 21:48:52 +01:00
|
|
|
This program and the accompanying materials are licensed and made available under
|
|
|
|
the terms and conditions of the BSD License that accompanies this distribution.
|
|
|
|
The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
|
|
|
|
2009-03-04 02:05:31 +01:00
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_
|
|
|
|
#define _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_
|
|
|
|
|
|
|
|
#define EFI_SWAP_ADDRESS_RANGE_PROTOCOL_GUID \
|
|
|
|
{ \
|
|
|
|
0x1259f60d, 0xb754, 0x468e, {0xa7, 0x89, 0x4d, 0xb8, 0x5d, 0x55, 0xe8, 0x7e } \
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Forward reference for pure ANSI compatability
|
|
|
|
//
|
|
|
|
typedef struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL EFI_SWAP_ADDRESS_RANGE_PROTOCOL;
|
|
|
|
|
|
|
|
#define EFI_UNSUPPORT_LOCK 0
|
|
|
|
#define EFI_SOFTWARE_LOCK 1
|
|
|
|
#define EFI_HARDWARE_LOCK 2
|
|
|
|
|
|
|
|
typedef UINT8 EFI_SWAP_LOCK_CAPABILITY;
|
|
|
|
|
|
|
|
//
|
2009-06-11 16:17:23 +02:00
|
|
|
// Protocol APIs
|
2009-03-04 02:05:31 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
/**
|
2009-06-11 16:17:23 +02:00
|
|
|
This function gets the address range location of
|
2009-03-04 02:05:31 +01:00
|
|
|
boot block and backup block.
|
|
|
|
|
2009-06-12 07:47:03 +02:00
|
|
|
@param This Indicates the calling context.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param BootBlockBase The base address of current boot block.
|
|
|
|
@param BootBlockSize The size (in bytes) of current boot block.
|
|
|
|
@param BackupBlockBase The base address of current backup block.
|
|
|
|
@param BackupBlockSize The size (in bytes) of current backup block.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
2009-06-12 07:47:03 +02:00
|
|
|
@retval EFI_SUCCESS The call was successful.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2010-03-05 07:31:45 +01:00
|
|
|
(EFIAPI *EFI_GET_RANGE_LOCATION)(
|
2009-06-12 07:47:03 +02:00
|
|
|
IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
|
|
|
|
OUT EFI_PHYSICAL_ADDRESS *BootBlockBase,
|
2009-03-04 02:05:31 +01:00
|
|
|
OUT UINTN *BootBlockSize,
|
2009-06-12 07:47:03 +02:00
|
|
|
OUT EFI_PHYSICAL_ADDRESS *BackupBlockBase,
|
2009-03-04 02:05:31 +01:00
|
|
|
OUT UINTN *BackupBlockSize
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This service checks if the boot block and backup block has been swapped.
|
|
|
|
|
2009-06-12 07:47:03 +02:00
|
|
|
@param This Indicates the calling context.
|
|
|
|
@param SwapState True if the boot block and backup block has been swapped.
|
|
|
|
False if the boot block and backup block has not been swapped.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
2009-06-12 07:47:03 +02:00
|
|
|
@retval EFI_SUCCESS The call was successful.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2010-03-05 07:31:45 +01:00
|
|
|
(EFIAPI *EFI_GET_SWAP_STATE)(
|
2009-06-12 07:47:03 +02:00
|
|
|
IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
|
2009-03-04 02:05:31 +01:00
|
|
|
OUT BOOLEAN *SwapState
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This service swaps the boot block and backup block, or swaps them back.
|
|
|
|
|
2009-06-11 16:17:23 +02:00
|
|
|
It also acquires and releases software swap lock during operation. The setting of the new swap state
|
2009-03-04 02:05:31 +01:00
|
|
|
is not affected by the old swap state.
|
|
|
|
|
2009-06-12 07:47:03 +02:00
|
|
|
@param This Indicates the calling context.
|
|
|
|
@param NewSwapState True to swap real boot block and backup block, False to swap them back.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
2009-06-12 07:47:03 +02:00
|
|
|
@retval EFI_SUCCESS The call was successful.
|
2010-03-17 21:48:52 +01:00
|
|
|
@retval EFI_ABORTED Set swap state error.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2010-03-05 07:31:45 +01:00
|
|
|
(EFIAPI *EFI_SET_SWAP_STATE)(
|
2009-06-12 07:47:03 +02:00
|
|
|
IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
|
2009-03-04 02:05:31 +01:00
|
|
|
IN BOOLEAN NewSwapState
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-06-11 16:17:23 +02:00
|
|
|
This service checks if a Real Time Clock (RTC) power failure happened.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
2009-06-11 16:17:23 +02:00
|
|
|
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().
|
2009-03-04 02:05:31 +01:00
|
|
|
|
2009-06-10 07:38:20 +02:00
|
|
|
@param This Indicates the calling context.
|
2009-06-11 16:17:23 +02:00
|
|
|
@param RtcPowerFailed True if the RTC (Real Time Clock) power failed or was removed.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The call was successful.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2010-03-05 07:31:45 +01:00
|
|
|
(EFIAPI *EFI_GET_RTC_POWER_STATUS)(
|
2009-06-12 07:47:03 +02:00
|
|
|
IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
|
2009-03-04 02:05:31 +01:00
|
|
|
OUT BOOLEAN *RtcPowerFailed
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2010-03-17 21:48:52 +01:00
|
|
|
This service returns all lock methods for swap operations that the current platform
|
|
|
|
supports. Could be software lock, hardware lock, or unsupport lock.
|
2009-06-12 07:47:03 +02:00
|
|
|
Note that software and hardware lock methods can be used simultaneously.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
2009-06-10 07:38:20 +02:00
|
|
|
@param This Indicates the calling context.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param LockCapability The current lock method for swap operations.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The call was successful.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2010-03-05 07:31:45 +01:00
|
|
|
(EFIAPI *EFI_GET_SWAP_LOCK_CAPABILITY)(
|
2009-06-12 07:47:03 +02:00
|
|
|
IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
|
|
|
|
OUT EFI_SWAP_LOCK_CAPABILITY *LockCapability
|
2009-03-04 02:05:31 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-03-17 21:48:52 +01:00
|
|
|
This service is used to acquire or release appointed kind of lock for Swap Address Range operations.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
|
|
|
Note that software and hardware lock mothod can be used simultaneously.
|
|
|
|
|
2009-06-10 07:38:20 +02:00
|
|
|
@param This Indicates the calling context.
|
2009-03-04 02:05:31 +01:00
|
|
|
@param LockCapability Indicates which lock to acquire or release.
|
2010-03-17 21:48:52 +01:00
|
|
|
@param NewLockState True to acquire lock; False to release lock.
|
2009-03-04 02:05:31 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The call was successful.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2010-03-05 07:31:45 +01:00
|
|
|
(EFIAPI *EFI_SET_SWAP_LOCK)(
|
2009-06-12 07:47:03 +02:00
|
|
|
IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
|
2009-03-04 02:05:31 +01:00
|
|
|
IN EFI_SWAP_LOCK_CAPABILITY LockCapability,
|
|
|
|
IN BOOLEAN NewLockState
|
|
|
|
);
|
|
|
|
|
|
|
|
struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL {
|
|
|
|
EFI_GET_RANGE_LOCATION GetRangeLocation; // has output parameters for base and length
|
|
|
|
EFI_GET_SWAP_STATE GetSwapState; // are ranges swapped or not
|
|
|
|
EFI_SET_SWAP_STATE SetSwapState; // swap or unswap ranges
|
|
|
|
EFI_GET_RTC_POWER_STATUS GetRtcPowerStatus; // checks RTC battery, or whatever...
|
|
|
|
EFI_GET_SWAP_LOCK_CAPABILITY GetSwapLockCapability; // Get TOP_SWAP lock capability,
|
|
|
|
EFI_SET_SWAP_LOCK SetSwapLock; // Set TOP_SWAP lock state
|
|
|
|
};
|
|
|
|
|
|
|
|
extern EFI_GUID gEfiSwapAddressRangeProtocolGuid;
|
|
|
|
|
|
|
|
#endif
|