diff --git a/share/man/man9/BUS_PRINT_CHILD.9 b/share/man/man9/BUS_PRINT_CHILD.9 index 03a5f3d2ce8f..fb9fd9720dff 100644 --- a/share/man/man9/BUS_PRINT_CHILD.9 +++ b/share/man/man9/BUS_PRINT_CHILD.9 @@ -26,7 +26,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: BUS_PRINT_CHILD.9,v 1.1 1998/09/03 21:52:04 dfr Exp $ +.\" $Id: BUS_PRINT_CHILD.9,v 1.2 1999/03/06 17:25:49 bde Exp $ .\" .Dd June 16, 1998 .Os @@ -38,7 +38,7 @@ .Sh SYNOPSIS .Fd #include .Fd #include -.Ft void +.Ft int .Fn BUS_PRINT_CHILD "device_t dev" "device_t child" .Sh DESCRIPTION .Pp @@ -46,9 +46,14 @@ This is called from system code which prints out a description of a device. It should describe the attachment that the child has with the parent. For instance the TurboLaser bus prints which node the device is attached to. +Please see bus_generic_print_child.9 for more information regarding +the proper formatting of the messages printed by BUS_PRINT_CHILD. .Sh SEE ALSO .Xr device 9 , -.Xr driver 9 +.Xr driver 9 , +.Xr BUS_PRINT_CHILD 9 +.Sh RETURN VALUES +The number of characters output. .Sh AUTHORS This man page was written by .An Doug Rabson . diff --git a/share/man/man9/bus_generic_print_child.9 b/share/man/man9/bus_generic_print_child.9 index 15d50a0cb29a..39a459c94cb4 100644 --- a/share/man/man9/bus_generic_print_child.9 +++ b/share/man/man9/bus_generic_print_child.9 @@ -26,7 +26,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: bus_generic_print_child.9,v 1.1 1998/09/03 21:52:05 dfr Exp $ +.\" $Id: bus_generic_print_child.9,v 1.2 1999/03/06 17:25:49 bde Exp $ .\" .Dd June 16, 1998 .Os @@ -40,15 +40,28 @@ for busses .Sh SYNOPSIS .Fd #include .Fd #include -.Ft void +.Ft int .Fn bus_generic_print_child "device_t dev" "device_t child" .Sh DESCRIPTION .Pp -This implementation prints nothing at all. +This implementation prints out the default device announcement message. +Given device 'foo0' on bus 'bar0' where foo0 has the name "FooCard 1234" the +following would be printed: +.Pp +foo0: on bar0 +.Pp +bus_generic_print_child itself calls two functions +.Fn bus_print_child_header +and +.Fn bus_print_child_footer +The former prints "foo0: " and the latter "on bar0". +These routines should be used if possible in your own code if +.Fn bus_generic_print_child +does not completely suit your needs. .Sh SEE ALSO .Xr device 9 -.Sh BUGS -Not terribly useful. +.Sh RETURN VALUES +The number of characters output. .Sh AUTHORS This man page was written by .An Doug Rabson . diff --git a/sys/alpha/tc/ioasic.c b/sys/alpha/tc/ioasic.c index 9b7d87f2e047..5771d222a60a 100644 --- a/sys/alpha/tc/ioasic.c +++ b/sys/alpha/tc/ioasic.c @@ -1,4 +1,4 @@ -/* $Id: ioasic.c,v 1.3 1999/05/10 15:51:23 peter Exp $ */ +/* $Id: ioasic.c,v 1.4 1999/05/10 16:36:42 peter Exp $ */ /* from $NetBSD: ioasic.c,v 1.19 1998/05/27 00:18:13 thorpej Exp $ */ /*- @@ -99,7 +99,7 @@ struct ioasic_softc { static int ioasic_probe(device_t dev); static int ioasic_attach(device_t dev); static driver_intr_t ioasic_intrnull; -static void ioasic_print_child(device_t bus, device_t dev); +static int ioasic_print_child(device_t bus, device_t dev); static void ioasic_lance_dma_setup(void *v); int ioasic_intr __P((void *)); @@ -239,13 +239,17 @@ ioasic_intrnull(void *val) (u_long)val); } -static void +static int ioasic_print_child(device_t bus, device_t dev) { struct ioasic_dev *ioasic = device_get_ivars(dev); - printf(" at %s%d, offset 0x%x", - device_get_name(bus), device_get_unit(bus), - ioasic->iad_offset); + int retval = 0; + + retval += bus_print_child_header(bus, dev); + retval += printf(" on %s offset 0x%x\n", device_get_nameunit(bus), + ioasic->iad_offset); + + return (retval); } char * diff --git a/sys/alpha/tc/tc.c b/sys/alpha/tc/tc.c index 14703a373a94..b6b51db3e77b 100644 --- a/sys/alpha/tc/tc.c +++ b/sys/alpha/tc/tc.c @@ -1,4 +1,4 @@ -/* $Id: tc.c,v 1.4 1999/05/10 15:53:33 peter Exp $ */ +/* $Id: tc.c,v 1.5 1999/07/01 22:49:03 peter Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * All rights reserved. @@ -72,7 +72,6 @@ static tc_offset_t tc_slot_romoffs[NTC_ROMOFFS] = { static int tc_probe(device_t dev); static int tc_attach(device_t dev); -static void tc_print_child(device_t bus, device_t dev); int tc_checkslot( tc_addr_t slotbase, char *namep); static device_method_t tc_methods[] = { @@ -80,7 +79,7 @@ static device_method_t tc_methods[] = { DEVMETHOD(device_probe, tc_probe), DEVMETHOD(device_attach, tc_attach), /* Bus interface */ - DEVMETHOD(bus_print_child, tc_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), { 0, 0 }, }; @@ -684,14 +683,5 @@ tc_intr_disestablish(dev, cookie) (*sc->sc_intr_disestablish)(device_get_parent(dev), cookie); } - - -static void -tc_print_child(device_t bus, device_t dev) -{ - printf(" at %s%d", - device_get_name(bus), device_get_unit(bus)); -} - DRIVER_MODULE(tc, tcasic, tc_driver, tc_devclass, 0, 0); diff --git a/sys/alpha/tc/tcasic.c b/sys/alpha/tc/tcasic.c index 817ce10c2c40..683f3d368b93 100644 --- a/sys/alpha/tc/tcasic.c +++ b/sys/alpha/tc/tcasic.c @@ -1,4 +1,4 @@ -/* $Id: tcasic.c,v 1.3 1999/05/08 21:58:49 dfr Exp $ */ +/* $Id: tcasic.c,v 1.4 1999/05/10 15:54:58 peter Exp $ */ /* from $NetBSD: tcasic.c,v 1.23 1998/05/14 00:01:31 thorpej Exp $ */ /* @@ -56,13 +56,12 @@ struct tcasic_softc { static int tcasic_probe(device_t dev); static int tcasic_attach(device_t dev); -static void tcasic_print_child(device_t bus, device_t dev); static device_method_t tcasic_methods[] = { /* Device interface */ DEVMETHOD(device_probe, tcasic_probe), DEVMETHOD(device_attach, tcasic_attach), - DEVMETHOD(bus_print_child, tcasic_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), { 0, 0 } }; @@ -97,14 +96,5 @@ tcasic_attach(device_t dev) return 0; } -static void -tcasic_print_child(device_t bus, device_t dev) -{ - printf(" at %s%d", - device_get_name(bus), device_get_unit(bus)); -} - - - DRIVER_MODULE(tcasic, root, tcasic_driver, tcasic_devclass, 0, 0); diff --git a/sys/alpha/tc/tcds.c b/sys/alpha/tc/tcds.c index 1229c7e92df7..6736fec74768 100644 --- a/sys/alpha/tc/tcds.c +++ b/sys/alpha/tc/tcds.c @@ -1,4 +1,4 @@ -/* $Id: tcds.c,v 1.1 1998/08/20 08:27:11 dfr Exp $ */ +/* $Id: tcds.c,v 1.2 1999/05/08 21:58:50 dfr Exp $ */ /* from $NetBSD: tcds.c,v 1.25 1998/05/26 23:43:05 thorpej Exp $ */ /*- @@ -105,7 +105,6 @@ struct tcds_softc { static int tcds_probe(device_t dev); static int tcds_attach(device_t dev); static void tcds_intrnull __P((void *)); -static void tcds_print_child(device_t bus, device_t dev); static void tcds_lance_dma_setup(void *v); static int tcds_intr __P((void *)); @@ -115,7 +114,7 @@ static device_method_t tcds_methods[] = { /* Device interface */ DEVMETHOD(device_probe, tcds_probe), DEVMETHOD(device_attach, tcds_attach), - DEVMETHOD(bus_print_child, tcds_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), { 0, 0 } }; @@ -446,13 +445,5 @@ tcds_intr(val) return 1; } -static void -tcds_print_child(device_t bus, device_t dev) -{ - struct tcds_dev *ioasic = device_get_ivars(dev); - printf(" at %s%d", device_get_name(bus), device_get_unit(bus)); -} - - DRIVER_MODULE(tcds, tc, tcds_driver, tcds_devclass, 0, 0); diff --git a/sys/alpha/tlsb/gbus.c b/sys/alpha/tlsb/gbus.c index 2d4ad304a204..4213df6b812b 100644 --- a/sys/alpha/tlsb/gbus.c +++ b/sys/alpha/tlsb/gbus.c @@ -78,7 +78,7 @@ static devclass_t gbus_devclass; * Device methods */ static int gbus_probe(device_t dev); -static void gbus_print_child(device_t dev, device_t child); +static int gbus_print_child(device_t dev, device_t child); static int gbus_read_ivar(device_t dev, device_t child, int which, u_long *result);; static device_method_t gbus_methods[] = { @@ -128,14 +128,17 @@ gbus_probe(device_t dev) return 0; } -static void +static int gbus_print_child(device_t bus, device_t dev) { struct gbus_device* gdev = DEVTOGBUS(dev); + int retval = 0; - printf(" at %s%d offset 0x%x", - device_get_name(bus), device_get_unit(bus), - gdev->gd_offset); + retval += bus_print_child_header(bus, dev); + retval += printf(" on %s offset 0x%x\n", device_get_nameunit(bus), + gdev->gd_offset); + + return (retval); } static int diff --git a/sys/alpha/tlsb/kftxx.c b/sys/alpha/tlsb/kftxx.c index bfcd2e07dbd6..889f97d575b5 100644 --- a/sys/alpha/tlsb/kftxx.c +++ b/sys/alpha/tlsb/kftxx.c @@ -1,4 +1,4 @@ -/* $Id: kftxx.c,v 1.4 1998/11/15 18:25:16 dfr Exp $ */ +/* $Id: kftxx.c,v 1.5 1999/05/08 21:58:53 dfr Exp $ */ /* $NetBSD: kftxx.c,v 1.9 1998/05/14 00:01:32 thorpej Exp $ */ /* @@ -75,7 +75,7 @@ static devclass_t kft_devclass; * Device methods */ static int kft_probe(device_t dev); -static void kft_print_child(device_t dev, device_t child); +static int kft_print_child(device_t dev, device_t child); static int kft_read_ivar(device_t dev, device_t child, int which, u_long *result);; static device_method_t kft_methods[] = { @@ -151,14 +151,17 @@ kft_probe(device_t dev) return 0; } -static void +static int kft_print_child(device_t bus, device_t dev) { struct kft_device *kd = (struct kft_device*) device_get_ivars(dev); + int retval = 0; - printf(" at %s%d hose %d", - device_get_name(bus), device_get_unit(bus), - kd->kd_hosenum); + retval += bus_print_child_header(bus, dev); + retval += printf(" on %s hose %d\n", device_get_nameunit(bus), + kd->kd_hosenum); + + return (retval); } static int diff --git a/sys/alpha/tlsb/tlsb.c b/sys/alpha/tlsb/tlsb.c index f1097b20a4a1..8463ab1181a1 100644 --- a/sys/alpha/tlsb/tlsb.c +++ b/sys/alpha/tlsb/tlsb.c @@ -93,7 +93,7 @@ static devclass_t tlsb_devclass; * Device methods */ static int tlsb_probe(device_t dev); -static void tlsb_print_child(device_t dev, device_t child); +static int tlsb_print_child(device_t dev, device_t child); static int tlsb_read_ivar(device_t dev, device_t child, int which, u_long* result); static int tlsb_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, @@ -230,15 +230,17 @@ tlsb_probe(device_t dev) return 0; } -static void +static int tlsb_print_child(device_t dev, device_t child) { struct tlsb_device* tdev = DEVTOTLSB(child); + int retval = 0; - printf(" at %s%d node %d", - device_get_name(dev), - device_get_unit(dev), - tdev->td_node); + retval += bus_print_child_header(dev, child); + retval += printf(" at %s node %d\n", device_get_nameunit(dev), + tdev->td_node); + + return (retval); } static int diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 55171a4b74b3..337706d6782a 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: zs_tlsb.c,v 1.13 1999/05/30 16:50:54 phk Exp $ + * $Id: zs_tlsb.c,v 1.14 1999/07/04 14:58:04 phk Exp $ */ /* * This driver is a hopeless hack to get the SimOS console working. A real @@ -405,7 +405,7 @@ struct zsc_softc { static int zsc_tlsb_probe(device_t dev); static int zsc_tlsb_attach(device_t dev); -static void zsc_tlsb_print_child(device_t dev, device_t child); +static int zsc_tlsb_print_child(device_t dev, device_t child); static driver_intr_t zsc_tlsb_intr; @@ -485,12 +485,16 @@ zsc_tlsb_attach(device_t dev) return 0; } -static void +static int zsc_tlsb_print_child(device_t bus, device_t dev) { - printf(" at %s%d channel %c", - device_get_name(bus), device_get_unit(bus), - 'A' + (device_get_unit(dev) & 1)); + int retval = 0; + + retval += bus_print_child_header(bus, dev); + retval += printf(" on %s channel %c\n", device_get_nameunit(bus), + 'A' + (device_get_unit(dev) & 1)); + + return (retval); } static void diff --git a/sys/amd64/amd64/legacy.c b/sys/amd64/amd64/legacy.c index b0bd75666f9d..9675ba993f5a 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.11 1999/05/30 10:50:57 dfr Exp $ + * $Id: nexus.c,v 1.12 1999/07/16 01:00:24 msmith Exp $ */ /* @@ -74,7 +74,7 @@ static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); -static void nexus_print_child(device_t, device_t); +static int nexus_print_child(device_t, device_t); static device_t nexus_add_child(device_t bus, int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, @@ -213,10 +213,15 @@ nexus_probe(device_t dev) return 0; } -static void +static int nexus_print_child(device_t bus, device_t child) { - printf(" on motherboard"); + int retval = 0; + + retval += bus_print_child_header(bus, child); + retval += printf(" on motherboard\n"); + + return (retval); } static device_t diff --git a/sys/amd64/amd64/nexus.c b/sys/amd64/amd64/nexus.c index b0bd75666f9d..9675ba993f5a 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.11 1999/05/30 10:50:57 dfr Exp $ + * $Id: nexus.c,v 1.12 1999/07/16 01:00:24 msmith Exp $ */ /* @@ -74,7 +74,7 @@ static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); -static void nexus_print_child(device_t, device_t); +static int nexus_print_child(device_t, device_t); static device_t nexus_add_child(device_t bus, int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, @@ -213,10 +213,15 @@ nexus_probe(device_t dev) return 0; } -static void +static int nexus_print_child(device_t bus, device_t child) { - printf(" on motherboard"); + int retval = 0; + + retval += bus_print_child_header(bus, child); + retval += printf(" on motherboard\n"); + + return (retval); } static device_t diff --git a/sys/dev/atkbdc/atkbdc_isa.c b/sys/dev/atkbdc/atkbdc_isa.c index 0c57bc3da565..387f9a534153 100644 --- a/sys/dev/atkbdc/atkbdc_isa.c +++ b/sys/dev/atkbdc/atkbdc_isa.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atkbdc_isa.c,v 1.8 1999/05/30 11:12:27 dfr Exp $ + * $Id: atkbdc_isa.c,v 1.9 1999/06/29 17:35:09 yokota Exp $ */ #include "atkbdc.h" @@ -59,7 +59,7 @@ devclass_t atkbdc_devclass; static int atkbdc_probe(device_t dev); static int atkbdc_attach(device_t dev); -static void atkbdc_print_child(device_t bus, device_t dev); +static int atkbdc_print_child(device_t bus, device_t dev); static int atkbdc_read_ivar(device_t bus, device_t dev, int index, u_long *val); static int atkbdc_write_ivar(device_t bus, device_t dev, int index, @@ -201,19 +201,22 @@ atkbdc_attach(device_t dev) return 0; } -static void +static int atkbdc_print_child(device_t bus, device_t dev) { atkbdc_device_t *kbdcdev; + int retval = 0; kbdcdev = (atkbdc_device_t *)device_get_ivars(dev); + retval += bus_print_child_header(bus, dev); if (kbdcdev->flags != 0) - printf(" flags 0x%x", kbdcdev->flags); + retval += printf(" flags 0x%x", kbdcdev->flags); if (kbdcdev->irq != -1) - printf(" irq %d", kbdcdev->irq); + retval += printf(" irq %d", kbdcdev->irq); + retval += bus_print_child_footer(bus, dev); - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); + return (retval); } static int diff --git a/sys/dev/atkbdc/atkbdc_subr.c b/sys/dev/atkbdc/atkbdc_subr.c index 0c57bc3da565..387f9a534153 100644 --- a/sys/dev/atkbdc/atkbdc_subr.c +++ b/sys/dev/atkbdc/atkbdc_subr.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atkbdc_isa.c,v 1.8 1999/05/30 11:12:27 dfr Exp $ + * $Id: atkbdc_isa.c,v 1.9 1999/06/29 17:35:09 yokota Exp $ */ #include "atkbdc.h" @@ -59,7 +59,7 @@ devclass_t atkbdc_devclass; static int atkbdc_probe(device_t dev); static int atkbdc_attach(device_t dev); -static void atkbdc_print_child(device_t bus, device_t dev); +static int atkbdc_print_child(device_t bus, device_t dev); static int atkbdc_read_ivar(device_t bus, device_t dev, int index, u_long *val); static int atkbdc_write_ivar(device_t bus, device_t dev, int index, @@ -201,19 +201,22 @@ atkbdc_attach(device_t dev) return 0; } -static void +static int atkbdc_print_child(device_t bus, device_t dev) { atkbdc_device_t *kbdcdev; + int retval = 0; kbdcdev = (atkbdc_device_t *)device_get_ivars(dev); + retval += bus_print_child_header(bus, dev); if (kbdcdev->flags != 0) - printf(" flags 0x%x", kbdcdev->flags); + retval += printf(" flags 0x%x", kbdcdev->flags); if (kbdcdev->irq != -1) - printf(" irq %d", kbdcdev->irq); + retval += printf(" irq %d", kbdcdev->irq); + retval += bus_print_child_footer(bus, dev); - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); + return (retval); } static int diff --git a/sys/dev/bktr/bktr_i2c.c b/sys/dev/bktr/bktr_i2c.c index eec0642de1df..a3a1fdd737da 100644 --- a/sys/dev/bktr/bktr_i2c.c +++ b/sys/dev/bktr/bktr_i2c.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bt848_i2c.c,v 1.4 1999/05/10 10:08:05 roger Exp $ + * $Id: bt848_i2c.c,v 1.5 1999/07/03 20:17:01 peter Exp $ * */ @@ -91,7 +91,6 @@ struct bt_data btdata[NBKTR]; static int bti2c_probe(device_t); static int bti2c_attach(device_t); -static void bti2c_print_child(device_t, device_t); static int bti2c_iic_callback(device_t, int, caddr_t *); static void bti2c_iic_setlines(device_t, int, int); @@ -111,7 +110,7 @@ static device_method_t bti2c_methods[] = { DEVMETHOD(device_attach, bti2c_attach), /* bus interface */ - DEVMETHOD(bus_print_child, bti2c_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), /* iicbb interface */ DEVMETHOD(iicbb_callback, bti2c_iic_callback), @@ -193,14 +192,6 @@ bti2c_attach(device_t dev) return (0); } -static void -bti2c_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); - - return; -} - static int bti2c_smb_callback(device_t dev, int index, caddr_t *data) { diff --git a/sys/dev/eisa/eisaconf.c b/sys/dev/eisa/eisaconf.c index 5fa11139904d..53650a148efe 100644 --- a/sys/dev/eisa/eisaconf.c +++ b/sys/dev/eisa/eisaconf.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: eisaconf.c,v 1.46 1999/06/22 09:44:00 peter Exp $ + * $Id: eisaconf.c,v 1.47 1999/07/11 13:42:35 dfr Exp $ */ #include "opt_eisa.h" @@ -212,12 +212,17 @@ eisa_probe_nomatch(device_t dev, device_t child) return; } -static void +static int eisa_print_child(device_t dev, device_t child) { - /* XXX print resource descriptions? */ - printf(" at slot %d", eisa_get_slot(child)); - printf(" on %s", device_get_nameunit(dev)); + int retval = 0; + + bus_print_child_header(dev, child); + + retval += printf(" on %s slot %d", device_get_nameunit(dev), + eisa_get_slot(child)); + + return (retval); } static int diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 597d2daf4543..eaa5b0f58f79 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -47,7 +47,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.148 1999/07/04 14:58:32 phk Exp $ + * $Id: fd.c,v 1.149 1999/07/21 12:19:44 joerg Exp $ * */ @@ -757,11 +757,16 @@ fdc_attach(device_t dev) return (bus_generic_attach(dev)); } -static void +static int fdc_print_child(device_t me, device_t child) { - printf(" at %s%d drive %d", device_get_name(me), device_get_unit(me), + int retval = 0; + + retval += bus_print_child_header(me, child); + retval += printf(" on %s drive %d\n", device_get_nameunit(me), *(int *)device_get_ivars(child)); + + return (retval); } static int diff --git a/sys/dev/ida/ida_pci.c b/sys/dev/ida/ida_pci.c index 23446f106f11..6f5e260e0515 100644 --- a/sys/dev/ida/ida_pci.c +++ b/sys/dev/ida/ida_pci.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ida_pci.c,v 1.1 1999/06/24 03:32:07 jlemon Exp $ + * $Id: ida_pci.c,v 1.2 1999/07/03 20:17:02 peter Exp $ */ #include @@ -69,13 +69,12 @@ static struct { static int ida_pci_probe(device_t dev); static int ida_pci_attach(device_t dev); -static void ida_pci_print_child(device_t bus, device_t dev); static device_method_t ida_pci_methods[] = { DEVMETHOD(device_probe, ida_pci_probe), DEVMETHOD(device_attach, ida_pci_attach), - DEVMETHOD(bus_print_child, ida_pci_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), { 0, 0 } }; @@ -185,10 +184,4 @@ ida_pci_attach(device_t dev) return (0); } -static void -ida_pci_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); -} - DRIVER_MODULE(ida, pci, ida_pci_driver, ida_devclass, 0, 0); diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c index 1502ca4b23d5..df46c1ad859e 100644 --- a/sys/dev/iicbus/iicbb.c +++ b/sys/dev/iicbus/iicbb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: iicbb.c,v 1.3 1999/01/28 15:50:24 roger Exp $ + * $Id: iicbb.c,v 1.4 1999/05/08 21:59:04 dfr Exp $ * */ @@ -70,7 +70,7 @@ struct iicbb_softc { static int iicbb_probe(device_t); static int iicbb_attach(device_t); -static void iicbb_print_child(device_t, device_t); +static int iicbb_print_child(device_t, device_t); static int iicbb_callback(device_t, int, caddr_t); static int iicbb_start(device_t, u_char, int); @@ -119,27 +119,28 @@ static int iicbb_attach(device_t dev) return (0); } -static void +static int iicbb_print_child(device_t bus, device_t dev) { int error; + int retval = 0; u_char oldaddr; + retval += bus_print_child_header(bus, dev); /* retrieve the interface I2C address */ error = IICBB_RESET(device_get_parent(bus), IIC_FASTEST, 0, &oldaddr); if (error == IIC_ENOADDR) { - printf(" on %s%d master-only", device_get_name(bus), - device_get_unit(bus)); - + retval += printf(" on %s master-only\n", + device_get_nameunit(bus)); } else { /* restore the address */ IICBB_RESET(device_get_parent(bus), IIC_FASTEST, oldaddr, NULL); - printf(" on %s%d addr 0x%x", device_get_name(bus), - device_get_unit(bus), oldaddr & 0xff); + retval += printf(" on %s addr 0x%x\n", + device_get_nameunit(bus), oldaddr & 0xff); } - return; + return (retval); } #define I2C_SET(dev,ctrl,data) \ diff --git a/sys/dev/iicbus/iicbus.c b/sys/dev/iicbus/iicbus.c index 50e1dd19d51c..e97cbfb0cde6 100644 --- a/sys/dev/iicbus/iicbus.c +++ b/sys/dev/iicbus/iicbus.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: iicbus.c,v 1.8 1999/04/11 02:55:52 eivind Exp $ + * $Id: iicbus.c,v 1.9 1999/05/08 21:59:04 dfr Exp $ * */ @@ -92,7 +92,7 @@ static devclass_t iicbus_devclass; */ static int iicbus_probe(device_t); static int iicbus_attach(device_t); -static void iicbus_print_child(device_t, device_t); +static int iicbus_print_child(device_t, device_t); static int iicbus_read_ivar(device_t , device_t, int, u_long *); static int iicbus_write_ivar(device_t , device_t, int, u_long); @@ -231,27 +231,29 @@ iicbus_null_repeated_start(device_t dev, u_char addr) return (IIC_ENOTSUPP); } -static void +static int iicbus_print_child(device_t bus, device_t dev) { struct iicbus_device* iicdev = DEVTOIICBUS(dev); + int retval = 0; + + retval += bus_print_child_header(bus, dev); switch (iicdev->iicd_class) { case IICBUS_DEVICE_CLASS: - printf(" on %s%d addr 0x%x", device_get_name(bus), - device_get_unit(bus), iicdev->iicd_addr); + retval += printf(" on %s addr 0x%x\n", + device_get_nameunit(bus), iicdev->iicd_addr); break; case IICBUS_DRIVER_CLASS: - printf(" on %s%d", device_get_name(bus), - device_get_unit(bus)); + retval += bus_print_child_footer(bus, dev); break; default: - panic("%s: unknown class!", __FUNCTION__); + panic("%s: unknown class!\n", __FUNCTION__); } - return; + return (retval); } static int diff --git a/sys/dev/iicbus/iicsmb.c b/sys/dev/iicbus/iicsmb.c index 4319ca0ba4c0..4cea0b5dc2a7 100644 --- a/sys/dev/iicbus/iicsmb.c +++ b/sys/dev/iicbus/iicsmb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: iicsmb.c,v 1.2 1998/10/31 11:31:07 nsouch Exp $ + * $Id: iicsmb.c,v 1.3 1999/05/08 21:59:05 dfr Exp $ * */ @@ -83,7 +83,6 @@ struct iicsmb_softc { static int iicsmb_probe(device_t); static int iicsmb_attach(device_t); -static void iicsmb_print_child(device_t, device_t); static void iicsmb_intr(device_t dev, int event, char *buf); static int iicsmb_callback(device_t dev, int index, caddr_t data); @@ -106,7 +105,7 @@ static device_method_t iicsmb_methods[] = { DEVMETHOD(device_attach, iicsmb_attach), /* bus interface */ - DEVMETHOD(bus_print_child, iicsmb_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), /* iicbus interface */ DEVMETHOD(iicbus_intr, iicsmb_intr), @@ -157,14 +156,6 @@ iicsmb_attach(device_t dev) return (0); } -static void -iicsmb_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); - - return; -} - /* * iicsmb_intr() * diff --git a/sys/dev/pcf/pcf.c b/sys/dev/pcf/pcf.c index 94d685be8f16..e5498b40b5fd 100644 --- a/sys/dev/pcf/pcf.c +++ b/sys/dev/pcf/pcf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pcf.c,v 1.8 1999/05/06 18:54:18 peter Exp $ + * $Id: pcf.c,v 1.9 1999/05/08 21:59:27 dfr Exp $ * */ #include @@ -103,7 +103,7 @@ struct isa_driver pcfdriver = { static int pcf_probe(device_t); static int pcf_attach(device_t); -static void pcf_print_child(device_t, device_t); +static int pcf_print_child(device_t, device_t); static int pcf_repeated_start(device_t, u_char, int); static int pcf_start(device_t, u_char, int); @@ -219,15 +219,17 @@ pcf_attach(device_t pcfdev) return (0); } -static void +static int pcf_print_child(device_t bus, device_t dev) { struct pcf_softc *pcf = (struct pcf_softc *)device_get_softc(bus); + int retval = 0; - printf(" on %s%d addr 0x%x", device_get_name(bus), - device_get_unit(bus), (int)pcf->pcf_addr); + retval += bus_print_child_header(bus, dev); + retval += printf(" on %s addr 0x%x\n", device_get_nameunit(bus), + (int)pcf->pcf_addr); - return; + return (retval); } /* diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index c6184dac1b9f..78b0cda459f5 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci.c,v 1.112 1999/07/27 05:08:36 mdodd Exp $ + * $Id: pci.c,v 1.113 1999/07/28 07:57:47 dfr Exp $ * */ @@ -1116,18 +1116,26 @@ pci_new_probe(device_t dev) return 0; } -static void +static int pci_print_child(device_t dev, device_t child) { struct pci_devinfo *dinfo; pcicfgregs *cfg; + int retval = 0; dinfo = device_get_ivars(child); cfg = &dinfo->cfg; + + retval += bus_print_child_header(dev, child); + if (cfg->intpin > 0 && cfg->intline != 255) - printf(" irq %d", cfg->intline); - printf(" at device %d.%d", pci_get_slot(child), pci_get_function(child)); - printf(" on %s%d", device_get_name(dev), device_get_unit(dev)); + retval += printf(" irq %d", cfg->intline); + retval += printf(" at device %d.%d", pci_get_slot(child), + pci_get_function(child)); + + retval += bus_print_child_footer(dev, child); + + return (retval); } static void diff --git a/sys/dev/ppbus/lpbb.c b/sys/dev/ppbus/lpbb.c index e3ce6f0d2b56..08f454045821 100644 --- a/sys/dev/ppbus/lpbb.c +++ b/sys/dev/ppbus/lpbb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lpbb.c,v 1.4 1999/01/10 12:04:54 nsouch Exp $ + * $Id: lpbb.c,v 1.5 1999/05/08 21:59:06 dfr Exp $ * */ @@ -62,7 +62,6 @@ static int lpbb_detect(struct lpbb_softc *); static int lpbb_probe(device_t); static int lpbb_attach(device_t); -static void lpbb_print_child(device_t, device_t); static int lpbb_callback(device_t, int, caddr_t *); static void lpbb_setlines(device_t, int, int); @@ -77,7 +76,7 @@ static device_method_t lpbb_methods[] = { DEVMETHOD(device_attach, lpbb_attach), /* bus interface */ - DEVMETHOD(bus_print_child, lpbb_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), /* iicbb interface */ DEVMETHOD(iicbb_callback, lpbb_callback), @@ -307,12 +306,4 @@ lpbb_getdataline(device_t dev) return (getSDA(sc)); } -static void -lpbb_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); - - return; -} - DRIVER_MODULE(lpbb, root, lpbb_driver, lpbb_devclass, 0, 0); diff --git a/sys/dev/smbus/smbus.c b/sys/dev/smbus/smbus.c index cd16f3c58f50..2f2632ed3fc9 100644 --- a/sys/dev/smbus/smbus.c +++ b/sys/dev/smbus/smbus.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: smbus.c,v 1.8 1999/02/13 17:57:19 nsouch Exp $ + * $Id: smbus.c,v 1.9 1999/05/08 21:59:08 dfr Exp $ * */ #include @@ -64,7 +64,6 @@ static devclass_t smbus_devclass; */ static int smbus_probe(device_t); static int smbus_attach(device_t); -static void smbus_print_child(device_t, device_t); #if 0 static int smbus_read_ivar(device_t , device_t, int, u_long *); @@ -78,7 +77,7 @@ static device_method_t smbus_methods[] = { DEVMETHOD(device_shutdown, bus_generic_shutdown), /* bus interface */ - DEVMETHOD(bus_print_child, smbus_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), @@ -132,15 +131,6 @@ smbus_generic_intr(device_t dev, u_char devaddr, char low, char high) return; } -static void -smbus_print_child(device_t bus, device_t dev) -{ - - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); - - return; -} - #if 0 static int smbus_read_ivar(device_t bus, device_t dev, int index, u_long* result) diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 53f1b0d2c843..5439dc5fc1a2 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1224,30 +1224,34 @@ usbd_get_endpoint_descriptor(iface, address) } #if defined(__FreeBSD__) -void +int usbd_print_child(device_t parent, device_t child) { /* struct usb_softc *sc = device_get_softc(child); */ + int retval = 0; - printf(" at %s%d", device_get_name(parent), device_get_unit(parent)); + retval += bus_print_child_header(parent, child); + retval += bus_print_child_footer(parent, child); /* XXX How do we get to the usbd_device_handle??? usbd_device_handle dev = invalidadosch; - printf(" addr %d", dev->addr); + retval += printf(" addr %d\n", dev->addr); if (bootverbose) { if (dev->lowspeed) - printf(", lowspeed"); + retval += printf(", lowspeed"); if (dev->self_powered) - printf(", self powered"); + retval += printf(", self powered"); else - printf(", %dmA", dev->power); - printf(", config %d", dev->config); + retval += printf(", %dmA", dev->power); + retval += printf(", config %d", dev->config); } */ + + return (retval); } /* Reconfigure all the USB busses in the system. */ diff --git a/sys/i386/eisa/eisaconf.c b/sys/i386/eisa/eisaconf.c index 5fa11139904d..53650a148efe 100644 --- a/sys/i386/eisa/eisaconf.c +++ b/sys/i386/eisa/eisaconf.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: eisaconf.c,v 1.46 1999/06/22 09:44:00 peter Exp $ + * $Id: eisaconf.c,v 1.47 1999/07/11 13:42:35 dfr Exp $ */ #include "opt_eisa.h" @@ -212,12 +212,17 @@ eisa_probe_nomatch(device_t dev, device_t child) return; } -static void +static int eisa_print_child(device_t dev, device_t child) { - /* XXX print resource descriptions? */ - printf(" at slot %d", eisa_get_slot(child)); - printf(" on %s", device_get_nameunit(dev)); + int retval = 0; + + bus_print_child_header(dev, child); + + retval += printf(" on %s slot %d", device_get_nameunit(dev), + eisa_get_slot(child)); + + return (retval); } static int diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c index b0bd75666f9d..9675ba993f5a 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.11 1999/05/30 10:50:57 dfr Exp $ + * $Id: nexus.c,v 1.12 1999/07/16 01:00:24 msmith Exp $ */ /* @@ -74,7 +74,7 @@ static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); -static void nexus_print_child(device_t, device_t); +static int nexus_print_child(device_t, device_t); static device_t nexus_add_child(device_t bus, int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, @@ -213,10 +213,15 @@ nexus_probe(device_t dev) return 0; } -static void +static int nexus_print_child(device_t bus, device_t child) { - printf(" on motherboard"); + int retval = 0; + + retval += bus_print_child_header(bus, child); + retval += printf(" on motherboard\n"); + + return (retval); } static device_t diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c index b0bd75666f9d..9675ba993f5a 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.11 1999/05/30 10:50:57 dfr Exp $ + * $Id: nexus.c,v 1.12 1999/07/16 01:00:24 msmith Exp $ */ /* @@ -74,7 +74,7 @@ static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); -static void nexus_print_child(device_t, device_t); +static int nexus_print_child(device_t, device_t); static device_t nexus_add_child(device_t bus, int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, @@ -213,10 +213,15 @@ nexus_probe(device_t dev) return 0; } -static void +static int nexus_print_child(device_t bus, device_t child) { - printf(" on motherboard"); + int retval = 0; + + retval += bus_print_child_header(bus, child); + retval += printf(" on motherboard\n"); + + return (retval); } static device_t diff --git a/sys/i386/isa/pcf.c b/sys/i386/isa/pcf.c index 94d685be8f16..e5498b40b5fd 100644 --- a/sys/i386/isa/pcf.c +++ b/sys/i386/isa/pcf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pcf.c,v 1.8 1999/05/06 18:54:18 peter Exp $ + * $Id: pcf.c,v 1.9 1999/05/08 21:59:27 dfr Exp $ * */ #include @@ -103,7 +103,7 @@ struct isa_driver pcfdriver = { static int pcf_probe(device_t); static int pcf_attach(device_t); -static void pcf_print_child(device_t, device_t); +static int pcf_print_child(device_t, device_t); static int pcf_repeated_start(device_t, u_char, int); static int pcf_start(device_t, u_char, int); @@ -219,15 +219,17 @@ pcf_attach(device_t pcfdev) return (0); } -static void +static int pcf_print_child(device_t bus, device_t dev) { struct pcf_softc *pcf = (struct pcf_softc *)device_get_softc(bus); + int retval = 0; - printf(" on %s%d addr 0x%x", device_get_name(bus), - device_get_unit(bus), (int)pcf->pcf_addr); + retval += bus_print_child_header(bus, dev); + retval += printf(" on %s addr 0x%x\n", device_get_nameunit(bus), + (int)pcf->pcf_addr); - return; + return (retval); } /* diff --git a/sys/isa/atkbdc_isa.c b/sys/isa/atkbdc_isa.c index 0c57bc3da565..387f9a534153 100644 --- a/sys/isa/atkbdc_isa.c +++ b/sys/isa/atkbdc_isa.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atkbdc_isa.c,v 1.8 1999/05/30 11:12:27 dfr Exp $ + * $Id: atkbdc_isa.c,v 1.9 1999/06/29 17:35:09 yokota Exp $ */ #include "atkbdc.h" @@ -59,7 +59,7 @@ devclass_t atkbdc_devclass; static int atkbdc_probe(device_t dev); static int atkbdc_attach(device_t dev); -static void atkbdc_print_child(device_t bus, device_t dev); +static int atkbdc_print_child(device_t bus, device_t dev); static int atkbdc_read_ivar(device_t bus, device_t dev, int index, u_long *val); static int atkbdc_write_ivar(device_t bus, device_t dev, int index, @@ -201,19 +201,22 @@ atkbdc_attach(device_t dev) return 0; } -static void +static int atkbdc_print_child(device_t bus, device_t dev) { atkbdc_device_t *kbdcdev; + int retval = 0; kbdcdev = (atkbdc_device_t *)device_get_ivars(dev); + retval += bus_print_child_header(bus, dev); if (kbdcdev->flags != 0) - printf(" flags 0x%x", kbdcdev->flags); + retval += printf(" flags 0x%x", kbdcdev->flags); if (kbdcdev->irq != -1) - printf(" irq %d", kbdcdev->irq); + retval += printf(" irq %d", kbdcdev->irq); + retval += bus_print_child_footer(bus, dev); - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); + return (retval); } static int diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 597d2daf4543..eaa5b0f58f79 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -47,7 +47,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.148 1999/07/04 14:58:32 phk Exp $ + * $Id: fd.c,v 1.149 1999/07/21 12:19:44 joerg Exp $ * */ @@ -757,11 +757,16 @@ fdc_attach(device_t dev) return (bus_generic_attach(dev)); } -static void +static int fdc_print_child(device_t me, device_t child) { - printf(" at %s%d drive %d", device_get_name(me), device_get_unit(me), + int retval = 0; + + retval += bus_print_child_header(me, child); + retval += printf(" on %s drive %d\n", device_get_nameunit(me), *(int *)device_get_ivars(child)); + + return (retval); } static int diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index d2207ac98b1d..35bd28ad6db1 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: isa_common.c,v 1.2 1999/05/28 09:24:58 dfr Exp $ + * $Id: isa_common.c,v 1.3 1999/05/30 11:02:09 dfr Exp $ */ /* * Modifications for Intel architecture by Garrett A. Wollman. @@ -152,24 +152,28 @@ isa_print_resources(struct resource_list *rl, const char *name, int type, } } -static void +static int isa_print_child(device_t bus, device_t dev) { struct isa_device *idev = DEVTOISA(dev); struct resource_list *rl = &idev->id_resources; + int retval = 0; + + retval += bus_print_child_header(bus, dev); if (SLIST_FIRST(rl) || idev->id_flags) - printf(" at"); + retval += printf(" at"); - isa_print_resources(rl, "port", SYS_RES_IOPORT, "%#lx"); - isa_print_resources(rl, "iomem", SYS_RES_MEMORY, "%#lx"); - isa_print_resources(rl, "irq", SYS_RES_IRQ, "%ld"); - isa_print_resources(rl, "drq", SYS_RES_DRQ, "%ld"); + retval += isa_print_resources(rl, "port", SYS_RES_IOPORT, "%#lx"); + retval += isa_print_resources(rl, "iomem", SYS_RES_MEMORY, "%#lx"); + retval += isa_print_resources(rl, "irq", SYS_RES_IRQ, "%ld"); + retval += isa_print_resources(rl, "drq", SYS_RES_DRQ, "%ld"); if (idev->id_flags) - printf(" flags %#x", idev->id_flags); + retval += printf(" flags %#x", idev->id_flags); - printf(" on %s%d", - device_get_name(bus), device_get_unit(bus)); + retval += bus_print_child_footer(bus, dev); + + return (retval); } static int diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 8cc6e5e9f260..869639f074f1 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -23,7 +23,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $Id: bus_if.m,v 1.11 1999/05/28 09:25:08 dfr Exp $ +# $Id: bus_if.m,v 1.12 1999/07/11 13:42:36 dfr Exp $ # INTERFACE bus; @@ -46,9 +46,11 @@ CODE { # This is called from system code which prints out a description of a # device. It should describe the attachment that the child has with # the parent. For instance the TurboLaser bus prints which node the -# device is attached to. +# device is attached to. See bus_generic_print_child.9 for more +# information. +# This method returns the number of characters output. # -METHOD void print_child { +METHOD int print_child { device_t dev; device_t child; }; diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 526b402f7fdd..3ddb950c1311 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: subr_bus.c,v 1.30 1999/07/11 13:42:37 dfr Exp $ + * $Id: subr_bus.c,v 1.31 1999/07/24 09:34:12 dfr Exp $ */ #include @@ -625,17 +625,17 @@ make_device(device_t parent, const char *name, return dev; } -static void +static int device_print_child(device_t dev, device_t child) { - printf("%s%d", device_get_name(child), device_get_unit(child)); + int retval = 0; + if (device_is_alive(child)) { - if (device_get_desc(child)) - printf(": <%s>", device_get_desc(child)); - BUS_PRINT_CHILD(dev, child); + retval += BUS_PRINT_CHILD(dev, child); } else - printf(" not found"); - printf("\n"); + retval += device_printf(child, " not found\n"); + + return (retval); } device_t @@ -1857,10 +1857,36 @@ bus_generic_resume(device_t dev) return 0; } -void +int +bus_print_child_header (device_t dev, device_t child) +{ + int retval = 0; + + if (device_get_desc(child)) { + retval += device_printf(child, "<%s>", + device_get_desc(child)); + } else { + retval += printf("%s", device_get_nameunit(child)) + } + + return (retval); +} + +int +bus_print_child_footer (device_t dev, device_t child) +{ + return(printf(" on %s\n", device_get_nameunit(dev))); +} + +int bus_generic_print_child(device_t dev, device_t child) { - printf(" on %s%d", device_get_name(dev), device_get_unit(dev)); + int retval = 0; + + retval += bus_print_child_header(dev, child); + retval += bus_print_child_footer(dev, child); + + return (retval); } int @@ -2020,9 +2046,10 @@ bus_teardown_intr(device_t dev, struct resource *r, void *cookie) return (BUS_TEARDOWN_INTR(dev->parent, dev, r, cookie)); } -static void +static int root_print_child(device_t dev, device_t child) { + return (0); } static int diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index 6b523cd2890d..b06b7d58fdaf 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -47,7 +47,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.65 1999/06/28 14:01:03 kato Exp $ + * $Id: fd.c,v 1.66 1999/07/04 14:58:44 phk Exp $ * */ @@ -937,11 +937,16 @@ fdc_attach(device_t dev) return (bus_generic_attach(dev)); } -static void +static int fdc_print_child(device_t me, device_t child) { - printf(" at %s%d drive %d", device_get_name(me), device_get_unit(me), - *(int *)device_get_ivars(child)); + int retval = 0; + + retval += bus_print_child_header(me, child); + retval += printf(" on %s drive %d\n", device_get_nameunit(me), + *(int *)device_get_ivars(child)); + + return (retval); } static int diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index 6b523cd2890d..b06b7d58fdaf 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -47,7 +47,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.65 1999/06/28 14:01:03 kato Exp $ + * $Id: fd.c,v 1.66 1999/07/04 14:58:44 phk Exp $ * */ @@ -937,11 +937,16 @@ fdc_attach(device_t dev) return (bus_generic_attach(dev)); } -static void +static int fdc_print_child(device_t me, device_t child) { - printf(" at %s%d drive %d", device_get_name(me), device_get_unit(me), - *(int *)device_get_ivars(child)); + int retval = 0; + + retval += bus_print_child_header(me, child); + retval += printf(" on %s drive %d\n", device_get_nameunit(me), + *(int *)device_get_ivars(child)); + + return (retval); } static int diff --git a/sys/pci/alpm.c b/sys/pci/alpm.c index 5027c20f5951..4f98d1a44299 100644 --- a/sys/pci/alpm.c +++ b/sys/pci/alpm.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: alpm.c,v 1.4 1999/05/09 17:06:38 peter Exp $ + * $Id: alpm.c,v 1.5 1999/07/03 20:17:00 peter Exp $ * */ @@ -147,7 +147,6 @@ struct alsmb_softc { static int alsmb_probe(device_t); static int alsmb_attach(device_t); -static void alsmb_print_child(device_t, device_t); static int alsmb_smb_callback(device_t, int, caddr_t *); static int alsmb_smb_quick(device_t dev, u_char slave, int how); static int alsmb_smb_sendb(device_t dev, u_char slave, char byte); @@ -167,7 +166,7 @@ static device_method_t alsmb_methods[] = { DEVMETHOD(device_attach, alsmb_attach), /* bus interface */ - DEVMETHOD(bus_print_child, alsmb_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), /* smbus interface */ DEVMETHOD(smbus_callback, alsmb_smb_callback), @@ -317,14 +316,6 @@ alsmb_attach(device_t dev) return (0); } -static void -alsmb_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); - - return; -} - static int alsmb_smb_callback(device_t dev, int index, caddr_t *data) { diff --git a/sys/pci/bt848_i2c.c b/sys/pci/bt848_i2c.c index eec0642de1df..a3a1fdd737da 100644 --- a/sys/pci/bt848_i2c.c +++ b/sys/pci/bt848_i2c.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bt848_i2c.c,v 1.4 1999/05/10 10:08:05 roger Exp $ + * $Id: bt848_i2c.c,v 1.5 1999/07/03 20:17:01 peter Exp $ * */ @@ -91,7 +91,6 @@ struct bt_data btdata[NBKTR]; static int bti2c_probe(device_t); static int bti2c_attach(device_t); -static void bti2c_print_child(device_t, device_t); static int bti2c_iic_callback(device_t, int, caddr_t *); static void bti2c_iic_setlines(device_t, int, int); @@ -111,7 +110,7 @@ static device_method_t bti2c_methods[] = { DEVMETHOD(device_attach, bti2c_attach), /* bus interface */ - DEVMETHOD(bus_print_child, bti2c_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), /* iicbb interface */ DEVMETHOD(iicbb_callback, bti2c_iic_callback), @@ -193,14 +192,6 @@ bti2c_attach(device_t dev) return (0); } -static void -bti2c_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); - - return; -} - static int bti2c_smb_callback(device_t dev, int index, caddr_t *data) { diff --git a/sys/pci/ida_pci.c b/sys/pci/ida_pci.c index 23446f106f11..6f5e260e0515 100644 --- a/sys/pci/ida_pci.c +++ b/sys/pci/ida_pci.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ida_pci.c,v 1.1 1999/06/24 03:32:07 jlemon Exp $ + * $Id: ida_pci.c,v 1.2 1999/07/03 20:17:02 peter Exp $ */ #include @@ -69,13 +69,12 @@ static struct { static int ida_pci_probe(device_t dev); static int ida_pci_attach(device_t dev); -static void ida_pci_print_child(device_t bus, device_t dev); static device_method_t ida_pci_methods[] = { DEVMETHOD(device_probe, ida_pci_probe), DEVMETHOD(device_attach, ida_pci_attach), - DEVMETHOD(bus_print_child, ida_pci_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), { 0, 0 } }; @@ -185,10 +184,4 @@ ida_pci_attach(device_t dev) return (0); } -static void -ida_pci_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); -} - DRIVER_MODULE(ida, pci, ida_pci_driver, ida_devclass, 0, 0); diff --git a/sys/pci/intpm.c b/sys/pci/intpm.c index 2bac535c33c8..7163d37998ed 100644 --- a/sys/pci/intpm.c +++ b/sys/pci/intpm.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: intpm.c,v 1.11 1999/07/03 20:17:06 peter Exp $ + * $Id: intpm.c,v 1.12 1999/07/24 19:13:54 nsouch Exp $ */ #include @@ -67,7 +67,6 @@ static struct _pcsid }; static int intsmb_probe(device_t); static int intsmb_attach(device_t); -static void intsmb_print_child(device_t, device_t); static int intsmb_intr(device_t dev); static int intsmb_slvintr(device_t dev); @@ -95,7 +94,7 @@ static device_method_t intpm_methods[]={ DEVMETHOD(device_probe,intsmb_probe), DEVMETHOD(device_attach,intsmb_attach), - DEVMETHOD(bus_print_child, intsmb_print_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(smbus_callback,intsmb_callback), DEVMETHOD(smbus_quick,intsmb_quick), @@ -176,12 +175,6 @@ intsmb_attach(device_t dev) return (0); } -static void -intsmb_print_child(device_t bus, device_t dev) -{ - printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); - return; -} static int intsmb_callback(device_t dev, int index, caddr_t data) { diff --git a/sys/pci/pci.c b/sys/pci/pci.c index c6184dac1b9f..78b0cda459f5 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci.c,v 1.112 1999/07/27 05:08:36 mdodd Exp $ + * $Id: pci.c,v 1.113 1999/07/28 07:57:47 dfr Exp $ * */ @@ -1116,18 +1116,26 @@ pci_new_probe(device_t dev) return 0; } -static void +static int pci_print_child(device_t dev, device_t child) { struct pci_devinfo *dinfo; pcicfgregs *cfg; + int retval = 0; dinfo = device_get_ivars(child); cfg = &dinfo->cfg; + + retval += bus_print_child_header(dev, child); + if (cfg->intpin > 0 && cfg->intline != 255) - printf(" irq %d", cfg->intline); - printf(" at device %d.%d", pci_get_slot(child), pci_get_function(child)); - printf(" on %s%d", device_get_name(dev), device_get_unit(dev)); + retval += printf(" irq %d", cfg->intline); + retval += printf(" at device %d.%d", pci_get_slot(child), + pci_get_function(child)); + + retval += bus_print_child_footer(dev, child); + + return (retval); } static void diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 49ad58ea04d7..f02b3190d84c 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bus.h,v 1.20 1999/07/04 14:58:55 phk Exp $ + * $Id: bus.h,v 1.21 1999/07/24 09:34:10 dfr Exp $ */ #ifndef _SYS_BUS_H_ @@ -174,7 +174,9 @@ int bus_generic_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int bus_generic_detach(device_t dev); void bus_generic_driver_added(device_t dev, driver_t *driver); -void bus_generic_print_child(device_t dev, device_t child); +int bus_print_child_header(device_t dev, device_t child); +int bus_print_child_footer(device_t dev, device_t child); +int bus_generic_print_child(device_t dev, device_t child); int bus_generic_probe(device_t dev); int bus_generic_read_ivar(device_t dev, device_t child, int which, uintptr_t *result);