Changeset 05b51e37 in mainline


Ignore:
Timestamp:
2015-07-03T22:06:22Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
56b5569
Parents:
605db7f
Message:

ehci: consolidate HC logging messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hc.c

    r605db7f r05b51e37  
    168168            (void **)&instance->caps);
    169169        if (ret != EOK) {
    170                 usb_log_error("Failed to gain access to device registers: %s.\n",
    171                     str_error(ret));
     170                usb_log_error("HC(%p): Failed to gain access to device "
     171                    "registers: %s.\n", instance, str_error(ret));
    172172                return ret;
    173173        }
    174         usb_log_info("Device registers at %" PRIx64 " (%zuB) accessible.\n",
    175             hw_res->mem_ranges.ranges[0].address.absolute,
     174        usb_log_info("HC(%p): Device registers at %"PRIx64" (%zuB) accessible.",
     175            instance, hw_res->mem_ranges.ranges[0].address.absolute,
    176176            hw_res->mem_ranges.ranges[0].size);
    177177        instance->registers =
    178178            (void*)instance->caps + EHCI_RD8(instance->caps->caplength);
    179         usb_log_info("Device control registers at %" PRIx64 "\n",
     179        usb_log_info("HC(%p): Device control registers at %" PRIx64, instance,
    180180            hw_res->mem_ranges.ranges[0].address.absolute
    181181            + EHCI_RD8(instance->caps->caplength));
     
    187187        ret = hc_init_memory(instance);
    188188        if (ret != EOK) {
    189                 usb_log_error("Failed to create EHCI memory structures: %s.\n",
    190                     str_error(ret));
     189                usb_log_error("HC(%p): Failed to create EHCI memory structures:"
     190                    " %s.", instance, str_error(ret));
    191191                return ret;
    192192        }
    193193
     194        usb_log_info("HC(%p): Initializing RH(%p).", instance, &instance->rh);
    194195        ehci_rh_init(
    195196            &instance->rh, instance->caps, instance->registers, "ehci rh");
     197        usb_log_debug("HC(%p): Starting HW.", instance);
    196198        hc_start(instance);
    197199
     
    219221        assert(ep);
    220222        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    221         usb_log_debug("HCD(%p) enqueue EP(%d:%d:%s:%s)\n", instance,
     223        usb_log_debug("HC(%p) enqueue EP(%d:%d:%s:%s)\n", instance,
    222224            ep->address, ep->endpoint,
    223225            usb_str_transfer_type_short(ep->transfer_type),
     
    243245        assert(ep);
    244246        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    245         usb_log_debug("HCD(%p) dequeue EP(%d:%d:%s:%s)\n", instance,
     247        usb_log_debug("HC(%p) dequeue EP(%d:%d:%s:%s)\n", instance,
    246248            ep->address, ep->endpoint,
    247249            usb_str_transfer_type_short(ep->transfer_type),
     
    261263        }
    262264        fibril_mutex_lock(&instance->guard);
     265        usb_log_debug("HC(%p): Waiting for doorbell", instance);
    263266        EHCI_SET(instance->registers->usbcmd, USB_CMD_IRQ_ASYNC_DOORBELL);
    264267        fibril_condvar_wait(&instance->async_doorbell, &instance->guard);
     268        usb_log_debug2("HC(%p): Got doorbell", instance);
    265269        fibril_mutex_unlock(&instance->guard);
    266270}
     
    277281                EHCI_WR(instance->registers->usbsts, *status);
    278282        }
     283        usb_log_debug2("HC(%p): Read status: %x", instance, *status);
    279284        return EOK;
    280285}
     
    294299        /* Check for root hub communication */
    295300        if (batch->ep->address == ehci_rh_get_address(&instance->rh)) {
     301                usb_log_debug("HC(%p): Scheduling BATCH(%p) for RH(%p)",
     302                    instance, batch, &instance->rh);
    296303                return ehci_rh_schedule(&instance->rh, batch);
    297304        }
     
    301308
    302309        fibril_mutex_lock(&instance->guard);
     310        usb_log_debug2("HC(%p): Appending BATCH(%p)", instance, batch);
    303311        list_append(&ehci_batch->link, &instance->pending_batches);
     312        usb_log_debug("HC(%p): Committing BATCH(%p)", instance, batch);
    304313        ehci_transfer_batch_commit(ehci_batch);
    305314
     
    320329        assert(instance);
    321330
     331        usb_log_debug2("HC(%p): Interrupt: %"PRIx32, instance, status);
    322332        if (status & USB_STS_PORT_CHANGE_FLAG) {
    323333                ehci_rh_interrupt(&instance->rh);
     
    326336        if (status & USB_STS_IRQ_ASYNC_ADVANCE_FLAG) {
    327337                fibril_mutex_lock(&instance->guard);
     338                usb_log_debug2("HC(%p): Signaling doorbell", instance);
    328339                fibril_condvar_broadcast(&instance->async_doorbell);
    329340                fibril_mutex_unlock(&instance->guard);
     
    333344                fibril_mutex_lock(&instance->guard);
    334345
     346                usb_log_debug2("HC(%p): Scanning %u pending batches", instance,
     347                        list_count(&instance->pending_batches));
    335348                list_foreach_safe(instance->pending_batches, current, next) {
    336349                        ehci_transfer_batch_t *batch =
     
    346359
    347360        if (status & USB_STS_HOST_ERROR_FLAG) {
    348                 usb_log_fatal("HOST CONTROLLER SYSTEM ERROR!\n");
     361                usb_log_fatal("HCD(%p): HOST SYSTEM ERROR!", instance);
    349362                //TODO do something here
    350363        }
     
    371384                        async_usleep(1);
    372385                }
    373                 usb_log_info("EHCI turned off.\n");
     386                usb_log_info("HC(%p): EHCI turned off.", instance);
    374387        } else {
    375                 usb_log_info("EHCI was not running.\n");
     388                usb_log_info("HC(%p): EHCI was not running.", instance);
    376389        }
    377390
    378391        /* Hw initialization sequence, see page 53 (pdf 63) */
    379392        EHCI_SET(instance->registers->usbcmd, USB_CMD_HC_RESET_FLAG);
     393        usb_log_info("HC(%p): Waiting for HW reset.", instance);
    380394        while (EHCI_RD(instance->registers->usbcmd) & USB_CMD_HC_RESET_FLAG) {
    381395                async_usleep(1);
    382396        }
     397        usb_log_debug("HC(%p): HW reset OK.", instance);
     398
     399        //TODO: Do this last
    383400        /* Enable interrupts */
    384401        EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS);
     
    393410        EHCI_WR(instance->registers->periodiclistbase, phys_base);
    394411        EHCI_SET(instance->registers->usbcmd, USB_CMD_PERIODIC_SCHEDULE_FLAG);
     412        usb_log_debug("HC(%p): Enabled periodic list.", instance);
    395413
    396414
     
    400418        EHCI_WR(instance->registers->asynclistaddr, phys_base);
    401419        EHCI_SET(instance->registers->usbcmd, USB_CMD_ASYNC_SCHEDULE_FLAG);
     420        usb_log_debug("HC(%p): Enabled async list.", instance);
    402421
    403422        /* Start hc and get all ports */
    404423        EHCI_SET(instance->registers->usbcmd, USB_CMD_RUN_FLAG);
    405424        EHCI_SET(instance->registers->configflag, USB_CONFIG_FLAG_FLAG);
    406 
    407         usb_log_debug("Registers: \n"
    408             "\t USBCMD(%p): %x(0x00080000 = at least 1ms between interrupts)\n"
    409             "\t USBSTS(%p): %x(0x00001000 = HC halted)\n"
    410             "\t USBINT(%p): %x(0x0 = no interrupts).\n"
    411             "\t CONFIG(%p): %x(0x0 = ports controlled by companion hc).\n",
     425        usb_log_debug("HC(%p): HW started.", instance);
     426
     427        usb_log_debug2("HC(%p): Registers: \n"
     428            "\tUSBCMD(%p): %x(0x00080000 = at least 1ms between interrupts)\n"
     429            "\tUSBSTS(%p): %x(0x00001000 = HC halted)\n"
     430            "\tUSBINT(%p): %x(0x0 = no interrupts).\n"
     431            "\tCONFIG(%p): %x(0x0 = ports controlled by companion hc).\n",
     432            instance,
    412433            &instance->registers->usbcmd, EHCI_RD(instance->registers->usbcmd),
    413434            &instance->registers->usbsts, EHCI_RD(instance->registers->usbsts),
     
    424445{
    425446        assert(instance);
     447        usb_log_debug2("HC(%p): Initializing Async list(%p).", instance,
     448            &instance->async_list);
    426449        int ret = endpoint_list_init(&instance->async_list, "ASYNC");
    427450        if (ret != EOK) {
    428                 usb_log_error("Failed to setup ASYNC list: %s", str_error(ret));
     451                usb_log_error("HC(%p): Failed to setup ASYNC list: %s",
     452                    instance, str_error(ret));
    429453                return ret;
    430454        }
     
    435459        endpoint_list_chain(&instance->async_list, &instance->async_list);
    436460
     461        usb_log_debug2("HC(%p): Initializing Interrupt list (%p).", instance,
     462            &instance->int_list);
    437463        ret = endpoint_list_init(&instance->int_list, "INT");
    438464        if (ret != EOK) {
    439                 usb_log_error("Failed to setup INT list: %s", str_error(ret));
     465                usb_log_error("HC(%p): Failed to setup INT list: %s",
     466                    instance, str_error(ret));
    440467                endpoint_list_fini(&instance->async_list);
    441468                return ret;
     
    445472        instance->periodic_list_base = get_page();
    446473        if (!instance->periodic_list_base) {
    447                 usb_log_error("Failed to get ISO schedule page.");
     474                usb_log_error("HC(%p): Failed to get ISO schedule page.",
     475                    instance);
    448476                endpoint_list_fini(&instance->async_list);
    449477                endpoint_list_fini(&instance->int_list);
    450478                return ENOMEM;
    451479        }
     480
     481        usb_log_debug2("HC(%p): Initializing Periodic list.", instance);
    452482        for (unsigned i = 0;
    453483            i < PAGE_SIZE/sizeof(instance->periodic_list_base[0]); ++i)
Note: See TracChangeset for help on using the changeset viewer.