diff options
author | Gordon Willem Klok <gwk@cvs.openbsd.org> | 2006-10-23 02:05:27 +0000 |
---|---|---|
committer | Gordon Willem Klok <gwk@cvs.openbsd.org> | 2006-10-23 02:05:27 +0000 |
commit | a0a49ee8cceead08fc63bfeef2ff2d62ec77b366 (patch) | |
tree | 0e7b2d12d7991313ad44e4aa1b54f35546862203 /sys | |
parent | 40cf916c060f1314b1fe0001fc7ad6a5ba9a30fc (diff) |
Change bandit as found in many old world macs to use configuration type 1.
Alter range calculation to handle bandits dual non contiguous PCI
memory spaces. Finally fix a bug whereby if the "AAPL,Interrupts" property
is defined the variable intr isn't assigned a value and garbage may be
written to the PCI interrupt register.
tested by jolan, pedro, drahn and myself, and in snaps for a week.
ok drahn, deraadt
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/macppc/pci/mpcpcibus.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/arch/macppc/pci/mpcpcibus.c b/sys/arch/macppc/pci/mpcpcibus.c index a8f09dc76c9..9b197680914 100644 --- a/sys/arch/macppc/pci/mpcpcibus.c +++ b/sys/arch/macppc/pci/mpcpcibus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpcpcibus.c,v 1.32 2006/05/10 00:07:40 brad Exp $ */ +/* $OpenBSD: mpcpcibus.c,v 1.33 2006/10/23 02:05:26 gwk Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -107,7 +107,7 @@ struct config_type{ }; struct config_type config_offsets[] = { {"grackle", 0x00c00cf8, 0x00e00cfc, 0 }, - {"bandit", 0x00800000, 0x00c00000, 0 }, + {"bandit", 0x00800000, 0x00c00000, 1 }, {"uni-north", 0x00800000, 0x00c00000, 3 }, {"u3-agp", 0x00800000, 0x00c00000, 3 }, {"u3-ht", 0x00000cf8, 0x00000cfc, 3 }, @@ -216,12 +216,15 @@ mpcpcibus_find_ranges_32 (struct pcibr_softc *sc, u_int32_t *range_store, prange[i].size); #endif if (base != 0) { - if ((base + size) == prange[i].base) { + if ((base + size) == prange[i].base) size += prange[i].size; - } else { + else if (prange[i].base < base) { + size+= base - prange[i].base; base = prange[i].base; + } else { size = prange[i].size; - } + base = prange[i].base; + } } else { base = prange[i].base; size = prange[i].size; @@ -438,7 +441,7 @@ mpcpcibrattach(struct device *parent, struct device *self, void *aux) pci_addr_fixup(sc, &lcp->lc_pc, 32); pba.pba_dmat = &pci_bus_dma_tag; - + pba.pba_busname = "pci"; pba.pba_iot = &sc->sc_iobus_space; pba.pba_memt = &sc->sc_membus_space; @@ -605,7 +608,8 @@ fix_node_irq(int node, struct pcibus_attach_args *pba) } else return; } - } + } else + irq = intr; /* program the interrupt line register with the value * found in openfirmware */ @@ -737,15 +741,14 @@ mpc_gen_config_reg(void *cpv, pcitag_t tag, int offset) * config type 1 */ reg = tag | offset | 1; - } } else { /* config mechanism #2, type 0 * standard cf8/cfc config */ reg = 0x80000000 | tag | offset; - } + return reg; } |