Changeset a1732929 in mainline for uspace/drv/bus/usb/uhci
- Timestamp:
- 2018-01-15T17:04:34Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9ff99e8
- Parents:
- c1a966e
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:32)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:34)
- Location:
- uspace/drv/bus/usb/uhci
- Files:
-
- 5 edited
-
hc.c (modified) (14 diffs)
-
hw_struct/transfer_descriptor.c (modified) (2 diffs)
-
transfer_list.c (modified) (5 diffs)
-
uhci_batch.c (modified) (7 diffs)
-
uhci_rh.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
rc1a966e ra1732929 141 141 code->cmds[3].addr = (void*)®isters->usbsts; 142 142 143 usb_log_debug("I/O regs at %p (size %zu), IRQ %d. \n",143 usb_log_debug("I/O regs at %p (size %zu), IRQ %d.", 144 144 RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]); 145 145 … … 182 182 /* Resume interrupts are not supported */ 183 183 if (status & UHCI_STATUS_RESUME) { 184 usb_log_error("Resume interrupt! \n");184 usb_log_error("Resume interrupt!"); 185 185 } 186 186 187 187 /* Bits 4 and 5 indicate hc error */ 188 188 if (status & (UHCI_STATUS_PROCESS_ERROR | UHCI_STATUS_SYSTEM_ERROR)) { 189 usb_log_error("UHCI hardware failure!. \n");189 usb_log_error("UHCI hardware failure!."); 190 190 ++instance->hw_failures; 191 191 transfer_list_abort_all(&instance->transfers_interrupt); … … 198 198 hc_init_hw(instance); 199 199 } else { 200 usb_log_fatal("Too many UHCI hardware failures!. \n");200 usb_log_fatal("Too many UHCI hardware failures!."); 201 201 hc_gone(&instance->base); 202 202 } … … 229 229 (void **) &instance->registers); 230 230 if (ret != EOK) { 231 usb_log_error("Failed to gain access to registers: %s. \n",231 usb_log_error("Failed to gain access to registers: %s.", 232 232 str_error(ret)); 233 233 return ret; 234 234 } 235 235 236 usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible. \n",236 usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.", 237 237 hw_res->io_ranges.ranges[0].address.absolute, 238 238 hw_res->io_ranges.ranges[0].size); … … 240 240 ret = hc_init_mem_structures(instance, hcd); 241 241 if (ret != EOK) { 242 usb_log_error("Failed to init UHCI memory structures: %s. \n",242 usb_log_error("Failed to init UHCI memory structures: %s.", 243 243 str_error(ret)); 244 244 // TODO: we should disable pio here … … 304 304 const uint16_t cmd = pio_read_16(®isters->usbcmd); 305 305 if (cmd != 0) 306 usb_log_warning("Previous command value: %x. \n", cmd);306 usb_log_warning("Previous command value: %x.", cmd); 307 307 308 308 /* Start the hc with large(64B) packet FSBR */ … … 399 399 return ENOMEM; 400 400 } 401 usb_log_debug("Initialized frame list at %p. \n", instance->frame_list);401 usb_log_debug("Initialized frame list at %p.", instance->frame_list); 402 402 403 403 /* Init transfer lists */ 404 404 int ret = hc_init_transfer_lists(instance); 405 405 if (ret != EOK) { 406 usb_log_error("Failed to initialize transfer lists. \n");406 usb_log_error("Failed to initialize transfer lists."); 407 407 return_page(instance->frame_list); 408 408 return ENOMEM; 409 409 } 410 usb_log_debug("Initialized transfer lists. \n");410 usb_log_debug("Initialized transfer lists."); 411 411 412 412 … … 438 438 int ret = transfer_list_init(&instance->transfers_##type, name); \ 439 439 if (ret != EOK) { \ 440 usb_log_error("Failed to setup %s transfer list: %s. \n", \440 usb_log_error("Failed to setup %s transfer list: %s.", \ 441 441 name, str_error(ret)); \ 442 442 transfer_list_fini(&instance->transfers_bulk_full); \ … … 552 552 553 553 if (((cmd & UHCI_CMD_RUN_STOP) != 1) || (sts != 0)) { 554 usb_log_debug2("Command: %X Status: %X Intr: %x \n",554 usb_log_debug2("Command: %X Status: %X Intr: %x", 555 555 cmd, sts, intr); 556 556 } … … 559 559 pio_read_32(&instance->registers->flbaseadd) & ~0xfff; 560 560 if (frame_list != addr_to_phys(instance->frame_list)) { 561 usb_log_debug("Framelist address: %p vs. %p. \n",561 usb_log_debug("Framelist address: %p vs. %p.", 562 562 (void *) frame_list, 563 563 (void *) addr_to_phys(instance->frame_list)); … … 570 570 uintptr_t real_pa = addr_to_phys(QH(interrupt)); 571 571 if (expected_pa != real_pa) { 572 usb_log_debug("Interrupt QH: %p (frame %d) vs. %p. \n",572 usb_log_debug("Interrupt QH: %p (frame %d) vs. %p.", 573 573 (void *) expected_pa, frnum, (void *) real_pa); 574 574 } … … 577 577 real_pa = addr_to_phys(QH(control_slow)); 578 578 if (expected_pa != real_pa) { 579 usb_log_debug("Control Slow QH: %p vs. %p. \n",579 usb_log_debug("Control Slow QH: %p vs. %p.", 580 580 (void *) expected_pa, (void *) real_pa); 581 581 } … … 584 584 real_pa = addr_to_phys(QH(control_full)); 585 585 if (expected_pa != real_pa) { 586 usb_log_debug("Control Full QH: %p vs. %p. \n",586 usb_log_debug("Control Full QH: %p vs. %p.", 587 587 (void *) expected_pa, (void *) real_pa); 588 588 } … … 591 591 real_pa = addr_to_phys(QH(bulk_full)); 592 592 if (expected_pa != real_pa ) { 593 usb_log_debug("Bulk QH: %p vs. %p. \n",593 usb_log_debug("Bulk QH: %p vs. %p.", 594 594 (void *) expected_pa, (void *) real_pa); 595 595 } -
uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c
rc1a966e ra1732929 104 104 instance->buffer_ptr = addr_to_phys(buffer); 105 105 106 usb_log_debug2("Created TD(%p): %X:%X:%X:%X(%p). \n",106 usb_log_debug2("Created TD(%p): %X:%X:%X:%X(%p).", 107 107 instance, instance->next, instance->status, instance->device, 108 108 instance->buffer_ptr, buffer); 109 109 td_print_status(instance); 110 110 if (pid == USB_PID_SETUP) { 111 usb_log_debug2("SETUP BUFFER: %s \n",111 usb_log_debug2("SETUP BUFFER: %s", 112 112 usb_debug_str_buffer(buffer, 8, 8)); 113 113 } … … 160 160 assert(instance); 161 161 const uint32_t s = instance->status; 162 usb_log_debug2("TD(%p) status(%#" PRIx32 "):%s %d,%s%s%s%s%s%s%s%s%s%s%s %zu. \n",162 usb_log_debug2("TD(%p) status(%#" PRIx32 "):%s %d,%s%s%s%s%s%s%s%s%s%s%s %zu.", 163 163 instance, instance->status, 164 164 (s & TD_STATUS_SPD_FLAG) ? " SPD," : "", -
uspace/drv/bus/usb/uhci/transfer_list.c
rc1a966e ra1732929 59 59 instance->queue_head = malloc32(sizeof(qh_t)); 60 60 if (!instance->queue_head) { 61 usb_log_error("Failed to allocate queue head. \n");61 usb_log_error("Failed to allocate queue head."); 62 62 return ENOMEM; 63 63 } 64 64 const uint32_t queue_head_pa = addr_to_phys(instance->queue_head); 65 usb_log_debug2("Transfer list %s setup with QH: %p (%#" PRIx32" ). \n",65 usb_log_debug2("Transfer list %s setup with QH: %p (%#" PRIx32" ).", 66 66 name, instance->queue_head, queue_head_pa); 67 67 … … 120 120 fibril_mutex_unlock(&ep->guard); 121 121 122 usb_log_debug2("Batch %p adding to queue %s. \n",122 usb_log_debug2("Batch %p adding to queue %s.", 123 123 uhci_batch, instance->name); 124 124 … … 150 150 151 151 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT 152 " scheduled in queue %s. \n", uhci_batch,152 " scheduled in queue %s.", uhci_batch, 153 153 USB_TRANSFER_BATCH_ARGS(uhci_batch->base), instance->name); 154 154 fibril_mutex_unlock(&instance->guard); … … 213 213 assert(fibril_mutex_is_locked(&instance->guard)); 214 214 215 usb_log_debug2("Batch %p removing from queue %s. \n",215 usb_log_debug2("Batch %p removing from queue %s.", 216 216 uhci_batch, instance->name); 217 217 … … 236 236 list_remove(&uhci_batch->link); 237 237 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " removed (%s) " 238 "from %s, next: %x. \n", uhci_batch,238 "from %s, next: %x.", uhci_batch, 239 239 USB_TRANSFER_BATCH_ARGS(uhci_batch->base), 240 240 qpos, instance->name, uhci_batch->qh->next); -
uspace/drv/bus/usb/uhci/uhci_batch.c
rc1a966e ra1732929 75 75 calloc(1, sizeof(uhci_transfer_batch_t)); 76 76 if (!uhci_batch) { 77 usb_log_error("Failed to allocate UHCI batch. \n");77 usb_log_error("Failed to allocate UHCI batch."); 78 78 return NULL; 79 79 } … … 112 112 uhci_batch->device_buffer = malloc32(total_size); 113 113 if (!uhci_batch->device_buffer) { 114 usb_log_error("Failed to allocate UHCI buffer. \n");114 usb_log_error("Failed to allocate UHCI buffer."); 115 115 return ENOMEM; 116 116 } … … 135 135 } 136 136 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT 137 " memory structures ready. \n", usb_batch,137 " memory structures ready.", usb_batch, 138 138 USB_TRANSFER_BATCH_ARGS(*usb_batch)); 139 139 … … 159 159 160 160 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT 161 " checking %zu transfer(s) for completion. \n",161 " checking %zu transfer(s) for completion.", 162 162 uhci_batch, USB_TRANSFER_BATCH_ARGS(*batch), 163 163 uhci_batch->td_count); … … 174 174 175 175 usb_log_debug("Batch %p found error TD(%zu->%p):%" 176 PRIx32 ". \n", uhci_batch, i,176 PRIx32 ".", uhci_batch, i, 177 177 &uhci_batch->tds[i], uhci_batch->tds[i].status); 178 178 td_print_status(&uhci_batch->tds[i]); … … 260 260 uhci_batch->base.ep->toggle = toggle; 261 261 usb_log_debug2( 262 "Batch %p %s %s " USB_TRANSFER_BATCH_FMT " initialized. \n", \262 "Batch %p %s %s " USB_TRANSFER_BATCH_FMT " initialized.", \ 263 263 uhci_batch, 264 264 usb_str_transfer_type(uhci_batch->base.ep->transfer_type), … … 333 333 td_set_ioc(&uhci_batch->tds[td]); 334 334 335 usb_log_debug2("Control last TD status: %x. \n",335 usb_log_debug2("Control last TD status: %x.", 336 336 uhci_batch->tds[td].status); 337 337 } -
uspace/drv/bus/usb/uhci/uhci_rh.c
rc1a966e ra1732929 202 202 data[0] = ((value & STATUS_LINE_D_MINUS) ? 1 : 0) 203 203 | ((value & STATUS_LINE_D_PLUS) ? 2 : 0); 204 RH_DEBUG(hub, port, "Bus state %" PRIx8 "(source %" PRIx16") \n",204 RH_DEBUG(hub, port, "Bus state %" PRIx8 "(source %" PRIx16")", 205 205 data[0], value); 206 206 *act_size = 1; … … 248 248 ); 249 249 RH_DEBUG(hub, port, "Port status %" PRIx32 " (source %" PRIx16 250 "%s) \n", uint32_usb2host(status), val,250 "%s)", uint32_usb2host(status), val, 251 251 hub->reset_changed[port] ? "-reset" : ""); 252 252 memcpy(data, &status, sizeof(status)); … … 276 276 case USB_HUB_FEATURE_PORT_ENABLE: 277 277 RH_DEBUG(hub, port, "Clear port enable (status %" 278 PRIx16 ") \n", status);278 PRIx16 ")", status); 279 279 pio_write_16(hub->ports[port], val & ~STATUS_ENABLED); 280 280 break; 281 281 case USB_HUB_FEATURE_PORT_SUSPEND: 282 282 RH_DEBUG(hub, port, "Clear port suspend (status %" 283 PRIx16 ") \n", status);283 PRIx16 ")", status); 284 284 pio_write_16(hub->ports[port], val & ~STATUS_SUSPEND); 285 285 // TODO we should do resume magic 286 usb_log_warning("Resume is not implemented on port %u \n", port);286 usb_log_warning("Resume is not implemented on port %u", port); 287 287 break; 288 288 case USB_HUB_FEATURE_PORT_POWER: 289 RH_DEBUG(hub, port, "Clear port power (status %" PRIx16 ") \n",289 RH_DEBUG(hub, port, "Clear port power (status %" PRIx16 ")", 290 290 status); 291 291 /* We are always powered */ 292 usb_log_warning("Tried to power off port %u \n", port);292 usb_log_warning("Tried to power off port %u", port); 293 293 break; 294 294 case USB_HUB_FEATURE_C_PORT_CONNECTION: 295 295 RH_DEBUG(hub, port, "Clear port conn change (status %" 296 PRIx16 ") \n", status);296 PRIx16 ")", status); 297 297 pio_write_16(hub->ports[port], val | STATUS_CONNECTED_CHANGED); 298 298 break; 299 299 case USB_HUB_FEATURE_C_PORT_RESET: 300 300 RH_DEBUG(hub, port, "Clear port reset change (status %" 301 PRIx16 ") \n", status);301 PRIx16 ")", status); 302 302 hub->reset_changed[port] = false; 303 303 break; 304 304 case USB_HUB_FEATURE_C_PORT_ENABLE: 305 305 RH_DEBUG(hub, port, "Clear port enable change (status %" 306 PRIx16 ") \n", status);306 PRIx16 ")", status); 307 307 pio_write_16(hub->ports[port], status | STATUS_ENABLED_CHANGED); 308 308 break; 309 309 case USB_HUB_FEATURE_C_PORT_SUSPEND: 310 310 RH_DEBUG(hub, port, "Clear port suspend change (status %" 311 PRIx16 ") \n", status);311 PRIx16 ")", status); 312 312 //TODO 313 313 return ENOTSUP; 314 314 case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: 315 315 RH_DEBUG(hub, port, "Clear port OC change (status %" 316 PRIx16 ") \n", status);316 PRIx16 ")", status); 317 317 /* UHCI Does not report over current */ 318 318 //TODO: newer chips do, but some have broken wiring … … 320 320 default: 321 321 RH_DEBUG(hub, port, "Clear unknown feature %d (status %" 322 PRIx16 ") \n", feature, status);323 usb_log_warning("Clearing feature %d is unsupported \n",322 PRIx16 ")", feature, status); 323 usb_log_warning("Clearing feature %d is unsupported", 324 324 feature); 325 325 return ESTALL; … … 348 348 case USB_HUB_FEATURE_PORT_RESET: 349 349 RH_DEBUG(hub, port, "Set port reset before (status %" PRIx16 350 ") \n", status);350 ")", status); 351 351 uhci_port_reset_enable(hub->ports[port]); 352 352 hub->reset_changed[port] = true; 353 353 RH_DEBUG(hub, port, "Set port reset after (status %" PRIx16 354 ") \n", pio_read_16(hub->ports[port]));354 ")", pio_read_16(hub->ports[port])); 355 355 break; 356 356 case USB_HUB_FEATURE_PORT_SUSPEND: 357 357 RH_DEBUG(hub, port, "Set port suspend (status %" PRIx16 358 ") \n", status);358 ")", status); 359 359 pio_write_16(hub->ports[port], 360 360 (status & ~STATUS_WC_BITS) | STATUS_SUSPEND); 361 usb_log_warning("Suspend is not implemented on port %u \n", port);361 usb_log_warning("Suspend is not implemented on port %u", port); 362 362 break; 363 363 case USB_HUB_FEATURE_PORT_POWER: 364 364 RH_DEBUG(hub, port, "Set port power (status %" PRIx16 365 ") \n", status);365 ")", status); 366 366 /* We are always powered */ 367 usb_log_warning("Tried to power port %u \n", port);367 usb_log_warning("Tried to power port %u", port); 368 368 break; 369 369 case USB_HUB_FEATURE_C_PORT_CONNECTION: … … 372 372 case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: 373 373 RH_DEBUG(hub, port, "Set port change flag (status %" PRIx16 374 ") \n", status);374 ")", status); 375 375 /* These are voluntary and don't have to be set 376 376 * there is no way we could do it on UHCI anyway */ … … 378 378 default: 379 379 RH_DEBUG(hub, port, "Set unknown feature %d (status %" PRIx16 380 ") \n", feature, status);381 usb_log_warning("Setting feature %d is unsupported \n",380 ")", feature, status); 381 usb_log_warning("Setting feature %d is unsupported", 382 382 feature); 383 383 return ESTALL; … … 418 418 RH_DEBUG(hub, -1, "Event mask %" PRIx8 419 419 " (status_a %" PRIx16 "%s)," 420 " (status_b %" PRIx16 "%s) \n", status,420 " (status_b %" PRIx16 "%s)", status, 421 421 status_a, hub->reset_changed[0] ? "-reset" : "", 422 422 status_b, hub->reset_changed[1] ? "-reset" : "" );
Note:
See TracChangeset
for help on using the changeset viewer.
