当前位置: 首页>>代码示例>>C++>>正文


C++ CPU_SPECIFIC_SERVICES::GetProcIddMax方法代码示例

本文整理汇总了C++中CPU_SPECIFIC_SERVICES::GetProcIddMax方法的典型用法代码示例。如果您正苦于以下问题:C++ CPU_SPECIFIC_SERVICES::GetProcIddMax方法的具体用法?C++ CPU_SPECIFIC_SERVICES::GetProcIddMax怎么用?C++ CPU_SPECIFIC_SERVICES::GetProcIddMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPU_SPECIFIC_SERVICES的用法示例。


在下文中一共展示了CPU_SPECIFIC_SERVICES::GetProcIddMax方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetCpuServicesOfCurrentCore

/**
 * 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
F15CzInitializePsi (
  IN       PSI_FAMILY_SERVICES    *PsiServices,
  IN       UINT64                  EntryPoint,
  IN       PLATFORM_CONFIGURATION *PlatformConfig,
  IN       AMD_CONFIG_PARAMS      *StdHeader
  )
{
  PCI_ADDR                              PciAddress;
  CPU_SPECIFIC_SERVICES                 *FamilySpecificServices;
  UINT32                                HwPstateMaxVal;
  F15_CZ_CLK_PWR_TIMING_CTRL2_REGISTER  ClkPwrTimingCtrl2;
  UINT32                                CoreVrmLowPowerThreshold;
  UINT32                                Pstate;
  UINT32                                PstateCurrent;
  UINT32                                NextPstateCurrent;
  PSTATE_MSR                            PstateMsr;
  UINT32                                CurrentVid;
  UINT32                                PreviousVid;
  NB_PSTATE_REGISTER                    NbPstateReg;
  NB_PSTATE_CTRL_REGISTER               NbPsCtrl;
  UINT32                                NbVrmLowPowerThreshold;
  UINT32                                NbPstate;
  UINT32                                NbPstateMaxVal;
  UINT32                                NbPstateCurrent;
  UINT32                                NextNbPstateCurrent;
  UINT32                                PreviousNbVid;
  UINT32                                CurrentNbVid;
  SMUSVI_MISC_VID_STATUS_REGISTER       SmuSviMiscVidStatus;
  SMUSVI_POWER_CONTROL_MISC_REGISTER    SmuSviPowerCtrlMisc;

  if ((EntryPoint & (CPU_FEAT_AFTER_POST_MTRR_SYNC | CPU_FEAT_AFTER_RESUME_MTRR_SYNC)) != 0) {
    // Configure PsiVid
    GetCpuServicesOfCurrentCore ((CONST CPU_SPECIFIC_SERVICES **) &FamilySpecificServices, StdHeader);

    IDS_HDT_CONSOLE (CPU_TRACE, "  F15CzPmVrmLowPowerModeEnable\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;

      PciAddress.AddressValue = CPTC2_PCI_ADDR;
      LibAmdPciRead (AccessWidth32, PciAddress, &ClkPwrTimingCtrl2, StdHeader);
      HwPstateMaxVal = ClkPwrTimingCtrl2.HwPstateMaxVal;

      IDS_HDT_CONSOLE (CPU_TRACE, "    HwPstateMaxVal %d\n", HwPstateMaxVal);
      for (Pstate = 0; Pstate <= HwPstateMaxVal; Pstate++) {
        // Check only valid P-state
        if (FamilySpecificServices->GetProcIddMax (FamilySpecificServices, (UINT8) Pstate, &PstateCurrent, StdHeader) != TRUE) {
          continue;
        }

        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
          if (FamilySpecificServices->GetProcIddMax (FamilySpecificServices, (UINT8) (Pstate + 1), &NextPstateCurrent, StdHeader) != TRUE) {
            continue;
          }
        }

        if ((PstateCurrent <= CoreVrmLowPowerThreshold) &&
            (NextPstateCurrent <= CoreVrmLowPowerThreshold) &&
            (CurrentVid != PreviousVid)) {
          // Program PsiVid and PsiVidEn if PSI state is found and stop searching.
          GnbLibPciIndirectRead (MAKE_SBDFO (0, 0, 0, 0, 0xB8), SMUSVI_POWER_CONTROL_MISC, AccessWidth32, &SmuSviPowerCtrlMisc, StdHeader);
          SmuSviPowerCtrlMisc.PSIVID = CurrentVid;
          SmuSviPowerCtrlMisc.PSIVIDEN = 1;
          GnbLibPciIndirectWrite (MAKE_SBDFO (0, 0, 0, 0, 0xB8), SMUSVI_POWER_CONTROL_MISC, AccessWidth32, &SmuSviPowerCtrlMisc, StdHeader);

          IDS_HDT_CONSOLE (CPU_TRACE, "    PsiVid is enabled at P-state %d. PsiVid: %d\n", Pstate, CurrentVid);
          break;
        } else {
          PreviousVid = CurrentVid;
        }
      }
    }

    if (PlatformConfig->VrmProperties[NbVrm].LowPowerThreshold != 0) {
      // Set up NBPSI0_L for VDDNB
      NbVrmLowPowerThreshold = PlatformConfig->VrmProperties[NbVrm].LowPowerThreshold;
//.........这里部分代码省略.........
开发者ID:fishbaoz,项目名称:CarrizoPI,代码行数:101,代码来源:cpuF15CzPsi.c


注:本文中的CPU_SPECIFIC_SERVICES::GetProcIddMax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。