@@ -7118,9 +7118,40 @@ long ClockMod_Intel_HWP(CLOCK_ARG *pClockMod)
71187118 }
71197119}
71207120
7121+
7122+ void AMD_Watchdog (CORE_RO * Core )
7123+ { /* CPU Watchdog Timer. */
7124+ if ((Core -> T .ThreadID == 0 ) || (Core -> T .ThreadID == -1 ))
7125+ {
7126+ AMD_CPU_WDT_CFG CPU_WDT_CFG = {.value = 0 };
7127+ RDMSR (CPU_WDT_CFG , MSR_AMD_CPU_WDT_CFG );
7128+
7129+ switch (WDT_Enable ) {
7130+ case COREFREQ_TOGGLE_OFF :
7131+ case COREFREQ_TOGGLE_ON :
7132+ CPU_WDT_CFG .TmrCfgEn = WDT_Enable ;
7133+ WRMSR (CPU_WDT_CFG , MSR_AMD_CPU_WDT_CFG );
7134+ RDMSR (CPU_WDT_CFG , MSR_AMD_CPU_WDT_CFG );
7135+ break ;
7136+ }
7137+ if (CPU_WDT_CFG .TmrCfgEn ) {
7138+ BITSET_CC (LOCKLESS , PUBLIC (RW (Proc ))-> WDT , Core -> Bind );
7139+ } else {
7140+ BITCLR_CC (LOCKLESS , PUBLIC (RW (Proc ))-> WDT , Core -> Bind );
7141+ }
7142+ BITSET_CC (LOCKLESS , PUBLIC (RO (Proc ))-> WDT_Mask , Core -> Bind );
7143+ }
7144+ }
7145+
7146+ void PerCore_AMD_CState_BAR (CORE_RO * Core )
7147+ { /* Families: 10h, 12h, 14h, 15h, 16h, 17h: I/O C-State Base Address. */
7148+ CSTATE_BASE_ADDR CStateBaseAddr = {.value = 0 };
7149+ RDMSR (CStateBaseAddr , MSR_AMD_CSTATE_BAR );
7150+ Core -> Query .CStateBaseAddr = CStateBaseAddr .IOaddr ;
7151+ }
7152+
71217153void PerCore_Query_AMD_Zen_Features (CORE_RO * Core ) /* Per SMT */
71227154{
7123- CSTATE_BASE_ADDR CStateBaseAddr = {.value = 0 };
71247155 unsigned long long CC6 = 0 , PC6 = 0 ;
71257156 int ToggleFeature ;
71267157
@@ -7242,33 +7273,13 @@ void PerCore_Query_AMD_Zen_Features(CORE_RO *Core) /* Per SMT */
72427273 }
72437274 }
72447275 /* SMT C-State Base Address. */
7245- RDMSR (CStateBaseAddr , MSR_AMD_CSTATE_BAR );
7246- Core -> Query .CStateBaseAddr = CStateBaseAddr .IOaddr ;
7276+ PerCore_AMD_CState_BAR (Core );
72477277 /* Package C-State: Configuration Control . */
72487278 Core -> Query .CfgLock = 1 ;
72497279 /* Package C-State: I/O MWAIT Redirection . */
72507280 Core -> Query .IORedir = 0 ;
7251- /* CPU Watchdog Timer. */
7252- if ((Core -> T .ThreadID == 0 ) || (Core -> T .ThreadID == -1 ))
7253- {
7254- AMD_CPU_WDT_CFG CPU_WDT_CFG = {.value = 0 };
7255- RDMSR (CPU_WDT_CFG , MSR_AMD_CPU_WDT_CFG );
72567281
7257- switch (WDT_Enable ) {
7258- case COREFREQ_TOGGLE_OFF :
7259- case COREFREQ_TOGGLE_ON :
7260- CPU_WDT_CFG .TmrCfgEn = WDT_Enable ;
7261- WRMSR (CPU_WDT_CFG , MSR_AMD_CPU_WDT_CFG );
7262- RDMSR (CPU_WDT_CFG , MSR_AMD_CPU_WDT_CFG );
7263- break ;
7264- }
7265- if (CPU_WDT_CFG .TmrCfgEn ) {
7266- BITSET_CC (LOCKLESS , PUBLIC (RW (Proc ))-> WDT , Core -> Bind );
7267- } else {
7268- BITCLR_CC (LOCKLESS , PUBLIC (RW (Proc ))-> WDT , Core -> Bind );
7269- }
7270- BITSET_CC (LOCKLESS , PUBLIC (RO (Proc ))-> WDT_Mask , Core -> Bind );
7271- }
7282+ AMD_Watchdog (Core );
72727283}
72737284
72747285void Intel_Watchdog (CORE_RO * Core )
@@ -9666,6 +9677,7 @@ static void PerCore_AMD_Family_Same_Query(void *arg)
96669677 } else {
96679678 BITSET_CC (LOCKLESS , PUBLIC (RO (Proc ))-> C1E_Mask , Core -> Bind );
96689679 }
9680+
96699681 BITSET_CC (LOCKLESS , PUBLIC (RO (Proc ))-> ODCM_Mask , Core -> Bind );
96709682 BITSET_CC (LOCKLESS , PUBLIC (RO (Proc ))-> PowerMgmt_Mask , Core -> Bind );
96719683 BITSET_CC (LOCKLESS , PUBLIC (RO (Proc ))-> SpeedStep_Mask , Core -> Bind );
@@ -9690,6 +9702,8 @@ static void PerCore_AMD_Family_10h_Query(void *arg)
96909702
96919703 Compute_AMD_Family_10h_Boost (Core -> Bind );
96929704 PerCore_AMD_Family_Same_Query (Core );
9705+ /*TODO(Errata 438) PerCore_AMD_CState_BAR(Core); */
9706+ AMD_Watchdog (Core );
96939707}
96949708
96959709static void PerCore_AMD_Family_11h_Query (void * arg )
@@ -9698,6 +9712,8 @@ static void PerCore_AMD_Family_11h_Query(void *arg)
96989712
96999713 Compute_AMD_Family_11h_Boost (Core -> Bind );
97009714 PerCore_AMD_Family_Same_Query (Core );
9715+ /*TODO(Unspecified) PerCore_AMD_CState_BAR(Core); */
9716+ /*TODO(Watchdog): D18F3x{40,44} MCA NB Registers - Hardware needed */
97019717}
97029718
97039719static void PerCore_AMD_Family_12h_Query (void * arg )
@@ -9706,6 +9722,8 @@ static void PerCore_AMD_Family_12h_Query(void *arg)
97069722
97079723 Compute_AMD_Family_12h_Boost (Core -> Bind );
97089724 PerCore_AMD_Family_Same_Query (Core );
9725+ PerCore_AMD_CState_BAR (Core );
9726+ AMD_Watchdog (Core );
97099727}
97109728
97119729static void PerCore_AMD_Family_14h_Query (void * arg )
@@ -9714,6 +9732,8 @@ static void PerCore_AMD_Family_14h_Query(void *arg)
97149732
97159733 Compute_AMD_Family_14h_Boost (Core -> Bind );
97169734 PerCore_AMD_Family_Same_Query (Core );
9735+ PerCore_AMD_CState_BAR (Core );
9736+ AMD_Watchdog (Core );
97179737}
97189738
97199739static void PerCore_AMD_Family_15h_Query (void * arg )
@@ -9722,6 +9742,33 @@ static void PerCore_AMD_Family_15h_Query(void *arg)
97229742
97239743 Compute_AMD_Family_15h_Boost (Core -> Bind );
97249744 PerCore_AMD_Family_Same_Query (Core );
9745+ PerCore_AMD_CState_BAR (Core );
9746+
9747+ switch (PUBLIC (RO (Proc ))-> Features .Std .EAX .ExtModel ) {
9748+ case 0x0 :
9749+ case 0x1 :
9750+ /*TODO(Watchdog): D18F3x{40,44} MCA NB Registers - Hardware needed */
9751+ break ;
9752+ case 0x3 :
9753+ case 0x6 :
9754+ case 0x7 :
9755+ if ((PUBLIC (RO (Proc ))-> Features .Std .EAX .Model >= 0x0 )
9756+ && (PUBLIC (RO (Proc ))-> Features .Std .EAX .Model <= 0xf ))
9757+ {
9758+ AMD_Watchdog (Core );
9759+ }
9760+ break ;
9761+ }
9762+ }
9763+
9764+ static void PerCore_AMD_Family_16h_Query (void * arg )
9765+ {
9766+ CORE_RO * Core = (CORE_RO * ) arg ;
9767+
9768+ Compute_AMD_Family_15h_Boost (Core -> Bind );
9769+ PerCore_AMD_Family_Same_Query (Core );
9770+ PerCore_AMD_CState_BAR (Core );
9771+ AMD_Watchdog (Core );
97259772}
97269773
97279774static void PerCore_AMD_Family_17h_Query (void * arg )
0 commit comments