1 /* $FreeBSD$ */ 2 /*- 3 * SPDX-License-Identifier: BSD-2-Clause-NetBSD 4 * 5 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. 6 * Copyright (c) 1998 Lennart Augustsson. All rights reserved. 7 * Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31 /* 32 * USB spec: http://www.usb.org/developers/docs/usbspec.zip 33 */ 34 35 #ifndef USB_HUB_PRIVATE_H_ 36 #define USB_HUB_PRIVATE_H_ 37 #define UHUB_INTR_INTERVAL 250 /* ms */ 38 39 enum { 40 UHUB_INTR_TRANSFER, 41 #if USB_HAVE_TT_SUPPORT 42 UHUB_RESET_TT_TRANSFER, 43 #endif 44 UHUB_N_TRANSFER, 45 }; 46 47 struct uhub_current_state { 48 uint16_t port_change; 49 uint16_t port_status; 50 }; 51 52 struct uhub_softc { 53 struct uhub_current_state sc_st; /* current state */ 54 #if (USB_HAVE_FIXED_PORT != 0) 55 struct usb_hub sc_hub; 56 #endif 57 device_t sc_dev; /* base device */ 58 struct mtx sc_mtx; /* our mutex */ 59 struct usb_device *sc_udev; /* USB device */ 60 struct usb_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt xfer */ 61 #if USB_HAVE_DISABLE_ENUM 62 int sc_disable_enumeration; 63 int sc_disable_port_power; 64 #endif 65 uint8_t sc_usb_port_errors; /* error counter */ 66 #define UHUB_USB_PORT_ERRORS_MAX 4 67 uint8_t sc_flags; 68 #define UHUB_FLAG_DID_EXPLORE 0x01 69 }; 70 struct hub_result { 71 struct usb_device *udev; 72 uint8_t portno; 73 uint8_t iface_index; 74 }; 75 76 void 77 uhub_find_iface_index(struct usb_hub *hub, device_t child, 78 struct hub_result *res); 79 80 device_probe_t uhub_probe; 81 device_attach_t uhub_attach; 82 device_detach_t uhub_detach; 83 bus_child_location_str_t uhub_child_location_string; 84 85 #endif 86