Module Name: src
Committed By: christos
Date: Tue Oct 29 03:49:59 UTC 2019
Modified Files:
src/sys/dev/qbus: rf.c rfreg.h
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/qbus/rf.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/qbus/rfreg.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/qbus/rf.c
diff -u src/sys/dev/qbus/rf.c:1.33 src/sys/dev/qbus/rf.c:1.34
--- src/sys/dev/qbus/rf.c:1.33 Tue Dec 8 15:36:15 2015
+++ src/sys/dev/qbus/rf.c Mon Oct 28 23:49:59 2019
@@ -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 @@ TODO:
*/
#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 @@ rfc_sendcmd(struct rfc_softc *rfc_sc, in
/* 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 @@ rfc_sendcmd(struct rfc_softc *rfc_sc, in
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? */
Index: src/sys/dev/qbus/rfreg.h
diff -u src/sys/dev/qbus/rfreg.h:1.4 src/sys/dev/qbus/rfreg.h:1.5
--- src/sys/dev/qbus/rfreg.h:1.4 Sun Dec 11 07:23:29 2005
+++ src/sys/dev/qbus/rfreg.h Mon Oct 28 23:49:59 2019
@@ -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 */