Author: adrian Date: Mon Mar 17 23:21:31 2014 New Revision: 263279 URL: http://svnweb.freebsd.org/changeset/base/263279
Log: Implement apb_print_child(). Tested: * AR9344, Atheros DB120 Reference board Modified: head/sys/mips/atheros/apb.c Modified: head/sys/mips/atheros/apb.c ============================================================================== --- head/sys/mips/atheros/apb.c Mon Mar 17 22:37:17 2014 (r263278) +++ head/sys/mips/atheros/apb.c Mon Mar 17 23:21:31 2014 (r263279) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #define dprintf(x, arg...) #endif /* APB_DEBUG */ +#define DEVTOAPB(dev) ((struct apb_ivar *) device_get_ivars(dev)) + static int apb_activate_resource(device_t, device_t, int, int, struct resource *); static device_t apb_add_child(device_t, u_int, const char *, int); @@ -477,6 +479,37 @@ apb_get_resource_list(device_t dev, devi return (&(ivar->resources)); } +static int +apb_print_all_resources(device_t dev) +{ + struct apb_ivar *ndev = DEVTOAPB(dev); + struct resource_list *rl = &ndev->resources; + int retval = 0; + + if (STAILQ_FIRST(rl)) + retval += printf(" at"); + + retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx"); + retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); + + return (retval); +} + +static int +apb_print_child(device_t bus, device_t child) +{ + int retval = 0; + + retval += bus_print_child_header(bus, child); + retval += apb_print_all_resources(child); + if (device_get_flags(child)) + retval += printf(" flags %#x", device_get_flags(child)); + retval += printf(" on %s\n", device_get_nameunit(bus)); + + return (retval); +} + + static device_method_t apb_methods[] = { DEVMETHOD(bus_activate_resource, apb_activate_resource), DEVMETHOD(bus_add_child, apb_add_child), @@ -491,6 +524,7 @@ static device_method_t apb_methods[] = { DEVMETHOD(device_probe, apb_probe), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_print_child, apb_print_child), DEVMETHOD_END }; _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"