diff options
Diffstat (limited to 'sys/arch/sparc64/dev/pci_machdep.c')
-rw-r--r-- | sys/arch/sparc64/dev/pci_machdep.c | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c index a954876e04f..782a46fd9dc 100644 --- a/sys/arch/sparc64/dev/pci_machdep.c +++ b/sys/arch/sparc64/dev/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.8 2002/03/26 18:13:11 jason Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.9 2002/06/08 18:06:02 jason Exp $ */ /* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */ /* @@ -336,6 +336,18 @@ pci_make_tag(pc, b, d, f) return (tag); } +pcireg_t (*sparc64_pci_conf_read)(pci_chipset_tag_t, pcitag_t, int); +void (*sparc64_pci_conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t); + +void +pci_conf_setfunc(rd, wr) + pcireg_t (*rd)(pci_chipset_tag_t, pcitag_t, int); + void (*wr)(pci_chipset_tag_t, pcitag_t, int, pcireg_t); +{ + sparc64_pci_conf_read = rd; + sparc64_pci_conf_write = wr; +} + /* assume we are mapped little-endian/side-effect */ pcireg_t pci_conf_read(pc, tag, reg) @@ -343,29 +355,9 @@ pci_conf_read(pc, tag, reg) pcitag_t tag; int reg; { - struct psycho_pbm *pp = pc->cookie; - struct psycho_softc *sc = pp->pp_sc; - pcireg_t val = (pcireg_t)~0; - - DPRINTF(SPDB_CONF, ("pci_conf_read: tag %lx reg %x ", - (long)tag, reg)); - if (PCITAG_NODE(tag) != -1) { - DPRINTF(SPDB_CONF, ("asi=%x addr=%qx (offset=%x) ...", - bus_type_asi[sc->sc_configtag->type], - (long long)(sc->sc_configaddr + - PCITAG_OFFSET(tag) + reg), - (int)PCITAG_OFFSET(tag) + reg)); - - val = bus_space_read_4(sc->sc_configtag, sc->sc_configaddr, - PCITAG_OFFSET(tag) + reg); - } -#ifdef DEBUG - else DPRINTF(SPDB_CONF, ("pci_conf_read: bogus pcitag %x\n", - (int)PCITAG_OFFSET(tag))); -#endif - DPRINTF(SPDB_CONF, (" returning %08x\n", (u_int)val)); - - return (val); + if (sparc64_pci_conf_read == NULL) + panic("no pci_conf_read"); + return ((*sparc64_pci_conf_read)(pc, tag, reg)); } void @@ -375,26 +367,12 @@ pci_conf_write(pc, tag, reg, data) int reg; pcireg_t data; { - struct psycho_pbm *pp = pc->cookie; - struct psycho_softc *sc = pp->pp_sc; - - DPRINTF(SPDB_CONF, ("pci_conf_write: tag %lx; reg %x; data %x; ", - (long)PCITAG_OFFSET(tag), reg, (int)data)); - DPRINTF(SPDB_CONF, ("asi = %x; readaddr = %qx (offset = %x)\n", - bus_type_asi[sc->sc_configtag->type], - (long long)(sc->sc_configaddr + PCITAG_OFFSET(tag) + reg), - (int)PCITAG_OFFSET(tag) + reg)); - - /* If we don't know it, just punt. */ - if (PCITAG_NODE(tag) == -1) { - DPRINTF(SPDB_CONF, ("pci_config_write: bad addr")); - return; - } - - bus_space_write_4(sc->sc_configtag, sc->sc_configaddr, - PCITAG_OFFSET(tag) + reg, data); + if (sparc64_pci_conf_write == NULL) + panic("no pci_conf_read"); + return ((*sparc64_pci_conf_write)(pc, tag, reg, data)); } + /* * interrupt mapping foo. * XXX: how does this deal with multiple interrupts for a device? |