Changeset 7de1988c in mainline for uspace/drv/bus/usb/uhcirh
- Timestamp:
- 2013-09-12T20:53:09Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ddd0499d
- Parents:
- 8049b79
- Location:
- uspace/drv/bus/usb/uhcirh
- Files:
-
- 3 edited
-
main.c (modified) (6 diffs)
-
root_hub.c (modified) (2 diffs)
-
root_hub.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhcirh/main.c
r8049b79 r7de1988c 48 48 #define NAME "uhcirh" 49 49 50 static int hc_get_my_registers(ddf_dev_t *dev, 51 uintptr_t *io_reg_address, size_t *io_reg_size); 50 static int hc_get_my_registers(ddf_dev_t *dev, addr_range_t *io_regs); 52 51 53 52 static int uhci_rh_dev_add(ddf_dev_t *device); … … 90 89 ddf_dev_get_handle(device)); 91 90 92 uintptr_t io_regs = 0; 93 size_t io_size = 0; 91 addr_range_t regs; 94 92 uhci_root_hub_t *rh = NULL; 95 93 int rc; 96 94 97 rc = hc_get_my_registers(device, & io_regs, &io_size);95 rc = hc_get_my_registers(device, ®s); 98 96 if (rc != EOK) { 99 97 usb_log_error( "Failed to get registers from HC: %s.\n", … … 103 101 104 102 usb_log_debug("I/O regs at %p (size %zuB).\n", 105 (void *) io_regs, io_size);103 RNGABSPTR(regs), RNGSZ(regs)); 106 104 107 105 rh = ddf_dev_data_alloc(device, sizeof(uhci_root_hub_t)); … … 111 109 } 112 110 113 rc = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);111 rc = uhci_root_hub_init(rh, ®s, device); 114 112 if (rc != EOK) { 115 113 usb_log_error("Failed(%d) to initialize rh driver instance: " … … 127 125 * 128 126 * @param[in] dev Device asking for the addresses. 129 * @param[out] io_reg_address Base address of the memory range. 130 * @param[out] io_reg_size Size of the memory range. 127 * @param[out] io_regs_p Pointer to the device's register range. 131 128 * @return Error code. 132 129 */ 133 int hc_get_my_registers( 134 ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size) 130 int hc_get_my_registers(ddf_dev_t *dev, addr_range_t *io_regs_p) 135 131 { 136 132 async_sess_t *parent_sess = … … 153 149 } 154 150 155 if (io_reg_address != NULL) 156 *io_reg_address = hw_res.io_ranges.ranges[0].address; 157 158 if (io_reg_size != NULL) 159 *io_reg_size = hw_res.io_ranges.ranges[0].size; 151 if (io_regs_p != NULL) 152 *io_regs_p = hw_res.io_ranges.ranges[0]; 160 153 161 154 hw_res_list_parsed_clean(&hw_res); -
uspace/drv/bus/usb/uhcirh/root_hub.c
r8049b79 r7de1988c 36 36 #include <ddi.h> 37 37 #include <usb/debug.h> 38 #include <device/hw_res_parsed.h> 38 39 39 40 #include "root_hub.h" … … 42 43 * 43 44 * @param[in] instance Driver memory structure to use. 44 * @param[in] addr Address of I/O registers. 45 * @param[in] size Size of available I/O space. 45 * @param[in] io_regs Range of I/O registers. 46 46 * @param[in] rh Pointer to DDF instance of the root hub driver. 47 47 * @return Error code. 48 48 */ 49 int uhci_root_hub_init( 50 uhci_root_hub_t *instance, void *addr, size_t size,ddf_dev_t *rh)49 int uhci_root_hub_init(uhci_root_hub_t *instance, addr_range_t *io_regs, 50 ddf_dev_t *rh) 51 51 { 52 port_status_t *regs; 53 52 54 assert(instance); 53 55 assert(rh); 54 56 55 57 /* Allow access to root hub port registers */ 56 assert(sizeof( port_status_t) * UHCI_ROOT_HUB_PORT_COUNT <=size);57 port_status_t *regs; 58 int ret = pio_enable (addr, size, (void**)®s);58 assert(sizeof(*regs) * UHCI_ROOT_HUB_PORT_COUNT <= io_regs->size); 59 60 int ret = pio_enable_range(io_regs, (void **) ®s); 59 61 if (ret < 0) { 60 62 usb_log_error( 61 63 "Failed(%d) to gain access to port registers at %p: %s.\n", 62 ret, regs, str_error(ret));64 ret, RNGABSPTR(*io_regs), str_error(ret)); 63 65 return ret; 64 66 } -
uspace/drv/bus/usb/uhcirh/root_hub.h
r8049b79 r7de1988c 36 36 37 37 #include <ddf/driver.h> 38 #include <device/hw_res_parsed.h> 38 39 39 40 #include "port.h" … … 48 49 } uhci_root_hub_t; 49 50 50 int uhci_root_hub_init( 51 uhci_root_hub_t *instance, void *addr, size_t size,ddf_dev_t *rh);51 int uhci_root_hub_init(uhci_root_hub_t *instance, addr_range_t *regs, 52 ddf_dev_t *rh); 52 53 53 54 void uhci_root_hub_fini(uhci_root_hub_t *instance);
Note:
See TracChangeset
for help on using the changeset viewer.
