CVS commit: src/sys/dev/qbus

2024-03-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Mar 25 05:37:45 UTC 2024

Modified Files:
src/sys/dev/qbus: if_qe.c

Log Message:
vax/qe(4): supply an ipf->if_init() so that if_init() doesn't crash.

convert the existing qeinit() to one compatible with if_init.

should fix PR#58068.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/qbus/if_qe.c

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/if_qe.c
diff -u src/sys/dev/qbus/if_qe.c:1.81 src/sys/dev/qbus/if_qe.c:1.82
--- src/sys/dev/qbus/if_qe.c:1.81	Tue May 28 07:41:49 2019
+++ src/sys/dev/qbus/if_qe.c	Mon Mar 25 05:37:45 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_qe.c,v 1.81 2019/05/28 07:41:49 msaitoh Exp $ */
+/*  $NetBSD: if_qe.c,v 1.82 2024/03/25 05:37:45 mrg Exp $ */
 /*
  * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.81 2019/05/28 07:41:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.82 2024/03/25 05:37:45 mrg Exp $");
 
 #include "opt_inet.h"
 
@@ -97,7 +97,7 @@ struct	qe_softc {
 
 static	int	qematch(device_t, cfdata_t, void *);
 static	void	qeattach(device_t, device_t, void *);
-static	void	qeinit(struct qe_softc *);
+static	int	qeinit(struct ifnet *);
 static	void	qestart(struct ifnet *);
 static	void	qeintr(void *);
 static	int	qeioctl(struct ifnet *, u_long, void *);
@@ -341,6 +341,7 @@ qeattach(device_t parent, device_t self,
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_start = qestart;
+	ifp->if_init = qeinit;
 	ifp->if_ioctl = qeioctl;
 	ifp->if_watchdog = qetimeout;
 	IFQ_SET_READY(>if_snd);
@@ -381,10 +382,10 @@ qeattach(device_t parent, device_t self,
 /*
  * Initialization of interface.
  */
-void
-qeinit(struct qe_softc *sc)
+int
+qeinit(struct ifnet *ifp)
 {
-	struct ifnet *ifp = (struct ifnet *)>sc_if;
+	struct qe_softc *sc = ifp->if_softc;
 	struct qe_cdata *qc = sc->sc_qedata;
 	int i;
 
@@ -411,7 +412,6 @@ qeinit(struct qe_softc *sc)
 		qc->qc_xmit[i].qe_status1 = qc->qc_xmit[i].qe_flag = QE_NOTYET;
 	}
 
-
 	/*
 	 * Init receive descriptors.
 	 */
@@ -436,6 +436,7 @@ qeinit(struct qe_softc *sc)
 	 */
 	qe_setup(sc);
 
+	return 0;
 }
 
 /*
@@ -651,7 +652,7 @@ qeioctl(struct ifnet *ifp, u_long cmd, v
 		switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
 		case AF_INET:
-			qeinit(sc);
+			qeinit(ifp);
 			arp_ifinit(ifp, ifa);
 			break;
 #endif
@@ -677,7 +678,7 @@ qeioctl(struct ifnet *ifp, u_long cmd, v
 			 * If interface it marked up and it is stopped, then
 			 * start it.
 			 */
-			qeinit(sc);
+			qeinit(ifp);
 			break;
 		case IFF_UP | IFF_RUNNING:
 			/*
@@ -868,5 +869,5 @@ qetimeout(struct ifnet *ifp)
 	 * Do a reset of interface, to get it going again.
 	 * Will it work by just restart the transmit logic?
 	 */
-	qeinit(sc);
+	qeinit(ifp);
 }



CVS commit: src/sys/dev/qbus

2024-03-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Mar 25 05:37:45 UTC 2024

Modified Files:
src/sys/dev/qbus: if_qe.c

Log Message:
vax/qe(4): supply an ipf->if_init() so that if_init() doesn't crash.

convert the existing qeinit() to one compatible with if_init.

should fix PR#58068.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/qbus/if_qe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/qbus

2022-10-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 26 23:46:37 UTC 2022

Modified Files:
src/sys/dev/qbus: dhu.c

Log Message:
vax/dhu(4): Convert to ttylock/ttyunlock.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/qbus/dhu.c

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/dhu.c
diff -u src/sys/dev/qbus/dhu.c:1.57 src/sys/dev/qbus/dhu.c:1.58
--- src/sys/dev/qbus/dhu.c:1.57	Fri Jul 25 08:10:38 2014
+++ src/sys/dev/qbus/dhu.c	Wed Oct 26 23:46:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dhu.c,v 1.57 2014/07/25 08:10:38 dholland Exp $	*/
+/*	$NetBSD: dhu.c,v 1.58 2022/10/26 23:46:37 riastradh Exp $	*/
 /*
  * Copyright (c) 2003, Hugh Graham.
  * Copyright (c) 1992, 1993
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dhu.c,v 1.57 2014/07/25 08:10:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dhu.c,v 1.58 2022/10/26 23:46:37 riastradh Exp $");
 
 #include 
 #include 
@@ -439,7 +439,8 @@ dhuopen(dev_t dev, int flag, int mode, s
 	if (line >= sc->sc_lines)
 		return ENXIO;
 
-	mutex_spin_enter(_lock);
+	tp = sc->sc_dhu[line].dhu_tty;
+	ttylock(tp);
 	if (sc->sc_type == IS_DHU) {
 		/* CSR 3:0 must be 0 */
 		DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE);
@@ -449,8 +450,6 @@ dhuopen(dev_t dev, int flag, int mode, s
 	DHU_WRITE_BYTE(DHU_UBA_CSR, DHU_CSR_RXIE | line);
 	sc->sc_dhu[line].dhu_modem = DHU_READ_WORD(DHU_UBA_STAT);
 
-	tp = sc->sc_dhu[line].dhu_tty;
-
 	if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
 		return (EBUSY);
 
@@ -482,7 +481,7 @@ dhuopen(dev_t dev, int flag, int mode, s
 		if (error)
 			break;
 	}
-	mutex_spin_exit(_lock);
+	ttyunlock(tp);
 	if (error)
 		return (error);
 	return ((*tp->t_linesw->l_open)(dev, tp));



CVS commit: src/sys/dev/qbus

2022-10-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 26 23:46:37 UTC 2022

Modified Files:
src/sys/dev/qbus: dhu.c

Log Message:
vax/dhu(4): Convert to ttylock/ttyunlock.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/qbus/dhu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/qbus

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 12 02:40:20 UTC 2022

Modified Files:
src/sys/dev/qbus: ts.c

Log Message:
ts(4): Skip fabricating bogus struct device in tsmatch.

Doesn't appear to be used anywhere in tsmatch.  Let's not invent
bogus autoconf guts here.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/qbus/ts.c

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/ts.c
diff -u src/sys/dev/qbus/ts.c:1.34 src/sys/dev/qbus/ts.c:1.35
--- src/sys/dev/qbus/ts.c:1.34	Sat Jan  1 10:32:29 2022
+++ src/sys/dev/qbus/ts.c	Sat Feb 12 02:40:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ts.c,v 1.34 2022/01/01 10:32:29 msaitoh Exp $ */
+/*	$NetBSD: ts.c,v 1.35 2022/02/12 02:40:20 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.34 2022/01/01 10:32:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.35 2022/02/12 02:40:20 riastradh Exp $");
 
 #undef	TSDEBUG
 
@@ -215,7 +215,6 @@ const struct cdevsw ts_cdevsw = {
 int
 tsmatch(device_t parent, cfdata_t match, void *aux)
 {
-	struct device tsdev;
 	struct ts_softc ssc;
 	struct ts_softc *sc = 
 	struct uba_attach_args *ua = aux;
@@ -224,9 +223,7 @@ tsmatch(device_t parent, cfdata_t match,
 	sc->sc_iot = ua->ua_iot;
 	sc->sc_ioh = ua->ua_ioh;
 	sc->sc_mapped = 0;
-	sc->sc_dev = 
 	sc->sc_uh = device_private(parent);
-	strcpy(sc->sc_dev->dv_xname, "ts");
 
 	/* Try to reset the device */
 	for (i = 0; i < 3; i++) {



CVS commit: src/sys/dev/qbus

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 12 02:40:20 UTC 2022

Modified Files:
src/sys/dev/qbus: ts.c

Log Message:
ts(4): Skip fabricating bogus struct device in tsmatch.

Doesn't appear to be used anywhere in tsmatch.  Let's not invent
bogus autoconf guts here.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/qbus/ts.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/qbus

2021-12-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Dec 20 17:12:41 UTC 2021

Modified Files:
src/sys/dev/qbus: if_qt.c if_qtreg.h

Log Message:
Set up multicast (input) filter on qt (DELQA-Turbo).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/qbus/if_qt.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/qbus/if_qtreg.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/if_qt.c
diff -u src/sys/dev/qbus/if_qt.c:1.25 src/sys/dev/qbus/if_qt.c:1.26
--- src/sys/dev/qbus/if_qt.c:1.25	Wed Jan 29 05:57:21 2020
+++ src/sys/dev/qbus/if_qt.c	Mon Dec 20 17:12:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $	*/
+/*	$NetBSD: if_qt.c,v 1.26 2021/12/20 17:12:41 rhialto Exp $	*/
 /*
  * Copyright (c) 1992 Steven M. Schultz
  * All rights reserved.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.26 2021/12/20 17:12:41 rhialto Exp $");
 
 #include "opt_inet.h"
 
@@ -162,6 +162,7 @@ struct	qt_softc {
 
 static	int qtmatch(device_t, cfdata_t, void *);
 static	void qtattach(device_t, device_t, void *);
+static	void lance_setladrf(struct ethercom *ec, uint16_t *af);
 static	void qtintr(void *);
 static	int qtinit(struct ifnet *);
 static	int qtioctl(struct ifnet *, u_long, void *);
@@ -332,6 +333,67 @@ qtturbo(struct qt_softc *sc)
 	return(1);
 }
 
+#define ETHER_CMP(a,b)	memcmp((a), (b), 6)
+
+/*
+ * Set up the logical address filter.
+ */
+void
+lance_setladrf(struct ethercom *ec, uint16_t *af)
+{
+	struct ifnet *ifp = >ec_if;
+	struct ether_multi *enm;
+	uint32_t crc;
+	struct ether_multistep step;
+
+	/*
+	 * Set up multicast address filter by passing all multicast addresses
+	 * through a crc generator, and then using the high order 6 bits as an
+	 * index into the 64 bit logical address filter.  The high order bit
+	 * selects the word, while the rest of the bits select the bit within
+	 * the word.
+	 */
+
+	if (ifp->if_flags & IFF_PROMISC)
+		goto allmulti;
+
+	af[0] = af[1] = af[2] = af[3] = 0x;
+
+	ETHER_LOCK(ec);
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (ETHER_CMP(enm->enm_addrlo, enm->enm_addrhi)) {
+			/*
+			 * We must listen to a range of multicast addresses.
+			 * For now, just accept all multicasts, rather than
+			 * trying to set only those filter bits needed to match
+			 * the range.  (At this time, the only use of address
+			 * ranges is for IP multicast routing, for which the
+			 * range is big enough to require all bits set.)
+			 */
+			ETHER_UNLOCK(ec);
+			goto allmulti;
+		}
+
+		crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
+
+		/* Just want the 6 most significant bits. */
+		crc >>= 26;
+
+		/* Set the corresponding bit in the filter. */
+		af[crc >> 4] |= 1 << (crc & 0xf);
+
+		ETHER_NEXT_MULTI(step, enm);
+	}
+	ETHER_UNLOCK(ec);
+	ifp->if_flags &= ~IFF_ALLMULTI;
+	return;
+
+allmulti:
+	ifp->if_flags |= IFF_ALLMULTI;
+	af[0] = af[1] = af[2] = af[3] = 0x;
+}
+
 int
 qtinit(struct ifnet *ifp)
 {
@@ -388,7 +450,10 @@ qtinit(struct ifnet *ifp)
 	}
 	iniblk = >sc_ib->qc_init;
 	iniblk->mode = ifp->if_flags & IFF_PROMISC ? INIT_MODE_PRO : 0;
-
+/*
+ * The multicast filter works "like LANCE".
+ */
+	lance_setladrf(>is_ec, iniblk->laddr);
 
 /*
  * Now initialize the receive ring descriptors.  Because this routine can be

Index: src/sys/dev/qbus/if_qtreg.h
diff -u src/sys/dev/qbus/if_qtreg.h:1.5 src/sys/dev/qbus/if_qtreg.h:1.6
--- src/sys/dev/qbus/if_qtreg.h:1.5	Sun Dec 11 12:23:29 2005
+++ src/sys/dev/qbus/if_qtreg.h	Mon Dec 20 17:12:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qtreg.h,v 1.5 2005/12/11 12:23:29 christos Exp $	*/
+/*	$NetBSD: if_qtreg.h,v 1.6 2021/12/20 17:12:41 rhialto Exp $	*/
 /*
  * Copyright (c) 1992 Steven M. Schultz
  * All rights reserved.
@@ -207,18 +207,18 @@
 
 	struct	qt_init
 		{
-		short	mode;
-		u_char	paddr[6];	/* 48 bit physical address */
-		u_char	laddr[8];	/* 64 bit logical address filter */
-		u_short	rx_lo;		/* low 16 bits of receive ring addr */
-		u_short	rx_hi;		/* high 6 bits of receive ring addr */
-		u_short	tx_lo;		/* low 16 bits of transmit ring addr */
-		u_short	tx_hi;		/* high 6 bits of transmit ring addr */
-		u_short	options;
-		u_short	vector;
-		u_short	hit;
-		char	passwd[6];
-		char	pad[4];		/* even on 40 byte for alignment */
+		int16_t		mode;
+		u_char		paddr[6];	/* 48 bit physical address */
+		uint16_t	laddr[4];	/* 64 bit logical address filter */
+		uint16_t	rx_lo;		/* low 16 bits of receive ring addr */
+		uint16_t	rx_hi;		/* high 6 bits of receive ring addr */
+		uint16_t	tx_lo;		/* low 16 bits of transmit ring addr */
+		uint16_t	tx_hi;		/* high 6 bits of transmit ring addr */
+		uint16_t	options;
+		uint16_t	vector;
+		uint16_t	hit;
+		char		passwd[6];
+		char		pad[4];		/* even on 40 byte for alignment */
 		};
 
 

CVS commit: src/sys/dev/qbus

2021-12-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Dec 20 17:12:41 UTC 2021

Modified Files:
src/sys/dev/qbus: if_qt.c if_qtreg.h

Log Message:
Set up multicast (input) filter on qt (DELQA-Turbo).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/qbus/if_qt.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/qbus/if_qtreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/qbus

2019-10-28 Thread Christos Zoulas
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 
-__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 
@@ -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 */



CVS commit: src/sys/dev/qbus

2019-10-28 Thread Christos Zoulas
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.



CVS commit: src/sys/dev/qbus

2019-05-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 08:29:17 UTC 2019

Modified Files:
src/sys/dev/qbus: if_il.c

Log Message:
 Make if_il.c compilable again.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/qbus/if_il.c

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/if_il.c
diff -u src/sys/dev/qbus/if_il.c:1.33 src/sys/dev/qbus/if_il.c:1.34
--- src/sys/dev/qbus/if_il.c:1.33	Fri May 24 08:27:44 2019
+++ src/sys/dev/qbus/if_il.c	Fri May 24 08:29:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_il.c,v 1.33 2019/05/24 08:27:44 msaitoh Exp $	*/
+/*	$NetBSD: if_il.c,v 1.34 2019/05/24 08:29:17 msaitoh Exp $	*/
 /*
  * Copyright (c) 1982, 1986 Regents of the University of California.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.33 2019/05/24 08:27:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.34 2019/05/24 08:29:17 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -116,7 +116,7 @@ static	void ilattach(device_t, device_t,
 static	void ilcint(void *);
 static	void ilrint(void *);
 static	void ilreset(device_t);
-static	int ilwait(struct il_softc *, char *);
+static	int ilwait(struct il_softc *, const char *);
 static	int ilinit(struct ifnet *);
 static	void ilstart(struct ifnet *);
 static	void ilwatch(struct ifnet *);
@@ -137,12 +137,11 @@ int
 ilmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct uba_attach_args *ua = aux;
-	volatile int i;
 
 	bus_space_write_2(ua->ua_iot, ua->ua_ioh, IL_CSR,
 	ILC_OFFLINE | IL_CIE);
 	DELAY(10);
-	i = bus_space_read_2(ua->ua_iot, ua->ua_ioh, IL_CSR); /* clear CDONE */
+	bus_space_read_2(ua->ua_iot, ua->ua_ioh, IL_CSR); /* clear CDONE */
 
 	return 1;
 }
@@ -202,7 +201,7 @@ ilattach(device_t parent, device_t self,
 
 	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_softc = sc;
-	ifp->if_flags = IFF_BROADCAST;
+	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_init = ilinit;
 	ifp->if_stop = ilstop;
 	ifp->if_ioctl = ether_ioctl;
@@ -224,7 +223,7 @@ ilstop(struct ifnet *ifp, int a)
 
 
 int
-ilwait(struct il_softc *sc, char *op)
+ilwait(struct il_softc *sc, const char *op)
 {
 
 	while ((IL_RCSR(IL_CSR)_CDONE) == 0)
@@ -325,19 +324,18 @@ ilinit(struct ifnet *ifp)
 			goto out;
 		}
 	}
-#ifdef MULTICAST
-	if (is->is_if.if_flags & IFF_PROMISC) {
-		addr->il_csr = ILC_PRMSC;
-		if (ilwait(ui, "all multi"))
+	if (sc->sc_if.if_flags & IFF_PROMISC) {
+		IL_WCSR(IL_CSR, ILC_PRMSC);
+		if (ilwait(sc, "all multi"))
 			goto out;
-	} else if (is->is_if.if_flags & IFF_ALLMULTI) {
-	too_many_multis:
-		addr->il_csr = ILC_ALLMC;
-		if (ilwait(ui, "all multi"))
+	} else if (sc->sc_if.if_flags & IFF_ALLMULTI) {
+too_many_multis:
+		IL_WCSR(IL_CSR, ILC_ALLMC);
+		if (ilwait(sc, "all multi"))
 			goto out;
 	} else {
 		int i;
-		register struct ether_addr *ep = is->is_maddrs;
+		register struct ether_addr *ep = sc->sc_maddrs;
 		struct ether_multi *enm;
 		struct ether_multistep step;
 		/*
@@ -347,29 +345,28 @@ ilinit(struct ifnet *ifp)
 		 * multicasts.
 		 */
 		i = 0;
-		ETHER_FIRST_MULTI(step, >is_ac, enm);
+		ETHER_FIRST_MULTI(step, >sc_ec, enm);
 		while (enm != NULL) {
-			if (++i > 63 && k != 0) {
+			if (++i > 63 /* && k != 0 */) {
 break;
 			}
 			*ep++ = *(struct ether_addr *)enm->enm_addrlo;
 			ETHER_NEXT_MULTI(step, enm);
 		}
-		if (i = 0) {
+		if (i == 0) {
 			/* no multicasts! */
 		} else if (i <= 63) {
-			addr->il_bar = is->is_ubaddr & 0x;
-			addr->il_bcr = i * sizeof (struct ether_addr);
-			addr->il_csr = ((is->is_ubaddr >> 2) & IL_EUA)|
-		LC_LDGRPS;
-			if (ilwait(ui, "load multi"))
+			IL_WCSR(IL_BAR, sc->sc_ubaddr & 0x);
+			IL_WCSR(IL_BCR, i * sizeof(struct ether_addr));
+			IL_WCSR(IL_CSR,
+			((sc->sc_ubaddr >> 2) & IL_EUA) | ILC_LDGRPS);
+			if (ilwait(sc, "load multi"))
 goto out;
 		} else {
-		is->is_if.if_flags |= IFF_ALLMULTI;
-		goto too_many_multis;
+			sc->sc_if.if_flags |= IFF_ALLMULTI;
+			goto too_many_multis;
 		}
 	}
-#endif /* MULTICAST */
 	/*
 	 * Set board online.
 	 * Hang receive buffer and start any pending



CVS commit: src/sys/dev/qbus

2019-05-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 08:29:17 UTC 2019

Modified Files:
src/sys/dev/qbus: if_il.c

Log Message:
 Make if_il.c compilable again.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/qbus/if_il.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/qbus

2019-05-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 08:27:44 UTC 2019

Modified Files:
src/sys/dev/qbus: if_il.c

Log Message:
 Revert previous.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/qbus/if_il.c

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/if_il.c
diff -u src/sys/dev/qbus/if_il.c:1.32 src/sys/dev/qbus/if_il.c:1.33
--- src/sys/dev/qbus/if_il.c:1.32	Fri May 24 08:22:05 2019
+++ src/sys/dev/qbus/if_il.c	Fri May 24 08:27:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_il.c,v 1.32 2019/05/24 08:22:05 msaitoh Exp $	*/
+/*	$NetBSD: if_il.c,v 1.33 2019/05/24 08:27:44 msaitoh Exp $	*/
 /*
  * Copyright (c) 1982, 1986 Regents of the University of California.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.32 2019/05/24 08:22:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.33 2019/05/24 08:27:44 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -202,7 +202,7 @@ ilattach(device_t parent, device_t self,
 
 	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_softc = sc;
-	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+	ifp->if_flags = IFF_BROADCAST;
 	ifp->if_init = ilinit;
 	ifp->if_stop = ilstop;
 	ifp->if_ioctl = ether_ioctl;
@@ -325,20 +325,19 @@ ilinit(struct ifnet *ifp)
 			goto out;
 		}
 	}
-
-	if (sc->sc_if.if_flags & IFF_PROMISC) {
+#ifdef MULTICAST
+	if (is->is_if.if_flags & IFF_PROMISC) {
 		addr->il_csr = ILC_PRMSC;
 		if (ilwait(ui, "all multi"))
 			goto out;
-	} else if (sc->sc_if.if_flags & IFF_ALLMULTI) {
-too_many_multis:
+	} else if (is->is_if.if_flags & IFF_ALLMULTI) {
+	too_many_multis:
 		addr->il_csr = ILC_ALLMC;
 		if (ilwait(ui, "all multi"))
 			goto out;
 	} else {
 		int i;
-		struct ethercom *ec = >sc_ec;
-		register struct ether_addr *ep = sc->sc_maddrs;
+		register struct ether_addr *ep = is->is_maddrs;
 		struct ether_multi *enm;
 		struct ether_multistep step;
 		/*
@@ -348,8 +347,7 @@ too_many_multis:
 		 * multicasts.
 		 */
 		i = 0;
-		ETHER_LOCK(ec);
-		ETHER_FIRST_MULTI(step, ec, enm);
+		ETHER_FIRST_MULTI(step, >is_ac, enm);
 		while (enm != NULL) {
 			if (++i > 63 && k != 0) {
 break;
@@ -357,22 +355,21 @@ too_many_multis:
 			*ep++ = *(struct ether_addr *)enm->enm_addrlo;
 			ETHER_NEXT_MULTI(step, enm);
 		}
-		ETHER_UNLOCK(ec);
 		if (i = 0) {
 			/* no multicasts! */
 		} else if (i <= 63) {
-			addr->il_bar = sc->sc_ubaddr & 0x;
+			addr->il_bar = is->is_ubaddr & 0x;
 			addr->il_bcr = i * sizeof (struct ether_addr);
-			addr->il_csr = ((sc->sc_ubaddr >> 2) & IL_EUA) |
+			addr->il_csr = ((is->is_ubaddr >> 2) & IL_EUA)|
 		LC_LDGRPS;
 			if (ilwait(ui, "load multi"))
 goto out;
 		} else {
-			sc->sc_if.if_flags |= IFF_ALLMULTI;
-			goto too_many_multis;
+		is->is_if.if_flags |= IFF_ALLMULTI;
+		goto too_many_multis;
 		}
 	}
-
+#endif /* MULTICAST */
 	/*
 	 * Set board online.
 	 * Hang receive buffer and start any pending



CVS commit: src/sys/dev/qbus

2019-05-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 08:27:44 UTC 2019

Modified Files:
src/sys/dev/qbus: if_il.c

Log Message:
 Revert previous.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/qbus/if_il.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/qbus

2019-05-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 08:22:05 UTC 2019

Modified Files:
src/sys/dev/qbus: if_il.c

Log Message:
 Make it compilable. Not tested.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/qbus/if_il.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/qbus

2019-05-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 08:22:05 UTC 2019

Modified Files:
src/sys/dev/qbus: if_il.c

Log Message:
 Make it compilable. Not tested.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/qbus/if_il.c

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/if_il.c
diff -u src/sys/dev/qbus/if_il.c:1.31 src/sys/dev/qbus/if_il.c:1.32
--- src/sys/dev/qbus/if_il.c:1.31	Thu May 23 13:10:52 2019
+++ src/sys/dev/qbus/if_il.c	Fri May 24 08:22:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_il.c,v 1.31 2019/05/23 13:10:52 msaitoh Exp $	*/
+/*	$NetBSD: if_il.c,v 1.32 2019/05/24 08:22:05 msaitoh Exp $	*/
 /*
  * Copyright (c) 1982, 1986 Regents of the University of California.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.31 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.32 2019/05/24 08:22:05 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -202,7 +202,7 @@ ilattach(device_t parent, device_t self,
 
 	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_softc = sc;
-	ifp->if_flags = IFF_BROADCAST;
+	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_init = ilinit;
 	ifp->if_stop = ilstop;
 	ifp->if_ioctl = ether_ioctl;
@@ -325,19 +325,20 @@ ilinit(struct ifnet *ifp)
 			goto out;
 		}
 	}
-#ifdef MULTICAST
-	if (is->is_if.if_flags & IFF_PROMISC) {
+
+	if (sc->sc_if.if_flags & IFF_PROMISC) {
 		addr->il_csr = ILC_PRMSC;
 		if (ilwait(ui, "all multi"))
 			goto out;
-	} else if (is->is_if.if_flags & IFF_ALLMULTI) {
-	too_many_multis:
+	} else if (sc->sc_if.if_flags & IFF_ALLMULTI) {
+too_many_multis:
 		addr->il_csr = ILC_ALLMC;
 		if (ilwait(ui, "all multi"))
 			goto out;
 	} else {
 		int i;
-		register struct ether_addr *ep = is->is_maddrs;
+		struct ethercom *ec = >sc_ec;
+		register struct ether_addr *ep = sc->sc_maddrs;
 		struct ether_multi *enm;
 		struct ether_multistep step;
 		/*
@@ -347,7 +348,8 @@ ilinit(struct ifnet *ifp)
 		 * multicasts.
 		 */
 		i = 0;
-		ETHER_FIRST_MULTI(step, >is_ac, enm);
+		ETHER_LOCK(ec);
+		ETHER_FIRST_MULTI(step, ec, enm);
 		while (enm != NULL) {
 			if (++i > 63 && k != 0) {
 break;
@@ -355,21 +357,22 @@ ilinit(struct ifnet *ifp)
 			*ep++ = *(struct ether_addr *)enm->enm_addrlo;
 			ETHER_NEXT_MULTI(step, enm);
 		}
+		ETHER_UNLOCK(ec);
 		if (i = 0) {
 			/* no multicasts! */
 		} else if (i <= 63) {
-			addr->il_bar = is->is_ubaddr & 0x;
+			addr->il_bar = sc->sc_ubaddr & 0x;
 			addr->il_bcr = i * sizeof (struct ether_addr);
-			addr->il_csr = ((is->is_ubaddr >> 2) & IL_EUA)|
+			addr->il_csr = ((sc->sc_ubaddr >> 2) & IL_EUA) |
 		LC_LDGRPS;
 			if (ilwait(ui, "load multi"))
 goto out;
 		} else {
-		is->is_if.if_flags |= IFF_ALLMULTI;
-		goto too_many_multis;
+			sc->sc_if.if_flags |= IFF_ALLMULTI;
+			goto too_many_multis;
 		}
 	}
-#endif /* MULTICAST */
+
 	/*
 	 * Set board online.
 	 * Hang receive buffer and start any pending



CVS commit: src/sys/dev/qbus

2010-02-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Feb  2 14:58:46 UTC 2010

Modified Files:
src/sys/dev/qbus: if_il.c

Log Message:
Fix incomplete line (deleto?), found by cppcheck and reported by
Henning Petersen in PR 42719.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/qbus/if_il.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.