2 The Legacy Region Protocol controls the read, write and boot-lock attributes for
3 the region 0xC0000 to 0xFFFFF.
5 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
8 @par Revision Reference:
9 This Protocol is defined in UEFI Platform Initialization Specification 1.2
14 #ifndef __LEGACY_REGION2_H__
15 #define __LEGACY_REGION2_H__
17 #define EFI_LEGACY_REGION2_PROTOCOL_GUID \
19 0x70101eaf, 0x85, 0x440c, {0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 } \
22 typedef struct _EFI_LEGACY_REGION2_PROTOCOL EFI_LEGACY_REGION2_PROTOCOL
;
25 Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
27 If the On parameter evaluates to TRUE, this function enables memory reads in the address range
28 Start to (Start + Length - 1).
29 If the On parameter evaluates to FALSE, this function disables memory reads in the address range
30 Start to (Start + Length - 1).
32 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
33 @param Start[in] The beginning of the physical address of the region whose attributes
35 @param Length[in] The number of bytes of memory whose attributes should be modified.
36 The actual number of bytes modified may be greater than the number
38 @param Granularity[out] The number of bytes in the last region affected. This may be less
39 than the total number of bytes affected if the starting address
40 was not aligned to a region's starting address or if the length
41 was greater than the number of bytes in the first region.
42 @param On[in] Decode / Non-Decode flag.
44 @retval EFI_SUCCESS The region's attributes were successfully modified.
45 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
50 (EFIAPI
*EFI_LEGACY_REGION2_DECODE
)(
51 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
54 OUT UINT32
*Granularity
,
59 Modify the hardware to disallow memory writes in a region.
61 This function changes the attributes of a memory range to not allow writes.
63 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
64 @param Start[in] The beginning of the physical address of the region whose
65 attributes should be modified.
66 @param Length[in] The number of bytes of memory whose attributes should be modified.
67 The actual number of bytes modified may be greater than the number
69 @param Granularity[out] The number of bytes in the last region affected. This may be less
70 than the total number of bytes affected if the starting address was
71 not aligned to a region's starting address or if the length was
72 greater than the number of bytes in the first region.
74 @retval EFI_SUCCESS The region's attributes were successfully modified.
75 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
80 (EFIAPI
*EFI_LEGACY_REGION2_LOCK
)(
81 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
84 OUT UINT32
*Granularity
88 Modify the hardware to disallow memory attribute changes in a region.
90 This function makes the attributes of a region read only. Once a region is boot-locked with this
91 function, the read and write attributes of that region cannot be changed until a power cycle has
92 reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.
94 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
95 @param Start[in] The beginning of the physical address of the region whose
96 attributes should be modified.
97 @param Length[in] The number of bytes of memory whose attributes should be modified.
98 The actual number of bytes modified may be greater than the number
100 @param Granularity[out] The number of bytes in the last region affected. This may be less
101 than the total number of bytes affected if the starting address was
102 not aligned to a region's starting address or if the length was
103 greater than the number of bytes in the first region.
105 @retval EFI_SUCCESS The region's attributes were successfully modified.
106 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
107 @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
108 a way that will not affect memory regions outside the legacy memory
114 (EFIAPI
*EFI_LEGACY_REGION2_BOOT_LOCK
)(
115 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
118 OUT UINT32
*Granularity OPTIONAL
122 Modify the hardware to allow memory writes in a region.
124 This function changes the attributes of a memory range to allow writes.
126 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
127 @param Start[in] The beginning of the physical address of the region whose
128 attributes should be modified.
129 @param Length[in] The number of bytes of memory whose attributes should be modified.
130 The actual number of bytes modified may be greater than the number
132 @param Granularity[out] The number of bytes in the last region affected. This may be less
133 than the total number of bytes affected if the starting address was
134 not aligned to a region's starting address or if the length was
135 greater than the number of bytes in the first region.
137 @retval EFI_SUCCESS The region's attributes were successfully modified.
138 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
143 (EFIAPI
*EFI_LEGACY_REGION2_UNLOCK
)(
144 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
147 OUT UINT32
*Granularity
151 LegacyRegionDecoded
, ///< This region is currently set to allow reads.
152 LegacyRegionNotDecoded
, ///< This region is currently set to not allow reads.
153 LegacyRegionWriteEnabled
, ///< This region is currently set to allow writes.
154 LegacyRegionWriteDisabled
, ///< This region is currently set to write protected.
155 LegacyRegionBootLocked
, ///< This region's attributes are locked, cannot be modified until
156 ///< after a power cycle.
157 LegacyRegionNotLocked
///< This region's attributes are not locked.
158 } EFI_LEGACY_REGION_ATTRIBUTE
;
162 /// The beginning of the physical address of this
167 /// The number of bytes in this region.
171 /// Attribute of the Legacy Region Descriptor that
172 /// describes the capabilities for that memory region.
174 EFI_LEGACY_REGION_ATTRIBUTE Attribute
;
176 /// Describes the byte length programmability
177 /// associated with the Start address and the specified
178 /// Attribute setting.
180 } EFI_LEGACY_REGION_DESCRIPTOR
;
183 Get region information for the attributes of the Legacy Region.
185 This function is used to discover the granularity of the attributes for the memory in the legacy
186 region. Each attribute may have a different granularity and the granularity may not be the same
187 for all memory ranges in the legacy region.
189 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
190 @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
192 @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
193 region information is deposited. This buffer will contain a list of
194 DescriptorCount number of region descriptors. This function will
195 provide the memory for the buffer.
197 @retval EFI_SUCCESS The information structure was returned.
198 @retval EFI_UNSUPPORTED This function is not supported.
203 (EFIAPI
*EFI_LEGACY_REGION_GET_INFO
)(
204 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
205 OUT UINT32
*DescriptorCount
,
206 OUT EFI_LEGACY_REGION_DESCRIPTOR
**Descriptor
210 /// The EFI_LEGACY_REGION2_PROTOCOL is used to abstract the hardware control of the memory
211 /// attributes of the Option ROM shadowing region, 0xC0000 to 0xFFFFF.
212 /// There are three memory attributes that can be modified through this protocol: read, write and
213 /// boot-lock. These protocols may be set in any combination.
215 struct _EFI_LEGACY_REGION2_PROTOCOL
{
216 EFI_LEGACY_REGION2_DECODE Decode
;
217 EFI_LEGACY_REGION2_LOCK Lock
;
218 EFI_LEGACY_REGION2_BOOT_LOCK BootLock
;
219 EFI_LEGACY_REGION2_UNLOCK UnLock
;
220 EFI_LEGACY_REGION_GET_INFO GetInfo
;
223 extern EFI_GUID gEfiLegacyRegion2ProtocolGuid
;