From owner-svn-src-head@FreeBSD.ORG Mon Mar 17 23:21:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EEC35DE0; Mon, 17 Mar 2014 23:21:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C1A75856; Mon, 17 Mar 2014 23:21:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2HNLVd3011140; Mon, 17 Mar 2014 23:21:31 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2HNLVSS011139; Mon, 17 Mar 2014 23:21:31 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201403172321.s2HNLVSS011139@svn.freebsd.org> From: Adrian Chadd Date: Mon, 17 Mar 2014 23:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263279 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Mar 2014 23:21:32 -0000 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 };