CVS commit: src/sys/arch/atari/vme

2017-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  1 14:33:10 UTC 2017

Modified Files:
src/sys/arch/atari/vme: leo.c

Log Message:
PR/51933: David Binderman: Boolean confusion


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/atari/vme/leo.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/arch/atari/vme/leo.c
diff -u src/sys/arch/atari/vme/leo.c:1.21 src/sys/arch/atari/vme/leo.c:1.22
--- src/sys/arch/atari/vme/leo.c:1.21	Fri Jul 25 04:10:32 2014
+++ src/sys/arch/atari/vme/leo.c	Wed Feb  1 09:33:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: leo.c,v 1.21 2014/07/25 08:10:32 dholland Exp $	*/
+/*	$NetBSD: leo.c,v 1.22 2017/02/01 14:33:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 maximum entropy 
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: leo.c,v 1.21 2014/07/25 08:10:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: leo.c,v 1.22 2017/02/01 14:33:10 christos Exp $");
 
 #include 
 #include 
@@ -333,9 +333,9 @@ leo_scroll(struct leo_softc *sc, int scr
 	if ((scroll < 0) || (scroll > 255))
 		return EINVAL;
 bus_space_write_1(sc->sc_iot, sc->sc_ioh, LEO_REG_MSBSCROLL,
-			  (scroll >> 6) && 0xff);
+			  (scroll >> 6) & 0xff);
 bus_space_write_1(sc->sc_iot, sc->sc_ioh, LEO_REG_LSBSCROLL,
-			  (scroll << 2) && 0xff);
+			  (scroll << 2) & 0xff);
 	return 0;
 }
 



CVS commit: src/sys/arch/atari/vme

2011-06-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jun 10 09:29:07 UTC 2011

Modified Files:
src/sys/arch/atari/vme: leo.c

Log Message:
- split device_t/softc
- struct proc - struct lwp

XXX: this driver is not in the default kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/atari/vme/leo.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/arch/atari/vme/leo.c
diff -u src/sys/arch/atari/vme/leo.c:1.17 src/sys/arch/atari/vme/leo.c:1.18
--- src/sys/arch/atari/vme/leo.c:1.17	Tue Apr 13 09:51:07 2010
+++ src/sys/arch/atari/vme/leo.c	Fri Jun 10 09:29:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: leo.c,v 1.17 2010/04/13 09:51:07 tsutsui Exp $	*/
+/*	$NetBSD: leo.c,v 1.18 2011/06/10 09:29:07 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 maximum entropy entr...@zippy.bernstein.com
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: leo.c,v 1.17 2010/04/13 09:51:07 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: leo.c,v 1.18 2011/06/10 09:29:07 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,7 +78,7 @@
 #define NLEOSTD (sizeof(leostd) / sizeof(leostd[0]))
 
 struct leo_softc {
-	struct device sc_dev;		/* XXX what goes here? */
+	device_t sc_dev;		/* XXX what goes here? */
 	bus_space_tag_t sc_iot;
 	bus_space_tag_t sc_memt;
 	bus_space_handle_t sc_ioh;
@@ -90,15 +90,15 @@
 
 #define LEO_SC_FLAGS_INUSE 1
 
-static int leo_match(struct device *, struct cfdata *, void *);
-static void leo_attach(struct device *, struct device *, void *);
+static int leo_match(device_t, cfdata_t, void *);
+static void leo_attach(device_t, device_t, void *);
 static int leo_probe(bus_space_tag_t *, bus_space_tag_t *,
 			  bus_space_handle_t *, bus_space_handle_t *,
 			  u_int, u_int);
 static int leo_init(struct leo_softc *, int);
 static int leo_scroll(struct leo_softc *, int);
 
-CFATTACH_DECL(leo, sizeof(struct leo_softc),
+CFATTACH_DECL_NEW(leo, sizeof(struct leo_softc),
 leo_match, leo_attach, NULL, NULL);
 
 dev_type_open(leoopen);
@@ -113,7 +113,7 @@
 };
 
 static int
-leo_match(struct device *parent, struct cfdata *cfp, void *aux)
+leo_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct vme_attach_args *va = aux;
 	int i;
@@ -205,9 +205,9 @@
 }
 
 static void
-leo_attach(struct device *parent, struct device *self, void *aux)
+leo_attach(device_t parent, device_t self, void *aux)
 {
-	struct leo_softc *sc = (struct leo_softc *)self;
+	struct leo_softc *sc = device_private(self);
 	struct vme_attach_args *va = aux;
 	bus_space_handle_t ioh;
 	bus_space_handle_t memh;
@@ -215,6 +215,8 @@
 	int i;
 #endif
 
+	sc-sc_dev = self;
+
 	printf(\n);
 	if (bus_space_map(va-va_iot, va-va_iobase, va-va_iosize, 0, ioh))
 		panic(leo_attach: cannot map io area);
@@ -239,7 +241,7 @@
 }
 
 int
-leoopen(dev_t dev, int flags, int devtype, struct proc *p)
+leoopen(dev_t dev, int flags, int devtype, struct lwp *l)
 {
 	struct leo_softc *sc;
 	int r;
@@ -328,7 +330,7 @@
 }
 
 int
-leoclose(dev_t dev, int flags, int devtype, struct proc *p)
+leoclose(dev_t dev, int flags, int devtype, struct lwp *l)
 {
 	struct leo_softc *sc;
 
@@ -372,7 +374,7 @@
 }
 
 int
-leoioctl(dev_t dev, u_long cmd, void *data, int flags, struct proc *p)
+leoioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
 {
 	struct leo_softc *sc;
 



CVS commit: src/sys/arch/atari/vme

2010-03-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Mar 16 17:56:41 UTC 2010

Modified Files:
src/sys/arch/atari/vme: if_le_vme.c

Log Message:
Fix register and memory addresses for PAM, per MintNet driver.

XXX: In le_vme_match(), probably we should not return even if
XXX: bus_space_map(9) fails unless all le_addresses have been checked.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/atari/vme/if_le_vme.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/arch/atari/vme/if_le_vme.c
diff -u src/sys/arch/atari/vme/if_le_vme.c:1.28 src/sys/arch/atari/vme/if_le_vme.c:1.29
--- src/sys/arch/atari/vme/if_le_vme.c:1.28	Tue Jan 19 22:06:19 2010
+++ src/sys/arch/atari/vme/if_le_vme.c	Tue Mar 16 17:56:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le_vme.c,v 1.28 2010/01/19 22:06:19 pooka Exp $	*/
+/*	$NetBSD: if_le_vme.c,v 1.29 2010/03/16 17:56:41 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 maximum entropy.  All rights reserved.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_le_vme.c,v 1.28 2010/01/19 22:06:19 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_le_vme.c,v 1.29 2010/03/16 17:56:41 tsutsui Exp $);
 
 #include opt_inet.h
 
@@ -124,7 +124,7 @@
 } lestd[] = {
 	{ 0xfe00fff0, 0xfe01, IRQUNK, 16, 64*1024,
 LE_OLD_RIEBL|LE_NEW_RIEBL }, /* Riebl	*/
-	{ 0xffc0, 0xffcf,  5, 16, 64*1024,
+	{ 0xfec0, 0xfecf,  5, 16, 64*1024,
 LE_PAM },		 /* PAM	*/
 	{ 0xfec0, 0xfecf,  5, 16, 64*1024,
 LE_ROTHRON },		 /* Rhotron	*/



CVS commit: src/sys/arch/atari/vme

2010-03-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Mar 16 17:58:57 UTC 2010

Modified Files:
src/sys/arch/atari/vme: if_levar.h

Log Message:
Renumber board type for LE_PAM.
We can't use 0x00 if we also use the value as bitmap.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/atari/vme/if_levar.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/arch/atari/vme/if_levar.h
diff -u src/sys/arch/atari/vme/if_levar.h:1.6 src/sys/arch/atari/vme/if_levar.h:1.7
--- src/sys/arch/atari/vme/if_levar.h:1.6	Mon Apr 28 20:23:15 2008
+++ src/sys/arch/atari/vme/if_levar.h	Tue Mar 16 17:58:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_levar.h,v 1.6 2008/04/28 20:23:15 martin Exp $	*/
+/*	$NetBSD: if_levar.h,v 1.7 2010/03/16 17:58:57 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -64,11 +64,11 @@
 /*
  * Board Type:
  */
-#define	LE_PAM		0x00
 #define	LE_OLD_RIEBL	0x01
 #define	LE_NEW_RIEBL	0x02
 #define	LE_BVME410	0x04
 #define	LE_ROTHRON	0x08
+#define	LE_PAM		0x10
 
 /*
  * Determine type of RIEBL card by magic



CVS commit: src/sys/arch/atari/vme

2010-03-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Mar 16 18:50:15 UTC 2010

Modified Files:
src/sys/arch/atari/vme: if_we_vme.c

Log Message:
Check if mapped bus_space regions are actually valid
before trying to access them.

Fixes trap panic when SMC_TT board is not installed. (oops)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/atari/vme/if_we_vme.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/arch/atari/vme/if_we_vme.c
diff -u src/sys/arch/atari/vme/if_we_vme.c:1.1 src/sys/arch/atari/vme/if_we_vme.c:1.2
--- src/sys/arch/atari/vme/if_we_vme.c:1.1	Sat Mar 13 16:30:03 2010
+++ src/sys/arch/atari/vme/if_we_vme.c	Tue Mar 16 18:50:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_we_vme.c,v 1.1 2010/03/13 16:30:03 tsutsui Exp $	*/
+/*	$NetBSD: if_we_vme.c,v 1.2 2010/03/16 18:50:14 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2010 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_we_vme.c,v 1.1 2010/03/13 16:30:03 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_we_vme.c,v 1.2 2010/03/16 18:50:14 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -110,6 +110,8 @@
 bus_size_t);
 static voidsmctt_bus_space_write_1(bus_space_tag_t, bus_space_handle_t,
 bus_size_t, uint8_t);
+static int smctt_bus_space_peek_1(bus_space_tag_t, bus_space_handle_t,
+bus_size_t);
 
 struct we_vme_softc {
 	struct we_softc	sc_we;
@@ -155,6 +157,7 @@
 	/* XXX setup only simple byte functions used in MI we(4) driver */
 	asict-abs_r_1 = smctt_bus_space_read_1;
 	asict-abs_w_1 = smctt_bus_space_write_1;
+	asict-abs_p_1 = smctt_bus_space_peek_1;
 
 	/*
 	 * Only 16 bit accesses are allowed for memory space on SMC_TT,
@@ -182,6 +185,11 @@
 	(vaddr_t)bus_space_vaddr(asict, asich1) -
 	(vaddr_t)bus_space_vaddr(asict, asich);
 
+	/* check if register regions are valid */
+	if (bus_space_peek_1(asict, asich, WE_PROM + 0) == 0 ||
+	bus_space_peek_1(asict, asich, WE_PROM + 1) == 0)
+		goto out;
+
 	/*
 	 * Attempt to do a checksum over the station address PROM.
 	 * If it fails, it's probably not an SMC_TT board.
@@ -248,6 +256,10 @@
 	}
 	memh_valid = true;
 
+	/* check if memory region is valid */
+	if (bus_space_peek_2(memt, memh, 0) == 0)
+		goto out;
+
 	/*
 	 * Check the assigned interrupt number from the card.
 	 */
@@ -421,3 +433,20 @@
 		*(volatile uint8_t *)(bh + reg) = val;
 	}
 }
+
+static int
+smctt_bus_space_peek_1(bus_space_tag_t bt, bus_space_handle_t bh,
+bus_size_t reg)
+{
+	uint8_t *va;
+
+	if ((reg  0x01) != 0) {
+		/* odd address space */
+		va = (uint8_t *)(bh + bt-stride + (reg  ~0x01));
+	} else {
+		/* even address space */
+		va = (uint8_t *)(bh + reg);
+	}
+
+	return !badbaddr(va, sizeof(uint8_t));
+}