Changeset a1732929 in mainline for uspace/drv/bus/usb/ehci


Ignore:
Timestamp:
2018-01-15T17:04:34Z (8 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.

Location:
uspace/drv/bus/usb/ehci
Files:
5 edited

Legend:

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

    rc1a966e ra1732929  
    143143        batch_setup[ehci_batch->base.ep->transfer_type](ehci_batch);
    144144
    145         usb_log_debug("Batch %p %s " USB_TRANSFER_BATCH_FMT " initialized.\n",
     145        usb_log_debug("Batch %p %s " USB_TRANSFER_BATCH_FMT " initialized.",
    146146            ehci_batch, usb_str_direction(ehci_batch->base.dir),
    147147            USB_TRANSFER_BATCH_ARGS(ehci_batch->base));
     
    163163        assert(ehci_batch);
    164164
    165         usb_log_debug("Batch %p: checking %zu td(s) for completion.\n",
     165        usb_log_debug("Batch %p: checking %zu td(s) for completion.",
    166166            ehci_batch, ehci_batch->td_count);
    167167
    168         usb_log_debug2("Batch %p: QH: %08x:%08x:%08x:%08x:%08x:%08x.\n",
     168        usb_log_debug2("Batch %p: QH: %08x:%08x:%08x:%08x:%08x:%08x.",
    169169            ehci_batch,
    170170            ehci_batch->qh->ep_char, ehci_batch->qh->ep_cap,
  • uspace/drv/bus/usb/ehci/ehci_rh.c

    rc1a966e ra1732929  
    107107            (EHCI_RD(caps->hcsparams) >> EHCI_CAPS_HCS_N_PORTS_SHIFT) &
    108108            EHCI_CAPS_HCS_N_PORTS_MASK;
    109         usb_log_debug2("RH(%p): hcsparams: %x.\n", instance,
     109        usb_log_debug2("RH(%p): hcsparams: %x.", instance,
    110110            EHCI_RD(caps->hcsparams));
    111         usb_log_info("RH(%p): Found %u ports.\n", instance,
     111        usb_log_info("RH(%p): Found %u ports.", instance,
    112112            instance->port_count);
    113113
  • uspace/drv/bus/usb/ehci/endpoint_list.c

    rc1a966e ra1732929  
    9797        assert(ep);
    9898        assert(ep->qh);
    99         usb_log_debug2("EPL(%p-%s): Append endpoint(%p).\n",
     99        usb_log_debug2("EPL(%p-%s): Append endpoint(%p).",
    100100            instance, instance->name, ep);
    101101
     
    128128        ehci_endpoint_t *first = ehci_endpoint_list_instance(
    129129            list_first(&instance->endpoint_list));
    130         usb_log_debug("EPL(%p-%s): EP(%p) added to list, first is %p(%p).\n",
     130        usb_log_debug("EPL(%p-%s): EP(%p) added to list, first is %p(%p).",
    131131            instance, instance->name, ep, first, first->qh);
    132132        if (last_qh == instance->list_head) {
    133                 usb_log_debug2("EPL(%p-%s): head EP(%p-%"PRIxn"): %x:%x.\n",
     133                usb_log_debug2("EPL(%p-%s): head EP(%p-%"PRIxn"): %x:%x.",
    134134                    instance, instance->name, last_qh,
    135135                    addr_to_phys(instance->list_head),
     
    153153        fibril_mutex_lock(&instance->guard);
    154154
    155         usb_log_debug2("EPL(%p-%s): removing EP(%p).\n",
     155        usb_log_debug2("EPL(%p-%s): removing EP(%p).",
    156156            instance, instance->name, ep);
    157157
     
    172172        write_barrier();
    173173
    174         usb_log_debug("EPL(%p-%s): EP(%p) removed (%s), horizontal %x.\n",
     174        usb_log_debug("EPL(%p-%s): EP(%p) removed (%s), horizontal %x.",
    175175            instance, instance->name,  ep, qpos, ep->qh->horizontal);
    176176
  • uspace/drv/bus/usb/ehci/hc.c

    rc1a966e ra1732929  
    134134        EHCI_WR(code->cmds[1].value, EHCI_USED_INTERRUPTS);
    135135
    136         usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n",
     136        usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.",
    137137            RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
    138138
     
    160160        if (ret != EOK) {
    161161                usb_log_error("HC(%p): Failed to gain access to device "
    162                     "registers: %s.\n", instance, str_error(ret));
     162                    "registers: %s.", instance, str_error(ret));
    163163                return ret;
    164164        }
     
    211211        assert(ep);
    212212        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    213         usb_log_debug("HC(%p) enqueue EP(%d:%d:%s:%s)\n", instance,
     213        usb_log_debug("HC(%p) enqueue EP(%d:%d:%s:%s)", instance,
    214214            ep->device->address, ep->endpoint,
    215215            usb_str_transfer_type_short(ep->transfer_type),
     
    235235        assert(ep);
    236236        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    237         usb_log_debug("HC(%p) dequeue EP(?:%d:%s:%s)\n", instance,
     237        usb_log_debug("HC(%p) dequeue EP(?:%d:%s:%s)", instance,
    238238            ep->endpoint,
    239239            usb_str_transfer_type_short(ep->transfer_type),
     
    423423        usb_log_debug("HC(%p): HW started.", instance);
    424424
    425         usb_log_debug2("HC(%p): Registers: \n"
    426             "\tUSBCMD(%p): %x(0x00080000 = at least 1ms between interrupts)\n"
    427             "\tUSBSTS(%p): %x(0x00001000 = HC halted)\n"
    428             "\tUSBINT(%p): %x(0x0 = no interrupts).\n"
    429             "\tCONFIG(%p): %x(0x0 = ports controlled by companion hc).\n",
     425        usb_log_debug2("HC(%p): Registers: "
     426            "\tUSBCMD(%p): %x(0x00080000 = at least 1ms between interrupts)"
     427            "\tUSBSTS(%p): %x(0x00001000 = HC halted)"
     428            "\tUSBINT(%p): %x(0x0 = no interrupts)."
     429            "\tCONFIG(%p): %x(0x0 = ports controlled by companion hc).",
    430430            instance,
    431431            &instance->registers->usbcmd, EHCI_RD(instance->registers->usbcmd),
  • uspace/drv/bus/usb/ehci/res.c

    rc1a966e ra1732929  
    7474            eecp + USBLEGSUP_OFFSET, &usblegsup);
    7575        if (ret != EOK) {
    76                 usb_log_error("Failed to read USBLEGSUP: %s.\n", str_error(ret));
    77                 return ret;
    78         }
    79         usb_log_debug2("USBLEGSUP: %" PRIx32 ".\n", usblegsup);
     76                usb_log_error("Failed to read USBLEGSUP: %s.", str_error(ret));
     77                return ret;
     78        }
     79        usb_log_debug2("USBLEGSUP: %" PRIx32 ".", usblegsup);
    8080
    8181        /* Request control from firmware/BIOS by writing 1 to highest
    8282         * byte. (OS Control semaphore)*/
    83         usb_log_debug("Requesting OS control.\n");
     83        usb_log_debug("Requesting OS control.");
    8484        ret = pci_config_space_write_8(parent_sess,
    8585            eecp + USBLEGSUP_OFFSET + 3, 1);
    8686        if (ret != EOK) {
    87                 usb_log_error("Failed to request OS EHCI control: %s.\n",
     87                usb_log_error("Failed to request OS EHCI control: %s.",
    8888                    str_error(ret));
    8989                return ret;
     
    103103
    104104        if ((usblegsup & USBLEGSUP_BIOS_CONTROL) == 0) {
    105                 usb_log_info("BIOS released control after %zu usec.\n", wait);
     105                usb_log_info("BIOS released control after %zu usec.", wait);
    106106                return EOK;
    107107        }
     
    109109        /* BIOS failed to hand over control, this should not happen. */
    110110        usb_log_warning( "BIOS failed to release control after "
    111             "%zu usecs, force it.\n", wait);
     111            "%zu usecs, force it.", wait);
    112112        ret = pci_config_space_write_32(parent_sess,
    113113            eecp + USBLEGSUP_OFFSET, USBLEGSUP_OS_CONTROL);
    114114        if (ret != EOK) {
    115                 usb_log_error("Failed to force OS control: %s.\n",
     115                usb_log_error("Failed to force OS control: %s.",
    116116                    str_error(ret));
    117117                return ret;
     
    130130                    eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
    131131                if (ret != EOK) {
    132                         usb_log_error("Failed to get USBLEGCTLSTS: %s.\n",
     132                        usb_log_error("Failed to get USBLEGCTLSTS: %s.",
    133133                            str_error(ret));
    134134                        return ret;
    135135                }
    136                 usb_log_debug2("USBLEGCTLSTS: %" PRIx32 ".\n", usblegctlsts);
     136                usb_log_debug2("USBLEGCTLSTS: %" PRIx32 ".", usblegctlsts);
    137137                /*
    138138                 * Zero SMI enables in legacy control register.
     
    143143                    eecp + USBLEGCTLSTS_OFFSET, 0xe0000000);
    144144                if (ret != EOK) {
    145                         usb_log_error("Failed to zero USBLEGCTLSTS: %s\n",
     145                        usb_log_error("Failed to zero USBLEGCTLSTS: %s",
    146146                            str_error(ret));
    147147                        return ret;
     
    153153                    eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
    154154                if (ret != EOK) {
    155                         usb_log_error("Failed to get USBLEGCTLSTS 2: %s.\n",
     155                        usb_log_error("Failed to get USBLEGCTLSTS 2: %s.",
    156156                            str_error(ret));
    157157                        return ret;
    158158                }
    159                 usb_log_debug2("Zeroed USBLEGCTLSTS: %" PRIx32 ".\n",
     159                usb_log_debug2("Zeroed USBLEGCTLSTS: %" PRIx32 ".",
    160160                    usblegctlsts);
    161161        }
     
    165165            eecp + USBLEGSUP_OFFSET, &usblegsup);
    166166        if (ret != EOK) {
    167                 usb_log_error("Failed to read USBLEGSUP: %s.\n",
    168                     str_error(ret));
    169                 return ret;
    170         }
    171         usb_log_debug2("USBLEGSUP: %" PRIx32 ".\n", usblegsup);
     167                usb_log_error("Failed to read USBLEGSUP: %s.",
     168                    str_error(ret));
     169                return ret;
     170        }
     171        usb_log_debug2("USBLEGSUP: %" PRIx32 ".", usblegsup);
    172172        return ret;
    173173}
     
    181181                return ENOMEM;
    182182
    183         usb_log_debug("Disabling EHCI legacy support.\n");
     183        usb_log_debug("Disabling EHCI legacy support.");
    184184
    185185
    186186        const uint32_t hcc_params = EHCI_RD(hc->caps->hccparams);
    187         usb_log_debug2("Value of hcc params register: %x.\n", hcc_params);
     187        usb_log_debug2("Value of hcc params register: %x.", hcc_params);
    188188
    189189        /* Read value of EHCI Extended Capabilities Pointer
     
    191191        const uint32_t eecp =
    192192            (hcc_params >> EHCI_CAPS_HCC_EECP_SHIFT) & EHCI_CAPS_HCC_EECP_MASK;
    193         usb_log_debug2("Value of EECP: %x.\n", eecp);
     193        usb_log_debug2("Value of EECP: %x.", eecp);
    194194
    195195        int ret = disable_extended_caps(parent_sess, eecp);
    196196        if (ret != EOK) {
    197                 usb_log_error("Failed to disable extended capabilities: %s.\n",
     197                usb_log_error("Failed to disable extended capabilities: %s.",
    198198                    str_error(ret));
    199199                    goto clean;
Note: See TracChangeset for help on using the changeset viewer.