Lines Matching refs:iores
382 struct bhnd_erom_iores *iores; in bhnd_erom_iores_new() local
384 iores = malloc(sizeof(*iores), M_BHND, M_WAITOK | M_ZERO); in bhnd_erom_iores_new()
385 iores->eio.map = bhnd_erom_iores_map; in bhnd_erom_iores_new()
386 iores->eio.tell = bhnd_erom_iores_tell; in bhnd_erom_iores_new()
387 iores->eio.read = bhnd_erom_iores_read; in bhnd_erom_iores_new()
388 iores->eio.fini = bhnd_erom_iores_fini; in bhnd_erom_iores_new()
390 iores->owner = dev; in bhnd_erom_iores_new()
391 iores->owner_rid = rid; in bhnd_erom_iores_new()
392 iores->mapped = NULL; in bhnd_erom_iores_new()
393 iores->mapped_rid = -1; in bhnd_erom_iores_new()
395 return (&iores->eio); in bhnd_erom_iores_new()
402 struct bhnd_erom_iores *iores; in bhnd_erom_iores_map() local
404 iores = (struct bhnd_erom_iores *)eio; in bhnd_erom_iores_map()
414 if (iores->mapped) { in bhnd_erom_iores_map()
416 if (rman_get_start(iores->mapped->res) == addr && in bhnd_erom_iores_map()
417 rman_get_size(iores->mapped->res) == size) in bhnd_erom_iores_map()
423 bhnd_release_resource(iores->owner, SYS_RES_MEMORY, in bhnd_erom_iores_map()
424 iores->mapped_rid, iores->mapped); in bhnd_erom_iores_map()
425 iores->mapped = NULL; in bhnd_erom_iores_map()
426 iores->mapped_rid = -1; in bhnd_erom_iores_map()
430 iores->mapped_rid = iores->owner_rid; in bhnd_erom_iores_map()
431 iores->mapped = bhnd_alloc_resource(iores->owner, SYS_RES_MEMORY, in bhnd_erom_iores_map()
432 &iores->mapped_rid, addr, addr+size-1, size, in bhnd_erom_iores_map()
434 if (iores->mapped == NULL) { in bhnd_erom_iores_map()
435 iores->mapped_rid = -1; in bhnd_erom_iores_map()
446 struct bhnd_erom_iores *iores = (struct bhnd_erom_iores *)eio; in bhnd_erom_iores_tell() local
448 if (iores->mapped == NULL) in bhnd_erom_iores_tell()
451 *addr = rman_get_start(iores->mapped->res); in bhnd_erom_iores_tell()
452 *size = rman_get_size(iores->mapped->res); in bhnd_erom_iores_tell()
460 struct bhnd_erom_iores *iores = (struct bhnd_erom_iores *)eio; in bhnd_erom_iores_read() local
462 if (iores->mapped == NULL) in bhnd_erom_iores_read()
467 return (bhnd_bus_read_1(iores->mapped, offset)); in bhnd_erom_iores_read()
469 return (bhnd_bus_read_2(iores->mapped, offset)); in bhnd_erom_iores_read()
471 return (bhnd_bus_read_4(iores->mapped, offset)); in bhnd_erom_iores_read()
480 struct bhnd_erom_iores *iores = (struct bhnd_erom_iores *)eio; in bhnd_erom_iores_fini() local
483 if (iores->mapped) { in bhnd_erom_iores_fini()
484 bhnd_release_resource(iores->owner, SYS_RES_MEMORY, in bhnd_erom_iores_fini()
485 iores->mapped_rid, iores->mapped); in bhnd_erom_iores_fini()
486 iores->mapped = NULL; in bhnd_erom_iores_fini()
487 iores->mapped_rid = -1; in bhnd_erom_iores_fini()