svn commit: r187512 - projects/mips/sys/mips/mips
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Tue Jan 20 21:49:30 PST 2009
Author: gonzo
Date: Wed Jan 21 05:49:30 2009
New Revision: 187512
URL: http://svn.freebsd.org/changeset/base/187512
Log:
- Check if maddr/msize hints are there before setting hinted
resources to device
- Check for irq hint too
Modified:
projects/mips/sys/mips/mips/nexus.c
Modified: projects/mips/sys/mips/mips/nexus.c
==============================================================================
--- projects/mips/sys/mips/mips/nexus.c Wed Jan 21 04:19:18 2009 (r187511)
+++ projects/mips/sys/mips/mips/nexus.c Wed Jan 21 05:49:30 2009 (r187512)
@@ -249,6 +249,8 @@ nexus_hinted_child(device_t bus, const c
long maddr;
int msize;
int result;
+ int irq;
+ int mem_hints_count;
child = BUS_ADD_CHILD(bus, 0, dname, dunit);
@@ -256,17 +258,34 @@ nexus_hinted_child(device_t bus, const c
* Set hard-wired resources for hinted child using
* specific RIDs.
*/
- resource_long_value(dname, dunit, "maddr", &maddr);
- resource_int_value(dname, dunit, "msize", &msize);
+ mem_hints_count = 0;
+ if (resource_long_value(dname, dunit, "maddr", &maddr) == 0)
+ mem_hints_count++;
+ if (resource_int_value(dname, dunit, "msize", &msize) == 0)
+ mem_hints_count++;
+
+ /* check if all info for mem resource has been provided */
+ if ((mem_hints_count > 0) && (mem_hints_count < 2)) {
+ printf("Either maddr or msize hint is missing for %s%d\n",
+ dname, dunit);
+ } else if (mem_hints_count) {
+ dprintf("%s: discovered hinted child %s at maddr %p(%d)\n",
+ __func__, device_get_nameunit(child),
+ (void *)(intptr_t)maddr, msize);
+
+ result = bus_set_resource(child, SYS_RES_MEMORY, MIPS_MEM_RID,
+ maddr, msize);
+ if (result != 0) {
+ device_printf(bus,
+ "warning: bus_set_resource() failed\n");
+ }
+ }
- dprintf("%s: discovered hinted child %s at maddr %p(%d)\n",
- __func__, device_get_nameunit(child),
- (void *)(intptr_t)maddr, msize);
-
- result = bus_set_resource(child, SYS_RES_MEMORY, MIPS_MEM_RID,
- maddr, msize);
- if (result != 0) {
- device_printf(bus, "warning: bus_set_resource() failed\n");
+ if (resource_int_value(dname, dunit, "irq", &irq) == 0) {
+ result = bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
+ if (result != 0)
+ device_printf(bus,
+ "warning: bus_set_resource() failed\n");
}
}
More information about the svn-src-projects
mailing list