summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_perf.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-02-06 20:12:28 +0000
committernjl <njl@FreeBSD.org>2005-02-06 20:12:28 +0000
commit5f0a1215d90b8d94de3264169b9f4c488d29722a (patch)
treece6decbb475d9d60779f95f7e9d21f004144719e /sys/dev/acpica/acpi_perf.c
parent27c3b2cdeb8767d1005014d7133f28c7aa82ed54 (diff)
downloadFreeBSD-src-5f0a1215d90b8d94de3264169b9f4c488d29722a.zip
FreeBSD-src-5f0a1215d90b8d94de3264169b9f4c488d29722a.tar.gz
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.
Diffstat (limited to 'sys/dev/acpica/acpi_perf.c')
-rw-r--r--sys/dev/acpica/acpi_perf.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c
index c1ee05b..b8cd3d7 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;
OpenPOWER on IntegriCloud