Lines Matching +full:max +full:- +full:speed

1 // SPDX-License-Identifier: GPL-2.0+
16 * reason -- maybe it's just too deep of a directory structure.
24 * this in any plug-and-play environment.)
26 * 1999-12-16: Thomas Sailer <sailer@ife.ee.ethz.ch>
32 * 2000-01-04: Thomas Sailer <sailer@ife.ee.ethz.ch>
34 * 2000-07-05: Ashley Montanaro <ashley@compsoc.man.ac.uk>
55 "\nT: Bus=%2.2d Lev=%2.2d Prnt=%2.2d Port=%2.2d Cnt=%2.2d Dev#=%3d Spd=%-4s MxCh=%2d\n";
77 "D: Ver=%2x.%02x Cls=%02x(%-5s) Sub=%02x Prot=%02x MxPS=%2d #Cfgs=%3d\n";
89 "A: FirstIf#=%2d IfCount=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x\n";
93 "I:%c If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n";
97 "E: Ad=%02x(%c) Atr=%02x(%-4s) MxPS=%4d Ivl=%d%cs\n";
105 /* max. 5 chars. per name string */
117 {USB_CLASS_CONTENT_SEC, "c-sec"},
127 {-1, "unk."} /* leave as last */
136 for (ix = 0; clas_info[ix].class != -1; ix++) in class_decode()
142 static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, in usb_dump_endpoint_descriptor() argument
153 if (speed == USB_SPEED_HIGH) in usb_dump_endpoint_descriptor()
160 if (speed == USB_SPEED_HIGH) /* uframes per NAK */ in usb_dump_endpoint_descriptor()
161 interval = desc->bInterval; in usb_dump_endpoint_descriptor()
168 interval = 1 << (desc->bInterval - 1); in usb_dump_endpoint_descriptor()
172 if (speed == USB_SPEED_HIGH && dir == 'O') /* uframes per NAK */ in usb_dump_endpoint_descriptor()
173 interval = desc->bInterval; in usb_dump_endpoint_descriptor()
179 if (speed == USB_SPEED_HIGH || speed >= USB_SPEED_SUPER) in usb_dump_endpoint_descriptor()
180 interval = 1 << (desc->bInterval - 1); in usb_dump_endpoint_descriptor()
182 interval = desc->bInterval; in usb_dump_endpoint_descriptor()
187 interval *= (speed == USB_SPEED_HIGH || in usb_dump_endpoint_descriptor()
188 speed >= USB_SPEED_SUPER) ? 125 : 1000; in usb_dump_endpoint_descriptor()
196 start += sprintf(start, format_endpt, desc->bEndpointAddress, dir, in usb_dump_endpoint_descriptor()
197 desc->bmAttributes, type, in usb_dump_endpoint_descriptor()
215 desc = &intfc->altsetting[setno].desc; in usb_dump_interface_descriptor()
217 driver_name = (iface->dev.driver in usb_dump_interface_descriptor()
218 ? iface->dev.driver->name in usb_dump_interface_descriptor()
220 active = (desc == &iface->cur_altsetting->desc); in usb_dump_interface_descriptor()
224 desc->bInterfaceNumber, in usb_dump_interface_descriptor()
225 desc->bAlternateSetting, in usb_dump_interface_descriptor()
226 desc->bNumEndpoints, in usb_dump_interface_descriptor()
227 desc->bInterfaceClass, in usb_dump_interface_descriptor()
228 class_decode(desc->bInterfaceClass), in usb_dump_interface_descriptor()
229 desc->bInterfaceSubClass, in usb_dump_interface_descriptor()
230 desc->bInterfaceProtocol, in usb_dump_interface_descriptor()
235 static char *usb_dump_interface(int speed, char *start, char *end, in usb_dump_interface() argument
239 const struct usb_host_interface *desc = &intfc->altsetting[setno]; in usb_dump_interface()
243 for (i = 0; i < desc->desc.bNumEndpoints; i++) { in usb_dump_interface()
246 start = usb_dump_endpoint_descriptor(speed, in usb_dump_interface()
247 start, end, &desc->endpoint[i].desc); in usb_dump_interface()
258 iad->bFirstInterface, in usb_dump_iad_descriptor()
259 iad->bInterfaceCount, in usb_dump_iad_descriptor()
260 iad->bFunctionClass, in usb_dump_iad_descriptor()
261 class_decode(iad->bFunctionClass), in usb_dump_iad_descriptor()
262 iad->bFunctionSubClass, in usb_dump_iad_descriptor()
263 iad->bFunctionProtocol); in usb_dump_iad_descriptor()
274 int active, int speed) in usb_dump_config_descriptor() argument
280 if (speed >= USB_SPEED_SUPER) in usb_dump_config_descriptor()
287 desc->bNumInterfaces, in usb_dump_config_descriptor()
288 desc->bConfigurationValue, in usb_dump_config_descriptor()
289 desc->bmAttributes, in usb_dump_config_descriptor()
290 desc->bMaxPower * mul); in usb_dump_config_descriptor()
294 static char *usb_dump_config(int speed, char *start, char *end, in usb_dump_config() argument
306 start = usb_dump_config_descriptor(start, end, &config->desc, active, in usb_dump_config()
307 speed); in usb_dump_config()
309 if (config->intf_assoc[i] == NULL) in usb_dump_config()
312 config->intf_assoc[i]); in usb_dump_config()
314 for (i = 0; i < config->desc.bNumInterfaces; i++) { in usb_dump_config()
315 intfc = config->intf_cache[i]; in usb_dump_config()
316 interface = config->interface[i]; in usb_dump_config()
317 for (j = 0; j < intfc->num_altsetting; j++) { in usb_dump_config()
320 start = usb_dump_interface(speed, in usb_dump_config()
333 u16 bcdUSB = le16_to_cpu(desc->bcdUSB); in usb_dump_device_descriptor()
334 u16 bcdDevice = le16_to_cpu(desc->bcdDevice); in usb_dump_device_descriptor()
340 desc->bDeviceClass, in usb_dump_device_descriptor()
341 class_decode(desc->bDeviceClass), in usb_dump_device_descriptor()
342 desc->bDeviceSubClass, in usb_dump_device_descriptor()
343 desc->bDeviceProtocol, in usb_dump_device_descriptor()
344 desc->bMaxPacketSize0, in usb_dump_device_descriptor()
345 desc->bNumConfigurations); in usb_dump_device_descriptor()
349 le16_to_cpu(desc->idVendor), in usb_dump_device_descriptor()
350 le16_to_cpu(desc->idProduct), in usb_dump_device_descriptor()
363 if (dev->manufacturer) in usb_dump_device_strings()
365 dev->manufacturer); in usb_dump_device_strings()
368 if (dev->product) in usb_dump_device_strings()
369 start += sprintf(start, format_string_product, dev->product); in usb_dump_device_strings()
373 if (dev->serial) in usb_dump_device_strings()
375 dev->serial); in usb_dump_device_strings()
388 start = usb_dump_device_descriptor(start, end, &dev->descriptor); in usb_dump_desc()
395 for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { in usb_dump_desc()
398 start = usb_dump_config(dev->speed, in usb_dump_desc()
399 start, end, dev->config + i, in usb_dump_desc()
401 (dev->config + i) == dev->actconfig); in usb_dump_desc()
420 ptr++; leng--; in usb_dump_hub_descriptor()
432 if (index <= dev->maxstring && dev->stringindex && in usb_dump_string()
433 dev->stringindex[index]) in usb_dump_string()
435 dev->stringindex[index]); in usb_dump_string()
444 * buffer - the user-space buffer to write data into
445 * nbytes - the maximum number of bytes to write
446 * skip_bytes - the number of bytes to skip before writing anything
447 * file_offset - the offset into the devices file on completion
458 char *pages_start, *data_end, *speed; in usb_device_dump() local
473 return -ENOMEM; in usb_device_dump()
475 if (usbdev->parent && usbdev->parent->devnum != -1) in usb_device_dump()
476 parent_devnum = usbdev->parent->devnum; in usb_device_dump()
481 switch (usbdev->speed) { in usb_device_dump()
483 speed = "1.5"; break; in usb_device_dump()
486 speed = "12"; break; in usb_device_dump()
487 case USB_SPEED_WIRELESS: /* Wireless has no real fixed speed */ in usb_device_dump()
489 speed = "480"; break; in usb_device_dump()
491 speed = "5000"; break; in usb_device_dump()
493 speed = "10000"; break; in usb_device_dump()
495 speed = "??"; in usb_device_dump()
498 bus->busnum, level, parent_devnum, in usb_device_dump()
499 index, count, usbdev->devnum, in usb_device_dump()
500 speed, usbdev->maxchild); in usb_device_dump()
502 * level = topology-tier level; in usb_device_dump()
509 int max; in usb_device_dump() local
511 /* super/high speed reserves 80%, full/low reserves 90% */ in usb_device_dump()
512 if (usbdev->speed == USB_SPEED_HIGH || in usb_device_dump()
513 usbdev->speed >= USB_SPEED_SUPER) in usb_device_dump()
514 max = 800; in usb_device_dump()
516 max = FRAME_TIME_MAX_USECS_ALLOC; in usb_device_dump()
523 bus->bandwidth_allocated, max, in usb_device_dump()
524 (100 * bus->bandwidth_allocated + max / 2) in usb_device_dump()
525 / max, in usb_device_dump()
526 bus->bandwidth_int_reqs, in usb_device_dump()
527 bus->bandwidth_isoc_reqs); in usb_device_dump()
530 data_end = usb_dump_desc(data_end, pages_start + (2 * PAGE_SIZE) - 256, in usb_device_dump()
533 if (data_end > (pages_start + (2 * PAGE_SIZE) - 256)) in usb_device_dump()
536 length = data_end - pages_start; in usb_device_dump()
539 length -= *skip_bytes; in usb_device_dump()
544 return -EFAULT; in usb_device_dump()
546 *nbytes -= length; in usb_device_dump()
552 *skip_bytes -= length; in usb_device_dump()
561 level + 1, chix - 1, ++cnt); in usb_device_dump()
563 if (ret == -EFAULT) in usb_device_dump()
579 return -EINVAL; in usb_device_read()
587 if (!bus_to_hcd(bus)->rh_registered) in usb_device_read()
589 usb_lock_device(bus->root_hub); in usb_device_read()
591 bus->root_hub, bus, 0, 0, 0); in usb_device_read()
592 usb_unlock_device(bus->root_hub); in usb_device_read()