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

Function intel_hwpstate_attach

freebsd/x86/cpufreq/hwpstate_intel.c:478–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478static int
479intel_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
523static int
524intel_hwpstate_detach(device_t dev)

Callers

nothing calls this directly

Calls 6

device_get_softcFunction · 0.85
set_autonomous_hwpFunction · 0.85
device_get_sysctl_ctxFunction · 0.85
device_get_nameunitFunction · 0.85
device_get_sysctl_treeFunction · 0.85
cpufreq_registerFunction · 0.85

Tested by

no test coverage detected