Sun Mar 1 08:26:55 2015 UTC ()
Whitespace


(skrll)
diff -r1.234.2.33 -r1.234.2.34 src/sys/dev/usb/ehci.c

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

--- src/sys/dev/usb/ehci.c 2015/03/01 08:18:16 1.234.2.33
+++ src/sys/dev/usb/ehci.c 2015/03/01 08:26:55 1.234.2.34
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ehci.c,v 1.234.2.33 2015/03/01 08:18:16 skrll Exp $ */ 1/* $NetBSD: ehci.c,v 1.234.2.34 2015/03/01 08:26:55 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.234.2.33 2015/03/01 08:18:16 skrll Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.34 2015/03/01 08:26:55 skrll Exp $");
57 57
58#include "ohci.h" 58#include "ohci.h"
59#include "uhci.h" 59#include "uhci.h"
60#include "opt_usb.h" 60#include "opt_usb.h"
61 61
62#include <sys/param.h> 62#include <sys/param.h>
63 63
64#include <sys/bus.h> 64#include <sys/bus.h>
65#include <sys/cpu.h> 65#include <sys/cpu.h>
66#include <sys/device.h> 66#include <sys/device.h>
67#include <sys/kernel.h> 67#include <sys/kernel.h>
68#include <sys/kmem.h> 68#include <sys/kmem.h>
69#include <sys/mutex.h> 69#include <sys/mutex.h>
@@ -2831,27 +2831,27 @@ ehci_alloc_sqtd_chain(struct ehci_pipe * @@ -2831,27 +2831,27 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *
2831 if (curoffs + curlen != len || 2831 if (curoffs + curlen != len ||
2832 ((curlen % mps) == 0 && !rd && curlen != 0 && 2832 ((curlen % mps) == 0 && !rd && curlen != 0 &&
2833 (flags & USBD_FORCE_SHORT_XFER))) { 2833 (flags & USBD_FORCE_SHORT_XFER))) {
2834 next = ehci_alloc_sqtd(sc); 2834 next = ehci_alloc_sqtd(sc);
2835 if (next == NULL) 2835 if (next == NULL)
2836 goto nomem; 2836 goto nomem;
2837 nextphys = htole32(next->physaddr); 2837 nextphys = htole32(next->physaddr);
2838 } else { 2838 } else {
2839 next = NULL; 2839 next = NULL;
2840 nextphys = EHCI_NULL; 2840 nextphys = EHCI_NULL;
2841 } 2841 }
2842 2842
2843 /* Find number of pages we'll be using, insert dma addresses */ 2843 /* Find number of pages we'll be using, insert dma addresses */
2844 pages = EHCI_PAGE(curlen + EHCI_PAGE_SIZE -1) >> 12; 2844 pages = EHCI_PAGE(curlen + EHCI_PAGE_SIZE - 1) >> 12;
2845 KASSERT(pages <= EHCI_QTD_NBUFFERS); 2845 KASSERT(pages <= EHCI_QTD_NBUFFERS);
2846 pageoffs = EHCI_PAGE(curoffs); 2846 pageoffs = EHCI_PAGE(curoffs);
2847 for (i = 0; i < pages; i++) { 2847 for (i = 0; i < pages; i++) {
2848 a = DMAADDR(dma, pageoffs + i * EHCI_PAGE_SIZE); 2848 a = DMAADDR(dma, pageoffs + i * EHCI_PAGE_SIZE);
2849 cur->qtd.qtd_buffer[i] = htole32(a & 0xFFFFF000); 2849 cur->qtd.qtd_buffer[i] = htole32(a & 0xFFFFF000);
2850 /* Cast up to avoid compiler warnings */ 2850 /* Cast up to avoid compiler warnings */
2851 cur->qtd.qtd_buffer_hi[i] = htole32((uint64_t)a >> 32); 2851 cur->qtd.qtd_buffer_hi[i] = htole32((uint64_t)a >> 32);
2852 } 2852 }
2853 2853
2854 /* First buffer pointer requires a page offset to start at */ 2854 /* First buffer pointer requires a page offset to start at */
2855 va = (vaddr_t)KERNADDR(dma, curoffs); 2855 va = (vaddr_t)KERNADDR(dma, curoffs);
2856 cur->qtd.qtd_buffer[0] |= htole32(EHCI_PAGE_OFFSET(va)); 2856 cur->qtd.qtd_buffer[0] |= htole32(EHCI_PAGE_OFFSET(va));
2857 2857