]> git.proxmox.com Git - mirror_edk2.git/blame - QuarkSocPkg/QuarkNorthCluster/Include/Library/IntelQNCLib.h
QuarkSocPkg: Add new package for Quark SoC X1000
[mirror_edk2.git] / QuarkSocPkg / QuarkNorthCluster / Include / Library / IntelQNCLib.h
CommitLineData
9b6bbcdb
MK
1/** @file\r
2Library that provides QNC specific library services in PEI phase\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 __INTEL_QNC_LIB_H__\r
17#define __INTEL_QNC_LIB_H__\r
18\r
19/**\r
20 This function initializes the QNC register before MRC.\r
21 It sets RCBA, PMBASE, disable Watchdog timer and initialize QNC GPIO.\r
22 If the function cannot complete it'll ASSERT().\r
23**/\r
24VOID\r
25EFIAPI\r
26PeiQNCPreMemInit (\r
27 VOID\r
28 );\r
29\r
30\r
31/**\r
32 Used to check SCH if it's S3 state. Clear the register state after query.\r
33\r
34 @retval TRUE if it's S3 state.\r
35 @retval FALSE if it's not S3 state.\r
36\r
37**/\r
38BOOLEAN\r
39EFIAPI\r
40QNCCheckS3AndClearState (\r
41 VOID\r
42 );\r
43\r
44/**\r
45 Used to check SCH if system wakes up from power on reset. Clear the register state after query.\r
46\r
47 @retval TRUE if system wakes up from power on reset\r
48 @retval FALSE if system does not wake up from power on reset\r
49\r
50**/\r
51BOOLEAN\r
52EFIAPI\r
53QNCCheckPowerOnResetAndClearState (\r
54 VOID\r
55 );\r
56\r
57/**\r
58 This function is used to clear SMI and wake status.\r
59\r
60**/\r
61VOID\r
62EFIAPI\r
63QNCClearSmiAndWake (\r
64 VOID\r
65 );\r
66\r
67/**\r
68 Used to initialize the QNC register after MRC.\r
69\r
70**/\r
71VOID\r
72EFIAPI\r
73PeiQNCPostMemInit (\r
74 VOID\r
75 );\r
76\r
77/** Send DRAM Ready opcode.\r
78\r
79 @param[in] OpcodeParam Parameter to DRAM ready opcode.\r
80\r
81 @retval VOID\r
82**/\r
83VOID\r
84EFIAPI\r
85QNCSendOpcodeDramReady (\r
86 IN UINT32 OpcodeParam\r
87 );\r
88\r
89/**\r
90\r
91 Relocate RMU Main binary to memory after MRC to improve performance.\r
92\r
93 @param[in] DestBaseAddress - Specify the new memory address for the RMU Main binary.\r
94 @param[in] SrcBaseAddress - Specify the current memory address for the RMU Main binary.\r
95 @param[in] Size - Specify size of the RMU Main binary.\r
96\r
97 @retval VOID\r
98\r
99**/\r
100VOID\r
101EFIAPI\r
102RmuMainRelocation (\r
103 IN CONST UINT32 DestBaseAddress,\r
104 IN CONST UINT32 SrcBaseAddress,\r
105 IN CONST UINTN Size\r
106 );\r
107\r
108/**\r
109 Get the total memory size\r
110\r
111**/\r
112UINT32\r
113EFIAPI\r
114QNCGetTotalMemorysize (\r
115 VOID\r
116 );\r
117\r
118/**\r
119 Get the memory range of TSEG.\r
120 The TSEG's memory is below TOLM.\r
121\r
122 @param[out] BaseAddress The base address of TSEG's memory range\r
123 @param[out] MemorySize The size of TSEG's memory range\r
124\r
125**/\r
126VOID\r
127EFIAPI\r
128QNCGetTSEGMemoryRange (\r
129 OUT UINT64 *BaseAddress,\r
130 OUT UINT64 *MemorySize\r
131 );\r
132\r
133/**\r
134 Updates the PAM registers in the MCH for the requested range and mode.\r
135\r
136 @param Start The start address of the memory region\r
137 @param Length The length, in bytes, of the memory region\r
138 @param ReadEnable Pointer to the boolean variable on whether to enable read for legacy memory section.\r
139 If NULL, then read attribute will not be touched by this call.\r
140 @param ReadEnable Pointer to the boolean variable on whether to enable write for legacy memory section.\r
141 If NULL, then write attribute will not be touched by this call.\r
142 @param Granularity A pointer to granularity, in bytes, that the PAM registers support\r
143\r
144 @retval RETURN_SUCCESS The PAM registers in the MCH were updated\r
145 @retval RETURN_INVALID_PARAMETER The memory range is not valid in legacy region.\r
146\r
147**/\r
148RETURN_STATUS\r
149EFIAPI\r
150QNCLegacyRegionManipulation (\r
151 IN UINT32 Start,\r
152 IN UINT32 Length,\r
153 IN BOOLEAN *ReadEnable,\r
154 IN BOOLEAN *WriteEnable,\r
155 OUT UINT32 *Granularity\r
156 );\r
157\r
158/**\r
159 Do early init of pci express rootports on Soc.\r
160\r
161**/\r
162VOID\r
163EFIAPI\r
164PciExpressEarlyInit (\r
165 VOID\r
166 );\r
167\r
168/**\r
169 Complete initialization of all the pci express rootports on Soc.\r
170**/\r
171EFI_STATUS\r
172EFIAPI\r
173PciExpressInit (\r
174 );\r
175\r
176/**\r
177 Determine if QNC is supported.\r
178\r
179 @retval FALSE QNC is not supported.\r
180 @retval TRUE QNC is supported.\r
181**/\r
182BOOLEAN\r
183EFIAPI\r
184IsQncSupported (\r
185 VOID\r
186 );\r
187\r
188/**\r
189 Get the DeviceId of the SoC\r
190\r
191 @retval PCI DeviceId of the SoC\r
192**/\r
193UINT16\r
194EFIAPI\r
195QncGetSocDeviceId (\r
196 VOID\r
197 );\r
198\r
199/**\r
200 Enable SMI detection of legacy flash access violations.\r
201**/\r
202VOID\r
203EFIAPI\r
204QncEnableLegacyFlashAccessViolationSmi (\r
205 VOID\r
206 );\r
207\r
208/**\r
209 Setup RMU Thermal sensor registers for Vref mode.\r
210**/\r
211VOID\r
212EFIAPI\r
213QNCThermalSensorSetVRefMode (\r
214 VOID\r
215 );\r
216\r
217/**\r
218 Setup RMU Thermal sensor registers for Ratiometric mode.\r
219**/\r
220VOID\r
221EFIAPI\r
222QNCThermalSensorSetRatiometricMode (\r
223 VOID\r
224 );\r
225\r
226/**\r
227 Setup RMU Thermal sensor trip point values.\r
228\r
229 @param[in] CatastrophicTripOnDegreesCelsius - Catastrophic set trip point threshold.\r
230 @param[in] HotTripOnDegreesCelsius - Hot set trip point threshold.\r
231 @param[in] HotTripOffDegreesCelsius - Hot clear trip point threshold.\r
232\r
233 @retval VOID\r
234**/\r
235EFI_STATUS\r
236EFIAPI\r
237QNCThermalSensorSetTripValues (\r
238 IN CONST UINTN CatastrophicTripOnDegreesCelsius,\r
239 IN CONST UINTN HotTripOnDegreesCelsius,\r
240 IN CONST UINTN HotTripOffDegreesCelsius\r
241 );\r
242\r
243/**\r
244 Enable RMU Thermal sensor with a Catastrophic Trip point.\r
245\r
246 @retval EFI_SUCCESS Trip points setup.\r
247 @retval EFI_INVALID_PARAMETER Invalid trip point value.\r
248\r
249**/\r
250EFI_STATUS\r
251EFIAPI\r
252QNCThermalSensorEnableWithCatastrophicTrip (\r
253 IN CONST UINTN CatastrophicTripOnDegreesCelsius\r
254 );\r
255\r
256/**\r
257 Lock all RMU Thermal sensor control & trip point registers.\r
258\r
259**/\r
260VOID\r
261EFIAPI\r
262QNCThermalSensorLockAllRegisters (\r
263 VOID\r
264 );\r
265\r
266/**\r
267 Set chipset policy for double bit ECC error.\r
268\r
269 @param[in] PolicyValue Policy to config on double bit ECC error.\r
270\r
271**/\r
272VOID\r
273EFIAPI\r
274QNCPolicyDblEccBitErr (\r
275 IN CONST UINT32 PolicyValue\r
276 );\r
277\r
278/**\r
279 Determine if running on secure Quark hardware Sku.\r
280\r
281 @retval FALSE Base Quark Sku or unprovisioned Secure Sku running.\r
282 @retval TRUE Provisioned SecureSku hardware running.\r
283**/\r
284BOOLEAN\r
285EFIAPI\r
286QncIsSecureProvisionedSku (\r
287 VOID\r
288 );\r
289#endif\r
290\r