]>
Commit | Line | Data |
---|---|---|
23bb88ec | 1 | /** @file\r |
2 | The Legacy Region Protocol controls the read, write and boot-lock attributes for\r | |
3 | the region 0xC0000 to 0xFFFFF.\r | |
4 | \r | |
5 | Copyright (c) 2009, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | @par Revision Reference:\r | |
15 | This Protocol is defined in UEFI Platform Initialization Specification 1.2 \r | |
16 | Volume 5: Standards\r | |
17 | \r | |
18 | @attention This protocol appears to be 'EFI_LEGACY_REGION_PROTOCOL' in current PI 1.2\r | |
19 | public spec. Therefore, some names are different from public PI 1.2 spec and we should\r | |
20 | remove this attention when they appear in public PI 1.2 spec in the future. \r | |
21 | \r | |
22 | **/\r | |
23 | \r | |
24 | #ifndef __LEGACY_REGION2_H__\r | |
25 | #define __LEGACY_REGION2_H__\r | |
26 | \r | |
27 | \r | |
28 | #define EFI_LEGACY_REGION2_PROTOCOL_GUID \\r | |
29 | { \\r | |
30 | 0x70101eaf, 0x85, 0x440c, {0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 } \\r | |
31 | }\r | |
32 | \r | |
33 | typedef struct _EFI_LEGACY_REGION2_PROTOCOL EFI_LEGACY_REGION2_PROTOCOL;\r | |
34 | \r | |
35 | /**\r | |
36 | Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.\r | |
37 | \r | |
38 | If the On parameter evaluates to TRUE, this function enables memory reads in the address range \r | |
39 | Start to (Start + Length - 1).\r | |
40 | If the On parameter evaluates to FALSE, this function disables memory reads in the address range \r | |
41 | Start to (Start + Length - 1).\r | |
42 | \r | |
43 | @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.\r | |
44 | @param Start[in] The beginning of the physical address of the region whose attributes\r | |
45 | should be modified.\r | |
46 | @param Length[in] The number of bytes of memory whose attributes should be modified.\r | |
47 | The actual number of bytes modified may be greater than the number\r | |
48 | specified.\r | |
49 | @param Granularity[out] The number of bytes in the last region affected. This may be less\r | |
50 | than the total number of bytes affected if the starting address\r | |
51 | was not aligned to a region's starting address or if the length\r | |
52 | was greater than the number of bytes in the first region.\r | |
53 | @param On[in] Decode / Non-Decode flag.\r | |
54 | \r | |
55 | @retval EFI_SUCCESS The region's attributes were successfully modified.\r | |
56 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r | |
57 | \r | |
58 | **/\r | |
59 | typedef\r | |
60 | EFI_STATUS\r | |
61 | (EFIAPI *EFI_LEGACY_REGION2_DECODE) (\r | |
62 | IN EFI_LEGACY_REGION2_PROTOCOL *This,\r | |
63 | IN UINT32 Start,\r | |
64 | IN UINT32 Length,\r | |
65 | OUT UINT32 *Granularity,\r | |
66 | IN BOOLEAN *On\r | |
67 | );\r | |
68 | \r | |
69 | \r | |
70 | /**\r | |
71 | Modify the hardware to disallow memory writes in a region.\r | |
72 | \r | |
73 | This function changes the attributes of a memory range to not allow writes.\r | |
74 | \r | |
75 | @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.\r | |
76 | @param Start[in] The beginning of the physical address of the region whose\r | |
77 | attributes should be modified.\r | |
78 | @param Length[in] The number of bytes of memory whose attributes should be modified.\r | |
79 | The actual number of bytes modified may be greater than the number\r | |
80 | specified.\r | |
81 | @param Granularity[out] The number of bytes in the last region affected. This may be less\r | |
82 | than the total number of bytes affected if the starting address was\r | |
83 | not aligned to a region's starting address or if the length was\r | |
84 | greater than the number of bytes in the first region.\r | |
85 | \r | |
86 | @retval EFI_SUCCESS The region's attributes were successfully modified.\r | |
87 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r | |
88 | \r | |
89 | **/\r | |
90 | typedef\r | |
91 | EFI_STATUS\r | |
92 | (EFIAPI *EFI_LEGACY_REGION2_LOCK) (\r | |
93 | IN EFI_LEGACY_REGION2_PROTOCOL *This,\r | |
94 | IN UINT32 Start,\r | |
95 | IN UINT32 Length,\r | |
96 | OUT UINT32 *Granularity\r | |
97 | );\r | |
98 | \r | |
99 | \r | |
100 | /**\r | |
101 | Modify the hardware to disallow memory attribute changes in a region.\r | |
102 | \r | |
103 | This function makes the attributes of a region read only. Once a region is boot-locked with this \r | |
104 | function, the read and write attributes of that region cannot be changed until a power cycle has\r | |
105 | reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.\r | |
106 | \r | |
107 | @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.\r | |
108 | @param Start[in] The beginning of the physical address of the region whose\r | |
109 | attributes should be modified.\r | |
110 | @param Length[in] The number of bytes of memory whose attributes should be modified.\r | |
111 | The actual number of bytes modified may be greater than the number\r | |
112 | specified.\r | |
113 | @param Granularity[out] The number of bytes in the last region affected. This may be less\r | |
114 | than the total number of bytes affected if the starting address was\r | |
115 | not aligned to a region's starting address or if the length was\r | |
116 | greater than the number of bytes in the first region.\r | |
117 | \r | |
118 | @retval EFI_SUCCESS The region's attributes were successfully modified.\r | |
119 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r | |
120 | @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in\r | |
121 | a way that will not affect memory regions outside the legacy memory\r | |
122 | region.\r | |
123 | \r | |
124 | **/\r | |
125 | typedef\r | |
126 | EFI_STATUS\r | |
127 | (EFIAPI *EFI_LEGACY_REGION2_BOOT_LOCK)(\r | |
128 | IN EFI_LEGACY_REGION2_PROTOCOL *This,\r | |
129 | IN UINT32 Start,\r | |
130 | IN UINT32 Length,\r | |
131 | OUT UINT32 *Granularity OPTIONAL\r | |
132 | );\r | |
133 | \r | |
134 | \r | |
135 | /**\r | |
136 | Modify the hardware to allow memory writes in a region.\r | |
137 | \r | |
138 | This function changes the attributes of a memory range to allow writes. \r | |
139 | \r | |
140 | @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.\r | |
141 | @param Start[in] The beginning of the physical address of the region whose\r | |
142 | attributes should be modified.\r | |
143 | @param Length[in] The number of bytes of memory whose attributes should be modified.\r | |
144 | The actual number of bytes modified may be greater than the number\r | |
145 | specified.\r | |
146 | @param Granularity[out] The number of bytes in the last region affected. This may be less\r | |
147 | than the total number of bytes affected if the starting address was\r | |
148 | not aligned to a region's starting address or if the length was\r | |
149 | greater than the number of bytes in the first region.\r | |
150 | \r | |
151 | @retval EFI_SUCCESS The region's attributes were successfully modified.\r | |
152 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r | |
153 | \r | |
154 | **/\r | |
155 | typedef\r | |
156 | EFI_STATUS\r | |
157 | (EFIAPI *EFI_LEGACY_REGION2_UNLOCK) (\r | |
158 | IN EFI_LEGACY_REGION2_PROTOCOL *This,\r | |
159 | IN UINT32 Start,\r | |
160 | IN UINT32 Length,\r | |
161 | OUT UINT32 *Granularity\r | |
162 | );\r | |
163 | \r | |
164 | \r | |
165 | typedef enum {\r | |
166 | LegacyRegionDecoded, ///< This region is currently set to allow reads.\r | |
167 | LegacyRegionNotDecoded, ///< This region is currently set to not allow reads.\r | |
168 | LegacyRegionWriteEnabled, ///< This region is currently set to allow writes.\r | |
169 | LegacyRegionWriteDisabled, ///< This region is currently set to write protected.\r | |
170 | LegacyRegionBootLocked, ///< This region's attributes are locked, cannot be modified until\r | |
171 | ///< after a power cycle.\r | |
172 | LegacyRegionNotLocked ///< This region's attributes are not locked.\r | |
173 | } EFI_LEGACY_REGION_ATTRIBUTE;\r | |
174 | \r | |
175 | \r | |
176 | typedef struct {\r | |
e3f903d5 | 177 | ///\r |
178 | /// The beginning of the physical address of this\r | |
179 | /// region.\r | |
180 | ///\r | |
181 | UINT32 Start;\r | |
182 | ///\r | |
183 | /// The number of bytes in this region.\r | |
184 | ///\r | |
185 | UINT32 Length;\r | |
186 | ///\r | |
187 | /// Attribute of the Legacy Region Descriptor that\r | |
188 | /// describes the capabilities for that memory region.\r | |
189 | ///\r | |
190 | EFI_LEGACY_REGION_ATTRIBUTE Attribute;\r | |
191 | ///\r | |
192 | /// Describes the byte length programmability\r | |
193 | /// associated with the Start address and the specified\r | |
194 | /// Attribute setting.\r | |
195 | UINT32 Granularity;\r | |
23bb88ec | 196 | } EFI_LEGACY_REGION_DESCRIPTOR;\r |
197 | \r | |
198 | \r | |
199 | /**\r | |
200 | Get region information for the attributes of the Legacy Region.\r | |
201 | \r | |
202 | This function is used to discover the granularity of the attributes for the memory in the legacy \r | |
203 | region. Each attribute may have a different granularity and the granularity may not be the same\r | |
204 | for all memory ranges in the legacy region. \r | |
205 | \r | |
206 | @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.\r | |
207 | @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor\r | |
208 | buffer.\r | |
209 | @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy\r | |
210 | region information is deposited. This buffer will contain a list of\r | |
211 | DescriptorCount number of region descriptors. This function will\r | |
212 | provide the memory for the buffer.\r | |
213 | \r | |
214 | @retval EFI_SUCCESS The information structure was returned.\r | |
215 | @retval EFI_UNSUPPORTED This function is not supported.\r | |
216 | \r | |
217 | **/\r | |
218 | typedef\r | |
219 | EFI_STATUS\r | |
220 | (EFIAPI *EFI_LEGACY_REGION_GET_INFO) (\r | |
221 | IN EFI_LEGACY_REGION2_PROTOCOL *This,\r | |
222 | OUT UINT32 *DescriptorCount,\r | |
223 | OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor\r | |
224 | );\r | |
225 | \r | |
226 | \r | |
e3f903d5 | 227 | /// \r |
228 | /// The EFI_LEGACY_REGION2_PROTOCOL is used to abstract the hardware control of the memory \r | |
229 | /// attributes of the Option ROM shadowing region, 0xC0000 to 0xFFFFF.\r | |
230 | /// There are three memory attributes that can be modified through this protocol: read, write and\r | |
231 | /// boot-lock. These protocols may be set in any combination.\r | |
232 | ///\r | |
23bb88ec | 233 | struct _EFI_LEGACY_REGION2_PROTOCOL {\r |
e3f903d5 | 234 | EFI_LEGACY_REGION2_DECODE Decode;\r |
235 | EFI_LEGACY_REGION2_LOCK Lock;\r | |
236 | EFI_LEGACY_REGION2_BOOT_LOCK BootLock;\r | |
237 | EFI_LEGACY_REGION2_UNLOCK UnLock;\r | |
238 | EFI_LEGACY_REGION_GET_INFO GetInfo;\r | |
23bb88ec | 239 | };\r |
240 | \r | |
241 | extern EFI_GUID gEfiLegacyRegion2ProtocolGuid;\r | |
242 | \r | |
243 | #endif\r |