Changes in / [3094804b:0cec844] in mainline
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/pciintel/pci.c
r3094804b r0cec844 107 107 } 108 108 109 size_t i = 0; 110 hw_resource_list_t *res = &dev_data->hw_resources; 111 for (; i < res->count; i++) { 112 if (res->resources[i].type == INTERRUPT) { 113 const int irq = res->resources[i].res.interrupt.irq; 114 const int rc = 115 async_req_1_0(irc_phone, IRC_ENABLE_INTERRUPT, irq); 109 size_t i; 110 for (i = 0; i < dev_data->hw_resources.count; i++) { 111 if (dev_data->hw_resources.resources[i].type == INTERRUPT) { 112 int irq = dev_data->hw_resources.resources[i].res.interrupt.irq; 113 int rc = async_req_1_0(irc_phone, IRC_ENABLE_INTERRUPT, irq); 116 114 if (rc != EOK) { 117 115 async_hangup(irc_phone); -
uspace/drv/uhci-rhd/main.c
r3094804b r0cec844 44 44 45 45 #define NAME "uhci-rhd" 46 47 46 static int hc_get_my_registers(ddf_dev_t *dev, 48 47 uintptr_t *io_reg_address, size_t *io_reg_size); 49 /*----------------------------------------------------------------------------*/ 50 static int uhci_rh_add_device(ddf_dev_t *device); 48 #if 0 49 /*----------------------------------------------------------------------------*/ 50 static int usb_iface_get_hc_handle(ddf_fun_t *fun, devman_handle_t *handle) 51 { 52 assert(fun); 53 assert(fun->driver_data); 54 assert(handle); 55 56 *handle = ((uhci_root_hub_t*)fun->driver_data)->hc_handle; 57 58 return EOK; 59 } 60 /*----------------------------------------------------------------------------*/ 61 static usb_iface_t uhci_rh_usb_iface = { 62 .get_hc_handle = usb_iface_get_hc_handle, 63 .get_address = usb_iface_get_address_hub_impl 64 }; 65 /*----------------------------------------------------------------------------*/ 66 static ddf_dev_ops_t uhci_rh_ops = { 67 .interfaces[USB_DEV_IFACE] = &uhci_rh_usb_iface, 68 }; 69 #endif 70 /*----------------------------------------------------------------------------*/ 71 /** Initialize a new ddf driver instance of UHCI root hub. 72 * 73 * @param[in] device DDF instance of the device to initialize. 74 * @return Error code. 75 */ 76 static int uhci_rh_add_device(ddf_dev_t *device) 77 { 78 if (!device) 79 return ENOTSUP; 80 81 usb_log_debug2("%s called device %d\n", __FUNCTION__, device->handle); 82 83 //device->ops = &uhci_rh_ops; 84 uintptr_t io_regs = 0; 85 size_t io_size = 0; 86 87 int ret = hc_get_my_registers(device, &io_regs, &io_size); 88 if (ret != EOK) { 89 usb_log_error("Failed to get registers from parent HC: %s.\n", 90 str_error(ret)); 91 } 92 usb_log_debug("I/O regs at %#X (size %zu).\n", io_regs, io_size); 93 94 uhci_root_hub_t *rh = malloc(sizeof(uhci_root_hub_t)); 95 if (!rh) { 96 usb_log_error("Failed to allocate driver instance.\n"); 97 return ENOMEM; 98 } 99 100 ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device); 101 if (ret != EOK) { 102 usb_log_error("Failed to initialize driver instance: %s.\n", 103 str_error(ret)); 104 free(rh); 105 return ret; 106 } 107 108 device->driver_data = rh; 109 usb_log_info("Controlling root hub `%s' (%llu).\n", 110 device->name, device->handle); 111 return EOK; 112 } 51 113 /*----------------------------------------------------------------------------*/ 52 114 static driver_ops_t uhci_rh_driver_ops = { … … 70 132 { 71 133 printf(NAME ": HelenOS UHCI root hub driver.\n"); 134 72 135 usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME); 136 73 137 return ddf_driver_main(&uhci_rh_driver); 74 }75 /*----------------------------------------------------------------------------*/76 /** Initialize a new ddf driver instance of UHCI root hub.77 *78 * @param[in] device DDF instance of the device to initialize.79 * @return Error code.80 */81 static int uhci_rh_add_device(ddf_dev_t *device)82 {83 if (!device)84 return EINVAL;85 86 usb_log_debug2("%s called device %d\n", __FUNCTION__, device->handle);87 88 uintptr_t io_regs = 0;89 size_t io_size = 0;90 uhci_root_hub_t *rh = NULL;91 int ret = EOK;92 93 #define CHECK_RET_FREE_RH_RETURN(ret, message...) \94 if (ret != EOK) { \95 usb_log_error(message); \96 if (rh) \97 free(rh); \98 return ret; \99 } else (void)0100 101 ret = hc_get_my_registers(device, &io_regs, &io_size);102 CHECK_RET_FREE_RH_RETURN(ret,103 "Failed(%d) to get registers from HC: %s.\n", ret, str_error(ret));104 usb_log_debug("I/O regs at %#x (size %zu).\n", io_regs, io_size);105 106 rh = malloc(sizeof(uhci_root_hub_t));107 ret = (rh == NULL) ? ENOMEM : EOK;108 CHECK_RET_FREE_RH_RETURN(ret,109 "Failed to allocate rh driver instance.\n");110 111 ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);112 CHECK_RET_FREE_RH_RETURN(ret,113 "Failed(%d) to initialize rh driver instance: %s.\n",114 ret, str_error(ret));115 116 device->driver_data = rh;117 usb_log_info("Controlling root hub '%s' (%llu).\n",118 device->name, device->handle);119 return EOK;120 138 } 121 139 /*----------------------------------------------------------------------------*/ … … 138 156 } 139 157 158 int rc; 159 140 160 hw_resource_list_t hw_resources; 141 int ret = hw_res_get_resource_list(parent_phone, &hw_resources); 142 if (ret != EOK) { 143 async_hangup(parent_phone); 144 return ret; 161 rc = hw_res_get_resource_list(parent_phone, &hw_resources); 162 if (rc != EOK) { 163 goto leave; 145 164 } 146 165 … … 149 168 bool io_found = false; 150 169 151 size_t i = 0;152 for ( ; i < hw_resources.count; i++) {170 size_t i; 171 for (i = 0; i < hw_resources.count; i++) { 153 172 hw_resource_t *res = &hw_resources.resources[i]; 154 if (res->type == IO_RANGE) { 155 io_address = res->res.io_range.address; 173 switch (res->type) 174 { 175 case IO_RANGE: 176 io_address = (uintptr_t) res->res.io_range.address; 156 177 io_size = res->res.io_range.size; 157 178 io_found = true; 179 180 default: 181 break; 158 182 } 159 183 } 160 async_hangup(parent_phone);161 184 162 185 if (!io_found) { 163 return ENOENT; 164 } 186 rc = ENOENT; 187 goto leave; 188 } 189 165 190 if (io_reg_address != NULL) { 166 191 *io_reg_address = io_address; … … 169 194 *io_reg_size = io_size; 170 195 } 171 return EOK; 196 rc = EOK; 197 198 leave: 199 async_hangup(parent_phone); 200 return rc; 172 201 } 173 202 /** -
uspace/drv/uhci-rhd/port.c
r3094804b r0cec844 43 43 #include "port.h" 44 44 45 static int uhci_port_check(void *port);46 static int uhci_port_reset_enable(int portno, void *arg);47 45 static int uhci_port_new_device(uhci_port_t *port, usb_speed_t speed); 48 46 static int uhci_port_remove_device(uhci_port_t *port); 49 47 static int uhci_port_set_enabled(uhci_port_t *port, bool enabled); 48 static int uhci_port_check(void *port); 49 static int uhci_port_reset_enable(int portno, void *arg); 50 50 static void uhci_port_print_status( 51 51 uhci_port_t *port, const port_status_t value); … … 74 74 pio_write_16(port->address, value); 75 75 } 76 76 77 /*----------------------------------------------------------------------------*/ 77 78 /** Initialize UHCI root hub port instance. … … 258 259 259 260 usb_address_t dev_addr; 260 int r et= usb_hc_new_device_wrapper(port->rh, &port->hc_connection,261 int rc = usb_hc_new_device_wrapper(port->rh, &port->hc_connection, 261 262 speed, uhci_port_reset_enable, port->number, port, 262 263 &dev_addr, &port->attached_device, NULL, NULL, NULL); 263 264 264 if (r et!= EOK) {265 if (rc != EOK) { 265 266 usb_log_error("%s: Failed(%d) to add device: %s.\n", 266 port->id_string, r et, str_error(ret));267 port->id_string, rc, str_error(rc)); 267 268 uhci_port_set_enabled(port, false); 268 return r et;269 return rc; 269 270 } 270 271 … … 286 287 int uhci_port_remove_device(uhci_port_t *port) 287 288 { 288 usb_log_error("%s: Don't know how to remove device % llu.\n",289 port->id_string, port->attached_device);290 return E NOTSUP;289 usb_log_error("%s: Don't know how to remove device %d.\n", 290 port->id_string, (unsigned int)port->attached_device); 291 return EOK; 291 292 } 292 293 /*----------------------------------------------------------------------------*/ … … 340 341 (value & STATUS_CONNECTED_CHANGED) ? " CONNECTED-CHANGE," : "", 341 342 (value & STATUS_CONNECTED) ? " CONNECTED," : "", 342 (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERR : NO ALWAYS ONE"343 (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERROR: NO ALWAYS ONE" 343 344 ); 344 345 } -
uspace/drv/uhci-rhd/root_hub.c
r3094804b r0cec844 51 51 assert(instance); 52 52 assert(rh); 53 int ret; 53 54 54 55 /* Allow access to root hub port registers */ 55 56 assert(sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT <= size); 56 57 port_status_t *regs; 57 intret = pio_enable(addr, size, (void**)®s);58 ret = pio_enable(addr, size, (void**)®s); 58 59 if (ret < 0) { 59 60 usb_log_error( … … 83 84 * 84 85 * @param[in] instance Root hub structure to use. 86 * @return Error code. 85 87 */ 86 voiduhci_root_hub_fini(uhci_root_hub_t* instance)88 int uhci_root_hub_fini(uhci_root_hub_t* instance) 87 89 { 88 90 assert(instance); … … 91 93 uhci_port_fini(&instance->ports[i]); 92 94 } 95 return EOK; 93 96 } 94 97 /*----------------------------------------------------------------------------*/ -
uspace/drv/uhci-rhd/root_hub.h
r3094804b r0cec844 50 50 uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh); 51 51 52 voiduhci_root_hub_fini(uhci_root_hub_t *instance);52 int uhci_root_hub_fini(uhci_root_hub_t *instance); 53 53 #endif 54 54 /** -
uspace/srv/hw/irc/apic/apic.c
r3094804b r0cec844 87 87 async_answer_0(callid, EOK); 88 88 break; 89 case IPC_M_PHONE_HUNGUP:90 /* The other side has hung up. */91 async_answer_0(callid, EOK);92 return;93 89 default: 94 90 async_answer_0(callid, EINVAL); -
uspace/srv/hw/irc/i8259/i8259.c
r3094804b r0cec844 121 121 async_answer_0(callid, EOK); 122 122 break; 123 case IPC_M_PHONE_HUNGUP:124 /* The other side has hung up. */125 async_answer_0(callid, EOK);126 return;127 123 default: 128 124 async_answer_0(callid, EINVAL);
Note:
See TracChangeset
for help on using the changeset viewer.