| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ohci.c,v 1.254.2.66 2016/04/01 14:13:29 skrll Exp $ */ | | 1 | /* $NetBSD: ohci.c,v 1.254.2.67 2016/04/01 14:17:24 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.66 2016/04/01 14:13:29 skrll Exp $"); | | 44 | __KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.67 2016/04/01 14:17:24 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> |
| @@ -689,27 +689,27 @@ ohci_reset_std_chain(ohci_softc_t *sc, s | | | @@ -689,27 +689,27 @@ ohci_reset_std_chain(ohci_softc_t *sc, s |
689 | if (OHCI_PAGE(dataphys) == dataphysend || | | 689 | if (OHCI_PAGE(dataphys) == dataphysend || |
690 | OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) { | | 690 | OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) { |
691 | /* we can handle it in this TD */ | | 691 | /* we can handle it in this TD */ |
692 | curlen = len; | | 692 | curlen = len; |
693 | } else { | | 693 | } else { |
694 | /* must use multiple TDs, fill as much as possible. */ | | 694 | /* must use multiple TDs, fill as much as possible. */ |
695 | curlen = 2 * OHCI_PAGE_SIZE - | | 695 | curlen = 2 * OHCI_PAGE_SIZE - |
696 | (dataphys & (OHCI_PAGE_SIZE - 1)); | | 696 | (dataphys & (OHCI_PAGE_SIZE - 1)); |
697 | /* the length must be a multiple of the max size */ | | 697 | /* the length must be a multiple of the max size */ |
698 | curlen -= curlen % mps; | | 698 | curlen -= curlen % mps; |
699 | KASSERT(curlen != 0); | | 699 | KASSERT(curlen != 0); |
700 | } | | 700 | } |
701 | DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x " | | 701 | DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x " |
702 | "len=%d curlen=%d", dataphys, dataphysend, len, curlen); | | 702 | "len=%d curlen=%d", dataphys, dataphysend, len, curlen); |
703 | len -= curlen; | | 703 | len -= curlen; |
704 | | | 704 | |
705 | cur->td.td_flags = tdflags; | | 705 | cur->td.td_flags = tdflags; |
706 | cur->td.td_cbp = HTOO32(dataphys); | | 706 | cur->td.td_cbp = HTOO32(dataphys); |
707 | cur->td.td_be = HTOO32(dataphys + curlen - 1); | | 707 | cur->td.td_be = HTOO32(dataphys + curlen - 1); |
708 | cur->td.td_nexttd = (next != NULL) ? HTOO32(next->physaddr) : 0; | | 708 | cur->td.td_nexttd = (next != NULL) ? HTOO32(next->physaddr) : 0; |
709 | cur->nexttd = next; | | 709 | cur->nexttd = next; |
710 | cur->len = curlen; | | 710 | cur->len = curlen; |
711 | cur->flags = OHCI_ADD_LEN; | | 711 | cur->flags = OHCI_ADD_LEN; |
712 | cur->xfer = xfer; | | 712 | cur->xfer = xfer; |
713 | ohci_hash_add_td(sc, cur); | | 713 | ohci_hash_add_td(sc, cur); |
714 | | | 714 | |
715 | usb_syncmem(&cur->dma, cur->offs, sizeof(cur->td), | | 715 | usb_syncmem(&cur->dma, cur->offs, sizeof(cur->td), |