| 329 | } |
| 330 | |
| 331 | static struct resource * |
| 332 | localbus_alloc_resource(device_t bus, device_t child, int type, int *rid, |
| 333 | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) |
| 334 | { |
| 335 | struct localbus_devinfo *di; |
| 336 | struct resource_list_entry *rle; |
| 337 | |
| 338 | /* |
| 339 | * Request for the default allocation with a given rid: use resource |
| 340 | * list stored in the local device info. |
| 341 | */ |
| 342 | if (RMAN_IS_DEFAULT_RANGE(start, end)) { |
| 343 | if ((di = device_get_ivars(child)) == NULL) |
| 344 | return (NULL); |
| 345 | |
| 346 | if (type == SYS_RES_IOPORT) |
| 347 | type = SYS_RES_MEMORY; |
| 348 | |
| 349 | rid = &di->di_bank; |
| 350 | rle = resource_list_find(&di->di_res, type, *rid); |
| 351 | if (rle == NULL) { |
| 352 | device_printf(bus, "no default resources for " |
| 353 | "rid = %d, type = %d\n", *rid, type); |
| 354 | return (NULL); |
| 355 | } |
| 356 | start = rle->start; |
| 357 | end = rle->end; |
| 358 | count = rle->count; |
| 359 | } |
| 360 | |
| 361 | return (bus_generic_alloc_resource(bus, child, type, rid, start, end, |
| 362 | count, flags)); |
| 363 | } |
| 364 | |
| 365 | static struct resource_list * |
| 366 | localbus_get_resource_list(device_t bus, device_t child) |
nothing calls this directly
no test coverage detected