Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 May 2007 17:33:30 GMT
From:      Bruce M Simpson <bms@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 119433 for review
Message-ID:  <200705071733.l47HXURF080481@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119433

Change 119433 by bms@bms_anglepoise on 2007/05/07 17:33:27

	Give the nexus device a description.
	Print child resources as they are probed and attached.

Affected files ...

.. //depot/projects/mips2/src/sys/mips/mips/nexus.c#6 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/mips/nexus.c#6 (text+ko) ====

@@ -73,6 +73,7 @@
 static int	nexus_probe(device_t);
 static int	nexus_attach(device_t);
 static int	nexus_print_child(device_t, device_t);
+static int	nexus_print_all_resources(device_t dev);
 static device_t	nexus_add_child(device_t, int, const char *, int);
 static struct resource *
 		nexus_alloc_resource(device_t, device_t, int, int *, u_long,
@@ -110,7 +111,7 @@
 nexus_probe(device_t dev)
 {
 
-	device_quiet(dev);      /* suppress attach message for neatness */
+	device_set_desc(dev, "MIPS32 root nexus");
 
 	irq_rman.rm_start = 0;
 	irq_rman.rm_end = 5;
@@ -154,6 +155,7 @@
 nexus_attach(device_t dev)
 {
 
+	bus_enumerate_hinted_children(dev);
 	bus_generic_probe(dev);
 	bus_generic_attach(dev);
 
@@ -166,11 +168,29 @@
 	int retval = 0;
 
 	retval += bus_print_child_header(bus, child);
-	retval += printf(" on motherboard\n");	/* XXX "motherboard", ick */
+	retval += nexus_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 int
+nexus_print_all_resources(device_t dev)
+{
+	struct nexus_device *ndev = DEVTONX(dev);
+	struct resource_list *rl = &ndev->nx_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 device_t
 nexus_add_child(device_t bus, int order, const char *name, int unit)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705071733.l47HXURF080481>