Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nick-nhusb]: src/sys/dev/usb Improve EHCI_PAGE macros and usage.
details: https://anonhg.NetBSD.org/src/rev/88cda2d80ef7
branches: nick-nhusb
changeset: 334127:88cda2d80ef7
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Mar 03 06:36:53 2015 +0000
description:
Improve EHCI_PAGE macros and usage.
No functional change.
diffstat:
sys/dev/usb/ehci.c | 8 ++++----
sys/dev/usb/ehcireg.h | 12 +++++++-----
2 files changed, 11 insertions(+), 9 deletions(-)
diffs (59 lines):
diff -r 96f9b623029d -r 88cda2d80ef7 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Tue Mar 03 06:23:43 2015 +0000
+++ b/sys/dev/usb/ehci.c Tue Mar 03 06:36:53 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.234.2.36 2015/03/02 22:16:38 skrll Exp $ */
+/* $NetBSD: ehci.c,v 1.234.2.37 2015/03/03 06:36:53 skrll Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.36 2015/03/02 22:16:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.37 2015/03/03 06:36:53 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -2835,12 +2835,12 @@
}
/* Find number of pages we'll be using, insert dma addresses */
- pages = EHCI_PAGE(curlen + EHCI_PAGE_SIZE - 1) >> 12;
+ pages = EHCI_NPAGES(curlen);
KASSERT(pages <= EHCI_QTD_NBUFFERS);
pageoffs = EHCI_PAGE(curoffs);
for (i = 0; i < pages; i++) {
a = DMAADDR(dma, pageoffs + i * EHCI_PAGE_SIZE);
- cur->qtd.qtd_buffer[i] = htole32(a & 0xFFFFF000);
+ cur->qtd.qtd_buffer[i] = htole32(EHCI_PAGE(a));
/* Cast up to avoid compiler warnings */
cur->qtd.qtd_buffer_hi[i] = htole32((uint64_t)a >> 32);
}
diff -r 96f9b623029d -r 88cda2d80ef7 sys/dev/usb/ehcireg.h
--- a/sys/dev/usb/ehcireg.h Tue Mar 03 06:23:43 2015 +0000
+++ b/sys/dev/usb/ehcireg.h Tue Mar 03 06:36:53 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcireg.h,v 1.34.14.4 2015/02/01 08:45:04 skrll Exp $ */
+/* $NetBSD: ehcireg.h,v 1.34.14.5 2015/03/03 06:36:53 skrll Exp $ */
/*
* Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -188,10 +188,12 @@
#define EHCI_MAX_PORTS 16 /* only 4 bits available in EHCI_HCS_N_PORTS */
/* No data structure may cross a page boundary. */
-#define EHCI_PAGE_SIZE 0x1000
-#define EHCI_PAGE_MASK (EHCI_PAGE_SIZE - 1)
-#define EHCI_PAGE(x) ((x) & ~EHCI_PAGE_MASK)
-#define EHCI_PAGE_OFFSET(x) ((x) & EHCI_PAGE_MASK)
+#define EHCI_PAGE_SHIFT 12
+#define EHCI_PAGE_SIZE (1 << EHCI_PAGE_SHIFT)
+#define EHCI_PAGE_MASK (EHCI_PAGE_SIZE - 1)
+#define EHCI_PAGE(x) ((x) & ~EHCI_PAGE_MASK)
+#define EHCI_PAGE_OFFSET(x) ((x) & EHCI_PAGE_MASK)
+#define EHCI_NPAGES(x) (((x) + EHCI_PAGE_MASK) >> EHCI_PAGE_SHIFT)
typedef uint32_t ehci_link_t;
#define EHCI_LINK_TERMINATE 0x00000001
Home |
Main Index |
Thread Index |
Old Index