intel_hwpstate(4): Use identcpu-cached cpuid 6 leaf

No functional change.
This commit is contained in:
Conrad Meyer 2020-02-01 17:54:46 +00:00
parent 351896d372
commit f591c3c847
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357373

View File

@ -266,8 +266,6 @@ sysctl_epp_select(SYSCTL_HANDLER_ARGS)
void
intel_hwpstate_identify(driver_t *driver, device_t parent)
{
uint32_t regs[4];
if (device_find_child(parent, "hwpstate_intel", -1) != NULL)
return;
@ -277,17 +275,6 @@ intel_hwpstate_identify(driver_t *driver, device_t parent)
if (resource_disabled("hwpstate_intel", 0))
return;
/*
* Intel SDM 14.4.1 (HWP Programming Interfaces):
* The CPUID instruction allows software to discover the presence of
* HWP support in an Intel processor. Specifically, execute CPUID
* instruction with EAX=06H as input will return 5 bit flags covering
* the following aspects in bits 7 through 11 of CPUID.06H:EAX.
*/
if (cpu_high < 6)
return;
/*
* Intel SDM 14.4.1 (HWP Programming Interfaces):
* Availability of HWP baseline resource and capability,
@ -295,9 +282,7 @@ intel_hwpstate_identify(driver_t *driver, device_t parent)
* architectural MSRs: IA32_PM_ENABLE, IA32_HWP_CAPABILITIES,
* IA32_HWP_REQUEST, IA32_HWP_STATUS.
*/
do_cpuid(6, regs);
if ((regs[0] & CPUTPM1_HWP) == 0)
if ((cpu_power_eax & CPUTPM1_HWP) == 0)
return;
if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", -1) == NULL)
@ -396,20 +381,18 @@ static int
intel_hwpstate_attach(device_t dev)
{
struct hwp_softc *sc;
uint32_t regs[4];
int ret;
sc = device_get_softc(dev);
sc->dev = dev;
do_cpuid(6, regs);
if (regs[0] & CPUTPM1_HWP_NOTIFICATION)
if (cpu_power_eax & CPUTPM1_HWP_NOTIFICATION)
sc->hwp_notifications = true;
if (regs[0] & CPUTPM1_HWP_ACTIVITY_WINDOW)
if (cpu_power_eax & CPUTPM1_HWP_ACTIVITY_WINDOW)
sc->hwp_activity_window = true;
if (regs[0] & CPUTPM1_HWP_PERF_PREF)
if (cpu_power_eax & CPUTPM1_HWP_PERF_PREF)
sc->hwp_pref_ctrl = true;
if (regs[0] & CPUTPM1_HWP_PKG)
if (cpu_power_eax & CPUTPM1_HWP_PKG)
sc->hwp_pkg_ctrl = true;
ret = set_autonomous_hwp(sc);