]>
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 | |
3 | and backup block of FV. This swap is especially needed when updating the boot block of FV. If any \r | |
4 | power failure happens during updating boot block, the swapped backup block (now is the boot block) \r | |
5 | can boot the machine with old boot block backuped 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 hardward directly.\r | |
7 | \r | |
8 | Copyright (c) 2009, Intel Corporation \r | |
9 | All rights reserved. This program and the accompanying materials \r | |
10 | are licensed and made available under the terms and conditions of the BSD License \r | |
11 | which accompanies this distribution. The full text of the license may be found at \r | |
12 | http://opensource.org/licenses/bsd-license.php \r | |
13 | \r | |
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 | |
39 | // Protocl APIs\r | |
40 | //\r | |
41 | \r | |
42 | /**\r | |
43 | This service gets the address range location of boot block and backup block.\r | |
44 | The EFI_GET_RANGE_LOCATION service allows caller to get the range location of \r | |
45 | boot block and backup block. \r | |
46 | \r | |
b4f26bb1 | 47 | @param This Indicates the calling context. \r |
85e923a5 LG |
48 | @param BootBlockBase Base address of current boot block.\r |
49 | @param BootBlockSize Size (in bytes) of current boot block.\r | |
b4f26bb1 LG |
50 | @param BackupBlockBase Base address of current backup block.\r |
51 | @param BackupBlockSize Size (in bytes) of current backup block.\r | |
85e923a5 LG |
52 | \r |
53 | @retval EFI_SUCCESS The call was successful.\r | |
54 | \r | |
55 | **/\r | |
56 | typedef\r | |
57 | EFI_STATUS\r | |
58 | (EFIAPI *EFI_GET_RANGE_LOCATION) (\r | |
59 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL * This,\r | |
60 | OUT EFI_PHYSICAL_ADDRESS * BootBlockBase,\r | |
61 | OUT UINTN *BootBlockSize,\r | |
62 | OUT EFI_PHYSICAL_ADDRESS * BackupBlockBase,\r | |
63 | OUT UINTN *BackupBlockSize\r | |
64 | );\r | |
65 | \r | |
66 | /**\r | |
67 | This service checks if the boot block and backup block has been swapped.\r | |
68 | \r | |
69 | The EFI_GET_SWAP_STATE service allows caller to get current swap state of boot block and backup block.\r | |
70 | \r | |
b4f26bb1 | 71 | @param This Indicates the calling context. \r |
85e923a5 | 72 | @param SwapState True if the boot block and backup block has been swapped. \r |
b4f26bb1 | 73 | False if the boot block and backup block has not been swapped.\r |
85e923a5 LG |
74 | \r |
75 | @retval EFI_SUCCESS The call was successful.\r | |
76 | \r | |
77 | **/\r | |
78 | typedef\r | |
79 | EFI_STATUS\r | |
80 | (EFIAPI *EFI_GET_SWAP_STATE) (\r | |
81 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL * This,\r | |
82 | OUT BOOLEAN *SwapState\r | |
83 | );\r | |
84 | \r | |
85 | /**\r | |
86 | This service swaps the boot block and backup block, or swaps them back.\r | |
87 | \r | |
88 | The EFI_SET_SWAP_STATE service allows caller to set the swap state of boot block and backup block. \r | |
89 | It also acquires and releases software swap lock during operation. Note the setting of new swap state \r | |
90 | is not affected by the old swap state.\r | |
91 | \r | |
b4f26bb1 | 92 | @param This Indicates the calling context. \r |
85e923a5 LG |
93 | @param NewSwapState True to swap real boot block and backup block , False to swap them back..\r |
94 | \r | |
95 | @retval EFI_SUCCESS The call was successful.\r | |
96 | @retval EFI_ABORTED Set swap state error\r | |
97 | \r | |
98 | **/\r | |
99 | typedef\r | |
100 | EFI_STATUS\r | |
101 | (EFIAPI *EFI_SET_SWAP_STATE) (\r | |
102 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL * This,\r | |
103 | IN BOOLEAN NewSwapState\r | |
104 | );\r | |
105 | \r | |
106 | \r | |
107 | \r | |
108 | /**\r | |
109 | This service checks if a RTC (Real Time Clock) power failure happened.\r | |
110 | \r | |
111 | The EFI_GET_RTC_POWER_STATUS service allows caller to get Real Time Clock power failure status. \r | |
112 | If parameter RtcPowerFailed is true after function returns, the trickle current (from the main battery or trickle supply) \r | |
113 | has been removed or failed, this means the swap status was lost in some platform (such as IA32). \r | |
114 | So it is recommended to check RTC power status before calling GetSwapState().\r | |
115 | \r | |
b4f26bb1 | 116 | @param This Indicates the calling context. \r |
85e923a5 LG |
117 | @param RtcPowerFailed True if a RTC (Real Time Clock) power failure has happened.\r |
118 | \r | |
119 | @retval EFI_SUCCESS The call was successful.\r | |
120 | \r | |
121 | **/\r | |
122 | typedef\r | |
123 | EFI_STATUS\r | |
124 | (EFIAPI *EFI_GET_RTC_POWER_STATUS) (\r | |
125 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL * This,\r | |
126 | OUT BOOLEAN *RtcPowerFailed\r | |
127 | );\r | |
128 | \r | |
129 | /**\r | |
130 | This service returns supported lock methods for swap operation in current platform. Could be software lock, hardware lock, or unsupport lock.\r | |
131 | \r | |
132 | The EFI_GET_SWAP_LOCK_CAPABILITY service allows caller to get supported lock method for swap operation in current platform. \r | |
133 | Note that software and hardware lock mothod can be used simultaneously.\r | |
134 | \r | |
b4f26bb1 | 135 | @param This Indicates the calling context.\r |
85e923a5 LG |
136 | @param LockCapability Current lock method for swap operation. \r |
137 | \r | |
138 | @retval EFI_SUCCESS The call was successful.\r | |
139 | \r | |
140 | **/\r | |
141 | typedef\r | |
142 | EFI_STATUS\r | |
143 | (EFIAPI *EFI_GET_SWAP_LOCK_CAPABILITY) (\r | |
144 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL * This,\r | |
145 | OUT EFI_SWAP_LOCK_CAPABILITY * LockCapability\r | |
146 | );\r | |
147 | \r | |
148 | \r | |
149 | \r | |
150 | /**\r | |
151 | This service is used to acquire or release appointed kind of lock for Swap Address Range operation.\r | |
152 | \r | |
153 | The EFI_GET_SWAP_LOCK_CAPABILITY service allows caller to get supported lock method for swap operation in current platform. \r | |
154 | Note that software and hardware lock mothod can be used simultaneously.\r | |
155 | \r | |
b4f26bb1 | 156 | @param This Indicates the calling context.\r |
85e923a5 | 157 | @param LockCapability Indicates which lock to acquire or release.\r |
b4f26bb1 | 158 | @param NewLockState True to acquire lock, False to release lock.\r |
85e923a5 LG |
159 | \r |
160 | @retval EFI_SUCCESS The call was successful.\r | |
161 | \r | |
162 | **/\r | |
163 | typedef\r | |
164 | EFI_STATUS\r | |
165 | (EFIAPI *EFI_SET_SWAP_LOCK) (\r | |
166 | IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL * This,\r | |
167 | IN EFI_SWAP_LOCK_CAPABILITY LockCapability,\r | |
168 | IN BOOLEAN NewLockState\r | |
169 | );\r | |
170 | \r | |
171 | struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL {\r | |
172 | EFI_GET_RANGE_LOCATION GetRangeLocation; // has output parameters for base and length\r | |
173 | EFI_GET_SWAP_STATE GetSwapState; // are ranges swapped or not\r | |
174 | EFI_SET_SWAP_STATE SetSwapState; // swap or unswap ranges\r | |
175 | EFI_GET_RTC_POWER_STATUS GetRtcPowerStatus; // checks RTC battery, or whatever...\r | |
176 | EFI_GET_SWAP_LOCK_CAPABILITY GetSwapLockCapability; // Get TOP_SWAP lock capability,\r | |
177 | EFI_SET_SWAP_LOCK SetSwapLock; // Set TOP_SWAP lock state\r | |
178 | };\r | |
179 | \r | |
180 | extern EFI_GUID gEfiSwapAddressRangeProtocolGuid;\r | |
181 | \r | |
182 | #endif\r |