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.
This commit is contained in:
Nate Lawson 2005-02-06 20:12:28 +00:00
parent 2c42caf7f0
commit 3cc2f17689
2 changed files with 15 additions and 11 deletions

View File

@ -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);

View File

@ -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);
}
@ -303,6 +304,18 @@ acpi_perf_evaluate(device_t dev)
return (error);
}
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)
{