Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ddi.c

    ra69d42e r848e880f  
    220220/** Enable PIO for specified HW resource wrt. to the PIO window.
    221221 *
    222  * @param win      PIO window. May be NULL if the resources are known to be
    223  *                 absolute.
    224  * @param res      Resources specifying the I/O range wrt. to the PIO window.
    225  * @param virt     Virtual address for application's PIO operations.
     222 * @param win        PIO window. May be NULL if the resources are known to be
     223 *                   absolute.
     224 * @param res        Resources specifying the I/O range wrt. to the PIO window.
     225 * @param[out] virt  Virtual address for application's PIO operations.
     226 * @param[out] phys  If non-NULL, physical address of the resource
     227 * @param[out] size  If non-NULL, size of the enabled resource.
    226228 *
    227229 * @return EOK on success.
     
    229231 *
    230232 */
    231 errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt)
     233errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt,
     234    uintptr_t *phys, size_t *size)
    232235{
    233236        uintptr_t addr;
    234         size_t size;
     237        size_t sz;
    235238
    236239        switch (res->type) {
     
    242245                        addr += win->io.base;
    243246                }
    244                 size = res->res.io_range.size;
     247                sz = res->res.io_range.size;
    245248                break;
    246249        case MEM_RANGE:
     
    251254                        addr += win->mem.base;
    252255                }
    253                 size = res->res.mem_range.size;
     256                sz = res->res.mem_range.size;
    254257                break;
    255258        default:
     
    257260        }
    258261
    259         return pio_enable((void *) addr, size, virt);
     262        if (phys)
     263                *phys = addr;
     264        if (size)
     265                *size = sz;
     266
     267        return pio_enable((void *) addr, sz, virt);
    260268}
    261269
Note: See TracChangeset for help on using the changeset viewer.