diff options
Diffstat (limited to 'sys/arch/i386/pci/pci_machdep.c')
-rw-r--r-- | sys/arch/i386/pci/pci_machdep.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index f37a299fe33..de60d8500d2 100644 --- a/sys/arch/i386/pci/pci_machdep.c +++ b/sys/arch/i386/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.45 2009/03/10 15:03:17 oga Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.46 2009/04/11 17:13:33 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */ /*- @@ -79,16 +79,18 @@ #include <sys/systm.h> #include <sys/errno.h> #include <sys/device.h> +#include <sys/extent.h> +#include <sys/malloc.h> #include <uvm/uvm_extern.h> #include <machine/bus.h> #include <machine/pio.h> #include <machine/i8259.h> +#include <machine/biosvar.h> #include "bios.h" #if NBIOS > 0 -#include <machine/biosvar.h> extern bios_pciinfo_t *bios_pciinfo; #endif @@ -600,3 +602,40 @@ pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie) /* XXX oh, unroute the pci int link? */ isa_intr_disestablish(NULL, cookie); } + +struct extent *pciio_ex; +struct extent *pcimem_ex; + +void +pci_init_extents(void) +{ + bios_memmap_t *bmp; + u_int64_t size; + + if (pciio_ex == NULL) + pciio_ex = extent_create("pciio", 0, 0xffff, M_DEVBUF, + NULL, 0, EX_NOWAIT); + + if (pcimem_ex == NULL) { + pcimem_ex = extent_create("pcimem", 0, 0xffffffff, M_DEVBUF, + NULL, 0, EX_NOWAIT); + if (pcimem_ex == NULL) + return; + + for (bmp = bios_memmap; bmp->type != BIOS_MAP_END; bmp++) { + /* + * Ignore address space beyond 4G. + */ + if (bmp->addr >= 0x100000000ULL) + continue; + size = bmp->size; + if (bmp->addr + size >= 0x100000000ULL) + size = 0x100000000ULL - bmp->addr; + + if (extent_alloc_region(pcimem_ex, bmp->addr, size, + EX_NOWAIT)) + printf("memory map conflict 0x%llx/0x%llx\n", + bmp->addr, bmp->size); + } + } +} |