Changeset c4fb5ecd in mainline


Ignore:
Timestamp:
2011-06-18T19:18:41Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
497b6f31
Parents:
84eb7432
Message:

Less logging in USB host controller drivers

Many of the debug messages were degraded to debug2 level or
completely removed. Also added formatting string for unified
dump of USB transfer batches.

Warnings in EHCI stub use debug level now.

Location:
uspace
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ehci_hcd/hc_iface.c

    r84eb7432 rc4fb5ecd  
    4545
    4646#define UNSUPPORTED(methodname) \
    47         usb_log_warning("Unsupported interface method `%s()' in %s:%d.\n", \
     47        usb_log_debug("Client called unsupported interface method " \
     48            "`%s()' in %s:%d.\n", \
    4849            methodname, __FILE__, __LINE__)
    4950
  • uspace/drv/ohci/hc.c

    r84eb7432 rc4fb5ecd  
    6565            device_keeper_get_free_address(&instance->manager, USB_SPEED_FULL);
    6666        if (hub_address <= 0) {
    67                 usb_log_error("Failed(%d) to get OHCI root hub address.\n",
    68                     hub_address);
     67                usb_log_error("Failed to get OHCI root hub address: %s\n",
     68                    str_error(hub_address));
    6969                return hub_address;
    7070        }
     
    445445        /* HC is in reset (hw startup) => no other driver
    446446         * maintain reset for at least the time specified in USB spec (50 ms)*/
    447         usb_log_info("HC found in reset.\n");
     447        usb_log_debug("Host controller found in reset state.\n");
    448448        async_usleep(50000);
    449449}
     
    516516
    517517        instance->registers->control &= (C_HCFS_OPERATIONAL << C_HCFS_SHIFT);
    518         usb_log_info("OHCI HC up and running(%x).\n",
     518        usb_log_debug("OHCI HC up and running (ctl_reg=0x%x).\n",
    519519            instance->registers->control);
    520520}
  • uspace/drv/ohci/root_hub.c

    r84eb7432 rc4fb5ecd  
    232232                return ENOMEM;
    233233
    234         usb_log_info("OHCI root hub with %zu ports initialized.\n",
     234        usb_log_info("Root hub (%zu ports) initialized.\n",
    235235            instance->port_count);
    236236
     
    521521                case USB_DESCTYPE_HUB:
    522522                {
    523                         usb_log_debug("USB_DESCTYPE_HUB\n");
     523                        usb_log_debug2("USB_DESCTYPE_HUB\n");
    524524                        result_descriptor = instance->hub_descriptor;
    525525                        size = instance->descriptor_size;
     
    528528                case USB_DESCTYPE_DEVICE:
    529529                {
    530                         usb_log_debug("USB_DESCTYPE_DEVICE\n");
     530                        usb_log_debug2("USB_DESCTYPE_DEVICE\n");
    531531                        result_descriptor = &ohci_rh_device_descriptor;
    532532                        size = sizeof (ohci_rh_device_descriptor);
     
    535535                case USB_DESCTYPE_CONFIGURATION:
    536536                {
    537                         usb_log_debug("USB_DESCTYPE_CONFIGURATION\n");
     537                        usb_log_debug2("USB_DESCTYPE_CONFIGURATION\n");
    538538                        result_descriptor = instance->descriptors.configuration;
    539539                        size = instance->descriptors.configuration_size;
     
    542542                case USB_DESCTYPE_INTERFACE:
    543543                {
    544                         usb_log_debug("USB_DESCTYPE_INTERFACE\n");
     544                        usb_log_debug2("USB_DESCTYPE_INTERFACE\n");
    545545                        result_descriptor = &ohci_rh_iface_descriptor;
    546546                        size = sizeof (ohci_rh_iface_descriptor);
     
    549549                case USB_DESCTYPE_ENDPOINT:
    550550                {
    551                         usb_log_debug("USB_DESCTYPE_ENDPOINT\n");
     551                        usb_log_debug2("USB_DESCTYPE_ENDPOINT\n");
    552552                        result_descriptor = &ohci_rh_ep_descriptor;
    553553                        size = sizeof (ohci_rh_ep_descriptor);
     
    556556                default:
    557557                {
    558                         usb_log_debug("USB_DESCTYPE_EINVAL %d \n",
     558                        usb_log_debug2("USB_DESCTYPE_EINVAL %d \n",
    559559                            setup_request->value);
    560                         usb_log_debug("\ttype %d\n\trequest %d\n\tvalue "
     560                        usb_log_debug2("\ttype %d\n\trequest %d\n\tvalue "
    561561                            "%d\n\tindex %d\n\tlen %d\n ",
    562562                            setup_request->request_type,
     
    789789                }
    790790                if (setup_request->request_type == USB_HUB_REQ_TYPE_SET_PORT_FEATURE) {
    791                         usb_log_debug("USB_HUB_REQ_TYPE_SET_PORT_FEATURE\n");
     791                        usb_log_debug2("USB_HUB_REQ_TYPE_SET_PORT_FEATURE\n");
    792792                        return process_port_feature_clear_request(instance,
    793793                            setup_request->value,
     
    854854                return EINVAL;
    855855        }
    856         usb_log_info("CTRL packet: %s.\n",
     856        usb_log_debug("CTRL packet: %s.\n",
    857857            usb_debug_str_buffer(
    858858            (const uint8_t *) request->setup_buffer, 8, 8));
     
    864864                case USB_DEVREQ_GET_DESCRIPTOR:
    865865                case USB_DEVREQ_GET_CONFIGURATION:
    866                         usb_log_debug("Processing request with output\n");
     866                        usb_log_debug2("Processing request with output\n");
    867867                        opResult = process_request_with_output(
    868868                            instance, request);
     
    871871                case USB_DEVREQ_SET_FEATURE:
    872872                case USB_DEVREQ_SET_ADDRESS:
    873                         usb_log_debug("Processing request without "
     873                        usb_log_debug2("Processing request without "
    874874                            "additional data\n");
    875875                        opResult = process_request_without_data(
     
    878878                case USB_DEVREQ_SET_DESCRIPTOR:
    879879                case USB_DEVREQ_SET_CONFIGURATION:
    880                         usb_log_debug("Processing request with "
    881                             "input\n");
     880                        usb_log_debug2("Processing request with input\n");
    882881                        opResult = process_request_with_input(
    883882                            instance, request);
     
    885884                        break;
    886885                default:
    887                         usb_log_warning("Received unsuported request: "
    888                             "%d\n",
    889                             setup_request->request
    890                             );
     886                        usb_log_warning("Received unsupported request: %d.\n",
     887                            setup_request->request);
    891888                        opResult = ENOTSUP;
    892889        }
  • uspace/drv/uhci_hcd/batch.c

    r84eb7432 rc4fb5ecd  
    147147            + sizeof(qh_t);
    148148        void *data_buffer = setup + setup_size;
    149         usb_target_t target =
    150             { .address = ep->address, .endpoint = ep->endpoint };
    151149        usb_transfer_batch_init(instance, ep, buffer, data_buffer, buffer_size,
    152150            setup, setup_size, func_in, func_out, arg, fun,
     
    154152
    155153        memcpy(instance->setup_buffer, setup_buffer, setup_size);
    156         usb_log_debug("Batch(%p) %d:%d memory structures ready.\n",
    157             instance, target.address, target.endpoint);
     154        usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT
     155            " memory structures ready.\n", instance,
     156            USB_TRANSFER_BATCH_ARGS(*instance));
    158157        return instance;
    159158}
     
    205204        return true;
    206205}
     206
     207#define LOG_BATCH_INITIALIZED(batch, name) \
     208        usb_log_debug2("Batch %p %s " USB_TRANSFER_BATCH_FMT " initialized.\n", \
     209            (batch), (name), USB_TRANSFER_BATCH_ARGS(*(batch)))
     210
    207211/*----------------------------------------------------------------------------*/
    208212/** Prepares control write transfer.
     
    219223        batch_control(instance, USB_PID_OUT, USB_PID_IN);
    220224        instance->next_step = usb_transfer_batch_call_out_and_dispose;
    221         usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance);
     225        LOG_BATCH_INITIALIZED(instance, "control write");
    222226}
    223227/*----------------------------------------------------------------------------*/
     
    233237        batch_control(instance, USB_PID_IN, USB_PID_OUT);
    234238        instance->next_step = usb_transfer_batch_call_in_and_dispose;
    235         usb_log_debug("Batch(%p) CONTROL READ initialized.\n", instance);
     239        LOG_BATCH_INITIALIZED(instance, "control read");
    236240}
    237241/*----------------------------------------------------------------------------*/
     
    247251        batch_data(instance, USB_PID_IN);
    248252        instance->next_step = usb_transfer_batch_call_in_and_dispose;
    249         usb_log_debug("Batch(%p) INTERRUPT IN initialized.\n", instance);
     253        LOG_BATCH_INITIALIZED(instance, "interrupt in");
    250254}
    251255/*----------------------------------------------------------------------------*/
     
    263267        batch_data(instance, USB_PID_OUT);
    264268        instance->next_step = usb_transfer_batch_call_out_and_dispose;
    265         usb_log_debug("Batch(%p) INTERRUPT OUT initialized.\n", instance);
     269        LOG_BATCH_INITIALIZED(instance, "interrupt out");
    266270}
    267271/*----------------------------------------------------------------------------*/
     
    277281        batch_data(instance, USB_PID_IN);
    278282        instance->next_step = usb_transfer_batch_call_in_and_dispose;
    279         usb_log_debug("Batch(%p) BULK IN initialized.\n", instance);
     283        LOG_BATCH_INITIALIZED(instance, "bulk in");
    280284}
    281285/*----------------------------------------------------------------------------*/
     
    293297        batch_data(instance, USB_PID_OUT);
    294298        instance->next_step = usb_transfer_batch_call_out_and_dispose;
    295         usb_log_debug("Batch(%p) BULK OUT initialized.\n", instance);
     299        LOG_BATCH_INITIALIZED(instance, "bulk out");
    296300}
    297301/*----------------------------------------------------------------------------*/
  • uspace/drv/uhci_hcd/hw_struct/transfer_descriptor.c

    r84eb7432 rc4fb5ecd  
    103103        td_print_status(instance);
    104104        if (pid == USB_PID_SETUP) {
    105                 usb_log_debug("SETUP BUFFER: %s\n",
     105                usb_log_debug2("SETUP BUFFER: %s\n",
    106106                    usb_debug_str_buffer(buffer, 8, 8));
    107107        }
  • uspace/drv/uhci_hcd/iface.c

    r84eb7432 rc4fb5ecd  
    6464        }
    6565
    66         usb_log_debug("%s %d:%d %zu(%zu).\n",
     66        usb_log_debug2("%s %d:%d %zu(%zu).\n",
    6767            name, target.address, target.endpoint, size, ep->max_packet_size);
    6868
     
    172172                speed = ep_speed;
    173173        }
    174         usb_log_debug("Register endpoint %d:%d %s %s(%d) %zu(%zu) %u.\n",
     174        usb_log_debug("Register endpoint %d:%d %s-%s %s %zuB %ums.\n",
    175175            address, endpoint, usb_str_transfer_type(transfer_type),
    176             usb_str_speed(speed), direction, size, max_packet_size, interval);
     176            usb_str_direction(direction), usb_str_speed(speed),
     177            max_packet_size, interval);
    177178
    178179        return usb_endpoint_manager_add_ep(&hc->ep_manager, address, endpoint,
     
    187188        hc_t *hc = fun_to_hc(fun);
    188189        assert(hc);
    189         usb_log_debug("Unregister endpoint %d:%d %d.\n",
    190             address, endpoint, direction);
     190        usb_log_debug("Unregister endpoint %d:%d %s.\n",
     191            address, endpoint, usb_str_direction(direction));
    191192        return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address,
    192193            endpoint, direction);
  • uspace/drv/uhci_hcd/transfer_list.c

    r84eb7432 rc4fb5ecd  
    141141        list_append(&batch->link, &instance->batch_list);
    142142
    143         usb_transfer_batch_t *first = list_get_instance(
    144             instance->batch_list.next, usb_transfer_batch_t, link);
    145         usb_log_debug("Batch(%p) added to queue %s, first is %p.\n",
    146                 batch, instance->name, first);
     143        usb_log_debug("Batch %p " USB_TRANSFER_BATCH_FMT " scheduled in queue %s.\n",
     144            batch, USB_TRANSFER_BATCH_ARGS(*batch), instance->name);
    147145        fibril_mutex_unlock(&instance->guard);
    148146}
     
    234232        /* Remove from the batch list */
    235233        list_remove(&batch->link);
    236         usb_log_debug("Batch(%p) removed (%s) from %s, next: %x.\n",
    237             batch, qpos, instance->name, batch_qh(batch)->next);
     234        usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " removed (%s) "
     235            "from %s, next: %x.\n",
     236            batch, USB_TRANSFER_BATCH_ARGS(*batch),
     237            qpos, instance->name, batch_qh(batch)->next);
    238238}
    239239/**
  • uspace/lib/usbhost/include/usb/host/batch.h

    r84eb7432 rc4fb5ecd  
    6161};
    6262
     63/** Printf formatting string for dumping usb_transfer_batch_t. */
     64#define USB_TRANSFER_BATCH_FMT "[%d:%d %s %s-%s %zuB/%zu]"
     65
     66/** Printf arguments for dumping usb_transfer_batch_t.
     67 * @param batch USB transfer batch to be dumped.
     68 */
     69#define USB_TRANSFER_BATCH_ARGS(batch) \
     70        (batch).ep->address, (batch).ep->endpoint, \
     71        usb_str_speed((batch).ep->speed), \
     72        usb_str_transfer_type_short((batch).ep->transfer_type), \
     73        usb_str_direction((batch).ep->direction), \
     74        (batch).buffer_size, (batch).ep->max_packet_size
     75
     76
    6377void usb_transfer_batch_init(
    6478    usb_transfer_batch_t *instance,
  • uspace/lib/usbhost/src/batch.c

    r84eb7432 rc4fb5ecd  
    128128        memcpy(instance->buffer, instance->data_buffer, instance->buffer_size);
    129129
    130         usb_log_debug("Batch(%p) done (T%d.%d, %s %s in, %zuB): %s (%d).\n",
    131             instance, instance->ep->address, instance->ep->endpoint,
    132             usb_str_speed(instance->ep->speed),
    133             usb_str_transfer_type_short(instance->ep->transfer_type),
    134             instance->transfered_size, str_error(instance->error),
    135             instance->error);
     130        usb_log_debug("Batch %p " USB_TRANSFER_BATCH_FMT " completed (%zuB): %s.\n",
     131            instance, USB_TRANSFER_BATCH_ARGS(*instance),
     132            instance->transfered_size, str_error(instance->error));
    136133
    137134        instance->callback_in(instance->fun, instance->error,
     
    148145        assert(instance->callback_out);
    149146
    150         usb_log_debug("Batch(%p) done (T%d.%d, %s %s out): %s (%d).\n",
    151             instance, instance->ep->address, instance->ep->endpoint,
    152             usb_str_speed(instance->ep->speed),
    153             usb_str_transfer_type_short(instance->ep->transfer_type),
    154             str_error(instance->error), instance->error);
     147        usb_log_debug("Batch %p " USB_TRANSFER_BATCH_FMT " completed: %s.\n",
     148            instance, USB_TRANSFER_BATCH_ARGS(*instance),
     149            str_error(instance->error));
    155150
    156151        instance->callback_out(instance->fun,
     
    165160{
    166161        assert(instance);
    167         usb_log_debug("Batch(%p) disposing.\n", instance);
     162        usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " disposing.\n",
     163            instance, USB_TRANSFER_BATCH_ARGS(*instance));
    168164        if (instance->private_data) {
    169165                assert(instance->private_data_dtor);
Note: See TracChangeset for help on using the changeset viewer.