From a48bd3e3b497c034b01c53585a690de0e7454054 Mon Sep 17 00:00:00 2001 From: eeh Date: Thu, 16 May 2002 20:28:33 +0000 Subject: [PATCH] Make the PCI code actually work. --- sys/arch/sparc64/dev/pci_machdep.c | 23 +++++++---------------- sys/arch/sparc64/dev/psycho.c | 4 ++-- sys/arch/sparc64/include/pci_machdep.h | 3 +-- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c index b5d27c5af47a..22b276df3aa7 100644 --- a/sys/arch/sparc64/dev/pci_machdep.c +++ b/sys/arch/sparc64/dev/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.30 2002/05/16 01:01:45 thorpej Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.31 2002/05/16 20:28:33 eeh Exp $ */ /* * Copyright (c) 1999, 2000 Matthew R. Green @@ -96,20 +96,6 @@ pci_attach_hook(parent, self, pba) struct device *self; struct pcibus_attach_args *pba; { - struct sparc_pci_chipset *npc; - pcitag_t btag; - - /* - * If we're attaching at a bridge, create a new PCI chipset - * tag that points at the bridge's node. - */ - if (pba->pba_bridgetag != NULL) { - btag = *pba->pba_bridgetag; - npc = malloc(sizeof(*npc), M_DEVBUF, M_WAITOK); - *npc = *pba->pba_pc; - npc->curnode = PCITAG_NODE(btag); - pba->pba_pc = npc; - } } int @@ -265,7 +251,12 @@ pci_enumerate_bus(struct pci_softc *sc, int node, b, d, f, ret; char name[30]; - for (node = OF_child(pc->curnode); node != 0 && node != -1; + if (sc->sc_bridgetag) + node = PCITAG_NODE(*sc->sc_bridgetag); + else + node = pc->rootnode; + + for (node = OF_child(node); node != 0 && node != -1; node = OF_peer(node)) { name[0] = name[29] = 0; OF_getprop(node, "name", name, sizeof(name)); diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index 78451ff6f907..b57236df9936 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $NetBSD: psycho.c,v 1.47 2002/05/16 01:01:45 thorpej Exp $ */ +/* $NetBSD: psycho.c,v 1.48 2002/05/16 20:28:33 eeh Exp $ */ /* * Copyright (c) 2001, 2002 Eduardo E. Horvath @@ -398,6 +398,7 @@ found: psycho_get_bus_range(sc->sc_node, psycho_br); pba.pba_bus = psycho_br[0]; + pba.pba_bridgetag = NULL; printf("bus range %u to %u", psycho_br[0], psycho_br[1]); printf("; PCI bus %d", psycho_br[0]); @@ -593,7 +594,6 @@ psycho_alloc_chipset(pp, node, pc) memcpy(npc, pc, sizeof *pc); npc->cookie = pp; npc->rootnode = node; - npc->curnode = node; return (npc); } diff --git a/sys/arch/sparc64/include/pci_machdep.h b/sys/arch/sparc64/include/pci_machdep.h index b66d5304d22c..12874dfa7f25 100644 --- a/sys/arch/sparc64/include/pci_machdep.h +++ b/sys/arch/sparc64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.h,v 1.13 2002/05/16 01:01:47 thorpej Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.14 2002/05/16 20:28:34 eeh Exp $ */ /* * Copyright (c) 1999 Matthew R. Green @@ -46,7 +46,6 @@ typedef u_int pci_intr_handle_t; struct sparc_pci_chipset { void *cookie; /* psycho_pbm, but sssh! */ int rootnode; /* PCI controller */ - int curnode; /* Current OFW node */ }; /*