Fri Nov 17 08:22:03 2017 UTC ()
s/PR_NOWAIT/PR_WAITOK/ in HCD allocx (allocate xfer) method


(skrll)
diff -r1.256 -r1.257 src/sys/dev/usb/ehci.c
diff -r1.18 -r1.19 src/sys/dev/usb/motg.c
diff -r1.275 -r1.276 src/sys/dev/usb/ohci.c
diff -r1.278 -r1.279 src/sys/dev/usb/uhci.c
diff -r1.76 -r1.77 src/sys/dev/usb/xhci.c
diff -r1.46 -r1.47 src/sys/external/bsd/dwc2/dwc2.c

cvs diff -r1.256 -r1.257 src/sys/dev/usb/ehci.c (expand / switch to unified diff)

--- src/sys/dev/usb/ehci.c 2017/10/28 00:37:12 1.256
+++ src/sys/dev/usb/ehci.c 2017/11/17 08:22:02 1.257
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ehci.c,v 1.256 2017/10/28 00:37:12 pgoyette Exp $ */ 1/* $NetBSD: ehci.c,v 1.257 2017/11/17 08:22:02 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.256 2017/10/28 00:37:12 pgoyette Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.257 2017/11/17 08:22:02 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>
@@ -1506,27 +1506,27 @@ ehci_shutdown(device_t self, int flags) @@ -1506,27 +1506,27 @@ ehci_shutdown(device_t self, int flags)
1506 EHCIHIST_FUNC(); EHCIHIST_CALLED(); 1506 EHCIHIST_FUNC(); EHCIHIST_CALLED();
1507 1507
1508 EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ 1508 EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */
1509 EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); 1509 EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
1510 return true; 1510 return true;
1511} 1511}
1512 1512
1513Static struct usbd_xfer * 1513Static struct usbd_xfer *
1514ehci_allocx(struct usbd_bus *bus, unsigned int nframes) 1514ehci_allocx(struct usbd_bus *bus, unsigned int nframes)
1515{ 1515{
1516 struct ehci_softc *sc = EHCI_BUS2SC(bus); 1516 struct ehci_softc *sc = EHCI_BUS2SC(bus);
1517 struct usbd_xfer *xfer; 1517 struct usbd_xfer *xfer;
1518 1518
1519 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 1519 xfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
1520 if (xfer != NULL) { 1520 if (xfer != NULL) {
1521 memset(xfer, 0, sizeof(struct ehci_xfer)); 1521 memset(xfer, 0, sizeof(struct ehci_xfer));
1522#ifdef DIAGNOSTIC 1522#ifdef DIAGNOSTIC
1523 struct ehci_xfer *ex = EHCI_XFER2EXFER(xfer); 1523 struct ehci_xfer *ex = EHCI_XFER2EXFER(xfer);
1524 ex->ex_isdone = true; 1524 ex->ex_isdone = true;
1525 xfer->ux_state = XFER_BUSY; 1525 xfer->ux_state = XFER_BUSY;
1526#endif 1526#endif
1527 } 1527 }
1528 return xfer; 1528 return xfer;
1529} 1529}
1530 1530
1531Static void 1531Static void
1532ehci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) 1532ehci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)

cvs diff -r1.18 -r1.19 src/sys/dev/usb/motg.c (expand / switch to unified diff)

--- src/sys/dev/usb/motg.c 2017/10/28 00:37:12 1.18
+++ src/sys/dev/usb/motg.c 2017/11/17 08:22:02 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: motg.c,v 1.18 2017/10/28 00:37:12 pgoyette Exp $ */ 1/* $NetBSD: motg.c,v 1.19 2017/11/17 08:22:02 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2004, 2011, 2012, 2014 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) at 8 * by Lennart Augustsson (lennart@augustsson.net) at
9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca), 9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca),
10 * Matthew R. Green (mrg@eterna.com.au), and Manuel Bouyer (bouyer@netbsd.org). 10 * Matthew R. Green (mrg@eterna.com.au), and Manuel Bouyer (bouyer@netbsd.org).
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:
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34 34
35/* 35/*
36 * This file contains the driver for the Mentor Graphics Inventra USB 36 * This file contains the driver for the Mentor Graphics Inventra USB
37 * 2.0 High Speed Dual-Role controller. 37 * 2.0 High Speed Dual-Role controller.
38 * 38 *
39 * NOTE: The current implementation only supports Device Side Mode! 39 * NOTE: The current implementation only supports Device Side Mode!
40 */ 40 */
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.18 2017/10/28 00:37:12 pgoyette Exp $"); 43__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.19 2017/11/17 08:22:02 skrll Exp $");
44 44
45#ifdef _KERNEL_OPT 45#ifdef _KERNEL_OPT
46#include "opt_motg.h" 46#include "opt_motg.h"
47#include "opt_usb.h" 47#include "opt_usb.h"
48#endif 48#endif
49 49
50#include <sys/param.h> 50#include <sys/param.h>
51 51
52#include <sys/bus.h> 52#include <sys/bus.h>
53#include <sys/cpu.h> 53#include <sys/cpu.h>
54#include <sys/device.h> 54#include <sys/device.h>
55#include <sys/kernel.h> 55#include <sys/kernel.h>
56#include <sys/kmem.h> 56#include <sys/kmem.h>
@@ -742,27 +742,27 @@ motg_intr_vbus(struct motg_softc *sc, in @@ -742,27 +742,27 @@ motg_intr_vbus(struct motg_softc *sc, in
742 val = UREAD1(sc, MUSB2_REG_DEVCTL); 742 val = UREAD1(sc, MUSB2_REG_DEVCTL);
743 val |= MUSB2_MASK_SESS; 743 val |= MUSB2_MASK_SESS;
744 UWRITE1(sc, MUSB2_REG_DEVCTL, val); 744 UWRITE1(sc, MUSB2_REG_DEVCTL, val);
745 } 745 }
746 return 1; 746 return 1;
747} 747}
748 748
749struct usbd_xfer * 749struct usbd_xfer *
750motg_allocx(struct usbd_bus *bus, unsigned int nframes) 750motg_allocx(struct usbd_bus *bus, unsigned int nframes)
751{ 751{
752 struct motg_softc *sc = MOTG_BUS2SC(bus); 752 struct motg_softc *sc = MOTG_BUS2SC(bus);
753 struct usbd_xfer *xfer; 753 struct usbd_xfer *xfer;
754 754
755 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 755 xfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
756 if (xfer != NULL) { 756 if (xfer != NULL) {
757 memset(xfer, 0, sizeof(struct motg_xfer)); 757 memset(xfer, 0, sizeof(struct motg_xfer));
758#ifdef DIAGNOSTIC 758#ifdef DIAGNOSTIC
759 xfer->ux_state = XFER_BUSY; 759 xfer->ux_state = XFER_BUSY;
760#endif 760#endif
761 } 761 }
762 return xfer; 762 return xfer;
763} 763}
764 764
765void 765void
766motg_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) 766motg_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
767{ 767{
768 struct motg_softc *sc = MOTG_BUS2SC(bus); 768 struct motg_softc *sc = MOTG_BUS2SC(bus);

cvs diff -r1.275 -r1.276 src/sys/dev/usb/ohci.c (expand / switch to unified diff)

--- src/sys/dev/usb/ohci.c 2017/10/28 07:36:02 1.275
+++ src/sys/dev/usb/ohci.c 2017/11/17 08:22:02 1.276
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ohci.c,v 1.275 2017/10/28 07:36:02 skrll Exp $ */ 1/* $NetBSD: ohci.c,v 1.276 2017/11/17 08:22:02 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2004, 2005, 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) at 8 * by Lennart Augustsson (lennart@augustsson.net) at
9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca) 9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca)
10 * and Matthew R. Green (mrg@eterna.com.au). 10 * and Matthew R. Green (mrg@eterna.com.au).
11 * This code is derived from software contributed to The NetBSD Foundation 11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Charles M. Hannum. 12 * by Charles M. Hannum.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE. 33 * POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36/* 36/*
37 * USB Open Host Controller driver. 37 * USB Open Host Controller driver.
38 * 38 *
39 * OHCI spec: http://www.compaq.com/productinfo/development/openhci.html 39 * OHCI spec: http://www.compaq.com/productinfo/development/openhci.html
40 * USB spec: http://www.usb.org/developers/docs/ 40 * USB spec: http://www.usb.org/developers/docs/
41 */ 41 */
42 42
43#include <sys/cdefs.h> 43#include <sys/cdefs.h>
44__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.275 2017/10/28 07:36:02 skrll Exp $"); 44__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.276 2017/11/17 08:22:02 skrll Exp $");
45 45
46#ifdef _KERNEL_OPT 46#ifdef _KERNEL_OPT
47#include "opt_usb.h" 47#include "opt_usb.h"
48#endif 48#endif
49 49
50#include <sys/param.h> 50#include <sys/param.h>
51 51
52#include <sys/cpu.h> 52#include <sys/cpu.h>
53#include <sys/device.h> 53#include <sys/device.h>
54#include <sys/kernel.h> 54#include <sys/kernel.h>
55#include <sys/kmem.h> 55#include <sys/kmem.h>
56#include <sys/proc.h> 56#include <sys/proc.h>
57#include <sys/queue.h> 57#include <sys/queue.h>
@@ -1059,27 +1059,27 @@ ohci_init(ohci_softc_t *sc) @@ -1059,27 +1059,27 @@ ohci_init(ohci_softc_t *sc)
1059 ohci_free_sed(sc, sc->sc_ctrl_head); 1059 ohci_free_sed(sc, sc->sc_ctrl_head);
1060 bad1: 1060 bad1:
1061 usb_freemem(&sc->sc_bus, &sc->sc_hccadma); 1061 usb_freemem(&sc->sc_bus, &sc->sc_hccadma);
1062 sc->sc_hcca = NULL; 1062 sc->sc_hcca = NULL;
1063 return err; 1063 return err;
1064} 1064}
1065 1065
1066struct usbd_xfer * 1066struct usbd_xfer *
1067ohci_allocx(struct usbd_bus *bus, unsigned int nframes) 1067ohci_allocx(struct usbd_bus *bus, unsigned int nframes)
1068{ 1068{
1069 ohci_softc_t *sc = OHCI_BUS2SC(bus); 1069 ohci_softc_t *sc = OHCI_BUS2SC(bus);
1070 struct usbd_xfer *xfer; 1070 struct usbd_xfer *xfer;
1071 1071
1072 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 1072 xfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
1073 if (xfer != NULL) { 1073 if (xfer != NULL) {
1074 memset(xfer, 0, sizeof(struct ohci_xfer)); 1074 memset(xfer, 0, sizeof(struct ohci_xfer));
1075#ifdef DIAGNOSTIC 1075#ifdef DIAGNOSTIC
1076 xfer->ux_state = XFER_BUSY; 1076 xfer->ux_state = XFER_BUSY;
1077#endif 1077#endif
1078 } 1078 }
1079 return xfer; 1079 return xfer;
1080} 1080}
1081 1081
1082void 1082void
1083ohci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) 1083ohci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
1084{ 1084{
1085 ohci_softc_t *sc = OHCI_BUS2SC(bus); 1085 ohci_softc_t *sc = OHCI_BUS2SC(bus);

cvs diff -r1.278 -r1.279 src/sys/dev/usb/uhci.c (expand / switch to unified diff)

--- src/sys/dev/usb/uhci.c 2017/11/16 21:54:51 1.278
+++ src/sys/dev/usb/uhci.c 2017/11/17 08:22:02 1.279
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uhci.c,v 1.278 2017/11/16 21:54:51 christos Exp $ */ 1/* $NetBSD: uhci.c,v 1.279 2017/11/17 08:22:02 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2004, 2011, 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) at 8 * by Lennart Augustsson (lennart@augustsson.net) at
9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca) 9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca)
10 * and Matthew R. Green (mrg@eterna.com.au). 10 * 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:
@@ -32,27 +32,27 @@ @@ -32,27 +32,27 @@
32 */ 32 */
33 33
34/* 34/*
35 * USB Universal Host Controller driver. 35 * USB Universal Host Controller driver.
36 * Handles e.g. PIIX3 and PIIX4. 36 * Handles e.g. PIIX3 and PIIX4.
37 * 37 *
38 * UHCI spec: http://www.intel.com/technology/usb/spec.htm 38 * UHCI spec: http://www.intel.com/technology/usb/spec.htm
39 * USB spec: http://www.usb.org/developers/docs/ 39 * USB spec: http://www.usb.org/developers/docs/
40 * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf 40 * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf
41 * ftp://download.intel.com/design/intarch/datashts/29056201.pdf 41 * ftp://download.intel.com/design/intarch/datashts/29056201.pdf
42 */ 42 */
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.278 2017/11/16 21:54:51 christos Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.279 2017/11/17 08:22:02 skrll Exp $");
46 46
47#ifdef _KERNEL_OPT 47#ifdef _KERNEL_OPT
48#include "opt_usb.h" 48#include "opt_usb.h"
49#endif 49#endif
50 50
51#include <sys/param.h> 51#include <sys/param.h>
52 52
53#include <sys/bus.h> 53#include <sys/bus.h>
54#include <sys/cpu.h> 54#include <sys/cpu.h>
55#include <sys/device.h> 55#include <sys/device.h>
56#include <sys/kernel.h> 56#include <sys/kernel.h>
57#include <sys/kmem.h> 57#include <sys/kmem.h>
58#include <sys/mutex.h> 58#include <sys/mutex.h>
@@ -647,27 +647,27 @@ uhci_detach(struct uhci_softc *sc, int f @@ -647,27 +647,27 @@ uhci_detach(struct uhci_softc *sc, int f
647 pool_cache_destroy(sc->sc_xferpool); 647 pool_cache_destroy(sc->sc_xferpool);
648 648
649 /* XXX free other data structures XXX */ 649 /* XXX free other data structures XXX */
650 650
651 return rv; 651 return rv;
652} 652}
653 653
654struct usbd_xfer * 654struct usbd_xfer *
655uhci_allocx(struct usbd_bus *bus, unsigned int nframes) 655uhci_allocx(struct usbd_bus *bus, unsigned int nframes)
656{ 656{
657 struct uhci_softc *sc = UHCI_BUS2SC(bus); 657 struct uhci_softc *sc = UHCI_BUS2SC(bus);
658 struct usbd_xfer *xfer; 658 struct usbd_xfer *xfer;
659 659
660 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 660 xfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
661 if (xfer != NULL) { 661 if (xfer != NULL) {
662 memset(xfer, 0, sizeof(struct uhci_xfer)); 662 memset(xfer, 0, sizeof(struct uhci_xfer));
663 663
664#ifdef DIAGNOSTIC 664#ifdef DIAGNOSTIC
665 struct uhci_xfer *uxfer = UHCI_XFER2UXFER(xfer); 665 struct uhci_xfer *uxfer = UHCI_XFER2UXFER(xfer);
666 uxfer->ux_isdone = true; 666 uxfer->ux_isdone = true;
667 xfer->ux_state = XFER_BUSY; 667 xfer->ux_state = XFER_BUSY;
668#endif 668#endif
669 } 669 }
670 return xfer; 670 return xfer;
671} 671}
672 672
673void 673void

cvs diff -r1.76 -r1.77 src/sys/dev/usb/xhci.c (expand / switch to unified diff)

--- src/sys/dev/usb/xhci.c 2017/11/09 10:03:46 1.76
+++ src/sys/dev/usb/xhci.c 2017/11/17 08:22:02 1.77
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xhci.c,v 1.76 2017/11/09 10:03:46 msaitoh Exp $ */ 1/* $NetBSD: xhci.c,v 1.77 2017/11/17 08:22:02 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2013 Jonathan A. Kollasch 4 * Copyright (c) 2013 Jonathan A. Kollasch
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29/* 29/*
30 * USB rev 2.0 and rev 3.1 specification 30 * USB rev 2.0 and rev 3.1 specification
31 * http://www.usb.org/developers/docs/ 31 * http://www.usb.org/developers/docs/
32 * xHCI rev 1.1 specification 32 * xHCI rev 1.1 specification
33 * http://www.intel.com/technology/usb/spec.htm 33 * http://www.intel.com/technology/usb/spec.htm
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.76 2017/11/09 10:03:46 msaitoh Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.77 2017/11/17 08:22:02 skrll Exp $");
38 38
39#ifdef _KERNEL_OPT 39#ifdef _KERNEL_OPT
40#include "opt_usb.h" 40#include "opt_usb.h"
41#endif 41#endif
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/systm.h> 44#include <sys/systm.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/kmem.h> 46#include <sys/kmem.h>
47#include <sys/device.h> 47#include <sys/device.h>
48#include <sys/select.h> 48#include <sys/select.h>
49#include <sys/proc.h> 49#include <sys/proc.h>
50#include <sys/queue.h> 50#include <sys/queue.h>
@@ -2179,27 +2179,27 @@ xhci_poll(struct usbd_bus *bus) @@ -2179,27 +2179,27 @@ xhci_poll(struct usbd_bus *bus)
2179 mutex_spin_exit(&sc->sc_intr_lock); 2179 mutex_spin_exit(&sc->sc_intr_lock);
2180 2180
2181 return; 2181 return;
2182} 2182}
2183 2183
2184static struct usbd_xfer * 2184static struct usbd_xfer *
2185xhci_allocx(struct usbd_bus *bus, unsigned int nframes) 2185xhci_allocx(struct usbd_bus *bus, unsigned int nframes)
2186{ 2186{
2187 struct xhci_softc * const sc = XHCI_BUS2SC(bus); 2187 struct xhci_softc * const sc = XHCI_BUS2SC(bus);
2188 struct usbd_xfer *xfer; 2188 struct usbd_xfer *xfer;
2189 2189
2190 XHCIHIST_FUNC(); XHCIHIST_CALLED(); 2190 XHCIHIST_FUNC(); XHCIHIST_CALLED();
2191 2191
2192 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 2192 xfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
2193 if (xfer != NULL) { 2193 if (xfer != NULL) {
2194 memset(xfer, 0, sizeof(struct xhci_xfer)); 2194 memset(xfer, 0, sizeof(struct xhci_xfer));
2195#ifdef DIAGNOSTIC 2195#ifdef DIAGNOSTIC
2196 xfer->ux_state = XFER_BUSY; 2196 xfer->ux_state = XFER_BUSY;
2197#endif 2197#endif
2198 } 2198 }
2199 2199
2200 return xfer; 2200 return xfer;
2201} 2201}
2202 2202
2203static void 2203static void
2204xhci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) 2204xhci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
2205{ 2205{

cvs diff -r1.46 -r1.47 src/sys/external/bsd/dwc2/dwc2.c (expand / switch to unified diff)

--- src/sys/external/bsd/dwc2/dwc2.c 2017/06/01 02:45:12 1.46
+++ src/sys/external/bsd/dwc2/dwc2.c 2017/11/17 08:22:02 1.47
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dwc2.c,v 1.46 2017/06/01 02:45:12 chs Exp $ */ 1/* $NetBSD: dwc2.c,v 1.47 2017/11/17 08:22:02 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 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 Nick Hudson 8 * by Nick Hudson
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.46 2017/06/01 02:45:12 chs Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.47 2017/11/17 08:22:02 skrll Exp $");
34 34
35#include "opt_usb.h" 35#include "opt_usb.h"
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/kmem.h> 39#include <sys/kmem.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/select.h> 42#include <sys/select.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/queue.h> 44#include <sys/queue.h>
45#include <sys/cpu.h> 45#include <sys/cpu.h>
46 46
@@ -197,27 +197,27 @@ Static const struct usbd_pipe_methods dw @@ -197,27 +197,27 @@ Static const struct usbd_pipe_methods dw
197 .upm_cleartoggle = dwc2_noop, 197 .upm_cleartoggle = dwc2_noop,
198 .upm_done = dwc2_device_isoc_done, 198 .upm_done = dwc2_device_isoc_done,
199}; 199};
200 200
201struct usbd_xfer * 201struct usbd_xfer *
202dwc2_allocx(struct usbd_bus *bus, unsigned int nframes) 202dwc2_allocx(struct usbd_bus *bus, unsigned int nframes)
203{ 203{
204 struct dwc2_softc *sc = DWC2_BUS2SC(bus); 204 struct dwc2_softc *sc = DWC2_BUS2SC(bus);
205 struct dwc2_xfer *dxfer; 205 struct dwc2_xfer *dxfer;
206 206
207 DPRINTFN(10, "\n"); 207 DPRINTFN(10, "\n");
208 208
209 DWC2_EVCNT_INCR(sc->sc_ev_xferpoolget); 209 DWC2_EVCNT_INCR(sc->sc_ev_xferpoolget);
210 dxfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 210 dxfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
211 if (dxfer != NULL) { 211 if (dxfer != NULL) {
212 memset(dxfer, 0, sizeof(*dxfer)); 212 memset(dxfer, 0, sizeof(*dxfer));
213 213
214 dxfer->urb = dwc2_hcd_urb_alloc(sc->sc_hsotg, 214 dxfer->urb = dwc2_hcd_urb_alloc(sc->sc_hsotg,
215 nframes, GFP_KERNEL); 215 nframes, GFP_KERNEL);
216 216
217#ifdef DIAGNOSTIC 217#ifdef DIAGNOSTIC
218 dxfer->xfer.ux_state = XFER_BUSY; 218 dxfer->xfer.ux_state = XFER_BUSY;
219#endif 219#endif
220 } 220 }
221 return (struct usbd_xfer *)dxfer; 221 return (struct usbd_xfer *)dxfer;
222} 222}
223 223