Deleted Added
full compact
usb_hub.c (184610) usb_hub.c (184824)
1/* $FreeBSD: head/sys/dev/usb2/core/usb2_hub.c 184610 2008-11-04 02:31:03Z alfred $ */
1/* $FreeBSD: head/sys/dev/usb2/core/usb2_hub.c 184824 2008-11-10 20:54:31Z thompsa $ */
2/*-
3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 741 unchanged lines hidden (view full) ---

751 }
752
753 device_printf(dev, "%d port%s with %d "
754 "removable, %s powered\n", nports, (nports != 1) ? "s" : "",
755 removable, udev->flags.self_powered ? "self" : "bus");
756
757 /* start the interrupt endpoint */
758
2/*-
3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 741 unchanged lines hidden (view full) ---

751 }
752
753 device_printf(dev, "%d port%s with %d "
754 "removable, %s powered\n", nports, (nports != 1) ? "s" : "",
755 removable, udev->flags.self_powered ? "self" : "bus");
756
757 /* start the interrupt endpoint */
758
759 mtx_lock(sc->sc_xfer[0]->priv_mtx);
759 USB_XFER_LOCK(sc->sc_xfer[0]);
760 usb2_transfer_start(sc->sc_xfer[0]);
760 usb2_transfer_start(sc->sc_xfer[0]);
761 mtx_unlock(sc->sc_xfer[0]->priv_mtx);
761 USB_XFER_UNLOCK(sc->sc_xfer[0]);
762
763 return (0);
764
765error:
766 usb2_transfer_unsetup(sc->sc_xfer, 2);
767
768 if (udev->hub) {
769 free(udev->hub, M_USBDEV);

--- 227 unchanged lines hidden (view full) ---

997 * The slot on which the bandwidth update was done.
998 *------------------------------------------------------------------------*/
999uint8_t
1000usb2_intr_schedule_adjust(struct usb2_device *udev, int16_t len, uint8_t slot)
1001{
1002 struct usb2_bus *bus = udev->bus;
1003 struct usb2_hub *hub;
1004
762
763 return (0);
764
765error:
766 usb2_transfer_unsetup(sc->sc_xfer, 2);
767
768 if (udev->hub) {
769 free(udev->hub, M_USBDEV);

--- 227 unchanged lines hidden (view full) ---

997 * The slot on which the bandwidth update was done.
998 *------------------------------------------------------------------------*/
999uint8_t
1000usb2_intr_schedule_adjust(struct usb2_device *udev, int16_t len, uint8_t slot)
1001{
1002 struct usb2_bus *bus = udev->bus;
1003 struct usb2_hub *hub;
1004
1005 mtx_assert(&bus->mtx, MA_OWNED);
1005 USB_BUS_LOCK_ASSERT(bus, MA_OWNED);
1006
1007 if (usb2_get_speed(udev) == USB_SPEED_HIGH) {
1008 if (slot >= USB_HS_MICRO_FRAMES_MAX) {
1009 slot = usb2_intr_find_best_slot(bus->uframe_usage, 0,
1010 USB_HS_MICRO_FRAMES_MAX);
1011 }
1012 bus->uframe_usage[slot] += len;
1013 } else {

--- 60 unchanged lines hidden (view full) ---

1074 * Returns:
1075 * 16-bit isochronous time counter.
1076 *------------------------------------------------------------------------*/
1077uint16_t
1078usb2_isoc_time_expand(struct usb2_bus *bus, uint16_t isoc_time_curr)
1079{
1080 uint16_t rem;
1081
1006
1007 if (usb2_get_speed(udev) == USB_SPEED_HIGH) {
1008 if (slot >= USB_HS_MICRO_FRAMES_MAX) {
1009 slot = usb2_intr_find_best_slot(bus->uframe_usage, 0,
1010 USB_HS_MICRO_FRAMES_MAX);
1011 }
1012 bus->uframe_usage[slot] += len;
1013 } else {

--- 60 unchanged lines hidden (view full) ---

1074 * Returns:
1075 * 16-bit isochronous time counter.
1076 *------------------------------------------------------------------------*/
1077uint16_t
1078usb2_isoc_time_expand(struct usb2_bus *bus, uint16_t isoc_time_curr)
1079{
1080 uint16_t rem;
1081
1082 mtx_assert(&bus->mtx, MA_OWNED);
1082 USB_BUS_LOCK_ASSERT(bus, MA_OWNED);
1083
1084 rem = bus->isoc_time_last & (USB_ISOC_TIME_MAX - 1);
1085
1086 isoc_time_curr &= (USB_ISOC_TIME_MAX - 1);
1087
1088 if (isoc_time_curr < rem) {
1089 /* the time counter wrapped around */
1090 bus->isoc_time_last += USB_ISOC_TIME_MAX;

--- 183 unchanged lines hidden (view full) ---

1274usb2_needs_explore(struct usb2_bus *bus, uint8_t do_probe)
1275{
1276 DPRINTF("\n");
1277
1278 if (bus == NULL) {
1279 DPRINTF("No bus pointer!\n");
1280 return;
1281 }
1083
1084 rem = bus->isoc_time_last & (USB_ISOC_TIME_MAX - 1);
1085
1086 isoc_time_curr &= (USB_ISOC_TIME_MAX - 1);
1087
1088 if (isoc_time_curr < rem) {
1089 /* the time counter wrapped around */
1090 bus->isoc_time_last += USB_ISOC_TIME_MAX;

--- 183 unchanged lines hidden (view full) ---

1274usb2_needs_explore(struct usb2_bus *bus, uint8_t do_probe)
1275{
1276 DPRINTF("\n");
1277
1278 if (bus == NULL) {
1279 DPRINTF("No bus pointer!\n");
1280 return;
1281 }
1282 mtx_lock(&bus->mtx);
1282 USB_BUS_LOCK(bus);
1283 if (do_probe) {
1284 bus->do_probe = 1;
1285 }
1286 if (usb2_proc_msignal(&bus->explore_proc,
1287 &bus->explore_msg[0], &bus->explore_msg[1])) {
1288 /* ignore */
1289 }
1283 if (do_probe) {
1284 bus->do_probe = 1;
1285 }
1286 if (usb2_proc_msignal(&bus->explore_proc,
1287 &bus->explore_msg[0], &bus->explore_msg[1])) {
1288 /* ignore */
1289 }
1290 mtx_unlock(&bus->mtx);
1290 USB_BUS_UNLOCK(bus);
1291 return;
1292}
1293
1294/*------------------------------------------------------------------------*
1295 * usb2_needs_explore_all
1296 *
1297 * This function is called whenever a new driver is loaded and will
1298 * cause that all USB busses are re-explored.

--- 32 unchanged lines hidden ---
1291 return;
1292}
1293
1294/*------------------------------------------------------------------------*
1295 * usb2_needs_explore_all
1296 *
1297 * This function is called whenever a new driver is loaded and will
1298 * cause that all USB busses are re-explored.

--- 32 unchanged lines hidden ---