summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2014-03-17 23:21:31 +0000
committeradrian <adrian@FreeBSD.org>2014-03-17 23:21:31 +0000
commitd5f533fd038883ed27840ec652a210040e7892b7 (patch)
tree63a5d481fc8522fbddc058f35bbb9333d8cccd83
parent51675bd43f687bc1b9b0b03892fbc60c62f43a64 (diff)
downloadFreeBSD-src-d5f533fd038883ed27840ec652a210040e7892b7.zip
FreeBSD-src-d5f533fd038883ed27840ec652a210040e7892b7.tar.gz
Implement apb_print_child().
Tested: * AR9344, Atheros DB120 Reference board
-rw-r--r--sys/mips/atheros/apb.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/mips/atheros/apb.c b/sys/mips/atheros/apb.c
index 4427be2..5829e19 100644
--- a/sys/mips/atheros/apb.c
+++ b/sys/mips/atheros/apb.c
@@ -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, device_t child)
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
};
OpenPOWER on IntegriCloud