~sheosi/helenos/lua

« back to all changes in this revision

Viewing changes to uspace/drv/bus/usb/uhci/root_hub.c

  • Committer: Sergio Tortosa (sheosi)
  • Date: 2013-12-22 14:13:23 UTC
  • mfrom: (2032.1.12 mainline)
  • Revision ID: sertorbe@gmail.com-20131222141323-gbiqm4j2w9sbjty5
MergedĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <errno.h>
36
36
#include <str_error.h>
37
37
#include <stdio.h>
 
38
#include <device/hw_res_parsed.h>
38
39
 
39
40
#include <usb/debug.h>
40
41
 
47
48
 * @param[in] reg_size Size of accessible address space.
48
49
 * @return Error code.
49
50
 */
50
 
int rh_init(rh_t *instance, ddf_fun_t *fun, uintptr_t reg_addr, size_t reg_size)
 
51
int
 
52
rh_init(rh_t *instance, ddf_fun_t *fun, addr_range_t *regs, uintptr_t reg_addr,
 
53
    size_t reg_size)
51
54
{
52
55
        assert(instance);
53
56
        assert(fun);
54
57
 
 
58
        /* Crop the PIO window to the absolute address range of UHCI I/O. */
 
59
        instance->pio_window.mem.base = 0;
 
60
        instance->pio_window.mem.size = 0;
 
61
        instance->pio_window.io.base = RNGABS(*regs);
 
62
        instance->pio_window.io.size = RNGSZ(*regs);
 
63
 
55
64
        /* Initialize resource structure */
56
65
        instance->resource_list.count = 1;
57
66
        instance->resource_list.resources = &instance->io_regs;
59
68
        instance->io_regs.type = IO_RANGE;
60
69
        instance->io_regs.res.io_range.address = reg_addr;
61
70
        instance->io_regs.res.io_range.size = reg_size;
 
71
        instance->io_regs.res.io_range.relative = true;
62
72
        instance->io_regs.res.io_range.endianness = LITTLE_ENDIAN;
63
73
 
64
74
        const int ret = ddf_fun_add_match_id(fun, "usb&uhci&root-hub", 100);