summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/acpica/acpi_machdep.c240
-rw-r--r--sys/i386/acpica/madt.c232
-rw-r--r--sys/i386/conf/NOTES8
-rw-r--r--sys/i386/i386/machdep.c40
-rw-r--r--sys/i386/i386/pmap.c5
-rw-r--r--sys/i386/i386/trap.c5
-rw-r--r--sys/i386/include/acpica_machdep.h3
-rw-r--r--sys/i386/include/param.h2
-rw-r--r--sys/i386/pci/pci_cfgreg.c14
9 files changed, 313 insertions, 236 deletions
diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c
index a0ef60f..ae23178 100644
--- a/sys/i386/acpica/acpi_machdep.c
+++ b/sys/i386/acpica/acpi_machdep.c
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
#include <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/accommon.h>
+#include <contrib/dev/acpica/include/actables.h>
#include <dev/acpica/acpivar.h>
#include <dev/acpica/acpiio.h>
@@ -558,6 +560,244 @@ acpi_cpu_c1()
}
/*
+ * Support for mapping ACPI tables during early boot. This abuses the
+ * crashdump map because the kernel cannot allocate KVA in
+ * pmap_mapbios() when this is used. This makes the following
+ * assumptions about how we use this KVA: pages 0 and 1 are used to
+ * map in the header of each table found via the RSDT or XSDT and
+ * pages 2 to n are used to map in the RSDT or XSDT. This has to use
+ * 2 pages for the table headers in case a header spans a page
+ * boundary.
+ *
+ * XXX: We don't ensure the table fits in the available address space
+ * in the crashdump map.
+ */
+
+/*
+ * Map some memory using the crashdump map. 'offset' is an offset in
+ * pages into the crashdump map to use for the start of the mapping.
+ */
+static void *
+table_map(vm_paddr_t pa, int offset, vm_offset_t length)
+{
+ vm_offset_t va, off;
+ void *data;
+
+ off = pa & PAGE_MASK;
+ length = roundup(length + off, PAGE_SIZE);
+ pa = pa & PG_FRAME;
+ va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
+ (offset * PAGE_SIZE);
+ data = (void *)(va + off);
+ length -= PAGE_SIZE;
+ while (length > 0) {
+ va += PAGE_SIZE;
+ pa += PAGE_SIZE;
+ length -= PAGE_SIZE;
+ pmap_kenter(va, pa);
+ invlpg(va);
+ }
+ return (data);
+}
+
+/* Unmap memory previously mapped with table_map(). */
+static void
+table_unmap(void *data, vm_offset_t length)
+{
+ vm_offset_t va, off;
+
+ va = (vm_offset_t)data;
+ off = va & PAGE_MASK;
+ length = roundup(length + off, PAGE_SIZE);
+ va &= ~PAGE_MASK;
+ while (length > 0) {
+ pmap_kremove(va);
+ invlpg(va);
+ va += PAGE_SIZE;
+ length -= PAGE_SIZE;
+ }
+}
+
+/*
+ * Map a table at a given offset into the crashdump map. It first
+ * maps the header to determine the table length and then maps the
+ * entire table.
+ */
+static void *
+map_table(vm_paddr_t pa, int offset, const char *sig)
+{
+ ACPI_TABLE_HEADER *header;
+ vm_offset_t length;
+ void *table;
+
+ header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
+ if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
+ table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+ return (NULL);
+ }
+ length = header->Length;
+ table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+ table = table_map(pa, offset, length);
+ if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
+ if (bootverbose)
+ printf("ACPI: Failed checksum for table %s\n", sig);
+ table_unmap(table, length);
+ return (NULL);
+ }
+ return (table);
+}
+
+/*
+ * See if a given ACPI table is the requested table. Returns the
+ * length of the able if it matches or zero on failure.
+ */
+static int
+probe_table(vm_paddr_t address, const char *sig)
+{
+ ACPI_TABLE_HEADER *table;
+
+ table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
+ if (table == NULL) {
+ if (bootverbose)
+ printf("ACPI: Failed to map table at 0x%jx\n",
+ (uintmax_t)address);
+ return (0);
+ }
+ if (bootverbose)
+ printf("Table '%.4s' at 0x%jx\n", table->Signature,
+ (uintmax_t)address);
+
+ if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) {
+ table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+ return (0);
+ }
+ table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+ return (1);
+}
+
+/*
+ * Try to map a table at a given physical address previously returned
+ * by acpi_find_table().
+ */
+void *
+acpi_map_table(vm_paddr_t pa, const char *sig)
+{
+
+ return (map_table(pa, 0, sig));
+}
+
+/* Unmap a table previously mapped via acpi_map_table(). */
+void
+acpi_unmap_table(void *table)
+{
+ ACPI_TABLE_HEADER *header;
+
+ header = (ACPI_TABLE_HEADER *)table;
+ table_unmap(table, header->Length);
+}
+
+/*
+ * Return the physical address of the requested table or zero if one
+ * is not found.
+ */
+vm_paddr_t
+acpi_find_table(const char *sig)
+{
+ ACPI_PHYSICAL_ADDRESS rsdp_ptr;
+ ACPI_TABLE_RSDP *rsdp;
+ ACPI_TABLE_RSDT *rsdt;
+ ACPI_TABLE_XSDT *xsdt;
+ ACPI_TABLE_HEADER *table;
+ vm_paddr_t addr;
+ int i, count;
+
+ if (resource_disabled("acpi", 0))
+ return (0);
+
+ /*
+ * Map in the RSDP. Since ACPI uses AcpiOsMapMemory() which in turn
+ * calls pmap_mapbios() to find the RSDP, we assume that we can use
+ * pmap_mapbios() to map the RSDP.
+ */
+ if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
+ return (0);
+ rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
+ if (rsdp == NULL) {
+ if (bootverbose)
+ printf("ACPI: Failed to map RSDP\n");
+ return (0);
+ }
+
+ /*
+ * For ACPI >= 2.0, use the XSDT if it is available.
+ * Otherwise, use the RSDT. We map the XSDT or RSDT at page 2
+ * in the crashdump area. Pages 0 and 1 are used to map in the
+ * headers of candidate ACPI tables.
+ */
+ addr = 0;
+ if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
+ /*
+ * AcpiOsGetRootPointer only verifies the checksum for
+ * the version 1.0 portion of the RSDP. Version 2.0 has
+ * an additional checksum that we verify first.
+ */
+ if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
+ if (bootverbose)
+ printf("ACPI: RSDP failed extended checksum\n");
+ return (0);
+ }
+ xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
+ if (xsdt == NULL) {
+ if (bootverbose)
+ printf("ACPI: Failed to map XSDT\n");
+ return (0);
+ }
+ count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+ sizeof(UINT64);
+ for (i = 0; i < count; i++)
+ if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
+ addr = xsdt->TableOffsetEntry[i];
+ break;
+ }
+ acpi_unmap_table(xsdt);
+ } else {
+ rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT);
+ if (rsdt == NULL) {
+ if (bootverbose)
+ printf("ACPI: Failed to map RSDT\n");
+ return (0);
+ }
+ count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+ sizeof(UINT32);
+ for (i = 0; i < count; i++)
+ if (probe_table(rsdt->TableOffsetEntry[i], sig)) {
+ addr = rsdt->TableOffsetEntry[i];
+ break;
+ }
+ acpi_unmap_table(rsdt);
+ }
+ pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
+ if (addr == 0) {
+ if (bootverbose)
+ printf("ACPI: No %s table found\n", sig);
+ return (0);
+ }
+ if (bootverbose)
+ printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
+
+ /*
+ * Verify that we can map the full table and that its checksum is
+ * correct, etc.
+ */
+ table = map_table(addr, 0, sig);
+ if (table == NULL)
+ return (0);
+ acpi_unmap_table(table);
+
+ return (addr);
+}
+
+/*
* ACPI nexus(4) driver.
*/
static int
diff --git a/sys/i386/acpica/madt.c b/sys/i386/acpica/madt.c
index f9756ec..114fbc7 100644
--- a/sys/i386/acpica/madt.c
+++ b/sys/i386/acpica/madt.c
@@ -36,27 +36,19 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/smp.h>
-
#include <vm/vm.h>
-#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <machine/apicreg.h>
-#include <machine/frame.h>
#include <machine/intr_machdep.h>
#include <machine/apicvar.h>
-#include <machine/md_var.h>
-#include <machine/specialreg.h>
#include <contrib/dev/acpica/include/acpi.h>
-#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/actables.h>
#include <dev/acpica/acpivar.h>
#include <dev/pci/pcivar.h>
-typedef void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg);
-
/* These two arrays are indexed by APIC IDs. */
struct ioapic_info {
void *io_apic;
@@ -79,8 +71,6 @@ static enum intr_polarity interrupt_polarity(UINT16 IntiFlags, UINT8 Source);
static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source);
static int madt_find_cpu(u_int acpi_id, u_int *apic_id);
static int madt_find_interrupt(int intr, void **apic, u_int *pin);
-static void *madt_map(vm_paddr_t pa, int offset, vm_offset_t length);
-static void *madt_map_table(vm_paddr_t pa, int offset, const char *sig);
static void madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg);
static void madt_parse_interrupt_override(
ACPI_MADT_INTERRUPT_OVERRIDE *intr);
@@ -92,13 +82,10 @@ static int madt_probe(void);
static int madt_probe_cpus(void);
static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
void *arg __unused);
-static int madt_probe_table(vm_paddr_t address);
static void madt_register(void *dummy);
static int madt_setup_local(void);
static int madt_setup_io(void);
-static void madt_unmap(void *data, vm_offset_t length);
-static void madt_unmap_table(void *table);
-static void madt_walk_table(madt_entry_handler *handler, void *arg);
+static void madt_walk_table(acpi_subtable_handler *handler, void *arg);
static struct apic_enumerator madt_enumerator = {
"MADT",
@@ -108,87 +95,6 @@ static struct apic_enumerator madt_enumerator = {
madt_setup_io
};
-/*
- * Code to abuse the crashdump map to map in the tables for the early
- * probe. We cheat and make the following assumptions about how we
- * use this KVA: pages 0 and 1 are used to map in the header of each
- * table found via the RSDT or XSDT and pages 2 to n are used to map
- * in the RSDT or XSDT. We have to use 2 pages for the table headers
- * in case a header spans a page boundary. The offset is in pages;
- * the length is in bytes.
- */
-static void *
-madt_map(vm_paddr_t pa, int offset, vm_offset_t length)
-{
- vm_offset_t va, off;
- void *data;
-
- off = pa & PAGE_MASK;
- length = roundup(length + off, PAGE_SIZE);
- pa = pa & PG_FRAME;
- va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
- (offset * PAGE_SIZE);
- data = (void *)(va + off);
- length -= PAGE_SIZE;
- while (length > 0) {
- va += PAGE_SIZE;
- pa += PAGE_SIZE;
- length -= PAGE_SIZE;
- pmap_kenter(va, pa);
- invlpg(va);
- }
- return (data);
-}
-
-static void
-madt_unmap(void *data, vm_offset_t length)
-{
- vm_offset_t va, off;
-
- va = (vm_offset_t)data;
- off = va & PAGE_MASK;
- length = roundup(length + off, PAGE_SIZE);
- va &= ~PAGE_MASK;
- while (length > 0) {
- pmap_kremove(va);
- invlpg(va);
- va += PAGE_SIZE;
- length -= PAGE_SIZE;
- }
-}
-
-static void *
-madt_map_table(vm_paddr_t pa, int offset, const char *sig)
-{
- ACPI_TABLE_HEADER *header;
- vm_offset_t length;
- void *table;
-
- header = madt_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
- if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
- madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
- return (NULL);
- }
- length = header->Length;
- madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
- table = madt_map(pa, offset, length);
- if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
- if (bootverbose)
- printf("MADT: Failed checksum for table %s\n", sig);
- madt_unmap(table, length);
- return (NULL);
- }
- return (table);
-}
-
-static void
-madt_unmap_table(void *table)
-{
- ACPI_TABLE_HEADER *header;
-
- header = (ACPI_TABLE_HEADER *)table;
- madt_unmap(table, header->Length);
-}
/*
* Look for an ACPI Multiple APIC Description Table ("APIC")
@@ -196,137 +102,25 @@ madt_unmap_table(void *table)
static int
madt_probe(void)
{
- ACPI_PHYSICAL_ADDRESS rsdp_ptr;
- ACPI_TABLE_RSDP *rsdp;
- ACPI_TABLE_RSDT *rsdt;
- ACPI_TABLE_XSDT *xsdt;
- int i, count;
-
- if (resource_disabled("acpi", 0))
- return (ENXIO);
-
- /*
- * Map in the RSDP. Since ACPI uses AcpiOsMapMemory() which in turn
- * calls pmap_mapbios() to find the RSDP, we assume that we can use
- * pmap_mapbios() to map the RSDP.
- */
- if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
- return (ENXIO);
- rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
- if (rsdp == NULL) {
- if (bootverbose)
- printf("MADT: Failed to map RSDP\n");
- return (ENXIO);
- }
-
- /*
- * For ACPI >= 2.0, use the XSDT if it is available.
- * Otherwise, use the RSDT. We map the XSDT or RSDT at page 1
- * in the crashdump area. Page 0 is used to map in the
- * headers of candidate ACPI tables.
- */
- if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
- /*
- * AcpiOsGetRootPointer only verifies the checksum for
- * the version 1.0 portion of the RSDP. Version 2.0 has
- * an additional checksum that we verify first.
- */
- if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
- if (bootverbose)
- printf("MADT: RSDP failed extended checksum\n");
- return (ENXIO);
- }
- xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 2,
- ACPI_SIG_XSDT);
- if (xsdt == NULL) {
- if (bootverbose)
- printf("MADT: Failed to map XSDT\n");
- return (ENXIO);
- }
- count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
- sizeof(UINT64);
- for (i = 0; i < count; i++)
- if (madt_probe_table(xsdt->TableOffsetEntry[i]))
- break;
- madt_unmap_table(xsdt);
- } else {
- rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 2,
- ACPI_SIG_RSDT);
- if (rsdt == NULL) {
- if (bootverbose)
- printf("MADT: Failed to map RSDT\n");
- return (ENXIO);
- }
- count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
- sizeof(UINT32);
- for (i = 0; i < count; i++)
- if (madt_probe_table(rsdt->TableOffsetEntry[i]))
- break;
- madt_unmap_table(rsdt);
- }
- pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
- if (madt_physaddr == 0) {
- if (bootverbose)
- printf("MADT: No MADT table found\n");
- return (ENXIO);
- }
- if (bootverbose)
- printf("MADT: Found table at 0x%jx\n",
- (uintmax_t)madt_physaddr);
- /*
- * Verify that we can map the full table and that its checksum is
- * correct, etc.
- */
- madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
- if (madt == NULL)
+ madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
+ if (madt_physaddr == 0)
return (ENXIO);
- madt_unmap_table(madt);
- madt = NULL;
-
return (0);
}
/*
- * See if a given ACPI table is the MADT.
- */
-static int
-madt_probe_table(vm_paddr_t address)
-{
- ACPI_TABLE_HEADER *table;
-
- table = madt_map(address, 0, sizeof(ACPI_TABLE_HEADER));
- if (table == NULL) {
- if (bootverbose)
- printf("MADT: Failed to map table at 0x%jx\n",
- (uintmax_t)address);
- return (0);
- }
- if (bootverbose)
- printf("Table '%.4s' at 0x%jx\n", table->Signature,
- (uintmax_t)address);
-
- if (strncmp(table->Signature, ACPI_SIG_MADT, ACPI_NAME_SIZE) != 0) {
- madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
- return (0);
- }
- madt_physaddr = address;
- madt_length = table->Length;
- madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
- return (1);
-}
-
-/*
* Run through the MP table enumerating CPUs.
*/
static int
madt_probe_cpus(void)
{
- madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
+ madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
+ madt_length = madt->Header.Length;
KASSERT(madt != NULL, ("Unable to re-map MADT"));
madt_walk_table(madt_probe_cpus_handler, NULL);
- madt_unmap_table(madt);
+ acpi_unmap_table(madt);
madt = NULL;
return (0);
}
@@ -416,17 +210,11 @@ SYSINIT(madt_register, SI_SUB_CPU - 1, SI_ORDER_SECOND, madt_register, NULL);
* Call the handler routine for each entry in the MADT table.
*/
static void
-madt_walk_table(madt_entry_handler *handler, void *arg)
+madt_walk_table(acpi_subtable_handler *handler, void *arg)
{
- ACPI_SUBTABLE_HEADER *entry;
- u_char *p, *end;
-
- end = (u_char *)(madt) + madt->Header.Length;
- for (p = (u_char *)(madt + 1); p < end; ) {
- entry = (ACPI_SUBTABLE_HEADER *)p;
- handler(entry, arg);
- p += entry->Length;
- }
+
+ acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
+ handler, arg);
}
static void
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 876224e..594c43a 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -353,7 +353,7 @@ options AGP_DEBUG
#####################################################################
# HARDWARE DEVICE CONFIGURATION
-# To include support for VGA VESA video modes (depends on X86EMU)
+# To include support for VGA VESA video modes
options VESA
# Turn on extra debugging checks and output for VESA support.
@@ -361,6 +361,9 @@ options VESA_DEBUG
device dpms # DPMS suspend & resume via VESA BIOS
+# x86 real mode BIOS emulator, required by atkbdc/dpms/vesa
+options X86BIOS
+
#
# The Numeric Processing eXtension driver. This is non-optional.
device npx
@@ -444,6 +447,9 @@ options VGA_WIDTH90 # support 90 column modes
# Debugging.
options VGA_DEBUG
+# Linear framebuffer driver for S3 VESA 1.2 cards. Works on top of VESA.
+device s3pci
+
# 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create
# the /dev/3dfx0 device to work with glide implementations. This should get
# linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 1a6b3c6..96c8f25 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -1946,7 +1946,7 @@ sdtossd(sd, ssd)
static int
add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp)
{
- int i, physmap_idx;
+ int i, insert_idx, physmap_idx;
physmap_idx = *physmap_idxp;
@@ -1968,17 +1968,34 @@ add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp)
}
#endif
+ /*
+ * Find insertion point while checking for overlap. Start off by
+ * assuming the new entry will be added to the end.
+ */
+ insert_idx = physmap_idx + 2;
for (i = 0; i <= physmap_idx; i += 2) {
if (smap->base < physmap[i + 1]) {
+ if (smap->base + smap->length <= physmap[i]) {
+ insert_idx = i;
+ break;
+ }
if (boothowto & RB_VERBOSE)
printf(
- "Overlapping or non-monotonic memory region, ignoring second region\n");
+ "Overlapping memory regions, ignoring second region\n");
return (1);
}
}
- if (smap->base == physmap[physmap_idx + 1]) {
- physmap[physmap_idx + 1] += smap->length;
+ /* See if we can prepend to the next entry. */
+ if (insert_idx <= physmap_idx &&
+ smap->base + smap->length == physmap[insert_idx]) {
+ physmap[insert_idx] = smap->base;
+ return (1);
+ }
+
+ /* See if we can append to the previous entry. */
+ if (insert_idx > 0 && smap->base == physmap[insert_idx - 1]) {
+ physmap[insert_idx - 1] += smap->length;
return (1);
}
@@ -1989,8 +2006,19 @@ add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp)
"Too many segments in the physical address map, giving up\n");
return (0);
}
- physmap[physmap_idx] = smap->base;
- physmap[physmap_idx + 1] = smap->base + smap->length;
+
+ /*
+ * Move the last 'N' entries down to make room for the new
+ * entry if needed.
+ */
+ for (i = physmap_idx; i > insert_idx; i -= 2) {
+ physmap[i] = physmap[i - 2];
+ physmap[i + 1] = physmap[i - 1];
+ }
+
+ /* Insert the new entry. */
+ physmap[insert_idx] = smap->base;
+ physmap[insert_idx + 1] = smap->base + smap->length;
return (1);
}
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index f3b4d99..7e3bc37 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -702,6 +702,11 @@ pmap_init(void)
* Are large page mappings enabled?
*/
TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
+ if (pg_ps_enabled) {
+ KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0,
+ ("pmap_init: can't assign to pagesizes[1]"));
+ pagesizes[1] = NBPDR;
+ }
/*
* Calculate the size of the pv head table for superpages.
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index f7064f0..f4df668 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -225,6 +225,11 @@ trap(struct trapframe *frame)
}
#endif
+ if (type == T_RESERVED) {
+ trap_fatal(frame, 0);
+ goto out;
+ }
+
#ifdef HWPMC_HOOKS
/*
* CPU PMCs interrupt using an NMI so we check for that first.
diff --git a/sys/i386/include/acpica_machdep.h b/sys/i386/include/acpica_machdep.h
index f90b213..d5bfe65 100644
--- a/sys/i386/include/acpica_machdep.h
+++ b/sys/i386/include/acpica_machdep.h
@@ -97,5 +97,8 @@ extern int acpi_release_global_lock(uint32_t *lock);
void acpi_SetDefaultIntrModel(int model);
void acpi_cpu_c1(void);
+void *acpi_map_table(vm_paddr_t pa, const char *sig);
+void acpi_unmap_table(void *table);
+vm_paddr_t acpi_find_table(const char *sig);
#endif /* __ACPICA_MACHDEP_H__ */
diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h
index b6a527d..11ac12e 100644
--- a/sys/i386/include/param.h
+++ b/sys/i386/include/param.h
@@ -110,6 +110,8 @@
#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
#define PDRMASK (NBPDR-1)
+#define MAXPAGESIZES 2 /* maximum number of supported page sizes */
+
#define IOPAGES 2 /* pages of i/o permission bitmap */
#ifndef KSTACK_PAGES
diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c
index 20050e6..ae56990 100644
--- a/sys/i386/pci/pci_cfgreg.c
+++ b/sys/i386/pci/pci_cfgreg.c
@@ -299,9 +299,9 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes)
if (bus <= PCI_BUSMAX
&& slot < devmax
&& func <= PCI_FUNCMAX
- && reg <= PCI_REGMAX
+ && (unsigned)reg <= PCI_REGMAX
&& bytes != 3
- && (unsigned) bytes <= 4
+ && (unsigned)bytes <= 4
&& (reg & (bytes - 1)) == 0) {
switch (cfgmech) {
case CFGMECH_PCIE:
@@ -595,7 +595,7 @@ pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
* fall back to using type 1 config access instead.
*/
if (pci_cfgregopen() != 0) {
- for (slot = 0; slot < 32; slot++) {
+ for (slot = 0; slot <= PCI_SLOTMAX; slot++) {
val1 = pcireg_cfgread(0, slot, 0, 0, 4);
if (val1 == 0xffffffff)
continue;
@@ -661,8 +661,8 @@ pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
vm_paddr_t pa, papage;
int data = -1;
- if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
- func > PCI_FUNCMAX || reg >= 0x1000 || bytes > 4 || bytes == 3)
+ if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
+ func > PCI_FUNCMAX || reg > PCIE_REGMAX)
return (-1);
critical_enter();
@@ -695,8 +695,8 @@ pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
volatile vm_offset_t va;
vm_paddr_t pa, papage;
- if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
- func > PCI_FUNCMAX || reg >= 0x1000)
+ if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
+ func > PCI_FUNCMAX || reg > PCIE_REGMAX)
return;
critical_enter();
OpenPOWER on IntegriCloud