summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-12-03 20:27:48 +0000
committerjhb <jhb@FreeBSD.org>2003-12-03 20:27:48 +0000
commit60c6b104ef24df5d0b2934e5d6b0781a62bdab81 (patch)
tree656498fa265fe81926bc709ec40284637b5908f0 /sys/dev/acpica
parent91ba98c804629e05715a0f7ec18eeaa8b2f10e0a (diff)
downloadFreeBSD-src-60c6b104ef24df5d0b2934e5d6b0781a62bdab81.zip
FreeBSD-src-60c6b104ef24df5d0b2934e5d6b0781a62bdab81.tar.gz
Update this driver to be more module friendly:
- Dynamically allocate the cpu_softc[] array based on mp_maxid instead of using a statically sized array that depended on 'options SMP'. - Use mp_maxid rather than MAXCPU when walking all the CPUs looking for a match. - Always call smp_rendezvous() since UP kernels now provide this. - Use mp_ncpus rather than cpu_ndevices when determining if we need to disable C3 for SMP machines. Approved by: re (rwatson) Reviewed by: njl
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi_cpu.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 0d3a4ac..a318ffc 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/malloc.h>
#include <sys/pcpu.h>
#include <sys/power.h>
#include <sys/proc.h>
@@ -142,7 +143,7 @@ static char cpu_cx_supported[64];
static device_t *cpu_devices;
static int cpu_ndevices;
-static struct acpi_cpu_softc *cpu_softc[MAXCPU];
+static struct acpi_cpu_softc **cpu_softc;
static struct sysctl_ctx_list acpi_cpu_sysctl_ctx;
static struct sysctl_oid *acpi_cpu_sysctl_tree;
@@ -192,6 +193,9 @@ acpi_cpu_probe(device_t dev)
{
if (!acpi_disabled("cpu") && acpi_get_type(dev) == ACPI_TYPE_PROCESSOR) {
device_set_desc(dev, "CPU");
+ if (cpu_softc == NULL)
+ cpu_softc = malloc(sizeof(struct acpi_cpu_softc *) *
+ (mp_maxid + 1), M_TEMP /* XXX */, M_WAITOK | M_ZERO);
return (0);
}
@@ -300,7 +304,7 @@ acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id, uint32_t *cpu_id)
KASSERT(acpi_id != NULL, ("Null acpi_id"));
KASSERT(cpu_id != NULL, ("Null cpu_id"));
- for (i = 0; i < MAXCPU; i++) {
+ for (i = 0; i <= mp_maxid; i++) {
if (CPU_ABSENT(i))
continue;
pcpu_data = pcpu_find(i);
@@ -332,10 +336,8 @@ acpi_cpu_shutdown(device_t dev)
/* Disable any entry to the idle function. */
cpu_cx_count = 0;
-#ifdef SMP
/* Wait for all processors to exit acpi_cpu_idle(). */
smp_rendezvous(NULL, NULL, NULL, NULL);
-#endif
while (cpu_idle_busy > 0)
DELAY(1);
@@ -986,7 +988,7 @@ acpi_cpu_quirks(struct acpi_cpu_softc *sc)
* C3 is not supported on multiple CPUs since this would require
* flushing all caches which is currently too expensive.
*/
- if (cpu_ndevices > 1)
+ if (mp_ncpus > 1)
cpu_quirks |= CPU_QUIRK_NO_C3;
#ifdef notyet
OpenPOWER on IntegriCloud