Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Insert (very conservative!) bus_space_barrier() ...



details:   https://anonhg.NetBSD.org/src/rev/288ae535e516
branches:  trunk
changeset: 485345:288ae535e516
user:      augustss <augustss%NetBSD.org@localhost>
date:      Tue Apr 25 14:28:13 2000 +0000

description:
Insert (very conservative!) bus_space_barrier() calls at all register accesses.
The bus_space(9) man page says you've gotta have them...

diffstat:

 sys/dev/usb/ohci.c |  16 ++++++++++++----
 sys/dev/usb/uhci.c |  19 ++++++++++++-------
 2 files changed, 24 insertions(+), 11 deletions(-)

diffs (63 lines):

diff -r 4885fa0d7881 -r 288ae535e516 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Tue Apr 25 14:16:46 2000 +0000
+++ b/sys/dev/usb/ohci.c        Tue Apr 25 14:28:13 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.87 2000/04/22 22:50:44 augustss Exp $       */
+/*     $NetBSD: ohci.c,v 1.88 2000/04/25 14:28:13 augustss Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -227,9 +227,17 @@
 Static void            ohci_dump_itds __P((ohci_soft_itd_t *));
 #endif
 
-#define OWRITE4(sc, r, x) bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x))
-#define OREAD4(sc, r) bus_space_read_4((sc)->iot, (sc)->ioh, (r))
-#define OREAD2(sc, r) bus_space_read_2((sc)->iot, (sc)->ioh, (r))
+#define OBARR(sc) bus_space_barrier((sc)->iot, (sc)->ioh, 0, (sc)->sc_size, \
+                       BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
+#define OWRITE1(sc, r, x) \
+ do { OBARR(sc); bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+#define OWRITE2(sc, r, x) \
+ do { OBARR(sc); bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+#define OWRITE4(sc, r, x) \
+ do { OBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+#define OREAD1(sc, r) (OBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r)))
+#define OREAD2(sc, r) (OBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r)))
+#define OREAD4(sc, r) (OBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r)))
 
 /* Reverse the bits in a value 0 .. 31 */
 Static u_int8_t revbits[OHCI_NO_INTRS] = 
diff -r 4885fa0d7881 -r 288ae535e516 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Tue Apr 25 14:16:46 2000 +0000
+++ b/sys/dev/usb/uhci.c        Tue Apr 25 14:28:13 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.111 2000/04/21 15:40:01 augustss Exp $      */
+/*     $NetBSD: uhci.c,v 1.112 2000/04/25 14:28:14 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -261,12 +261,17 @@
 Static void            uhci_dump __P((void));
 #endif
 
-#define UWRITE1(sc, r, x) bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x))
-#define UWRITE2(sc, r, x) bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x))
-#define UWRITE4(sc, r, x) bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x))
-#define UREAD1(sc, r) bus_space_read_1((sc)->iot, (sc)->ioh, (r))
-#define UREAD2(sc, r) bus_space_read_2((sc)->iot, (sc)->ioh, (r))
-#define UREAD4(sc, r) bus_space_read_4((sc)->iot, (sc)->ioh, (r))
+#define UBARR(sc) bus_space_barrier((sc)->iot, (sc)->ioh, 0, (sc)->sc_size, \
+                       BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
+#define UWRITE1(sc, r, x) \
+ do { UBARR(sc); bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+#define UWRITE2(sc, r, x) \
+ do { UBARR(sc); bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+#define UWRITE4(sc, r, x) \
+ do { UBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+#define UREAD1(sc, r) (UBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r)))
+#define UREAD2(sc, r) (UBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r)))
+#define UREAD4(sc, r) (UBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r)))
 
 #define UHCICMD(sc, cmd) UWRITE2(sc, UHCI_CMD, cmd)
 #define UHCISTS(sc) UREAD2(sc, UHCI_STS)



Home | Main Index | Thread Index | Old Index