Changes in uspace/drv/bus/usb/uhci/uhci.c [795448f:b500d60a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/uhci.c
r795448f rb500d60a 41 41 42 42 #include "uhci.h" 43 44 #include "res.h" 43 #include "pci.h" 44 45 45 #include "hc.h" 46 46 #include "root_hub.h" … … 49 49 * and USB root hub */ 50 50 typedef struct uhci { 51 /** Pointer to DDF represen tation of UHCI host controller */51 /** Pointer to DDF represenation of UHCI host controller */ 52 52 ddf_fun_t *hc_fun; 53 /** Pointer to DDF represen tation of UHCI root hub */53 /** Pointer to DDF represenation of UHCI root hub */ 54 54 ddf_fun_t *rh_fun; 55 55 56 /** Internal driver's represen tation of UHCI host controller */56 /** Internal driver's represenation of UHCI host controller */ 57 57 hc_t hc; 58 /** Internal driver's represen tation of UHCI root hub */58 /** Internal driver's represenation of UHCI root hub */ 59 59 rh_t rh; 60 60 } uhci_t; … … 148 148 int device_setup_uhci(ddf_dev_t *device) 149 149 { 150 if (!device) 151 return EBADMEM; 152 153 uhci_t *instance = ddf_dev_data_alloc(device, sizeof(uhci_t)); 150 assert(device); 151 uhci_t *instance = malloc(sizeof(uhci_t)); 154 152 if (instance == NULL) { 155 153 usb_log_error("Failed to allocate OHCI driver.\n"); … … 160 158 if (ret != EOK) { \ 161 159 if (instance->hc_fun) \ 160 instance->hc_fun->ops = NULL; \ 162 161 instance->hc_fun->driver_data = NULL; \ 163 162 ddf_fun_destroy(instance->hc_fun); \ 164 163 if (instance->rh_fun) {\ 164 instance->rh_fun->ops = NULL; \ 165 165 instance->rh_fun->driver_data = NULL; \ 166 166 ddf_fun_destroy(instance->rh_fun); \ 167 167 } \ 168 device->driver_data = NULL; \ 168 169 usb_log_error(message); \ 169 170 return ret; \ … … 187 188 int irq = 0; 188 189 189 ret = get_my_registers(device, ®_base, ®_size, &irq);190 ret = pci_get_my_registers(device, ®_base, ®_size, &irq); 190 191 CHECK_RET_DEST_FREE_RETURN(ret, 191 192 "Failed to get I/O addresses for %" PRIun ": %s.\n", … … 194 195 (void *) reg_base, reg_size, irq); 195 196 196 ret = disable_legacy(device);197 ret = pci_disable_legacy(device); 197 198 CHECK_RET_DEST_FREE_RETURN(ret, 198 199 "Failed to disable legacy USB: %s.\n", str_error(ret)); 199 200 200 const size_t ranges_count = hc_irq_pio_range_count(); 201 const size_t cmds_count = hc_irq_cmd_count(); 202 irq_pio_range_t irq_ranges[ranges_count]; 203 irq_cmd_t irq_cmds[cmds_count]; 204 ret = hc_get_irq_code(irq_ranges, sizeof(irq_ranges), irq_cmds, 205 sizeof(irq_cmds), reg_base, reg_size); 201 const size_t cmd_count = hc_irq_cmd_count(); 202 irq_cmd_t irq_cmds[cmd_count]; 203 ret = 204 hc_get_irq_commands(irq_cmds, sizeof(irq_cmds), reg_base, reg_size); 206 205 CHECK_RET_DEST_FREE_RETURN(ret, 207 206 "Failed to generate IRQ commands: %s.\n", str_error(ret)); 208 207 209 irq_code_t irq_code = { 210 .rangecount = ranges_count, 211 .ranges = irq_ranges, 212 .cmdcount = cmds_count, 213 .cmds = irq_cmds 214 }; 208 irq_code_t irq_code = { .cmdcount = cmd_count, .cmds = irq_cmds }; 215 209 216 210 /* Register handler to avoid interrupt lockup */ … … 220 214 221 215 bool interrupts = false; 222 ret = enable_interrupts(device);216 ret = pci_enable_interrupts(device); 223 217 if (ret != EOK) { 224 218 usb_log_warning("Failed to enable interrupts: %s." … … 233 227 "Failed to init uhci_hcd: %s.\n", str_error(ret)); 234 228 229 device->driver_data = instance; 230 235 231 #define CHECK_RET_FINI_RETURN(ret, message...) \ 236 232 if (ret != EOK) { \
Note:
See TracChangeset
for help on using the changeset viewer.