diff options
author | Siyuan Wang <wangsiyuanbuaa@gmail.com> | 2013-07-25 15:14:15 +0800 |
---|---|---|
committer | Bruce Griffith <Bruce.Griffith@se-eng.com> | 2013-08-04 05:40:37 +0200 |
commit | affe85fbc8a13d35960aa92ae87cbb6330ad253f (patch) | |
tree | 9c1ace69f12b06b6544faf041994aa4288fb2e45 /src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB | |
parent | ae8d06969bdde9b1250bc3c4ad93f5db408dae98 (diff) |
AMD Kabini: Add AGESA/PI code for new processor family
Change-Id: Icb6f64e2e3cfd678fb4fb4f13f0e4b678d5acc4a
Signed-off-by: Siyuan Wang <SiYuan.Wang@amd.com>
Signed-off-by: Siyuan Wang <wangsiyuanbuaa@gmail.com>
Reviewed-by: Nick Dill <nick.dill@se-eng.com>
Tested-by: Bruce Griffith <bruce.griffith@se-eng.com>
Reviewed-on: http://review.coreboot.org/3836
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
Diffstat (limited to 'src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB')
27 files changed, 14644 insertions, 0 deletions
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbC6State.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbC6State.c new file mode 100644 index 0000000000..b923fec5bd --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbC6State.c @@ -0,0 +1,198 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini C6 C-state feature support functions. + * + * Provides the functions necessary to initialize the C6 feature. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/F16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "Ids.h" +#include "cpuRegisters.h" +#include "cpuFeatures.h" +#include "cpuC6State.h" +#include "cpuApicUtilities.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuServices.h" +#include "cpuFamilyTranslation.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBC6STATE_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ +BOOLEAN +STATIC +F16KbIsC6Supported ( + IN C6_FAMILY_SERVICES *C6Services, + IN UINT32 Socket, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +STATIC +F16KbInitializeC6 ( + IN C6_FAMILY_SERVICES *C6Services, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Is C6 supported on this CPU + * + * @param[in] C6Services Pointer to this CPU's C6 family services. + * @param[in] Socket This core's zero-based socket number. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] StdHeader Config Handle for library, services. + * + * @retval TRUE C6 state is supported. + * @retval FALSE C6 state is not supported. + * + */ +BOOLEAN +STATIC +F16KbIsC6Supported ( + IN C6_FAMILY_SERVICES *C6Services, + IN UINT32 Socket, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + return (IsFeatureEnabled (IoCstate, PlatformConfig, StdHeader)); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Enable C6 on a family 16h Kabini CPU. + * + * @param[in] C6Services Pointer to this CPU's C6 family services. + * @param[in] EntryPoint Timepoint designator. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] StdHeader Config Handle for library, services. + * + * @return AGESA_SUCCESS Always succeeds. + * + */ +AGESA_STATUS +STATIC +F16KbInitializeC6 ( + IN C6_FAMILY_SERVICES *C6Services, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + PCI_ADDR PciAddress; + CSTATE_CTRL1_REGISTER CstateCtrl1; + POPUP_PSTATE_REGISTER PopDownPstate; + CLK_PWR_TIMING_CTRL2_REGISTER ClkPwrTimingCtrl2; + + if ((EntryPoint & CPU_FEAT_AFTER_PM_INIT) != 0) { + // Initialize F4x118 + PciAddress.AddressValue = CSTATE_CTRL1_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &CstateCtrl1, StdHeader); + // Set C-state Action Field 0 + // bits[8] PwrGateEnCstAct0 = 0x1 + // bits[9] PwrOffEnCstAct0 = 0x1 + CstateCtrl1.PwrGateEnCstAct0 = 1; + CstateCtrl1.PwrOffEnCstAct0 = 1; + // Set C-state Action Field 1 + // bits[24] PwrGateEnCstAct1 = 0x1 + // bits[25] PwrOffEnCstAct1 = 0x1 + CstateCtrl1.PwrGateEnCstAct1 = 1; + CstateCtrl1.PwrOffEnCstAct1 = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &CstateCtrl1, StdHeader); + + // Initialize F3xA8[PopDownPstate] = F3xDC[HwPstateMaxVal] + PciAddress.AddressValue = CPTC2_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &ClkPwrTimingCtrl2, StdHeader); + PciAddress.AddressValue = POPUP_PSTATE_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &PopDownPstate, StdHeader); + PopDownPstate.PopDownPstate = ClkPwrTimingCtrl2.HwPstateMaxVal; + LibAmdPciWrite (AccessWidth32, PciAddress, &PopDownPstate, StdHeader); + } else if ((EntryPoint & (CPU_FEAT_AFTER_RESUME_MTRR_SYNC | CPU_FEAT_BEFORE_RELINQUISH_AP)) != 0) { + // Initialize F4x118 + PciAddress.AddressValue = CSTATE_CTRL1_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &CstateCtrl1, StdHeader); + // Set C-state Action Field 0 + // bits[1] CacheFlushEnCstAct0 = 0x1 + CstateCtrl1.CacheFlushEnCstAct0 = 1; + // Set C-state Action Field 1 + // bits[17] CacheFlushEnCstAct1 = 0x1 + CstateCtrl1.CacheFlushEnCstAct1 = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &CstateCtrl1, StdHeader); + } + return AGESA_SUCCESS; +} + +CONST C6_FAMILY_SERVICES ROMDATA F16KbC6Support = +{ + 0, + F16KbIsC6Supported, + F16KbInitializeC6, + ReloadMicrocodePatchAfterMemInit +}; diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCacheFlushOnHalt.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCacheFlushOnHalt.c new file mode 100644 index 0000000000..95c3a5ab96 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCacheFlushOnHalt.c @@ -0,0 +1,150 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD CPU Cache Flush On Halt Function for Family 16h Kabini. + * + * Contains code to initialize Cache Flush On Halt feature for Family 16h Kabini. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + *---------------------------------------------------------------------------- + */ + + +/* + *---------------------------------------------------------------------------- + * MODULES USED + * + *---------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuRegisters.h" +#include "cpuServices.h" +#include "cpuFamilyTranslation.h" +#include "cpuPostInit.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuFeatures.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBCACHEFLUSHONHALT_FILECODE + +/*---------------------------------------------------------------------------- + * DEFINITIONS AND MACROS + * + *---------------------------------------------------------------------------- + */ + + +/*---------------------------------------------------------------------------- + * TYPEDEFS AND STRUCTURES + * + *---------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------- + * PROTOTYPES OF LOCAL FUNCTIONS + * + *---------------------------------------------------------------------------- + */ +VOID +SetF16KbCacheFlushOnHaltRegister ( + IN CPU_CFOH_FAMILY_SERVICES *FamilySpecificServices, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * P U B L I C F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/* -----------------------------------------------------------------------------*/ +/** + * Enable Cpu Cache Flush On Halt Function + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] EntryPoint Timepoint designator. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] StdHeader Config Handle for library, services. + */ +VOID +SetF16KbCacheFlushOnHaltRegister ( + IN CPU_CFOH_FAMILY_SERVICES *FamilySpecificServices, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + PCI_ADDR PciAddress; + CSTATE_CTRL1_REGISTER CstateCtrl1; + + if ((EntryPoint & (CPU_FEAT_AFTER_POST_MTRR_SYNC | CPU_FEAT_AFTER_RESUME_MTRR_SYNC)) != 0) { + // Set F4x118 + PciAddress.AddressValue = CSTATE_CTRL1_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &CstateCtrl1, StdHeader); + // Set C-state Action Field 0 + // bits[11] NbClkGate0 = 0x1 + // bits[12] SelfRefr0 = 0x1 + CstateCtrl1.NbClkGate0 = 1; + CstateCtrl1.SelfRefr0 = 1; + // Set C-state Action Field 1 + // bits[27] NbClkGate1 = 0x1 + // bits[28] SelfRefr1 = 0x1 + CstateCtrl1.NbClkGate1 = 1; + CstateCtrl1.SelfRefr1 = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &CstateCtrl1, StdHeader); + + //Override the default setting + IDS_OPTION_HOOK (IDS_CACHE_FLUSH_HLT, NULL, StdHeader); + } + +} + +CONST CPU_CFOH_FAMILY_SERVICES ROMDATA F16KbCacheFlushOnHalt = +{ + 0, + SetF16KbCacheFlushOnHaltRegister +}; diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCoreAfterReset.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCoreAfterReset.c new file mode 100644 index 0000000000..0ae46c605e --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCoreAfterReset.c @@ -0,0 +1,250 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini after warm reset sequence for core P-states + * + * Performs the "Core Minimum P-State Transition Sequence After Warm Reset" + * as described in the BKDG. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuRegisters.h" +#include "GeneralServices.h" +#include "cpuApicUtilities.h" +#include "cpuFamilyTranslation.h" +#include "F16KbCoreAfterReset.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBCOREAFTERRESET_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +STATIC +F16KbPmCoreAfterResetPhase1OnCore ( + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbPmCoreAfterResetPhase2OnCore ( + IN VOID *HwPsMaxVal, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Family 16h Kabini core 0 entry point for performing the necessary steps for core + * P-states after a warm reset has occurred. + * + * The steps are as follows: + * 1. Write 0 to MSRC001_0062[PstateCmd] on all cores in the processor. + * 2. Wait for MSRC001_0071[CurCpuFid, CurCpuDid] = [CpuFid, CpuDid] from + * MSRC001_00[6B:64] indexed by MSRC001_0071[CurPstateLimit]. + * 3. Write MSRC001_0061[PstateMaxVal] to MSRC001_0062[PstateCmd] on all + * cores in the processor. + * 4. Wait for MSRC001_0071[CurCpuFid, CurCpuDid] = [CpuFid, CpuDid] from + * MSRC001_00[6B:64] indexed by MSRC001_0061[PstateMaxVal]. + * 5. If MSRC001_0071[CurPstateLimit] != MSRC001_0071[CurPstate], wait for + * MSRC001_0071[CurCpuVid] = [CpuVid] from MSRC001_00[6B:64] indexed by + * MSRC001_0061[PstateMaxVal]. + * 6. Wait for MSRC001_0063[CurPstate] = MSRC001_0062[PstateCmd]. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] CpuEarlyParamsPtr Service parameters + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +F16KbPmCoreAfterReset ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParamsPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 Core; + UINT32 HwPsMaxVal; + PCI_ADDR PciAddress; + AP_TASK TaskPtr; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbPmCoreAfterReset\n"); + + GetCurrentCore (&Core, StdHeader); + ASSERT (Core == 0); + + PciAddress.AddressValue = MAKE_SBDFO (0, 0, 24, FUNC_3, CPTC2_REG); + LibAmdPciRead (AccessWidth32, PciAddress, &HwPsMaxVal, StdHeader); + HwPsMaxVal = ((CLK_PWR_TIMING_CTRL2_REGISTER *) &HwPsMaxVal)->HwPstateMaxVal; + + // Launch each local core to perform steps 1 through 3. + TaskPtr.FuncAddress.PfApTask = F16KbPmCoreAfterResetPhase1OnCore; + TaskPtr.DataTransfer.DataSizeInDwords = 0; + TaskPtr.ExeFlags = WAIT_FOR_CORE; + ApUtilRunCodeOnAllLocalCoresAtEarly (&TaskPtr, StdHeader, CpuEarlyParamsPtr); + + // Launch each local core to perform steps 4 through 6. + TaskPtr.FuncAddress.PfApTaskI = F16KbPmCoreAfterResetPhase2OnCore; + TaskPtr.DataTransfer.DataSizeInDwords = 1; + TaskPtr.DataTransfer.DataPtr = &HwPsMaxVal; + TaskPtr.DataTransfer.DataTransferFlags = 0; + TaskPtr.ExeFlags = WAIT_FOR_CORE; + ApUtilRunCodeOnAllLocalCoresAtEarly (&TaskPtr, StdHeader, CpuEarlyParamsPtr); +} + + +/*--------------------------------------------------------------------------------------- + * L O C A L F U N C T I O N S + *--------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Support routine for F16KbPmCoreAfterReset to perform MSR initialization on all + * cores of a family 16h socket. + * + * This function implements steps 1 - 3 on each core. + * + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +F16KbPmCoreAfterResetPhase1OnCore ( + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT64 CofvidSts; + UINT64 LocalMsrRegister; + UINT64 PstateCtrl; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbPmCoreAfterResetPhase1OnCore\n"); + + // 1. Write 0 to MSRC001_0062[PstateCmd] on all cores in the processor. + PstateCtrl = 0; + LibAmdMsrWrite (MSR_PSTATE_CTL, &PstateCtrl, StdHeader); + + // 2. Wait for MSRC001_0071[CurCpuFid, CurCpuDid] = [CpuFid, CpuDid] from + // MSRC001_00[6B:64] indexed by MSRC001_0071[CurPstateLimit]. + do { + LibAmdMsrRead (MSR_COFVID_STS, &CofvidSts, StdHeader); + LibAmdMsrRead ((UINT32) (MSR_PSTATE_0 + (UINT32) (((COFVID_STS_MSR *) &CofvidSts)->CurPstateLimit)), &LocalMsrRegister, StdHeader); + } while ((((COFVID_STS_MSR *) &CofvidSts)->CurCpuFid != ((PSTATE_MSR *) &LocalMsrRegister)->CpuFid) || + (((COFVID_STS_MSR *) &CofvidSts)->CurCpuDid != ((PSTATE_MSR *) &LocalMsrRegister)->CpuDid)); + + // 3. Write MSRC001_0061[PstateMaxVal] to MSRC001_0062[PstateCmd] on all + // cores in the processor. + LibAmdMsrRead (MSR_PSTATE_CURRENT_LIMIT, &LocalMsrRegister, StdHeader); + ((PSTATE_CTRL_MSR *) &PstateCtrl)->PstateCmd = ((PSTATE_CURLIM_MSR *) &LocalMsrRegister)->PstateMaxVal; + LibAmdMsrWrite (MSR_PSTATE_CTL, &PstateCtrl, StdHeader); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Support routine for F16KbPmCoreAfterReset to perform MSR initialization on all + * cores of a family 16h socket. + * + * This function implements steps 4 - 6 on each core. + * + * @param[in] HwPsMaxVal Index of the highest enabled HW P-state. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +F16KbPmCoreAfterResetPhase2OnCore ( + IN VOID *HwPsMaxVal, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT64 TargetPsMsr; + UINT64 LocalMsrRegister; + UINT64 PstateCtrl; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbPmCoreAfterResetPhase2OnCore\n"); + + // 4. Wait for MSRC001_0071[CurCpuFid, CurCpuDid] = [CpuFid, CpuDid] from + // MSRC001_00[6B:64] indexed by D18F3xDC[PstateMaxVal]. + LibAmdMsrRead ((*(UINT32 *) HwPsMaxVal) + MSR_PSTATE_0, &TargetPsMsr, StdHeader); + do { + LibAmdMsrRead (MSR_COFVID_STS, &LocalMsrRegister, StdHeader); + } while ((((COFVID_STS_MSR *) &LocalMsrRegister)->CurCpuFid != ((PSTATE_MSR *) &TargetPsMsr)->CpuFid) || + (((COFVID_STS_MSR *) &LocalMsrRegister)->CurCpuDid != ((PSTATE_MSR *) &TargetPsMsr)->CpuDid)); + + // 5. If MSRC001_0071[CurPstateLimit] != MSRC001_0071[CurPstate], wait for + // MSRC001_0071[CurCpuVid] = [CpuVid] from MSRC001_00[6B:64] indexed by + // MSRC001_0061[PstateMaxVal]. + if (((COFVID_STS_MSR *) &LocalMsrRegister)->CurPstateLimit != ((COFVID_STS_MSR *) &LocalMsrRegister)->CurPstate) { + do { + LibAmdMsrRead (MSR_COFVID_STS, &LocalMsrRegister, StdHeader); + } while (GetF16KbCurCpuVid (&LocalMsrRegister) != GetF16KbCpuVid (&TargetPsMsr)); + } + + // 6. Wait for MSRC001_0063[CurPstate] = MSRC001_0062[PstateCmd]. + LibAmdMsrRead (MSR_PSTATE_CTL, &PstateCtrl, StdHeader); + do { + LibAmdMsrRead (MSR_PSTATE_STS, &LocalMsrRegister, StdHeader); + } while (((PSTATE_STS_MSR *) &LocalMsrRegister)->CurPstate != ((PSTATE_CTRL_MSR *) &PstateCtrl)->PstateCmd); +} diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCoreAfterReset.h b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCoreAfterReset.h new file mode 100644 index 0000000000..2f986286ad --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCoreAfterReset.h @@ -0,0 +1,78 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini after warm reset sequence for core P-states + * + * Contains code that provide power management functionality + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +#ifndef _F16_KB_CORE_AFTER_RESET_H_ +#define _F16_KB_CORE_AFTER_RESET_H_ + + +/*--------------------------------------------------------------------------------------- + * M I X E D (Definitions And Macros / Typedefs, Structures, Enums) + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * T Y P E D E F S, S T R U C T U R E S, E N U M S + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * F U N C T I O N P R O T O T Y P E + *--------------------------------------------------------------------------------------- + */ +VOID +F16KbPmCoreAfterReset ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParamsPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +#endif // _F16_KB_CORE_AFTER_RESET_H_ diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCpb.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCpb.c new file mode 100644 index 0000000000..db00c58e95 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbCpb.c @@ -0,0 +1,195 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 CPB Initialization + * + * Enables core performance boost. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "GeneralServices.h" +#include "cpuFamilyTranslation.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuFeatures.h" +#include "cpuCpb.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBCPB_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +BOOLEAN +STATIC +F16KbIsCpbSupported ( + IN CPB_FAMILY_SERVICES *CpbServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN UINT32 Socket, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +STATIC +F16KbInitializeCpb ( + IN CPB_FAMILY_SERVICES *CpbServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN UINT64 EntryPoint, + IN UINT32 Socket, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------*/ +/** + * BSC entry point for checking whether or not CPB is supported. + * + * @param[in] CpbServices The current CPU's family services. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] Socket Zero based socket number to check. + * @param[in] StdHeader Config handle for library and services. + * + * @retval TRUE CPB is supported. + * @retval FALSE CPB is not supported. + * + */ +BOOLEAN +STATIC +F16KbIsCpbSupported ( + IN CPB_FAMILY_SERVICES *CpbServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN UINT32 Socket, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT64 MsrData; + BOOLEAN CpbSupported; + CPB_CTRL_REGISTER CpbControl; + PCI_ADDR PciAddress; + + CpbSupported = FALSE; + + PciAddress.AddressValue = CPB_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &CpbControl, StdHeader); + if (CpbControl.NumBoostStates != 0) { + LibAmdMsrRead (MSR_PSTATE_0, &MsrData, StdHeader); + if (((PSTATE_MSR *) &MsrData)->PsEnable == 1) { + CpbSupported = TRUE; + } + } + return CpbSupported; +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * BSC entry point for for enabling Core Performance Boost. + * + * Set up D18F4x15C[BoostSrc] and start the PDMs according to the BKDG. + * + * @param[in] CpbServices The current CPU's family services. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] EntryPoint Current CPU feature dispatch point. + * @param[in] Socket Zero based socket number to check. + * @param[in] StdHeader Config handle for library and services. + * + * @retval AGESA_SUCCESS Always succeeds. + * + */ +AGESA_STATUS +STATIC +F16KbInitializeCpb ( + IN CPB_FAMILY_SERVICES *CpbServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN UINT64 EntryPoint, + IN UINT32 Socket, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + CPB_CTRL_REGISTER CpbControl; + PCI_ADDR PciAddress; + F16_PSTATE_MSR PstateMsrData; + UINT32 Pbx; + + if ((EntryPoint & (CPU_FEAT_AFTER_POST_MTRR_SYNC | CPU_FEAT_AFTER_RESUME_MTRR_SYNC)) != 0) { + PciAddress.AddressValue = CPB_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &CpbControl, StdHeader); + if ((CpbControl.BoostSrc == 0) && (CpbControl.NumBoostStates != 0)) { + // If any boosted P-state is still enabled, set BoostSrc = 1. + for (Pbx = 0; Pbx < CpbControl.NumBoostStates; Pbx++) { + LibAmdMsrRead (PS_REG_BASE + Pbx, (UINT64 *)&PstateMsrData, StdHeader); + if (PstateMsrData.PsEnable == 1) { + CpbControl.BoostSrc = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &CpbControl, StdHeader); + break; + } + } + } + } + return AGESA_SUCCESS; +} + +CONST CPB_FAMILY_SERVICES ROMDATA F16KbCpbSupport = +{ + 0, + F16KbIsCpbSupported, + F16KbInitializeCpb +}; diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbDmi.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbDmi.c new file mode 100644 index 0000000000..37d0aa0ea3 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbDmi.c @@ -0,0 +1,369 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD DMI Record Creation API, and related functions for Family16h Kabini. + * + * Contains code that produce the DMI related information. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 87400 $ @e \$Date: 2013-02-01 12:14:44 -0600 (Fri, 01 Feb 2013) $ + * + */ +/***************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuRegisters.h" +#include "cpuFamilyTranslation.h" +#include "cpuPstateTables.h" +#include "cpuLateInit.h" +#include "cpuF16Dmi.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuServices.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBDMI_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ +extern CPU_FAMILY_SUPPORT_TABLE PstateFamilyServiceTable; + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*--------------------------------------------------------------------------------------- + * Processor Family Table + * + *-------------------------------------------------------------------------------------*/ +CONST CHAR8 ROMDATA str_A6[] = "AMD A6-"; +CONST CHAR8 ROMDATA str_A4[] = "AMD A4-"; +CONST CHAR8 ROMDATA str_E2[] = "AMD E2-"; +CONST CHAR8 ROMDATA str_E1[] = "AMD E1-"; +CONST CHAR8 ROMDATA str_GX[] = "AMD GX-"; +/*--------------------------------------------------------------------------------------- + * Processor Family Table + * + * 047h = "E-Series" + * 048h = "A-Series" + * 049h = "GX-Series" + *-------------------------------------------------------------------------------------*/ +CONST CPU_T4_PROC_FAMILY ROMDATA F16KbFT3T4ProcFamily[] = +{ + {str_A6, 0x48}, + {str_A4, 0x48}, + {str_E2, 0x47}, + {str_E1, 0x47}, + {str_GX, 0x49}, +}; + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +DmiF16KbGetInfo ( + IN OUT CPU_TYPE_INFO *CpuInfoPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +DmiF16KbGetT4ProcFamily ( + IN OUT UINT8 *T4ProcFamily, + IN PROC_FAMILY_TABLE *CpuDmiProcFamilyTable, + IN CPU_TYPE_INFO *CpuInfo, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +UINT8 +DmiF16KbGetVoltage ( + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +DmiF16KbGetMemInfo ( + IN OUT CPU_GET_MEM_INFO *CpuGetMemInfoPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +UINT16 +DmiF16KbGetExtClock ( + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/* -----------------------------------------------------------------------------*/ +/** + * + * DmiF16KbGetInfo + * + * Get CPU type information + * + * @param[in,out] CpuInfoPtr Pointer to CPU_TYPE_INFO struct. + * @param[in] StdHeader Standard Head Pointer + * + */ +VOID +DmiF16KbGetInfo ( + IN OUT CPU_TYPE_INFO *CpuInfoPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + CPUID_DATA CpuId; + CPU_SPECIFIC_SERVICES *FamilySpecificServices; + + LibAmdCpuidRead (AMD_CPUID_FMF, &CpuId, StdHeader); + CpuInfoPtr->ExtendedFamily = (UINT8) (CpuId.EAX_Reg >> 20) & 0xFF; // bit 27:20 + CpuInfoPtr->ExtendedModel = (UINT8) (CpuId.EAX_Reg >> 16) & 0xF; // bit 19:16 + CpuInfoPtr->BaseFamily = (UINT8) (CpuId.EAX_Reg >> 8) & 0xF; // bit 11:8 + CpuInfoPtr->BaseModel = (UINT8) (CpuId.EAX_Reg >> 4) & 0xF; // bit 7:4 + CpuInfoPtr->Stepping = (UINT8) (CpuId.EAX_Reg & 0xF); // bit 3:0 + + CpuInfoPtr->PackageType = (UINT8) (CpuId.EBX_Reg >> 28) & 0xF; // bit 31:28 + + GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, StdHeader); + CpuInfoPtr->TotalCoreNumber = FamilySpecificServices->GetNumberOfPhysicalCores (FamilySpecificServices, StdHeader); + CpuInfoPtr->TotalCoreNumber--; + + LibAmdCpuidRead (AMD_CPUID_ASIZE_PCCOUNT, &CpuId, StdHeader); + CpuInfoPtr->EnabledCoreNumber = (UINT8) (CpuId.ECX_Reg & 0xFF); // bit 7:0 + + switch (CpuInfoPtr->PackageType) { + case KB_SOCKET_FT3: + /// Use 'NONE' for BGA package + CpuInfoPtr->ProcUpgrade = P_UPGRADE_NONE; + break; + default: + CpuInfoPtr->ProcUpgrade = P_UPGRADE_UNKNOWN; + break; + } + + // L1 Size & Associativity + LibAmdCpuidRead (AMD_CPUID_TLB_L1Cache, &CpuId, StdHeader); + CpuInfoPtr->CacheInfo.L1CacheSize = (UINT32) (((CpuId.ECX_Reg >> 24) + (CpuId.EDX_Reg >> 24)) * (CpuInfoPtr->TotalCoreNumber + 1)); + + CpuInfoPtr->CacheInfo.L1CacheAssoc = DMI_ASSOCIATIVE_2_WAY; // Per the BKDG, this is hard-coded to 2-Way. + + // L2 Size & Associativity + LibAmdCpuidRead (AMD_CPUID_L2L3Cache_L2TLB, &CpuId, StdHeader); + CpuInfoPtr->CacheInfo.L2CacheSize = (UINT32) (CpuId.ECX_Reg >> 16); + + CpuInfoPtr->CacheInfo.L2CacheAssoc = DMI_ASSOCIATIVE_16_WAY; // Per the BKDG, this is hard-coded to 16-Way. + + // L3 Size & Associativity + CpuInfoPtr->CacheInfo.L3CacheSize = 0; + CpuInfoPtr->CacheInfo.L3CacheAssoc = DMI_ASSOCIATIVE_UNKNOWN; + } + +/* -----------------------------------------------------------------------------*/ +/** + * + * DmiF16KbGetT4ProcFamily + * + * Get type 4 processor family information + * + * @param[in,out] T4ProcFamily Pointer to type 4 processor family information. + * @param[in] *CpuDmiProcFamilyTable Pointer to DMI family special service + * @param[in] *CpuInfo Pointer to CPU_TYPE_INFO struct + * @param[in] StdHeader Standard Head Pointer + * + */ +VOID +DmiF16KbGetT4ProcFamily ( + IN OUT UINT8 *T4ProcFamily, + IN PROC_FAMILY_TABLE *CpuDmiProcFamilyTable, + IN CPU_TYPE_INFO *CpuInfo, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + CHAR8 NameString[49]; + CONST CHAR8 *DmiString; + CONST VOID *DmiStringTable; + UINT8 NumberOfDmiString; + UINT8 i; + + // Get name string from MSR_C001_00[30:35] + GetNameString (NameString, StdHeader); + // Get DMI String + DmiStringTable = NULL; + switch (CpuInfo->PackageType) { + case KB_SOCKET_FT3: + DmiStringTable = (CONST VOID *) &F16KbFT3T4ProcFamily[0]; + NumberOfDmiString = sizeof (F16KbFT3T4ProcFamily) / sizeof (CPU_T4_PROC_FAMILY); + break; + default: + DmiStringTable = NULL; + NumberOfDmiString = 0; + break; + } + + // Find out which DMI string matches current processor's name string + *T4ProcFamily = P_FAMILY_UNKNOWN; + if ((DmiStringTable != NULL) && (NumberOfDmiString != 0)) { + for (i = 0; i < NumberOfDmiString; i++) { + DmiString = (((CPU_T4_PROC_FAMILY *) DmiStringTable)[i]).Stringstart; + if (IsSourceStrContainTargetStr (NameString, DmiString, StdHeader)) { + *T4ProcFamily = (((CPU_T4_PROC_FAMILY *) DmiStringTable)[i]).T4ProcFamilySetting; + break; + } + } + } +} + +/* -----------------------------------------------------------------------------*/ +/** + * + * DmiF16KbGetVoltage + * + * Get the voltage value according to SMBIOS SPEC's requirement. + * + * @param[in] StdHeader Standard Head Pointer + * + * @retval Voltage - CPU Voltage. + * + */ +UINT8 +DmiF16KbGetVoltage ( + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT8 MaxVid; + UINT8 Voltage; + UINT8 NumberBoostStates; + UINT64 MsrData; + PCI_ADDR TempAddr; + CPB_CTRL_REGISTER CpbCtrl; + + // Voltage = 0x80 + (voltage at boot time * 10) + TempAddr.AddressValue = CPB_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, TempAddr, &CpbCtrl, StdHeader); // F4x15C + NumberBoostStates = (UINT8) CpbCtrl.NumBoostStates; + + LibAmdMsrRead ((MSR_PSTATE_0 + NumberBoostStates), &MsrData, StdHeader); + MaxVid = (UINT8) (((PSTATE_MSR *)&MsrData)->CpuVid); + + if ((MaxVid >= 0xF8) && (MaxVid <= 0xFF)) { + Voltage = 0; + } else { + Voltage = (UINT8) ((155000L - (625 * MaxVid) + 5000) / 10000); + } + + Voltage += 0x80; + return (Voltage); +} + +/* -----------------------------------------------------------------------------*/ +/** + * + * DmiF16KbGetMemInfo + * + * Get memory information. + * + * @param[in,out] CpuGetMemInfoPtr Pointer to CPU_GET_MEM_INFO struct. + * @param[in] StdHeader Standard Head Pointer + * + */ +VOID +DmiF16KbGetMemInfo ( + IN OUT CPU_GET_MEM_INFO *CpuGetMemInfoPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 PciData; + PCI_ADDR PciAddress; + + CpuGetMemInfoPtr->EccCapable = FALSE; + + PciAddress.AddressValue = MAKE_SBDFO (0, 0 , PCI_DEV_BASE, FUNC_2, 0x90); + LibAmdPciRead (AccessWidth32, PciAddress, &PciData, StdHeader); + // Check if F2x90[DimmEccEn] is set + if ((PciData & 0x00080000) != 0) { + CpuGetMemInfoPtr->EccCapable = TRUE; + } +} + +/* -----------------------------------------------------------------------------*/ +/** + * + * DmiF16KbGetExtClock + * + * Get the external clock Speed + * + * @param[in] StdHeader Standard Head Pointer + * + * @retval ExtClock - CPU external clock Speed. + * + */ +UINT16 +DmiF16KbGetExtClock ( + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + return (EXTERNAL_CLOCK_DFLT); +} + +/* -----------------------------------------------------------------------------*/ +CONST PROC_FAMILY_TABLE ROMDATA ProcFamily16KbDmiTable = +{ +// This table is for Processor family 16h Kabini + AMD_FAMILY_16_KB, // ID for Family 16h Kabini + DmiF16KbGetInfo, // Transfer vectors for family + DmiF16KbGetT4ProcFamily, // Get type 4 processor family information + DmiF16KbGetVoltage, // specific routines (above) + DmiF16GetMaxSpeed, + DmiF16KbGetExtClock, + DmiF16KbGetMemInfo, // Get memory information + 0, + NULL +}; + + +/*--------------------------------------------------------------------------------------- + * L O C A L F U N C T I O N S + *--------------------------------------------------------------------------------------- + */ diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbEquivalenceTable.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbEquivalenceTable.c new file mode 100644 index 0000000000..02e5df92af --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbEquivalenceTable.c @@ -0,0 +1,120 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini Equivalence Table related data + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "cpuFamilyTranslation.h" +#include "Filecode.h" +#include "amdlib.h" +#include "cpuRegisters.h" +CODE_GROUP (G2_PEI) +RDATA_GROUP (G2_PEI) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBEQUIVALENCETABLE_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +GetF16KbMicrocodeEquivalenceTable ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT CONST VOID **KbEquivalenceTablePtr, + OUT UINT8 *NumberOfElements, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +STATIC CONST UINT16 ROMDATA stu1[] = +{ + 0x7001, 0x7001, + 0x7000, 0x7000 +}; + + +/*---------------------------------------------------------------------------------------*/ +/** + * Returns the appropriate microcode patch equivalent ID table. + * + * @CpuServiceMethod{::F_CPU_GET_FAMILY_SPECIFIC_ARRAY}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[out] KbEquivalenceTablePtr Points to the first entry in the table. + * @param[out] NumberOfElements Number of valid entries in the table. + * @param[in] StdHeader Header for library and services. + * + */ +VOID +GetF16KbMicrocodeEquivalenceTable ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT CONST VOID **KbEquivalenceTablePtr, + OUT UINT8 *NumberOfElements, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT64 MsrDeCfg; + + LibAmdMsrRead (0xC0011029, &MsrDeCfg, StdHeader); + if ((MsrDeCfg & BIT12) == 0) { + } else { + *NumberOfElements = ((sizeof (stu1) / sizeof (UINT16)) / 2); + *KbEquivalenceTablePtr = stu1; + } +} + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbHtc.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbHtc.c new file mode 100644 index 0000000000..9b93e4512d --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbHtc.c @@ -0,0 +1,178 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini thermal initialization + * + * Performs processor thermal initialization. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 85817 $ @e \$Date: 2013-01-11 16:58:12 -0600 (Fri, 11 Jan 2013) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "Ids.h" +#include "cpuRegisters.h" +#include "GeneralServices.h" +#include "CommonReturns.h" +#include "cpuFeatures.h" +#include "cpuHtc.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "Gnb.h" +#include "GnbPcie.h" +#include "GnbRegistersKB.h" +#include "GnbRegisterAccKB.h" +#include "GnbHandleLib.h" +#include "Filecode.h" +CODE_GROUP (G2_PEI) +RDATA_GROUP (G2_PEI) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBHTC_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ +AGESA_STATUS +STATIC +F16KbInitializeHtc ( + IN HTC_FAMILY_SERVICES *HtcServices, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*----------------------------------------------------------------------------------------*/ +/** + * Main entry point for initializing the Thermal Control + * safety net feature. + * + * This must be run by all Family 16h Kabini core 0s in the system. + * + * @param[in] HtcServices The current CPU's family services. + * @param[in] EntryPoint Timepoint designator. + * @param[in] PlatformConfig Platform profile/build option config structure. + * @param[in] StdHeader Config handle for library and services. + * + * @retval AGESA_SUCCESS Always succeeds. + * + */ +AGESA_STATUS +STATIC +F16KbInitializeHtc ( + IN HTC_FAMILY_SERVICES *HtcServices, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 HtcTempLimit; + NB_CAPS_REGISTER NbCaps; + HTC_REGISTER HtcReg; + CLK_PWR_TIMING_CTRL2_REGISTER Cptc2; + POPUP_PSTATE_REGISTER PopUpPstate; + PCI_ADDR PciAddress; + UINT32 D0F0xBC_xC0107097; + + if ((EntryPoint & (CPU_FEAT_AFTER_POST_MTRR_SYNC | CPU_FEAT_AFTER_RESUME_MTRR_SYNC)) != 0) { + PciAddress.AddressValue = NB_CAPS_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbCaps, StdHeader); + if (NbCaps.HtcCapable == 1) { + // Enable HTC + PciAddress.Address.Register = HTC_REG; + LibAmdPciRead (AccessWidth32, PciAddress, &HtcReg, StdHeader); + GnbRegisterReadKB (GnbGetHandle (StdHeader), 0x4, 0xC0107097, &D0F0xBC_xC0107097, 0, StdHeader); + HtcReg.HtcTmpLmt = (D0F0xBC_xC0107097 >> 3) & 0x7F; + if (HtcReg.HtcTmpLmt != 0) { + // Enable HTC + HtcReg.HtcEn = 1; + PciAddress.Address.Register = CPTC2_REG; + LibAmdPciRead (AccessWidth32, PciAddress, &Cptc2, StdHeader); + if (HtcReg.HtcPstateLimit > Cptc2.HwPstateMaxVal) { + // F3xDC[HwPstateMaxVal] = F3x64[HtcPstateLimit] + Cptc2.HwPstateMaxVal = HtcReg.HtcPstateLimit; + LibAmdPciWrite (AccessWidth32, PciAddress, &Cptc2, StdHeader); + // F3xA8[PopDownPstate] = F3xDC[HwPstateMaxVal] + PciAddress.Address.Register = POPUP_PSTATE_REG; + LibAmdPciRead (AccessWidth32, PciAddress, &PopUpPstate, StdHeader); + PopUpPstate.PopDownPstate = Cptc2.HwPstateMaxVal; + LibAmdPciWrite (AccessWidth32, PciAddress, &PopUpPstate, StdHeader); + } + if ((PlatformConfig->HtcTemperatureLimit >= 520) && (PlatformConfig->LhtcTemperatureLimit != 0)) { + HtcTempLimit = ((PlatformConfig->HtcTemperatureLimit - 520) / 5); + if (HtcTempLimit < HtcReg.HtcTmpLmt) { + HtcReg.HtcTmpLmt = HtcTempLimit; + } + } + } else { + // Disable HTC + HtcReg.HtcEn = 0; + } + PciAddress.Address.Register = HTC_REG; + IDS_OPTION_HOOK (IDS_HTC_CTRL, &HtcReg, StdHeader); + LibAmdPciWrite (AccessWidth32, PciAddress, &HtcReg, StdHeader); + } + } + return AGESA_SUCCESS; +} + +CONST HTC_FAMILY_SERVICES ROMDATA F16KbHtcSupport = +{ + 0, + (PF_HTC_IS_SUPPORTED) CommonReturnTrue, + F16KbInitializeHtc +}; diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbInitEarlyTable.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbInitEarlyTable.c new file mode 100644 index 0000000000..9c0e54baca --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbInitEarlyTable.c @@ -0,0 +1,143 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * Initialize the Family 16h Kabini specific way of running early initialization. + * + * Returns the table of initialization steps to perform at + * AmdInitEarly. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/FAMILY/0x16/KB + * @e \$Revision: 86705 $ @e \$Date: 2013-01-24 17:34:21 -0600 (Thu, 24 Jan 2013) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuFamilyTranslation.h" +#include "Filecode.h" +#include "cpuEarlyInit.h" +CODE_GROUP (G2_PEI) +RDATA_GROUP (G2_PEI) +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBINITEARLYTABLE_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ +extern CONST S_PERFORM_EARLY_INIT_ON_CORE ROMDATA F16KbEarlyInitBeforeApLaunchOnCoreTable[]; +extern CONST S_PERFORM_EARLY_INIT_ON_CORE ROMDATA F16KbEarlyInitAfterApLaunchOnCoreTable[]; +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +VOID +GetF16KbEarlyInitBeforeApLaunchOnCoreTable ( + IN CPU_SPECIFIC_SERVICES *FamilyServices, + OUT CONST S_PERFORM_EARLY_INIT_ON_CORE **Table, + IN AMD_CPU_EARLY_PARAMS *EarlyParams, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +GetF16KbEarlyInitAfterApLaunchOnCoreTable ( + IN CPU_SPECIFIC_SERVICES *FamilyServices, + OUT CONST S_PERFORM_EARLY_INIT_ON_CORE **Table, + IN AMD_CPU_EARLY_PARAMS *EarlyParams, + IN AMD_CONFIG_PARAMS *StdHeader + ); +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*------------------------------------------------------------------------------------*/ +/** + * Initializer routine that may be invoked at AmdCpuEarly (Before AP launch) to return the steps that a + * processor that uses the standard initialization steps should take. + * + * @CpuServiceMethod{::F_GET_EARLY_INIT_TABLE}. + * + * @param[in] FamilyServices The current Family Specific Services. + * @param[out] Table Table of appropriate init steps for the executing core. + * @param[in] EarlyParams Service Interface structure to initialize. + * @param[in] StdHeader Opaque handle to standard config header. + * + */ +VOID +GetF16KbEarlyInitBeforeApLaunchOnCoreTable ( + IN CPU_SPECIFIC_SERVICES *FamilyServices, + OUT CONST S_PERFORM_EARLY_INIT_ON_CORE **Table, + IN AMD_CPU_EARLY_PARAMS *EarlyParams, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + *Table = F16KbEarlyInitBeforeApLaunchOnCoreTable; +} + +/*------------------------------------------------------------------------------------*/ +/** + * Initializer routine that may be invoked at AmdCpuEarly (After AP launch) to return the steps that a + * processor that uses the standard initialization steps should take. + * + * @CpuServiceMethod{::F_GET_EARLY_INIT_TABLE}. + * + * @param[in] FamilyServices The current Family Specific Services. + * @param[out] Table Table of appropriate init steps for the executing core. + * @param[in] EarlyParams Service Interface structure to initialize. + * @param[in] StdHeader Opaque handle to standard config header. + * + */ +VOID +GetF16KbEarlyInitAfterApLaunchOnCoreTable ( + IN CPU_SPECIFIC_SERVICES *FamilyServices, + OUT CONST S_PERFORM_EARLY_INIT_ON_CORE **Table, + IN AMD_CPU_EARLY_PARAMS *EarlyParams, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + *Table = F16KbEarlyInitAfterApLaunchOnCoreTable; +} + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbIoCstate.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbIoCstate.c new file mode 100644 index 0000000000..d3923d6a75 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbIoCstate.c @@ -0,0 +1,371 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini IO C-state feature support functions. + * + * Provides the functions necessary to initialize the IO C-state feature. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ + +#include "AGESA.h" +#include "amdlib.h" +#include "Ids.h" +#include "cpuFeatures.h" +#include "cpuIoCstate.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuLateInit.h" +#include "cpuRegisters.h" +#include "cpuServices.h" +#include "cpuApicUtilities.h" +#include "cpuFamilyTranslation.h" +#include "CommonReturns.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBIOCSTATE_FILECODE + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +STATIC +F16KbInitializeIoCstateOnCore ( + IN VOID *CstateBaseMsr, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +BOOLEAN +F16KbIsCsdObjGenerated ( + IN IO_CSTATE_FAMILY_SERVICES *IoCstateServices, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ +extern CPU_FAMILY_SUPPORT_TABLE IoCstateFamilyServiceTable; + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Enable IO Cstate on a family 16h Kabini CPU. + * Implement BIOS Requirements for Initialization of C-states + * + * @param[in] IoCstateServices Pointer to this CPU's IO Cstate family services. + * @param[in] EntryPoint Timepoint designator. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] StdHeader Config Handle for library, services. + * + * @return AGESA_SUCCESS Always succeeds. + * + */ +AGESA_STATUS +STATIC +F16KbInitializeIoCstate ( + IN IO_CSTATE_FAMILY_SERVICES *IoCstateServices, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT64 LocalMsrRegister; + AP_TASK TaskPtr; + PCI_ADDR PciAddress; + CSTATE_POLICY_CTRL1_REGISTER CstatePolicyCtrl1; + + if ((EntryPoint & CPU_FEAT_AFTER_PM_INIT) != 0) { + // Initialize F4x128 + // bit[4:2] HaltCstateIndex = 0 + PciAddress.AddressValue = CSTATE_POLICY_CTRL1_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &CstatePolicyCtrl1, StdHeader); + CstatePolicyCtrl1.HaltCstateIndex = 0; + LibAmdPciWrite (AccessWidth32, PciAddress, &CstatePolicyCtrl1, StdHeader); + + // Initialize MSRC001_0073[CstateAddr] on each core to a region of + // the IO address map with 8 consecutive available addresses. + LocalMsrRegister = 0; + + IDS_HDT_CONSOLE (CPU_TRACE, " Init IO C-state Base at 0x%x\n", PlatformConfig->CStateIoBaseAddress); + ((CSTATE_ADDRESS_MSR *) &LocalMsrRegister)->CstateAddr = PlatformConfig->CStateIoBaseAddress; + + TaskPtr.FuncAddress.PfApTaskI = F16KbInitializeIoCstateOnCore; + TaskPtr.DataTransfer.DataSizeInDwords = 2; + TaskPtr.DataTransfer.DataPtr = &LocalMsrRegister; + TaskPtr.DataTransfer.DataTransferFlags = 0; + TaskPtr.ExeFlags = WAIT_FOR_CORE; + ApUtilRunCodeOnAllLocalCoresAtEarly (&TaskPtr, StdHeader, NULL); + } + return AGESA_SUCCESS; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Enable CState on a family 16h Kabini core. + * + * @param[in] CstateBaseMsr MSR value to write to C001_0073 as determined by core 0. + * @param[in] StdHeader Config Handle for library, services. + * + */ +VOID +STATIC +F16KbInitializeIoCstateOnCore ( + IN VOID *CstateBaseMsr, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + // Initialize MSRC001_0073[CstateAddr] on each core + LibAmdMsrWrite (MSR_CSTATE_ADDRESS, (UINT64 *) CstateBaseMsr, StdHeader); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Returns the size of CST object + * + * @param[in] IoCstateServices IO Cstate services. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data + * @param[in] StdHeader Config Handle for library, services. + * + * @retval CstObjSize Size of CST Object + * + */ +UINT32 +STATIC +F16KbGetAcpiCstObj ( + IN IO_CSTATE_FAMILY_SERVICES *IoCstateServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + BOOLEAN GenerateCsdObj; + UINT32 CStateAcpiObjSize; + IO_CSTATE_FAMILY_SERVICES *FamilyServices; + ACPI_CST_GET_INPUT CstGetInput; + + CstGetInput.IoCstateServices = IoCstateServices; + CstGetInput.PlatformConfig = PlatformConfig; + CstGetInput.CStateAcpiObjSizePtr = &CStateAcpiObjSize; + + IDS_SKIP_HOOK (IDS_CST_SIZE, &CstGetInput, StdHeader) { + CStateAcpiObjSize = CST_HEADER_SIZE + CST_BODY_SIZE; + + // If CSD Object is generated, add the size of CSD Object to the total size of + // CState ACPI Object size + GetFeatureServicesOfCurrentCore (&IoCstateFamilyServiceTable, (CONST VOID **)&FamilyServices, StdHeader); + ASSERT (FamilyServices != NULL); + GenerateCsdObj = FamilyServices->IsCsdObjGenerated (FamilyServices, StdHeader); + + if (GenerateCsdObj) { + CStateAcpiObjSize += CSD_HEADER_SIZE + CSD_BODY_SIZE; + } + } + return CStateAcpiObjSize; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Routine to generate the C-State ACPI objects + * + * @param[in] IoCstateServices IO Cstate services. + * @param[in] LocalApicId Local Apic Id for each core. + * @param[in, out] **PstateAcpiBufferPtr Pointer to the Acpi Buffer Pointer. + * @param[in] StdHeader Config Handle for library, services. + * + */ +VOID +STATIC +F16KbCreateAcpiCstObj ( + IN IO_CSTATE_FAMILY_SERVICES *IoCstateServices, + IN UINT8 LocalApicId, + IN OUT VOID **PstateAcpiBufferPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT64 MsrData; + BOOLEAN GenerateCsdObj; + CST_HEADER_STRUCT *CstHeaderPtr; + CST_BODY_STRUCT *CstBodyPtr; + CSD_HEADER_STRUCT *CsdHeaderPtr; + CSD_BODY_STRUCT *CsdBodyPtr; + IO_CSTATE_FAMILY_SERVICES *FamilyServices; + ACPI_CST_CREATE_INPUT CstInput; + + CstInput.IoCstateServices = IoCstateServices; + CstInput.LocalApicId = LocalApicId; + CstInput.PstateAcpiBufferPtr = PstateAcpiBufferPtr; + + IDS_SKIP_HOOK (IDS_CST_CREATE, &CstInput, StdHeader) { + // Read from MSR C0010073 to obtain CstateAddr + LibAmdMsrRead (MSR_CSTATE_ADDRESS, &MsrData, StdHeader); + + // Typecast the pointer + CstHeaderPtr = (CST_HEADER_STRUCT *) *PstateAcpiBufferPtr; + + // Set CST Header + CstHeaderPtr->NameOpcode = NAME_OPCODE; + CstHeaderPtr->CstName_a__ = CST_NAME__; + CstHeaderPtr->CstName_a_C = CST_NAME_C; + CstHeaderPtr->CstName_a_S = CST_NAME_S; + CstHeaderPtr->CstName_a_T = CST_NAME_T; + + // Typecast the pointer + CstHeaderPtr++; + CstBodyPtr = (CST_BODY_STRUCT *) CstHeaderPtr; + + // Set CST Body + CstBodyPtr->PkgOpcode = PACKAGE_OPCODE; + CstBodyPtr->PkgLength = CST_LENGTH; + CstBodyPtr->PkgElements = CST_NUM_OF_ELEMENTS; + CstBodyPtr->BytePrefix = BYTE_PREFIX_OPCODE; + CstBodyPtr->Count = CST_COUNT; + CstBodyPtr->PkgOpcode2 = PACKAGE_OPCODE; + CstBodyPtr->PkgLength2 = CST_PKG_LENGTH; + CstBodyPtr->PkgElements2 = CST_PKG_ELEMENTS; + CstBodyPtr->BufferOpcode = BUFFER_OPCODE; + CstBodyPtr->BufferLength = CST_SUBPKG_LENGTH; + CstBodyPtr->BufferElements = CST_SUBPKG_ELEMENTS; + CstBodyPtr->BufferOpcode2 = BUFFER_OPCODE; + CstBodyPtr->GdrOpcode = GENERIC_REG_DESCRIPTION; + CstBodyPtr->GdrLength = CST_GDR_LENGTH; + CstBodyPtr->AddrSpaceId = GDR_ASI_SYSTEM_IO; + CstBodyPtr->RegBitWidth = 0x08; + CstBodyPtr->RegBitOffset = 0x00; + CstBodyPtr->AddressSize = GDR_ASZ_BYTE_ACCESS; + CstBodyPtr->RegisterAddr = ((CSTATE_ADDRESS_MSR *) &MsrData)->CstateAddr + 1; + CstBodyPtr->EndTag = 0x0079; + CstBodyPtr->BytePrefix2 = BYTE_PREFIX_OPCODE; + CstBodyPtr->Type = CST_C2_TYPE; + CstBodyPtr->WordPrefix = WORD_PREFIX_OPCODE; + CstBodyPtr->Latency = 400; + CstBodyPtr->DWordPrefix = DWORD_PREFIX_OPCODE; + CstBodyPtr->Power = 0; + + CstBodyPtr++; + //Update the pointer + *PstateAcpiBufferPtr = CstBodyPtr; + + + // Check whether CSD object should be generated + GetFeatureServicesOfCurrentCore (&IoCstateFamilyServiceTable, (CONST VOID **)&FamilyServices, StdHeader); + ASSERT (FamilyServices != NULL); + GenerateCsdObj = FamilyServices->IsCsdObjGenerated (FamilyServices, StdHeader); + + if (GenerateCsdObj) { + CsdHeaderPtr = (CSD_HEADER_STRUCT *) *PstateAcpiBufferPtr; + + // Set CSD Header + CsdHeaderPtr->NameOpcode = NAME_OPCODE; + CsdHeaderPtr->CsdName_a__ = CST_NAME__; + CsdHeaderPtr->CsdName_a_C = CST_NAME_C; + CsdHeaderPtr->CsdName_a_S = CST_NAME_S; + CsdHeaderPtr->CsdName_a_D = CSD_NAME_D; + + CsdHeaderPtr++; + CsdBodyPtr = (CSD_BODY_STRUCT *) CsdHeaderPtr; + + // Set CSD Body + CsdBodyPtr->PkgOpcode = PACKAGE_OPCODE; + CsdBodyPtr->PkgLength = CSD_BODY_SIZE - 1; + CsdBodyPtr->PkgElements = 1; + CsdBodyPtr->PkgOpcode2 = PACKAGE_OPCODE; + CsdBodyPtr->PkgLength2 = CSD_BODY_SIZE - 4; // CSD_BODY_SIZE - Package() - Package Opcode + CsdBodyPtr->PkgElements2 = 6; + CsdBodyPtr->BytePrefix = BYTE_PREFIX_OPCODE; + CsdBodyPtr->NumEntries = 6; + CsdBodyPtr->BytePrefix2 = BYTE_PREFIX_OPCODE; + CsdBodyPtr->Revision = 0; + CsdBodyPtr->DWordPrefix = DWORD_PREFIX_OPCODE; + CsdBodyPtr->Domain = (LocalApicId & 0xFE) >> 1; + CsdBodyPtr->DWordPrefix2 = DWORD_PREFIX_OPCODE; + CsdBodyPtr->CoordType = CSD_COORD_TYPE_HW_ALL; + CsdBodyPtr->DWordPrefix3 = DWORD_PREFIX_OPCODE; + CsdBodyPtr->NumProcessors = 0x2; + CsdBodyPtr->DWordPrefix4 = DWORD_PREFIX_OPCODE; + CsdBodyPtr->Index = 0x0; + + CsdBodyPtr++; + + // Update the pointer + *PstateAcpiBufferPtr = CsdBodyPtr; + } + } +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Routine to check whether CSD object should be created. + * + * @param[in] IoCstateServices IO Cstate services. + * @param[in] StdHeader Config Handle for library, services. + * + * @retval TRUE CSD Object should be created. + * @retval FALSE CSD Object should not be created. + * + */ +BOOLEAN +F16KbIsCsdObjGenerated ( + IN IO_CSTATE_FAMILY_SERVICES *IoCstateServices, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + // CSD Object should only be created when there are two cores per compute unit + if (GetComputeUnitMapping (StdHeader) == EvenCoresMapping) { + return TRUE; + } + return FALSE; +} + +CONST IO_CSTATE_FAMILY_SERVICES ROMDATA F16KbIoCstateSupport = +{ + 0, + (PF_IO_CSTATE_IS_SUPPORTED) CommonReturnTrue, + F16KbInitializeIoCstate, + F16KbGetAcpiCstObj, + F16KbCreateAcpiCstObj, + F16KbIsCsdObjGenerated +}; diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbLogicalIdTables.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbLogicalIdTables.c new file mode 100644 index 0000000000..97affa017c --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbLogicalIdTables.c @@ -0,0 +1,107 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini Logical ID Table + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "cpuRegisters.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBLOGICALIDTABLES_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +GetF16KbLogicalIdAndRev ( + OUT CONST CPU_LOGICAL_ID_XLAT **KbIdPtr, + OUT UINT8 *NumberOfElements, + OUT UINT64 *LogicalFamily, + IN OUT AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +STATIC CONST CPU_LOGICAL_ID_XLAT ROMDATA CpuF16KbLogicalIdAndRevArray[] = +{ + { + 0x7001, + AMD_F16_KB_A1 + }, + { + 0x7000, + AMD_F16_KB_A0 + }, +}; + +VOID +GetF16KbLogicalIdAndRev ( + OUT CONST CPU_LOGICAL_ID_XLAT **KbIdPtr, + OUT UINT8 *NumberOfElements, + OUT UINT64 *LogicalFamily, + IN OUT AMD_CONFIG_PARAMS *StdHeader + ) +{ + *NumberOfElements = (sizeof (CpuF16KbLogicalIdAndRevArray) / sizeof (CPU_LOGICAL_ID_XLAT)); + *KbIdPtr = CpuF16KbLogicalIdAndRevArray; + *LogicalFamily = AMD_FAMILY_16_KB; +} + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatch0700002A_Enc.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatch0700002A_Enc.c new file mode 100644 index 0000000000..5a010ae1a4 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatch0700002A_Enc.c @@ -0,0 +1,3539 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD F16Kb Microcode patch. + * + * F16Kb Microcode Patch rev 0700002A for 7000 or equivalent. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84798 $ @e \$Date: 2012-12-19 21:26:23 -0600 (Wed, 19 Dec 2012) $ + */ +/***************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ***************************************************************************/ + + + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "Ids.h" +#include "cpuRegisters.h" +#include "cpuEarlyInit.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + + +// Encrypt Patch code 0700002A for 7000 and equivalent + +CONST UINT8 ROMDATA arr1 [IDS_PAD_4K] = +{ + 0x12, + 0x20, + 0x18, + 0x12, + 0x2a, + 0x00, + 0x00, + 0x07, + 0x03, + 0x80, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x70, + 0x00, + 0x00, + 0x00, + 0xaa, + 0xaa, + 0xaa, + 0x49, + 0x98, + 0x47, + 0x92, + 0x9e, + 0x94, + 0x1c, + 0x90, + 0x43, + 0x82, + 0xfb, + 0x61, + 0x5c, + 0xc3, + 0x8a, + 0xb1, + 0xd7, + 0x77, + 0xc5, + 0x2f, + 0xe2, + 0x32, + 0x8e, + 0xa2, + 0xfe, + 0x17, + 0x86, + 0x8b, + 0xea, + 0xf8, + 0x9c, + 0x9a, + 0xdb, + 0x75, + 0x44, + 0x1c, + 0x12, + 0xd5, + 0x0f, + 0x64, + 0x9f, + 0x29, + 0x38, + 0x9c, + 0xec, + 0xfd, + 0x20, + 0xb9, + 0x5c, + 0x11, + 0xfa, + 0xac, + 0xde, + 0xa7, + 0xaf, + 0xb2, + 0x71, + 0x1b, + 0x5d, + 0x8d, + 0x0a, + 0x84, + 0xff, + 0xae, + 0x77, + 0xef, + 0xee, + 0xe8, + 0xb9, + 0xe4, + 0x4c, + 0xcf, + 0x43, + 0x69, + 0xda, + 0x62, + 0x85, + 0x56, + 0x75, + 0xf4, + 0xa9, + 0x9e, + 0x2a, + 0x63, + 0x6d, + 0xdd, + 0xcb, + 0x04, + 0x18, + 0xeb, + 0xa5, + 0xab, + 0x8d, + 0xd7, + 0x03, + 0x48, + 0x71, + 0x18, + 0x18, + 0x3e, + 0xff, + 0x33, + 0x60, + 0xb0, + 0x43, + 0x6c, + 0xa3, + 0xc6, + 0x78, + 0x0a, + 0xc8, + 0x88, + 0x0b, + 0x85, + 0x34, + 0x41, + 0x72, + 0xe7, + 0x2f, + 0xac, + 0x22, + 0x75, + 0x9c, + 0xe3, + 0x58, + 0xa0, + 0xf4, + 0xa7, + 0x39, + 0x42, + 0x6c, + 0x39, + 0xe6, + 0x8e, + 0xd2, + 0xbc, + 0x6d, + 0xea, + 0x84, + 0xb6, + 0x83, + 0xdf, + 0xfa, + 0x39, + 0xf8, + 0x22, + 0x55, + 0xd4, + 0x69, + 0x89, + 0x6a, + 0xcd, + 0xb0, + 0x3d, + 0xdc, + 0x2e, + 0x16, + 0xcd, + 0xd6, + 0xeb, + 0x66, + 0x67, + 0x74, + 0xc1, + 0x3c, + 0x7c, + 0xed, + 0xce, + 0x4c, + 0x15, + 0xdf, + 0x64, + 0x80, + 0xbc, + 0x7f, + 0xee, + 0x45, + 0x2f, + 0xa2, + 0x64, + 0x3b, + 0xed, + 0x26, + 0xdd, + 0xb5, + 0xb7, + 0xef, + 0xa2, + 0x7d, + 0x9b, + 0x05, + 0x67, + 0xbe, + 0x6e, + 0xbd, + 0xb4, + 0x7d, + 0x22, + 0x9f, + 0xea, + 0x5b, + 0xe5, + 0xf2, + 0x4b, + 0x5c, + 0xfa, + 0xad, + 0xcc, + 0x41, + 0x10, + 0x63, + 0x1a, + 0xc3, + 0x7a, + 0x8a, + 0x1e, + 0xc2, + 0x41, + 0x3f, + 0xde, + 0x82, + 0x7c, + 0xa9, + 0x49, + 0x43, + 0xd2, + 0x05, + 0x83, + 0xe6, + 0x2c, + 0x3f, + 0xb1, + 0x61, + 0xac, + 0x78, + 0x8a, + 0x03, + 0xe9, + 0xda, + 0x54, + 0xfd, + 0x80, + 0x93, + 0x32, + 0x84, + 0xf6, + 0xee, + 0xb1, + 0x5b, + 0xa4, + 0x3e, + 0x0d, + 0x7a, + 0x6a, + 0x53, + 0x85, + 0x61, + 0x29, + 0x17, + 0xb6, + 0xd3, + 0xaa, + 0x02, + 0x2e, + 0xef, + 0x99, + 0x23, + 0x88, + 0x70, + 0xa8, + 0xfa, + 0xbf, + 0x0a, + 0xac, + 0x41, + 0x1f, + 0x38, + 0x03, + 0x12, + 0x9f, + 0x87, + 0xd8, + 0x74, + 0xdb, + 0xf5, + 0x51, + 0x53, + 0xb0, + 0x57, + 0x74, + 0x1d, + 0xcd, + 0x21, + 0x0e, + 0xa8, + 0x0f, + 0x3e, + 0x0c, + 0x40, + 0x09, + 0xd2, + 0x1d, + 0xd7, + 0xb1, + 0x85, + 0x0d, + 0x1f, + 0x47, + 0x3e, + 0x59, + 0x67, + 0x09, + 0x95, + 0xbb, + 0x05, + 0x52, + 0x7f, + 0xf3, + 0xc2, + 0xf5, + 0x1a, + 0x80, + 0x6d, + 0x31, + 0x18, + 0x9d, + 0xc4, + 0x47, + 0xb4, + 0x5f, + 0x3c, + 0xbb, + 0x20, + 0x51, + 0x02, + 0x5a, + 0x32, + 0x13, + 0x8d, + 0x25, + 0x99, + 0x8d, + 0xa1, + 0x87, + 0x53, + 0xff, + 0x0b, + 0x74, + 0x68, + 0x85, + 0x34, + 0x3a, + 0x56, + 0xfd, + 0x68, + 0x0c, + 0x15, + 0xd2, + 0x67, + 0x4b, + 0x45, + 0xa5, + 0x1b, + 0x5c, + 0x5b, + 0xc9, + 0x08, + 0x73, + 0x99, + 0xd4, + 0xbb, + 0xca, + 0x5c, + 0x96, + 0x39, + 0x9c, + 0xbb, + 0xfe, + 0x1d, + 0xff, + 0x70, + 0xe1, + 0xdd, + 0xfb, + 0xb7, + 0x5a, + 0xce, + 0x1f, + 0x16, + 0xc8, + 0x2b, + 0x2d, + 0xa5, + 0xdc, + 0xbf, + 0x08, + 0xfe, + 0x8a, + 0xf8, + 0xd6, + 0xd7, + 0xf5, + 0x0e, + 0x5e, + 0xcf, + 0xb1, + 0x0f, + 0xf8, + 0x0c, + 0x89, + 0xb4, + 0x36, + 0xd3, + 0x81, + 0xe4, + 0xd5, + 0x16, + 0x23, + 0xe3, + 0x1c, + 0xb3, + 0xe1, + 0x82, + 0x41, + 0x81, + 0xd4, + 0x6b, + 0xc2, + 0x51, + 0xfb, + 0x26, + 0x59, + 0x9c, + 0x01, + 0xc2, + 0xc7, + 0xc1, + 0x60, + 0xf9, + 0xe0, + 0xfc, + 0x46, + 0xc0, + 0xd1, + 0xf7, + 0xc7, + 0xe1, + 0x44, + 0x23, + 0x3c, + 0x9d, + 0xec, + 0xbb, + 0x6e, + 0x88, + 0xae, + 0x2c, + 0xec, + 0xfb, + 0x5f, + 0xf4, + 0x12, + 0x35, + 0xff, + 0x09, + 0x81, + 0x66, + 0x81, + 0x56, + 0xcd, + 0xee, + 0x62, + 0x61, + 0x4d, + 0xc3, + 0xb7, + 0x45, + 0xa4, + 0xec, + 0x07, + 0xca, + 0x49, + 0xce, + 0x34, + 0x56, + 0x33, + 0xdf, + 0xaa, + 0xcb, + 0xf4, + 0xf8, + 0x00, + 0x29, + 0x2f, + 0x30, + 0xf4, + 0xb9, + 0x7a, + 0x5b, + 0x1b, + 0xb5, + 0xe4, + 0x14, + 0x78, + 0x04, + 0x04, + 0xb6, + 0x51, + 0xd2, + 0xf6, + 0xf1, + 0xf4, + 0x09, + 0xca, + 0x66, + 0xe5, + 0x79, + 0xda, + 0xff, + 0xbd, + 0x23, + 0x3e, + 0xb9, + 0xcb, + 0x81, + 0x4b, + 0x32, + 0xff, + 0x3d, + 0x64, + 0x5b, + 0xf3, + 0x78, + 0xe7, + 0x91, + 0x40, + 0x89, + 0xf4, + 0xdc, + 0x50, + 0xa7, + 0xd7, + 0x2c, + 0xd1, + 0x93, + 0x4d, + 0x7f, + 0x35, + 0xa7, + 0xd1, + 0xd1, + 0x17, + 0x99, + 0x63, + 0xae, + 0x8a, + 0x4c, + 0x5a, + 0x50, + 0x47, + 0xa7, + 0x15, + 0x5e, + 0xbc, + 0x09, + 0xce, + 0x7f, + 0x54, + 0x70, + 0xfc, + 0x22, + 0xef, + 0x86, + 0x57, + 0xa7, + 0x68, + 0x01, + 0x00, + 0x00, + 0x00, + 0x2a, + 0x00, + 0x00, + 0x07, + 0x0c, + 0x1b, + 0xae, + 0x1d, + 0x63, + 0x04, + 0x5d, + 0x04, + 0x05, + 0x1a, + 0xd4, + 0x06, + 0xa0, + 0x0d, + 0x0e, + 0x13, + 0xec, + 0x0f, + 0x1b, + 0x10, + 0xe7, + 0x13, + 0x40, + 0x1f, + 0x70, + 0x10, + 0x3e, + 0x11, + 0xe2, + 0x13, + 0x93, + 0x07, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xff, + 0xf7, + 0x7f, + 0x22, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x43, + 0x0c, + 0xfe, + 0x00, + 0xe1, + 0xcf, + 0x43, + 0xd7, + 0xf1, + 0xa4, + 0x06, + 0x00, + 0x65, + 0xd1, + 0x38, + 0x80, + 0xc1, + 0x1f, + 0x10, + 0xe0, + 0xf7, + 0xff, + 0xff, + 0x80, + 0xe1, + 0x1b, + 0x8a, + 0xfa, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xff, + 0xbf, + 0x2e, + 0xe0, + 0x9f, + 0xab, + 0xff, + 0xff, + 0x7f, + 0xff, + 0xff, + 0xff, + 0xff, + 0xcf, + 0xbf, + 0xf8, + 0xb9, + 0x06, + 0x00, + 0x5a, + 0x5c, + 0x39, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xdf, + 0xff, + 0xff, + 0x2e, + 0xe0, + 0x1f, + 0xab, + 0xfa, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x9d, + 0x4b, + 0xe1, + 0x0a, + 0xa0, + 0x06, + 0x00, + 0x8e, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xcf, + 0x43, + 0xd7, + 0x70, + 0x5c, + 0x39, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xa3, + 0xdb, + 0x38, + 0x00, + 0xc1, + 0xdf, + 0xd9, + 0xeb, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xda, + 0xb8, + 0x06, + 0x00, + 0x00, + 0xff, + 0xff, + 0x3c, + 0xe1, + 0x5f, + 0xeb, + 0xfe, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xdb, + 0x7a, + 0x00, + 0xc0, + 0x1f, + 0xdb, + 0xeb, + 0xf4, + 0x01, + 0x39, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0x4d, + 0xa0, + 0x06, + 0x00, + 0x5b, + 0xd4, + 0x38, + 0x00, + 0x80, + 0x1f, + 0xc0, + 0xff, + 0x9f, + 0xfa, + 0xff, + 0xac, + 0xe1, + 0x1f, + 0xeb, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf8, + 0xff, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xeb, + 0xfe, + 0xe2, + 0xff, + 0xff, + 0x2e, + 0xe1, + 0x9f, + 0xab, + 0xfa, + 0x27, + 0xb9, + 0x06, + 0x00, + 0x0d, + 0xdd, + 0x38, + 0xc0, + 0xa1, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x26, + 0xb9, + 0x06, + 0x00, + 0xfd, + 0xff, + 0xff, + 0x2c, + 0xe0, + 0x9f, + 0x6b, + 0xf1, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xf3, + 0xb8, + 0x06, + 0x00, + 0xf0, + 0x58, + 0x39, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xf0, + 0x5c, + 0x39, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x43, + 0xdc, + 0x38, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0x3f, + 0xdc, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0x1f, + 0xa3, + 0x06, + 0x00, + 0xff, + 0x7f, + 0xff, + 0x2e, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0x8d, + 0xdf, + 0x38, + 0x00, + 0xc1, + 0x1f, + 0x10, + 0xe0, + 0xff, + 0xbd, + 0x07, + 0x00, + 0x38, + 0xdd, + 0x38, + 0xc0, + 0xa1, + 0x1f, + 0xc0, + 0xe7, + 0xb1, + 0xfe, + 0x38, + 0xc0, + 0xa1, + 0x1f, + 0xc0, + 0xe7, + 0xe6, + 0x2f, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x56, + 0x5f, + 0x06, + 0x00, + 0xf8, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x5f, + 0xeb, + 0xfe, + 0xf0, + 0xff, + 0xff, + 0x2e, + 0xe1, + 0x9f, + 0xeb, + 0xfe, + 0x56, + 0xb8, + 0x06, + 0x00, + 0xff, + 0xdd, + 0x7f, + 0x00, + 0xe1, + 0x5d, + 0x8b, + 0xfe, + 0xff, + 0xdb, + 0x7f, + 0x2e, + 0xe1, + 0x8f, + 0x6b, + 0xcb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x67, + 0xd9, + 0x3a, + 0x00, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x42, + 0xa0, + 0x06, + 0x00, + 0x9d, + 0xf1, + 0xef, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xe0, + 0xff, + 0xff, + 0x2f, + 0xe1, + 0x1f, + 0xe0, + 0xac, + 0xdf, + 0xfb, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0x2c, + 0xa0, + 0x06, + 0x00, + 0xf7, + 0x63, + 0x3f, + 0x00, + 0xc0, + 0x9f, + 0xd9, + 0xeb, + 0xef, + 0x61, + 0x3f, + 0x00, + 0xc0, + 0x9f, + 0xd9, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd7, + 0x7a, + 0x00, + 0xc0, + 0xdf, + 0xda, + 0xeb, + 0xe7, + 0xff, + 0xff, + 0x00, + 0xe0, + 0xdd, + 0x0a, + 0xf9, + 0x81, + 0xaf, + 0x06, + 0x00, + 0xef, + 0x56, + 0x39, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0xdf, + 0xff, + 0xff, + 0x2f, + 0xe0, + 0xdf, + 0xab, + 0xfa, + 0x80, + 0xaf, + 0x06, + 0x00, + 0x7f, + 0xfd, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0x67, + 0xf9, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0x0d, + 0xa0, + 0x06, + 0x00, + 0x77, + 0xd5, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0xd9, + 0x7f, + 0x3f, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x6f, + 0xd7, + 0x3a, + 0x00, + 0xc0, + 0x9f, + 0xdb, + 0xeb, + 0xff, + 0x57, + 0x7f, + 0x29, + 0xa0, + 0x9f, + 0xc9, + 0xe7, + 0x0c, + 0xa0, + 0x06, + 0x00, + 0x67, + 0xd9, + 0x3a, + 0x00, + 0xc0, + 0x9f, + 0xdb, + 0xeb, + 0xc0, + 0xff, + 0xff, + 0x28, + 0xe0, + 0x1f, + 0xe0, + 0xac, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf9, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x9f, + 0xaf, + 0xfe, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x6b, + 0xb8, + 0x06, + 0x00, + 0xf5, + 0xff, + 0xff, + 0x28, + 0xe1, + 0x9f, + 0xaf, + 0xfe, + 0x90, + 0xff, + 0xff, + 0x29, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x0b, + 0xd0, + 0x38, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0x7b, + 0xfa, + 0xff, + 0xa8, + 0xe1, + 0x1f, + 0xea, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xdb, + 0x7a, + 0x00, + 0xc1, + 0x1f, + 0x1a, + 0xe0, + 0x00, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x5b, + 0xeb, + 0xfe, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x07, + 0xd0, + 0x38, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0x6f, + 0xfc, + 0xff, + 0xa8, + 0xe1, + 0x1f, + 0xea, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd9, + 0x7a, + 0x00, + 0xc1, + 0x1f, + 0x1a, + 0xe0, + 0xff, + 0xff, + 0xff, + 0xac, + 0xe1, + 0x1f, + 0xeb, + 0xe1, + 0x5b, + 0x92, + 0x06, + 0x00, + 0xff, + 0xd9, + 0x7f, + 0x2d, + 0xe1, + 0x5f, + 0xab, + 0xfe, + 0xa1, + 0xdb, + 0x38, + 0x00, + 0xa1, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf9, + 0xff, + 0xff, + 0x2f, + 0xe1, + 0xdf, + 0xab, + 0xfa, + 0xfc, + 0xff, + 0xff, + 0x2f, + 0xe1, + 0xdf, + 0xeb, + 0xfe, + 0x1e, + 0xa0, + 0x06, + 0x00, + 0xfe, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xdb, + 0x8b, + 0xfe, + 0xff, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xd7, + 0xc3, + 0xd6, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xfb, + 0xff, + 0x26, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xa3, + 0xdf, + 0x38, + 0x00, + 0xc1, + 0x9f, + 0xd9, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xe7, + 0xff, + 0xff, + 0x2f, + 0xe1, + 0xdf, + 0xeb, + 0xfa, + 0xf7, + 0xff, + 0xff, + 0x2f, + 0xe1, + 0xdf, + 0xeb, + 0xff, + 0x1e, + 0xa0, + 0x06, + 0x00, + 0xef, + 0xdf, + 0x3a, + 0x00, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd5, + 0x7a, + 0x00, + 0xc1, + 0x1f, + 0xdb, + 0xeb, + 0x81, + 0xff, + 0xff, + 0x2c, + 0xe1, + 0x9f, + 0xea, + 0xfe, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf7, + 0xff, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xeb, + 0xff, + 0xf8, + 0xff, + 0xff, + 0x2a, + 0xe1, + 0x9f, + 0xaa, + 0xfa, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xfe, + 0xff, + 0xff, + 0x2a, + 0xe1, + 0x9f, + 0xea, + 0xfe, + 0xff, + 0xd5, + 0x7f, + 0x2c, + 0xe1, + 0x1f, + 0xab, + 0xfa, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe0, + 0x1f, + 0x4b, + 0xe6, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe0, + 0xdf, + 0x79, + 0xe4, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xab, + 0xdb, + 0x38, + 0x00, + 0xc0, + 0x5f, + 0x9a, + 0xfc, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xe2, + 0xff, + 0xcf, + 0x7f, + 0x27, + 0xe0, + 0x5f, + 0x6b, + 0xe3, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xdc, + 0xff, + 0xff, + 0x27, + 0xe0, + 0xdd, + 0xa9, + 0xfa, + 0xe2, + 0xff, + 0xff, + 0x2a, + 0xe0, + 0x9f, + 0xea, + 0xfa, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd5, + 0x7f, + 0x2c, + 0xe0, + 0xcf, + 0x69, + 0xff, + 0x4f, + 0xd8, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x2e, + 0xe0, + 0x1f, + 0xe0, + 0xe2, + 0xff, + 0xd9, + 0x7f, + 0x2c, + 0xe0, + 0x9f, + 0x6b, + 0xe3, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xdf, + 0xff, + 0xff, + 0x2c, + 0xe0, + 0x1d, + 0xab, + 0xfa, + 0xdf, + 0xff, + 0xff, + 0x2e, + 0xe0, + 0x9f, + 0xeb, + 0xfa, + 0xef, + 0xa5, + 0x06, + 0x00, + 0xff, + 0xdd, + 0x7f, + 0x2c, + 0xe0, + 0x0f, + 0x6b, + 0xff, + 0x2b, + 0xce, + 0x38, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0x94, + 0xbb, + 0x06, + 0x00, + 0xdf, + 0xfb, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xdf, + 0x7a, + 0x2c, + 0xc0, + 0x9f, + 0xdb, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf7, + 0x5f, + 0x3f, + 0x00, + 0xa0, + 0x9f, + 0xc9, + 0xe7, + 0xf7, + 0xdf, + 0x3a, + 0x2c, + 0xc0, + 0x9f, + 0xdb, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xef, + 0x5f, + 0x3f, + 0x00, + 0xa0, + 0x9f, + 0xc9, + 0xe7, + 0x2f, + 0xcc, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xf7, + 0xdf, + 0x3a, + 0x2c, + 0xc0, + 0x9f, + 0xdb, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xdd, + 0x0b, + 0xf9, + 0xfe, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x4b, + 0x6b, + 0xcb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x5b, + 0x7f, + 0x00, + 0xa0, + 0x9f, + 0xc9, + 0xe7, + 0xe7, + 0xff, + 0xff, + 0x26, + 0xe0, + 0x9f, + 0xe9, + 0xff, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf3, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xd7, + 0xc3, + 0xd6, + 0x7f, + 0x5e, + 0x3f, + 0x00, + 0xa0, + 0x9f, + 0xc9, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xff, + 0xbf, + 0x2d, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x0f, + 0xff, + 0xfe, + 0xff, + 0xff, + 0xff, + 0xcf, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xdb, + 0x7f, + 0x2d, + 0xe0, + 0xdf, + 0x6b, + 0xf1, + 0xcc, + 0xff, + 0xff, + 0x2b, + 0xe0, + 0x1f, + 0xe0, + 0xac, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xe0, + 0xff, + 0xff, + 0x28, + 0xe1, + 0x1f, + 0xe0, + 0xac, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd7, + 0x7f, + 0x2d, + 0xe0, + 0x5f, + 0xab, + 0xff, + 0xf7, + 0xdb, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd1, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x00, + 0x00, + 0xfe, + 0x2b, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x00, + 0x00, + 0xfe, + 0x2d, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x49, + 0x9d, + 0x06, + 0x00, + 0x00, + 0x00, + 0xbf, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x00, + 0x80, + 0xff, + 0x7f, + 0x80, + 0x3e, + 0xce, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xdf, + 0xbf, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x5d, + 0xff, + 0xff, + 0xff, + 0xff, + 0xcf, + 0xbf, + 0x49, + 0x3d, + 0x06, + 0x00, + 0xb0, + 0xff, + 0xff, + 0x2b, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xc0, + 0xff, + 0xff, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xac, + 0x49, + 0x3d, + 0x06, + 0x00, + 0x2f, + 0xd4, + 0x38, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0x67, + 0x5e, + 0x3f, + 0x00, + 0xc0, + 0x9f, + 0xda, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xdf, + 0xfb, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xf7, + 0xdf, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd1, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x2f, + 0xd4, + 0x38, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0xf7, + 0x5f, + 0x3f, + 0x00, + 0xc0, + 0x9f, + 0xda, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xef, + 0x5b, + 0x3f, + 0x00, + 0xc0, + 0x9f, + 0xda, + 0xeb, + 0x00, + 0xff, + 0xff, + 0x2f, + 0xe1, + 0xdf, + 0xeb, + 0xfe, + 0x48, + 0xba, + 0x06, + 0x00, + 0xff, + 0xdf, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xf7, + 0xdb, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0x47, + 0xba, + 0x06, + 0x00, + 0xe7, + 0xff, + 0xff, + 0x26, + 0xe0, + 0x9f, + 0xe9, + 0xff, + 0xf4, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xcf, + 0x03, + 0xd7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf7, + 0x81, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xdf, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x2b, + 0xe0, + 0xdf, + 0xeb, + 0xf3, + 0x00, + 0x00, + 0xfe, + 0x2d, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x49, + 0x9d, + 0x06, + 0x00, + 0x00, + 0x00, + 0xbf, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x00, + 0x80, + 0xff, + 0x7f, + 0x80, + 0x3e, + 0xce, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xdf, + 0xbf, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x5d, + 0xff, + 0xff, + 0xff, + 0xff, + 0xcf, + 0xbf, + 0x49, + 0x3d, + 0x06, + 0x00, + 0xb0, + 0xff, + 0xff, + 0x2b, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xc0, + 0xff, + 0xff, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xac, + 0x49, + 0x3d, + 0x06, + 0x00, + 0xcc, + 0xff, + 0xff, + 0x2d, + 0xe0, + 0x1f, + 0xe0, + 0xac, + 0xff, + 0xe5, + 0x7f, + 0x2a, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x67, + 0x5e, + 0x3f, + 0x00, + 0xc0, + 0x9f, + 0xda, + 0xeb, + 0xff, + 0xdb, + 0x7f, + 0x2d, + 0xe0, + 0xdf, + 0xab, + 0xff, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xfe, + 0xff, + 0xff, + 0x2a, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xd5, + 0x7f, + 0x2d, + 0xe0, + 0x5f, + 0x6b, + 0xf1, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xdf, + 0xfb, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xe0, + 0xff, + 0xff, + 0x29, + 0xe1, + 0x1f, + 0xe0, + 0xac, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf7, + 0xdb, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xd3, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xf7, + 0xdf, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xd3, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x00, + 0xff, + 0xff, + 0x31, + 0xe1, + 0x5f, + 0xec, + 0xfe, + 0xff, + 0xe3, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xc3, + 0xb2, + 0x06, + 0x00, + 0xf7, + 0xe1, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xc2, + 0xb2, + 0x06, + 0x00, + 0x0a, + 0x02, + 0xff, + 0x2e, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0x7f, + 0xfd, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xfa, + 0x3a, + 0x06, + 0x00, + 0x39, + 0x1f, + 0xfe, + 0x00, + 0xe1, + 0xcf, + 0x03, + 0xd7, + 0xe7, + 0xff, + 0xff, + 0x2e, + 0xe0, + 0x9f, + 0xeb, + 0xfa, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xee, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x1f, + 0xe0, + 0xac, + 0xff, + 0xdb, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x2d, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0x11, + 0x20, + 0x06, + 0x00, + 0x17, + 0xfc, + 0xbf, + 0x2d, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xcf, + 0xbf, + 0x11, + 0x80, + 0x06, + 0x00, + 0xfc, + 0xff, + 0xff, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xe3, + 0xff, + 0xff, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xee, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0x11, + 0x20, + 0x06, + 0x00, + 0xff, + 0xff, + 0xbf, + 0x2d, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xff, + 0xef, + 0xff, + 0xaa, + 0xff, + 0xcf, + 0xbf, + 0x11, + 0x80, + 0x06, + 0x00, + 0xf1, + 0xff, + 0xff, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xff, + 0xbf, + 0x2d, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xff, + 0x9f, + 0xef, + 0xd5, + 0xfe, + 0xcf, + 0xbf, + 0x11, + 0x80, + 0x06, + 0x00, + 0xf0, + 0xff, + 0xff, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xfe, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0x11, + 0x20, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x56, + 0x5f, + 0x06, + 0x00, + 0x0a, + 0x02, + 0xff, + 0x2e, + 0xe0, + 0x1f, + 0xe0, + 0xe7, + 0xe7, + 0xff, + 0xff, + 0x2e, + 0xe0, + 0x9f, + 0xeb, + 0xfa, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xe0, + 0xff, + 0xff, + 0x29, + 0xe1, + 0x1f, + 0xe0, + 0xac, + 0xdf, + 0xfb, + 0xff, + 0x2c, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd7, + 0x7f, + 0x2b, + 0xe1, + 0x5f, + 0xaa, + 0xff, + 0xf7, + 0xdb, + 0x3a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xfb, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd7, + 0x7a, + 0x2c, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xdb, + 0xf7, + 0xff, + 0x3e, + 0xe0, + 0x1f, + 0x2b, + 0xfb, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xe6, + 0x58, + 0x06, + 0x00, + 0xff, + 0xd1, + 0x7f, + 0x28, + 0xe0, + 0x1f, + 0x6b, + 0xf1, + 0x67, + 0xd1, + 0x3a, + 0x00, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0x46, + 0xa1, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x45, + 0xa1, + 0x06, + 0x00, + 0xf8, + 0xff, + 0xff, + 0x00, + 0xe1, + 0x9d, + 0x0b, + 0xf9, + 0xfe, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xcf, + 0x43, + 0xd7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x2b, + 0xce, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x97, + 0x5b, + 0x02, + 0x00, + 0x57, + 0xdc, + 0x38, + 0x00, + 0xc0, + 0xdf, + 0xdb, + 0xeb, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x9b, + 0x5b, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xbc, + 0xa8, + 0x3e, + 0x11, + 0x69, + 0xce, + 0x06, + 0x3f, + 0xb9, + 0x87, + 0xd7, + 0xdd, + 0xc6, + 0x12, + 0xb6, + 0xe2, + 0xc2, + 0x53, + 0x20, + 0xfb, + 0xea, + 0x71, + 0x72, + 0xb5, + 0xe1, + 0xa6, + 0xd8, + 0xee, + 0x9d, + 0x97, + 0xe6, + 0x72, + 0x3f, + 0x73, + 0x88, + 0xed, + 0x14, + 0x8c, + 0xdf, + 0x5d, + 0x8f, + 0x0d, + 0xd0, + 0x70, + 0x64, + 0x1c, + 0x06, + 0x7f, + 0x59, + 0x93, + 0x32, + 0x55, + 0x2a, + 0x10, + 0x61, + 0xde, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, +}; + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatch07000106_Enc.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatch07000106_Enc.c new file mode 100644 index 0000000000..85bdc4e582 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatch07000106_Enc.c @@ -0,0 +1,3539 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD F16Kb Microcode patch. + * + * F16Kb Microcode Patch rev 07000106 for 7001 or equivalent. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 86822 $ @e \$Date: 2013-01-28 00:17:14 -0500 (Mon, 28 Jan 2013) $ + */ +/***************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ***************************************************************************/ + + + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "Ids.h" +#include "cpuRegisters.h" +#include "cpuEarlyInit.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + + +// Encrypt Patch code 07000106 for 7001 and equivalent + +CONST UINT8 ROMDATA arr2 [IDS_PAD_4K] = +{ + 0x13, + 0x20, + 0x22, + 0x01, + 0x06, + 0x01, + 0x00, + 0x07, + 0x03, + 0x80, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x70, + 0x00, + 0x00, + 0x00, + 0xaa, + 0xaa, + 0xaa, + 0x49, + 0x66, + 0xa8, + 0x8e, + 0x7a, + 0x20, + 0xc7, + 0xae, + 0xe4, + 0xf4, + 0xb4, + 0x4a, + 0x32, + 0x58, + 0xbb, + 0x8b, + 0x60, + 0x57, + 0x0e, + 0x35, + 0x36, + 0xda, + 0x53, + 0x69, + 0xb7, + 0xaf, + 0x84, + 0xe0, + 0x66, + 0x54, + 0x71, + 0x2a, + 0xef, + 0x0f, + 0xf0, + 0x0e, + 0x9d, + 0x5a, + 0xbe, + 0xbe, + 0x19, + 0x2a, + 0xe1, + 0x53, + 0xdf, + 0x30, + 0x15, + 0xe9, + 0x9e, + 0xa2, + 0xb4, + 0x74, + 0x0f, + 0xfa, + 0x38, + 0x6e, + 0x5c, + 0x08, + 0xa5, + 0xe5, + 0xd7, + 0xc3, + 0x24, + 0x04, + 0x5c, + 0x6e, + 0xf5, + 0x57, + 0xb6, + 0x2e, + 0x41, + 0x1d, + 0x5d, + 0xa2, + 0x62, + 0x9c, + 0xce, + 0x79, + 0xfb, + 0xd8, + 0xda, + 0x01, + 0x36, + 0xfe, + 0xcf, + 0x18, + 0x78, + 0xcd, + 0x8b, + 0x49, + 0x92, + 0x0a, + 0x59, + 0x40, + 0x8f, + 0xc9, + 0x3e, + 0xf6, + 0xd7, + 0xea, + 0x78, + 0x89, + 0xc1, + 0xea, + 0xf8, + 0x2e, + 0x35, + 0xf8, + 0xfb, + 0x15, + 0x48, + 0x8f, + 0x07, + 0xd4, + 0x3f, + 0x1f, + 0x85, + 0x38, + 0x87, + 0x17, + 0x38, + 0x23, + 0x9b, + 0xcc, + 0x4a, + 0xea, + 0xfd, + 0x49, + 0x5a, + 0xfe, + 0xb6, + 0x11, + 0x21, + 0xa6, + 0x5d, + 0x26, + 0x5a, + 0x2e, + 0xc9, + 0x49, + 0x4a, + 0x2a, + 0x5b, + 0xc7, + 0x8f, + 0xde, + 0x65, + 0x27, + 0xfd, + 0x9d, + 0x59, + 0x02, + 0xf9, + 0xad, + 0x13, + 0x4a, + 0x19, + 0xb9, + 0x63, + 0x1b, + 0x94, + 0xd8, + 0x24, + 0x87, + 0xd2, + 0xfc, + 0x1d, + 0x4f, + 0xa2, + 0xf1, + 0xf1, + 0x4e, + 0x1a, + 0x8e, + 0x7a, + 0xbd, + 0xaf, + 0xd4, + 0x24, + 0x07, + 0x3b, + 0x43, + 0x2d, + 0xe3, + 0xbf, + 0xc3, + 0x03, + 0x4c, + 0x81, + 0x9b, + 0xec, + 0x8a, + 0x91, + 0x7b, + 0x1c, + 0xe0, + 0x70, + 0xa4, + 0x3f, + 0x83, + 0x4d, + 0xa5, + 0x4b, + 0x9d, + 0xbe, + 0xfe, + 0xdf, + 0xed, + 0xb8, + 0xa9, + 0x0e, + 0xe1, + 0x11, + 0x71, + 0x4d, + 0xfa, + 0x27, + 0x32, + 0x5c, + 0xd1, + 0xe9, + 0x84, + 0xbb, + 0xeb, + 0x65, + 0x19, + 0x09, + 0xc9, + 0x2f, + 0x0c, + 0x80, + 0x14, + 0x3f, + 0x94, + 0x1f, + 0xcd, + 0xaf, + 0x29, + 0x51, + 0x7c, + 0x88, + 0x36, + 0xf3, + 0xcb, + 0x41, + 0x20, + 0xcb, + 0x4c, + 0x1c, + 0x4b, + 0xb2, + 0xaa, + 0x6c, + 0x2c, + 0xab, + 0x37, + 0x5b, + 0x2a, + 0x58, + 0x44, + 0x53, + 0xdf, + 0x59, + 0xbc, + 0x14, + 0xe3, + 0x7f, + 0xd6, + 0x4a, + 0xd6, + 0x98, + 0x59, + 0x8c, + 0xbb, + 0xce, + 0xe6, + 0x86, + 0xdb, + 0x66, + 0xbd, + 0xeb, + 0x51, + 0xf1, + 0xce, + 0x80, + 0x0f, + 0xd9, + 0x83, + 0x86, + 0x17, + 0xed, + 0x78, + 0x3e, + 0x5d, + 0xac, + 0xd1, + 0x13, + 0xfa, + 0x01, + 0x58, + 0x35, + 0xe9, + 0x66, + 0x16, + 0x5d, + 0xa8, + 0x70, + 0x08, + 0x0e, + 0xa3, + 0xab, + 0x3b, + 0xd1, + 0x75, + 0xbf, + 0x2f, + 0xb2, + 0x9a, + 0x7c, + 0xd8, + 0x84, + 0x66, + 0x1a, + 0x07, + 0x00, + 0xe0, + 0x04, + 0xbf, + 0x0e, + 0x04, + 0xaa, + 0x0e, + 0x91, + 0x6f, + 0xb4, + 0xb8, + 0xff, + 0xfa, + 0xad, + 0xb0, + 0xd8, + 0x41, + 0x65, + 0xf5, + 0xd5, + 0x0d, + 0x12, + 0x15, + 0xbf, + 0x40, + 0x5b, + 0xed, + 0xeb, + 0x81, + 0x2a, + 0x1f, + 0x48, + 0x00, + 0x5b, + 0xf7, + 0x08, + 0x35, + 0x86, + 0x8d, + 0xe4, + 0x15, + 0x52, + 0x40, + 0x1b, + 0x88, + 0x5a, + 0x8f, + 0xd0, + 0x4f, + 0xb5, + 0xbc, + 0xdb, + 0x45, + 0x30, + 0xc5, + 0x89, + 0x32, + 0x98, + 0xf9, + 0xa7, + 0x18, + 0x27, + 0xf1, + 0x0b, + 0xc7, + 0x6d, + 0xeb, + 0x7f, + 0x39, + 0xd2, + 0x25, + 0x99, + 0x6d, + 0x3a, + 0x1b, + 0x24, + 0xa4, + 0xc5, + 0x7c, + 0xdf, + 0x33, + 0x3d, + 0x7c, + 0x43, + 0x40, + 0x5b, + 0x8d, + 0xd1, + 0xec, + 0x0c, + 0xca, + 0x76, + 0xd9, + 0x1a, + 0x32, + 0xee, + 0x45, + 0xee, + 0xb6, + 0x30, + 0x21, + 0xf8, + 0x66, + 0xb5, + 0xbf, + 0xfb, + 0x66, + 0x13, + 0x9c, + 0xf0, + 0xcf, + 0xae, + 0xca, + 0x54, + 0xbc, + 0xf1, + 0xce, + 0x76, + 0x57, + 0x8d, + 0xf5, + 0xee, + 0x02, + 0x14, + 0xc0, + 0x62, + 0x3f, + 0xa1, + 0xad, + 0x9d, + 0xbb, + 0x83, + 0x3d, + 0x8f, + 0xf2, + 0xe9, + 0x41, + 0x42, + 0xca, + 0x04, + 0xf9, + 0xf7, + 0x4f, + 0xf7, + 0xc6, + 0x77, + 0xf0, + 0x0e, + 0x8c, + 0xea, + 0xb6, + 0x6c, + 0x47, + 0xae, + 0xd1, + 0x1b, + 0x2c, + 0x89, + 0xbf, + 0x4b, + 0x61, + 0xdc, + 0x2d, + 0x06, + 0x6d, + 0x79, + 0x5c, + 0x5e, + 0x82, + 0xc0, + 0x4f, + 0x54, + 0x5d, + 0x68, + 0x55, + 0x5b, + 0x1c, + 0x75, + 0xb6, + 0xcc, + 0x4b, + 0xb6, + 0x3e, + 0x2b, + 0xec, + 0x30, + 0xa7, + 0x90, + 0xd8, + 0x99, + 0x44, + 0x85, + 0xe7, + 0x21, + 0x33, + 0x00, + 0x48, + 0xf3, + 0xbb, + 0x92, + 0xe9, + 0x48, + 0x99, + 0x45, + 0x66, + 0xd5, + 0xe6, + 0xd9, + 0x9e, + 0x92, + 0x8b, + 0x42, + 0x94, + 0xa3, + 0x2f, + 0x44, + 0xb1, + 0x5e, + 0x07, + 0xd7, + 0x0a, + 0xb4, + 0x7b, + 0x49, + 0x7e, + 0x15, + 0xab, + 0x34, + 0x6b, + 0xff, + 0x1f, + 0xcf, + 0x84, + 0x7f, + 0x57, + 0x6c, + 0xdb, + 0xc3, + 0x3e, + 0xc1, + 0xef, + 0x05, + 0xea, + 0x39, + 0xe0, + 0xe6, + 0x15, + 0x4f, + 0x9a, + 0xdd, + 0x93, + 0x01, + 0x00, + 0x00, + 0x00, + 0x06, + 0x01, + 0x00, + 0x07, + 0xe2, + 0x13, + 0xe7, + 0x13, + 0x93, + 0x07, + 0x66, + 0x04, + 0x60, + 0x04, + 0xd7, + 0x19, + 0x04, + 0x07, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0xf0, + 0x0c, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x6f, + 0xd7, + 0x3a, + 0x00, + 0xc0, + 0x9f, + 0xdb, + 0xeb, + 0xff, + 0x57, + 0x7f, + 0x29, + 0xa0, + 0x9f, + 0xc9, + 0xe7, + 0x55, + 0xa0, + 0x06, + 0x00, + 0x67, + 0xd9, + 0x3a, + 0x00, + 0xc0, + 0x9f, + 0xdb, + 0xeb, + 0xc0, + 0xff, + 0xff, + 0x28, + 0xe0, + 0x1f, + 0xe0, + 0xac, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x67, + 0xd9, + 0x3a, + 0x00, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x17, + 0xac, + 0x06, + 0x00, + 0x9d, + 0xf1, + 0xef, + 0x2b, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x16, + 0xac, + 0x06, + 0x00, + 0xf9, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0x9f, + 0xaf, + 0xfe, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x6b, + 0xb8, + 0x06, + 0x00, + 0xf5, + 0xff, + 0xff, + 0x28, + 0xe1, + 0x9f, + 0xaf, + 0xfe, + 0x90, + 0xff, + 0xff, + 0x29, + 0xe1, + 0x1f, + 0xe0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xdf, + 0xff, + 0xff, + 0x2e, + 0xe0, + 0x1f, + 0xab, + 0xfa, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x9d, + 0x4b, + 0xe1, + 0x53, + 0xa0, + 0x06, + 0x00, + 0xd9, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xcf, + 0x43, + 0xd7, + 0x70, + 0x5c, + 0x39, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xa3, + 0xdb, + 0x38, + 0x00, + 0xc1, + 0xdf, + 0xd9, + 0xeb, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xd7, + 0xb8, + 0x06, + 0x00, + 0x00, + 0xff, + 0xff, + 0x3c, + 0xe1, + 0x5f, + 0xeb, + 0xfe, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xdd, + 0x7f, + 0x2c, + 0xe0, + 0x0f, + 0x6b, + 0xff, + 0x4b, + 0xd8, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0x91, + 0xbb, + 0x06, + 0x00, + 0x2b, + 0xce, + 0x38, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x90, + 0xbb, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x29, + 0xe1, + 0x4f, + 0x2a, + 0xca, + 0xff, + 0x81, + 0x7f, + 0x2d, + 0xe1, + 0x4f, + 0x2b, + 0xca, + 0xfa, + 0xb8, + 0x06, + 0x00, + 0xfb, + 0xff, + 0xff, + 0x2d, + 0xe1, + 0xdf, + 0xab, + 0xfe, + 0x23, + 0xd3, + 0x38, + 0x00, + 0xc1, + 0x1d, + 0x00, + 0xf9, + 0x19, + 0xa1, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x76, + 0x5e, + 0x39, + 0x00, + 0xc0, + 0x1f, + 0xd0, + 0xeb, + 0xf5, + 0xff, + 0xff, + 0x2e, + 0xe1, + 0x1f, + 0xe0, + 0xac, + 0x93, + 0xbf, + 0x06, + 0x00, + 0xff, + 0xdd, + 0x7f, + 0x2f, + 0xe0, + 0xdf, + 0xab, + 0xff, + 0x76, + 0x5e, + 0x39, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0xd1, + 0x7f, + 0x28, + 0xe0, + 0x1f, + 0x6b, + 0xf1, + 0x67, + 0xd1, + 0x3a, + 0x00, + 0xa0, + 0x9f, + 0xcb, + 0xe7, + 0x33, + 0xa1, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x32, + 0xa1, + 0x06, + 0x00, + 0xf8, + 0xff, + 0xff, + 0x00, + 0xe1, + 0x9d, + 0x0b, + 0xf9, + 0xfe, + 0xff, + 0xff, + 0x00, + 0xe1, + 0xcf, + 0x43, + 0xd7, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x2b, + 0xce, + 0x38, + 0x00, + 0xa0, + 0x1f, + 0xc0, + 0xe7, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x94, + 0x5b, + 0x02, + 0x00, + 0x57, + 0xdc, + 0x38, + 0x00, + 0xc0, + 0xdf, + 0xdb, + 0xeb, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0x98, + 0x5b, + 0x06, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0x81, + 0x7f, + 0x00, + 0xe1, + 0x1f, + 0xc0, + 0xbf, + 0xff, + 0xbf, + 0x07, + 0x00, + 0x13, + 0x42, + 0x99, + 0xf4, + 0x9c, + 0x43, + 0x10, + 0xb9, + 0x93, + 0x17, + 0x40, + 0x75, + 0x1b, + 0x3d, + 0x9e, + 0xa9, + 0x4f, + 0xbf, + 0xac, + 0x60, + 0x92, + 0x6b, + 0xbb, + 0x51, + 0x50, + 0x1a, + 0x56, + 0xc0, + 0x34, + 0x59, + 0xb6, + 0x4a, + 0x30, + 0x0a, + 0x21, + 0xa2, + 0x14, + 0x1f, + 0x8d, + 0x89, + 0xc4, + 0x82, + 0xb0, + 0x5c, + 0x8d, + 0x49, + 0x3d, + 0xb8, + 0x34, + 0x7a, + 0x54, + 0xb2, + 0xc2, + 0x0e, + 0x5b, + 0xbc, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, +}; + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatchTables.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatchTables.c new file mode 100644 index 0000000000..4790709618 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMicrocodePatchTables.c @@ -0,0 +1,111 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini microcode patches + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "cpuRegisters.h" +#include "cpuEarlyInit.h" +#include "cpuFamilyTranslation.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBMICROCODEPATCHTABLES_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ +extern CONST MICROCODE_PATCHES_4K ROMDATA *CpuF16KbMicroCodePatchArray[]; +extern CONST UINT8 ROMDATA CpuF16KbNumberOfMicrocodePatches; + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +GetF16KbMicroCodePatchesStruct ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT CONST VOID **KbUcodePtr, + OUT UINT8 *NumberOfElements, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Returns a table containing the appropriate microcode patches. + * + * @CpuServiceMethod{::F_CPU_GET_FAMILY_SPECIFIC_ARRAY}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[out] KbUcodePtr Points to the first entry in the table. + * @param[out] NumberOfElements Number of valid entries in the table. + * @param[in] StdHeader Header for library and services. + * + */ +VOID +GetF16KbMicroCodePatchesStruct ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT CONST VOID **KbUcodePtr, + OUT UINT8 *NumberOfElements, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + *NumberOfElements = CpuF16KbNumberOfMicrocodePatches; + *KbUcodePtr = &CpuF16KbMicroCodePatchArray[0]; +} + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMsrTables.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMsrTables.c new file mode 100644 index 0000000000..12dd300f70 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbMsrTables.c @@ -0,0 +1,264 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 KB MSR tables with values as defined in BKDG + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/FAMILY/0x16/KB + * @e \$Revision: 87267 $ @e \$Date: 2013-01-31 09:34:00 -0600 (Thu, 31 Jan 2013) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuRegisters.h" +#include "F16KbPowerMgmt.h" +#include "Table.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBMSRTABLES_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +NbMcaLock ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +// M S R T a b l e s +// ---------------------- + +STATIC CONST MSR_TYPE_ENTRY_INITIALIZER ROMDATA F16KbMsrRegisters[] = +{ +// MSR_TOM2 (0xC001001D) +// bits[39:23] TOP_MEM2 = 0x0 + { + MsrRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MSR_TOM2, // Address + 0x0000000000000000, // RegData + 0xFFFFFFFFFF800000, // RegMask + }} + }, + +// MSR_SYS_CFG (0xC0010010) +// bits[21] MtrrTom2En = 0x1 + { + MsrRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MSR_SYS_CFG, // Address + (1 << 21), // RegData + (1 << 21), // RegMask + }} + }, +// MC4_MISC_1 (0xC0000408) +// Clear to 0 + { + MsrRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + 0xC0000408, // Address + 0x0000000000000000, // RegData + 0xFF0FFFFFFFFFFFFF, // RegMask + }} + }, +// MSR_LS_CFG (C0011020) +// bits[26] = 0x1 + { + MsrRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MSR_LS_CFG, // Address + 0x0000000004000000, // RegData + 0x0000000004000000, // RegMask + }} + }, +// MSR_IC_CFG (C0011021) +// bits[26] DIS_WIDEREAD_PWR_SAVE = 0x1 + { + MsrRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MSR_IC_CFG, // Address + 0x0000000004000000, // RegData + 0x0000000004000000, // RegMask + }} + }, +// Processor Feedback Constants 0 (C0011090) +// bits[15:8] RefCountScale = 0x64 +// bits[7:0] ActualCountScale = 0xA5 + { + MsrRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + 0xC0011090, // Address + 0x00000000000064A5, // RegData + 0x000000000000FFFF, // RegMask + }} + }, +// MSR_L2I_CFG (C00110A0) +// bits[56:45] L2ScrubberInterval = 0x100 +// bits[44] PbDisObeysThrottleNb = 0x1 +// bits[43:40] ThrottleNbInterface = 0x0 +// bits[19] McaToMstCoreEn = 0x1 + { + MsrRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MSR_L2I_CFG, // Address + 0x0020100000080000, // RegData + 0x01FFFF0000080000, // RegMask + }} + }, +}; + +// MSR with Special Programming Requirements Table +// ---------------------- + +STATIC CONST FAM_SPECIFIC_WORKAROUND_TYPE_ENTRY_INITIALIZER ROMDATA F16KbMsrWorkarounds[] = +{ +// MSR_0000_0413 + { + FamSpecificWorkaround, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + NbMcaLock, // Function call + 0x00000000, // Data + }} + }, +}; + +CONST REGISTER_TABLE ROMDATA F16KbMsrRegisterTable = { + AllCores, + PERFORM_TP_AFTER_AP_LAUNCH, + (sizeof (F16KbMsrRegisters) / sizeof (TABLE_ENTRY_FIELDS)), + (TABLE_ENTRY_FIELDS *) &F16KbMsrRegisters, +}; + +CONST REGISTER_TABLE ROMDATA F16KbMsrWorkaroundTable = { + AllCores, + PERFORM_TP_AFTER_AP_LAUNCH, + (sizeof (F16KbMsrWorkarounds) / sizeof (TABLE_ENTRY_FIELDS)), + (TABLE_ENTRY_FIELDS *) F16KbMsrWorkarounds, +}; + + +/*---------------------------------------------------------------------------------------*/ +/** + * MSR special programming requirements for MSR_0000_0413 + * + * + * @param[in] Data The table data value, for example to indicate which CPU and Platform types matched. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +NbMcaLock ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + MC4_MISC0_MSR Mc4Misc0; + + LibAmdMsrRead (MSR_MC4_MISC, (UINT64 *) &Mc4Misc0, StdHeader); + + if (Mc4Misc0.IntType == 0x2) { + Mc4Misc0.Locked = 1; + } else { + Mc4Misc0.Locked = 0; + } + LibAmdMsrWrite (MSR_MC4_MISC, (UINT64 *) &Mc4Misc0, StdHeader); + + return; +} diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbNbAfterReset.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbNbAfterReset.c new file mode 100644 index 0000000000..0ab9896db4 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbNbAfterReset.c @@ -0,0 +1,365 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini after warm reset sequence for NB P-states + * + * Performs the "NB COF and VID Transition Sequence After Warm Reset" + * as described in the BKDG. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuRegisters.h" +#include "cpuApicUtilities.h" +#include "cpuFamilyTranslation.h" +#include "GeneralServices.h" +#include "cpuServices.h" +#include "F16KbNbAfterReset.h" +#include "Gnb.h" +#include "GnbPcie.h" +#include "GnbHandleLib.h" +#include "GnbRegisterAccKB.h" +#include "GnbRegistersKB.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBNBAFTERRESET_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +STATIC +F16KbPmNbAfterResetOnCore ( + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +TransitionToNbLow ( + IN PCI_ADDR PciAddress, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +TransitionToNbHigh ( + IN PCI_ADDR PciAddress, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +WaitForNbTransitionToComplete ( + IN PCI_ADDR PciAddress, + IN UINT32 PstateIndex, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Family 16h Kabini core 0 entry point for performing the necessary steps after + * a warm reset has occurred. + * + * The steps are as follows: + * + * 1. Temp1=D18F5x170[SwNbPstateLoDis]. + * 2. Temp2=D18F5x170[NbPstateDisOnP0]. + * 3. Temp3=D18F5x170[NbPstateThreshold]. + * 4. Temp4=D18F5x170[NbPstateGnbSlowDis]. + * 5. If MSRC001_0070[NbPstate]=0, go to step 6. If MSRC001_0070[NbPstate]=1, go to step 11. + * 6. Write 1 to D18F5x170[NbPstateGnbSlowDis]. + * 7. Write 0 to D18F5x170[SwNbPstateLoDis, NbPstateDisOnP0, NbPstateThreshold]. + * 8. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateLo] and D18F5x174[CurNbFid, CurNb- + * Did]=[NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateLo]. + * 9. Set D18F5x170[SwNbPstateLoDis]=1. + * 10. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateHi] and D18F5x174[CurNbFid, CurNb- + * Did]=[NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateHi]. Go to step 15. + * 11. Write 1 to D18F5x170[SwNbPstateLoDis]. + * 12. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateHi] and D18F5x174[CurNbFid, CurNb- + * Did]=[NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateHi]. + * 13. Write 0 to D18F5x170[SwNbPstateLoDis, NbPstateDisOnP0, NbPstateThreshold]. + * 14. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateLo] and D18F5x174[CurNbFid, CurNb- + * Did]=[NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateLo]. + * 15. Set D18F5x170[SwNbPstateLoDis]=Temp1, D18F5x170[NbPstateDisOnP0]=Temp2, D18F5x170[NbP- + * stateThreshold]=Temp3, and D18F5x170[NbPstateGnbSlowDis]=Temp4. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] CpuEarlyParamsPtr Service parameters + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +F16KbPmNbAfterReset ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParamsPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 Socket; + UINT32 Module; + UINT32 Core; + UINT32 TaskedCore; + UINT32 Ignored; + AP_TASK TaskPtr; + AGESA_STATUS IgnoredSts; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbPmNbAfterReset\n"); + + IdentifyCore (StdHeader, &Socket, &Module, &Core, &IgnoredSts); + + ASSERT (Core == 0); + + // Launch one core per node. + TaskPtr.FuncAddress.PfApTask = F16KbPmNbAfterResetOnCore; + TaskPtr.DataTransfer.DataSizeInDwords = 0; + TaskPtr.ExeFlags = WAIT_FOR_CORE; + for (Module = 0; Module < GetPlatformNumberOfModules (); Module++) { + if (GetGivenModuleCoreRange (Socket, Module, &TaskedCore, &Ignored, StdHeader)) { + if (TaskedCore != 0) { + ApUtilRunCodeOnSocketCore ((UINT8) Socket, (UINT8) TaskedCore, &TaskPtr, StdHeader); + } + } + } + ApUtilTaskOnExecutingCore (&TaskPtr, StdHeader, (VOID *) CpuEarlyParamsPtr); +} + +/*--------------------------------------------------------------------------------------- + * L O C A L F U N C T I O N S + *--------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Support routine for F16KbPmNbAfterReset to perform MSR initialization on one + * core of each die in a family 16h socket. + * + * This function implements steps 1 - 15 on each core. + * + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +F16KbPmNbAfterResetOnCore ( + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 NbPsCtrlOnEntry; + UINT32 NbPsCtrlOnExit; + UINT64 LocalMsrRegister; + PCI_ADDR PciAddress; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbPmNbAfterResetOnCore\n"); + + // 1. Temp1 = D18F5x170[SwNbPstateLoDis]. + // 2. Temp2 = D18F5x170[NbPstateDisOnP0]. + // 3. Temp3 = D18F5x170[NbPstateThreshold]. + // 4. Temp4 = D18F5x170[NbPstateGnbSlowDis]. + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrlOnEntry, StdHeader); + + // Check if NB P-states were disabled, and if so, prevent any changes from occurring. + if (((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnEntry)->SwNbPstateLoDis == 0) { + // 5. If MSRC001_0070[NbPstate] = 1, go to step 11 + LibAmdMsrRead (MSR_COFVID_CTL, &LocalMsrRegister, StdHeader); + if (((COFVID_CTRL_MSR *) &LocalMsrRegister)->NbPstate == 0) { + // 6. Write 1 to D18F5x170[NbPstateGnbSlowDis]. + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrlOnExit, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnExit)->NbPstateGnbSlowDis = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrlOnExit, StdHeader); + + // 7. Write 0 to D18F5x170[SwNbPstateLoDis, NbPstateDisOnP0, NbPstateThreshold]. + // 8. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateLo] and D18F5x174[CurNbFid, + // CurNbDid] = [NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateLo]. + TransitionToNbLow (PciAddress, StdHeader); + + // 9. Set D18F5x170[SwNbPstateLoDis] = 1. + // 10. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateHi] and D18F5x174[CurNbFid, + // CurNbDid] = [NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateHi]. + // Go to step 15. + TransitionToNbHigh (PciAddress, StdHeader); + } else { + // 11. Set D18F5x170[SwNbPstateLoDis] = 1. + // 12. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateHi] and D18F5x174[CurNbFid, + // CurNbDid] = [NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateHi]. + TransitionToNbHigh (PciAddress, StdHeader); + + // 13. Write 0 to D18F5x170[SwNbPstateLoDis, NbPstateDisOnP0, NbPstateThreshold]. + // 14. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateLo] and D18F5x174[CurNbFid, + // CurNbDid] = [NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateLo]. + TransitionToNbLow (PciAddress, StdHeader); + } + + // 15. Set D18F5x170[SwNbPstateLoDis]=Temp1, D18F5x170[NbPstateDisOnP0]=Temp2, D18F5x170[NbP- + // stateThreshold]=Temp3, and D18F5x170[NbPstateGnbSlowDis]=Temp4. + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrlOnExit, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnExit)->SwNbPstateLoDis = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnEntry)->SwNbPstateLoDis; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnExit)->NbPstateDisOnP0 = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnEntry)->NbPstateDisOnP0; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnExit)->NbPstateThreshold = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnEntry)->NbPstateThreshold; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnExit)->NbPstateGnbSlowDis = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOnEntry)->NbPstateGnbSlowDis; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrlOnExit, StdHeader); + } +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Support routine for F16KbPmNbAfterResetOnCore to transition to the low NB P-state. + * + * This function implements steps 7, 8, 13, and 14 as needed. + * + * @param[in] PciAddress Segment, bus, device number of the node to transition. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +TransitionToNbLow ( + IN PCI_ADDR PciAddress, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + NB_PSTATE_CTRL_REGISTER NbPsCtrl; + + IDS_HDT_CONSOLE (CPU_TRACE, " TransitionToNbLow\n"); + + // 7/13. Write 0 to D18F5x170[SwNbPstateLoDis, NbPstateDisOnP0, NbPstateThreshold]. + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + NbPsCtrl.SwNbPstateLoDis = 0; + NbPsCtrl.NbPstateDisOnP0 = 0; + NbPsCtrl.NbPstateThreshold = 0; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + + // 8/14. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateLo] and D18F5x174[CurNbFid, + // CurNbDid] = [NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateLo]. + WaitForNbTransitionToComplete (PciAddress, NbPsCtrl.NbPstateLo, StdHeader); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Support routine for F16KbPmNbAfterResetOnCore to transition to the high NB P-state. + * + * This function implements steps 9, 10, 11, and 12 as needed. + * + * @param[in] PciAddress Segment, bus, device number of the node to transition. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +TransitionToNbHigh ( + IN PCI_ADDR PciAddress, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + NB_PSTATE_CTRL_REGISTER NbPsCtrl; + + IDS_HDT_CONSOLE (CPU_TRACE, " TransitionToNbHigh\n"); + + // 9/10. Set D18F5x170[SwNbPstateLoDis] = 1. + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + NbPsCtrl.SwNbPstateLoDis = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + + // 11/12. Wait for D18F5x174[CurNbPstate] = D18F5x170[NbPstateHi] and D18F5x174[CurNbFid, + // CurNbDid] = [NbFid, NbDid] from D18F5x1[6C:60] indexed by D18F5x170[NbPstateHi]. + WaitForNbTransitionToComplete (PciAddress, NbPsCtrl.NbPstateHi, StdHeader); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Support routine for F16KbPmAfterResetCore to wait for NB FID and DID to + * match a specific P-state. + * + * This function implements steps 8, 10, 12, and 14 as needed. + * + * @param[in] PciAddress Segment, bus, device number of the node to transition. + * @param[in] PstateIndex P-state settings to match. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +WaitForNbTransitionToComplete ( + IN PCI_ADDR PciAddress, + IN UINT32 PstateIndex, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + NB_PSTATE_REGISTER TargetNbPs; + NB_PSTATE_STS_REGISTER NbPsSts; + + IDS_HDT_CONSOLE (CPU_TRACE, " WaitForNbTransitionToComplete\n"); + + PciAddress.Address.Function = FUNC_5; + PciAddress.Address.Register = NB_PSTATE_0 + (PstateIndex << 2); + LibAmdPciRead (AccessWidth32, PciAddress, &TargetNbPs, StdHeader); + PciAddress.Address.Register = NB_PSTATE_STATUS; + do { + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsSts, StdHeader); + } while ((NbPsSts.CurNbPstate != PstateIndex || + (NbPsSts.CurNbFid != TargetNbPs.NbFid)) || + (NbPsSts.CurNbDid != TargetNbPs.NbDid)); +} diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbNbAfterReset.h b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbNbAfterReset.h new file mode 100644 index 0000000000..0d2c7bcd72 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbNbAfterReset.h @@ -0,0 +1,78 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini after warm reset sequence for NB P-states + * + * Contains code that provide power management functionality + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +#ifndef _CPU_F16_KB_NB_AFTER_RESET_H_ +#define _CPU_F16_KB_NB_AFTER_RESET_H_ + + +/*--------------------------------------------------------------------------------------- + * M I X E D (Definitions And Macros / Typedefs, Structures, Enums) + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * T Y P E D E F S, S T R U C T U R E S, E N U M S + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * F U N C T I O N P R O T O T Y P E + *--------------------------------------------------------------------------------------- + */ +VOID +F16KbPmNbAfterReset ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParamsPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +#endif // _CPU_F16_KB_NB_AFTER_RESET_H_ diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPciTables.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPciTables.c new file mode 100644 index 0000000000..4cd445e349 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPciTables.c @@ -0,0 +1,1147 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 KB PCI tables with values as defined in BKDG + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/FAMILY/0x16/KB + * @e \$Revision: 86705 $ @e \$Date: 2013-01-24 17:34:21 -0600 (Thu, 24 Jan 2013) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "Ids.h" +#include "cpuRegisters.h" +#include "F16KbPowerMgmt.h" +#include "Table.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBPCITABLES_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +SetDisCstateBoostBlockPstateUp ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +ScalingApmParamBaseOnCSampleTimer ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +SetTdpLimitDis ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ); +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +// P C I T a b l e s +// ---------------------- + +STATIC CONST TABLE_ENTRY_FIELDS ROMDATA F16KbPciRegistersAfterApLaunch[] = +{ +// D18F0x6C - Link Initialization Control +// bits[0] RouteTblDis = 0x0 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x6C), // Address + 0x00000000, // RegData + 0x00000001, // RegMask + }} + }, +// D18F0x84 - Link Control +// bits[12] IsocEn = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x84), // Address + 0x00001000, // RegData + 0x00001000, // RegMask + }} + }, +// D18F0x90 - Link Base Channel Buffer Count +// bits[30] PReq[3] = 0x0 +// bits[29:28] NpReqData[3:2] = 0x0 +// bits[27:25] FreeData = 0x0 +// bits[24:20] FreeCmd = 0x0 +// bits[19:18] RspData = 0x1 +// bits[17:16] NpReqData[1:0] = 0x1 +// bits[15:12] ProbeCmd = 0x0 +// bits[11:8] RspCmd = 0x1 +// bits[7:5] PReq[2:0] = 0x5 +// bits[4:0] NpReqCmd = 0x5 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x90), // Address + 0x000501A5, // RegData + 0x7FFFFFFF, // RegMask + }} + }, +// D18F0x94 - Link Isochronous Channel Buffer Count +// bits[28:27] IsocRspData = 0x0 +// bits[26:25] IsocNpReqData = 0x1 +// bits[24:22] IsocRspCmd = 0x0 +// bits[21:19] IsocPReq = 0x0 +// bits[18:16] IsocNpReqCmd = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x94), // Address + 0x02010000, // RegData + 0x1FFF0000, + }} + }, +// D18F0x90 - Link Base Channel Buffer Count +// bit [31] LockBc = 0x1 +// +// NOTE: The entry is intended to be programmed after other bits of D18F0x[90, 94] is programmed. + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x90), // Address + 0x80000000, // regData + 0x80000000, // regMask + }} + }, +// D18F0x110 - Link Clumping Enable +// bits [31:1] ClumpEn = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x110), // Address + 0x00000002, // regData + 0xFFFFFFFE, // regMask + }} + }, +// D18F0x168 - Extended Link Transaction Control +// bits[20] = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x168), // Address + 0x00100000, // RegData + 0x00100000, // RegMask + }} + }, + +// D18F2x118 - Memory Controller Configuration Low +// bits[31:28] MctVarPriCntLmt = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_2, 0x118), // Address + 0x10000000, // RegData + 0xF0000000, // RegMask + }} + }, +// D18F3x44 - MCA NB Configuration +// bits[30] SyncFloodOnDramAdrParErr = 0x1 +// bits[27] NbMcaToMstCpuEn = 0x1 +// bits[21] SyncFloodOnAnyUcErr = 0x1 +// bits[20] SyncFloodOnWDT = 0x1 +// bits[6] CpuErrDis = 0x1 +// bits[4] SyncPktPropDis = 0x0 +// bits[3] SyncPktGenDis = 0x0 +// bits[2] SyncFloodOnDramUcEcc = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x44), // Address + 0x48300044, // RegData + 0x4830005C, // RegMask + }} + }, +// D18F3x6C - Data Buffer Count +// bits[30:28] IsocRspDBC = 0x1 +// bits[18:16] UpRspDBC = 0x1 +// bits[7:6] DnRspDBC = 0x1 +// bits[5:4] DnReqDBC = 0x1 +// bits[2:0] UpReqDBC = 0x2 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x6C), // Address + 0x10010052, // RegData + 0x700700F7, // RegMask + }} + }, +// D18F3x70 - SRI to XBAR Command Buffer Count +// bits[30:28] IsocRspCBC = 0x1 +// bits[26:24] IsocPreqCBC = 0x0 +// bits[22:20] IsocReqCBC = 0x1 +// bits[18:16] UpRspCBC = 0x3 +// bits[14:12] DnPreqCBC = 0x1 +// bits[10:8] UpPreqCBC = 0x1 +// bits[7:6] DnRspCBC = 0x1 +// bits[5:4] DnReqCBC = 0x1 +// bits[2:0] UpReqCBC = 0x3 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x70), // Address + 0x10131153, // RegData + 0x777777F7, // RegMask + }} + }, +// D18F3x74 - XBAR to SRI Command Buffer Count +// bits[31:28] DRReqCBC = 0x0 +// bits[26:24] IsocPreqCBC = 0x1 +// bits[23:20] IsocReqCBC = 0x1 +// bits[19:16] ProbeCBC = 0xC +// bits[14:12] DnPreqCBC = 0x0 +// bits[10:8] UpPreqCBC = 0x1 +// bits[6:4] DnReqCBC = 0x0 +// bits[2:0] UpReqCBC = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x74), // Address + 0x011C0101, // RegData + 0xF7FF7777, // RegMask + }} + }, +// D18F3x78 - MCT to XBAR Buffer Count +// bits[12:8] ProbeCBC = 0x8 +// bits[5:0] RspCBC = 0x10 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x78), // Address + 0x00000810, // RegData + 0x00001F3F, // RegMask + }} + }, + +// D18F3x7C - Free List Buffer Count +// bits[22:20] Sri2XbarFreeRspDBC = 0x0 +// bits[19:16] Sri2XbarFreeXreqDBC = 0x5 +// bits[15:12] Sri2XbarFreeRspCBC = 0x0 +// bits[11:8] Sri2XbarFreeXreqCBC = 0x6 +// bits[5:0] Xbar2SriFreeListCBC = 0x1B + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x7C), // Address + 0x0005061B, // RegData + 0x007FFF3F, // RegMask + }} + }, +// D18F3x84 - ACPI Power State Control High +// bits[1] NbLowPwrEnSmafAct4 = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x84), // Address + 0x00000002, // RegData + 0x00000002, // RegMask + }} + }, +// D18F3xA0 - Power Control Miscellaneous +// bits[13:11] PllLockTime = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0xA0), // Address + 0x00000800, // RegData + 0x00003800, // RegMask + }} + }, +// D18F3xA0 - Power Control Miscellaneous +// bits[14] Svi2HighFreqSel = 0x1, if PERFORMANCE_VRM_HIGH_SPEED_ENABLE == TRUE + { + ProfileFixup, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // platformFeatures + {{ + PERFORMANCE_VRM_HIGH_SPEED_ENABLE, // PerformanceFeatures + MAKE_SBDFO (0, 0, 24, FUNC_3, 0xA0), // Address + 0x00004000, // regData + 0x00004000, // regMask + }} + }, +// D18F3xA4 - Reported Temperature Control +// bits[12:8] PerStepTimeDn = 0xF +// bits[7] TmpSlewDnEn = 0x1 +// bits[6:5] TmpMaxDiffUp = 0x3 +// bits[4:0] PerStepTimeUp = 0xF + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0xA4), // Address + 0x00000FEF, // RegData + 0x00001FFF, // RegMask + }} + }, +// D18F3xD4 - Clock Power/Timing Control 0 +// bits[31] NbClkDivApplyAll = 0x1 +// bits[30:28] NbClkDiv = 0x1 +// bits[27:24] PowerStepUp = 0x8 +// bits[23:20] PowerStepDown = 0x8 +// bits[11:8] ClkRampHystSel = 0xF + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0xD4), // Address + 0x98800F00, // RegData + 0xFFF00F00, // RegMask + }} + }, +// D18F3xD8 - Clock Power/Timing Control 1 +// bits[6:4] VSRampSlamTime = 0x4 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0xD8), // Address + 0x00000040, // RegData + 0x00000070, // RegMask + }} + }, +// D18F3xDC - Clock Power/Timing Control 2 +// bits[29:27] NbsynPtrAdjLo = 0x5 +// bits[26] IgnCpuPrbEn = 0x0 +// bits[25:19] CacheFlushOnHaltTmr = 0xF +// bits[18:16] CacheFlushOnHaltCtl = 0x0 +// bits[14:12] NbsynPtrAdj = 0x6 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0xDC), // Address + 0x28786000, // RegData + 0x3FFF7000, // RegMask + }} + }, +// D18F3x140 - SRI to XCS Token Count +// bits[24:20] FreeTok = 0xF +// bits[17:16] IsocRspTok = 0x1 +// bits[15:14] IsocPreqTok = 0x0 +// bits[13:12] IsocReqTok = 0x1 +// bits[11:10] DnRspTok = 0x1 +// bits[9:8] UpRspTok = 0x1 +// bits[7:6] DnPreqTok = 0x1 +// bits[5:4] UpPreqTok = 0x2 +// bits[3:2] DnReqTok = 0x1 +// bits[1:0] UpReqTok = 0x2 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x140), // Address + 0x00F11566, // RegData + 0x01F3FFFF, // RegMask + }} + }, +// D18F3x144 - MCT to XCS Token Count +// bits[7:4] ProbeTok = 0x4 +// bits[3:0] RspTok = 0x7 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x144), // Address + 0x00000047, // RegData + 0x000000FF, // RegMask + }} + }, +// D18F3x148 - Link to XCS Token Count - Link 0 +// bits[31:30] FreeTok[3:2] = 0x0 +// bits[28] IsocRspTok1 = 0x0 +// bits[26] IsocPreqTok1 = 0x0 +// bits[24] IsocReqTok1 = 0x0 +// bits[23:22] ProbeTok1 = 0x0 +// bits[21:20] RspTok1 = 0x0 +// bits[19:18] PReqTok1 = 0x0 +// bits[17:16] ReqTok1 = 0x0 +// bits[15:14] FreeTok[1:0] = 0x0 +// bits[13:12] IsocRspTok0 = 0x0 +// bits[11:10] IsocPreqTok0 = 0x1 +// bits[9:8] IsocReqTok0 = 0x1 +// bits[7:6] ProbeTok0 = 0x0 +// bits[5:4] RspTok0 = 0x2 +// bits[3:2] PReqTok0 = 0x2 +// bits[1:0] ReqTok0 = 0x2 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x148), // Address + 0x0000052A, // RegData + 0xD5FFFFFF, // RegMask + }} + }, +// D18F3x160 - NB Machine Check Misc (DRAM Thresholding) 0 (MC4_MISC0) +// bits[23:20] LvtOffset = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x160), // Address + 0x00100000, // RegData + 0x00F00000, // RegMask + }} + }, +// D18F3x168 - NB Machine Check Misc (Link Thresholding) 1 (MC4_MISC1) +// bits[23:20] LvtOffset = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x168), // Address + 0x00100000, // RegData + 0x00F00000, // RegMask + }} + }, +// D18F3x17C - Extended Freelist Buffer Count +// bits[3:0] SPQPrbFreeCBC = 0x8 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x17C), // Address + 0x00000008, // RegData + 0x0000000F, // RegMask + }} + }, +// D18F3x180 - Extended NB MCA Configuration +// bits[28] SyncFloodOnCC6DramUcErr = 0x1 +// bits[24] McaLogErrAddrWdtErr = 0x1 +// bits[21] SyncFloodOnCpuLeakErr = 0x1 +// bits[17] SyncFloodOnDeferErrToIO = 0x1 +// bits[9] SyncFloodOnUCNbAry = 0x1 +// bits[8] SyncFloodOnProtErr = 0x1 +// bits[7] SyncFloodOnTgtAbortErr = 0x1 +// bits[6] SyncFloodOnDatErr = 0x1 +// bits[5] DisPciCfgCpuMstAbortRsp = 0x1 +// bits[1] SyncFloodOnUsPwDatErr = 0x1 +// bits[0] McaLogUsPwDatErrEn = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x180), // Address + 0x112203E3, // RegData + 0x112203E3, // RegMask + }} + }, +// bits[9] = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x188), // Address + 0x00000200, // RegData + 0x00000200, // RegMask + }} + }, +// D18F3x1A0 - Core Interface Buffer Count +// bits[18:16] CpuToNbFreeBufCnt = 0x3 +// bits[2:0] CpuCmdBufCnt = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x1A0), // Address + 0x00030001, // RegData + 0x00070007, // RegMask + }} + }, +// D18F3x1CC - IBS Control +// bits[8] LvtOffsetVal = 0x1 +// bits[3:0] LvtOffset = 0x0 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x1CC), // Address + 0x00000100, // RegData + 0x0000010F, // RegMask + }} + }, +// D18F3x1E4 - SBI Control +// bits[11:8] LvtOffset = 0x3 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x1E4), // Address + 0x00000300, // RegData + 0x00000F00, // RegMask + }} + }, +// D18F0x6C - Link Initialization Control +// bit [30] RlsLnkFullTokCntImm = 0x1 +// bit [28] RlsIntFullTokCntImm = 0x1 +// +// NOTE: The entry is intended to be after D18F0x[90, 94] and D18F3x[6C, 70, 74, 78, 7C, 140, 144, 148, 14C, 17C, 1A0] are programmed. + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x6C), // Address + 0x50000000, // RegData + 0x50000000, // RegMask + }} + }, +// D18F0x6C - Link Initialization Control +// bits[27] ApplyIsocModeEnNow = 0x1 +// +// NOTE: The entry is intended to be after RlsLnkFullTokCntImm and RlsIntFullTokCntImm have been set. + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x6C), // Address + 0x08000000, // RegData + 0x08000000, // RegMask + }} + }, +// D18F3x200 - Performance Mode Control Register +// bits[3] EnMcqPrbPickThrottle = 0x1 +// bits[2] EnDctOddToNcLnkDatXfr = 0x1 +// bits[1] EnDctEvnToNcLnkDatXfr = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x200), // Address + 0x0000000E, // RegData + 0x0000000E, // RegMask + }} + }, +// D18F4x118 - C-state Control 1 +// bits[23:21] ClkDivisorCstAct1 = 0x0 +// bits[19:18] CacheFlushTmrSelCstAct1 = 0x2 +// bits[16] CpuPrbEnCstAct1 = 0x1 +// bits[7:5] ClkDivisorCstAct0 = 0x0 +// bits[3:2] CacheFlushTmrSelCstAct0 = 0x2 +// bits[0] CpuPrbEnCstAct0 = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_4, 0x118), // Address + 0x00090009, // RegData + 0x00ED00ED, // RegMask + }} + }, +// D18F4x128 - C-state Policy Control 1 +// bits[24:23] CacheFlushSucMonMispredictAct = 0x1 +// bits[22:21] CacheFlushSucMonTmrSel = 0x1 +// bits[20:18] CacheFlushSucMonThreshold = 0x4 +// bits[11:5] CacheFlushTmr = 0x7F +// bits[4:2] HaltCstateIndex = 0x0 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_4, 0x128), // Address + 0x00B00FE0, // RegData + 0x01FC0FFC, // RegMask + }} + }, +// D18F4x15C - Core Performance Boost Control +// bits[8] CstatePowerEn = 0x1 +// bits[1:0] BoostSrc = 0x0 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_4, 0x15C), // Address + 0x00000100, // RegData + 0x00000103, // RegMask + }} + }, +// D18F4x16C - APM TDP Control +// bits[14] CacUpC1 = 0x0 +// bits[4] ApmTdpLimitIntEn = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_4, 0x16C), // Address + 0x00000010, // RegData + 0x00004010, // RegMask + }} + }, + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_4, 0x210), // Address + 0x0000B41F, // RegData + 0x0000F7FF, // RegMask + }} + }, +// D18F5x88 - NB Configuration 4 (NB_CFG4) +// bits[24] DisHbNpReqBusLock = 0x1 +// bits[0] CC6PstateWakeUpDis = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_5, 0x88), // Address + 0x01000001, // RegData + 0x01000001, // RegMask + }} + }, +// D18F5x8C +// bits[15] = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_5, 0x8C), // Address + 0x00008000, // RegData + 0x00008000, // RegMask + }} + }, +// D18F5xE0 - Processor TDP Running Average +// bits[3:0] RunAvgRange = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_5, 0xE0), // Address + 0x00000001, // RegData + 0x0000000F, // RegMask + }} + }, +// D18F5x128 - Clock Power/Timing Control 3 +// bits[13:12] PwrGateTmr = 0x0 +// bits[9] FastSlamTimeDown = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_5, 0x128), // Address + 0x00000200, // RegData + 0x00003200, // RegMask + }} + }, +// D18F5x12C - Clock Power/Timing Control 4 +// bits[5] CorePsi1En = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_5, 0x12C), // Address + 0x00000020, // RegData + 0x00000020, // RegMask + }} + }, +// D18F5x170 - Northbridge P-state Control +// bits[12:9] NbPstateThreshold = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_5, 0x170), // Address + 0x00000200, // RegData + 0x00001E00, // RegMask + }} + }, +// D18F5x178 - Northbridge Fusion Configuration +// bits[18] CstateFusionHsDis = 0x1 +// bits[17] = 0x1 +// bits[16] ProcHotToGnbEn = 0x1 +// bits[11] = 0x1 +// bits[10] = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_5, 0x178), // Address + 0x00070C00, // RegData + 0x00070C00, // RegMask + }} + }, +}; + +STATIC CONST TABLE_ENTRY_FIELDS ROMDATA F16KbPciRegistersBeforeApLaunch[] = +{ +// D18F0x68 - Link Transaction Control +// bits[22:21] DsNpReqLmt = 0x2 +// bits[19] ApicExtSpur = 0x1 +// bits[18] ApicExtId = 0x1 +// bits[17] ApicExtBrdCst = 0x1 +// bits[15] LimitCldtCfg = 0x1 +// bits[11] RespPassPW = 0x1 +// bits[10] DisFillP = 0x0 +// bits[4] DisMTS = 0x1 +// bits[3] DisWrDwP = 0x1 +// bits[2] DisWrBP = 0x1 +// bits[1] DisRdDwP = 0x1 +// bits[0] DisRdBP = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_0, 0x68), // Address + 0x004E881F, // RegData + 0x006E8C1F, // RegMask + }} + }, +// D18F3x8C - NB Configuration 1 High (NB_CFG1_HI) +// bits[30] MSRC001_001F[DisStpClkAbortFlush] = 0x1 +// bits[23] MSRC001_001F[EnaDiv1CpuLowPwr] = 0x1 +// bits[22] MSRC001_001F[InitApicIdCpuIdLo] = 0x1 +// bits[19] MSRC001_001F[DisDatFwdVic] = 0x1 + { + PciRegister, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // PlatformFeatures + {{ + MAKE_SBDFO (0, 0, 24, FUNC_3, 0x8C), // Address + 0x40C80000, // RegData + 0x40C80000, // RegMask + }} + }, +}; + +// PCI with Special Programming Requirements Table +// ---------------------- + +STATIC CONST FAM_SPECIFIC_WORKAROUND_TYPE_ENTRY_INITIALIZER ROMDATA F16KbPciWorkarounds[] = +{ +// D18F3x88 + { + FamSpecificWorkaround, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // platformFeatures + {{ + SetDisCstateBoostBlockPstateUp, // function call + 0x00000000, // data + }} + }, +// D18F4x110 + { + FamSpecificWorkaround, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // platformFeatures + {{ + ScalingApmParamBaseOnCSampleTimer, // function call + 0x00000000, // data + }} + }, +// D18F4x16C + { + FamSpecificWorkaround, + { + AMD_FAMILY_16, // CpuFamily + AMD_F16_KB_ALL // CpuRevision + }, + {AMD_PF_ALL}, // platformFeatures + {{ + SetTdpLimitDis, // function call + 0x00000000, // data + }} + }, +}; + +CONST REGISTER_TABLE ROMDATA F16KbPciRegisterTableAfterApLaunch = { + PrimaryCores, + PERFORM_TP_AFTER_AP_LAUNCH, + (sizeof (F16KbPciRegistersAfterApLaunch) / sizeof (TABLE_ENTRY_FIELDS)), + (TABLE_ENTRY_FIELDS *) F16KbPciRegistersAfterApLaunch, +}; + +CONST REGISTER_TABLE ROMDATA F16KbPciRegisterTableBeforeApLaunch = { + PrimaryCores, + PERFORM_TP_BEFORE_AP_LAUNCH, + (sizeof (F16KbPciRegistersBeforeApLaunch) / sizeof (TABLE_ENTRY_FIELDS)), + (TABLE_ENTRY_FIELDS *) F16KbPciRegistersBeforeApLaunch, +}; + +CONST REGISTER_TABLE ROMDATA F16KbPciWorkaroundTable = { + PrimaryCores, + PERFORM_TP_AFTER_AP_LAUNCH, + (sizeof (F16KbPciWorkarounds) / sizeof (TABLE_ENTRY_FIELDS)), + (TABLE_ENTRY_FIELDS *) F16KbPciWorkarounds, +}; + +/*---------------------------------------------------------------------------------------*/ +/** + * Workaround for Kabini processors. + * + * + * @param[in] Data The table data value, for example to indicate which CPU and Platform types matched. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +SetDisCstateBoostBlockPstateUp ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + PCI_ADDR PciAddress; + NB_CFG1_LOW_REG_REGISTER NbCfg1Low; + NB_CFG_4_REGISTER NbCfg4; + + PciAddress.AddressValue = NB_CFG_REG4_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *)&NbCfg4, StdHeader); + + PciAddress.AddressValue = NB_CFG1_LOW_REG_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *)&NbCfg1Low, StdHeader); + + NbCfg1Low.DisCstateBoostBlockPstateUp = NbCfg4.EnCstateBoostBlockCC6Exit; + LibAmdPciWrite (AccessWidth32, PciAddress, (VOID *)&NbCfg1Low, StdHeader); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Workaround for Kabini processors. + * + * AGESA should program F4x110[11:0][CSampleTimer] to 2, and update below registers as: + * The following should be ROUNDED-NEAREST: + * + * @param[in] Data The table data value, for example to indicate which CPU and Platform types matched. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +ScalingApmParamBaseOnCSampleTimer ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + PCI_ADDR PciAddress; + pmgmt_str0 var0; + pmgmt_str1 var1; + SAMPLE_RESIDENCY_TIMER_REGISTER SampleResidencyTimer; + + PciAddress.AddressValue = SAMPLE_RESIDENCY_TIMER_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *)&SampleResidencyTimer, StdHeader); + + SampleResidencyTimer.CSampleTimer = 20; + IDS_OPTION_HOOK (IDS_CSAMPLE_TIMER, (VOID *) (&SampleResidencyTimer), StdHeader); + ASSERT (SampleResidencyTimer.CSampleTimer != 0); + LibAmdPciWrite (AccessWidth32, PciAddress, (VOID *)&SampleResidencyTimer, StdHeader); + + // The following should be ROUNDED-NEAREST: + // F5xB8[19:0] = F5xB8[19:0] * 2 / F4x110[CSampleTimer] + // F5xBC[19:0] = F5xBC[19:0] * 2 / F4x110[CSampleTimer] + PciAddress.AddressValue = MAKE_SBDFO (0, 0, 0x18, FUNC_5, 0xB8); + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *)&var0, StdHeader); + var0.Bits_19_0 = ((var0.Bits_19_0 * 2) + (SampleResidencyTimer.CSampleTimer / 2)) / SampleResidencyTimer.CSampleTimer; + LibAmdPciWrite (AccessWidth32, PciAddress, (VOID *)&var0, StdHeader); + + PciAddress.AddressValue = MAKE_SBDFO (0, 0, 0x18, FUNC_5, 0xBC); + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *)&var1, StdHeader); + var1.Bits_19_0 = ((var1.Bits_19_0 * 2) + (SampleResidencyTimer.CSampleTimer / 2)) / SampleResidencyTimer.CSampleTimer; + LibAmdPciWrite (AccessWidth32, PciAddress, (VOID *)&var1, StdHeader); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Workaround for Kabini processors. + * + * AGESA should program F4x16C[TdpLimitDis] in some case + * + * @param[in] Data The table data value, for example to indicate which CPU and Platform types matched. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +SetTdpLimitDis ( + IN UINT32 Data, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 PciData; + PCI_ADDR PciAddress; + + PciAddress.AddressValue = MAKE_SBDFO (0, 0, 0, FUNC_0, 0xB8); + PciData = 0xC010408C; + LibAmdPciWrite (AccessWidth32, PciAddress, (VOID *)&PciData, StdHeader); + PciAddress.Address.Register = 0xBC; + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *)&PciData, StdHeader); + + if ((PciData & BIT2) == BIT2) { + PciAddress.AddressValue = MAKE_SBDFO (0, 0, 0x18, FUNC_4, 0x16C); + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *)&PciData, StdHeader); + PciData |= BIT3; + LibAmdPciWrite (AccessWidth32, PciAddress, (VOID *)&PciData, StdHeader); + } +} + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerCheck.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerCheck.c new file mode 100644 index 0000000000..2017f8b548 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerCheck.c @@ -0,0 +1,500 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 P-State power check + * + * Performs the "Processor-Systemboard Power Delivery Compatibility Check" as + * described in the BKDG. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16 + * @e \$Revision: 86879 $ @e \$Date: 2013-01-28 11:11:12 -0600 (Mon, 28 Jan 2013) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuF16PowerMgmt.h" +#include "cpuRegisters.h" +#include "cpuFamilyTranslation.h" +#include "F16KbPowerCheck.h" +#include "cpuServices.h" +#include "GeneralServices.h" +#include "cpuFeatures.h" +#include "cpuApicUtilities.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBPOWERCHECK_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +STATIC +F16KbPmPwrCheckErrorHandler ( + IN VOID *ErrorData, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbPmPwrChkCopyPstate ( + IN UINT8 Dest, + IN UINT8 Src, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbTransitionPstateCore ( + IN VOID *StateNumber, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +/*---------------------------------------------------------------------------------------*/ +/** + * Family 16h Kabini core 0 entry point for performing the family 16h Processor- + * Systemboard Power Delivery Check. + * + * The steps are as follows: + * 1. Starting with P0, loop through all P-states until a passing state is + * found. A passing state is one in which the current required by the + * CPU is less than the maximum amount of current that the system can + * provide to the CPU. If P0 is under the limit, no further action is + * necessary. + * 2. If at least one P-State is under the limit & at least one P-State is + * over the limit, the BIOS must: + * a. If the processor's current P-State is disabled by the power check, + * then the BIOS must request a transition to an enabled P-state + * using MSRC001_0062[PstateCmd] and wait for MSRC001_0063[CurPstate] + * to reflect the new value. + * b. Copy the contents of the enabled P-state MSRs to the highest + * performance P-state locations. + * c. Request a P-state transition to the P-state MSR containing the + * COF/VID values currently applied. + * d. If a subset of boosted P-states are disabled, then copy the contents + * of the highest performance boosted P-state still enabled to the + * boosted P-states that have been disabled. + * e. If all boosted P-states are disabled, then program D18F4x15C[BoostSrc] + * to zero. + * f. Adjust the following P-state parameters affected by the P-state + * MSR copy by subtracting the number of P-states that are disabled + * by the power check. + * 1. F3x64[HtcPstateLimit] + * 2. F3x68[SwPstateLimit] + * 3. F3xDC[PstateMaxVal] + * 3. If all P-States are over the limit, the BIOS must: + * a. If the processor's current P-State is !=F3xDC[PstateMaxVal], then + * write F3xDC[PstateMaxVal] to MSRC001_0062[PstateCmd] and wait for + * MSRC001_0063[CurPstate] to reflect the new value. + * b. If MSRC001_0061[PstateMaxVal]!=000b, copy the contents of the P-state + * MSR pointed to by F3xDC[PstateMaxVal] to the software P0 MSR. + * Write 000b to MSRC001_0062[PstateCmd] and wait for MSRC001_0063 + * [CurPstate] to reflect the new value. + * c. Adjust the following P-state parameters to zero: + * 1. F3x64[HtcPstateLimit] + * 2. F3x68[SwPstateLimit] + * 3. F3xDC[PstateMaxVal] + * d. Program D18F4x15C[BoostSrc] to zero. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] CpuEarlyParams Service parameters + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +F16KbPmPwrCheck ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParams, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT8 DisPsNum; + UINT8 PsMaxVal; + UINT8 Pstate; + UINT32 ProcIddMax; + UINT32 LocalPciRegister; + UINT32 PstateLimit; + UINT32 SwPstateAdjust; + PCI_ADDR PciAddress; + UINT64 LocalMsrRegister; + PWRCHK_ERROR_DATA ErrorData; + + ErrorData.SocketNumber = 0; + // get the Max P-state value + for (PsMaxVal = NM_PS_REG - 1; PsMaxVal != 0; --PsMaxVal) { + LibAmdMsrRead (PS_REG_BASE + PsMaxVal, &LocalMsrRegister, StdHeader); + if (((F16_PSTATE_MSR *) &LocalMsrRegister)->PsEnable == 1) { + break; + } + } + + ErrorData.HwPstateNumber = (UINT8) (PsMaxVal + 1); + + // Starting with P0, loop through all P-states until a passing state is + // found. A passing state is one in which the current required by the + // CPU is less than the maximum amount of current that the system can + // provide to the CPU. If P0 is under the limit, no further action is + // necessary. + DisPsNum = 0; + for (Pstate = 0; Pstate < ErrorData.HwPstateNumber; Pstate++) { + if (FamilySpecificServices->GetProcIddMax (FamilySpecificServices, Pstate, &ProcIddMax, StdHeader)) { + if (ProcIddMax > CpuEarlyParams->PlatformConfig.VrmProperties[CoreVrm].MaximumCurrentLimit) { + // Add to event log the Pstate that exceeded the current limit + PutEventLog (AGESA_WARNING, + CPU_EVENT_PM_PSTATE_OVERCURRENT, + 0, Pstate, 0, 0, StdHeader); + DisPsNum++; + } else { + break; + } + } + } + + ErrorData.AllowablePstateNumber = ((PsMaxVal + 1) - DisPsNum); + + if (ErrorData.AllowablePstateNumber == 0) { + PutEventLog (AGESA_FATAL, + CPU_EVENT_PM_ALL_PSTATE_OVERCURRENT, + 0, 0, 0, 0, StdHeader); + } + + if (DisPsNum != 0) { + PciAddress.AddressValue = CPB_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); // F4x15C + ErrorData.NumberOfBoostStates = (UINT8) ((F16_CPB_CTRL_REGISTER *) &LocalPciRegister)->NumBoostStates; + + if (DisPsNum >= ErrorData.NumberOfBoostStates) { + // If all boosted P-states are disabled, then program D18F4x15C[BoostSrc] to zero. + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + ((F16_CPB_CTRL_REGISTER *) (&LocalPciRegister))->BoostSrc = 0; + LibAmdPciWrite (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + // Update the result of isFeatureEnabled in heap. + UpdateFeatureStatusInHeap (CoreBoost, FALSE, StdHeader); + + ErrorData.NumberOfSwPstatesDisabled = DisPsNum - ErrorData.NumberOfBoostStates; + } else { + ErrorData.NumberOfSwPstatesDisabled = 0; + } + + PciAddress.AddressValue = HTC_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); // F3x64 + ErrorData.HtcPstate = (UINT8) (((HTC_REGISTER *) (&LocalPciRegister))->HtcPstateLimit); + + F16KbPmPwrCheckErrorHandler (&ErrorData, StdHeader); + + // Final Step + // F3x64[HtcPstatelimit] -= disPsNum + // F3x68[SwPstateLimit] -= disPsNum + // F3xDC[HwPstateMaxVal] -= disPsNum + if (ErrorData.NumberOfSwPstatesDisabled != 0) { + PstateLimit = ((HTC_REGISTER *) &LocalPciRegister)->HtcPstateLimit; + if (PstateLimit > PsMaxVal) { + SwPstateAdjust = PstateLimit - PsMaxVal; + } else { + SwPstateAdjust = 0; + } + if (PstateLimit > ErrorData.NumberOfSwPstatesDisabled) { + PstateLimit -= ErrorData.NumberOfSwPstatesDisabled; + } else { + PstateLimit = ErrorData.NumberOfBoostStates; + } + if (PstateLimit <= ErrorData.NumberOfBoostStates) { + PstateLimit = ErrorData.NumberOfBoostStates + SwPstateAdjust; + } + ((HTC_REGISTER *) (&LocalPciRegister))->HtcPstateLimit = PstateLimit; + LibAmdPciWrite (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + + PciAddress.Address.Register = SW_PS_LIMIT_REG; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); // F3x68 + PstateLimit = ((SW_PS_LIMIT_REGISTER *) &LocalPciRegister)->SwPstateLimit; + if (PstateLimit > PsMaxVal) { + SwPstateAdjust = PstateLimit - PsMaxVal; + } else { + SwPstateAdjust = 0; + } + if (PstateLimit > ErrorData.NumberOfSwPstatesDisabled) { + PstateLimit -= ErrorData.NumberOfSwPstatesDisabled; + } else { + PstateLimit = ErrorData.NumberOfBoostStates; + } + if (PstateLimit <= ErrorData.NumberOfBoostStates) { + PstateLimit = ErrorData.NumberOfBoostStates + SwPstateAdjust; + } + ((SW_PS_LIMIT_REGISTER *) (&LocalPciRegister))->SwPstateLimit = PstateLimit; + LibAmdPciWrite (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + + PciAddress.Address.Register = CPTC2_REG; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); // F3xDC + PstateLimit = ((CLK_PWR_TIMING_CTRL2_REGISTER *) &LocalPciRegister)->HwPstateMaxVal; + if (PstateLimit > ErrorData.NumberOfSwPstatesDisabled) { + PstateLimit -= ErrorData.NumberOfSwPstatesDisabled; + } else { + PstateLimit = ErrorData.NumberOfBoostStates; + } + if (PstateLimit < ErrorData.NumberOfBoostStates) { + PstateLimit = ErrorData.NumberOfBoostStates; + } + + ((CLK_PWR_TIMING_CTRL2_REGISTER *) (&LocalPciRegister))->HwPstateMaxVal = PstateLimit; + LibAmdPciWrite (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + } + } +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Error handler called if any p-states were determined to be out + * of range for the mother board. + * + * This function implements steps 2a-c and 3a-c on each core. + * + * @param[in] ErrorData Details about the error condition. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +F16KbPmPwrCheckErrorHandler ( + IN VOID *ErrorData, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT8 i; + UINT8 HwPsMaxVal; + UINT8 SwPsMaxVal; + UINT8 HwDisPsNum; + UINT8 CurrentSwPs; + UINT8 ShiftIndex; + UINT8 PsDisableCount; + UINT8 NewSwP0; + UINT8 StateNumber; + UINT8 Core; + UINT32 ActiveCores; + UINT64 LocalMsrRegister; + BOOLEAN DisableAllBoostPstates; + AP_TASK ApTask; + AGESA_STATUS IgnoreStatus; + CPU_SPECIFIC_SERVICES *FamilySpecificServices; + + if (IsBsp (StdHeader, &IgnoreStatus)) { + // P-state MSRs are shared, so only BSC needs to perform this + GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, StdHeader); + GetActiveCoresInCurrentSocket (&ActiveCores, StdHeader); + + HwPsMaxVal = (((PWRCHK_ERROR_DATA *) ErrorData)->HwPstateNumber - 1); + HwDisPsNum = (((PWRCHK_ERROR_DATA *) ErrorData)->HwPstateNumber - + ((PWRCHK_ERROR_DATA *) ErrorData)->AllowablePstateNumber); + + LibAmdMsrRead (MSR_PSTATE_STS, &LocalMsrRegister, StdHeader); + CurrentSwPs = (UINT8) (((PSTATE_STS_MSR *) &LocalMsrRegister)->CurPstate); + LibAmdMsrRead (MSR_PSTATE_CURRENT_LIMIT, &LocalMsrRegister, StdHeader); + SwPsMaxVal = (UINT8) (((PSTATE_CURLIM_MSR *) &LocalMsrRegister)->PstateMaxVal); + PsDisableCount = 0; + if (((PWRCHK_ERROR_DATA *) ErrorData)->HtcPstate > HwPsMaxVal) { + ShiftIndex = ((PWRCHK_ERROR_DATA *) ErrorData)->HtcPstate; + } else { + ShiftIndex = HwPsMaxVal; + } + + DisableAllBoostPstates = FALSE; + + // Prepare ApTask + ApTask.FuncAddress.PfApTaskI = F16KbTransitionPstateCore; + ApTask.DataTransfer.DataSizeInDwords = 1; + ApTask.DataTransfer.DataPtr = &StateNumber; + ApTask.DataTransfer.DataTransferFlags = 0; + ApTask.ExeFlags = 0; + if (((PWRCHK_ERROR_DATA *) ErrorData)->AllowablePstateNumber == 0) { + // All P-States are over the limit. + + // Step 1 + // Transition to Pstate Max if not there already + if (CurrentSwPs != SwPsMaxVal) { + StateNumber = SwPsMaxVal; + for (Core = 1; Core < (UINT8) ActiveCores; ++Core) { + ApUtilRunCodeOnSocketCore (0, Core, &ApTask, StdHeader); + } + ApUtilTaskOnExecutingCore (&ApTask, StdHeader, (VOID *) NULL); + } + + // Step 2 + // If Pstate Max is not P0, copy Pstate max contents to P0 and switch + // to P0. + for (i = 0; i <= (ShiftIndex - HwPsMaxVal); i++) { + F16KbPmPwrChkCopyPstate ((((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfBoostStates + i), (HwPsMaxVal + i), StdHeader); + } + StateNumber = 0; + for (Core = 1; Core < (UINT8) ActiveCores; ++Core) { + ApUtilRunCodeOnSocketCore (0, Core, &ApTask, StdHeader); + } + ApUtilTaskOnExecutingCore (&ApTask, StdHeader, (VOID *) NULL); + + + // Disable all SW P-states except P0 + PsDisableCount = ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled - 1; + + // Set a flag to disable all boost P-states + DisableAllBoostPstates = TRUE; + } else { + // At least one P-State is under the limit & at least one P-State is + // over the limit. + if (((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfBoostStates > HwDisPsNum) { + // A subset of boosted P-states are disabled. Copy the contents of the + // highest performance boosted P-state still enabled to the boosted + // P-states that have been disabled. + for (i = 0; i < HwDisPsNum; i++) { + F16KbPmPwrChkCopyPstate (i, HwDisPsNum, StdHeader); + } + } else { + // Set a flag to disable all boost P-states + DisableAllBoostPstates = TRUE; + + if (((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled != 0) { + // Move remaining P-state register(s) up + // Step 1 + // Transition to a valid Pstate if current Pstate has been disabled + if (CurrentSwPs < ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled) { + StateNumber = ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled; + for (Core = 1; Core < (UINT8) ActiveCores; ++Core) { + ApUtilRunCodeOnSocketCore (0, Core, &ApTask, StdHeader); + } + ApUtilTaskOnExecutingCore (&ApTask, StdHeader, (VOID *) NULL); + + CurrentSwPs = ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled; + } + + // Step 2 + // Move enabled Pstates up and disable the remainder + NewSwP0 = ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfBoostStates + ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled; + for (i = 0; i <= (ShiftIndex - NewSwP0); i++) { + F16KbPmPwrChkCopyPstate ((i + ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfBoostStates), (i + NewSwP0), StdHeader); + } + + // Step 3 + // Transition to current COF/VID at shifted location + CurrentSwPs = (CurrentSwPs - ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled); + StateNumber = CurrentSwPs; + for (Core = 1; Core < (UINT8) ActiveCores; ++Core) { + ApUtilRunCodeOnSocketCore (0, Core, &ApTask, StdHeader); + } + ApUtilTaskOnExecutingCore (&ApTask, StdHeader, (VOID *) NULL); + + // Disable the appropriate number of P-states + PsDisableCount = ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfSwPstatesDisabled; + } + } + } + // Disable all boost P-states + if (DisableAllBoostPstates) { + for (i = 0; i < ((PWRCHK_ERROR_DATA *) ErrorData)->NumberOfBoostStates; i++) { + FamilySpecificServices->DisablePstate (FamilySpecificServices, i, StdHeader); + } + } + // Disable the appropriate P-states if any, starting from HW Pmin + for (i = 0; i < PsDisableCount; i++) { + FamilySpecificServices->DisablePstate (FamilySpecificServices, (HwPsMaxVal - i), StdHeader); + } + } +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Copies the contents of one P-State MSR to another. + * + * @param[in] Dest Destination p-state number + * @param[in] Src Source p-state number + * @param[in] StdHeader Config handle for library and services + * + */ +VOID +STATIC +F16KbPmPwrChkCopyPstate ( + IN UINT8 Dest, + IN UINT8 Src, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT64 LocalMsrRegister; + + LibAmdMsrRead ((UINT32) (PS_REG_BASE + Src), &LocalMsrRegister, StdHeader); + LibAmdMsrWrite ((UINT32) (PS_REG_BASE + Dest), &LocalMsrRegister, StdHeader); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Core-level transition Pstate + * + * Transitions the executing core to the desired P-state. + * + * @param[in] StateNumber The new P-State to make effective. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +F16KbTransitionPstateCore ( + IN VOID *StateNumber, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + CPU_SPECIFIC_SERVICES *FamilySpecificServices; + + GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, StdHeader); + + FamilySpecificServices->TransitionPstate (FamilySpecificServices, *((UINT8 *) StateNumber), (BOOLEAN) TRUE, StdHeader); +} diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerCheck.h b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerCheck.h new file mode 100644 index 0000000000..078a539226 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerCheck.h @@ -0,0 +1,84 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini Power related functions and structures + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +#ifndef _F16_KB_POWER_CHECK_H_ +#define _F16_KB_POWER_CHECK_H_ + + +/*--------------------------------------------------------------------------------------- + * M I X E D (Definitions And Macros / Typedefs, Structures, Enums) + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * T Y P E D E F S, S T R U C T U R E S, E N U M S + *--------------------------------------------------------------------------------------- + */ +/// Power Check Error Data +typedef struct { + UINT8 SocketNumber; ///< Socket Number + UINT8 HwPstateNumber; ///< Number of hardware P-states + UINT8 AllowablePstateNumber; ///< Number of allowable P-states + UINT8 NumberOfBoostStates; ///< Number of boosted P-states + UINT8 NumberOfSwPstatesDisabled; ///< Number of software P-states disabled + UINT8 HtcPstate; ///< HTC Pstate Limit Pstate +} PWRCHK_ERROR_DATA; + +/*--------------------------------------------------------------------------------------- + * F U N C T I O N P R O T O T Y P E + *--------------------------------------------------------------------------------------- + */ +VOID +F16KbPmPwrCheck ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParams, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +#endif // _F16_KB_POWER_CHECK_H_ diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerMgmt.h b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerMgmt.h new file mode 100644 index 0000000000..497b4d4fdb --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerMgmt.h @@ -0,0 +1,535 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini Power Management related registers defination + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +#ifndef _CPU_F16_KB_POWERMGMT_H_ +#define _CPU_F16_KB_POWERMGMT_H_ + +/* + * Family 16h Kabini CPU Power Management MSR definitions + * + */ + + +/* NB Machine Check Misc 4 MSR Register 0x00000413 */ +#define MC4_MISC0 0x00000413ul + +/// Interrupt Pending and CMP-Halt MSR Register +typedef struct { + UINT64 :24; ///< Reserved + UINT64 BlkPtr:8; ///< Block pointer for additional MISC registers + UINT64 ErrCnt:12; ///< Error counter + UINT64 :4; ///< Reserved + UINT64 Ovrflw:1; ///< Overflow + UINT64 IntType:2; ///< Interrupt type + UINT64 CntEn:1; ///< Counter enable + UINT64 LvtOffset:4; ///< LVT offset + UINT64 :5; ///< Reserved + UINT64 Locked:1; ///< Locked + UINT64 CntP:1; ///< Counter present + UINT64 Valid:1; ///< Valid +} MC4_MISC0_MSR; + +/* P-state Registers 0xC00100[6B:64] */ + +/// P-state MSR +typedef struct { + UINT64 CpuFid:6; ///< CpuFid + UINT64 CpuDid:3; ///< CpuDid + UINT64 CpuVid:8; ///< CpuVid + UINT64 :5; ///< Reserved + UINT64 NbPstate:1; ///< NbPstate + UINT64 :9; ///< Reserved + UINT64 IddValue:8; ///< IddValue + UINT64 IddDiv:2; ///< IddDiv + UINT64 :21; ///< Reserved + UINT64 PsEnable:1; ///< Pstate Enable +} PSTATE_MSR; + +#define GetF16KbCpuVid(PstateMsr) (((PSTATE_MSR *) PstateMsr)->CpuVid) + + +/* VID operation related macros */ +#define ConvertVidInuV(Vid) (1550000 - (6250 * Vid)) ///< Convert VID in uV. + +/* COFVID Control Register 0xC0010070 */ +#define MSR_COFVID_CTL 0xC0010070ul + +/// COFVID Control MSR Register +typedef struct { + UINT64 CpuFid:6; ///< CpuFid + UINT64 CpuDid:3; ///< CpuDid + UINT64 CpuVid_6_0:7; ///< CpuVid[6:0] + UINT64 PstateId:3; ///< Pstate ID + UINT64 :1; ///< Reserved + UINT64 CpuVid_7:1; ///< CpuVid[7] + UINT64 :1; ///< Reserved + UINT64 NbPstate:1; ///< Northbridge P-state + UINT64 :1; ///< Reserved + UINT64 NbVid:8; ///< NbVid + UINT64 :32; ///< Reserved +} COFVID_CTRL_MSR; + +#define COFVID_CTRL_MSR_CurCpuVid_6_0_OFFSET 9 +#define COFVID_CTRL_MSR_CurCpuVid_6_0_WIDTH 7 +#define COFVID_CTRL_MSR_CurCpuVid_6_0_MASK 0xfe00 +#define COFVID_CTRL_MSR_CurCpuVid_7_OFFSET 20 +#define COFVID_CTRL_MSR_CurCpuVid_7_WIDTH 1 +#define COFVID_CTRL_MSR_CurCpuVid_7_MASK 0x100000ul + +/* SVI VID Encoding */ + +///< Union structure of VID in SVI1/SVI2 modes +typedef union { + UINT32 RawVid; ///< Raw VID value + struct { ///< SVI2 mode VID structure + UINT32 Vid_6_0:7; ///< Vid[6:0] of SVI2 mode + UINT32 Vid_7:1; ///< Vid[7] of SVI2 mode + } SVI2; + struct { ///< SVI1 mode VID structure + UINT32 Vid_LSB_Ignore:1; ///< Ignored LSB of 8bit VID encoding in SVI1 mode + UINT32 Vid_6_0:1; ///< Vid[6:0] of SVI mode + } SVI1; +} SVI_VID; + + +#define SetF16KbCpuVid(CofVidStsMsr, NewCpuVid) ( \ + ((COFVID_CTRL_MSR *) CofVidStsMsr)->CurCpuVid_6_0) = ((SVI_VID *) NewCpuVid)->SVI2.Vid_6_0; \ + ((COFVID_CTRL_MSR *) CofVidStsMsr)->CurCpuVid_7) = ((SVI_VID *) NewCpuVid)->SVI2.Vid_7; \ +) + + +/* COFVID Status Register 0xC0010071 */ +#define MSR_COFVID_STS 0xC0010071ul + +/// COFVID Status MSR Register +typedef struct { + UINT64 CurCpuFid:6; ///< Current CpuFid + UINT64 CurCpuDid:3; ///< Current CpuDid + UINT64 CurCpuVid_6_0:7; ///< Current CpuVid[6:0] + UINT64 CurPstate:3; ///< Current Pstate + UINT64 :1; ///< Reserved + UINT64 CurCpuVid_7:1; ///< Current CpuVid[7] + UINT64 :2; ///< Reserved + UINT64 NbPstateDis:1; ///< NbPstate Disable + UINT64 :8; + UINT64 StartupPstate:3; ///< Startup Pstate + UINT64 :14; ///< Reserved + UINT64 MaxCpuCof:6; ///< MaxCpuCof + UINT64 :1; ///< Reserved + UINT64 CurPstateLimit:3; ///< Current Pstate Limit + UINT64 MaxNbCof:5; ///< MaxNbCof +} COFVID_STS_MSR; + +#define COFVID_STS_MSR_CurCpuVid_6_0_OFFSET 9 +#define COFVID_STS_MSR_CurCpuVid_6_0_WIDTH 7 +#define COFVID_STS_MSR_CurCpuVid_6_0_MASK 0xfe00 +#define COFVID_STS_MSR_CurCpuVid_7_OFFSET 20 +#define COFVID_STS_MSR_CurCpuVid_7_WIDTH 1 +#define COFVID_STS_MSR_CurCpuVid_7_MASK 0x100000ul + +#define GetF16KbCurCpuVid(CofVidStsMsr) ( \ + (((COFVID_STS_MSR *) CofVidStsMsr)->CurCpuVid_7 << COFVID_STS_MSR_CurCpuVid_6_0_WIDTH) \ + | ((COFVID_STS_MSR *) CofVidStsMsr)->CurCpuVid_6_0) + + +/* + * Family 16h Kabini CPU Power Management PCI definitions + * + */ +/* Link Initialization Status D18F0x1A0 */ +#define LINK_INIT_STATUS_REG 0x1A0 +#define LINK_INIT_STATUS_REG_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_0, LINK_INIT_STATUS_REG)) + +/// Link Initialization Status +typedef struct { + UINT32 InitComplete0:2; ///< Initialization complete for link 0 + UINT32 InitComplete1:2; ///< Initialization complete for link 1 + UINT32 :20; ///< Reserved + UINT32 IntNbExtCap:4; ///< Internal NB extneded capability + UINT32 :3; ///< Reserved + UINT32 InitStatusValid:1; ///< Initialization status valid +} LINK_INIT_STATUS_REGISTER; + +/* NB Configuration 1 Low F3x88 */ +#define NB_CFG1_LOW_REG 0x88 +#define NB_CFG1_LOW_REG_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_3, NB_CFG1_LOW_REG)) + +/// Power Control Miscellaneous PCI Register +typedef struct { + UINT32 :18; ///< Reserved + UINT32 DisCstateBoostBlockPstateUp:1; ///< DisCstateBoostBlockPstateUp + UINT32 :12; ///< Reserved + UINT32 DisCohLdtCfg:1; ///< Disable coherent link configuration accesses +} NB_CFG1_LOW_REG_REGISTER; + +/* Power Control Miscellaneous Register F3xA0 */ +#define PW_CTL_MISC_REG 0xA0 +#define PW_CTL_MISC_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_3, PW_CTL_MISC_REG)) + +/// Power Control Miscellaneous PCI Register +typedef struct { + UINT32 PsiVid:7; ///< PSI_L VID threshold VID[6:0] + UINT32 PsiVidEn:1; ///< PSI_L VID enable + UINT32 PsiVid_7:1; ///< PSI_L VID threshold VID[7] + UINT32 :1; ///< Reserved + UINT32 IdleExitEn:1; ///< Idle exit enable + UINT32 PllLockTime:3; ///< PLL synchronization lock time + UINT32 Svi2HighFreqSel:1; ///< SVI2 high frequency select + UINT32 :1; ///< Reserved + UINT32 ConfigId:12; ///< Configuration ID + UINT32 :3; ///< Reserved + UINT32 CofVidProg:1; ///< COF and VID of Pstate programmed +} POWER_CTRL_MISC_REGISTER; + + +/* Clock Power/Timing Control 0 Register F3xD4 */ +#define CPTC0_REG 0xD4 +#define CPTC0_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_3, CPTC0_REG)) + +/// Clock Power Timing Control PCI Register +typedef struct { + UINT32 MaxSwPstateCpuCof:6; ///< Maximum software P-state core COF + UINT32 :2; ///< Reserved + UINT32 ClkRampHystSel:4; ///< Clock Ramp Hysteresis Select + UINT32 ClkRampHystCtl:1; ///< Clock Ramp Hysteresis Control + UINT32 :1; ///< Reserved + UINT32 CacheFlushImmOnAllHalt:1; ///< Cache Flush Immediate on All Halt + UINT32 :5; ///< Reserved + UINT32 PowerStepDown:4; ///< Power Step Down + UINT32 PowerStepUp:4; ///< Power Step Up + UINT32 NbClkDiv:3; ///< NbClkDiv + UINT32 NbClkDivApplyAll:1; ///< NbClkDivApplyAll +} CLK_PWR_TIMING_CTRL_REGISTER; + + +/* Clock Power/Timing Control 1 Register F3xD8 */ +#define CPTC1_REG 0xD8 +#define CPTC1_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_3, CPTC1_REG)) + +/// Clock Power Timing Control 1 PCI Register +typedef struct { + UINT32 :4; ///< Reserved + UINT32 VSRampSlamTime:3; ///< Voltage stabilization ramp time + UINT32 :25; ///< Reserved +} CLK_PWR_TIMING_CTRL1_REGISTER; + + +/* Northbridge Capabilities Register F3xE8 */ +#define NB_CAPS_REG 0xE8 +#define NB_CAPS_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_3, NB_CAPS_REG)) + +/// Northbridge Capabilities PCI Register +typedef struct { + UINT32 :1; ///< Reserved + UINT32 DualNode:1; ///< Dual-node multi-processor capable + UINT32 EightNode:1; ///< Eight-node multi-processor capable + UINT32 Ecc:1; ///< ECC capable + UINT32 Chipkill:1; ///< Chipkill ECC capable + UINT32 :3; ///< Reserved + UINT32 MctCap:1; ///< Memory controller capable + UINT32 SvmCapable:1; ///< SVM capable + UINT32 HtcCapable:1; ///< HTC capable + UINT32 :3; ///< Reserved + UINT32 MultVidPlane:1; ///< Multiple VID plane capable + UINT32 :4; ///< Reserved + UINT32 x2Apic:1; ///< x2Apic capability + UINT32 :4; ///< Reserved + UINT32 MemPstateCap:1; ///< Memory P-state capable + UINT32 :3; ///< Reserved + UINT32 Succor:1; ///< SUCCOR + UINT32 :3; ///< Reserved +} NB_CAPS_REGISTER; + +/* Sample and Residency Timers Register D18F4x110 */ +#define SAMPLE_RESIDENCY_TIMER_REG 0x110 +#define SAMPLE_RESIDENCY_TIMER_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_4, SAMPLE_RESIDENCY_TIMER_REG)) + +/// Sample and Residency Timers Register +typedef struct { + UINT32 CSampleTimer:12; ///< CSampleTimer + UINT32 FastCSampleTimer:1; ///< FastCSampleTimer + UINT32 MinResTmr:8; ///< Minimum residency timer + UINT32 :11; ///< Reserved +} SAMPLE_RESIDENCY_TIMER_REGISTER; + +/* C-state Control 1 Register D18F4x118 */ +#define CSTATE_CTRL1_REG 0x118 +#define CSTATE_CTRL1_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_4, CSTATE_CTRL1_REG)) + +/// C-state Control 1 Register +typedef struct { + UINT32 CpuPrbEnCstAct0:1; ///< Core direct probe enable + UINT32 CacheFlushEnCstAct0:1; ///< Cache flush enable + UINT32 CacheFlushTmrSelCstAct0:2; ///< Cache flush timer select + UINT32 :1; ///< Reserved + UINT32 ClkDivisorCstAct0:3; ///< Clock divisor + UINT32 PwrGateEnCstAct0:1; ///< Power gate enable + UINT32 PwrOffEnCstAct0:1; ///< C-state action field 3 + UINT32 NbPwrGate0:1; ///< NB power-gating 0 + UINT32 NbClkGate0:1; ///< NB clock-gating 0 + UINT32 SelfRefr0:1; ///< Self-refresh 0 + UINT32 SelfRefrEarly0:1; ///< Allow early self-refresh 0 + UINT32 :2; ///< Reserved + UINT32 CpuPrbEnCstAct1:1; ///< Core direct probe enable + UINT32 CacheFlushEnCstAct1:1; ///< Cache flush eable + UINT32 CacheFlushTmrSelCstAct1:2; ///< Cache flush timer select + UINT32 :1; ///< Reserved + UINT32 ClkDivisorCstAct1:3; ///< Clock divisor + UINT32 PwrGateEnCstAct1:1; ///< Power gate enable + UINT32 PwrOffEnCstAct1:1; ///< C-state action field 3 + UINT32 NbPwrGate1:1; ///< NB power-gating 1 + UINT32 NbClkGate1:1; ///< NB clock-gating 1 + UINT32 SelfRefr1:1; ///< Self-refresh 1 + UINT32 SelfRefrEarly1:1; ///< Allow early self-refresh 1 + UINT32 :2; ///< Reserved +} CSTATE_CTRL1_REGISTER; + + +/* C-state Control 2 Register D18F4x11C */ +#define CSTATE_CTRL2_REG 0x11C +#define CSTATE_CTRL2_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_4, CSTATE_CTRL2_REG)) + +/// C-state Control 2 Register +typedef struct { + UINT32 CpuPrbEnCstAct2:1; ///< Core direct probe enable + UINT32 CacheFlushEnCstAct2:1; ///< Cache flush eable + UINT32 CacheFlushTmrSelCstAct2:2; ///< Cache flush timer select + UINT32 :1; ///< Reserved + UINT32 ClkDivisorCstAct2:3; ///< Clock divisor + UINT32 PwrGateEnCstAct2:1; ///< Power gate enable + UINT32 PwrOffEnCstAct2:1; ///< C-state action field 3 + UINT32 NbPwrGate2:1; ///< NB power-gating 2 + UINT32 NbClkGate2:1; ///< NB clock-gating 2 + UINT32 SelfRefr2:1; ///< Self-refresh 2 + UINT32 SelfRefrEarly2:1; ///< Allow early self-refresh 2 + UINT32 :18; ///< Reserved +} CSTATE_CTRL2_REGISTER; + + +/* Cstate Policy Control 1 Register D18F4x128 */ +#define CSTATE_POLICY_CTRL1_REG 0x128 +#define CSTATE_POLICY_CTRL1_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_4, CSTATE_POLICY_CTRL1_REG)) + +/// Cstate Policy Control 1 Register +typedef struct { + UINT32 :2; ///< Reserved + UINT32 HaltCstateIndex:3; ///< Specifies the IO-based C-state that is invoked by a HLT instruction + UINT32 CacheFlushTmr:7; ///< Cache flush timer + UINT32 :6; ///< Reserved + UINT32 CacheFlushSucMonThreshold:3; ///< Cache flush success monitor threshold + UINT32 CacheFlushSucMonTmrSel:2; ///< Cache flush success monitor timer select + UINT32 CacheFlushSucMonMispredictAct:2; ///< Cache flush success monitor mispredict action + UINT32 :6; ///< Reserved + UINT32 CstateMsgDis:1; ///< C-state messaging disable +} CSTATE_POLICY_CTRL1_REGISTER; + + +/* Core Performance Boost Control Register D18F4x15C */ + +/// Core Performance Boost Control Register +typedef struct { + UINT32 BoostSrc:2; ///< Boost source + UINT32 NumBoostStates:3; ///< Number of boosted states + UINT32 :2; ///< Reserved + UINT32 ApmMasterEn:1; ///< APM master enable + UINT32 CstatePowerEn:1; ///< C-state Power Enable + UINT32 :22; ///< Reserved + UINT32 BoostLock:1; ///< +} CPB_CTRL_REGISTER; + + +/* Northbridge Capabilities 2 F5x84*/ +#define NB_CAPS_REG2 0x84 +#define NB_CAPS_REG2_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_5, NB_CAPS_REG2)) + +/// Northbridge Capabilities 2 PCI Register +typedef struct { + UINT32 CmpCap:8; ///< CMP capable + UINT32 :4; ///< Reserved + UINT32 DctEn:4; ///< DCT enabled + UINT32 DdrMaxRate:5; ///< maximum DDR rate + UINT32 :3; ///< Reserved + UINT32 DdrMaxRateEnf:5; ///< enforced maximum DDR rate: + UINT32 :3; ///< Reserved +} NB_CAPS_2_REGISTER; + +/* Northbridge Configuration 4 F5x88*/ +#define NB_CFG_REG4 0x88 +#define NB_CFG_REG4_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_5, NB_CFG_REG4)) + +/// Northbridge Configuration 4 PCI Register +typedef struct { + UINT32 CC6PstateWakeUpDis:1; ///< CC6PstateWakeUpDis + UINT32 :17; ///< Reserved + UINT32 EnCstateBoostBlockCC6Exit:1;///< EnCstateBoostBlockCC6Exit + UINT32 :5; ///< Reserved + UINT32 DisHbNpReqBusLock:1; ///< DisHbNpReqBusLock + UINT32 :7; ///< Reserved +} NB_CFG_4_REGISTER; + +typedef struct { + UINT32 Bits_19_0:20; ///< Bits[19:0] + UINT32 Bits_31_20:12; ///< Reserved +} pmgmt_str0; + +typedef struct { + UINT32 Bits_19_0:20; ///< Bits[19:0] + UINT32 Bits_31_20:12; ///< Reserved +} pmgmt_str1; + +/* Northbridge P-state [3:0] F5x1[6C:60] */ + +/// Northbridge P-state Register +typedef struct { + UINT32 NbPstateEn:1; ///< NB P-state enable + UINT32 NbFid:6; ///< NB frequency ID + UINT32 NbDid:1; ///< NB divisor ID + UINT32 :2; ///< Reserved + UINT32 NbVid_6_0:7; ///< NB VID[6:0] + UINT32 :1; ///< Reserved + UINT32 MemPstate:1; ///< Memory P-State + UINT32 :2; ///< Reserved + UINT32 NbVid_7:1; ///< NB VID[7] + UINT32 NbIddDiv:2; ///< northbridge current divisor + UINT32 NbIddValue:8; ///< northbridge current value +} NB_PSTATE_REGISTER; + +#define NB_PSTATE_REGISTER_NbVid_6_0_OFFSET 10 +#define NB_PSTATE_REGISTER_NbVid_6_0_WIDTH 7 +#define NB_PSTATE_REGISTER_NbVid_6_0_MASK 0x0001FC00ul +#define NB_PSTATE_REGISTER_NbVid_7_OFFSET 21 +#define NB_PSTATE_REGISTER_NbVid_7_WIDTH 1 +#define NB_PSTATE_REGISTER_NbVid_7_MASK 0x00200000ul + +#define GetF16KbNbVid(NbPstateRegister) ( \ + (((NB_PSTATE_REGISTER *) NbPstateRegister)->NbVid_7 << NB_PSTATE_REGISTER_NbVid_6_0_WIDTH) \ + | ((NB_PSTATE_REGISTER *) NbPstateRegister)->NbVid_6_0) + +#define SetF16KbNbVid(NbPstateRegister, NewNbVid) { \ + ((NB_PSTATE_REGISTER *) NbPstateRegister)->NbVid_6_0 = ((SVI_VID *) NewNbVid)->SVI2.Vid_6_0; \ + ((NB_PSTATE_REGISTER *) NbPstateRegister)->NbVid_7 = ((SVI_VID *) NewNbVid)->SVI2.Vid_7; \ +} + +/* Northbridge P-state Status */ +#define NB_PSTATE_CTRL 0x170 +#define NB_PSTATE_CTRL_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_5, NB_PSTATE_CTRL)) + +/// Northbridge P-state Control Register +typedef struct { + UINT32 NbPstateMaxVal:2; ///< NB P-state maximum value + UINT32 :1; ///< Reserved + UINT32 NbPstateLo:2; ///< NB P-state low + UINT32 :1; ///< Reserved + UINT32 NbPstateHi:2; ///< NB P-state high + UINT32 :1; ///< Reserved + UINT32 NbPstateThreshold:4; ///< NB P-state threshold + UINT32 NbPstateDisOnP0:1; ///< NB P-state disable on P0 + UINT32 SwNbPstateLoDis:1; ///< Software NB P-state low disable + UINT32 :8; ///< Reserved + UINT32 NbPstateGnbSlowDis:1; ///< NbPstateGnbSlowDis + UINT32 NbPstateLoRes:3; ///< NB P-state low residency timer + UINT32 NbPstateHiRes:3; ///< NB P-state high residency timer + UINT32 NbPstateFidVidSbcEn:1; ///< NbPstateFidVidSbcEn + UINT32 MemPstateDis:1; ///< Memory P-state disable +} NB_PSTATE_CTRL_REGISTER; + + +/* Northbridge P-state Status */ +#define NB_PSTATE_STATUS 0x174 +#define NB_PSTATE_STATUS_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_5, NB_PSTATE_STATUS)) + +/// Northbridge P-state Status Register +typedef struct { + UINT32 NbPstateDis:1; ///< Nb pstate disable + UINT32 StartupNbPstate:2; ///< startup northbridge Pstate number + UINT32 CurNbFid:6; ///< Current NB FID + UINT32 CurNbDid:1; ///< Current NB DID + UINT32 :2; ///< Reserved + UINT32 CurNbVid_6_0:7; ///< Current NB VID[6:0] + UINT32 CurNbPstate:2; ///< Current NB Pstate + UINT32 :1; ///< Reserved + UINT32 CurNbPstateLo:1; ///< Current NB Pstate maps to Lo or Hi + UINT32 CurNbVid_7:1; ///< Current NB VID[7] + UINT32 CurMemPstate:1; ///< Current memory P-state + UINT32 :7; ///< Reserved +} NB_PSTATE_STS_REGISTER; + +#define NB_PSTATE_STS_REGISTER_CurNbVid_6_0_OFFSET 12 +#define NB_PSTATE_STS_REGISTER_CurNbVid_6_0_WIDTH 7 +#define NB_PSTATE_STS_REGISTER_CurNbVid_6_0_MASK 0x0007F000ul +#define NB_PSTATE_STS_REGISTER_CurNbVid_7_OFFSET 23 +#define NB_PSTATE_STS_REGISTER_CurNbVid_7_WIDTH 1 +#define NB_PSTATE_STS_REGISTER_CurNbVid_7_MASK 0x00800000ul + +#define GetF16KbCurNbVid(NbPstateStsRegister) ( \ + (((NB_PSTATE_STS_REGISTER *) NbPstateStsRegister)->CurNbVid_7 << NB_PSTATE_STS_REGISTER_CurNbVid_6_0_WIDTH) \ + | ((NB_PSTATE_STS_REGISTER *) NbPstateStsRegister)->CurNbVid_6_0) + +/* Miscellaneous Voltages */ +#define MISC_VOLTAGES 0x17C +#define MISC_VOLTAGES_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_5, MISC_VOLTAGES)) + +/// Miscellaneous Voltages Register +typedef struct { + UINT32 MaxVid:8; ///< Maximum Voltage + UINT32 :2; ///< Reserved + UINT32 MinVid:8; ///< Minimum Voltage + UINT32 :5; ///< Reserved + UINT32 NbPsi0Vid:8; ///< Northbridge PSI0_L VID threshold + UINT32 NbPsi0VidEn:1; ///< Northbridge PSI0_L VID enable +} MISC_VOLTAGE_REGISTER; + + +/* Clock Power/Timing Control 5 Register F5x188 */ +#define CPTC5_REG 0x188 +#define CPTC5_PCI_ADDR (MAKE_SBDFO (0, 0, 0x18, FUNC_5, CPTC5_REG)) + +/// Clock Power Timing Control 5 Register +typedef struct { + UINT32 NbOffsetTrim:2; ///< Northbridge offset trim + UINT32 NbLoadLineTrim:3; ///< Northbridge load line trim + UINT32 NbPsi1:1; ///< Northbridge PSI1_L + UINT32 :1; ///< Northbridge telemetry functionality. + UINT32 :25; ///< Reserved +} CLK_PWR_TIMING_CTRL_5_REGISTER; + +#endif /* _CPU_F16_KB_POWERMGMT_H_ */ diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerMgmtSystemTables.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerMgmtSystemTables.c new file mode 100644 index 0000000000..fac228848f --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPowerMgmtSystemTables.c @@ -0,0 +1,153 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Models 0x00 - 0x0F Kabini Power Management related initialization table + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "Ids.h" +#include "cpuRegisters.h" +#include "cpuApicUtilities.h" +#include "cpuFamilyTranslation.h" +#include "cpuPowerMgmtSystemTables.h" +#include "F16KbUtilities.h" +#include "F16KbCoreAfterReset.h" +#include "F16KbNbAfterReset.h" +#include "F16KbPowerCheck.h" +#include "IdsF16KbAllService.h" +#include "Filecode.h" +CODE_GROUP (G2_PEI) +RDATA_GROUP (G2_PEI) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBPOWERMGMTSYSTEMTABLES_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +GetF16KbSysPmTable ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT CONST VOID **SysPmTblPtr, + OUT UINT8 *NumberOfElements, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/* Family 16h Kabini Only Table */ +/* ---------------------- */ +CONST SYS_PM_TBL_STEP ROMDATA CpuF16KbSysPmTableArray[] = +{ + /// @todo + IDS_INITIAL_F16_KB_PM_STEP + // Step 1 - Configure F3x[84:80]. Handled by PCI register table. + + // Step 2 - Disable NB Pstate, if required + // Execute both cold & warm + { + 0, // ExeFlags + F16KbNbPstateDis // Function Pointer + }, + + // Step 3 - Core Minimum P-state Transition Sequence After Warm Reset + // Execute only after warm reset + { + PM_EXEFLAGS_WARM_ONLY, // ExeFlags + F16KbPmCoreAfterReset // Function Pointer + }, + + // Step 4 - NB P-state COF and VID Synchronization After Warm Reset + // Execute only after warm reset + { + PM_EXEFLAGS_WARM_ONLY, // ExeFlags + F16KbPmNbAfterReset // Function Pointer + }, + + // Step 5 - Power Check + // Execute only after warm reset + { + 0, // ExeFlags + F16KbPmPwrCheck // Function Pointer + }, + + IDS_F16_KB_PM_CUSTOM_STEP +}; + +/*---------------------------------------------------------------------------------------*/ +/** + * Returns the appropriate table of steps to perform to initialize the power management + * subsystem. + * + * @CpuServiceMethod{::F_CPU_GET_FAMILY_SPECIFIC_ARRAY}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[out] SysPmTblPtr Points to the first entry in the table. + * @param[out] NumberOfElements Number of valid entries in the table. + * @param[in] StdHeader Header for library and services. + * + */ +VOID +GetF16KbSysPmTable ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT CONST VOID **SysPmTblPtr, + OUT UINT8 *NumberOfElements, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + *NumberOfElements = (sizeof (CpuF16KbSysPmTableArray) / sizeof (SYS_PM_TBL_STEP)); + *SysPmTblPtr = CpuF16KbSysPmTableArray; +} diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPsi.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPsi.c new file mode 100644 index 0000000000..7d9d4d2a96 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPsi.c @@ -0,0 +1,278 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini PSI Initialization + * + * Enables Power Status Indicator (PSI) feature + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuRegisters.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuFeatures.h" +#include "cpuServices.h" +#include "GeneralServices.h" +#include "cpuFamilyTranslation.h" +#include "CommonReturns.h" +#include "cpuPsi.h" +#include "Filecode.h" +CODE_GROUP (G2_PEI) +RDATA_GROUP (G2_PEI) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBPSI_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +VOID +STATIC +F16KbPmVrmLowPowerModeEnable ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN PCI_ADDR PciAddress, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Entry point for enabling Power Status Indicator + * + * This function must be run after all P-State routines have been executed + * + * @param[in] PsiServices The current CPU's family services. + * @param[in] EntryPoint Timepoint designator. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] StdHeader Config handle for library and services. + * + * @retval AGESA_SUCCESS Always succeeds. + * + */ +AGESA_STATUS +STATIC +F16KbInitializePsi ( + IN PSI_FAMILY_SERVICES *PsiServices, + IN UINT64 EntryPoint, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + PCI_ADDR PciAddress; + CPU_SPECIFIC_SERVICES *FamilySpecificServices; + + if ((EntryPoint & (CPU_FEAT_AFTER_POST_MTRR_SYNC | CPU_FEAT_AFTER_RESUME_MTRR_SYNC)) != 0) { + GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **)&FamilySpecificServices, StdHeader); + PciAddress.AddressValue = MAKE_SBDFO (0, 0, 24, 0, 0); + // Configure PsiVid + F16KbPmVrmLowPowerModeEnable (FamilySpecificServices, PlatformConfig, PciAddress, StdHeader); + } + + return AGESA_SUCCESS; +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Sets up PSI_L operation. + * + * This function implements the LowPowerThreshold parameter. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] PciAddress Segment, bus, device number of the node to transition. + * @param[in] StdHeader Config handle for library and services. + * + */ +VOID +STATIC +F16KbPmVrmLowPowerModeEnable ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN PCI_ADDR PciAddress, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + PSTATE_MSR PstateMsr; + CLK_PWR_TIMING_CTRL2_REGISTER ClkPwrTimingCtrl2; + POWER_CTRL_MISC_REGISTER PwrCtrlMisc; + UINT32 CoreVrmLowPowerThreshold; + UINT32 Pstate; + UINT32 HwPstateMaxVal; + UINT32 PstateCurrent; + UINT32 NextPstateCurrent; + UINT32 PreviousVid; + UINT32 CurrentVid; + + NB_PSTATE_REGISTER NbPstateReg; + NB_PSTATE_CTRL_REGISTER NbPsCtrl; + MISC_VOLTAGE_REGISTER MiscVoltageReg; + UINT32 NbVrmLowPowerThreshold; + UINT32 NbPstate; + UINT32 NbPstateMaxVal; + UINT32 NbPstateCurrent; + UINT32 NextNbPstateCurrent; + UINT32 PreviousNbVid; + UINT32 CurrentNbVid; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbPmVrmLowPowerModeEnable\n"); + + if (PlatformConfig->VrmProperties[CoreVrm].LowPowerThreshold != 0) { + // Set up PSI0_L for VDD + CoreVrmLowPowerThreshold = PlatformConfig->VrmProperties[CoreVrm].LowPowerThreshold; + IDS_HDT_CONSOLE (CPU_TRACE, " Core VRM - LowPowerThreshold: %d\n", CoreVrmLowPowerThreshold); + PreviousVid = 0xFF; + CurrentVid = 0xFF; + + PciAddress.AddressValue = CPTC2_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &ClkPwrTimingCtrl2, StdHeader); + HwPstateMaxVal = ClkPwrTimingCtrl2.HwPstateMaxVal; + ASSERT (HwPstateMaxVal < NM_PS_REG); + + IDS_HDT_CONSOLE (CPU_TRACE, " HwPstateMaxVal %d\n", HwPstateMaxVal); + // Check P-state from P0 to HwPstateMaxVal + for (Pstate = 0; Pstate <= HwPstateMaxVal; Pstate++) { + FamilySpecificServices->GetProcIddMax (FamilySpecificServices, (UINT8) Pstate, &PstateCurrent, StdHeader); + + LibAmdMsrRead ((UINT32) (Pstate + PS_REG_BASE), (UINT64 *) &PstateMsr, StdHeader); + CurrentVid = (UINT32) PstateMsr.CpuVid; + + if (Pstate == HwPstateMaxVal) { + NextPstateCurrent = 0; + } else { + // Check P-state from P1 to HwPstateMaxVal + FamilySpecificServices->GetProcIddMax (FamilySpecificServices, (UINT8) (Pstate + 1), &NextPstateCurrent, StdHeader); + } + + if ((PstateCurrent <= CoreVrmLowPowerThreshold) && + (NextPstateCurrent <= CoreVrmLowPowerThreshold) && + (CurrentVid != PreviousVid)) { + // Program PsiVid and PsiVidEn if PSI state is found and stop searching. + PciAddress.AddressValue = PW_CTL_MISC_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &PwrCtrlMisc, StdHeader); + PwrCtrlMisc.PsiVid = CurrentVid; + PwrCtrlMisc.PsiVidEn = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &PwrCtrlMisc, StdHeader); + IDS_HDT_CONSOLE (CPU_TRACE, " PsiVid is enabled at P-state %d. PsiVid: %d\n", Pstate, CurrentVid); + break; + } else { + PstateCurrent = NextPstateCurrent; + PreviousVid = CurrentVid; + } + } + } + + if (PlatformConfig->VrmProperties[NbVrm].LowPowerThreshold != 0) { + // Set up NBPSI0_L for VDDNB + NbVrmLowPowerThreshold = PlatformConfig->VrmProperties[NbVrm].LowPowerThreshold; + IDS_HDT_CONSOLE (CPU_TRACE, " NB VRM - LowPowerThreshold: %d\n", NbVrmLowPowerThreshold); + PreviousNbVid = 0xFF; + CurrentNbVid = 0xFF; + + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + NbPstateMaxVal = NbPsCtrl.NbPstateMaxVal; + ASSERT (NbPstateMaxVal < NM_NB_PS_REG); + + IDS_HDT_CONSOLE (CPU_TRACE, " NbPstateMaxVal %d\n", NbPstateMaxVal); + for (NbPstate = 0; NbPstate <= NbPstateMaxVal; NbPstate++) { + // Check only valid NB P-state + if (FamilySpecificServices->GetNbIddMax (FamilySpecificServices, (UINT8) NbPstate, &NbPstateCurrent, StdHeader) != TRUE) { + continue; + } + + PciAddress.Address.Register = (NB_PSTATE_0 + (sizeof (NB_PSTATE_REGISTER) * NbPstate)); + LibAmdPciRead (AccessWidth32, PciAddress, &NbPstateReg, StdHeader); + CurrentNbVid = (UINT32) GetF16KbNbVid (&NbPstateReg); + + if (NbPstate == NbPstateMaxVal) { + NextNbPstateCurrent = 0; + } else { + // Check only valid NB P-state + if (FamilySpecificServices->GetNbIddMax (FamilySpecificServices, (UINT8) (NbPstate + 1), &NextNbPstateCurrent, StdHeader) != TRUE) { + continue; + } + } + + if ((NbPstateCurrent <= NbVrmLowPowerThreshold) && + (NextNbPstateCurrent <= NbVrmLowPowerThreshold) && + (CurrentNbVid != PreviousNbVid)) { + // Program NbPsi0Vid and NbPsi0VidEn if PSI state is found and stop searching. + PciAddress.AddressValue = MISC_VOLTAGES_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &MiscVoltageReg, StdHeader); + MiscVoltageReg.NbPsi0Vid = CurrentNbVid; + MiscVoltageReg.NbPsi0VidEn = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &MiscVoltageReg, StdHeader); + IDS_HDT_CONSOLE (CPU_TRACE, " NbPsi0Vid is enabled at NB P-state %d. NbPsi0Vid: %d\n", NbPstate, CurrentNbVid); + break; + } else { + PreviousNbVid = CurrentNbVid; + } + } + } +} + + +CONST PSI_FAMILY_SERVICES ROMDATA F16KbPsiSupport = +{ + 0, + (PF_PSI_IS_SUPPORTED) CommonReturnTrue, + F16KbInitializePsi +}; diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPstate.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPstate.c new file mode 100644 index 0000000000..38913c1d7a --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbPstate.c @@ -0,0 +1,613 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini Pstate feature support functions. + * + * Provides the functions necessary to initialize the Pstate feature. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "GeneralServices.h" +#include "cpuPstateTables.h" +#include "cpuRegisters.h" +#include "Table.h" +#include "cpuFamilyTranslation.h" +#include "cpuFamRegisters.h" +#include "cpuF16Utilities.h" +#include "F16KbUtilities.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "CommonReturns.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBPSTATE_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +VOID +STATIC +F16KbGetPowerStepValueInTime ( + IN OUT UINT32 *PowerStepPtr + ); + +VOID +STATIC +F16KbGetPllValueInTime ( + IN OUT UINT32 *PllLockTimePtr + ); + + +AGESA_STATUS +F16KbGetPstateTransLatency ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN PSTATE_LEVELING *PStateLevelingBufferStructPtr, + IN PCI_ADDR *PciAddress, + OUT UINT32 *TransitionLatency, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +F16KbGetPstateFrequency ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN UINT8 StateNumber, + OUT UINT32 *FrequencyInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +F16KbGetPstatePower ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN UINT8 StateNumber, + OUT UINT32 *PowerInMw, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +F16KbGetPstateMaxState ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + OUT UINT32 *MaxPStateNumber, + OUT UINT8 *NumberOfBoostStates, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +F16KbGetPstateRegisterInfo ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN UINT32 PState, + OUT BOOLEAN *PStateEnabled, + IN OUT UINT32 *IddVal, + IN OUT UINT32 *IddDiv, + OUT UINT32 *SwPstateNumber, + IN AMD_CONFIG_PARAMS *StdHeader + ); + + + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Family specific call to check if Pstate PSD is dependent. + * + * @param[in] PstateCpuServices Pstate CPU services. + * @param[in,out] PlatformConfig Contains the runtime modifiable feature input data. + * @param[in] StdHeader Config Handle for library, services. + * + * @retval TRUE PSD is dependent. + * @retval FALSE PSD is independent. + * + */ +BOOLEAN +STATIC +F16KbIsPstatePsdDependent ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN OUT PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbIsPstatePsdDependent\n"); + // Family 16h KB defaults to independent PSD + IDS_HDT_CONSOLE (CPU_TRACE, " P-state PSD is independent.\n"); + return FALSE; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Family specific call to get Pstate Transition Latency. + * + * Calculate TransitionLatency by power step value and pll value. + * + * @param[in] PstateCpuServices Pstate CPU services. + * @param[in] PStateLevelingBufferStructPtr Pstate row data buffer pointer + * @param[in] PciAddress Pci address + * @param[out] TransitionLatency The transition latency. + * @param[in] StdHeader Header for library and services + * + * @retval AGESA_SUCCESS Always succeeds. + */ +AGESA_STATUS +F16KbGetPstateTransLatency ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN PSTATE_LEVELING *PStateLevelingBufferStructPtr, + IN PCI_ADDR *PciAddress, + OUT UINT32 *TransitionLatency, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 CpuFid; + UINT32 HwP0CpuFid; + UINT32 PowerStepDown; + UINT32 PowerStepUp; + UINT32 PllLockTime; + UINT32 LocalPciRegister; + UINT32 k; + UINT32 PStateMaxValueOnCurrentCore; + UINT32 TransAndBusMastLatency; + UINT64 MsrData; + BOOLEAN CpuFidSameFlag; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetPstateTransLatency\n"); + + CpuFidSameFlag = TRUE; + HwP0CpuFid = 0; + + // Get PStateMaxValue + PciAddress->Address.Register = CPTC2_REG; + PciAddress->Address.Function = FUNC_3; + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + PStateMaxValueOnCurrentCore = ((CLK_PWR_TIMING_CTRL2_REGISTER *) &LocalPciRegister)->HwPstateMaxVal; + + // + //Check if MSRC001_00[6B:64][CpuFid] is the same value for all P-states + // + for (k = 0; k <= PStateMaxValueOnCurrentCore; k++) { + LibAmdMsrRead ((MSR_PSTATE_0 + k), &MsrData, StdHeader); + CpuFid = (UINT32) (((PSTATE_MSR *) &MsrData)->CpuFid); + if (k == 0) { + HwP0CpuFid = CpuFid; + } + if (HwP0CpuFid != CpuFid) { + CpuFidSameFlag = FALSE; + break; + } + } + + PciAddress->Address.Register = CPTC0_REG; + PciAddress->Address.Function = FUNC_3; + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + + // PowerStepDown - Bits 20:23 + PowerStepDown = ((CLK_PWR_TIMING_CTRL_REGISTER *) &LocalPciRegister)->PowerStepDown; + + // PowerStepUp - Bits 24:27 + PowerStepUp = ((CLK_PWR_TIMING_CTRL_REGISTER *) &LocalPciRegister)->PowerStepUp; + + // Convert the raw numbers in TempVar8_a and TempVar8_b into time + F16KbGetPowerStepValueInTime (&PowerStepDown); + F16KbGetPowerStepValueInTime (&PowerStepUp); + + // + //(15 * (F3xD4[PowerStepDown] + F3xD4[PowerStepUp]) /1000) us + // + TransAndBusMastLatency = + (15 * (PowerStepDown + PowerStepUp) + 999) / 1000; + + if (!CpuFidSameFlag) { + // + //+ F3xA0[PllLockTime] + // + PciAddress->Address.Register = PW_CTL_MISC_REG; + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + + PllLockTime = ((POWER_CTRL_MISC_REGISTER *) &LocalPciRegister)->PllLockTime; + F16KbGetPllValueInTime (&PllLockTime); + TransAndBusMastLatency += PllLockTime; + } + + *TransitionLatency = TransAndBusMastLatency; + + return (AGESA_SUCCESS); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Family specific call to calculates the frequency in megahertz of the desired P-state. + * + * @param[in] PstateCpuServices Pstate CPU services. + * @param[in] StateNumber The P-State to analyze. + * @param[out] FrequencyInMHz The P-State's frequency in MegaHertz + * @param[in] StdHeader Header for library and services + * + * @retval AGESA_SUCCESS Always Succeeds. + */ +AGESA_STATUS +F16KbGetPstateFrequency ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN UINT8 StateNumber, + OUT UINT32 *FrequencyInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT8 TempValue; + UINT32 CpuDid; + UINT32 CpuFid; + UINT64 LocalMsrRegister; + PCI_ADDR PciAddress; + HTC_REGISTER HtcReg; + CLK_PWR_TIMING_CTRL2_REGISTER ClkPwrTimingCtrl2; + + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetPstateFrequency - P%d\n", StateNumber); + + PciAddress.AddressValue = CPTC2_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &ClkPwrTimingCtrl2, StdHeader); + + PciAddress.AddressValue = HTC_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &HtcReg, StdHeader); + + ASSERT ((StateNumber <= ClkPwrTimingCtrl2.HwPstateMaxVal) || ((StateNumber == HtcReg.HtcPstateLimit))); + + LibAmdMsrRead (PS_REG_BASE + (UINT32) StateNumber, &LocalMsrRegister, StdHeader); + + CpuDid = (UINT32) (((PSTATE_MSR *) &LocalMsrRegister)->CpuDid); + CpuFid = (UINT32) (((PSTATE_MSR *) &LocalMsrRegister)->CpuFid); + + switch (CpuDid) { + case 0: + TempValue = 1; + break; + case 1: + TempValue = 2; + break; + case 2: + TempValue = 4; + break; + case 3: + TempValue = 8; + break; + case 4: + TempValue = 16; + break; + default: + // CpuDid is set to an undefined value. This is due to either a misfused CPU, or + // an invalid P-state MSR write. + ASSERT (FALSE); + TempValue = 1; + break; + } + *FrequencyInMHz = (100 * (CpuFid + 0x10) / TempValue); + IDS_HDT_CONSOLE (CPU_TRACE, " FrequencyInMHz=%d, CpuFid=%d, CpuDid=%d\n", *FrequencyInMHz, CpuFid, CpuDid); + + return (AGESA_SUCCESS); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Family specific call to calculates the power in milliWatts of the desired P-state. + * + * @param[in] PstateCpuServices Pstate CPU services. + * @param[in] StateNumber Which P-state to analyze + * @param[out] PowerInMw The Power in milliWatts of that P-State + * @param[in] StdHeader Header for library and services + * + * @retval AGESA_SUCCESS Always succeeds. + */ +AGESA_STATUS +F16KbGetPstatePower ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN UINT8 StateNumber, + OUT UINT32 *PowerInMw, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 CpuVid; + UINT32 IddValue; + UINT32 IddDiv; + UINT32 V_x100000; + UINT32 Power; + UINT64 LocalMsrRegister; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetPstatePower - P%d\n", StateNumber); + + ASSERT (StateNumber < NM_PS_REG); + LibAmdMsrRead (PS_REG_BASE + (UINT32) StateNumber, &LocalMsrRegister, StdHeader); + ASSERT (((PSTATE_MSR *) &LocalMsrRegister)->PsEnable == 1); + CpuVid = (UINT32) (((PSTATE_MSR *) &LocalMsrRegister)->CpuVid); + IddValue = (UINT32) (((PSTATE_MSR *) &LocalMsrRegister)->IddValue); + IddDiv = (UINT32) (((PSTATE_MSR *) &LocalMsrRegister)->IddDiv); + + if (CpuVid >= 0xF8) { + V_x100000 = 0; + } else { + V_x100000 = 155000L - (625L * CpuVid); + } + + Power = V_x100000 * IddValue; + + switch (IddDiv) { + case 0: + *PowerInMw = Power / 100L; + break; + case 1: + *PowerInMw = Power / 1000L; + break; + case 2: + *PowerInMw = Power / 10000L; + break; + default: + // IddDiv is set to an undefined value. This is due to either a misfused CPU, or + // an invalid P-state MSR write. + ASSERT (FALSE); + *PowerInMw = 0; + break; + } + IDS_HDT_CONSOLE (CPU_TRACE, " PowerInMw=%d, CpuVid=%d, IddValue=%d, IddDiv=%d\n", *PowerInMw, CpuVid, IddValue, IddDiv); + + return (AGESA_SUCCESS); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Family specific call to get CPU pstate max state. + * + * @param[in] PstateCpuServices Pstate CPU services. + * @param[out] MaxPStateNumber The max hw pstate value on the current socket. + * @param[out] NumberOfBoostStates The number of boosted P-states on the current socket. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @retval AGESA_SUCCESS Always succeeds. + */ +AGESA_STATUS +F16KbGetPstateMaxState ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + OUT UINT32 *MaxPStateNumber, + OUT UINT8 *NumberOfBoostStates, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 NumBoostStates; + UINT64 MsrValue; + UINT32 LocalPciRegister; + PCI_ADDR PciAddress; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetPstateMaxState\n"); + + LocalPciRegister = 0; + + // For F16 Kabini CPU, skip boosted p-state. The boosted p-state number = F4x15C[NumBoostStates]. + PciAddress.AddressValue = CPB_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); // F4x15C + + NumBoostStates = ((CPB_CTRL_REGISTER *) &LocalPciRegister)->NumBoostStates; + *NumberOfBoostStates = (UINT8) NumBoostStates; + + // + // Read PstateMaxVal [6:4] from MSR C001_0061 + // So, we will know the max pstate state in this socket. + // + LibAmdMsrRead (MSR_PSTATE_CURRENT_LIMIT, &MsrValue, StdHeader); + *MaxPStateNumber = (UINT32) (((PSTATE_CURLIM_MSR *) &MsrValue)->PstateMaxVal) + NumBoostStates; + IDS_HDT_CONSOLE (CPU_TRACE, " MaxPStateNumber=%d, NumBoostStates=%d\n", *MaxPStateNumber, NumBoostStates); + + return (AGESA_SUCCESS); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Family specific call to get CPU pstate register information. + * + * @param[in] PstateCpuServices Pstate CPU services. + * @param[in] PState Input Pstate number for query. + * @param[out] PStateEnabled Boolean flag return pstate enable. + * @param[in,out] IddVal Pstate current value. + * @param[in,out] IddDiv Pstate current divisor. + * @param[out] SwPstateNumber Software P-state number. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @retval AGESA_SUCCESS Always succeeds. + */ +AGESA_STATUS +F16KbGetPstateRegisterInfo ( + IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices, + IN UINT32 PState, + OUT BOOLEAN *PStateEnabled, + IN OUT UINT32 *IddVal, + IN OUT UINT32 *IddDiv, + OUT UINT32 *SwPstateNumber, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 LocalPciRegister; + UINT64 LocalMsrRegister; + PCI_ADDR PciAddress; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetPstateRegisterInfo - P%d\n", PState); + + ASSERT (PState < NM_PS_REG); + + // For F16 Kabini CPU, skip boosted p-state. The boosted p-state number = F4x15C[NumBoostStates]. + PciAddress.AddressValue = CPB_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); // F4x15C + + // Read PSTATE MSRs + LibAmdMsrRead (PS_REG_BASE + (UINT32) PState, &LocalMsrRegister, StdHeader); + + *SwPstateNumber = PState; + + if (((PSTATE_MSR *) &LocalMsrRegister)->PsEnable == 1) { + // PState enable = bit 63 + *PStateEnabled = TRUE; + // + // Check input pstate belongs to Boosted-Pstate, if yes, return *PStateEnabled = FALSE. + // + if (PState < ((CPB_CTRL_REGISTER *) &LocalPciRegister)->NumBoostStates) { + *PStateEnabled = FALSE; + } else { + *SwPstateNumber = PState - ((CPB_CTRL_REGISTER *) &LocalPciRegister)->NumBoostStates; + } + IDS_HDT_CONSOLE (CPU_TRACE, " Pstate %d is enabled. SwPstateNumber=%d\n", PState, *SwPstateNumber); + } else { + *PStateEnabled = FALSE; + } + + // Bits 39:32 (high 32 bits [7:0]) + *IddVal = (UINT32) ((PSTATE_MSR *) &LocalMsrRegister)->IddValue; + // Bits 41:40 (high 32 bits [9:8]) + *IddDiv = (UINT32) ((PSTATE_MSR *) &LocalMsrRegister)->IddDiv; + + IDS_HDT_CONSOLE (CPU_TRACE, " IddVal=%d, IddDiv=%d\n", *IddVal, *IddDiv); + return (AGESA_SUCCESS); +} + + +CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F16KbPstateServices = +{ + 0, + (PF_PSTATE_PSD_IS_NEEDED) CommonReturnTrue, + F16KbIsPstatePsdDependent, + F16KbGetPstateTransLatency, + F16KbGetPstateFrequency, + (PF_CPU_SET_PSTATE_LEVELING_REG) CommonReturnAgesaSuccess, + F16KbGetPstatePower, + F16KbGetPstateMaxState, + F16KbGetPstateRegisterInfo +}; + + +/*--------------------------------------------------------------------------------------- + * L O C A L F U N C T I O N S + *--------------------------------------------------------------------------------------- + */ + + +/** + *--------------------------------------------------------------------------------------- + * + * F16KbGetPowerStepValueInTime + * + * Description: + * Convert power step value in time + * + * Parameters: + * @param[out] *PowerStepPtr + * + * @retval VOID + * + *--------------------------------------------------------------------------------------- + **/ +VOID +STATIC +F16KbGetPowerStepValueInTime ( + IN OUT UINT32 *PowerStepPtr + ) +{ + UINT32 TempVar_a; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetPowerStepValueInTime\n"); + + TempVar_a = *PowerStepPtr; + + if (TempVar_a < 0x4) { + *PowerStepPtr = 400 - (TempVar_a * 100); + } else if (TempVar_a < 0x9) { + *PowerStepPtr = 130 - (TempVar_a * 10); + } else { + *PowerStepPtr = 90 - (TempVar_a * 5); + } + IDS_HDT_CONSOLE (CPU_TRACE, " PowerStepPtr=%d\n", *PowerStepPtr); +} + +/** + *--------------------------------------------------------------------------------------- + * + * F16KbGetPllValueInTime + * + * Description: + * Convert PLL Value in time + * + * Parameters: + * @param[out] *PllLockTimePtr + * + * @retval VOID + * + *--------------------------------------------------------------------------------------- + **/ +VOID +STATIC +F16KbGetPllValueInTime ( + IN OUT UINT32 *PllLockTimePtr + ) +{ + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetPllValueInTime\n"); + + if (*PllLockTimePtr < 4) { + *PllLockTimePtr = *PllLockTimePtr + 1; + } else if (*PllLockTimePtr == 4) { + *PllLockTimePtr = 8; + } else if (*PllLockTimePtr == 5) { + *PllLockTimePtr = 16; + } else + *PllLockTimePtr = 0; + IDS_HDT_CONSOLE (CPU_TRACE, " PllLockTimePtr=%d\n", *PllLockTimePtr); +} + + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbSharedMsrTable.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbSharedMsrTable.c new file mode 100644 index 0000000000..a953793c3d --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbSharedMsrTable.c @@ -0,0 +1,112 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini Shared MSR table with values as defined in BKDG + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 86705 $ @e \$Date: 2013-01-24 17:34:21 -0600 (Thu, 24 Jan 2013) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuRegisters.h" +#include "Table.h" +#include "Filecode.h" +CODE_GROUP (G3_DXE) +RDATA_GROUP (G3_DXE) + +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBSHAREDMSRTABLE_FILECODE + + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ +// M S R T a b l e s +// ---------------------- + +STATIC CONST MSR_TYPE_ENTRY_INITIALIZER ROMDATA F16KbSharedMsrRegisters[] = +{ + // When there's a entry, change the number of entries below from 0 to (sizeof (F16KbSharedMsrRegisters) / sizeof (TABLE_ENTRY_FIELDS)) + {0}, +}; + +// Shared MSRs with Special Programming Requirements Table +// ---------------------- +STATIC CONST FAM_SPECIFIC_WORKAROUND_TYPE_ENTRY_INITIALIZER ROMDATA F16KbSharedMsrWorkarounds[] = +{ + // When there's a entry, change the number of entries below from 0 to (sizeof (F16KbSharedMsrWorkarounds) / sizeof (TABLE_ENTRY_FIELDS)) + {0}, +}; + + +CONST REGISTER_TABLE ROMDATA F16KbSharedMsrRegisterTable = { + ComputeUnitPrimary, + PERFORM_TP_AFTER_AP_LAUNCH, + 0, + //(sizeof (F16KbSharedMsrRegisters) / sizeof (TABLE_ENTRY_FIELDS)), + (TABLE_ENTRY_FIELDS *) &F16KbSharedMsrRegisters, +}; + +CONST REGISTER_TABLE ROMDATA F16KbSharedMsrWorkaroundTable = { + ComputeUnitPrimary, + PERFORM_TP_AFTER_AP_LAUNCH, + 0, + //(sizeof (F16KbSharedMsrWorkarounds) / sizeof (TABLE_ENTRY_FIELDS)), + (TABLE_ENTRY_FIELDS *) &F16KbSharedMsrWorkarounds, +}; + + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbUtilities.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbUtilities.c new file mode 100644 index 0000000000..ed94e79f78 --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbUtilities.c @@ -0,0 +1,1015 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 models 00h - 0Fh Kabini specific utility functions. + * + * Provides numerous utility functions specific to family 16h Kabini. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +/*---------------------------------------------------------------------------------------- + * M O D U L E S U S E D + *---------------------------------------------------------------------------------------- + */ +#include "AGESA.h" +#include "amdlib.h" +#include "cpuFamilyTranslation.h" +#include "cpuF16PowerMgmt.h" +#include "F16KbPowerMgmt.h" +#include "cpuEarlyInit.h" +#include "GeneralServices.h" +#include "F16KbUtilities.h" +#include "Filecode.h" +CODE_GROUP (G2_PEI) +RDATA_GROUP (G2_PEI) +#define FILECODE PROC_CPU_FAMILY_0X16_KB_F16KBUTILITIES_FILECODE + +/*---------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * T Y P E D E F S A N D S T R U C T U R E S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------- + * P R O T O T Y P E S O F L O C A L F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +VOID +STATIC +F16KbNbPstateDisCore ( + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbGetNbFreqNumeratorInMHz ( + IN UINT32 NbFid, + OUT UINT32 *FreqNumeratorInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbGetNbFreqDivisor ( + IN UINT32 NbDid, + OUT UINT32 *FreqDivisor, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +STATIC +F16KbCalculateNbFrequencyInMHz ( + IN UINT32 NbFid, + IN UINT32 NbDid, + OUT UINT32 *FrequencyInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbCovertVidInuV ( + IN UINT32 Vid, + OUT UINT32 *VoltageInuV, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbCmnGetIddDivisor ( + IN UINT32 IddDiv, + OUT UINT32 *IddDivisor, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +STATIC +F16KbCmnCalculateCurrentInmA ( + IN UINT32 IddValue, + IN UINT32 IddDiv, + OUT UINT32 *CurrentInmA, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +BOOLEAN +F16KbSetDownCoreRegister ( + IN CPU_CORE_LEVELING_FAMILY_SERVICES *FamilySpecificServices, + IN UINT32 *Socket, + IN UINT32 *Module, + IN UINT32 *LeveledCores, + IN CORE_LEVELING_TYPE CoreLevelMode, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +/*---------------------------------------------------------------------------------------- + * E X P O R T E D F U N C T I O N S + *---------------------------------------------------------------------------------------- + */ + +/*---------------------------------------------------------------------------------------*/ +/** + * Get CPU pstate current. + * + * @CpuServiceMethod{::F_CPU_GET_IDD_MAX}. + * + * This function returns the ProcIddMax. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] Pstate The P-state to check. + * @param[out] ProcIddMax P-state current in mA. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @retval TRUE P-state is enabled + * @retval FALSE P-state is disabled + */ +BOOLEAN +F16KbGetProcIddMax ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN UINT8 Pstate, + OUT UINT32 *ProcIddMax, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 MsrAddress; + PSTATE_MSR PstateMsr; + BOOLEAN IsPstateEnabled; + PCI_ADDR PciAddress; + NB_CAPS_2_REGISTER NbCap2; + UINT32 ProcIddMaxPerCore; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetProcIddMax - P%d\n", Pstate); + + IsPstateEnabled = FALSE; + + MsrAddress = (UINT32) (Pstate + PS_REG_BASE); + ASSERT (MsrAddress <= PS_MAX_REG); + + LibAmdMsrRead (MsrAddress, (UINT64 *) &PstateMsr, StdHeader); + F16KbCmnCalculateCurrentInmA ((UINT32) PstateMsr.IddValue, (UINT32) PstateMsr.IddDiv, &ProcIddMaxPerCore, StdHeader); + PciAddress.AddressValue = NB_CAPS_REG2_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbCap2, StdHeader); + *ProcIddMax = (UINT32) ProcIddMaxPerCore * (NbCap2.CmpCap + 1); + IDS_HDT_CONSOLE (CPU_TRACE, " Pstate %d ProcIddMax %d CmpCap %d\n", Pstate, *ProcIddMax, NbCap2.CmpCap); + + if (PstateMsr.PsEnable == 1) { + IsPstateEnabled = TRUE; + } + return IsPstateEnabled; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Set down core register on Kabini + * + * This function set F3x190 Downcore Control Register[5:0] + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] Socket Socket ID. + * @param[in] Module Module ID in socket. + * @param[in] LeveledCores Number of core. + * @param[in] CoreLevelMode Core level mode. + * @param[in] StdHeader Header for library and services. + * + * @retval TRUE Down Core register is updated. + * @retval FALSE Down Core register is not updated. + */ +BOOLEAN +F16KbSetDownCoreRegister ( + IN CPU_CORE_LEVELING_FAMILY_SERVICES *FamilySpecificServices, + IN UINT32 *Socket, + IN UINT32 *Module, + IN UINT32 *LeveledCores, + IN CORE_LEVELING_TYPE CoreLevelMode, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT8 NumOfComputeUnit; + UINT8 CoresPerComputeUnit; + UINT32 LocalPciRegister; + UINT32 CoreDisableBits; + UINT32 TempVar32_a; + PCI_ADDR PciAddress; + BOOLEAN IsUpdated; + AGESA_STATUS AgesaStatus; + + IsUpdated = FALSE; + CoreDisableBits = 0; + TempVar32_a = 1; + CoresPerComputeUnit = 1; + + switch (CoreLevelMode) { + // There's no 'break' except 'case CORE_LEVEL_COMPUTE_UNIT'. + // It's for generating CoreDisableBits and CoresPerComputeUnit + case CORE_LEVEL_COMPUTE_UNIT_THREE: + TempVar32_a = TempVar32_a << 1; + CoresPerComputeUnit++; + case CORE_LEVEL_COMPUTE_UNIT_TWO: + TempVar32_a = TempVar32_a << 1; + CoresPerComputeUnit++; + case CORE_LEVEL_COMPUTE_UNIT: + TempVar32_a = (TempVar32_a << 1) - 1; + TempVar32_a = FOUR_CORE_COMPUTE_UNIT_BITMAP & (~TempVar32_a); + NumOfComputeUnit = (UINT8) ((*LeveledCores) / CoresPerComputeUnit); + for (CoreDisableBits = 0; NumOfComputeUnit > 0; NumOfComputeUnit--) { + CoreDisableBits <<= FOUR_CORE_COMPUTE_UNIT_BITWIDTH; + CoreDisableBits |= TempVar32_a; + } + break; + default: + TempVar32_a = *LeveledCores; + if (TempVar32_a == 1) { + CoreDisableBits = DOWNCORE_MASK_SINGLE; + } else { + CoreDisableBits = ALL_CORES_DISABLE_BITMAP; + TempVar32_a = ((1 << TempVar32_a) - 1); + CoreDisableBits &= ~TempVar32_a; + } + } + + if (CoreDisableBits != 0) { + if (GetPciAddress (StdHeader, (UINT8) *Socket, (UINT8) *Module, &PciAddress, &AgesaStatus)) { + PciAddress.Address.Function = FUNC_5; + PciAddress.Address.Register = NORTH_BRIDGE_CAPABILITIES_2_REG; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + LocalPciRegister = (LocalPciRegister & 0xFF) + 1; + LocalPciRegister = (1 << LocalPciRegister) - 1; + CoreDisableBits &= LocalPciRegister; + + PciAddress.Address.Function = FUNC_3; + PciAddress.Address.Register = DOWNCORE_CTRL; + LibAmdPciRead (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + if ((LocalPciRegister | CoreDisableBits) != LocalPciRegister) { + LocalPciRegister |= CoreDisableBits; + LibAmdPciWrite (AccessWidth32, PciAddress, &LocalPciRegister, StdHeader); + IsUpdated = TRUE; + } + } + } + + return IsUpdated; +} + + +CONST CPU_CORE_LEVELING_FAMILY_SERVICES ROMDATA F16KbCoreLeveling = +{ + 0, + F16KbSetDownCoreRegister +}; + + +/*---------------------------------------------------------------------------------------*/ +/** + * Determines the NB clock on the desired node. + * + * @CpuServiceMethod{::F_CPU_GET_NB_FREQ}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[out] FrequencyInMHz Northbridge clock frequency in MHz. + * @param[in] StdHeader Header for library and services. + * + * @return AGESA_SUCCESS FrequencyInMHz is valid. + */ +AGESA_STATUS +F16KbGetCurrentNbFrequency ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT UINT32 *FrequencyInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + NB_PSTATE_STS_REGISTER NbPstateStsReg; + PCI_ADDR PciAddress; + AGESA_STATUS ReturnCode; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetCurrentNbFrequency\n"); + + PciAddress.AddressValue = NB_PSTATE_STATUS_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPstateStsReg, StdHeader); + ReturnCode = F16KbCalculateNbFrequencyInMHz ( + NbPstateStsReg.CurNbFid, + NbPstateStsReg.CurNbDid, + FrequencyInMHz, + StdHeader + ); + return ReturnCode; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Returns the node's minimum and maximum northbridge frequency. + * + * @CpuServiceMethod{::F_CPU_GET_MIN_MAX_NB_FREQ}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] PlatformConfig Platform profile/build option config structure. + * @param[in] PciAddress The segment, bus, and device numbers of the CPU in question. + * @param[out] MaxFreqInMHz The node's maximum northbridge frequency. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @retval AGESA_SUCCESS Northbridge frequency is valid + */ +AGESA_STATUS +F16KbGetMinMaxNbFrequency ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN PCI_ADDR *PciAddress, + OUT UINT32 *var3, + OUT UINT32 *MaxFreqInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + INT8 NbPsMaxVal; + UINT8 i; + UINT32 LocalPciRegister; + AGESA_STATUS AgesaStatus; + + AgesaStatus = AGESA_ERROR; + + // Obtain the max NB frequency on the node + PciAddress->Address.Function = FUNC_5; + PciAddress->Address.Register = NB_PSTATE_CTRL; + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + NbPsMaxVal = (INT8) ((NB_PSTATE_CTRL_REGISTER *) &LocalPciRegister)->NbPstateMaxVal; + + // Starting from NB Pmax + for (i = 0; i <= NbPsMaxVal; i++) { + PciAddress->Address.Function = FUNC_5; + PciAddress->Address.Register = (NB_PSTATE_0 + (4 * i)); + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + + // Ensure that the NB Pstate is enabled + if (((NB_PSTATE_REGISTER *) &LocalPciRegister)->NbPstateEn == 1) { + AgesaStatus = F16KbCalculateNbFrequencyInMHz (((NB_PSTATE_REGISTER *) &LocalPciRegister)->NbFid, + ((NB_PSTATE_REGISTER *) &LocalPciRegister)->NbDid, + MaxFreqInMHz, + StdHeader); + break; + } + } + // If all of NbPstates are disabled, get MaxFreqInMHz from CurNbPstate + if (i > NbPsMaxVal) { + PciAddress->Address.Register = NB_PSTATE_STATUS; + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + F16KbCalculateNbFrequencyInMHz (((NB_PSTATE_STS_REGISTER *) &LocalPciRegister)->CurNbFid, + ((NB_PSTATE_STS_REGISTER *) &LocalPciRegister)->CurNbDid, + MaxFreqInMHz, + StdHeader); + *var3 = *MaxFreqInMHz; + ASSERT (FALSE); + } else { + // If platform configuration disable NB P-states, return the NB P0 frequency + // as both the min and max frequency on the node. + if (PlatformConfig->PlatformProfile.PlatformPowerPolicy == Performance) { + *var3 = *MaxFreqInMHz; + } else { + PciAddress->Address.Function = FUNC_5; + PciAddress->Address.Register = NB_PSTATE_CTRL; + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + NbPsMaxVal = (INT8) ((NB_PSTATE_CTRL_REGISTER *) &LocalPciRegister)->NbPstateMaxVal; + + // Obtain the min NB frequency on the node, starting from NB Pmin + for (; NbPsMaxVal >= 0; NbPsMaxVal--) { + PciAddress->Address.Function = FUNC_5; + PciAddress->Address.Register = (NB_PSTATE_0 + (4 * NbPsMaxVal)); + LibAmdPciRead (AccessWidth32, *PciAddress, &LocalPciRegister, StdHeader); + + // Ensure that the NB Pstate is enabled + if (((NB_PSTATE_REGISTER *) &LocalPciRegister)->NbPstateEn == 1) { + AgesaStatus = F16KbCalculateNbFrequencyInMHz (((NB_PSTATE_REGISTER *) &LocalPciRegister)->NbFid, + ((NB_PSTATE_REGISTER *) &LocalPciRegister)->NbDid, + var3, + StdHeader); + break; + } + } + } + } + IDS_OPTION_HOOK (IDS_NBPS_MIN_FREQ, var3, StdHeader); + + return AgesaStatus; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Determines the NB clock on the desired node. + * + * @CpuServiceMethod{::F_CPU_GET_NB_PSTATE_INFO}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] PlatformConfig Platform profile/build option config structure. + * @param[in] PciAddress The segment, bus, and device numbers of the CPU in question. + * @param[in] NbPstate The NB P-state number to check. + * @param[out] FreqNumeratorInMHz The desired node's frequency numerator in megahertz. + * @param[out] FreqDivisor The desired node's frequency divisor. + * @param[out] VoltageInuV The desired node's voltage in microvolts. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @retval TRUE NbPstate is valid + * @retval FALSE NbPstate is disabled or invalid + */ +BOOLEAN +F16KbGetNbPstateInfo ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN PCI_ADDR *PciAddress, + IN UINT32 NbPstate, + OUT UINT32 *FreqNumeratorInMHz, + OUT UINT32 *FreqDivisor, + OUT UINT32 *VoltageInuV, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 NbVid; + BOOLEAN PstateIsValid; + NB_PSTATE_CTRL_REGISTER NbPstateCtrlReg; + NB_PSTATE_REGISTER NbPstateReg; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetNbPstateInfo - NB P%d\n", NbPstate); + + ASSERT ((PciAddress->Address.Segment == 0) && (PciAddress->Address.Bus == 0) && (PciAddress->Address.Device == 0x18)); + + PstateIsValid = FALSE; + + // If NB P1, P2, or P3 is requested, make sure that NB Pstate is enabled + if ((NbPstate == 0) || (FamilySpecificServices->IsNbPstateEnabled (FamilySpecificServices, PlatformConfig, StdHeader))) { + PciAddress->AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, *PciAddress, &NbPstateCtrlReg, StdHeader); + + ASSERT ((NbPstate < NM_NB_PS_REG) && (NbPstateCtrlReg.NbPstateMaxVal < NM_NB_PS_REG)); + if (NbPstate <= NbPstateCtrlReg.NbPstateMaxVal) { + PciAddress->Address.Register = (NB_PSTATE_0 + (sizeof (NB_PSTATE_REGISTER) * NbPstate)); + LibAmdPciRead (AccessWidth32, *PciAddress, &NbPstateReg, StdHeader); + IDS_HDT_CONSOLE (CPU_TRACE, " En:%d Fid:%x Did:%x Vid:%x\n", NbPstateReg.NbPstateEn, NbPstateReg.NbFid, NbPstateReg.NbDid, GetF16KbNbVid (&NbPstateReg)); + + // Check if at least NB P0 is enabled. + ASSERT ((NbPstate == 0) ? (NbPstateReg.NbPstateEn == 1) : TRUE); + // Ensure that requested NbPstate is enabled + if (NbPstateReg.NbPstateEn == 1) { + F16KbGetNbFreqNumeratorInMHz (NbPstateReg.NbFid, FreqNumeratorInMHz, StdHeader); + F16KbGetNbFreqDivisor (NbPstateReg.NbDid, FreqDivisor, StdHeader); + + NbVid = GetF16KbNbVid (&NbPstateReg); + F16KbCovertVidInuV (NbVid, VoltageInuV, StdHeader); + PstateIsValid = TRUE; + } + } + } + return PstateIsValid; +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Get NB pstate current. + * + * @CpuServiceMethod{::F_CPU_GET_NB_IDD_MAX}. + * + * This function returns the NbIddMax. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] NbPstate The NB P-state to check. + * @param[out] NbIddMax NB P-state current in mA. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @retval TRUE NB P-state is enabled, and NbIddMax is valid. + * @retval FALSE NB P-state is disabled + */ +BOOLEAN +F16KbGetNbIddMax ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN UINT8 NbPstate, + OUT UINT32 *NbIddMax, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + BOOLEAN IsNbPsEnabled; + PCI_ADDR PciAddress; + NB_PSTATE_CTRL_REGISTER NbPstateCtrlReg; + NB_PSTATE_REGISTER NbPstateReg; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetNbIddMax - NB P%d\n", NbPstate); + + IsNbPsEnabled = FALSE; + + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPstateCtrlReg, StdHeader); + + ASSERT (NbPstate < NM_NB_PS_REG); + if (NbPstate <= NbPstateCtrlReg.NbPstateMaxVal) { + PciAddress.Address.Register = (NB_PSTATE_0 + (sizeof (NB_PSTATE_REGISTER) * NbPstate)); + LibAmdPciRead (AccessWidth32, PciAddress, &NbPstateReg, StdHeader); + + // Ensure that requested NbPstate is enabled + if (NbPstateReg.NbPstateEn == 1) { + F16KbCmnCalculateCurrentInmA (NbPstateReg.NbIddValue, NbPstateReg.NbIddDiv, NbIddMax, StdHeader); + IsNbPsEnabled = TRUE; + IDS_HDT_CONSOLE (CPU_TRACE, " NB Pstate %d is Valid. NbIddMax %d\n", NbPstate, *NbIddMax); + } + } + return IsNbPsEnabled; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Get the number of physical cores of current processor. + * + * @CpuServiceMethod{::F_CPU_NUMBER_OF_PHYSICAL_CORES}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @return The number of physical cores. + */ +UINT8 +F16KbGetNumberOfPhysicalCores ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + CPUID_DATA CpuId; + + // + //CPUID.80000008h.ECX.NC + 1, 000b = 1, 001b = 2, etc. + // + LibAmdCpuidRead (CPUID_LONG_MODE_ADDR, &CpuId, StdHeader); + return ((UINT8) ((CpuId.ECX_Reg & 0xff) + 1)); +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Use the Mailbox Register to get the Ap Mailbox info for the current core. + * + * @CpuServiceMethod{::F_CPU_AMD_GET_AP_MAILBOX_FROM_HARDWARE}. + * + * Access the mailbox register used with this NB family. This is valid until the + * point that some init code initializes the mailbox register for its normal use. + * The Machine Check Misc (Thresholding) register is available as both a PCI config + * register and a MSR, so it can be used as a mailbox from HT to other functions. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[out] ApMailboxInfo The AP Mailbox info + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + */ +VOID +F16KbGetApMailboxFromHardware ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT AP_MAILBOXES *ApMailboxInfo, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + // For Family 16h Kabini, we will return socket 0, node 0, module 0, module type 0, and 0 for + // the system degree + ApMailboxInfo->ApMailInfo.Info = (UINT32) 0x00000000; + ApMailboxInfo->ApMailExtInfo.Info = (UINT32) 0x00000000; +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Get this AP's system core number from hardware. + * + * @CpuServiceMethod{::F_CPU_GET_AP_CORE_NUMBER}. + * + * Returns the system core number from the scratch MSR, where + * it was saved at heap initialization. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @return The AP's unique core number + */ +UINT32 +F16KbGetApCoreNumber ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + CPUID_DATA Cpuid; + + LibAmdCpuidRead (0x1, &Cpuid, StdHeader); + return ((Cpuid.EBX_Reg >> 24) & 0xFF); +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Is the Northbridge PState feature enabled? + * + * @CpuServiceMethod{::F_IS_NB_PSTATE_ENABLED}. + * + * @param[in] FamilySpecificServices The current Family Specific Services. + * @param[in] PlatformConfig Platform profile/build option config structure. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @retval TRUE The NB PState feature is enabled. + * @retval FALSE The NB PState feature is not enabled. + */ +BOOLEAN +F16KbIsNbPstateEnabled ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + PCI_ADDR PciAddress; + BOOLEAN NbPstatesSupported; + BOOLEAN SkipHwCfg; + NB_PSTATE_STS_REGISTER NbPstateSts; + NB_PSTATE_CTRL_REGISTER NbPstateCtrl; + + + PciAddress.AddressValue = NB_PSTATE_STATUS_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *) &NbPstateSts, StdHeader); + if (NbPstateSts.NbPstateDis == 1) { + return FALSE; + } + + SkipHwCfg = FALSE; + IDS_OPTION_HOOK (IDS_NBPSDIS_OVERRIDE, &SkipHwCfg, StdHeader); + + // NbPstates is supported by default + NbPstatesSupported = TRUE; + + // Get user options + if (!PlatformConfig->PlatformProfile.NbPstatesSupported) { + NbPstatesSupported = FALSE; + } + + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, (VOID *) &NbPstateCtrl, StdHeader); + if (((NbPstateCtrl.NbPstateMaxVal != 0) || SkipHwCfg) && (NbPstatesSupported)) { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------------------*/ +/** + * Disable NB P-state. + * - clear F5x1[6C:64] + * - clear F5x170[NbPstateMaxVal] + * - set F5x170[SwNbPstateLoDis] + * - clear MSRC001_00[6B:64][NbPstate] + * + * @param[in] FamilySpecificServices The current Family Specific Services + * @param[in] CpuEarlyParamsPtr Service Parameters + * @param[in] StdHeader Handle of Header for calling lib functions and services. + */ +VOID +F16KbNbPstateDis ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParamsPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 i; + UINT32 PciData; + UINT32 NbPsCtrl; + UINT32 NbPsCtrlOrg; + BOOLEAN SkipNbPsLoPart; + PCI_ADDR PciAddress; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbNbPstateDis\n"); + + // D18F5x170[30, NbPstateFidVidSbcEn] = 1 + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateFidVidSbcEn = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + + // Check whether NB P-state is disabled + if (!FamilySpecificServices->IsNbPstateEnabled (FamilySpecificServices, &CpuEarlyParamsPtr->PlatformConfig, StdHeader)) { + + IDS_HDT_CONSOLE (CPU_TRACE, " NB Pstates disabled\n"); + + PciAddress.AddressValue = NB_PSTATE_CTRL_PCI_ADDR; + LibAmdPciRead (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + NbPsCtrlOrg = NbPsCtrl; + + // If CurNbPstate is not NB P0, get the Pstate pointed to by CurNbPstate and copy it's value to NB P0 to P3 and clear NbPstateHi + PciAddress.Address.Register = NB_PSTATE_STATUS; + LibAmdPciRead (AccessWidth32, PciAddress, &PciData, StdHeader); + + SkipNbPsLoPart = FALSE; + if ((((NB_PSTATE_STS_REGISTER *) &PciData)->StartupNbPstate != ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateHi) && + (((NB_PSTATE_STS_REGISTER *) &PciData)->StartupNbPstate != ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateLo)) { + SkipNbPsLoPart = TRUE; + } + + if (((NB_PSTATE_STS_REGISTER *) &PciData)->CurNbPstate != 0) { + PciAddress.Address.Register = NB_PSTATE_0 + (((NB_PSTATE_STS_REGISTER *) &PciData)->CurNbPstate * 4); + LibAmdPciRead (AccessWidth32, PciAddress, &PciData, StdHeader); + + for (i = 1; i < NM_NB_PS_REG; i++) { + PciAddress.Address.Register = NB_PSTATE_0 + (i * 4); + LibAmdPciWrite (AccessWidth32, PciAddress, &PciData, StdHeader); + } + + if (!SkipNbPsLoPart) { + // Program D18F5x170 to transition the NB P-state: + // 1) NbPstateLo = NbPstateMaxVal. + // 2) SwNbPstateLoDis = NbPstateDisOnP0 = NbPstateThreshold = 0. + + PciAddress.Address.Register = NB_PSTATE_CTRL; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateLo = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateMaxVal; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->SwNbPstateLoDis = 0; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateDisOnP0 = 0; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateThreshold = 0; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + + // Wait for D18F5x174[CurNbPstate] to equal NbPstateLo. + PciAddress.Address.Register = NB_PSTATE_STATUS; + do { + LibAmdPciRead (AccessWidth32, PciAddress, &PciData, StdHeader); + } while (((NB_PSTATE_STS_REGISTER *) &PciData)->CurNbPstate != ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateLo); + } + } + + // Program D18F5x170 to force the NB P-state: + // 1) NbPstateHi = target NB P-state. + // 2) SwNbPstateLoDis = 1 + // And clear F5x170[NbPstateMaxVal] + PciAddress.Address.Register = NB_PSTATE_CTRL; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateHi = 0; + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->NbPstateMaxVal = 0; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrl)->SwNbPstateLoDis = 1; + LibAmdPciWrite (AccessWidth32, PciAddress, &NbPsCtrl, StdHeader); + + // Wait for D18F5x174[CurNbPstate] to equal the target NB P-state. + PciAddress.Address.Register = NB_PSTATE_STATUS; + do { + LibAmdPciRead (AccessWidth32, PciAddress, &PciData, StdHeader); + } while (((NB_PSTATE_STS_REGISTER *) &PciData)->CurNbPstate != 0); + + // Clear F5x1[6C:64] + PciData = 0x00000000; + for (i = 1; i < NM_NB_PS_REG; i++) { + PciAddress.Address.Register = NB_PSTATE_0 + (i * 4); + LibAmdPciWrite (AccessWidth32, PciAddress, &PciData, StdHeader); + + } + + // Clear MSRC001_00[6B:64][NbPstate] on cores + F16KbNbPstateDisCore (StdHeader); + + // BIOS performs the following to release the NB P-state force: + // 1. Restore the initial D18F5x170[SwNbPstateLoDis, NbPstateDisOnP0, NbPstateLo] values. + // 2. Restore the initial D18F5x170[NbPstateThreshold, NbPstateHi] values. + PciAddress.Address.Register = NB_PSTATE_CTRL; + LibAmdPciRead (AccessWidth32, PciAddress, &PciData, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &PciData)->NbPstateLo = 0; + LibAmdPciWrite (AccessWidth32, PciAddress, &PciData, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &PciData)->SwNbPstateLoDis = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOrg)->SwNbPstateLoDis; + ((NB_PSTATE_CTRL_REGISTER *) &PciData)->NbPstateDisOnP0 = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOrg)->NbPstateDisOnP0; + LibAmdPciWrite (AccessWidth32, PciAddress, &PciData, StdHeader); + + ((NB_PSTATE_CTRL_REGISTER *) &PciData)->NbPstateHi = 0; + ((NB_PSTATE_CTRL_REGISTER *) &PciData)->NbPstateMaxVal = 0; + LibAmdPciWrite (AccessWidth32, PciAddress, &PciData, StdHeader); + ((NB_PSTATE_CTRL_REGISTER *) &PciData)->NbPstateThreshold = ((NB_PSTATE_CTRL_REGISTER *) &NbPsCtrlOrg)->NbPstateThreshold; + LibAmdPciWrite (AccessWidth32, PciAddress, &PciData, StdHeader); + } +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Disable NB P-state on core. + * - clear MSRC001_00[6B:64][NbPstate]. + * + * @param[in] StdHeader Handle of Header for calling lib functions and services. + */ +VOID +STATIC +F16KbNbPstateDisCore ( + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 i; + UINT64 MsrData; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbNbPstateDisCore\n"); + + // Only one core per compute unit needs to clear NbPstate in P-state MSRs + if (IsCoreComputeUnitPrimary (FirstCoreIsComputeUnitPrimary, StdHeader)) { + for (i = MSR_PSTATE_0; i <= MSR_PSTATE_7; i++) { + LibAmdMsrRead (i, &MsrData, StdHeader); + ((PSTATE_MSR *) &MsrData)->NbPstate = 0; + LibAmdMsrWrite (i, &MsrData, StdHeader); + } + } +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Get NB Frequency Numerator in MHz + * + * @param[in] NbFid NB Frequency ID to convert + * @param[out] FreqNumeratorInMHz The desire NB FID's frequency numerator in megahertz. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + */ +VOID +STATIC +F16KbGetNbFreqNumeratorInMHz ( + IN UINT32 NbFid, + OUT UINT32 *FreqNumeratorInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetNbFreqNumeratorInMHz - NbFid=%d\n", NbFid); + *FreqNumeratorInMHz = (NbFid + 4) * 100; + IDS_HDT_CONSOLE (CPU_TRACE, " FreqNumeratorInMHz=%d\n", *FreqNumeratorInMHz); +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Get NB Frequency Divisor + * + * @param[in] NbDid NB Divisor ID to convert. + * @param[out] FreqDivisor The desire NB DID's frequency divisor. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + */ +VOID +STATIC +F16KbGetNbFreqDivisor ( + IN UINT32 NbDid, + OUT UINT32 *FreqDivisor, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbGetNbFreqDivisor - NbDid=%d\n", NbDid); + *FreqDivisor = (1 << NbDid); + IDS_HDT_CONSOLE (CPU_TRACE, " FreqDivisor=%d\n", *FreqDivisor); +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Calculate NB Frequency in MHz + * + * @param[in] NbFid NB Frequency ID to convert + * @param[in] NbDid NB Divisor ID to convert. + * @param[out] FrequencyInMHz The Northbridge clock frequency in megahertz. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + * @return AGESA_SUCCESS FrequencyInMHz is valid. + */ +AGESA_STATUS +STATIC +F16KbCalculateNbFrequencyInMHz ( + IN UINT32 NbFid, + IN UINT32 NbDid, + OUT UINT32 *FrequencyInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 FreqNumeratorInMHz; + UINT32 FreqDivisor; + AGESA_STATUS ReturnStatus; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbCalculateNbFrequencyInMHz - NbFid=%x, NbDid=%x\n", NbFid, NbDid); + + ReturnStatus = AGESA_SUCCESS; + F16KbGetNbFreqNumeratorInMHz (NbFid, &FreqNumeratorInMHz, StdHeader); + F16KbGetNbFreqDivisor (NbDid, &FreqDivisor, StdHeader); + *FrequencyInMHz = FreqNumeratorInMHz / FreqDivisor; + IDS_HDT_CONSOLE (CPU_TRACE, " FrequencyInMHz=%d\n", *FrequencyInMHz); + + return ReturnStatus; +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Convert VID to microvolts(uV) + * + * @param[in] Vid The voltage ID of SVI2 encoding to be converted. + * @param[out] VoltageInuV The voltage in microvolts. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + */ +VOID +STATIC +F16KbCovertVidInuV ( + IN UINT32 Vid, + OUT UINT32 *VoltageInuV, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbCovertVidInuV\n"); + // Maximum 1.55V, 6.25mV per stpe + *VoltageInuV = ConvertVidInuV(Vid); + IDS_HDT_CONSOLE (CPU_TRACE, " Vid=%x, VoltageInuV=%d\n", Vid, *VoltageInuV); +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Get Core/NB Idd Divisor + * + * @param[in] IddDiv Core/NB current divisor to convert. + * @param[out] IddDivisor The desire Core/NB current divisor. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + */ +VOID +STATIC +F16KbCmnGetIddDivisor ( + IN UINT32 IddDiv, + OUT UINT32 *IddDivisor, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbCmnGetIddDivisor - IddDiv=%d\n", IddDiv); + + switch (IddDiv) { + case 0: + *IddDivisor = 1000; + break; + case 1: + *IddDivisor = 100; + break; + case 2: + *IddDivisor = 10; + break; + default: // IddDiv = 3 is reserved. Use 10 + *IddDivisor = 10; + ASSERT (FALSE); + break; + } + IDS_HDT_CONSOLE (CPU_TRACE, " IddDivisor=%d\n", *IddDivisor); +} + + +/*---------------------------------------------------------------------------------------*/ +/** + * Calculate Core/NB current in mA + * + * @param[in] IddValue Core/NB current value. + * @param[in] IddDiv Core/NB current divisor. + * @param[out] CurrentInmA The Core/NB current in milliampere. + * @param[in] StdHeader Handle of Header for calling lib functions and services. + * + */ +VOID +STATIC +F16KbCmnCalculateCurrentInmA ( + IN UINT32 IddValue, + IN UINT32 IddDiv, + OUT UINT32 *CurrentInmA, + IN AMD_CONFIG_PARAMS *StdHeader + ) +{ + UINT32 IddDivisor; + + IDS_HDT_CONSOLE (CPU_TRACE, " F16KbCmnCalculateCurrentInmA - IddValue=%x, IddDiv=%x\n", IddValue, IddDiv); + + F16KbCmnGetIddDivisor (IddDiv, &IddDivisor, StdHeader); + *CurrentInmA = IddValue * IddDivisor; + + IDS_HDT_CONSOLE (CPU_TRACE, " CurrentInmA=%d\n", *CurrentInmA); +} + + diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbUtilities.h b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbUtilities.h new file mode 100644 index 0000000000..4565ccef0d --- /dev/null +++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/KB/F16KbUtilities.h @@ -0,0 +1,152 @@ +/* $NoKeywords:$ */ +/** + * @file + * + * AMD Family_16 Kabini specific utility functions. + * + * Provides numerous utility functions specific to family 16h Kabini. + * + * @xrefitem bom "File Content Label" "Release Content" + * @e project: AGESA + * @e sub-project: CPU/Family/0x16/KB + * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ + * + */ +/* + ****************************************************************************** + * + * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Advanced Micro Devices, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************** + */ + +#ifndef _F16_KB_UTILITES_H_ +#define _F16_KB_UTILITES_H_ + + +/*--------------------------------------------------------------------------------------- + * M I X E D (Definitions And Macros / Typedefs, Structures, Enums) + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * D E F I N I T I O N S A N D M A C R O S + *--------------------------------------------------------------------------------------- + */ + + +/*--------------------------------------------------------------------------------------- + * T Y P E D E F S, S T R U C T U R E S, E N U M S + *--------------------------------------------------------------------------------------- + */ +#define FOUR_CORE_COMPUTE_UNIT_BITMAP 0xF +#define FOUR_CORE_COMPUTE_UNIT_BITWIDTH 0x4 +#define ALL_CORES_DISABLE_BITMAP 0xFFFFFFFFul + +/*--------------------------------------------------------------------------------------- + * F U N C T I O N P R O T O T Y P E + *--------------------------------------------------------------------------------------- + */ + +UINT8 +F16KbGetNumberOfPhysicalCores ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +F16KbGetApMailboxFromHardware ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT AP_MAILBOXES *ApMailboxInfo, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +BOOLEAN +F16KbIsNbPstateEnabled ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +VOID +F16KbNbPstateDis ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CPU_EARLY_PARAMS *CpuEarlyParamsPtr, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +BOOLEAN +F16KbGetProcIddMax ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN UINT8 Pstate, + OUT UINT32 *ProcIddMax, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +BOOLEAN +F16KbGetNbIddMax ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN UINT8 NbPstate, + OUT UINT32 *NbIddMax, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +F16KbGetCurrentNbFrequency ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + OUT UINT32 *FrequencyInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +AGESA_STATUS +F16KbGetMinMaxNbFrequency ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN PCI_ADDR *PciAddress, + OUT UINT32 *var3, + OUT UINT32 *MaxFreqInMHz, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +BOOLEAN +F16KbGetNbPstateInfo ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN PLATFORM_CONFIGURATION *PlatformConfig, + IN PCI_ADDR *PciAddress, + IN UINT32 NbPstate, + OUT UINT32 *FreqNumeratorInMHz, + OUT UINT32 *FreqDivisor, + OUT UINT32 *VoltageInuV, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +UINT32 +F16KbGetApCoreNumber ( + IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, + IN AMD_CONFIG_PARAMS *StdHeader + ); + +#endif // _F16_KB_UTILITES_H_ |