summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-03-28 18:53:48 +0000
committerjhb <jhb@FreeBSD.org>2012-03-28 18:53:48 +0000
commit08f2264a84a9746776454c5bec660b03744b88c8 (patch)
treedfa1f0e19a8bc2e78add51b8b601e8b6c14a2548
parenta95c98845608b765a2471a2465314c453fbca532 (diff)
downloadFreeBSD-src-08f2264a84a9746776454c5bec660b03744b88c8.zip
FreeBSD-src-08f2264a84a9746776454c5bec660b03744b88c8.tar.gz
Allocate the ioapics[] array dynamically since it is only needed for the
duration of madt_setup_io(). This avoids having the array take up permanent space in the BSS. Inspired by: bde MFC after: 2 weeks
-rw-r--r--sys/x86/acpica/madt.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c
index b67b481..66af032 100644
--- a/sys/x86/acpica/madt.c
+++ b/sys/x86/acpica/madt.c
@@ -50,15 +50,15 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
/* These two arrays are indexed by APIC IDs. */
-struct ioapic_info {
+static struct {
void *io_apic;
UINT32 io_vector;
-} static ioapics[MAX_APIC_ID + 1];
+} *ioapics;
-struct lapic_info {
+static struct lapic_info {
u_int la_enabled:1;
u_int la_acpi_id:8;
-} static lapics[MAX_APIC_ID + 1];
+} lapics[MAX_APIC_ID + 1];
static int madt_found_sci_override;
static ACPI_TABLE_MADT *madt;
@@ -162,7 +162,10 @@ madt_setup_io(void)
printf("Try disabling either ACPI or apic support.\n");
panic("Using MADT but ACPI doesn't work");
}
-
+
+ ioapics = malloc(sizeof(*ioapics) * (MAX_APIC_ID + 1), M_MADT,
+ M_WAITOK | M_ZERO);
+
/* First, we run through adding I/O APIC's. */
madt_walk_table(madt_parse_apics, NULL);
@@ -194,6 +197,9 @@ madt_setup_io(void)
/* Finally, we throw the switch to enable the I/O APIC's. */
acpi_SetDefaultIntrModel(ACPI_INTR_APIC);
+ free(ioapics, M_MADT);
+ ioapics = NULL;
+
return (0);
}
OpenPOWER on IntegriCloud