aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNate Lawson <njl@FreeBSD.org>2005-02-06 20:12:28 +0000
committerNate Lawson <njl@FreeBSD.org>2005-02-06 20:12:28 +0000
commit3cc2f176899f6d29dda30ed29baa5835553fd7b9 (patch)
treece6decbb475d9d60779f95f7e9d21f004144719e /sys
parent2c42caf7f06f54b0263c021f09d3d8768c8734f9 (diff)
downloadsrc-3cc2f176899f6d29dda30ed29baa5835553fd7b9.tar.gz
src-3cc2f176899f6d29dda30ed29baa5835553fd7b9.zip
Notify the OS that we're taking over Px states in acpi_perf(4) instead of
doing it in the cpu driver. The previous code was incorrect anyway since this value controls Px states, not throttling as the comment said. Since we didn't support Px states before, there was no impact. Also, note that we delay the write to SMI_CMD until after booting is complete since it sometimes triggers a change in the frequency and we want to have all drivers ready to detect/handle this.
Notes
Notes: svn path=/head/; revision=141411
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpica/acpi_cpu.c9
-rw-r--r--sys/dev/acpica/acpi_perf.c17
2 files changed, 15 insertions, 11 deletions
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 22d58cf11217..7780ed7525ec 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -124,7 +124,6 @@ static uint32_t cpu_duty_width;
/* Platform hardware resource information. */
static uint32_t cpu_smi_cmd; /* Value to write to SMI_CMD. */
-static uint8_t cpu_pstate_cnt;/* Register to take over throttling. */
static uint8_t cpu_cst_cnt; /* Indicate we are _CST aware. */
static int cpu_rid; /* Driver-wide resource id. */
static int cpu_quirks; /* Indicate any hardware bugs. */
@@ -469,7 +468,6 @@ acpi_cpu_throttle_probe(struct acpi_cpu_softc *sc)
/* Get throttling parameters from the FADT. 0 means not supported. */
if (device_get_unit(sc->cpu_dev) == 0) {
cpu_smi_cmd = AcpiGbl_FADT->SmiCmd;
- cpu_pstate_cnt = AcpiGbl_FADT->PstateCnt;
cpu_cst_cnt = AcpiGbl_FADT->CstCnt;
cpu_duty_offset = AcpiGbl_FADT->DutyOffset;
cpu_duty_width = AcpiGbl_FADT->DutyWidth;
@@ -812,13 +810,6 @@ acpi_cpu_startup_throttling()
CTLTYPE_INT | CTLFLAG_RW, &cpu_throttle_state,
0, acpi_cpu_throttle_sysctl, "I", "current CPU speed");
- /* If ACPI 2.0+, signal platform that we are taking over throttling. */
- if (cpu_pstate_cnt != 0) {
- ACPI_LOCK(acpi);
- AcpiOsWritePort(cpu_smi_cmd, cpu_pstate_cnt, 8);
- ACPI_UNLOCK(acpi);
- }
-
/* Set initial speed to maximum. */
ACPI_SERIAL_BEGIN(cpu);
acpi_cpu_throttle_set(cpu_throttle_max);
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c
index c1ee05bb97fd..b8cd3d7cd4f8 100644
--- a/sys/dev/acpica/acpi_perf.c
+++ b/sys/dev/acpica/acpi_perf.c
@@ -95,6 +95,7 @@ static int acpi_perf_evaluate(device_t dev);
static int acpi_px_to_set(device_t dev, struct acpi_px *px,
struct cf_setting *set);
static void acpi_px_available(struct acpi_perf_softc *sc);
+static void acpi_px_startup(void *arg);
static void acpi_px_notify(ACPI_HANDLE h, UINT32 notify, void *context);
static int acpi_px_settings(device_t dev, struct cf_setting *sets,
int *count, int *type);
@@ -130,7 +131,6 @@ MALLOC_DEFINE(M_ACPIPERF, "acpi_perf", "ACPI Performance states");
static void
acpi_perf_identify(driver_t *driver, device_t parent)
{
- device_t child;
ACPI_HANDLE handle;
/* Make sure we're not being doubly invoked. */
@@ -143,7 +143,7 @@ acpi_perf_identify(driver_t *driver, device_t parent)
return;
if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_PSS", NULL, NULL)))
return;
- if ((child = BUS_ADD_CHILD(parent, 0, "acpi_perf", 0)) == NULL)
+ if (BUS_ADD_CHILD(parent, 0, "acpi_perf", 0) == NULL)
device_printf(parent, "acpi_perf: add child failed\n");
}
@@ -194,6 +194,7 @@ acpi_perf_attach(device_t dev)
if (acpi_perf_evaluate(dev) != 0)
return (ENXIO);
cpufreq_register(dev);
+ AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_px_startup, NULL);
return (0);
}
@@ -304,6 +305,18 @@ out:
}
static void
+acpi_px_startup(void *arg)
+{
+
+ /* Signal to the platform that we are taking over CPU control. */
+ if (AcpiGbl_FADT->PstateCnt == 0)
+ return;
+ ACPI_LOCK(acpi);
+ AcpiOsWritePort(AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->PstateCnt, 8);
+ ACPI_UNLOCK(acpi);
+}
+
+static void
acpi_px_notify(ACPI_HANDLE h, UINT32 notify, void *context)
{
struct acpi_perf_softc *sc;