]> git.proxmox.com Git - mirror_edk2.git/blame - QuarkSocPkg/QuarkNorthCluster/QNCInit/Dxe/LegacyRegion.h
QuarkSocPkg: Add new package for Quark SoC X1000
[mirror_edk2.git] / QuarkSocPkg / QuarkNorthCluster / QNCInit / Dxe / LegacyRegion.h
CommitLineData
9b6bbcdb
MK
1/** @file\r
2The header file legacy region initialization in QNC DXE component.\r
3\r
4Copyright (c) 2013-2015 Intel Corporation.\r
5\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _LEGACY_REGION_H_\r
17#define _LEGACY_REGION_H_\r
18#include "CommonHeader.h"\r
19\r
20#include <IndustryStandard/Pci.h>\r
21\r
22#define LEGACY_REGION_INSTANCE_SIGNATURE SIGNATURE_32('R','E','G','N')\r
23\r
24typedef struct {\r
25 UINT32 Signature;\r
26\r
27 EFI_HANDLE Handle;\r
28 EFI_LEGACY_REGION2_PROTOCOL LegacyRegion2;\r
29 EFI_HANDLE ImageHandle;\r
30\r
31 //\r
32 // Protocol for PAM register access\r
33 //\r
34 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
35} LEGACY_REGION_INSTANCE;\r
36\r
37#define LEGACY_REGION_INSTANCE_FROM_THIS(this) \\r
38 CR(this, LEGACY_REGION_INSTANCE, LegacyRegion2, LEGACY_REGION_INSTANCE_SIGNATURE)\r
39\r
40\r
41EFI_STATUS\r
42LegacyRegionManipluateRegion (\r
43 IN LEGACY_REGION_INSTANCE *Private\r
44 );\r
45\r
46EFI_STATUS\r
47LegacyRegionInit (\r
48 VOID\r
49 );\r
50\r
51/**\r
52 Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.\r
53\r
54 If the On parameter evaluates to TRUE, this function enables memory reads in the address range\r
55 Start to (Start + Length - 1).\r
56 If the On parameter evaluates to FALSE, this function disables memory reads in the address range\r
57 Start to (Start + Length - 1).\r
58\r
59 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.\r
60 @param Start[in] The beginning of the physical address of the region whose attributes\r
61 should be modified.\r
62 @param Length[in] The number of bytes of memory whose attributes should be modified.\r
63 The actual number of bytes modified may be greater than the number\r
64 specified.\r
65 @param Granularity[out] The number of bytes in the last region affected. This may be less\r
66 than the total number of bytes affected if the starting address\r
67 was not aligned to a region's starting address or if the length\r
68 was greater than the number of bytes in the first region.\r
69 @param On[in] Decode / Non-Decode flag.\r
70\r
71 @retval EFI_SUCCESS The region's attributes were successfully modified.\r
72 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r
73\r
74**/\r
75EFI_STATUS\r
76EFIAPI\r
77LegacyRegion2Decode (\r
78 IN EFI_LEGACY_REGION2_PROTOCOL *This,\r
79 IN UINT32 Start,\r
80 IN UINT32 Length,\r
81 OUT UINT32 *Granularity,\r
82 IN BOOLEAN *On\r
83 );\r
84\r
85/**\r
86 Modify the hardware to disallow memory writes in a region.\r
87\r
88 This function changes the attributes of a memory range to not allow writes.\r
89\r
90 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.\r
91 @param Start[in] The beginning of the physical address of the region whose\r
92 attributes should be modified.\r
93 @param Length[in] The number of bytes of memory whose attributes should be modified.\r
94 The actual number of bytes modified may be greater than the number\r
95 specified.\r
96 @param Granularity[out] The number of bytes in the last region affected. This may be less\r
97 than the total number of bytes affected if the starting address was\r
98 not aligned to a region's starting address or if the length was\r
99 greater than the number of bytes in the first region.\r
100\r
101 @retval EFI_SUCCESS The region's attributes were successfully modified.\r
102 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r
103\r
104**/\r
105EFI_STATUS\r
106EFIAPI\r
107LegacyRegion2Lock (\r
108 IN EFI_LEGACY_REGION2_PROTOCOL *This,\r
109 IN UINT32 Start,\r
110 IN UINT32 Length,\r
111 OUT UINT32 *Granularity\r
112 );\r
113\r
114/**\r
115 Modify the hardware to disallow memory attribute changes in a region.\r
116\r
117 This function makes the attributes of a region read only. Once a region is boot-locked with this\r
118 function, the read and write attributes of that region cannot be changed until a power cycle has\r
119 reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.\r
120\r
121 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.\r
122 @param Start[in] The beginning of the physical address of the region whose\r
123 attributes should be modified.\r
124 @param Length[in] The number of bytes of memory whose attributes should be modified.\r
125 The actual number of bytes modified may be greater than the number\r
126 specified.\r
127 @param Granularity[out] The number of bytes in the last region affected. This may be less\r
128 than the total number of bytes affected if the starting address was\r
129 not aligned to a region's starting address or if the length was\r
130 greater than the number of bytes in the first region.\r
131\r
132 @retval EFI_SUCCESS The region's attributes were successfully modified.\r
133 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r
134 @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in\r
135 a way that will not affect memory regions outside the legacy memory\r
136 region.\r
137\r
138**/\r
139EFI_STATUS\r
140EFIAPI\r
141LegacyRegion2BootLock (\r
142 IN EFI_LEGACY_REGION2_PROTOCOL *This,\r
143 IN UINT32 Start,\r
144 IN UINT32 Length,\r
145 OUT UINT32 *Granularity\r
146 );\r
147\r
148/**\r
149 Modify the hardware to allow memory writes in a region.\r
150\r
151 This function changes the attributes of a memory range to allow writes.\r
152\r
153 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.\r
154 @param Start[in] The beginning of the physical address of the region whose\r
155 attributes should be modified.\r
156 @param Length[in] The number of bytes of memory whose attributes should be modified.\r
157 The actual number of bytes modified may be greater than the number\r
158 specified.\r
159 @param Granularity[out] The number of bytes in the last region affected. This may be less\r
160 than the total number of bytes affected if the starting address was\r
161 not aligned to a region's starting address or if the length was\r
162 greater than the number of bytes in the first region.\r
163\r
164 @retval EFI_SUCCESS The region's attributes were successfully modified.\r
165 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r
166\r
167**/\r
168EFI_STATUS\r
169EFIAPI\r
170LegacyRegion2Unlock (\r
171 IN EFI_LEGACY_REGION2_PROTOCOL *This,\r
172 IN UINT32 Start,\r
173 IN UINT32 Length,\r
174 OUT UINT32 *Granularity\r
175 );\r
176\r
177/**\r
178 Get region information for the attributes of the Legacy Region.\r
179\r
180 This function is used to discover the granularity of the attributes for the memory in the legacy\r
181 region. Each attribute may have a different granularity and the granularity may not be the same\r
182 for all memory ranges in the legacy region.\r
183\r
184 @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.\r
185 @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor\r
186 buffer.\r
187 @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy\r
188 region information is deposited. This buffer will contain a list of\r
189 DescriptorCount number of region descriptors. This function will\r
190 provide the memory for the buffer.\r
191\r
192 @retval EFI_SUCCESS The region's attributes were successfully modified.\r
193 @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r
194\r
195**/\r
196EFI_STATUS\r
197EFIAPI\r
198LegacyRegionGetInfo (\r
199 IN EFI_LEGACY_REGION2_PROTOCOL *This,\r
200 OUT UINT32 *DescriptorCount,\r
201 OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor\r
202 );\r
203\r
204#endif //_QNC_LEGACY_REGION_H_\r