Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/fdt/simplebus.c
Show First 20 Lines • Show All 329 Lines • ▼ Show 20 Lines | simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
int j; | int j; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
/* | /* | ||||
* Request for the default allocation with a given rid: use resource | * Request for the default allocation with a given rid: use resource | ||||
* list stored in the local device info. | * list stored in the local device info. | ||||
*/ | */ | ||||
if (RMAN_IS_DEFAULT_RANGE(start, end)) { | if (RMAN_IS_DEFAULT_RANGE(start, end)) { | ||||
jhb: Use ~0 here? (You have mostly used ~0 rather than RM_MAX_END in the rest of the code.) | |||||
if ((di = device_get_ivars(child)) == NULL) | if ((di = device_get_ivars(child)) == NULL) | ||||
return (NULL); | return (NULL); | ||||
if (type == SYS_RES_IOPORT) | if (type == SYS_RES_IOPORT) | ||||
type = SYS_RES_MEMORY; | type = SYS_RES_MEMORY; | ||||
rle = resource_list_find(&di->rl, type, *rid); | rle = resource_list_find(&di->rl, type, *rid); | ||||
if (rle == NULL) { | if (rle == NULL) { | ||||
Show All 17 Lines | for (j = 0; j < sc->nranges; j++) { | ||||
end -= sc->ranges[j].bus; | end -= sc->ranges[j].bus; | ||||
end += sc->ranges[j].host; | end += sc->ranges[j].host; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (j == sc->nranges && sc->nranges != 0) { | if (j == sc->nranges && sc->nranges != 0) { | ||||
if (bootverbose) | if (bootverbose) | ||||
device_printf(bus, "Could not map resource " | device_printf(bus, "Could not map resource " | ||||
"%#lx-%#lx\n", start, end); | "%#jx-%#jx\n", start, end); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
} | } | ||||
return (bus_generic_alloc_resource(bus, child, type, rid, start, end, | return (bus_generic_alloc_resource(bus, child, type, rid, start, end, | ||||
count, flags)); | count, flags)); | ||||
} | } | ||||
static int | static int | ||||
simplebus_print_res(struct simplebus_devinfo *di) | simplebus_print_res(struct simplebus_devinfo *di) | ||||
{ | { | ||||
int rv; | int rv; | ||||
if (di == NULL) | if (di == NULL) | ||||
return (0); | return (0); | ||||
rv = 0; | rv = 0; | ||||
rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#lx"); | rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#jx"); | ||||
rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%ld"); | rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%jd"); | ||||
return (rv); | return (rv); | ||||
} | } | ||||
static void | static void | ||||
simplebus_probe_nomatch(device_t bus, device_t child) | simplebus_probe_nomatch(device_t bus, device_t child) | ||||
{ | { | ||||
const char *name, *type, *compat; | const char *name, *type, *compat; | ||||
Show All 30 Lines |
Use ~0 here? (You have mostly used ~0 rather than RM_MAX_END in the rest of the code.)