From 9cf3b29a572d01059963ddfd789d1cc03e9ff688 Mon Sep 17 00:00:00 2001 From: danw Date: Wed, 2 Feb 2000 16:41:56 +0000 Subject: [PATCH] Make the device_register code work on machines with multiple PCI bridges with the same bus number (like the new G4s). Also, don't hardcode the size of the pci_bridges array. --- sys/arch/macppc/macppc/autoconf.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c index f6e4c3fd071d..d3a95a7d9085 100644 --- a/sys/arch/macppc/macppc/autoconf.c +++ b/sys/arch/macppc/macppc/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.16 2000/02/01 04:04:19 danw Exp $ */ +/* $NetBSD: autoconf.c,v 1.17 2000/02/02 16:41:56 danw Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -162,14 +162,15 @@ device_register(dev, aux) if (DEVICE_IS(parent, "mainbus") && DEVICE_IS(dev, "pci")) { struct pcibus_attach_args *pba = aux; - int n; + int n, size = sizeof(pci_bridges) / sizeof(struct pci_bridge); - for (n = 0; n < 2; n++) { + for (n = 0; n < size; n++) { if (pci_bridges[n].present && - pci_bridges[n].bus == pba->pba_bus) + pci_bridges[n].bus == pba->pba_bus && + pci_bridges[n].reg[0] == addr) break; } - if (n == 2 || addr != pci_bridges[n].reg[0]) + if (n == size) return; } else if (DEVICE_IS(parent, "pci")) { struct pci_attach_args *pa = aux;