Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/qbus Implement what the documentation in rfreg.h sta...



details:   https://anonhg.NetBSD.org/src/rev/cf153707f620
branches:  trunk
changeset: 1004454:cf153707f620
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 29 03:49:59 2019 +0000

description:
Implement what the documentation in rfreg.h states, and do not apply the
wrong mask to the command register (which kind of works, but really?!?!)
Found by gcc -Wtautological-compare

diffstat:

 sys/dev/qbus/rf.c    |   9 +++++----
 sys/dev/qbus/rfreg.h |  19 ++++++++++---------
 2 files changed, 15 insertions(+), 13 deletions(-)

diffs (70 lines):

diff -r 471952d8e442 -r cf153707f620 sys/dev/qbus/rf.c
--- a/sys/dev/qbus/rf.c Tue Oct 29 02:49:05 2019 +0000
+++ b/sys/dev/qbus/rf.c Tue Oct 29 03:49:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf.c,v 1.33 2015/12/08 20:36:15 christos Exp $ */
+/*     $NetBSD: rf.c,v 1.34 2019/10/29 03:49:59 christos Exp $ */
 /*
  * Copyright (c) 2002 Jochen Kunz.
  * All rights reserved.
@@ -36,7 +36,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.33 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.34 2019/10/29 03:49:59 christos Exp $");
 
 /* autoconfig stuff */
 #include <sys/param.h>
@@ -530,7 +530,7 @@
        /* Wait 50us, the controller needs this time to setle. */
        DELAY(50);
        /* Write parameter 1 to DBR */
-       if ((cmd & RX2CS_FC) != RX2CS_RSTAT) {
+       if ((cmd & RX2CS_MASK) != RX2CS_RSTAT) {
                /* Transfer request set? */
                if ((bus_space_read_2(rfc_sc->sc_iot, rfc_sc->sc_ioh, RX2CS)
                    & RX2CS_TR) == 0) {
@@ -542,7 +542,8 @@
                    data1);
        }
        /* Write parameter 2 to DBR */
-       if ((cmd & RX2CS_FC) <= RX2CS_RSEC || (cmd & RX2CS_FC) == RX2CS_WDDS) {
+       if ((cmd & RX2CS_MASK) <= RX2CS_RSEC ||
+           (cmd & RX2CS_MASK) == RX2CS_WDDS) {
                /* Wait 50us, the controller needs this time to setle. */
                DELAY(50);
                /* Transfer request set? */
diff -r 471952d8e442 -r cf153707f620 sys/dev/qbus/rfreg.h
--- a/sys/dev/qbus/rfreg.h      Tue Oct 29 02:49:05 2019 +0000
+++ b/sys/dev/qbus/rfreg.h      Tue Oct 29 03:49:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rfreg.h,v 1.4 2005/12/11 12:23:29 christos Exp $       */
+/*     $NetBSD: rfreg.h,v 1.5 2019/10/29 03:49:59 christos Exp $       */
 /*
  * Copyright (c) 2002 Jochen Kunz.
  * All rights reserved.
@@ -66,14 +66,15 @@
 
 
 /* Commands of the controller and parameter cont. */
-#define        RX2CS_FBUF      001     /* Fill Buffer, word count and bus address */
-#define        RX2CS_EBUF      003     /* Empty Buffer, word count and bus address */
-#define        RX2CS_WSEC      005     /* Write Sector, sector and track */
-#define        RX2CS_RSEC      007     /* Read Sector, sector and track */
-#define        RX2CS_SMD       011     /* Set Media Density, ??? */
-#define        RX2CS_RSTAT     013     /* Read Status, no params */
-#define        RX2CS_WDDS      015     /* Write Deleted Data Sector, sector and track */
-#define        RX2CS_REC       017     /* Read Error Code, bus address */
+#define        RX2CS_FBUF      0x1     /* Fill Buffer, word count and bus address */
+#define        RX2CS_EBUF      0x3     /* Empty Buffer, word count and bus address */
+#define        RX2CS_WSEC      0x5     /* Write Sector, sector and track */
+#define        RX2CS_RSEC      0x7     /* Read Sector, sector and track */
+#define        RX2CS_SMD       0x9     /* Set Media Density, ??? */
+#define        RX2CS_RSTAT     0xb     /* Read Status, no params */
+#define        RX2CS_WDDS      0xd     /* Write Deleted Data Sector, sector and track */
+#define        RX2CS_REC       0xf     /* Read Error Code, bus address */
+#define        RX2CS_MASK      0xf
 
 
 /* Track Address Register */



Home | Main Index | Thread Index | Old Index