diff options
-rw-r--r-- | sys/amd64/amd64/legacy.c | 57 | ||||
-rw-r--r-- | sys/amd64/amd64/nexus.c | 57 | ||||
-rw-r--r-- | sys/i386/i386/legacy.c | 57 | ||||
-rw-r--r-- | sys/i386/i386/nexus.c | 57 |
4 files changed, 136 insertions, 92 deletions
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; } diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c index 9675ba9..aee5e94 100644 --- a/sys/i386/i386/legacy.c +++ b/sys/i386/i386/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/i386/i386/nexus.c b/sys/i386/i386/nexus.c index 9675ba9..aee5e94 100644 --- a/sys/i386/i386/nexus.c +++ b/sys/i386/i386/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; } |