2 The header file legacy region initialization in QNC DXE component.
4 Copyright (c) 2013-2015 Intel Corporation.
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.
16 #ifndef _LEGACY_REGION_H_
17 #define _LEGACY_REGION_H_
18 #include "CommonHeader.h"
20 #include <IndustryStandard/Pci.h>
22 #define LEGACY_REGION_INSTANCE_SIGNATURE SIGNATURE_32('R','E','G','N')
28 EFI_LEGACY_REGION2_PROTOCOL LegacyRegion2
;
29 EFI_HANDLE ImageHandle
;
32 // Protocol for PAM register access
34 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
;
35 } LEGACY_REGION_INSTANCE
;
37 #define LEGACY_REGION_INSTANCE_FROM_THIS(this) \
38 CR(this, LEGACY_REGION_INSTANCE, LegacyRegion2, LEGACY_REGION_INSTANCE_SIGNATURE)
42 LegacyRegionManipluateRegion (
43 IN LEGACY_REGION_INSTANCE
*Private
52 Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
54 If the On parameter evaluates to TRUE, this function enables memory reads in the address range
55 Start to (Start + Length - 1).
56 If the On parameter evaluates to FALSE, this function disables memory reads in the address range
57 Start to (Start + Length - 1).
59 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
60 @param Start[in] The beginning of the physical address of the region whose attributes
62 @param Length[in] The number of bytes of memory whose attributes should be modified.
63 The actual number of bytes modified may be greater than the number
65 @param Granularity[out] The number of bytes in the last region affected. This may be less
66 than the total number of bytes affected if the starting address
67 was not aligned to a region's starting address or if the length
68 was greater than the number of bytes in the first region.
69 @param On[in] Decode / Non-Decode flag.
71 @retval EFI_SUCCESS The region's attributes were successfully modified.
72 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
78 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
81 OUT UINT32
*Granularity
,
86 Modify the hardware to disallow memory writes in a region.
88 This function changes the attributes of a memory range to not allow writes.
90 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
91 @param Start[in] The beginning of the physical address of the region whose
92 attributes should be modified.
93 @param Length[in] The number of bytes of memory whose attributes should be modified.
94 The actual number of bytes modified may be greater than the number
96 @param Granularity[out] The number of bytes in the last region affected. This may be less
97 than the total number of bytes affected if the starting address was
98 not aligned to a region's starting address or if the length was
99 greater than the number of bytes in the first region.
101 @retval EFI_SUCCESS The region's attributes were successfully modified.
102 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
108 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
111 OUT UINT32
*Granularity
115 Modify the hardware to disallow memory attribute changes in a region.
117 This function makes the attributes of a region read only. Once a region is boot-locked with this
118 function, the read and write attributes of that region cannot be changed until a power cycle has
119 reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.
121 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
122 @param Start[in] The beginning of the physical address of the region whose
123 attributes should be modified.
124 @param Length[in] The number of bytes of memory whose attributes should be modified.
125 The actual number of bytes modified may be greater than the number
127 @param Granularity[out] The number of bytes in the last region affected. This may be less
128 than the total number of bytes affected if the starting address was
129 not aligned to a region's starting address or if the length was
130 greater than the number of bytes in the first region.
132 @retval EFI_SUCCESS The region's attributes were successfully modified.
133 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
134 @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
135 a way that will not affect memory regions outside the legacy memory
141 LegacyRegion2BootLock (
142 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
145 OUT UINT32
*Granularity
149 Modify the hardware to allow memory writes in a region.
151 This function changes the attributes of a memory range to allow writes.
153 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
154 @param Start[in] The beginning of the physical address of the region whose
155 attributes should be modified.
156 @param Length[in] The number of bytes of memory whose attributes should be modified.
157 The actual number of bytes modified may be greater than the number
159 @param Granularity[out] The number of bytes in the last region affected. This may be less
160 than the total number of bytes affected if the starting address was
161 not aligned to a region's starting address or if the length was
162 greater than the number of bytes in the first region.
164 @retval EFI_SUCCESS The region's attributes were successfully modified.
165 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
170 LegacyRegion2Unlock (
171 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
174 OUT UINT32
*Granularity
178 Get region information for the attributes of the Legacy Region.
180 This function is used to discover the granularity of the attributes for the memory in the legacy
181 region. Each attribute may have a different granularity and the granularity may not be the same
182 for all memory ranges in the legacy region.
184 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
185 @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
187 @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
188 region information is deposited. This buffer will contain a list of
189 DescriptorCount number of region descriptors. This function will
190 provide the memory for the buffer.
192 @retval EFI_SUCCESS The region's attributes were successfully modified.
193 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
198 LegacyRegionGetInfo (
199 IN EFI_LEGACY_REGION2_PROTOCOL
*This
,
200 OUT UINT32
*DescriptorCount
,
201 OUT EFI_LEGACY_REGION_DESCRIPTOR
**Descriptor
204 #endif //_QNC_LEGACY_REGION_H_