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