Changes in uspace/drv/uhci-hcd/uhci.c [4125b7d:fa3de85] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/uhci.c
r4125b7d rfa3de85 44 44 #include "pci.h" 45 45 46 /** IRQ handling callback, forward status from call to diver structure.46 /** IRQ handling callback, identifies device 47 47 * 48 48 * @param[in] dev DDF instance of the device to use. 49 49 * @param[in] iid (Unused). 50 * @param[in] call Pointer to the call from kernel.50 * @param[in] call Pointer to the call that represents interrupt. 51 51 */ 52 52 static void irq_handler(ddf_dev_t *dev, ipc_callid_t iid, ipc_call_t *call) … … 61 61 /** Get address of the device identified by handle. 62 62 * 63 * @param[in] fun DDF instance of the functionto use.64 * @param[in] handle DDF handle of the driver seeking its USB address.65 * @param[ out] address Found address.63 * @param[in] dev DDF instance of the device to use. 64 * @param[in] iid (Unused). 65 * @param[in] call Pointer to the call that represents interrupt. 66 66 */ 67 67 static int usb_iface_get_address( … … 69 69 { 70 70 assert(fun); 71 usb_device_keeper_t *manager = 72 &((uhci_t*)fun->dev->driver_data)->hc.manager; 71 usb_device_keeper_t *manager = &((uhci_t*)fun->dev->driver_data)->hc.manager; 73 72 74 73 usb_address_t addr = usb_device_keeper_find(manager, handle); … … 84 83 } 85 84 /*----------------------------------------------------------------------------*/ 86 /** Gets handle of the respective hc .87 * 88 * @param[in] fun DDF function of uhci device.89 * @param[out] handle Host cotnrollerhandle.85 /** Gets handle of the respective hc (this or parent device). 86 * 87 * @param[in] root_hub_fun Root hub function seeking hc handle. 88 * @param[out] handle Place to write the handle. 90 89 * @return Error code. 91 90 */ … … 101 100 } 102 101 /*----------------------------------------------------------------------------*/ 103 /** USB interface implementation used by RH*/102 /** This iface is generic for both RH and HC. */ 104 103 static usb_iface_t usb_iface = { 105 104 .get_hc_handle = usb_iface_get_hc_handle, … … 107 106 }; 108 107 /*----------------------------------------------------------------------------*/ 109 /** Operations supported by the HC driver */110 108 static ddf_dev_ops_t hc_ops = { 109 // .interfaces[USB_DEV_IFACE] = &usb_iface, 111 110 .interfaces[USBHC_DEV_IFACE] = &hc_iface, /* see iface.h/c */ 112 111 }; … … 123 122 } 124 123 /*----------------------------------------------------------------------------*/ 125 /** Interface to provide the root hub driver with hw info */126 124 static hw_res_ops_t hw_res_iface = { 127 125 .get_resource_list = get_resource_list, … … 129 127 }; 130 128 /*----------------------------------------------------------------------------*/ 131 /** RH function support for uhci-rhd */132 129 static ddf_dev_ops_t rh_ops = { 133 130 .interfaces[USB_DEV_IFACE] = &usb_iface, … … 135 132 }; 136 133 /*----------------------------------------------------------------------------*/ 137 /** Initialize hc and rh DDFstructures and their respective drivers.134 /** Initialize hc and rh ddf structures and their respective drivers. 138 135 * 139 136 * @param[in] instance UHCI structure to use. … … 141 138 * 142 139 * This function does all the preparatory work for hc and rh drivers: 143 * - gets device 'shw resources144 * - disables UHCI legacy support (PCI config space)140 * - gets device hw resources 141 * - disables UHCI legacy support 145 142 * - asks for interrupt 146 143 * - registers interrupt handler … … 168 165 pci_get_my_registers(device, &io_reg_base, &io_reg_size, &irq); 169 166 CHECK_RET_DEST_FUN_RETURN(ret, 170 "Failed to get I/O addresses for %" PRIun ": %s.\n", 171 device->handle, str_error(ret)); 172 usb_log_debug("I/O regs at 0x%p (size %zu), IRQ %d.\n", 173 (void *) io_reg_base, io_reg_size, irq); 167 "Failed(%d) to get I/O addresses:.\n", ret, device->handle); 168 usb_log_debug("I/O regs at 0x%X (size %zu), IRQ %d.\n", 169 io_reg_base, io_reg_size, irq); 174 170 175 171 ret = pci_disable_legacy(device); … … 197 193 ret = (instance->hc_fun == NULL) ? ENOMEM : EOK; 198 194 CHECK_RET_DEST_FUN_RETURN(ret, 199 "Failed(%d) to create HC function : %s.\n", ret, str_error(ret));195 "Failed(%d) to create HC function.\n", ret); 200 196 201 197 ret = hc_init(&instance->hc, instance->hc_fun, 202 198 (void*)io_reg_base, io_reg_size, interrupts); 203 CHECK_RET_DEST_FUN_RETURN(ret, 204 "Failed(%d) to init uhci-hcd: %s.\n", ret, str_error(ret)); 205 199 CHECK_RET_DEST_FUN_RETURN(ret, "Failed(%d) to init uhci-hcd.\n", ret); 206 200 instance->hc_fun->ops = &hc_ops; 207 201 instance->hc_fun->driver_data = &instance->hc; … … 227 221 &instance->hc.interrupt_code); 228 222 CHECK_RET_FINI_RETURN(ret, 229 "Failed(%d) to register interrupt handler: %s.\n", 230 ret, str_error(ret)); 223 "Failed(%d) to register interrupt handler.\n", ret); 231 224 232 225 instance->rh_fun = ddf_fun_create(device, fun_inner, "uhci-rh"); 233 226 ret = (instance->rh_fun == NULL) ? ENOMEM : EOK; 234 227 CHECK_RET_FINI_RETURN(ret, 235 "Failed(%d) to create root hub function: %s.\n", 236 ret, str_error(ret)); 228 "Failed(%d) to create root hub function.\n", ret); 237 229 238 230 ret = rh_init(&instance->rh, instance->rh_fun, 239 231 (uintptr_t)instance->hc.registers + 0x10, 4); 240 232 CHECK_RET_FINI_RETURN(ret, 241 "Failed(%d) to setup UHCI root hub : %s.\n", ret, str_error(ret));233 "Failed(%d) to setup UHCI root hub.\n", ret); 242 234 243 235 instance->rh_fun->ops = &rh_ops; … … 245 237 ret = ddf_fun_bind(instance->rh_fun); 246 238 CHECK_RET_FINI_RETURN(ret, 247 "Failed(%d) to register UHCI root hub : %s.\n", ret, str_error(ret));239 "Failed(%d) to register UHCI root hub.\n", ret); 248 240 249 241 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.