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