2 The Legacy Region Protocol controls the read, write and boot-lock attributes for
3 the region 0xC0000 to 0xFFFFF.
5 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
6 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
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.
14 @par Revision Reference:
15 This Protocol is defined in UEFI Platform Initialization Specification 1.2
20 #ifndef __LEGACY_REGION2_H__
21 #define __LEGACY_REGION2_H__
24 #define EFI_LEGACY_REGION2_PROTOCOL_GUID \
26 0x70101eaf, 0x85, 0x440c, {0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 } \
29 typedef struct _EFI_LEGACY_REGION2_PROTOCOL EFI_LEGACY_REGION2_PROTOCOL
;
32 Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
34 If the On parameter evaluates to TRUE, this function enables memory reads in the address range
35 Start to (Start + Length - 1).
36 If the On parameter evaluates to FALSE, this function disables memory reads in the address range
37 Start to (Start + Length - 1).
39 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
40 @param Start[in] The beginning of the physical address of the region whose attributes
42 @param Length[in] The number of bytes of memory whose attributes should be modified.
43 The actual number of bytes modified may be greater than the number
45 @param Granularity[out] The number of bytes in the last region affected. This may be less
46 than the total number of bytes affected if the starting address
47 was not aligned to a region's starting address or if the length
48 was greater than the number of bytes in the first region.
49 @param On[in] Decode / Non-Decode flag.
51 @retval EFI_SUCCESS The region's attributes were successfully modified.
52 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
57 (EFIAPI
*EFI_LEGACY_REGION2_DECODE
)(
58 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
61 OUT UINT32
*Granularity
,
67 Modify the hardware to disallow memory writes in a region.
69 This function changes the attributes of a memory range to not allow writes.
71 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
72 @param Start[in] The beginning of the physical address of the region whose
73 attributes should be modified.
74 @param Length[in] The number of bytes of memory whose attributes should be modified.
75 The actual number of bytes modified may be greater than the number
77 @param Granularity[out] The number of bytes in the last region affected. This may be less
78 than the total number of bytes affected if the starting address was
79 not aligned to a region's starting address or if the length was
80 greater than the number of bytes in the first region.
82 @retval EFI_SUCCESS The region's attributes were successfully modified.
83 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
88 (EFIAPI
*EFI_LEGACY_REGION2_LOCK
)(
89 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
92 OUT UINT32
*Granularity
97 Modify the hardware to disallow memory attribute changes in a region.
99 This function makes the attributes of a region read only. Once a region is boot-locked with this
100 function, the read and write attributes of that region cannot be changed until a power cycle has
101 reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.
103 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
104 @param Start[in] The beginning of the physical address of the region whose
105 attributes should be modified.
106 @param Length[in] The number of bytes of memory whose attributes should be modified.
107 The actual number of bytes modified may be greater than the number
109 @param Granularity[out] The number of bytes in the last region affected. This may be less
110 than the total number of bytes affected if the starting address was
111 not aligned to a region's starting address or if the length was
112 greater than the number of bytes in the first region.
114 @retval EFI_SUCCESS The region's attributes were successfully modified.
115 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
116 @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
117 a way that will not affect memory regions outside the legacy memory
123 (EFIAPI
*EFI_LEGACY_REGION2_BOOT_LOCK
)(
124 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
127 OUT UINT32
*Granularity OPTIONAL
132 Modify the hardware to allow memory writes in a region.
134 This function changes the attributes of a memory range to allow writes.
136 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
137 @param Start[in] The beginning of the physical address of the region whose
138 attributes should be modified.
139 @param Length[in] The number of bytes of memory whose attributes should be modified.
140 The actual number of bytes modified may be greater than the number
142 @param Granularity[out] The number of bytes in the last region affected. This may be less
143 than the total number of bytes affected if the starting address was
144 not aligned to a region's starting address or if the length was
145 greater than the number of bytes in the first region.
147 @retval EFI_SUCCESS The region's attributes were successfully modified.
148 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
153 (EFIAPI
*EFI_LEGACY_REGION2_UNLOCK
)(
154 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
157 OUT UINT32
*Granularity
162 LegacyRegionDecoded
, ///< This region is currently set to allow reads.
163 LegacyRegionNotDecoded
, ///< This region is currently set to not allow reads.
164 LegacyRegionWriteEnabled
, ///< This region is currently set to allow writes.
165 LegacyRegionWriteDisabled
, ///< This region is currently set to write protected.
166 LegacyRegionBootLocked
, ///< This region's attributes are locked, cannot be modified until
167 ///< after a power cycle.
168 LegacyRegionNotLocked
///< This region's attributes are not locked.
169 } EFI_LEGACY_REGION_ATTRIBUTE
;
174 /// The beginning of the physical address of this
179 /// The number of bytes in this region.
183 /// Attribute of the Legacy Region Descriptor that
184 /// describes the capabilities for that memory region.
186 EFI_LEGACY_REGION_ATTRIBUTE Attribute
;
188 /// Describes the byte length programmability
189 /// associated with the Start address and the specified
190 /// Attribute setting.
192 } EFI_LEGACY_REGION_DESCRIPTOR
;
196 Get region information for the attributes of the Legacy Region.
198 This function is used to discover the granularity of the attributes for the memory in the legacy
199 region. Each attribute may have a different granularity and the granularity may not be the same
200 for all memory ranges in the legacy region.
202 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
203 @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
205 @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
206 region information is deposited. This buffer will contain a list of
207 DescriptorCount number of region descriptors. This function will
208 provide the memory for the buffer.
210 @retval EFI_SUCCESS The information structure was returned.
211 @retval EFI_UNSUPPORTED This function is not supported.
216 (EFIAPI
*EFI_LEGACY_REGION_GET_INFO
)(
217 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
218 OUT UINT32
*DescriptorCount
,
219 OUT EFI_LEGACY_REGION_DESCRIPTOR
**Descriptor
224 /// The EFI_LEGACY_REGION2_PROTOCOL is used to abstract the hardware control of the memory
225 /// attributes of the Option ROM shadowing region, 0xC0000 to 0xFFFFF.
226 /// There are three memory attributes that can be modified through this protocol: read, write and
227 /// boot-lock. These protocols may be set in any combination.
229 struct _EFI_LEGACY_REGION2_PROTOCOL
{
230 EFI_LEGACY_REGION2_DECODE Decode
;
231 EFI_LEGACY_REGION2_LOCK Lock
;
232 EFI_LEGACY_REGION2_BOOT_LOCK BootLock
;
233 EFI_LEGACY_REGION2_UNLOCK UnLock
;
234 EFI_LEGACY_REGION_GET_INFO GetInfo
;
237 extern EFI_GUID gEfiLegacyRegion2ProtocolGuid
;