diff options
-rw-r--r-- | sys/arch/amd64/pci/pci_machdep.c | 18 | ||||
-rw-r--r-- | sys/arch/i386/pci/pci_machdep.c | 18 |
2 files changed, 28 insertions, 8 deletions
diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c index 19137f17676..67fa23b429d 100644 --- a/sys/arch/amd64/pci/pci_machdep.c +++ b/sys/arch/amd64/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.28 2009/04/21 19:18:09 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.29 2009/04/29 18:28:38 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -372,9 +372,19 @@ 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 (pciio_ex == NULL) { + /* + * We only have 64K of addressable I/O space. + * However, since BARs may contain garbage, we cover + * the full 32-bit address space defined by PCI of + * which we only make the first 64K available. + */ + pciio_ex = extent_create("pciio", 0, 0xffffffff, M_DEVBUF, + NULL, 0, EX_NOWAIT | EX_FILLED); + if (pciio_ex == NULL) + return; + extent_free(pciio_ex, 0, 0x10000, M_NOWAIT); + } if (pcimem_ex == NULL) { pcimem_ex = extent_create("pcimem", 0, 0xffffffff, M_DEVBUF, diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index dd545221c8a..777bd451fdd 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.47 2009/04/13 21:22:38 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.48 2009/04/29 18:28:37 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */ /*- @@ -612,9 +612,19 @@ 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 (pciio_ex == NULL) { + /* + * We only have 64K of addressable I/O space. + * However, since BARs may contain garbage, we cover + * the full 32-bit address space defined by PCI of + * which we only make the first 64K available. + */ + pciio_ex = extent_create("pciio", 0, 0xffffffff, M_DEVBUF, + NULL, 0, EX_NOWAIT | EX_FILLED); + if (pciio_ex == NULL) + return; + extent_free(pciio_ex, 0, 0x10000, M_NOWAIT); + } if (pcimem_ex == NULL) { pcimem_ex = extent_create("pcimem", 0, 0xffffffff, M_DEVBUF, |