diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-01-13 06:12:49 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-01-13 06:12:49 +0000 |
commit | d0bbd2d6443777ef53c24574b09427c55e04112e (patch) | |
tree | ae56d7b5f737f9251280f969c9e815c684de1e9a /sys/dev | |
parent | f81cc2b29a14337b801b60b0e5372ce058b26241 (diff) |
Don't whack conflicting BARs if they are enabled.
Makes the IBM eServer x336 work. Tested by sthen@ and naddy@.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/pci.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 02e73fa1346..15432e50d52 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.71 2009/11/23 22:34:23 mlarkin Exp $ */ +/* $OpenBSD: pci.c,v 1.72 2010/01/13 06:12:48 kettenis Exp $ */ /* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */ /* @@ -531,12 +531,13 @@ pci_reserve_resources(struct pci_attach_args *pa) { pci_chipset_tag_t pc = pa->pa_pc; pcitag_t tag = pa->pa_tag; - pcireg_t bhlc, blr, type; + pcireg_t bhlc, blr, csr, type; bus_addr_t base, limit; bus_size_t size; int reg, reg_start, reg_end; int flags; + csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); bhlc = pci_conf_read(pc, tag, PCI_BHLC_REG); switch (PCI_HDRTYPE_TYPE(bhlc)) { case 0: @@ -554,7 +555,7 @@ pci_reserve_resources(struct pci_attach_args *pa) default: return (0); } - + for (reg = reg_start; reg < reg_end; reg += 4) { if (!pci_mapreg_probe(pc, tag, reg, &type)) continue; @@ -579,9 +580,14 @@ pci_reserve_resources(struct pci_attach_args *pa) base, size, EX_NOWAIT)) { printf("mem address conflict 0x%x/0x%x\n", base, size); - pci_conf_write(pc, tag, reg, 0); - if (type & PCI_MAPREG_MEM_TYPE_64BIT) - pci_conf_write(pc, tag, reg + 4, 0); + if (csr & PCI_COMMAND_MEM_ENABLE) { + extent_alloc_region(pa->pa_memex, + base, size, EX_NOWAIT | EX_CONFLICTOK); + } else { + pci_conf_write(pc, tag, reg, 0); + if (type & PCI_MAPREG_MEM_TYPE_64BIT) + pci_conf_write(pc, tag, reg + 4, 0); + } } break; case PCI_MAPREG_TYPE_IO: @@ -589,7 +595,12 @@ pci_reserve_resources(struct pci_attach_args *pa) base, size, EX_NOWAIT)) { printf("io address conflict 0x%x/0x%x\n", base, size); - pci_conf_write(pc, tag, reg, 0); + if (csr & PCI_COMMAND_IO_ENABLE) { + extent_alloc_region(pa->pa_memex, + base, size, EX_NOWAIT | EX_CONFLICTOK); + } else { + pci_conf_write(pc, tag, reg, 0); + } } break; } |