Changes in uspace/drv/bus/usb/uhcirh/main.c [7de1988c:920d0fc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhcirh/main.c
r7de1988c r920d0fc 48 48 #define NAME "uhcirh" 49 49 50 static int hc_get_my_registers(ddf_dev_t *dev, addr_range_t *io_regs); 50 static int hc_get_my_registers(ddf_dev_t *dev, 51 uintptr_t *io_reg_address, size_t *io_reg_size); 51 52 52 53 static int uhci_rh_dev_add(ddf_dev_t *device); … … 89 90 ddf_dev_get_handle(device)); 90 91 91 addr_range_t regs; 92 uintptr_t io_regs = 0; 93 size_t io_size = 0; 92 94 uhci_root_hub_t *rh = NULL; 93 int r c;95 int ret = EOK; 94 96 95 rc = hc_get_my_registers(device, ®s); 96 if (rc != EOK) { 97 usb_log_error( "Failed to get registers from HC: %s.\n", 98 str_error(rc)); 99 return rc; 100 } 97 #define CHECK_RET_FREE_RH_RETURN(ret, message...) \ 98 if (ret != EOK) { \ 99 usb_log_error(message); \ 100 return ret; \ 101 } else (void)0 101 102 103 ret = hc_get_my_registers(device, &io_regs, &io_size); 104 CHECK_RET_FREE_RH_RETURN(ret, 105 "Failed to get registers from HC: %s.\n", str_error(ret)); 102 106 usb_log_debug("I/O regs at %p (size %zuB).\n", 103 RNGABSPTR(regs), RNGSZ(regs));107 (void *) io_regs, io_size); 104 108 105 109 rh = ddf_dev_data_alloc(device, sizeof(uhci_root_hub_t)); 106 if (rh == NULL) { 107 usb_log_error("Failed to allocate rh driver instance.\n"); 108 return ENOMEM; 109 } 110 ret = (rh == NULL) ? ENOMEM : EOK; 111 CHECK_RET_FREE_RH_RETURN(ret, 112 "Failed to allocate rh driver instance.\n"); 110 113 111 rc = uhci_root_hub_init(rh, ®s, device); 112 if (rc != EOK) { 113 usb_log_error("Failed(%d) to initialize rh driver instance: " 114 "%s.\n", rc, str_error(rc)); 115 return rc; 116 } 114 ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device); 115 CHECK_RET_FREE_RH_RETURN(ret, 116 "Failed(%d) to initialize rh driver instance: %s.\n", 117 ret, str_error(ret)); 117 118 118 119 usb_log_info("Controlling root hub '%s' (%" PRIun ").\n", 119 120 ddf_dev_get_name(device), ddf_dev_get_handle(device)); 120 121 121 return EOK; 122 122 } … … 125 125 * 126 126 * @param[in] dev Device asking for the addresses. 127 * @param[out] io_regs_p Pointer to the device's register range. 127 * @param[out] io_reg_address Base address of the memory range. 128 * @param[out] io_reg_size Size of the memory range. 128 129 * @return Error code. 129 130 */ 130 int hc_get_my_registers(ddf_dev_t *dev, addr_range_t *io_regs_p) 131 int hc_get_my_registers( 132 ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size) 131 133 { 132 134 async_sess_t *parent_sess = … … 149 151 } 150 152 151 if (io_regs_p != NULL) 152 *io_regs_p = hw_res.io_ranges.ranges[0]; 153 if (io_reg_address != NULL) 154 *io_reg_address = hw_res.io_ranges.ranges[0].address; 155 156 if (io_reg_size != NULL) 157 *io_reg_size = hw_res.io_ranges.ranges[0].size; 153 158 154 159 hw_res_list_parsed_clean(&hw_res);
Note:
See TracChangeset
for help on using the changeset viewer.