| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ehci.c,v 1.267 2019/06/13 17:20:25 maxv Exp $ */ | | 1 | /* $NetBSD: ehci.c,v 1.268 2019/12/31 18:11:18 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2004-2012 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2004-2012 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Lennart Augustsson (lennart@augustsson.net), Charles M. Hannum, | | 8 | * by Lennart Augustsson (lennart@augustsson.net), Charles M. Hannum, |
9 | * Jeremy Morse (jeremy.morse@gmail.com), Jared D. McNeill | | 9 | * Jeremy Morse (jeremy.morse@gmail.com), Jared D. McNeill |
10 | * (jmcneill@invisible.ca) and Matthew R. Green (mrg@eterna.com.au). | | 10 | * (jmcneill@invisible.ca) and Matthew R. Green (mrg@eterna.com.au). |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -43,27 +43,27 @@ | | | @@ -43,27 +43,27 @@ |
43 | | | 43 | |
44 | /* | | 44 | /* |
45 | * TODO: | | 45 | * TODO: |
46 | * 1) hold off explorations by companion controllers until ehci has started. | | 46 | * 1) hold off explorations by companion controllers until ehci has started. |
47 | * | | 47 | * |
48 | * 2) The hub driver needs to handle and schedule the transaction translator, | | 48 | * 2) The hub driver needs to handle and schedule the transaction translator, |
49 | * to assign place in frame where different devices get to go. See chapter | | 49 | * to assign place in frame where different devices get to go. See chapter |
50 | * on hubs in USB 2.0 for details. | | 50 | * on hubs in USB 2.0 for details. |
51 | * | | 51 | * |
52 | * 3) Command failures are not recovered correctly. | | 52 | * 3) Command failures are not recovered correctly. |
53 | */ | | 53 | */ |
54 | | | 54 | |
55 | #include <sys/cdefs.h> | | 55 | #include <sys/cdefs.h> |
56 | __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267 2019/06/13 17:20:25 maxv Exp $"); | | 56 | __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.268 2019/12/31 18:11:18 skrll Exp $"); |
57 | | | 57 | |
58 | #include "ohci.h" | | 58 | #include "ohci.h" |
59 | #include "uhci.h" | | 59 | #include "uhci.h" |
60 | | | 60 | |
61 | #ifdef _KERNEL_OPT | | 61 | #ifdef _KERNEL_OPT |
62 | #include "opt_usb.h" | | 62 | #include "opt_usb.h" |
63 | #endif | | 63 | #endif |
64 | | | 64 | |
65 | #include <sys/param.h> | | 65 | #include <sys/param.h> |
66 | | | 66 | |
67 | #include <sys/bus.h> | | 67 | #include <sys/bus.h> |
68 | #include <sys/cpu.h> | | 68 | #include <sys/cpu.h> |
69 | #include <sys/device.h> | | 69 | #include <sys/device.h> |
| @@ -2599,27 +2599,27 @@ ehci_roothub_ctrl(struct usbd_bus *bus, | | | @@ -2599,27 +2599,27 @@ ehci_roothub_ctrl(struct usbd_bus *bus, |
2599 | return totlen; | | 2599 | return totlen; |
2600 | } | | 2600 | } |
2601 | | | 2601 | |
2602 | /* | | 2602 | /* |
2603 | * Handle ehci hand-off in early boot vs RB_ASKNAME/RB_SINGLE. | | 2603 | * Handle ehci hand-off in early boot vs RB_ASKNAME/RB_SINGLE. |
2604 | * | | 2604 | * |
2605 | * This pile of garbage below works around the following problem without | | 2605 | * This pile of garbage below works around the following problem without |
2606 | * holding boots with no hand-over devices present, while penalising | | 2606 | * holding boots with no hand-over devices present, while penalising |
2607 | * boots where the first ehci probe hands off devices with a 5 second | | 2607 | * boots where the first ehci probe hands off devices with a 5 second |
2608 | * delay, if RB_ASKNAME/RB_SINGLE is set. This is typically not a problem | | 2608 | * delay, if RB_ASKNAME/RB_SINGLE is set. This is typically not a problem |
2609 | * for RB_SINGLE, but the same basic issue exists. | | 2609 | * for RB_SINGLE, but the same basic issue exists. |
2610 | * | | 2610 | * |
2611 | * The way ehci hand-off works, the companion controller does not get the | | 2611 | * The way ehci hand-off works, the companion controller does not get the |
2612 | * device until after its' initial bus explore, so the reference dropped | | 2612 | * device until after its initial bus explore, so the reference dropped |
2613 | * after the first explore is not enough. 5 seconds should be enough, | | 2613 | * after the first explore is not enough. 5 seconds should be enough, |
2614 | * and EHCI_DISOWN_DELAY_SECONDS can be set to another value. | | 2614 | * and EHCI_DISOWN_DELAY_SECONDS can be set to another value. |
2615 | * | | 2615 | * |
2616 | * There are 3 states. CO_EARLY is set during attach. CO_SCHED is set | | 2616 | * There are 3 states. CO_EARLY is set during attach. CO_SCHED is set |
2617 | * if the callback is scheduled. CO_DONE is set when the callout has | | 2617 | * if the callback is scheduled. CO_DONE is set when the callout has |
2618 | * called config_pending_decr(). | | 2618 | * called config_pending_decr(). |
2619 | * | | 2619 | * |
2620 | * There's a mutex, a cv and a callout here, and we delay detach if the | | 2620 | * There's a mutex, a cv and a callout here, and we delay detach if the |
2621 | * callout has been set. | | 2621 | * callout has been set. |
2622 | */ | | 2622 | */ |
2623 | #ifndef EHCI_DISOWN_DELAY_SECONDS | | 2623 | #ifndef EHCI_DISOWN_DELAY_SECONDS |
2624 | #define EHCI_DISOWN_DELAY_SECONDS 5 | | 2624 | #define EHCI_DISOWN_DELAY_SECONDS 5 |
2625 | #endif | | 2625 | #endif |