| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uhub.c,v 1.137 2017/10/28 00:37:12 pgoyette Exp $ */ | | 1 | /* $NetBSD: uhub.c,v 1.138 2018/02/01 09:50:48 msaitoh Exp $ */ |
2 | /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ | | 2 | /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ |
3 | /* $OpenBSD: uhub.c,v 1.86 2015/06/29 18:27:40 mpi Exp $ */ | | 3 | /* $OpenBSD: uhub.c,v 1.86 2015/06/29 18:27:40 mpi Exp $ */ |
4 | | | 4 | |
5 | /* | | 5 | /* |
6 | * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. | | 6 | * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * This code is derived from software contributed to The NetBSD Foundation | | 9 | * This code is derived from software contributed to The NetBSD Foundation |
10 | * by Lennart Augustsson (lennart@augustsson.net) at | | 10 | * by Lennart Augustsson (lennart@augustsson.net) at |
11 | * Carlstedt Research & Technology. | | 11 | * Carlstedt Research & Technology. |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
32 | * POSSIBILITY OF SUCH DAMAGE. | | 32 | * POSSIBILITY OF SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | /* | | 35 | /* |
36 | * USB spec: http://www.usb.org/developers/docs/usbspec.zip | | 36 | * USB spec: http://www.usb.org/developers/docs/usbspec.zip |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | __KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.137 2017/10/28 00:37:12 pgoyette Exp $"); | | 40 | __KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.138 2018/02/01 09:50:48 msaitoh Exp $"); |
41 | | | 41 | |
42 | #ifdef _KERNEL_OPT | | 42 | #ifdef _KERNEL_OPT |
43 | #include "opt_usb.h" | | 43 | #include "opt_usb.h" |
44 | #endif | | 44 | #endif |
45 | | | 45 | |
46 | #include <sys/param.h> | | 46 | #include <sys/param.h> |
47 | | | 47 | |
48 | #include <sys/bus.h> | | 48 | #include <sys/bus.h> |
49 | #include <sys/device.h> | | 49 | #include <sys/device.h> |
50 | #include <sys/kernel.h> | | 50 | #include <sys/kernel.h> |
51 | #include <sys/kmem.h> | | 51 | #include <sys/kmem.h> |
52 | #include <sys/proc.h> | | 52 | #include <sys/proc.h> |
53 | #include <sys/sysctl.h> | | 53 | #include <sys/sysctl.h> |
| @@ -134,28 +134,29 @@ Static void uhub_intr(struct usbd_xfer * | | | @@ -134,28 +134,29 @@ Static void uhub_intr(struct usbd_xfer * |
134 | * hub to usb and hub to hub | | 134 | * hub to usb and hub to hub |
135 | * Every other driver only connects to hubs | | 135 | * Every other driver only connects to hubs |
136 | */ | | 136 | */ |
137 | | | 137 | |
138 | int uhub_match(device_t, cfdata_t, void *); | | 138 | int uhub_match(device_t, cfdata_t, void *); |
139 | void uhub_attach(device_t, device_t, void *); | | 139 | void uhub_attach(device_t, device_t, void *); |
140 | int uhub_rescan(device_t, const char *, const int *); | | 140 | int uhub_rescan(device_t, const char *, const int *); |
141 | void uhub_childdet(device_t, device_t); | | 141 | void uhub_childdet(device_t, device_t); |
142 | int uhub_detach(device_t, int); | | 142 | int uhub_detach(device_t, int); |
143 | extern struct cfdriver uhub_cd; | | 143 | extern struct cfdriver uhub_cd; |
144 | CFATTACH_DECL3_NEW(uhub, sizeof(struct uhub_softc), uhub_match, | | 144 | CFATTACH_DECL3_NEW(uhub, sizeof(struct uhub_softc), uhub_match, |
145 | uhub_attach, uhub_detach, NULL, uhub_rescan, uhub_childdet, | | 145 | uhub_attach, uhub_detach, NULL, uhub_rescan, uhub_childdet, |
146 | DVF_DETACH_SHUTDOWN); | | 146 | DVF_DETACH_SHUTDOWN); |
147 | CFATTACH_DECL2_NEW(uroothub, sizeof(struct uhub_softc), uhub_match, | | 147 | CFATTACH_DECL3_NEW(uroothub, sizeof(struct uhub_softc), uhub_match, |
148 | uhub_attach, uhub_detach, NULL, uhub_rescan, uhub_childdet); | | 148 | uhub_attach, uhub_detach, NULL, uhub_rescan, uhub_childdet, |
| | | 149 | DVF_DETACH_SHUTDOWN); |
149 | | | 150 | |
150 | /* | | 151 | /* |
151 | * Setting this to 1 makes sure than an uhub attaches even at higher | | 152 | * Setting this to 1 makes sure than an uhub attaches even at higher |
152 | * priority than ugen when ugen_override is set to 1. This allows to | | 153 | * priority than ugen when ugen_override is set to 1. This allows to |
153 | * probe the whole USB bus and attach functions with ugen. | | 154 | * probe the whole USB bus and attach functions with ugen. |
154 | */ | | 155 | */ |
155 | int uhub_ubermatch = 0; | | 156 | int uhub_ubermatch = 0; |
156 | | | 157 | |
157 | static usbd_status | | 158 | static usbd_status |
158 | usbd_get_hub_desc(struct usbd_device *dev, usb_hub_descriptor_t *hd, int speed) | | 159 | usbd_get_hub_desc(struct usbd_device *dev, usb_hub_descriptor_t *hd, int speed) |
159 | { | | 160 | { |
160 | usb_device_request_t req; | | 161 | usb_device_request_t req; |
161 | usbd_status err; | | 162 | usbd_status err; |