]>
Commit | Line | Data |
---|---|---|
85e923a5 LG |
1 | /** @file\r |
2 | The EFI_SWAP_ADDRESS_RANGE_PROTOCOL is used to abstract the swap operation of boot block \r | |
64a80549 | 3 | and backup block of FV. This swap is especially needed when updating the boot block of FV. If a \r |
e9b67286 | 4 | power failure happens during the boot block update, the swapped backup block (now the boot block) \r |
5 | can boot the machine with the old boot block backed up in it. The swap operation is platform dependent, so \r | |
6 | other protocols such as FTW (Fault Tolerant Write) should use this protocol instead of handling hardware directly.\r | |
85e923a5 | 7 | \r |
cd5ebaa0 | 8 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r |
64a80549 | 9 | This program and the accompanying materials are licensed and made available under \r |
10 | the terms and conditions of the BSD License that accompanies this distribution. \r | |
11 | The full text of the license may be found at\r | |
12 | http://opensource.org/licenses/bsd-license.php. \r | |
13 | \r | |
85e923a5 LG |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
16 | \r | |
17 | **/\r | |
18 | \r | |
19 | #ifndef _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_\r | |
20 | #define _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_\r | |
21 | \r | |
22 | #define EFI_SWAP_ADDRESS_RANGE_PROTOCOL_GUID \\r | |
23 | { \\r | |
24 | 0x1259f60d, 0xb754, 0x468e, {0xa7, 0x89, 0x4d, 0xb8, 0x5d, 0x55, 0xe8, 0x7e } \\r | |
25 | }\r | |
26 | \r | |
27 | //\r | |
28 | // Forward reference for pure ANSI compatability\r | |
29 | //\r | |
30 | typedef struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL EFI_SWAP_ADDRESS_RANGE_PROTOCOL;\r | |
31 | \r | |
32 | #define EFI_UNSUPPORT_LOCK 0\r | |
33 | #define EFI_SOFTWARE_LOCK 1\r | |
34 | #define EFI_HARDWARE_LOCK 2\r | |
35 | \r | |
36 | typedef UINT8 EFI_SWAP_LOCK_CAPABILITY;\r | |
37 | \r | |
38 | //\r | |
e9b67286 | 39 | // Protocol APIs\r |
85e923a5 LG |
40 | //\r |
41 | \r | |
42 | /**\r | |
e9b67286 | 43 | This function gets the address range location of \r |
85e923a5 LG |
44 | boot block and backup block. \r |
45 | \r | |
e40b7d5d | 46 | @param This Indicates the calling context. \r |
64a80549 | 47 | @param BootBlockBase The base address of current boot block.\r |
48 | @param BootBlockSize The size (in bytes) of current boot block.\r | |
49 | @param BackupBlockBase The base address of current backup block.\r | |
50 | @param BackupBlockSize The size (in bytes) of current backup block.\r | |
85e923a5 | 51 | \r |
e40b7d5d | 52 | @retval EFI_SUCCESS The call was successful.\r |
85e923a5 LG |
53 | \r |
54 | **/\r | |
55 | typedef\r | |
56 | EFI_STATUS\r | |
0c1a4aa6 | 57 | (EFIAPI *EFI_GET_RANGE_LOCATION)(\r |
e40b7d5d LG |
58 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,\r |
59 | OUT EFI_PHYSICAL_ADDRESS *BootBlockBase,\r | |
85e923a5 | 60 | OUT UINTN *BootBlockSize,\r |
e40b7d5d | 61 | OUT EFI_PHYSICAL_ADDRESS *BackupBlockBase,\r |
85e923a5 LG |
62 | OUT UINTN *BackupBlockSize\r |
63 | );\r | |
64 | \r | |
65 | /**\r | |
66 | This service checks if the boot block and backup block has been swapped.\r | |
67 | \r | |
e40b7d5d LG |
68 | @param This Indicates the calling context. \r |
69 | @param SwapState True if the boot block and backup block has been swapped. \r | |
70 | False if the boot block and backup block has not been swapped.\r | |
85e923a5 | 71 | \r |
e40b7d5d | 72 | @retval EFI_SUCCESS The call was successful.\r |
85e923a5 LG |
73 | \r |
74 | **/\r | |
75 | typedef\r | |
76 | EFI_STATUS\r | |
0c1a4aa6 | 77 | (EFIAPI *EFI_GET_SWAP_STATE)(\r |
e40b7d5d | 78 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,\r |
85e923a5 LG |
79 | OUT BOOLEAN *SwapState\r |
80 | );\r | |
81 | \r | |
82 | /**\r | |
83 | This service swaps the boot block and backup block, or swaps them back.\r | |
84 | \r | |
e9b67286 | 85 | It also acquires and releases software swap lock during operation. The setting of the new swap state \r |
85e923a5 LG |
86 | is not affected by the old swap state.\r |
87 | \r | |
e40b7d5d LG |
88 | @param This Indicates the calling context. \r |
89 | @param NewSwapState True to swap real boot block and backup block, False to swap them back.\r | |
85e923a5 | 90 | \r |
e40b7d5d | 91 | @retval EFI_SUCCESS The call was successful.\r |
64a80549 | 92 | @retval EFI_ABORTED Set swap state error.\r |
85e923a5 LG |
93 | \r |
94 | **/\r | |
95 | typedef\r | |
96 | EFI_STATUS\r | |
0c1a4aa6 | 97 | (EFIAPI *EFI_SET_SWAP_STATE)(\r |
e40b7d5d | 98 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,\r |
85e923a5 LG |
99 | IN BOOLEAN NewSwapState\r |
100 | );\r | |
101 | \r | |
102 | \r | |
103 | \r | |
104 | /**\r | |
e9b67286 | 105 | This service checks if a Real Time Clock (RTC) power failure happened.\r |
85e923a5 | 106 | \r |
e9b67286 | 107 | If parameter RtcPowerFailed is true after the function returns, RTC power supply failed or was removed. \r |
108 | It is recommended to check RTC power status before calling GetSwapState().\r | |
85e923a5 | 109 | \r |
b4f26bb1 | 110 | @param This Indicates the calling context. \r |
e9b67286 | 111 | @param RtcPowerFailed True if the RTC (Real Time Clock) power failed or was removed. \r |
85e923a5 LG |
112 | \r |
113 | @retval EFI_SUCCESS The call was successful.\r | |
114 | \r | |
115 | **/\r | |
116 | typedef\r | |
117 | EFI_STATUS\r | |
0c1a4aa6 | 118 | (EFIAPI *EFI_GET_RTC_POWER_STATUS)(\r |
e40b7d5d | 119 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,\r |
85e923a5 LG |
120 | OUT BOOLEAN *RtcPowerFailed\r |
121 | );\r | |
122 | \r | |
123 | /**\r | |
64a80549 | 124 | This service returns all lock methods for swap operations that the current platform \r |
125 | supports. Could be software lock, hardware lock, or unsupport lock.\r | |
e40b7d5d | 126 | Note that software and hardware lock methods can be used simultaneously.\r |
85e923a5 | 127 | \r |
b4f26bb1 | 128 | @param This Indicates the calling context.\r |
64a80549 | 129 | @param LockCapability The current lock method for swap operations. \r |
85e923a5 LG |
130 | \r |
131 | @retval EFI_SUCCESS The call was successful.\r | |
132 | \r | |
133 | **/\r | |
134 | typedef\r | |
135 | EFI_STATUS\r | |
0c1a4aa6 | 136 | (EFIAPI *EFI_GET_SWAP_LOCK_CAPABILITY)(\r |
e40b7d5d LG |
137 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,\r |
138 | OUT EFI_SWAP_LOCK_CAPABILITY *LockCapability\r | |
85e923a5 LG |
139 | );\r |
140 | \r | |
141 | \r | |
142 | \r | |
143 | /**\r | |
64a80549 | 144 | This service is used to acquire or release appointed kind of lock for Swap Address Range operations.\r |
85e923a5 | 145 | \r |
85e923a5 LG |
146 | Note that software and hardware lock mothod can be used simultaneously.\r |
147 | \r | |
b4f26bb1 | 148 | @param This Indicates the calling context.\r |
85e923a5 | 149 | @param LockCapability Indicates which lock to acquire or release.\r |
64a80549 | 150 | @param NewLockState True to acquire lock; False to release lock.\r |
85e923a5 LG |
151 | \r |
152 | @retval EFI_SUCCESS The call was successful.\r | |
153 | \r | |
154 | **/\r | |
155 | typedef\r | |
156 | EFI_STATUS\r | |
0c1a4aa6 | 157 | (EFIAPI *EFI_SET_SWAP_LOCK)(\r |
e40b7d5d | 158 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,\r |
85e923a5 LG |
159 | IN EFI_SWAP_LOCK_CAPABILITY LockCapability,\r |
160 | IN BOOLEAN NewLockState\r | |
161 | );\r | |
162 | \r | |
163 | struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL {\r | |
164 | EFI_GET_RANGE_LOCATION GetRangeLocation; // has output parameters for base and length\r | |
165 | EFI_GET_SWAP_STATE GetSwapState; // are ranges swapped or not\r | |
166 | EFI_SET_SWAP_STATE SetSwapState; // swap or unswap ranges\r | |
167 | EFI_GET_RTC_POWER_STATUS GetRtcPowerStatus; // checks RTC battery, or whatever...\r | |
168 | EFI_GET_SWAP_LOCK_CAPABILITY GetSwapLockCapability; // Get TOP_SWAP lock capability,\r | |
169 | EFI_SET_SWAP_LOCK SetSwapLock; // Set TOP_SWAP lock state\r | |
170 | };\r | |
171 | \r | |
172 | extern EFI_GUID gEfiSwapAddressRangeProtocolGuid;\r | |
173 | \r | |
174 | #endif\r |