2 Library that provides QNC specific library services in PEI phase
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 __INTEL_QNC_LIB_H__
17 #define __INTEL_QNC_LIB_H__
20 This function initializes the QNC register before MRC.
21 It sets RCBA, PMBASE, disable Watchdog timer and initialize QNC GPIO.
22 If the function cannot complete it'll ASSERT().
32 Used to check SCH if it's S3 state. Clear the register state after query.
34 @retval TRUE if it's S3 state.
35 @retval FALSE if it's not S3 state.
40 QNCCheckS3AndClearState (
45 Used to check SCH if system wakes up from power on reset. Clear the register state after query.
47 @retval TRUE if system wakes up from power on reset
48 @retval FALSE if system does not wake up from power on reset
53 QNCCheckPowerOnResetAndClearState (
58 This function is used to clear SMI and wake status.
68 Used to initialize the QNC register after MRC.
77 /** Send DRAM Ready opcode.
79 @param[in] OpcodeParam Parameter to DRAM ready opcode.
85 QNCSendOpcodeDramReady (
91 Relocate RMU Main binary to memory after MRC to improve performance.
93 @param[in] DestBaseAddress - Specify the new memory address for the RMU Main binary.
94 @param[in] SrcBaseAddress - Specify the current memory address for the RMU Main binary.
95 @param[in] Size - Specify size of the RMU Main binary.
103 IN CONST UINT32 DestBaseAddress
,
104 IN CONST UINT32 SrcBaseAddress
,
109 Get the total memory size
114 QNCGetTotalMemorysize (
119 Get the memory range of TSEG.
120 The TSEG's memory is below TOLM.
122 @param[out] BaseAddress The base address of TSEG's memory range
123 @param[out] MemorySize The size of TSEG's memory range
128 QNCGetTSEGMemoryRange (
129 OUT UINT64
*BaseAddress
,
130 OUT UINT64
*MemorySize
134 Updates the PAM registers in the MCH for the requested range and mode.
136 @param Start The start address of the memory region
137 @param Length The length, in bytes, of the memory region
138 @param ReadEnable Pointer to the boolean variable on whether to enable read for legacy memory section.
139 If NULL, then read attribute will not be touched by this call.
140 @param ReadEnable Pointer to the boolean variable on whether to enable write for legacy memory section.
141 If NULL, then write attribute will not be touched by this call.
142 @param Granularity A pointer to granularity, in bytes, that the PAM registers support
144 @retval RETURN_SUCCESS The PAM registers in the MCH were updated
145 @retval RETURN_INVALID_PARAMETER The memory range is not valid in legacy region.
150 QNCLegacyRegionManipulation (
153 IN BOOLEAN
*ReadEnable
,
154 IN BOOLEAN
*WriteEnable
,
155 OUT UINT32
*Granularity
159 Do early init of pci express rootports on Soc.
164 PciExpressEarlyInit (
169 Complete initialization of all the pci express rootports on Soc.
177 Determine if QNC is supported.
179 @retval FALSE QNC is not supported.
180 @retval TRUE QNC is supported.
189 Get the DeviceId of the SoC
191 @retval PCI DeviceId of the SoC
200 Enable SMI detection of legacy flash access violations.
204 QncEnableLegacyFlashAccessViolationSmi (
209 Setup RMU Thermal sensor registers for Vref mode.
213 QNCThermalSensorSetVRefMode (
218 Setup RMU Thermal sensor registers for Ratiometric mode.
222 QNCThermalSensorSetRatiometricMode (
227 Setup RMU Thermal sensor trip point values.
229 @param[in] CatastrophicTripOnDegreesCelsius - Catastrophic set trip point threshold.
230 @param[in] HotTripOnDegreesCelsius - Hot set trip point threshold.
231 @param[in] HotTripOffDegreesCelsius - Hot clear trip point threshold.
237 QNCThermalSensorSetTripValues (
238 IN CONST UINTN CatastrophicTripOnDegreesCelsius
,
239 IN CONST UINTN HotTripOnDegreesCelsius
,
240 IN CONST UINTN HotTripOffDegreesCelsius
244 Enable RMU Thermal sensor with a Catastrophic Trip point.
246 @retval EFI_SUCCESS Trip points setup.
247 @retval EFI_INVALID_PARAMETER Invalid trip point value.
252 QNCThermalSensorEnableWithCatastrophicTrip (
253 IN CONST UINTN CatastrophicTripOnDegreesCelsius
257 Lock all RMU Thermal sensor control & trip point registers.
262 QNCThermalSensorLockAllRegisters (
267 Set chipset policy for double bit ECC error.
269 @param[in] PolicyValue Policy to config on double bit ECC error.
274 QNCPolicyDblEccBitErr (
275 IN CONST UINT32 PolicyValue
279 Determine if running on secure Quark hardware Sku.
281 @retval FALSE Base Quark Sku or unprovisioned Secure Sku running.
282 @retval TRUE Provisioned SecureSku hardware running.
286 QncIsSecureProvisionedSku (