| 476 | } |
| 477 | |
| 478 | static int |
| 479 | intel_hwpstate_attach(device_t dev) |
| 480 | { |
| 481 | struct hwp_softc *sc; |
| 482 | int ret; |
| 483 | |
| 484 | sc = device_get_softc(dev); |
| 485 | sc->dev = dev; |
| 486 | |
| 487 | /* eax */ |
| 488 | if (cpu_power_eax & CPUTPM1_HWP_NOTIFICATION) |
| 489 | sc->hwp_notifications = true; |
| 490 | if (cpu_power_eax & CPUTPM1_HWP_ACTIVITY_WINDOW) |
| 491 | sc->hwp_activity_window = true; |
| 492 | if (cpu_power_eax & CPUTPM1_HWP_PERF_PREF) |
| 493 | sc->hwp_pref_ctrl = true; |
| 494 | if (cpu_power_eax & CPUTPM1_HWP_PKG) |
| 495 | sc->hwp_pkg_ctrl = true; |
| 496 | |
| 497 | /* Allow administrators to disable pkg-level control. */ |
| 498 | sc->hwp_pkg_ctrl_en = (sc->hwp_pkg_ctrl && hwpstate_pkg_ctrl_enable); |
| 499 | |
| 500 | /* ecx */ |
| 501 | if (cpu_power_ecx & CPUID_PERF_BIAS) |
| 502 | sc->hwp_perf_bias = true; |
| 503 | |
| 504 | ret = set_autonomous_hwp(sc); |
| 505 | if (ret) |
| 506 | return (ret); |
| 507 | |
| 508 | SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), |
| 509 | SYSCTL_STATIC_CHILDREN(_debug), OID_AUTO, device_get_nameunit(dev), |
| 510 | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_NEEDGIANT, |
| 511 | sc, 0, intel_hwp_dump_sysctl_handler, "A", ""); |
| 512 | |
| 513 | SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), |
| 514 | SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, |
| 515 | "epp", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, dev, 0, |
| 516 | sysctl_epp_select, "I", |
| 517 | "Efficiency/Performance Preference " |
| 518 | "(range from 0, most performant, through 100, most efficient)"); |
| 519 | |
| 520 | return (cpufreq_register(dev)); |
| 521 | } |
| 522 | |
| 523 | static int |
| 524 | intel_hwpstate_detach(device_t dev) |
nothing calls this directly
no test coverage detected