]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/LegacyRegion2.h
add carriage return
[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
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
33typedef 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
59typedef\r
60EFI_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
90typedef\r
91EFI_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
125typedef\r
126EFI_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
155typedef\r
156EFI_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
165typedef 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
176typedef struct {\r
177 UINT32 Start; ///< The beginning of the physical address of this\r
178 ///< region.\r
179 UINT32 Length; ///< The number of bytes in this region.\r
180 EFI_LEGACY_REGION_ATTRIBUTE Attribute; ///< Attribute of the Legacy Region Descriptor that\r
181 ///< describes the capabilities for that memory region. \r
182 UINT32 Granularity; ///< Describes the byte length programmability\r
183 ///< associated with the Start address and the specified\r
184 ///< Attribute setting.\r
185} EFI_LEGACY_REGION_DESCRIPTOR;\r
186\r
187\r
188/**\r
189 Get region information for the attributes of the Legacy Region.\r
190\r
191 This function is used to discover the granularity of the attributes for the memory in the legacy \r
192 region. Each attribute may have a different granularity and the granularity may not be the same\r
193 for all memory ranges in the legacy region. \r
194\r
195 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.\r
196 @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor\r
197 buffer.\r
198 @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy\r
199 region information is deposited. This buffer will contain a list of\r
200 DescriptorCount number of region descriptors. This function will\r
201 provide the memory for the buffer.\r
202\r
203 @retval EFI_SUCCESS The information structure was returned.\r
204 @retval EFI_UNSUPPORTED This function is not supported.\r
205\r
206**/\r
207typedef\r
208EFI_STATUS\r
209(EFIAPI *EFI_LEGACY_REGION_GET_INFO) (\r
210 IN EFI_LEGACY_REGION2_PROTOCOL *This,\r
211 OUT UINT32 *DescriptorCount,\r
212 OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor\r
213 );\r
214\r
215\r
216/**\r
217 Abstracts the hardware control of the physical address region 0xC0000-0xFFFFF.\r
218\r
219 The EFI_LEGACY_REGION2_PROTOCOL is used to abstract the hardware control of the memory \r
220 attributes of the Option ROM shadowing region, 0xC0000 to 0xFFFFF.\r
221 \r
222 There are three memory attributes that can be modified through this protocol: read, write and\r
223 boot-lock. These protocols may be set in any combination.\r
224\r
225**/\r
226struct _EFI_LEGACY_REGION2_PROTOCOL {\r
227 EFI_LEGACY_REGION2_DECODE Decode; ///< Modify the read attribute of a memory region. See\r
228 ///< the Decode() function description.\r
229 EFI_LEGACY_REGION2_LOCK Lock; ///< Modify the write attribute of a memory region to\r
230 ///< prevent writes. See the Lock() function description.\r
231 EFI_LEGACY_REGION2_BOOT_LOCK BootLock; ///< Modify the boot-lock attribute of a memory region to\r
232 ///< prevent future changes to the memory attributes for\r
233 ///< this region. See the BootLock() function description.\r
234 EFI_LEGACY_REGION2_UNLOCK UnLock; ///< Modify the write attribute of a memory region to\r
235 ///< allow writes. See the Unlock() function description. \r
236 EFI_LEGACY_REGION_GET_INFO GetInfo; ///< Modify the write attribute of a memory region to\r
237 ///< allow writes. See the GetInfo() function description.\r
238};\r
239\r
240extern EFI_GUID gEfiLegacyRegion2ProtocolGuid;\r
241\r
242#endif\r