| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ohci.c,v 1.254.2.62 2016/04/01 14:06:14 skrll Exp $ */ | | 1 | /* $NetBSD: ohci.c,v 1.254.2.63 2016/04/01 14:08:39 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.254.2.62 2016/04/01 14:06:14 skrll Exp $"); | | 44 | __KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.63 2016/04/01 14:08:39 skrll Exp $"); |
45 | | | 45 | |
46 | #include "opt_usb.h" | | 46 | #include "opt_usb.h" |
47 | | | 47 | |
48 | #include <sys/param.h> | | 48 | #include <sys/param.h> |
49 | | | 49 | |
50 | #include <sys/cpu.h> | | 50 | #include <sys/cpu.h> |
51 | #include <sys/device.h> | | 51 | #include <sys/device.h> |
52 | #include <sys/kernel.h> | | 52 | #include <sys/kernel.h> |
53 | #include <sys/kmem.h> | | 53 | #include <sys/kmem.h> |
54 | #include <sys/proc.h> | | 54 | #include <sys/proc.h> |
55 | #include <sys/queue.h> | | 55 | #include <sys/queue.h> |
56 | #include <sys/select.h> | | 56 | #include <sys/select.h> |
57 | #include <sys/sysctl.h> | | 57 | #include <sys/sysctl.h> |
| @@ -561,27 +561,27 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s | | | @@ -561,27 +561,27 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s |
561 | ox->ox_stds[j++] = cur; | | 561 | ox->ox_stds[j++] = cur; |
562 | next = ohci_alloc_std(sc); | | 562 | next = ohci_alloc_std(sc); |
563 | if (next == NULL) | | 563 | if (next == NULL) |
564 | goto nomem; | | 564 | goto nomem; |
565 | | | 565 | |
566 | /* The OHCI hardware can handle at most one page crossing. */ | | 566 | /* The OHCI hardware can handle at most one page crossing. */ |
567 | if (OHCI_PAGE(dataphys) == dataphysend || | | 567 | if (OHCI_PAGE(dataphys) == dataphysend || |
568 | OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) { | | 568 | OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) { |
569 | /* we can handle it in this TD */ | | 569 | /* we can handle it in this TD */ |
570 | curlen = len; | | 570 | curlen = len; |
571 | } else { | | 571 | } else { |
572 | /* must use multiple TDs, fill as much as possible. */ | | 572 | /* must use multiple TDs, fill as much as possible. */ |
573 | curlen = 2 * OHCI_PAGE_SIZE - | | 573 | curlen = 2 * OHCI_PAGE_SIZE - |
574 | (dataphys & (OHCI_PAGE_SIZE - 1)); | | 574 | (dataphys & (OHCI_PAGE_SIZE - 1)); |
575 | /* the length must be a multiple of the max size */ | | 575 | /* the length must be a multiple of the max size */ |
576 | curlen -= curlen % mps; | | 576 | curlen -= curlen % mps; |
577 | KASSERT(curlen != 0); | | 577 | KASSERT(curlen != 0); |
578 | } | | 578 | } |
579 | DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x " | | 579 | DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x " |
580 | "len=%d curlen=%d", dataphys, dataphysend, len, curlen); | | 580 | "len=%d curlen=%d", dataphys, dataphysend, len, curlen); |
581 | len -= curlen; | | 581 | len -= curlen; |
582 | | | 582 | |
583 | cur->td.td_flags = tdflags; | | 583 | cur->td.td_flags = tdflags; |
584 | cur->td.td_cbp = HTOO32(dataphys); | | 584 | cur->td.td_cbp = HTOO32(dataphys); |
585 | cur->td.td_nexttd = HTOO32(next->physaddr); | | 585 | cur->td.td_nexttd = HTOO32(next->physaddr); |
586 | cur->td.td_be = HTOO32(dataphys + curlen - 1); | | 586 | cur->td.td_be = HTOO32(dataphys + curlen - 1); |
587 | cur->nexttd = next; | | 587 | cur->nexttd = next; |