Changeset a1732929 in mainline for uspace/drv/bus/usb/uhci/hc.c


Ignore:
Timestamp:
2018-01-15T17:04:34Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
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)
Message:

usb: unified logging

Use logger instead of printf. Logger adds newlines automatically.

File:
1 edited

Legend:

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

    rc1a966e ra1732929  
    141141        code->cmds[3].addr = (void*)&registers->usbsts;
    142142
    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.",
    144144            RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
    145145
     
    182182        /* Resume interrupts are not supported */
    183183        if (status & UHCI_STATUS_RESUME) {
    184                 usb_log_error("Resume interrupt!\n");
     184                usb_log_error("Resume interrupt!");
    185185        }
    186186
    187187        /* Bits 4 and 5 indicate hc error */
    188188        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!.");
    190190                ++instance->hw_failures;
    191191                transfer_list_abort_all(&instance->transfers_interrupt);
     
    198198                        hc_init_hw(instance);
    199199                } else {
    200                         usb_log_fatal("Too many UHCI hardware failures!.\n");
     200                        usb_log_fatal("Too many UHCI hardware failures!.");
    201201                        hc_gone(&instance->base);
    202202                }
     
    229229            (void **) &instance->registers);
    230230        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.",
    232232                    str_error(ret));
    233233                return ret;
    234234        }
    235235
    236         usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.\n",
     236        usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.",
    237237            hw_res->io_ranges.ranges[0].address.absolute,
    238238            hw_res->io_ranges.ranges[0].size);
     
    240240        ret = hc_init_mem_structures(instance, hcd);
    241241        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.",
    243243                    str_error(ret));
    244244                // TODO: we should disable pio here
     
    304304        const uint16_t cmd = pio_read_16(&registers->usbcmd);
    305305        if (cmd != 0)
    306                 usb_log_warning("Previous command value: %x.\n", cmd);
     306                usb_log_warning("Previous command value: %x.", cmd);
    307307
    308308        /* Start the hc with large(64B) packet FSBR */
     
    399399                return ENOMEM;
    400400        }
    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);
    402402
    403403        /* Init transfer lists */
    404404        int ret = hc_init_transfer_lists(instance);
    405405        if (ret != EOK) {
    406                 usb_log_error("Failed to initialize transfer lists.\n");
     406                usb_log_error("Failed to initialize transfer lists.");
    407407                return_page(instance->frame_list);
    408408                return ENOMEM;
    409409        }
    410         usb_log_debug("Initialized transfer lists.\n");
     410        usb_log_debug("Initialized transfer lists.");
    411411
    412412
     
    438438        int ret = transfer_list_init(&instance->transfers_##type, name); \
    439439        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.", \
    441441                    name, str_error(ret)); \
    442442                transfer_list_fini(&instance->transfers_bulk_full); \
     
    552552
    553553                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",
    555555                            cmd, sts, intr);
    556556                }
     
    559559                    pio_read_32(&instance->registers->flbaseadd) & ~0xfff;
    560560                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.",
    562562                            (void *) frame_list,
    563563                            (void *) addr_to_phys(instance->frame_list));
     
    570570                uintptr_t real_pa = addr_to_phys(QH(interrupt));
    571571                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.",
    573573                            (void *) expected_pa, frnum, (void *) real_pa);
    574574                }
     
    577577                real_pa = addr_to_phys(QH(control_slow));
    578578                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.",
    580580                            (void *) expected_pa, (void *) real_pa);
    581581                }
     
    584584                real_pa = addr_to_phys(QH(control_full));
    585585                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.",
    587587                            (void *) expected_pa, (void *) real_pa);
    588588                }
     
    591591                real_pa = addr_to_phys(QH(bulk_full));
    592592                if (expected_pa != real_pa ) {
    593                         usb_log_debug("Bulk QH: %p vs. %p.\n",
     593                        usb_log_debug("Bulk QH: %p vs. %p.",
    594594                            (void *) expected_pa, (void *) real_pa);
    595595                }
Note: See TracChangeset for help on using the changeset viewer.