2 The header file legacy region initialization in QNC DXE component.
4 Copyright (c) 2013-2015 Intel Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _LEGACY_REGION_H_
11 #define _LEGACY_REGION_H_
12 #include "CommonHeader.h"
14 #include <IndustryStandard/Pci.h>
16 #define LEGACY_REGION_INSTANCE_SIGNATURE SIGNATURE_32('R','E','G','N')
22 EFI_LEGACY_REGION2_PROTOCOL LegacyRegion2
;
23 EFI_HANDLE ImageHandle
;
26 // Protocol for PAM register access
28 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
;
29 } LEGACY_REGION_INSTANCE
;
31 #define LEGACY_REGION_INSTANCE_FROM_THIS(this) \
32 CR(this, LEGACY_REGION_INSTANCE, LegacyRegion2, LEGACY_REGION_INSTANCE_SIGNATURE)
36 LegacyRegionManipluateRegion (
37 IN LEGACY_REGION_INSTANCE
*Private
46 Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
48 If the On parameter evaluates to TRUE, this function enables memory reads in the address range
49 Start to (Start + Length - 1).
50 If the On parameter evaluates to FALSE, this function disables memory reads in the address range
51 Start to (Start + Length - 1).
53 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
54 @param Start[in] The beginning of the physical address of the region whose attributes
56 @param Length[in] The number of bytes of memory whose attributes should be modified.
57 The actual number of bytes modified may be greater than the number
59 @param Granularity[out] The number of bytes in the last region affected. This may be less
60 than the total number of bytes affected if the starting address
61 was not aligned to a region's starting address or if the length
62 was greater than the number of bytes in the first region.
63 @param On[in] Decode / Non-Decode flag.
65 @retval EFI_SUCCESS The region's attributes were successfully modified.
66 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
72 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
75 OUT UINT32
*Granularity
,
80 Modify the hardware to disallow memory writes in a region.
82 This function changes the attributes of a memory range to not allow writes.
84 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
85 @param Start[in] The beginning of the physical address of the region whose
86 attributes should be modified.
87 @param Length[in] The number of bytes of memory whose attributes should be modified.
88 The actual number of bytes modified may be greater than the number
90 @param Granularity[out] The number of bytes in the last region affected. This may be less
91 than the total number of bytes affected if the starting address was
92 not aligned to a region's starting address or if the length was
93 greater than the number of bytes in the first region.
95 @retval EFI_SUCCESS The region's attributes were successfully modified.
96 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
102 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
105 OUT UINT32
*Granularity
109 Modify the hardware to disallow memory attribute changes in a region.
111 This function makes the attributes of a region read only. Once a region is boot-locked with this
112 function, the read and write attributes of that region cannot be changed until a power cycle has
113 reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.
115 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
116 @param Start[in] The beginning of the physical address of the region whose
117 attributes should be modified.
118 @param Length[in] The number of bytes of memory whose attributes should be modified.
119 The actual number of bytes modified may be greater than the number
121 @param Granularity[out] The number of bytes in the last region affected. This may be less
122 than the total number of bytes affected if the starting address was
123 not aligned to a region's starting address or if the length was
124 greater than the number of bytes in the first region.
126 @retval EFI_SUCCESS The region's attributes were successfully modified.
127 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
128 @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
129 a way that will not affect memory regions outside the legacy memory
135 LegacyRegion2BootLock (
136 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
139 OUT UINT32
*Granularity
143 Modify the hardware to allow memory writes in a region.
145 This function changes the attributes of a memory range to allow writes.
147 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
148 @param Start[in] The beginning of the physical address of the region whose
149 attributes should be modified.
150 @param Length[in] The number of bytes of memory whose attributes should be modified.
151 The actual number of bytes modified may be greater than the number
153 @param Granularity[out] The number of bytes in the last region affected. This may be less
154 than the total number of bytes affected if the starting address was
155 not aligned to a region's starting address or if the length was
156 greater than the number of bytes in the first region.
158 @retval EFI_SUCCESS The region's attributes were successfully modified.
159 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
164 LegacyRegion2Unlock (
165 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
168 OUT UINT32
*Granularity
172 Get region information for the attributes of the Legacy Region.
174 This function is used to discover the granularity of the attributes for the memory in the legacy
175 region. Each attribute may have a different granularity and the granularity may not be the same
176 for all memory ranges in the legacy region.
178 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
179 @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
181 @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
182 region information is deposited. This buffer will contain a list of
183 DescriptorCount number of region descriptors. This function will
184 provide the memory for the buffer.
186 @retval EFI_SUCCESS The region's attributes were successfully modified.
187 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
192 LegacyRegionGetInfo (
193 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
194 OUT UINT32
*DescriptorCount
,
195 OUT EFI_LEGACY_REGION_DESCRIPTOR
**Descriptor
198 #endif //_QNC_LEGACY_REGION_H_