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