| 952 | } |
| 953 | |
| 954 | static int |
| 955 | est_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 | |
| 994 | static int |
| 995 | est_attach(device_t dev) |
nothing calls this directly
no test coverage detected