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