Changeset 9e9ced0 in mainline


Ignore:
Timestamp:
2018-05-22T19:06:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d6c0016
Parents:
a86174ec
git-author:
Jakub Jermar <jakub@…> (2018-04-22 12:14:08)
git-committer:
Jakub Jermar <jakub@…> (2018-05-22 19:06:50)
Message:

Return also the size of the enabled resource

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/pci/pciintel/pci.c

    ra86174ec r9e9ced0  
    738738
    739739                if (pio_enable_resource(&bus->pio_win,
    740                     &hw_resources.resources[0],
    741                     (void **) &bus->conf_space)) {
     740                    &hw_resources.resources[0], (void **) &bus->conf_space,
     741                    NULL)) {
    742742                        ddf_msg(LVL_ERROR,
    743743                            "Failed to map configuration space.");
     
    759759
    760760                if (pio_enable_resource(&bus->pio_win,
    761                     &hw_resources.resources[0],
    762                     (void **) &bus->conf_addr_reg)) {
     761                    &hw_resources.resources[0], (void **) &bus->conf_addr_reg,
     762                    NULL)) {
    763763                        ddf_msg(LVL_ERROR,
    764764                            "Failed to enable configuration ports.");
     
    767767                }
    768768                if (pio_enable_resource(&bus->pio_win,
    769                     &hw_resources.resources[1],
    770                     (void **) &bus->conf_data_reg)) {
     769                    &hw_resources.resources[1], (void **) &bus->conf_data_reg,
     770                    NULL)) {
    771771                        ddf_msg(LVL_ERROR,
    772772                            "Failed to enable configuration ports.");
  • uspace/lib/c/generic/ddi.c

    ra86174ec r9e9ced0  
    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] size  If non-NULL, size of the enabled resource.
    226227 *
    227228 * @return EOK on success.
     
    229230 *
    230231 */
    231 errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt)
     232errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt,
     233    size_t *size)
    232234{
    233235        uintptr_t addr;
    234         size_t size;
     236        size_t sz;
    235237
    236238        switch (res->type) {
     
    242244                        addr += win->io.base;
    243245                }
    244                 size = res->res.io_range.size;
     246                sz = res->res.io_range.size;
    245247                break;
    246248        case MEM_RANGE:
     
    251253                        addr += win->mem.base;
    252254                }
    253                 size = res->res.mem_range.size;
     255                sz = res->res.mem_range.size;
    254256                break;
    255257        default:
     
    257259        }
    258260
    259         return pio_enable((void *) addr, size, virt);
     261        if (size)
     262                *size = sz;
     263
     264        return pio_enable((void *) addr, sz, virt);
    260265}
    261266
  • uspace/lib/c/include/ddi.h

    ra86174ec r9e9ced0  
    6464
    6565extern errno_t pio_enable_range(addr_range_t *, void **);
    66 extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **);
     66extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **,
     67    size_t *);
    6768extern errno_t pio_enable(void *, size_t, void **);
    6869extern errno_t pio_disable(void *, size_t);
  • uspace/lib/virtio/virtio-pci.c

    ra86174ec r9e9ced0  
    143143
    144144                rc = pio_enable_resource(&pio_window, &hw_res.resources[j],
    145                     &vdev->bar[i].mapped_base);
     145                    &vdev->bar[i].mapped_base, NULL);
    146146                if (rc == EOK)
    147147                        vdev->bar[i].mapped = true;
Note: See TracChangeset for help on using the changeset viewer.