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


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

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


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

示例1: GetCpuServicesOfCurrentCore


//.........这里部分代码省略.........

    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;
      IDS_HDT_CONSOLE (CPU_TRACE, "    NB VRM - LowPowerThreshold: %d\n", NbVrmLowPowerThreshold);
      PreviousNbVid = 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) GetF15CzNbVid (&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.
          GnbLibPciIndirectRead (MAKE_SBDFO (0, 0, 0, 0, 0xB8), SMUSVI_MISC_VID_STATUS, AccessWidth32, &SmuSviMiscVidStatus, StdHeader);
          SmuSviMiscVidStatus.NB_PSI_VID = CurrentNbVid;
          SmuSviMiscVidStatus.NB_PSI_VID_EN = 1;
          GnbLibPciIndirectWrite (MAKE_SBDFO (0, 0, 0, 0, 0xB8), SMUSVI_MISC_VID_STATUS, AccessWidth32, &SmuSviMiscVidStatus, StdHeader);

          IDS_HDT_CONSOLE (CPU_TRACE, "    NbPsi0Vid is enabled at NB P-state %d. NbPsi0Vid: %d\n", NbPstate, CurrentNbVid);
          break;
        } else {
          PreviousNbVid = CurrentNbVid;
        }
      }
    }
  }

  return AGESA_SUCCESS;
}
开发者ID:fishbaoz,项目名称:CarrizoPI,代码行数:101,代码来源:cpuF15CzPsi.c


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