Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpica/acpi_cpu.c
Show All 12 Lines | |||||
/* Assume we won't be using generic Cx mode by default */ | /* Assume we won't be using generic Cx mode by default */ | ||||
cpu_cx_generic = FALSE; | cpu_cx_generic = FALSE; | ||||
/* Install hw.acpi.cpu sysctl tree */ | /* Install hw.acpi.cpu sysctl tree */ | ||||
acpi_sc = acpi_device_get_parent_softc(dev); | acpi_sc = acpi_device_get_parent_softc(dev); | ||||
sysctl_ctx_init(&cpu_sysctl_ctx); | sysctl_ctx_init(&cpu_sysctl_ctx); | ||||
cpu_sysctl_tree = SYSCTL_ADD_NODE(&cpu_sysctl_ctx, | cpu_sysctl_tree = SYSCTL_ADD_NODE(&cpu_sysctl_ctx, | ||||
SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO, "cpu", | SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO, "cpu", | ||||
CTLFLAG_RD, 0, "node for CPU children"); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "node for CPU children"); | ||||
} | } | ||||
/* | /* | ||||
* Before calling any CPU methods, collect child driver feature hints | * Before calling any CPU methods, collect child driver feature hints | ||||
* and notify ACPI of them. We support unified SMP power control | * and notify ACPI of them. We support unified SMP power control | ||||
* so advertise this ourselves. Note this is not the same as independent | * so advertise this ourselves. Note this is not the same as independent | ||||
* SMP control where each CPU can have different settings. | * SMP control where each CPU can have different settings. | ||||
*/ | */ | ||||
Show All 24 Lines | |||||
/* Perform Cx final initialization. */ | /* Perform Cx final initialization. */ | ||||
for (i = 0; i < cpu_ndevices; i++) { | for (i = 0; i < cpu_ndevices; i++) { | ||||
sc = device_get_softc(cpu_devices[i]); | sc = device_get_softc(cpu_devices[i]); | ||||
acpi_cpu_startup_cx(sc); | acpi_cpu_startup_cx(sc); | ||||
} | } | ||||
/* Add a sysctl handler to handle global Cx lowest setting */ | /* Add a sysctl handler to handle global Cx lowest setting */ | ||||
SYSCTL_ADD_PROC(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cpu_sysctl_tree), | SYSCTL_ADD_PROC(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cpu_sysctl_tree), | ||||
OID_AUTO, "cx_lowest", CTLTYPE_STRING | CTLFLAG_RW, | OID_AUTO, "cx_lowest", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | ||||
NULL, 0, acpi_cpu_global_cx_lowest_sysctl, "A", | NULL, 0, acpi_cpu_global_cx_lowest_sysctl, "A", | ||||
"Global lowest Cx sleep state to use"); | "Global lowest Cx sleep state to use"); | ||||
/* Take over idling from cpu_idle_default(). */ | /* Take over idling from cpu_idle_default(). */ | ||||
cpu_cx_lowest_lim = 0; | cpu_cx_lowest_lim = 0; | ||||
for (i = 0; i < cpu_ndevices; i++) { | for (i = 0; i < cpu_ndevices; i++) { | ||||
sc = device_get_softc(cpu_devices[i]); | sc = device_get_softc(cpu_devices[i]); | ||||
enable_idle(sc); | enable_idle(sc); | ||||
Show All 24 Lines | |||||
acpi_cpu_cx_list(sc); | acpi_cpu_cx_list(sc); | ||||
SYSCTL_ADD_STRING(&sc->cpu_sysctl_ctx, | SYSCTL_ADD_STRING(&sc->cpu_sysctl_ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), | ||||
OID_AUTO, "cx_supported", CTLFLAG_RD, | OID_AUTO, "cx_supported", CTLFLAG_RD, | ||||
sc->cpu_cx_supported, 0, | sc->cpu_cx_supported, 0, | ||||
"Cx/microsecond values for supported Cx states"); | "Cx/microsecond values for supported Cx states"); | ||||
SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), OID_AUTO, | ||||
OID_AUTO, "cx_lowest", CTLTYPE_STRING | CTLFLAG_RW, | "cx_lowest", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | ||||
(void *)sc, 0, acpi_cpu_cx_lowest_sysctl, "A", | (void *)sc, 0, acpi_cpu_cx_lowest_sysctl, "A", | ||||
"lowest Cx sleep state to use"); | "lowest Cx sleep state to use"); | ||||
SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), OID_AUTO, | ||||
OID_AUTO, "cx_usage", CTLTYPE_STRING | CTLFLAG_RD, | "cx_usage", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | ||||
(void *)sc, 0, acpi_cpu_usage_sysctl, "A", | (void *)sc, 0, acpi_cpu_usage_sysctl, "A", | ||||
"percent usage for each Cx state"); | "percent usage for each Cx state"); | ||||
SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), OID_AUTO, | ||||
OID_AUTO, "cx_usage_counters", CTLTYPE_STRING | CTLFLAG_RD, | "cx_usage_counters", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | ||||
(void *)sc, 0, acpi_cpu_usage_counters_sysctl, "A", | (void *)sc, 0, acpi_cpu_usage_counters_sysctl, "A", | ||||
"Cx sleep state counters"); | "Cx sleep state counters"); | ||||
#if defined(__i386__) || defined(__amd64__) | #if defined(__i386__) || defined(__amd64__) | ||||
SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | SYSCTL_ADD_PROC(&sc->cpu_sysctl_ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(sc->cpu_dev)), OID_AUTO, | ||||
OID_AUTO, "cx_method", CTLTYPE_STRING | CTLFLAG_RD, | "cx_method", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | ||||
(void *)sc, 0, acpi_cpu_method_sysctl, "A", | (void *)sc, 0, acpi_cpu_method_sysctl, "A", "Cx entrance methods"); | ||||
"Cx entrance methods"); | |||||
#endif | #endif | ||||
/* Signal platform that we can handle _CST notification. */ | /* Signal platform that we can handle _CST notification. */ | ||||
if (!cpu_cx_generic && cpu_cst_cnt != 0) { | if (!cpu_cx_generic && cpu_cst_cnt != 0) { | ||||
ACPI_LOCK(acpi); | ACPI_LOCK(acpi); | ||||
AcpiOsWritePort(cpu_smi_cmd, cpu_cst_cnt, 8); | AcpiOsWritePort(cpu_smi_cmd, cpu_cst_cnt, 8); | ||||
ACPI_UNLOCK(acpi); | ACPI_UNLOCK(acpi); | ||||
} | } | ||||
Show All 12 Lines |