| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ehci.c,v 1.188 2012/03/15 18:38:37 bouyer Exp $ */ | | 1 | /* $NetBSD: ehci.c,v 1.189 2012/03/17 11:45:00 bouyer Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2004-2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2004-2008 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 and | | 8 | * by Lennart Augustsson (lennart@augustsson.net), Charles M. Hannum and |
9 | * Jeremy Morse (jeremy.morse@gmail.com). | | 9 | * Jeremy Morse (jeremy.morse@gmail.com). |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -42,27 +42,27 @@ | | | @@ -42,27 +42,27 @@ |
42 | | | 42 | |
43 | /* | | 43 | /* |
44 | * TODO: | | 44 | * TODO: |
45 | * 1) hold off explorations by companion controllers until ehci has started. | | 45 | * 1) hold off explorations by companion controllers until ehci has started. |
46 | * | | 46 | * |
47 | * 2) The hub driver needs to handle and schedule the transaction translator, | | 47 | * 2) The hub driver needs to handle and schedule the transaction translator, |
48 | * to assign place in frame where different devices get to go. See chapter | | 48 | * to assign place in frame where different devices get to go. See chapter |
49 | * on hubs in USB 2.0 for details. | | 49 | * on hubs in USB 2.0 for details. |
50 | * | | 50 | * |
51 | * 3) Command failures are not recovered correctly. | | 51 | * 3) Command failures are not recovered correctly. |
52 | */ | | 52 | */ |
53 | | | 53 | |
54 | #include <sys/cdefs.h> | | 54 | #include <sys/cdefs.h> |
55 | __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.188 2012/03/15 18:38:37 bouyer Exp $"); | | 55 | __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.189 2012/03/17 11:45:00 bouyer Exp $"); |
56 | | | 56 | |
57 | #include "ohci.h" | | 57 | #include "ohci.h" |
58 | #include "uhci.h" | | 58 | #include "uhci.h" |
59 | #include "opt_usb.h" | | 59 | #include "opt_usb.h" |
60 | | | 60 | |
61 | #include <sys/param.h> | | 61 | #include <sys/param.h> |
62 | #include <sys/systm.h> | | 62 | #include <sys/systm.h> |
63 | #include <sys/kernel.h> | | 63 | #include <sys/kernel.h> |
64 | #include <sys/malloc.h> | | 64 | #include <sys/malloc.h> |
65 | #include <sys/device.h> | | 65 | #include <sys/device.h> |
66 | #include <sys/select.h> | | 66 | #include <sys/select.h> |
67 | #include <sys/proc.h> | | 67 | #include <sys/proc.h> |
68 | #include <sys/queue.h> | | 68 | #include <sys/queue.h> |
| @@ -2702,32 +2702,32 @@ ehci_alloc_sqtd_chain(struct ehci_pipe * | | | @@ -2702,32 +2702,32 @@ ehci_alloc_sqtd_chain(struct ehci_pipe * |
2702 | if (next == NULL) | | 2702 | if (next == NULL) |
2703 | goto nomem; | | 2703 | goto nomem; |
2704 | nextphys = htole32(next->physaddr); | | 2704 | nextphys = htole32(next->physaddr); |
2705 | } else { | | 2705 | } else { |
2706 | next = NULL; | | 2706 | next = NULL; |
2707 | nextphys = EHCI_NULL; | | 2707 | nextphys = EHCI_NULL; |
2708 | } | | 2708 | } |
2709 | | | 2709 | |
2710 | for (i = 0; i * EHCI_PAGE_SIZE < | | 2710 | for (i = 0; i * EHCI_PAGE_SIZE < |
2711 | curlen + EHCI_PAGE_OFFSET(dataphys); i++) { | | 2711 | curlen + EHCI_PAGE_OFFSET(dataphys); i++) { |
2712 | ehci_physaddr_t a = dataphys + i * EHCI_PAGE_SIZE; | | 2712 | ehci_physaddr_t a = dataphys + i * EHCI_PAGE_SIZE; |
2713 | if (i != 0) /* use offset only in first buffer */ | | 2713 | if (i != 0) /* use offset only in first buffer */ |
2714 | a = EHCI_PAGE(a); | | 2714 | a = EHCI_PAGE(a); |
2715 | #ifdef DIAGNOSTIC | | | |
2716 | if (i >= EHCI_QTD_NBUFFERS) { | | 2715 | if (i >= EHCI_QTD_NBUFFERS) { |
| | | 2716 | #ifdef DIAGNOSTIC |
2717 | printf("ehci_alloc_sqtd_chain: i=%d\n", i); | | 2717 | printf("ehci_alloc_sqtd_chain: i=%d\n", i); |
| | | 2718 | #endif |
2718 | goto nomem; | | 2719 | goto nomem; |
2719 | } | | 2720 | } |
2720 | #endif | | | |
2721 | cur->qtd.qtd_buffer[i] = htole32(a); | | 2721 | cur->qtd.qtd_buffer[i] = htole32(a); |
2722 | cur->qtd.qtd_buffer_hi[i] = 0; | | 2722 | cur->qtd.qtd_buffer_hi[i] = 0; |
2723 | } | | 2723 | } |
2724 | cur->nextqtd = next; | | 2724 | cur->nextqtd = next; |
2725 | cur->qtd.qtd_next = cur->qtd.qtd_altnext = nextphys; | | 2725 | cur->qtd.qtd_next = cur->qtd.qtd_altnext = nextphys; |
2726 | cur->qtd.qtd_status = | | 2726 | cur->qtd.qtd_status = |
2727 | htole32(qtdstatus | EHCI_QTD_SET_BYTES(curlen)); | | 2727 | htole32(qtdstatus | EHCI_QTD_SET_BYTES(curlen)); |
2728 | cur->xfer = xfer; | | 2728 | cur->xfer = xfer; |
2729 | cur->len = curlen; | | 2729 | cur->len = curlen; |
2730 | | | 2730 | |
2731 | DPRINTFN(10,("ehci_alloc_sqtd_chain: cbp=0x%08x end=0x%08x\n", | | 2731 | DPRINTFN(10,("ehci_alloc_sqtd_chain: cbp=0x%08x end=0x%08x\n", |
2732 | dataphys, dataphys + curlen)); | | 2732 | dataphys, dataphys + curlen)); |
2733 | /* adjust the toggle based on the number of packets in this | | 2733 | /* adjust the toggle based on the number of packets in this |