2 The Legacy Region Protocol controls the read, write and boot-lock attributes for
3 the region 0xC0000 to 0xFFFFF.
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
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
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.
24 #ifndef __LEGACY_REGION2_H__
25 #define __LEGACY_REGION2_H__
28 #define EFI_LEGACY_REGION2_PROTOCOL_GUID \
30 0x70101eaf, 0x85, 0x440c, {0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 } \
33 typedef struct _EFI_LEGACY_REGION2_PROTOCOL EFI_LEGACY_REGION2_PROTOCOL
;
36 Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
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).
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
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
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.
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.
61 (EFIAPI
*EFI_LEGACY_REGION2_DECODE
) (
62 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
65 OUT UINT32
*Granularity
,
71 Modify the hardware to disallow memory writes in a region.
73 This function changes the attributes of a memory range to not allow writes.
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
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.
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.
92 (EFIAPI
*EFI_LEGACY_REGION2_LOCK
) (
93 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
96 OUT UINT32
*Granularity
101 Modify the hardware to disallow memory attribute changes in a region.
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.
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
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.
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
127 (EFIAPI
*EFI_LEGACY_REGION2_BOOT_LOCK
)(
128 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
131 OUT UINT32
*Granularity OPTIONAL
136 Modify the hardware to allow memory writes in a region.
138 This function changes the attributes of a memory range to allow writes.
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
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.
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.
157 (EFIAPI
*EFI_LEGACY_REGION2_UNLOCK
) (
158 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
161 OUT UINT32
*Granularity
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
;
177 UINT32 Start
; ///< The beginning of the physical address of this
179 UINT32 Length
; ///< The number of bytes in this region.
180 EFI_LEGACY_REGION_ATTRIBUTE Attribute
; ///< Attribute of the Legacy Region Descriptor that
181 ///< describes the capabilities for that memory region.
182 UINT32 Granularity
; ///< Describes the byte length programmability
183 ///< associated with the Start address and the specified
184 ///< Attribute setting.
185 } EFI_LEGACY_REGION_DESCRIPTOR
;
189 Get region information for the attributes of the Legacy Region.
191 This function is used to discover the granularity of the attributes for the memory in the legacy
192 region. Each attribute may have a different granularity and the granularity may not be the same
193 for all memory ranges in the legacy region.
195 @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
196 @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
198 @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
199 region information is deposited. This buffer will contain a list of
200 DescriptorCount number of region descriptors. This function will
201 provide the memory for the buffer.
203 @retval EFI_SUCCESS The information structure was returned.
204 @retval EFI_UNSUPPORTED This function is not supported.
209 (EFIAPI
*EFI_LEGACY_REGION_GET_INFO
) (
210 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
211 OUT UINT32
*DescriptorCount
,
212 OUT EFI_LEGACY_REGION_DESCRIPTOR
**Descriptor
217 Abstracts the hardware control of the physical address region 0xC0000-0xFFFFF.
219 The EFI_LEGACY_REGION2_PROTOCOL is used to abstract the hardware control of the memory
220 attributes of the Option ROM shadowing region, 0xC0000 to 0xFFFFF.
222 There are three memory attributes that can be modified through this protocol: read, write and
223 boot-lock. These protocols may be set in any combination.
226 struct _EFI_LEGACY_REGION2_PROTOCOL
{
227 EFI_LEGACY_REGION2_DECODE Decode
; ///< Modify the read attribute of a memory region. See
228 ///< the Decode() function description.
229 EFI_LEGACY_REGION2_LOCK Lock
; ///< Modify the write attribute of a memory region to
230 ///< prevent writes. See the Lock() function description.
231 EFI_LEGACY_REGION2_BOOT_LOCK BootLock
; ///< Modify the boot-lock attribute of a memory region to
232 ///< prevent future changes to the memory attributes for
233 ///< this region. See the BootLock() function description.
234 EFI_LEGACY_REGION2_UNLOCK UnLock
; ///< Modify the write attribute of a memory region to
235 ///< allow writes. See the Unlock() function description.
236 EFI_LEGACY_REGION_GET_INFO GetInfo
; ///< Modify the write attribute of a memory region to
237 ///< allow writes. See the GetInfo() function description.
240 extern EFI_GUID gEfiLegacyRegion2ProtocolGuid
;