From 9dc99a106d12372648f0bae23d3a3f5f1507715a Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 22 Aug 1999 19:56:55 +0000 Subject: Take advantage of the apm/npx code and let them identify themselves rather than having explicit hooks here. Treat the eisa/isa attach a little differently so that we defer the decision about to attach eisa/isa to the motherboard directly only if the PCI probe (if it exists) fails to turn up a PCI->EISA/ISA bridge. This restores the original device geometry where ISA and/or EISA attach to their bridge rather than bypassing and going to the root. --- sys/amd64/amd64/legacy.c | 57 +++++++++++++++++++++++++++++------------------- sys/amd64/amd64/nexus.c | 57 +++++++++++++++++++++++++++++------------------- 2 files changed, 68 insertions(+), 46 deletions(-) (limited to 'sys/amd64') diff --git a/sys/amd64/amd64/legacy.c b/sys/amd64/amd64/legacy.c index 9675ba9..aee5e94 100644 --- a/sys/amd64/amd64/legacy.c +++ b/sys/amd64/amd64/legacy.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.12 1999/07/16 01:00:24 msmith Exp $ + * $Id: nexus.c,v 1.13 1999/07/29 01:02:52 mdodd Exp $ */ /* @@ -132,7 +132,6 @@ DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); static int nexus_probe(device_t dev) { - device_t child; device_quiet(dev); /* suppress attach message for neatness */ @@ -187,29 +186,41 @@ nexus_probe(device_t dev) || rman_manage_region(&mem_rman, 0, ~0)) panic("nexus_probe mem_rman"); - child = device_add_child(dev, "npx", 0, 0); - if (child == 0) - panic("nexus_probe npx"); - - child = device_add_child(dev, "apm", 0, 0); - if (child == 0) - panic("nexus_probe apm"); - - bus_generic_probe(dev); -#if 0 - child = device_add_child(dev, "pcib", 0, 0); - if (child == 0) - panic("nexus_probe pcib"); -#endif - - child = device_add_child(dev, "eisa", 0, 0); - if (child == 0) - panic("nexus_probe eisa"); + return bus_generic_probe(dev); +} - child = device_add_child(dev, "isa", 0, 0); - if (child == 0) - panic("nexus_probe isa"); +static int +nexus_attach(device_t dev) +{ + device_t child; + int rv; + /* + * First, deal with the children we know about already + */ + rv = bus_generic_attach(dev); + if (rv) + return rv; + /* + * And if we didn't see EISA or ISA on a pci bridge, create some + * connection points now so they show up "on motherboard". + */ + if (!devclass_get_device(devclass_find("eisa"), 0)) { + child = device_add_child(dev, "eisa", 0, 0); + if (child == NULL) + panic("nexus_attach eisa"); + rv = device_probe_and_attach(child); + if (rv) + return rv; + } + if (!devclass_get_device(devclass_find("isa"), 0)) { + child = device_add_child(dev, "isa", 0, 0); + if (child == NULL) + panic("nexus_attach isa"); + rv = device_probe_and_attach(child); + if (rv) + return rv; + } return 0; } diff --git a/sys/amd64/amd64/nexus.c b/sys/amd64/amd64/nexus.c index 9675ba9..aee5e94 100644 --- a/sys/amd64/amd64/nexus.c +++ b/sys/amd64/amd64/nexus.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.12 1999/07/16 01:00:24 msmith Exp $ + * $Id: nexus.c,v 1.13 1999/07/29 01:02:52 mdodd Exp $ */ /* @@ -132,7 +132,6 @@ DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); static int nexus_probe(device_t dev) { - device_t child; device_quiet(dev); /* suppress attach message for neatness */ @@ -187,29 +186,41 @@ nexus_probe(device_t dev) || rman_manage_region(&mem_rman, 0, ~0)) panic("nexus_probe mem_rman"); - child = device_add_child(dev, "npx", 0, 0); - if (child == 0) - panic("nexus_probe npx"); - - child = device_add_child(dev, "apm", 0, 0); - if (child == 0) - panic("nexus_probe apm"); - - bus_generic_probe(dev); -#if 0 - child = device_add_child(dev, "pcib", 0, 0); - if (child == 0) - panic("nexus_probe pcib"); -#endif - - child = device_add_child(dev, "eisa", 0, 0); - if (child == 0) - panic("nexus_probe eisa"); + return bus_generic_probe(dev); +} - child = device_add_child(dev, "isa", 0, 0); - if (child == 0) - panic("nexus_probe isa"); +static int +nexus_attach(device_t dev) +{ + device_t child; + int rv; + /* + * First, deal with the children we know about already + */ + rv = bus_generic_attach(dev); + if (rv) + return rv; + /* + * And if we didn't see EISA or ISA on a pci bridge, create some + * connection points now so they show up "on motherboard". + */ + if (!devclass_get_device(devclass_find("eisa"), 0)) { + child = device_add_child(dev, "eisa", 0, 0); + if (child == NULL) + panic("nexus_attach eisa"); + rv = device_probe_and_attach(child); + if (rv) + return rv; + } + if (!devclass_get_device(devclass_find("isa"), 0)) { + child = device_add_child(dev, "isa", 0, 0); + if (child == NULL) + panic("nexus_attach isa"); + rv = device_probe_and_attach(child); + if (rv) + return rv; + } return 0; } -- cgit v1.1