From 2e1d04ae9bf9fe9814b5dd4289a3c53a950533b5 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 16 Dec 2019 21:35:02 +0000 Subject: [PATCH] Move attachment of pccard children into exca library. Attach the cardbus and pccard children before the sysctls are added rather than after. --- sys/dev/exca/exca.c | 7 +++++++ sys/dev/pccbb/pccbb_pci.c | 20 +++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/dev/exca/exca.c b/sys/dev/exca/exca.c index f73da8345d1..48169e0bca7 100644 --- a/sys/dev/exca/exca.c +++ b/sys/dev/exca/exca.c @@ -646,6 +646,11 @@ exca_init(struct exca_softc *sc, device_t dev, sc->flags = 0; sc->getb = exca_mem_getb; sc->putb = exca_mem_putb; + sc->pccarddev = device_add_child(dev, "pccard", -1); + if (sc->pccarddev == NULL) + DEVPRINTF(brdev, "WARNING: cannot add pccard bus.\n"); + else if (device_probe_and_attach(sc->pccarddev) != 0) + DEVPRINTF(brdev, "WARNING: cannot attach pccard bus.\n"); } /* @@ -742,6 +747,8 @@ exca_valid_slot(struct exca_softc *exca) * Intel i82365sl-DF step or maybe a vlsi 82c146 * we detected the vlsi case earlier, so if the controller * isn't set, we know it is a i82365sl step D. + * XXXX Except we didn't -- this is a regression but VLSI + * controllers are super hard to find these days for testing. */ exca->chipset = EXCA_I82365SL_DF; break; diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index 58c09d84059..6de68f2759f 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -317,6 +317,13 @@ cbb_pci_attach(device_t brdev) rman_get_start(sc->base_res))); } + /* attach children */ + sc->cbdev = device_add_child(brdev, "cardbus", -1); + if (sc->cbdev == NULL) + DEVPRINTF((brdev, "WARNING: cannot add cardbus bus.\n")); + else if (device_probe_and_attach(sc->cbdev) != 0) + DEVPRINTF((brdev, "WARNING: cannot attach cardbus bus!\n")); + sc->bst = rman_get_bustag(sc->base_res); sc->bsh = rman_get_bushandle(sc->base_res); exca_init(&sc->exca, brdev, sc->bst, sc->bsh, CBB_EXCA_OFFSET); @@ -373,19 +380,6 @@ cbb_pci_attach(device_t brdev) } #endif - /* attach children */ - sc->cbdev = device_add_child(brdev, "cardbus", -1); - if (sc->cbdev == NULL) - DEVPRINTF((brdev, "WARNING: cannot add cardbus bus.\n")); - else if (device_probe_and_attach(sc->cbdev) != 0) - DEVPRINTF((brdev, "WARNING: cannot attach cardbus bus!\n")); - - sc->exca.pccarddev = device_add_child(brdev, "pccard", -1); - if (sc->exca.pccarddev == NULL) - DEVPRINTF((brdev, "WARNING: cannot add pccard bus.\n")); - else if (device_probe_and_attach(sc->exca.pccarddev) != 0) - DEVPRINTF((brdev, "WARNING: cannot attach pccard bus.\n")); - /* Map and establish the interrupt. */ rid = 0; sc->irq_res = bus_alloc_resource_any(brdev, SYS_RES_IRQ, &rid,