MCPcopy Create free account
hub / github.com/F-Stack/f-stack / est_probe

Function est_probe

freebsd/x86/cpufreq/est.c:954–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

952}
953
954static int
955est_probe(device_t dev)
956{
957 device_t perf_dev;
958 uint64_t msr;
959 int error, type;
960
961 if (resource_disabled("est", 0))
962 return (ENXIO);
963
964 /*
965 * If the ACPI perf driver has attached and is not just offering
966 * info, let it manage things.
967 */
968 perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1);
969 if (perf_dev && device_is_attached(perf_dev)) {
970 error = CPUFREQ_DRV_TYPE(perf_dev, &type);
971 if (error == 0 && (type & CPUFREQ_FLAG_INFO_ONLY) == 0)
972 return (ENXIO);
973 }
974
975 /* Attempt to enable SpeedStep if not currently enabled. */
976 msr = rdmsr(MSR_MISC_ENABLE);
977 if ((msr & MSR_SS_ENABLE) == 0) {
978 wrmsr(MSR_MISC_ENABLE, msr | MSR_SS_ENABLE);
979 if (bootverbose)
980 device_printf(dev, "enabling SpeedStep\n");
981
982 /* Check if the enable failed. */
983 msr = rdmsr(MSR_MISC_ENABLE);
984 if ((msr & MSR_SS_ENABLE) == 0) {
985 device_printf(dev, "failed to enable SpeedStep\n");
986 return (ENXIO);
987 }
988 }
989
990 device_set_desc(dev, "Enhanced SpeedStep Frequency Control");
991 return (0);
992}
993
994static int
995est_attach(device_t dev)

Callers

nothing calls this directly

Calls 8

resource_disabledFunction · 0.85
device_find_childFunction · 0.85
device_get_parentFunction · 0.85
device_is_attachedFunction · 0.85
device_printfFunction · 0.85
device_set_descFunction · 0.85
rdmsrFunction · 0.50
wrmsrFunction · 0.50

Tested by

no test coverage detected