CVS commit: src/sys/arch/sparc/dev

2021-06-10 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Jun 11 04:58:30 UTC 2021

Modified Files:
src/sys/arch/sparc/dev: ts102.c

Log Message:
During slot enable and disable, make sure that the card Access and VCC
controls are enabled and disabled at the same time.
Also remove the software reset during slot enable (we are already in
reset because of the earlier Access and VCC changes).
While here, convert DELAY() to delay() and tsleep(), like nell(4).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/dev/ts102.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/sparc/dev/ts102.c
diff -u src/sys/arch/sparc/dev/ts102.c:1.19 src/sys/arch/sparc/dev/ts102.c:1.20
--- src/sys/arch/sparc/dev/ts102.c:1.19	Sat Apr 24 23:36:49 2021
+++ src/sys/arch/sparc/dev/ts102.c	Fri Jun 11 04:58:30 2021
@@ -1,5 +1,5 @@
 /*	$OpenBSD: ts102.c,v 1.14 2005/01/27 17:03:23 millert Exp $	*/
-/*	$NetBSD: ts102.c,v 1.19 2021/04/24 23:36:49 thorpej Exp $ */
+/*	$NetBSD: ts102.c,v 1.20 2021/06/11 04:58:30 jdc Exp $ */
 /*
  * Copyright (c) 2003, 2004, Miodrag Vallat.
  * Copyright (c) 2005, Michael Lorenz.
@@ -182,6 +182,7 @@ static void tslot_slot_intr(struct tslot
 static void tslot_slot_settype(pcmcia_chipset_handle_t, int);
 static void tslot_update_lcd(struct tslot_softc *, int, int);
 static void tslot_intr_dispatch(void *arg);
+void tslot_delay(struct tslot_softc *sc, unsigned int ms);
 
 CFATTACH_DECL_NEW(tslot, sizeof(struct tslot_softc),
 tslot_match, tslot_attach, NULL, NULL);
@@ -620,22 +621,35 @@ static void
 tslot_slot_disable(pcmcia_chipset_handle_t pch)
 {
 	struct tslot_data *td = (struct tslot_data *)pch;
+	int status;
+
 #ifdef TSLOT_DEBUG
 	printf("%s: disable slot %d\n",
 	device_xname(td->td_parent->sc_dev), td->td_slot);
 #endif
 
-	/*
-	 * Disable card access.
-	 */
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS,
-	TSLOT_READ(td, TS102_REG_CARD_A_STS) & ~TS102_CARD_STS_ACEN);
+	status = TSLOT_READ(td, TS102_REG_CARD_A_STS);
+
+	status &= ~TS102_CARD_STS_ACEN;
 
 	/*
 	 * Disable interrupts, except for insertion.
 	 */
 	TSLOT_WRITE(td, TS102_REG_CARD_A_INT,
 	TS102_CARD_INT_MASK_CARDDETECT_STATUS);
+
+	/*
+	 * Power down the socket and disable access
+	 */
+	status &= ~TS102_CARD_STS_ACEN;
+	status &= ~(TS102_CARD_STS_VPP1_MASK | TS102_CARD_STS_VPP2_MASK);
+	status |= TS102_CARD_STS_VCCEN;
+	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
+	
+	/*
+	 * wait 300ms until power fails (Tpf).
+	 */
+	tslot_delay(td->td_parent, 300);
 }
 
 static void
@@ -652,18 +666,23 @@ tslot_slot_enable(pcmcia_chipset_handle_
 	/* Power down the socket to reset it */
 	status = TSLOT_READ(td, TS102_REG_CARD_A_STS);
 	TSPRINTF("status: %x\n", status);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status | TS102_CARD_STS_VCCEN);
+
+	status &= ~TS102_CARD_STS_ACEN;
+	status &= ~(TS102_CARD_STS_VPP1_MASK | TS102_CARD_STS_VPP2_MASK);
+	status |= TS102_CARD_STS_VCCEN;
+	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
 
 	/*
 	 * wait 300ms until power fails (Tpf).  Then, wait 100ms since we
 	 * are changing Vcc (Toff).
 	 */
-	DELAY((300 + 100) * 1000);
+	tslot_delay(td->td_parent, 300 + 100);
 
 	/*
 	 * Power on the card if not already done, and enable card access
 	 */
 	status |= TS102_CARD_STS_ACEN;
+	status |= TS102_CARD_STS_VPP1_VCC;
 	status &= ~TS102_CARD_STS_VCCEN;
 	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
 
@@ -671,22 +690,18 @@ tslot_slot_enable(pcmcia_chipset_handle_
 	 * wait 100ms until power raise (Tpr) and 20ms to become
 	 * stable (Tsu(Vcc)).
 	 */
-	DELAY((100 + 20) * 1000);
-
-	status &= ~TS102_CARD_STS_VPP1_MASK;
-	status |= TS102_CARD_STS_VPP1_VCC;
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
+	tslot_delay(td->td_parent, 100 + 20);
 
 	/*
 	 * hold RESET at least 20us.
 	 */
 	intr = TSLOT_READ(td, TS102_REG_CARD_A_INT);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_INT, TS102_CARD_INT_SOFT_RESET);
-	DELAY(20);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_INT, intr);
+	delay(20);
+	TSLOT_WRITE(td, TS102_REG_CARD_A_INT,
+	intr & ~TS102_CARD_INT_SOFT_RESET);
 
 	/* wait 20ms as per pc card standard (r2.01) section 4.3.6 */
-	DELAY(20 * 1000);
+	tslot_delay(td->td_parent, 20);
 
 	/* We need level-triggered interrupts for PC Card hardware */
 	TSLOT_WRITE(td, TS102_REG_CARD_A_STS,
@@ -709,7 +724,7 @@ tslot_slot_enable(pcmcia_chipset_handle_
 		if (status & TS102_CARD_STS_RDY)
 			break;
 		else
-			DELAY(100);
+			delay(100);
 	}
 
 	if (i == 0) {
@@ -1020,3 +1035,24 @@ tslot_update_lcd(struct tslot_softc *sc,
 	}
 #endif
 }
+
+/*
+ * Delay and possibly yield CPU.
+ * XXX - assumes a context
+ */
+void
+tslot_delay(struct tslot_softc *sc, unsigned int ms)
+{
+	unsigned int ticks = mstohz(ms);
+
+	if (cold || ticks == 0) {
+		delay(ms);
+		return;
+	}
+
+#ifdef DIAGNOSTIC
+	if (ticks > 60*hz)
+		panic("tslot: preposterous delay: %u", ticks);
+#endif
+	tsleep(sc, 0, "tslotdel", ticks);

CVS commit: src/sys/arch/sparc/dev

2021-01-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  4 15:29:34 UTC 2021

Modified Files:
src/sys/arch/sparc/dev: tctrl.c

Log Message:
Use sel{record,remove}_knote().


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sparc/dev/tctrl.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/sparc/dev/tctrl.c
diff -u src/sys/arch/sparc/dev/tctrl.c:1.62 src/sys/arch/sparc/dev/tctrl.c:1.63
--- src/sys/arch/sparc/dev/tctrl.c:1.62	Sat Jun 13 05:31:28 2020
+++ src/sys/arch/sparc/dev/tctrl.c	Mon Jan  4 15:29:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $	*/
+/*	$NetBSD: tctrl.c,v 1.63 2021/01/04 15:29:34 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.63 2021/01/04 15:29:34 thorpej Exp $");
 
 #include 
 #include 
@@ -1218,7 +1218,7 @@ filt_tctrlrdetach(struct knote *kn)
 	int s;
 
 	s = splts102();
-	SLIST_REMOVE(>sc_rsel.sel_klist, kn, knote, kn_selnext);
+	selremove_knote(>sc_rsel, kn);
 	splx(s);
 }
 
@@ -1243,12 +1243,10 @@ tctrlkqfilter(dev_t dev, struct knote *k
 {
 	struct tctrl_softc *sc = device_lookup_private(_cd,
 		   TCTRL_STD_DEV);
-	struct klist *klist;
 	int s;
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		klist = >sc_rsel.sel_klist;
 		kn->kn_fop = _filtops;
 		break;
 
@@ -1259,7 +1257,7 @@ tctrlkqfilter(dev_t dev, struct knote *k
 	kn->kn_hook = sc;
 
 	s = splts102();
-	SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+	selrecord_knote(>sc_rsel, kn);
 	splx(s);
 
 	return (0);



CVS commit: src/sys/arch/sparc/dev

2020-06-12 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Jun 13 05:31:29 UTC 2020

Modified Files:
src/sys/arch/sparc/dev: tctrl.c

Log Message:
Initialise the mutex before we use it.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sparc/dev/tctrl.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/sparc/dev/tctrl.c
diff -u src/sys/arch/sparc/dev/tctrl.c:1.61 src/sys/arch/sparc/dev/tctrl.c:1.62
--- src/sys/arch/sparc/dev/tctrl.c:1.61	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/sparc/dev/tctrl.c	Sat Jun 13 05:31:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tctrl.c,v 1.61 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.61 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $");
 
 #include 
 #include 
@@ -260,6 +260,8 @@ tctrl_attach(device_t parent, device_t s
 
 	sc->sc_tft_on = 1;
 
+	mutex_init(>sc_requestlock, MUTEX_DEFAULT, IPL_NONE);
+
 	/* clear any pending data.
 	 */
 	for (i = 0; i < 1; i++) {
@@ -312,7 +314,6 @@ tctrl_attach(device_t parent, device_t s
 	sc->sc_ext_pending = 0;
 		sc->sc_ext_pending = 0;
 
-	mutex_init(>sc_requestlock, MUTEX_DEFAULT, IPL_NONE);
 	selinit(>sc_rsel);
 
 	/* setup sensors and register the power button */



CVS commit: src/sys/arch/sparc/dev

2020-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan  2 22:32:20 UTC 2020

Modified Files:
src/sys/arch/sparc/dev: rtc.c

Log Message:
- Use todr_gettime_ymdhms / todr_settime_ymdhms.
- Allocate the todr_handle with the softc, not separately.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/dev/rtc.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/sparc/dev/rtc.c
diff -u src/sys/arch/sparc/dev/rtc.c:1.19 src/sys/arch/sparc/dev/rtc.c:1.20
--- src/sys/arch/sparc/dev/rtc.c:1.19	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sparc/dev/rtc.c	Thu Jan  2 22:32:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtc.c,v 1.19 2019/11/10 21:16:32 chs Exp $ */
+/*	$NetBSD: rtc.c,v 1.20 2020/01/02 22:32:20 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001 Valeriy E. Ushakov
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.20 2020/01/02 22:32:20 thorpej Exp $");
 
 #include 
 #include 
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19
 struct rtc_ebus_softc {
 	bus_space_tag_t		sc_bt;	/* parent bus tag */
 	bus_space_handle_t	sc_bh;	/* handle for registers */
+	struct todr_chip_handle	sc_todr;/* TODR handle */
 };
 
 static int	rtcmatch_ebus(device_t, cfdata_t, void *);
@@ -65,16 +66,12 @@ static void	rtcattach_ebus(device_t, dev
 CFATTACH_DECL_NEW(rtc_ebus, sizeof(struct rtc_ebus_softc),
 rtcmatch_ebus, rtcattach_ebus, NULL, NULL);
 
-/* XXX: global TOD clock handle (sparc/clock.c) */
-extern todr_chip_handle_t todr_handle;
-
 /* todr(9) methods */
-static int rtc_gettime(todr_chip_handle_t, struct timeval *);
-static int rtc_settime(todr_chip_handle_t, struct timeval *);
+static int rtc_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+static int rtc_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
 
 int rtc_auto_century_adjust = 1; /* XXX: do we ever want not to? */
 
-
 /*
  * MD read/write functions declared in mc146818reg.h
  */
@@ -134,27 +131,23 @@ rtcattach_ebus(device_t parent, device_t
 	mc146818_write(sc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
 
 	/* setup our todr_handle */
-	handle = malloc(ALIGN(sizeof(struct todr_chip_handle)),
-			M_DEVBUF, M_WAITOK);
+	handle = >sc_todr;
 	handle->cookie = sc;
 	handle->bus_cookie = NULL; /* unused */
-	handle->todr_gettime = rtc_gettime;
-	handle->todr_settime = rtc_settime;
+	handle->todr_gettime = NULL;
+	handle->todr_settime = NULL;
+	handle->todr_gettime_ymdhms = rtc_gettime_ymdhms;
+	handle->todr_settime_ymdhms = rtc_settime_ymdhms;
 	handle->todr_setwen = NULL; /* not necessary, no idprom to protect */
 
 	todr_attach(handle);
 }
 
 
-/*
- * Get time-of-day and convert to a `struct timeval'
- * Return 0 on success; an error number otherwise.
- */
 static int
-rtc_gettime(todr_chip_handle_t handle, struct timeval *tv)
+rtc_gettime_ymdhms(todr_chip_handle_t handle, struct clock_ymdhms *dt)
 {
 	struct rtc_ebus_softc *sc = handle->cookie;
-	struct clock_ymdhms dt;
 	u_int year;
 
 	/* update in progress; spin loop */
@@ -166,12 +159,12 @@ rtc_gettime(todr_chip_handle_t handle, s
 		   (mc146818_read(sc, MC_REGB) | MC_REGB_SET));
 
 	/* read time */
-	dt.dt_sec  = mc146818_read(sc, MC_SEC);
-	dt.dt_min  = mc146818_read(sc, MC_MIN);
-	dt.dt_hour = mc146818_read(sc, MC_HOUR);
-	dt.dt_day  = mc146818_read(sc, MC_DOM);
-	dt.dt_mon  = mc146818_read(sc, MC_MONTH);
-	year   = mc146818_read(sc, MC_YEAR);
+	dt->dt_sec  = mc146818_read(sc, MC_SEC);
+	dt->dt_min  = mc146818_read(sc, MC_MIN);
+	dt->dt_hour = mc146818_read(sc, MC_HOUR);
+	dt->dt_day  = mc146818_read(sc, MC_DOM);
+	dt->dt_mon  = mc146818_read(sc, MC_MONTH);
+	year= mc146818_read(sc, MC_YEAR);
 
 	/* reenable updates */
 	mc146818_write(sc, MC_REGB,
@@ -181,32 +174,18 @@ rtc_gettime(todr_chip_handle_t handle, s
 	year += 1900;
 	if (year < POSIX_BASE_YEAR && rtc_auto_century_adjust != 0)
 		year += 100;
-	dt.dt_year = year;
+	dt->dt_year = year;
 
-	/* simple sanity checks */
-	if (dt.dt_mon > 12 || dt.dt_day > 31
-	|| dt.dt_hour >= 24 || dt.dt_min >= 60 || dt.dt_sec >= 60)
-		return (ERANGE);
-
-	tv->tv_sec = clock_ymdhms_to_secs();
-	tv->tv_usec = 0;
 	return (0);
 }
 
-/*
- * Set the time-of-day clock based on the value of the `struct timeval' arg.
- * Return 0 on success; an error number otherwise.
- */
 static int
-rtc_settime(todr_chip_handle_t handle, struct timeval *tv)
+rtc_settime_ymdhms(todr_chip_handle_t handle, struct clock_ymdhms *dt)
 {
 	struct rtc_ebus_softc *sc = handle->cookie;
-	struct clock_ymdhms dt;
 	u_int year;
 
-	clock_secs_to_ymdhms(tv->tv_sec, );
-
-	year = dt.dt_year - 1900;
+	year = dt->dt_year - 1900;
 	if (year >= 100 && rtc_auto_century_adjust != 0)
 		year -= 100;
 
@@ -214,12 +193,12 @@ rtc_settime(todr_chip_handle_t handle, s
 	mc146818_write(sc, MC_REGB,
 		   (mc146818_read(sc, 

CVS commit: src/sys/arch/sparc/dev

2019-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  1 02:30:42 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: sx.c sxvar.h

Log Message:
adapt to changes in sxreg.h


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc/dev/sx.c \
src/sys/arch/sparc/dev/sxvar.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/sparc/dev/sx.c
diff -u src/sys/arch/sparc/dev/sx.c:1.3 src/sys/arch/sparc/dev/sx.c:1.4
--- src/sys/arch/sparc/dev/sx.c:1.3	Tue Apr 15 10:24:54 2014
+++ src/sys/arch/sparc/dev/sx.c	Fri Mar  1 02:30:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $	*/
+/*	$NetBSD: sx.c,v 1.4 2019/03/01 02:30:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.4 2019/03/01 02:30:42 macallan Exp $");
 
 #include "locators.h"
 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.3 2
 #include 
 #include 
 #include 
+#include "opt_sx.h"
 
 /* autoconfiguration driver */
 static	int sx_match(device_t, struct cfdata *, void *);
@@ -57,6 +58,8 @@ static	void sx_attach(device_t, device_t
 CFATTACH_DECL_NEW(sx, sizeof(struct sx_softc),
 sx_match, sx_attach, NULL, NULL);
 
+static struct sx_softc *sx0 = NULL;
+
 static int
 sx_match(device_t parent, struct cfdata *cf, void *aux)
 {
@@ -90,7 +93,7 @@ sx_attach(device_t parent, device_t self
 	id = sx_read(sc, SX_ID);
 	aprint_normal_dev(self, "architecture rev. %d chip rev. %d\n",
 	(id & SX_ARCHITECTURE_MASK),
-	(id & SX_CHIP_REVISION) >> 8);
+	(id & SX_CHIP_REVISION) >> 3);
 
 	/* stop the processor */
 	sx_write(sc, SX_CONTROL_STATUS, 0);
@@ -114,6 +117,8 @@ sx_attach(device_t parent, device_t self
 	/* ... and start the processor again */
 	sx_write(sc, SX_CONTROL_STATUS, SX_PB | SX_GO);
 
+	sx0 = sc;
+
 #ifdef SX_DEBUG
 	sta(0xfc00, ASI_SX, SX_LD(8, 31, 0));
 	for (i = 1; i < 60; i++)
@@ -143,3 +148,15 @@ sx_attach(device_t parent, device_t self
 #endif
 }
 
+void
+sx_dump(void)
+{
+	if (sx0 == NULL)
+		return;
+	printf("SX STATUS: %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_CONTROL_STATUS));
+	printf("SX ERROR : %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_ERROR));
+	printf("SX DIAG  : %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_DIAGNOSTICS));
+}
Index: src/sys/arch/sparc/dev/sxvar.h
diff -u src/sys/arch/sparc/dev/sxvar.h:1.3 src/sys/arch/sparc/dev/sxvar.h:1.4
--- src/sys/arch/sparc/dev/sxvar.h:1.3	Sun Jun 29 03:57:10 2014
+++ src/sys/arch/sparc/dev/sxvar.h	Fri Mar  1 02:30:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxvar.h,v 1.3 2014/06/29 03:57:10 tsutsui Exp $	*/
+/*	$NetBSD: sxvar.h,v 1.4 2019/03/01 02:30:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,4 +51,6 @@ sx_read(struct sx_softc *sc, int addr)
 	return bus_space_read_4(sc->sc_tag, sc->sc_regh, addr);
 }
 
+void sx_dump(void);
+
 #endif



CVS commit: src/sys/arch/sparc/dev

2019-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 22 23:01:25 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
some register bits are defined differently by SunOS's sxreg.h and the SPAM
manual, upon investigation the hardware appears to agree with the SunOS header,
so adapt accordingly


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.16 src/sys/arch/sparc/dev/sxreg.h:1.17
--- src/sys/arch/sparc/dev/sxreg.h:1.16	Fri Dec  8 22:28:54 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Fri Feb 22 23:01:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.16 2017/12/08 22:28:54 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.17 2019/02/22 23:01:25 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -47,6 +47,8 @@
 #define SX_ID			0x0028
 #define SX_R0_INIT		0x002c
 #define SX_SOFTRESET		0x0030
+#define SX_SYNC			0x0034	/* write will stall CPU until */
+		/* SX is idle		  */
 /* write registers directly, only when processor is stopped */
 #define SX_DIRECT_R0		0x0100
 #define SX_DIRECT_R1		0x0104	/* and so on until R127 */
@@ -73,10 +75,39 @@
 #define SX_EE5		0x0010	/* alignment violation */
 #define SX_EE6		0x0020	/* illegal instruction queue write */
 #define SX_EI		0x0080	/* interrupt on error */
+/*
+ * XXX
+ * the following bit definitions are from the SX manual. They're defined in a
+ * different way in SunOS's sxreg.h, the hardware seems to follow the latter.
+ */
+#if 0
 #define SX_PB		0x1000	/* enable page bound checking */
 #define SX_WO		0x2000	/* write occured ( by SX ) */
 #define SX_GO		0x4000	/* start/stop the processor */
 #define SX_MT		0x8000	/* instruction queue is empty */
+#endif
+
+#define SX_PB		0x0400	/* enable page bound checking */
+#define SX_WO		0x0800	/* write occured ( by SX ) */
+#define SX_GO		0x1000	/* start/stop the processor */
+#define SX_JB		0x2000	/* Jammed/Busy specifies the type of events */
+	/* which increment the SX timer */
+#define SX_MT		0x4000	/* instruction queue is empty */
+#define SX_BZ		0x8000	/* Busy bit. When set it indicates that SX */
+	/* is processing an instruction or an */
+	/* instruction is pending in the Q  */
+#define SX_B0MOD	0x0001	/* When set by SX it indicates that a write */
+	/* to bank zero of the SX registers (0-31) */
+	/* occured */
+#define SX_B1MOD	0x0002	/* When set by SX it indicates that a write */
+	/* to bank 1 of the SX registers (32-63) */
+	/* occured */
+#define SX_B2MOD	0x0004	/* When set by SX it indicates that a write */
+	/* to bank 2 of the SX registers (64-95) */
+	/* occured */
+#define SX_B3MOD	0x0008	/* When set by SX it indicates that a write */
+	/* to bank 3 of the SX registers (96-127) */
+	/* occured */
 
 /* SX_ERROR */
 #define SX_SE1		0x0001	/* illegal instruction */
@@ -87,13 +118,29 @@
 #define SX_SE6		0x0020	/* illegal instruction queue write */
 #define SX_SI		0x0080	/* interrupt on error */
 
-/* SX_ID */
+/* SX_ID from the manual */
+#if 0
 #define SX_ARCHITECTURE_MASK	0x00ff
 #define SX_CHIP_REVISION	0xff00
+#endif
+
+#define SX_ARCHITECTURE_MASK	0x0003
+#define SX_CHIP_REVISION	0x00f8
 
 /* SX_DIAGNOSTICS */
 #define SX_IQ_FIFO_ACCESS	0x0001	/* allow memory instructions
 		 * in SX_INSTRUCTIONS */
+#define SX_SERIAL_INSTRUCTIONS	0x0002	/* force inst. serializing */
+#define SX_RAM_PAGE_CROSS	0x0004	/* indicates page crossing */
+#define SX_ARRAY_CONSTRAINING	0x0008	/* When set constrains VRAM */
+		/* array offset effective */
+		/* address calculation  */
+#define SX_UPG_MPG_DISABLE	0x0010	/* When set, disables page */
+		/* cross input into ld/st */
+		/* state machines */
+#define SX_DIAG_INIT		0x4804		/* Setting of the diag reg */
+		/* upon reset */
+
 
 /*
  * memory referencing instructions are written to 0x8 + PA



CVS commit: src/sys/arch/sparc/dev

2019-01-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 17 23:05:15 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
don't crash when we're not the console


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.86 src/sys/arch/sparc/dev/cgfourteen.c:1.87
--- src/sys/arch/sparc/dev/cgfourteen.c:1.86	Mon Sep  3 16:29:27 2018
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Jan 17 23:05:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.86 2018/09/03 16:29:27 riastradh Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.87 2019/01/17 23:05:15 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -284,7 +284,7 @@ cgfourteenattach(device_t parent, device
 	if (sbus_bus_map(sa->sa_bustag, sa->sa_slot,
 			 sa->sa_offset,
 			 sa->sa_size,
-			 0 /*BUS_SPACE_MAP_LINEAR*/,
+			 BUS_SPACE_MAP_LINEAR,
 			 ) != 0) {
 		printf("%s: cannot map control registers\n",
 		device_xname(self));
@@ -744,7 +744,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 	sc->sc_gc.gc_blitcookie = sc;
 	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
-	if (is_cons) {
+
 		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
 		);
 
@@ -770,21 +770,10 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 			ri->ri_font->fontwidth,
 			ri->ri_font->fontheight,
 			defattr);
+	if (is_cons) {
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
 		vcons_replay_msgbuf(>sc_console_screen);
-	} else {
-		/*
-		 * since we're not the console we can postpone the rest
-		 * until someone actually allocates a screen for us
-		 */
-		glyphcache_init(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
-			(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) -
-			 sc->sc_fb.fb_type.fb_height - 5,
-			sc->sc_fb.fb_type.fb_width,
-			ri->ri_font->fontwidth,
-			ri->ri_font->fontheight,
-			DEFATTR);
 	}
 
 	cg14_init_cmap(sc);



CVS commit: src/sys/arch/sparc/dev

2018-01-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 25 14:45:58 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
do boundary checks when writing cursor sprite colour registers


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.84 src/sys/arch/sparc/dev/cgfourteen.c:1.85
--- src/sys/arch/sparc/dev/cgfourteen.c:1.84	Fri Jan 12 23:38:24 2018
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Jan 25 14:45:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.84 2018/01/12 23:38:24 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.85 2018/01/25 14:45:58 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1120,7 +1120,11 @@ cg14_do_cursor(struct cgfourteen_softc *
 	if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
 		int i;
 		uint32_t val;
-	
+
+		if ((cur->cmap.index > 2) || (cur->cmap.count > 3) ||
+		(cur->cmap.index + cur->cmap.count > 3))
+			return EINVAL;
+
 		for (i = 0; i < min(cur->cmap.count, 3); i++) {
 			val = (cur->cmap.red[i] ) |
 			  (cur->cmap.green[i] << 8) |



CVS commit: src/sys/arch/sparc/dev

2018-01-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 12 23:38:24 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
enable font loading


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.83 src/sys/arch/sparc/dev/cgfourteen.c:1.84
--- src/sys/arch/sparc/dev/cgfourteen.c:1.83	Sat Jan  6 07:26:54 2018
+++ src/sys/arch/sparc/dev/cgfourteen.c	Fri Jan 12 23:38:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.83 2018/01/06 07:26:54 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.84 2018/01/12 23:38:24 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -724,7 +724,8 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 		0, 0,
 		NULL,
 		8, 16,
-		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE,
+		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
+		WSSCREEN_RESIZE,
 		NULL
 	};
 	cg14_set_depth(sc, 8);
@@ -734,6 +735,8 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 	vcons_init(>sc_vd, sc, >sc_defaultscreen_descr,
 	_accessops);
 	sc->sc_vd.init_screen = cg14_init_screen;
+	sc->sc_vd.show_screen_cookie = >sc_gc;
+	sc->sc_vd.show_screen_cb = glyphcache_adapt;
 
 	ri = >sc_console_screen.scr_ri;
 
@@ -1009,6 +1012,8 @@ cg14_init_screen(void *cookie, struct vc
 	ri->ri_flg = RI_CENTER | RI_FULLCLEAR;
 
 	ri->ri_bits = (char *)sc->sc_fb.fb_pixels;
+
+	scr->scr_flags |= VCONS_LOADFONT;
 #if NSX > 0
 	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA | RI_PREFER_ALPHA;
 
@@ -1020,14 +1025,15 @@ cg14_init_screen(void *cookie, struct vc
 		scr->scr_flags |= VCONS_NO_COPYCOLS;
 	} else
 #endif
-	scr->scr_flags |= VCONS_DONT_READ;
+		scr->scr_flags |= VCONS_DONT_READ;
 
 	if (existing) {
 		ri->ri_flg |= RI_CLEAR;
 	}
 
 	rasops_init(ri, 0, 0);
-	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE;
+	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
+		  WSSCREEN_RESIZE;
 
 	rasops_reconfig(ri,
 	sc->sc_fb.fb_type.fb_height / ri->ri_font->fontheight,



CVS commit: src/sys/arch/sparc/dev

2018-01-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  6 07:26:54 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support underlines


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.82 src/sys/arch/sparc/dev/cgfourteen.c:1.83
--- src/sys/arch/sparc/dev/cgfourteen.c:1.82	Fri Sep 16 22:39:35 2016
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sat Jan  6 07:26:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.82 2016/09/16 22:39:35 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.83 2018/01/06 07:26:54 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -163,6 +163,7 @@ static int  cg14_do_cursor(struct cgfour
 static void cg14_wait_idle(struct cgfourteen_softc *);
 static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int,
 uint32_t);
+static void cg14_rectfill_a(void *, int, int, int, int, long);
 static void cg14_invert(struct cgfourteen_softc *, int, int, int, int);
 static void cg14_bitblt(void *, int, int, int, int, int, int, int);
 static void cg14_bitblt_gc(void *, int, int, int, int, int, int, int);
@@ -723,7 +724,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 		0, 0,
 		NULL,
 		8, 16,
-		WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
+		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE,
 		NULL
 	};
 	cg14_set_depth(sc, 8);
@@ -738,6 +739,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 
 	sc->sc_gc.gc_bitblt = cg14_bitblt_gc;
 	sc->sc_gc.gc_blitcookie = sc;
+	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
 	if (is_cons) {
 		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
@@ -1008,7 +1010,7 @@ cg14_init_screen(void *cookie, struct vc
 
 	ri->ri_bits = (char *)sc->sc_fb.fb_pixels;
 #if NSX > 0
-	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA;
+	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA | RI_PREFER_ALPHA;
 
 	/*
 	 * unaligned copies with horizontal overlap are slow, so don't bother
@@ -1025,7 +1027,7 @@ cg14_init_screen(void *cookie, struct vc
 	}
 
 	rasops_init(ri, 0, 0);
-	ri->ri_caps = WSSCREEN_WSCOLORS;
+	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE;
 
 	rasops_reconfig(ri,
 	sc->sc_fb.fb_type.fb_height / ri->ri_font->fontheight,
@@ -1209,7 +1211,7 @@ cg14_rectfill(struct cgfourteen_softc *s
 			cnt -= pre;
 		}
 		/* now do the aligned pixels in 32bit chunks */
-		while(cnt > 31) {
+		while(cnt > 3) {
 			words = min(32, cnt >> 2);
 			sta(pptr & ~7, ASI_SX, SX_STS(8, words - 1, pptr & 7));
 			pptr += words << 2;
@@ -1223,6 +1225,16 @@ cg14_rectfill(struct cgfourteen_softc *s
 }
 
 static void
+cg14_rectfill_a(void *cookie, int dstx, int dsty,
+int width, int height, long attr)
+{
+	struct cgfourteen_softc *sc = cookie;
+
+	cg14_rectfill(sc, dstx, dsty, width, height,
+	sc->sc_vd.active->scr_ri.ri_devcmap[(attr >> 24 & 0xf)]);
+}
+
+static void
 cg14_invert(struct cgfourteen_softc *sc, int x, int y, int wi, int he)
 {
 	uint32_t addr, pptr;
@@ -1459,17 +1471,20 @@ cg14_putchar(void *cookie, int row, int 
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
 	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
-	sx_write(sc->sc_sx, SX_QUEUED(8), bg);
-	sx_write(sc->sc_sx, SX_QUEUED(9), fg);
 
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
 
 	if (c == 0x20) {
 		cg14_rectfill(sc, x, y, wi, he, bg);
+		if (attr & 1)
+			cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 		return;
 	}
 
+	sx_write(sc->sc_sx, SX_QUEUED(8), bg);
+	sx_write(sc->sc_sx, SX_QUEUED(9), fg);
+
 	data = WSFONT_GLYPH(c, font);
 	addr = sc->sc_fb_paddr + x + stride * y;
 
@@ -1501,6 +1516,8 @@ cg14_putchar(void *cookie, int row, int 
 			break;
 		}
 	}
+	if (attr & 1)
+		cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 }
 
 static void
@@ -1545,7 +1562,7 @@ cg14_putchar_aa(void *cookie, int row, i
 	struct vcons_screen *scr = ri->ri_hw;
 	struct cgfourteen_softc *sc = scr->scr_cookie;
 	int stride = sc->sc_fb.fb_type.fb_width;
-	uint32_t bg, addr, bg8, fg8, pixel, in, q, next;
+	uint32_t bg, fg, addr, bg8, fg8, pixel, in, q, next;
 	int i, j, x, y, wi, he, r, g, b, aval, cnt, reg;
 	int r1, g1, b1, r0, g0, b0, fgo, bgo, rv;
 	uint8_t *data8;
@@ -1560,10 +1577,13 @@ cg14_putchar_aa(void *cookie, int row, i
 	he = font->fontheight;
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
+	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
 	if (c == 0x20) {
 		cg14_rectfill(sc, x, y, wi, he, bg);
+		if (attr & 1)
+			cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 		return;
 	}
 
@@ -1641,7 +1661,9 @@ cg14_putchar_aa(void *cookie, int row, i
 
 	if (rv == GC_ADD) {
 		glyphcache_add(>sc_gc, c, x, y);
-	}
+	} else if (attr & 1)
+		cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
+
 }
 
 static void



CVS commit: src/sys/arch/sparc/dev

2017-12-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Dec  8 22:28:54 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
fix tpyos and pastos


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.15 src/sys/arch/sparc/dev/sxreg.h:1.16
--- src/sys/arch/sparc/dev/sxreg.h:1.15	Thu Dec  7 19:15:56 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Fri Dec  8 22:28:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.15 2017/12/07 19:15:56 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.16 2017/12/08 22:28:54 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -293,9 +293,9 @@
 /* MISC group */
 #define SX_GTHR		(3 << 21)	/* sa with spacing sb -> d */
 #define SX_SCTR		(2 << 21)	/* sa -> d with spacing sb */
-#define SX_GATHER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_GTHR | \
-		((sa) << 14) | ((d << 7) | (sb))
-#define SX_SCATTER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_SCRT | \
-		((sa) << 14) | ((d << 7) | (sb))
+#define SX_GATHER(sa, sb, d, cnt) (0xe000 | ((cnt) << 24) | SX_GTHR | \
+		 ((sa) << 14) | ((d) << 7) | (sb))
+#define SX_SCATTER(sa, sb, d, cnt) (0xe000 | ((cnt) << 24) | SX_SCTR | \
+		 ((sa) << 14) | ((d) << 7) | (sb))
 
 #endif /* SXREG_H */



CVS commit: src/sys/arch/sparc/dev

2017-12-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec  7 19:15:56 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add SCATTER/GATHER instructions


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.14 src/sys/arch/sparc/dev/sxreg.h:1.15
--- src/sys/arch/sparc/dev/sxreg.h:1.14	Mon Oct 30 21:41:39 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Thu Dec  7 19:15:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.14 2017/10/30 21:41:39 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.15 2017/12/07 19:15:56 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -290,4 +290,12 @@
 #define SX_ADDV(sa, sb, d, cnt) (0xa000 | ((cnt) << 24) | SX_ADD_V | \
 		((sa) << 14) | ((d) << 7) | (sb))
 
+/* MISC group */
+#define SX_GTHR		(3 << 21)	/* sa with spacing sb -> d */
+#define SX_SCTR		(2 << 21)	/* sa -> d with spacing sb */
+#define SX_GATHER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_GTHR | \
+		((sa) << 14) | ((d << 7) | (sb))
+#define SX_SCATTER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_SCRT | \
+		((sa) << 14) | ((d << 7) | (sb))
+
 #endif /* SXREG_H */



CVS commit: src/sys/arch/sparc/dev

2017-10-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Oct 30 21:41:39 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add load & store instructions for channel data type
mostly for Xorg


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.13 src/sys/arch/sparc/dev/sxreg.h:1.14
--- src/sys/arch/sparc/dev/sxreg.h:1.13	Fri Jan 13 21:49:46 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Mon Oct 30 21:41:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.13 2017/01/13 21:49:46 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.14 2017/10/30 21:41:39 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -158,6 +158,14 @@
 SX_UQUAD_16 | (dreg << 7) | (o))
 #define SX_LDUQ24(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
 SX_UQUAD_24 | (dreg << 7) | (o))
+#define SX_LDUC0(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_0 | (dreg << 7) | (o))
+#define SX_LDUC8(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_8 | (dreg << 7) | (o))
+#define SX_LDUC16(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_16 | (dreg << 7) | (o))
+#define SX_LDUC24(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_24 | (dreg << 7) | (o))
 #define SX_ST(sreg, cnt, o)  (0x8000 | ((cnt) << 23) | SX_STORE | \
 SX_LONG | (sreg << 7) | (o))
 #define SX_STM(sreg, cnt, o)  (0x8000 | ((cnt) << 23) | SX_STORE_MASK | \
@@ -184,6 +192,16 @@
 SX_UQUAD_16 | (sreg << 7) | (o))
 #define SX_STUQ24(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
 SX_UQUAD_24 | (sreg << 7) | (o))
+#define SX_STUC0(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_0 | (sreg << 7) | (o))
+#define SX_STUC0C(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_CLAMP | \
+SX_UCHAN_0 | (sreg << 7) | (o))
+#define SX_STUC8(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_8 | (sreg << 7) | (o))
+#define SX_STUC16(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_16 | (sreg << 7) | (o))
+#define SX_STUC24(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_24 | (sreg << 7) | (o))
 
 /* ROP and SELECT instructions */
 #define SX_ROPB	(0x0 << 21)	/* mask bits apply to bytes */



CVS commit: src/sys/arch/sparc/dev

2017-01-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 13 21:49:46 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add SX_STBM ( STore Byte Masked ) instruction


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.12 src/sys/arch/sparc/dev/sxreg.h:1.13
--- src/sys/arch/sparc/dev/sxreg.h:1.12	Sat Apr 30 05:22:19 2016
+++ src/sys/arch/sparc/dev/sxreg.h	Fri Jan 13 21:49:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.12 2016/04/30 05:22:19 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.13 2017/01/13 21:49:46 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -164,6 +164,8 @@
 SX_LONG | (sreg << 7) | (o))
 #define SX_STB(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
 SX_UBYTE_0 | (sreg << 7) | (o))
+#define SX_STBM(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_MASK | \
+SX_UBYTE_0 | (sreg << 7) | (o))
 #define SX_STBC(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_CLAMP | \
 SX_UBYTE_0 | (sreg << 7) | (o))
 #define SX_STP(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \



CVS commit: src/sys/arch/sparc/dev

2016-12-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 11 16:25:54 UTC 2016

Modified Files:
src/sys/arch/sparc/dev: tctrl.c

Log Message:
catch up with sd changes.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sparc/dev/tctrl.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/sparc/dev/tctrl.c
diff -u src/sys/arch/sparc/dev/tctrl.c:1.59 src/sys/arch/sparc/dev/tctrl.c:1.60
--- src/sys/arch/sparc/dev/tctrl.c:1.59	Fri Jul 25 04:10:34 2014
+++ src/sys/arch/sparc/dev/tctrl.c	Sun Dec 11 11:25:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tctrl.c,v 1.59 2014/07/25 08:10:34 dholland Exp $	*/
+/*	$NetBSD: tctrl.c,v 1.60 2016/12/11 16:25:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.59 2014/07/25 08:10:34 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.60 2016/12/11 16:25:54 christos Exp $");
 
 #include 
 #include 
@@ -1447,42 +1447,43 @@ tctrl_event_thread(void *v)
 {
 	struct tctrl_softc *sc = v;
 	device_t dv;
-	struct sd_softc *sd = NULL;
-	struct lance_softc *le = NULL;
-	int ticks = hz/2;
-	int rcount, wcount;
-	int s;
+	struct sd_softc *sd;
 	
-	while (sd == NULL) {
+	for (sd = NULL; sd == NULL;) {
 		dv = device_find_by_xname("sd0");
 		if (dv != NULL)
 			sd = device_private(dv);
 		else
 			tsleep(>sc_events, PWAIT, "probe_disk", hz);
 	}			
+
 	dv = device_find_by_xname("le0");
-	if (dv != NULL)
-		le = device_private(dv);
-	printf("found %s\n", device_xname(sd->sc_dev));
-	rcount = sd->sc_dk.dk_stats->io_rxfer;
-	wcount = sd->sc_dk.dk_stats->io_wxfer;
+
+	struct lance_softc *le = dv != NULL ? device_private(dv) : NULL;
+	struct dk_softc *dk = >sc_dksc;
+	printf("found %s\n", device_xname(dk->sc_dev));
+
+	struct io_stats *io = dk->sc_dkdev.dk_stats;
+	int rcount = io->io_rxfer;
+	int wcount = io->io_wxfer;
 
 	tctrl_read_event_status(sc);
 	
-	while (1) {
+	int ticks = hz / 2;
+	for (;;) {
 		tsleep(>sc_events, PWAIT, "tctrl_event", ticks);
-		s = splhigh();
-		if ((rcount != sd->sc_dk.dk_stats->io_rxfer) || 
-		(wcount != sd->sc_dk.dk_stats->io_wxfer)) {
-			rcount = sd->sc_dk.dk_stats->io_rxfer;
-			wcount = sd->sc_dk.dk_stats->io_wxfer;
+		int s = splhigh();
+		if ((rcount != io->io_rxfer) || (wcount != io->io_wxfer)) {
+			rcount = io->io_rxfer;
+			wcount = io->io_wxfer;
 			sc->sc_lcdwanted |= TS102_LCD_DISK_ACTIVE;
 		} else
 			sc->sc_lcdwanted &= ~TS102_LCD_DISK_ACTIVE;
+
 		if (le != NULL) {
-			if (le->sc_havecarrier != 0) {
+			if (le->sc_havecarrier != 0)
 sc->sc_lcdwanted |= TS102_LCD_LAN_ACTIVE;
-			} else
+			else
 sc->sc_lcdwanted &= ~TS102_LCD_LAN_ACTIVE;
 		}
 		splx(s);



CVS commit: src/sys/arch/sparc/dev

2016-09-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 16 22:39:36 UTC 2016

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
wipe glyph cache as needed when re-entering text mode
now the console is readable again when leaving X


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.81 src/sys/arch/sparc/dev/cgfourteen.c:1.82
--- src/sys/arch/sparc/dev/cgfourteen.c:1.81	Thu Jun  2 21:19:24 2016
+++ src/sys/arch/sparc/dev/cgfourteen.c	Fri Sep 16 22:39:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.81 2016/06/02 21:19:24 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.82 2016/09/16 22:39:35 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -418,9 +418,13 @@ cgfourteenclose(dev_t dev, int flags, in
 	/*
 	 * Restore video state to make the PROM happy, on last close.
 	 */
-	if (opens == 0)
+	if (opens == 0) {
 		cg14_reset(sc);
-
+#if NSX > 0
+		if (sc->sc_sx)
+			glyphcache_wipe(>sc_gc);
+#endif
+	}
 	return (0);
 }
 
@@ -918,6 +922,10 @@ cg14_ioctl(void *v, void *vs, u_long cmd
 
 		cg14_set_depth(sc, 8);
 		cg14_init_cmap(sc);
+#if NSX > 0
+		if (sc->sc_sx)
+			glyphcache_wipe(>sc_gc);
+#endif
 		vcons_redraw_screen(ms);
 	} else {
 



CVS commit: src/sys/arch/sparc/dev

2016-06-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  2 21:19:24 UTC 2016

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
use DEFATTR if we're not the console and can't init defattr.
should appease clang
TODO: we should really init the glyphcache whith the first screen


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.80 src/sys/arch/sparc/dev/cgfourteen.c:1.81
--- src/sys/arch/sparc/dev/cgfourteen.c:1.80	Sat Apr 30 05:23:03 2016
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Jun  2 21:19:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.80 2016/04/30 05:23:03 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.81 2016/06/02 21:19:24 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -775,7 +775,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 			sc->sc_fb.fb_type.fb_width,
 			ri->ri_font->fontwidth,
 			ri->ri_font->fontheight,
-			defattr);
+			DEFATTR);
 	}
 
 	cg14_init_cmap(sc);



CVS commit: src/sys/arch/sparc/dev

2016-04-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr 30 05:23:03 UTC 2016

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c cgfourteenvar.h

Log Message:
support anti-aliased fonts, glyphcache etc.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/dev/cgfourteenvar.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.79 src/sys/arch/sparc/dev/cgfourteen.c:1.80
--- src/sys/arch/sparc/dev/cgfourteen.c:1.79	Fri Jul 25 08:10:34 2014
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sat Apr 30 05:23:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.79 2014/07/25 08:10:34 dholland Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.80 2016/04/30 05:23:03 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -96,6 +96,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -164,10 +165,9 @@ static void cg14_rectfill(struct cgfourt
 uint32_t);
 static void cg14_invert(struct cgfourteen_softc *, int, int, int, int);
 static void cg14_bitblt(void *, int, int, int, int, int, int, int);
+static void cg14_bitblt_gc(void *, int, int, int, int, int, int, int);
 
-#if 0
 static void cg14_putchar_aa(void *, int, int, u_int, long);
-#endif
 static void cg14_cursor(void *, int, int, int);
 static void cg14_putchar(void *, int, int, u_int, long);
 static void cg14_copycols(void *, int, int, int, int);
@@ -595,74 +595,14 @@ cgfourteenpoll(dev_t dev, int events, st
 static void
 cg14_init(struct cgfourteen_softc *sc)
 {
-#if 0
-	volatile uint32_t *clut;
-	volatile uint8_t  *xlut;
-	int i;
-
-	/*
-	 * We stash away the following to restore on close:
-	 *
-	 * 	color look-up table 1 	(sc->sc_saveclut)
-	 *	x look-up table		(sc->sc_savexlut)
-	 *	control register	(sc->sc_savectl)
-	 *	cursor control register (sc->sc_savehwc)
-	 */
-	sc->sc_savectl = sc->sc_ctl->ctl_mctl;
-	sc->sc_savehwc = sc->sc_hwc->curs_ctl;
-
-	clut = (volatile uint32_t *) sc->sc_clut1->clut_lut;
-	xlut = (volatile uint8_t *) sc->sc_xlut->xlut_lut;
-	for (i = 0; i < CG14_CLUT_SIZE; i++) {
-		sc->sc_saveclut.cm_chip[i] = clut[i];
-		sc->sc_savexlut[i] = xlut[i];
-	}
-
-	/*
-	 * Enable the video and put it in 8 bit mode
-	 */
-	sc->sc_ctl->ctl_mctl = CG14_MCTL_ENABLEVID | CG14_MCTL_PIXMODE_8 |
-		CG14_MCTL_POWERCTL;
-#else
 	cg14_set_depth(sc, 32);
-#endif
 }
 
 static void
 /* Restore the state saved on cg14_init */
 cg14_reset(struct cgfourteen_softc *sc)
 {
-#if 0
-	volatile uint32_t *clut;
-	volatile uint8_t  *xlut;
-	int i;
-
-	/*
-	 * We restore the following, saved in cg14_init:
-	 *
-	 * 	color look-up table 1 	(sc->sc_saveclut)
-	 *	x look-up table		(sc->sc_savexlut)
-	 *	control register	(sc->sc_savectl)
-	 *	cursor control register (sc->sc_savehwc)
-	 *
-	 * Note that we don't touch the video enable bits in the
-	 * control register; otherwise, screenblank wouldn't work.
-	 */
-	sc->sc_ctl->ctl_mctl = (sc->sc_ctl->ctl_mctl & (CG14_MCTL_ENABLEVID |
-			CG14_MCTL_POWERCTL)) |
-(sc->sc_savectl & ~(CG14_MCTL_ENABLEVID |
-		CG14_MCTL_POWERCTL));
-	sc->sc_hwc->curs_ctl = sc->sc_savehwc;
-
-	clut = sc->sc_clut1->clut_lut;
-	xlut = sc->sc_xlut->xlut_lut;
-	for (i = 0; i < CG14_CLUT_SIZE; i++) {
-		clut[i] = sc->sc_saveclut.cm_chip[i];
-		xlut[i] = sc->sc_savexlut[i];
-	}
-#else
 	cg14_set_depth(sc, 8);
-#endif
 }
 
 /* Enable/disable video display; power down monitor if DPMS-capable */
@@ -767,7 +707,6 @@ cg14_load_hwcmap(struct cgfourteen_softc
 		*lutp++ = *colp++;
 }
 
-#if NWSDISPLAY > 0
 static void
 cg14_setup_wsdisplay(struct cgfourteen_softc *sc, int is_cons)
 {
@@ -793,20 +732,35 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 
 	ri = >sc_console_screen.scr_ri;
 
+	sc->sc_gc.gc_bitblt = cg14_bitblt_gc;
+	sc->sc_gc.gc_blitcookie = sc;
+	sc->sc_gc.gc_rop = 0xc;
 	if (is_cons) {
 		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
 		);
 
 		/* clear the screen with the default background colour */
-		memset(sc->sc_fb.fb_pixels,
-		   (defattr >> 16) & 0xff,
-		   ri->ri_stride * ri->ri_height);
+		if (sc->sc_sx != NULL) {
+			cg14_rectfill(sc, 0, 0, ri->ri_width, ri->ri_height,
+ri->ri_devcmap[(defattr >> 16) & 0xf]);
+		} else {
+			memset(sc->sc_fb.fb_pixels,
+			   ri->ri_devcmap[(defattr >> 16) & 0xf],
+			   ri->ri_stride * ri->ri_height);
+		}
 		sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
 		sc->sc_defaultscreen_descr.textops = >ri_ops;
 		sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
 		sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
 		sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
+		glyphcache_init(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
+			(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) - 
+			 sc->sc_fb.fb_type.fb_height - 5,
+			sc->sc_fb.fb_type.fb_width,
+			ri->ri_font->fontwidth,
+			

CVS commit: src/sys/arch/sparc/dev

2016-04-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr 30 05:22:19 UTC 2016

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
sprinkle ()s in macros


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.11 src/sys/arch/sparc/dev/sxreg.h:1.12
--- src/sys/arch/sparc/dev/sxreg.h:1.11	Wed Jun 19 00:41:16 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Sat Apr 30 05:22:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.11 2013/06/19 00:41:16 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.12 2016/04/30 05:22:19 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
 /* write registers via pseudo instructions */
 #define SX_QUEUED_R0		0x0300
 #define SX_QUEUED_R1		0x0304	/* and so on until R127 */
-#define SX_QUEUED(r)		(0x300 + (r << 2))
+#define SX_QUEUED(r)		(0x300 + ((r) << 2))
 
 /* special purpose registers */
 #define R_ZERO	0



CVS commit: src/sys/arch/sparc/dev

2016-04-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 21 17:59:18 UTC 2016

Modified Files:
src/sys/arch/sparc/dev: cgsix_obio.c

Log Message:
RASTERCONSOLE is no more


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sparc/dev/cgsix_obio.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/sparc/dev/cgsix_obio.c
diff -u src/sys/arch/sparc/dev/cgsix_obio.c:1.26 src/sys/arch/sparc/dev/cgsix_obio.c:1.27
--- src/sys/arch/sparc/dev/cgsix_obio.c:1.26	Sat Oct 27 17:18:11 2012
+++ src/sys/arch/sparc/dev/cgsix_obio.c	Thu Apr 21 17:59:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgsix_obio.c,v 1.26 2012/10/27 17:18:11 chs Exp $ */
+/*	$NetBSD: cgsix_obio.c,v 1.27 2016/04/21 17:59:18 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgsix_obio.c,v 1.26 2012/10/27 17:18:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix_obio.c,v 1.27 2016/04/21 17:59:18 macallan Exp $");
 
 #include 
 #include 
@@ -204,17 +204,15 @@ cgsixattach(device_t parent, device_t se
 	else
 		isconsole = 0;
 
-	if (isconsole && cgsix_use_rasterconsole) {
-		if (bus_space_map(oba->oba_bustag,
-  oba->oba_paddr + CGSIX_RAM_OFFSET,
-  sc->sc_ramsize,
-  BUS_SPACE_MAP_LINEAR,
-  ) != 0) {
-			printf("%s: cannot map pixels\n", device_xname(self));
-			return;
-		}
-		sc->sc_fb.fb_pixels = (void *)bh;
+	if (bus_space_map(oba->oba_bustag,
+			  oba->oba_paddr + CGSIX_RAM_OFFSET,
+			  sc->sc_ramsize,
+			  BUS_SPACE_MAP_LINEAR,
+			  ) != 0) {
+		printf("%s: cannot map pixels\n", device_xname(self));
+		return;
 	}
+	sc->sc_fb.fb_pixels = (void *)bh;
 
 	cg6attach(sc, name, isconsole);
 }



CVS commit: src/sys/arch/sparc/dev

2014-08-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Aug 19 14:43:41 UTC 2014

Modified Files:
src/sys/arch/sparc/dev: fd.c

Log Message:
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().

I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).

Should be pulled up to netbsd-7.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/sparc/dev/fd.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/sparc/dev/fd.c
diff -u src/sys/arch/sparc/dev/fd.c:1.154 src/sys/arch/sparc/dev/fd.c:1.155
--- src/sys/arch/sparc/dev/fd.c:1.154	Fri Jul 25 08:10:34 2014
+++ src/sys/arch/sparc/dev/fd.c	Tue Aug 19 14:43:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.154 2014/07/25 08:10:34 dholland Exp $	*/
+/*	$NetBSD: fd.c,v 1.155 2014/08/19 14:43:41 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.154 2014/07/25 08:10:34 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.155 2014/08/19 14:43:41 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -2244,7 +2244,7 @@ fdgetdisklabel(dev_t dev)
 	struct cpu_disklabel *clp = fd-sc_dk.dk_cpulabel;
 
 	memset(lp, 0, sizeof(struct disklabel));
-	memset(lp, 0, sizeof(struct cpu_disklabel));
+	memset(clp, 0, sizeof(struct cpu_disklabel));
 
 	lp-d_type = DTYPE_FLOPPY;
 	lp-d_secsize = FD_BSIZE(fd);



CVS commit: src/sys/arch/sparc/dev

2014-06-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 29 03:57:10 UTC 2014

Modified Files:
src/sys/arch/sparc/dev: sxvar.h

Log Message:
Add a newline at end of file.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/dev/sxvar.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/sparc/dev/sxvar.h
diff -u src/sys/arch/sparc/dev/sxvar.h:1.2 src/sys/arch/sparc/dev/sxvar.h:1.3
--- src/sys/arch/sparc/dev/sxvar.h:1.2	Tue Apr 15 10:24:54 2014
+++ src/sys/arch/sparc/dev/sxvar.h	Sun Jun 29 03:57:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxvar.h,v 1.2 2014/04/15 10:24:54 macallan Exp $	*/
+/*	$NetBSD: sxvar.h,v 1.3 2014/06/29 03:57:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,4 +51,4 @@ sx_read(struct sx_softc *sc, int addr)
 	return bus_space_read_4(sc-sc_tag, sc-sc_regh, addr);
 }
 
-#endif
\ No newline at end of file
+#endif



CVS commit: src/sys/arch/sparc/dev

2013-08-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 14 01:53:27 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
comments  whitespace police


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.75 src/sys/arch/sparc/dev/cgfourteen.c:1.76
--- src/sys/arch/sparc/dev/cgfourteen.c:1.75	Tue Jun  4 22:31:30 2013
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Aug 14 01:53:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.75 2013/06/04 22:31:30 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.76 2013/08/14 01:53:27 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -110,7 +110,7 @@ static void	cgfourteenunblank(device_t);
 
 CFATTACH_DECL_NEW(cgfourteen, sizeof(struct cgfourteen_softc),
 cgfourteenmatch, cgfourteenattach, NULL, NULL);
-
+
 extern struct cfdriver cgfourteen_cd;
 
 dev_type_open(cgfourteenopen);
@@ -191,14 +191,6 @@ cgfourteenmatch(device_t parent, struct 
 	return (strcmp(cf-cf_name, sa-sa_name) == 0);
 }
 
-/*
- * Set COLOUR_OFFSET to the offset of the video RAM.  This is to provide
- *  space for faked overlay junk for the cg8 emulation.
- *
- * As it happens, this value is correct for both cg3 and cg8 emulation!
- */
-#define COLOUR_OFFSET (256*1024)
-
 #if NWSDISPLAY  0
 static int	cg14_ioctl(void *, void *, u_long, void *, int, struct lwp *);
 static paddr_t	cg14_mmap(void *, void *, off_t, int);
@@ -554,6 +546,11 @@ cgfourteenmmap(dev_t dev, off_t off, int
 		offset = sc-sc_fbaddr + CG14_FB_PR32;
 		off -= CG14_R32_VOFF;
 #if NSX  0
+	/*
+	 * for convenience we also map the SX ranges here:
+	 * - one page userland registers
+	 * - CG14-sized IO space at 0x8 ( not a typo, it's above 4GB )
+	 */
 	} else if (sc-sc_sx == NULL) {
 		return -1;
 	} else if (off = CG14_SXREG_VOFF 
@@ -568,12 +565,7 @@ cgfourteenmmap(dev_t dev, off_t off, int
 #endif
 	} else
 		return -1;
-	/*
-	 * for convenience we also map the SX ranges here:
-	 * - one page userland registers
-	 * - CG14-sized IO space at 0x8 ( not a typo, it's above 4GB )
-	 * bus_space_mmap() should accept 64bit bus_addr_t's by the look of it
-	 */
+	
 	return (bus_space_mmap(sc-sc_bustag, offset, off, prot,
 		BUS_SPACE_MAP_LINEAR));
 }



CVS commit: src/sys/arch/sparc/dev

2013-06-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 19 00:41:16 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add store-with-clamp instructions


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.10 src/sys/arch/sparc/dev/sxreg.h:1.11
--- src/sys/arch/sparc/dev/sxreg.h:1.10	Wed Jun 12 20:44:20 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed Jun 19 00:41:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.10 2013/06/12 20:44:20 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.11 2013/06/19 00:41:16 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -164,6 +164,8 @@
 SX_LONG | (sreg  7) | (o))
 #define SX_STB(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
 SX_UBYTE_0 | (sreg  7) | (o))
+#define SX_STBC(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE_CLAMP | \
+SX_UBYTE_0 | (sreg  7) | (o))
 #define SX_STP(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
 SX_PACKED | (sreg  7) | (o))
 #define SX_STS(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE_SELECT \
@@ -172,6 +174,8 @@
 | SX_UBYTE_0 | (reg  7) | (o))
 #define SX_STUQ0(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
 SX_UQUAD_0 | (sreg  7) | (o))
+#define SX_STUQ0C(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE_CLAMP | \
+SX_UQUAD_0 | (sreg  7) | (o))
 #define SX_STUQ8(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
 SX_UQUAD_8 | (sreg  7) | (o))
 #define SX_STUQ16(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \



CVS commit: src/sys/arch/sparc/dev

2013-06-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 12 20:43:22 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
document arithmetics instructions


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.8 src/sys/arch/sparc/dev/sxreg.h:1.9
--- src/sys/arch/sparc/dev/sxreg.h:1.8	Wed Jun 12 04:23:46 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed Jun 12 20:43:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.8 2013/06/12 04:23:46 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.9 2013/06/12 20:43:21 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -253,14 +253,15 @@
 		((sa)  14) | ((d)  7) | (sb))
 
 /* arithmetic group */
-#define SX_ADD_V	(0x00  21)
-#define SX_ADD_S	(0x01  21)
-#define SX_ADD_I	(0x02  21)
-#define SX_SUM		(0x03  21)
-#define SX_SUB_V	(0x04  21)
-#define SX_SUB_S	(0x05  21)
-#define SX_SUB_I	(0x06  21)
-#define SX_ABS		(0x07  21)
+#define SX_ADD_V	(0x00  21)	/* vector + vector */
+#define SX_ADD_S	(0x01  21)	/* vector + scalar */
+#define SX_ADD_I	(0x02  21)	/* vector + immediate */
+#define SX_SUM		(0x03  21)	/* sum of vector and scalar */
+#define SX_SUB_V	(0x04  21)	/* vector - veector */
+#define SX_SUB_S	(0x05  21)	/* vector - scalar */
+#define SX_SUB_I	(0x06  21)	/* vector - immediate */
+#define SX_ABS		(0x07  21)	/* abs(sb) with sa=R0 */
+/* hardware does sa - sb for sb  0 and sa + sb if sb  0 */
 
 #define SX_ADDV(sa, sb, d, cnt) (0xa000 | ((cnt)  24) | SX_ADD_V | \
 		((sa)  14) | ((d)  7) | (sb))



CVS commit: src/sys/arch/sparc/dev

2013-06-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 12 20:44:20 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.9 src/sys/arch/sparc/dev/sxreg.h:1.10
--- src/sys/arch/sparc/dev/sxreg.h:1.9	Wed Jun 12 20:43:21 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed Jun 12 20:44:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.9 2013/06/12 20:43:21 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.10 2013/06/12 20:44:20 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -257,7 +257,7 @@
 #define SX_ADD_S	(0x01  21)	/* vector + scalar */
 #define SX_ADD_I	(0x02  21)	/* vector + immediate */
 #define SX_SUM		(0x03  21)	/* sum of vector and scalar */
-#define SX_SUB_V	(0x04  21)	/* vector - veector */
+#define SX_SUB_V	(0x04  21)	/* vector - vector */
 #define SX_SUB_S	(0x05  21)	/* vector - scalar */
 #define SX_SUB_I	(0x06  21)	/* vector - immediate */
 #define SX_ABS		(0x07  21)	/* abs(sb) with sa=R0 */



CVS commit: src/sys/arch/sparc/dev

2013-06-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 12 04:23:46 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
fix serial typepasto, while there add SX_ADD instructions


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.7 src/sys/arch/sparc/dev/sxreg.h:1.8
--- src/sys/arch/sparc/dev/sxreg.h:1.7	Wed Jun  5 18:15:06 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed Jun 12 04:23:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.7 2013/06/05 18:15:06 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.8 2013/06/12 04:23:46 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -207,22 +207,22 @@
 #define SX_ROUND	(0x1  23)	/* round results */
 
 #define SX_MUL16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
-		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d))	
+		SX_MULTIPLY | ((sa)  14) | ((d)  7) | (sb))	
 #define SX_MUL16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
-		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+		SX_MULTIPLY | ((sa)  14) | ((d)  7) | (sb) | SX_ROUND)	
 #define SX_MUL16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
-		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d))	
+		SX_MULTIPLY | ((sa)  14) | ((d)  7) | (sb))	
 #define SX_MUL16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
-		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+		SX_MULTIPLY | ((sa)  14) | ((d)  7) | (sb) | SX_ROUND)	
 
 #define SX_SAXP16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
-		SX_SAXP | ((sa)  14) | ((sb)  7) | (d))	
+		SX_SAXP | ((sa)  14) | ((d)  7) | (sb))	
 #define SX_SAXP16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
-		SX_SAXP | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+		SX_SAXP | ((sa)  14) | ((d)  7) | (sb) | SX_ROUND)	
 #define SX_SAXP16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
-		SX_SAXP | ((sa)  14) | ((sb)  7) | (d))	
+		SX_SAXP | ((sa)  14) | ((d)  7) | (sb))	
 #define SX_SAXP16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
-		SX_SAXP | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+		SX_SAXP | ((sa)  14) | ((d)  7) | (sb) | SX_ROUND)	
 
 /* logic group */
 #define SX_AND_V	(0x0  21)	/* vector AND vector */
@@ -236,20 +236,33 @@
 /* immediates are 7bit sign extended to 32bit */
 
 #define SX_ANDV(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_AND_V | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
 #define SX_ANDS(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_AND_S | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
 #define SX_ANDI(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_AND_I | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
 #define SX_XORV(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_XOR_V | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
 #define SX_XORS(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_XOR_S | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
 #define SX_XORI(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_XOR_I | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
 #define SX_ORV(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_OR_V | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
 #define SX_ORS(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_OR_S | \
-		((sa)  14) | ((sb)  7) | (d))
+		((sa)  14) | ((d)  7) | (sb))
+
+/* arithmetic group */
+#define SX_ADD_V	(0x00  21)
+#define SX_ADD_S	(0x01  21)
+#define SX_ADD_I	(0x02  21)
+#define SX_SUM		(0x03  21)
+#define SX_SUB_V	(0x04  21)
+#define SX_SUB_S	(0x05  21)
+#define SX_SUB_I	(0x06  21)
+#define SX_ABS		(0x07  21)
+
+#define SX_ADDV(sa, sb, d, cnt) (0xa000 | ((cnt)  24) | SX_ADD_V | \
+		((sa)  14) | ((d)  7) | (sb))
 
 #endif /* SXREG_H */



CVS commit: src/sys/arch/sparc/dev

2013-06-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun  5 18:15:06 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add a bunch more instructions ( still not complete but we're getting there )


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.6 src/sys/arch/sparc/dev/sxreg.h:1.7
--- src/sys/arch/sparc/dev/sxreg.h:1.6	Tue Jun  4 22:30:30 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed Jun  5 18:15:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.6 2013/06/04 22:30:30 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.7 2013/06/05 18:15:06 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -150,6 +150,14 @@
 SX_UBYTE_0 | (dreg  7) | (o))
 #define SX_LDP(dreg, cnt, o) (0x8000 | ((cnt)  23) | SX_LOAD | \
 SX_PACKED | (dreg  7) | (o))
+#define SX_LDUQ0(dreg, cnt, o) (0x8000 | ((cnt)  23) | SX_LOAD | \
+SX_UQUAD_0 | (dreg  7) | (o))
+#define SX_LDUQ8(dreg, cnt, o) (0x8000 | ((cnt)  23) | SX_LOAD | \
+SX_UQUAD_8 | (dreg  7) | (o))
+#define SX_LDUQ16(dreg, cnt, o) (0x8000 | ((cnt)  23) | SX_LOAD | \
+SX_UQUAD_16 | (dreg  7) | (o))
+#define SX_LDUQ24(dreg, cnt, o) (0x8000 | ((cnt)  23) | SX_LOAD | \
+SX_UQUAD_24 | (dreg  7) | (o))
 #define SX_ST(sreg, cnt, o)  (0x8000 | ((cnt)  23) | SX_STORE | \
 SX_LONG | (sreg  7) | (o))
 #define SX_STM(sreg, cnt, o)  (0x8000 | ((cnt)  23) | SX_STORE_MASK | \
@@ -162,8 +170,16 @@
 | SX_LONG | (sreg  7) | (o))
 #define SX_STBS(reg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE_SELECT \
 | SX_UBYTE_0 | (reg  7) | (o))
+#define SX_STUQ0(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
+SX_UQUAD_0 | (sreg  7) | (o))
+#define SX_STUQ8(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
+SX_UQUAD_8 | (sreg  7) | (o))
+#define SX_STUQ16(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
+SX_UQUAD_16 | (sreg  7) | (o))
+#define SX_STUQ24(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
+SX_UQUAD_24 | (sreg  7) | (o))
 
-/* ROP instruction */
+/* ROP and SELECT instructions */
 #define SX_ROPB	(0x0  21)	/* mask bits apply to bytes */
 #define SX_ROPM	(0x1  21)	/* mask bits apply to each bit */
 #define SX_ROPL	(0x2  21)	/* mask bits apply per register */
@@ -175,4 +191,65 @@
 		((sa)  14) | (sb) | ((d)  7))
 #define SX_SELECT_S(sa, sb, d, cnt) (0x9000 | ((cnt)  24) | SX_SELS | \
 		((sa)  14) | (sb) | ((d)  7))
+
+/* multiply group */
+#define SX_M16X16SR0	(0x0  28)	/* 16bit multiply, no shift */
+#define SX_M16X16SR8	(0x1  28)	/* 16bit multiply, shift right 8 */
+#define SX_M16X16SR16	(0x2  28)	/* 16bit multiply, shift right 16 */
+#define SX_M32X16SR0	(0x4  28)	/* 32x16bit multiply, no shift */
+#define SX_M32X16SR8	(0x5  28)	/* 32x16bit multiply, shift right 8 */
+#define SX_M32X16SR16	(0x6  28)	/* 32x16bit multiply, shift right 16 */
+
+#define SX_MULTIPLY	(0x0  21)	/* normal multiplication */
+#define SX_DOT		(0x1  21)	/* dot product of A and B */
+#define SX_SAXP		(0x2  21)	/* A * SCAM + B */
+
+#define SX_ROUND	(0x1  23)	/* round results */
+
+#define SX_MUL16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
+		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d))	
+#define SX_MUL16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
+		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+#define SX_MUL16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
+		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d))	
+#define SX_MUL16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
+		SX_MULTIPLY | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+
+#define SX_SAXP16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
+		SX_SAXP | ((sa)  14) | ((sb)  7) | (d))	
+#define SX_SAXP16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt)  24) | \
+		SX_SAXP | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+#define SX_SAXP16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
+		SX_SAXP | ((sa)  14) | ((sb)  7) | (d))	
+#define SX_SAXP16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt)  24) | \
+		SX_SAXP | ((sa)  14) | ((sb)  7) | (d) | SX_ROUND)	
+
+/* logic group */
+#define SX_AND_V	(0x0  21)	/* vector AND vector */
+#define SX_AND_S	(0x1  21)	/* vector AND scalar */
+#define SX_AND_I	(0x2  21)	/* vector AND immediate */
+#define SX_XOR_V	(0x3  21)	/* vector XOR vector */
+#define SX_XOR_S	(0x4  21)	/* vector XOR scalar */
+#define SX_XOR_I	(0x5  21)	/* vector XOR immediate */
+#define SX_OR_V		(0x6  21)	/* vector OR vector */
+#define SX_OR_S		(0x7  21)	/* vector OR scalar */
+/* immediates are 7bit sign extended to 32bit */
+
+#define SX_ANDV(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_AND_V | \
+		((sa)  14) | ((sb)  7) | (d))
+#define SX_ANDS(sa, sb, d, cnt) (0xb000 | ((cnt)  24) | SX_AND_S | \
+		

CVS commit: src/sys/arch/sparc/dev

2013-06-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun  4 13:42:37 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
actually map the whole SX IO space instead of just the first page over and
over again (doh)


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.73 src/sys/arch/sparc/dev/cgfourteen.c:1.74
--- src/sys/arch/sparc/dev/cgfourteen.c:1.73	Wed May 29 22:26:39 2013
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Jun  4 13:42:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.73 2013/05/29 22:26:39 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.74 2013/06/04 13:42:37 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -564,7 +564,8 @@ cgfourteenmmap(dev_t dev, off_t off, int
 	} else if (off = CG14_SXIO_VOFF 
 		   off  (CG14_SXIO_VOFF + 0x03ff)) {
 		return (bus_space_mmap(sc-sc_sx-sc_tag, 0x8LL,
-			sc-sc_fb_paddr, prot, BUS_SPACE_MAP_LINEAR));
+			sc-sc_fb_paddr + (off - CG14_SXIO_VOFF),
+			prot, BUS_SPACE_MAP_LINEAR));
 #endif
 	} else
 		return -1;



CVS commit: src/sys/arch/sparc/dev

2013-06-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun  4 22:30:30 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add STore with (plane) Mask instruction


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.5 src/sys/arch/sparc/dev/sxreg.h:1.6
--- src/sys/arch/sparc/dev/sxreg.h:1.5	Thu May 30 20:09:23 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Tue Jun  4 22:30:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.5 2013/05/30 20:09:23 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.6 2013/06/04 22:30:30 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -152,6 +152,8 @@
 SX_PACKED | (dreg  7) | (o))
 #define SX_ST(sreg, cnt, o)  (0x8000 | ((cnt)  23) | SX_STORE | \
 SX_LONG | (sreg  7) | (o))
+#define SX_STM(sreg, cnt, o)  (0x8000 | ((cnt)  23) | SX_STORE_MASK | \
+SX_LONG | (sreg  7) | (o))
 #define SX_STB(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
 SX_UBYTE_0 | (sreg  7) | (o))
 #define SX_STP(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \



CVS commit: src/sys/arch/sparc/dev

2013-06-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun  4 22:31:30 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
report actual VRAM size in fb_type.fb_size


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.74 src/sys/arch/sparc/dev/cgfourteen.c:1.75
--- src/sys/arch/sparc/dev/cgfourteen.c:1.74	Tue Jun  4 13:42:37 2013
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Jun  4 22:31:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.74 2013/06/04 13:42:37 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.75 2013/06/04 22:31:30 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -228,7 +228,7 @@ cgfourteenattach(device_t parent, device
 	struct cgfourteen_softc *sc = device_private(self);
 	struct fbdevice *fb = sc-sc_fb;
 	bus_space_handle_t bh;
-	int node, ramsize;
+	int node;
 	volatile uint32_t *lut;
 	int i, isconsole, items;
 	uint32_t fbva[2] = {0, 0};
@@ -254,10 +254,8 @@ cgfourteenattach(device_t parent, device
 	fb-fb_type.fb_depth = 32;
 
 	fb_setsize_obp(fb, sc-sc_fb.fb_type.fb_depth, 1152, 900, node);
-	ramsize = roundup(fb-fb_type.fb_height * fb-fb_linebytes, NBPG);
 
 	fb-fb_type.fb_cmsize = CG14_CLUT_SIZE;
-	fb-fb_type.fb_size = ramsize + COLOUR_OFFSET;
 
 	if (sa-sa_nreg  2) {
 		printf(%s: only %d register sets\n,
@@ -268,6 +266,7 @@ cgfourteenattach(device_t parent, device
 	  sa-sa_nreg * sizeof(struct sbus_reg));
 
 	sc-sc_vramsize = sc-sc_physadr[CG14_PXL_IDX].sbr_size;
+	fb-fb_type.fb_size = sc-sc_vramsize;
 
 	printf(: %d MB VRAM, (uint32_t)(sc-sc_vramsize  20));
 	/*
@@ -329,7 +328,7 @@ cgfourteenattach(device_t parent, device
 		if (sbus_bus_map( sc-sc_bustag,
 		sc-sc_physadr[CG14_PXL_IDX].sbr_slot,
 		sc-sc_physadr[CG14_PXL_IDX].sbr_offset,
-		ramsize, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE,
+		sc-sc_vramsize, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE,
 		bh) != 0) {
 			printf(%s: cannot map pixels\n, 
 device_xname(sc-sc_dev));



CVS commit: src/sys/arch/sparc/dev

2013-05-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 30 20:09:23 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add SX_SELECT_S instruction


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.4 src/sys/arch/sparc/dev/sxreg.h:1.5
--- src/sys/arch/sparc/dev/sxreg.h:1.4	Wed May 29 22:25:23 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Thu May 30 20:09:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.4 2013/05/29 22:25:23 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.5 2013/05/30 20:09:23 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -171,4 +171,6 @@
 
 #define SX_ROP(sa, sb, d, cnt) (0x9000 | ((cnt)  24) | SX_ROPL | \
 		((sa)  14) | (sb) | ((d)  7))
+#define SX_SELECT_S(sa, sb, d, cnt) (0x9000 | ((cnt)  24) | SX_SELS | \
+		((sa)  14) | (sb) | ((d)  7))
 #endif /* SXREG_H */



CVS commit: src/sys/arch/sparc/dev

2013-05-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed May 29 22:25:23 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
fix a typo


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.3 src/sys/arch/sparc/dev/sxreg.h:1.4
--- src/sys/arch/sparc/dev/sxreg.h:1.3	Wed Feb  6 20:39:03 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed May 29 22:25:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.3 2013/02/06 20:39:03 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.4 2013/05/29 22:25:23 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 /*
  * registers are repeated at 0x1000 with certain parts read only
- * ( like the PAGE_BOUND registers ) which userlanf has no business writing to
+ * ( like the PAGE_BOUND registers ) which userland has no business writing to
  */
 
 /* SX_CONTROL_STATUS */



CVS commit: src/sys/arch/sparc/dev

2013-05-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed May 29 22:26:39 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c cgfourteenvar.h

Log Message:
allow userland to map SX registers and IO space


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/dev/cgfourteenvar.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.72 src/sys/arch/sparc/dev/cgfourteen.c:1.73
--- src/sys/arch/sparc/dev/cgfourteen.c:1.72	Tue Feb 12 22:24:47 2013
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed May 29 22:26:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.72 2013/02/12 22:24:47 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.73 2013/05/29 22:26:39 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -554,8 +554,26 @@ cgfourteenmmap(dev_t dev, off_t off, int
 		   off  CG14_R32_VOFF + (sc-sc_vramsize  2)) {
 		offset = sc-sc_fbaddr + CG14_FB_PR32;
 		off -= CG14_R32_VOFF;
+#if NSX  0
+	} else if (sc-sc_sx == NULL) {
+		return -1;
+	} else if (off = CG14_SXREG_VOFF 
+		   off  (CG14_SXREG_VOFF + 0x400)) {
+		return (bus_space_mmap(sc-sc_sx-sc_tag, sc-sc_sx-sc_uregs,
+			0, prot, BUS_SPACE_MAP_LINEAR));
+	} else if (off = CG14_SXIO_VOFF 
+		   off  (CG14_SXIO_VOFF + 0x03ff)) {
+		return (bus_space_mmap(sc-sc_sx-sc_tag, 0x8LL,
+			sc-sc_fb_paddr, prot, BUS_SPACE_MAP_LINEAR));
+#endif
 	} else
 		return -1;
+	/*
+	 * for convenience we also map the SX ranges here:
+	 * - one page userland registers
+	 * - CG14-sized IO space at 0x8 ( not a typo, it's above 4GB )
+	 * bus_space_mmap() should accept 64bit bus_addr_t's by the look of it
+	 */
 	return (bus_space_mmap(sc-sc_bustag, offset, off, prot,
 		BUS_SPACE_MAP_LINEAR));
 }
@@ -1203,6 +1221,7 @@ cg14_rectfill(struct cgfourteen_softc *s
 	 * until we're 32bit aligned, then do the rest in 32bit
 	 * mode. Assumes that stride is always a multiple of 4. 
 	 */ 
+	/* TODO: use 32bit writes with byte mask instead */
 	pre = addr  3;
 	if (pre != 0) pre = 4 - pre;
 	for (line = 0; line  he; line++) {
@@ -1241,6 +1260,7 @@ cg14_invert(struct cgfourteen_softc *sc,
 	 * until we're 32bit aligned, then do the rest in 32bit
 	 * mode. Assumes that stride is always a multiple of 4. 
 	 */ 
+	/* TODO: use 32bit writes with byte mask instead */
 	pre = addr  3;
 	if (pre != 0) pre = 4 - pre;
 	for (line = 0; line  he; line++) {
@@ -1356,6 +1376,7 @@ cg14_bitblt(void *cookie, int xs, int ys
 		}
 	} else {
 		/* unaligned, have to use byte mode */
+		/* funnel shifter  byte mask trickery? */
 		for (line = 0; line  he; line++) {
 			sptr = saddr;
 			dptr = daddr;

Index: src/sys/arch/sparc/dev/cgfourteenvar.h
diff -u src/sys/arch/sparc/dev/cgfourteenvar.h:1.15 src/sys/arch/sparc/dev/cgfourteenvar.h:1.16
--- src/sys/arch/sparc/dev/cgfourteenvar.h:1.15	Wed Feb  6 04:10:54 2013
+++ src/sys/arch/sparc/dev/cgfourteenvar.h	Wed May 29 22:26:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteenvar.h,v 1.15 2013/02/06 04:10:54 macallan Exp $ */
+/*	$NetBSD: cgfourteenvar.h,v 1.16 2013/05/29 22:26:39 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -120,6 +120,7 @@ struct cgfourteen_softc {
 #define CG14_CLUT1_VOFF		0x4000	/* Color Look Up Table */
 #define CG14_CLUT2_VOFF		0x5000	/* Color Look Up Table */
 #define CG14_CLUT3_VOFF		0x6000	/* Color Look Up Table */
+#define CG14_SXREG_VOFF		0x0001	/* SX userspace registers */
 #define CG14_DIRECT_VOFF	0x1000
 #define CG14_CTLREG_VOFF	0x2000
 #define CG14_CURSOR_VOFF	0x3000
@@ -132,3 +133,4 @@ struct cgfourteen_softc {
 #define CG14_B32_VOFF		0xa000
 #define CG14_G32_VOFF		0xb000
 #define CG14_R32_VOFF		0xc000
+#define CG14_SXIO_VOFF		0xd000



CVS commit: src/sys/arch/sparc/dev

2013-03-24 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Mar 24 17:50:26 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: obio.c

Log Message:
Check if sbus is defined in the kernel configuration before using it.
From Taylor R Campbell.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sparc/dev/obio.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/sparc/dev/obio.c
diff -u src/sys/arch/sparc/dev/obio.c:1.73 src/sys/arch/sparc/dev/obio.c:1.74
--- src/sys/arch/sparc/dev/obio.c:1.73	Sat Oct 27 17:18:11 2012
+++ src/sys/arch/sparc/dev/obio.c	Sun Mar 24 17:50:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.73 2012/10/27 17:18:11 chs Exp $	*/
+/*	$NetBSD: obio.c,v 1.74 2013/03/24 17:50:26 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1997,1998 The NetBSD Foundation, Inc.
@@ -30,10 +30,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: obio.c,v 1.73 2012/10/27 17:18:11 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: obio.c,v 1.74 2013/03/24 17:50:26 jdc Exp $);
 
 #include locators.h
 
+#ifdef _KERNEL_OPT
+#include sbus.h
+#endif
+
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
@@ -47,7 +51,9 @@ __KERNEL_RCSID(0, $NetBSD: obio.c,v 1.7
 #include uvm/uvm_extern.h
 
 #include sys/bus.h
+#if NSBUS  0
 #include sparc/dev/sbusvar.h
+#endif
 #include machine/autoconf.h
 #include machine/oldmon.h
 #include machine/cpu.h
@@ -64,7 +70,9 @@ struct obio4_softc {
 
 union obio_softc {
 	struct	obio4_softc sc_obio;	/* sun4 obio */
+#if NSBUS  0
 	struct	sbus_softc sc_sbus;	/* sun4m obio is another sbus slot */
+#endif
 };
 
 
@@ -97,6 +105,7 @@ static	int _obio_bus_map(bus_space_tag_t
 static struct sparc_bus_space_tag obio_space_tag;
 #endif
 
+#if NSBUS  0
 /*
  * Translate obio `interrupts' property value to processor IPL (see sbus.c)
  * Apparently, the `interrupts' property on obio devices is just
@@ -105,6 +114,7 @@ static struct sparc_bus_space_tag obio_s
 static int intr_obio2ipl[] = {
 	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
 };
+#endif
 
 static int
 obiomatch(device_t parent, struct cfdata *cf, void *aux)
@@ -163,6 +173,7 @@ obioattach(device_t parent, device_t sel
 #endif
 		return;
 	} else if (CPU_ISSUN4M) {
+#if NSBUS  0
 		/*
 		 * Attach the on-board I/O bus at on a sun4m.
 		 * In this case we treat the obio bus as another sbus slot.
@@ -189,6 +200,7 @@ obioattach(device_t parent, device_t sel
 		sc-sc_intr2ipl = intr_obio2ipl;
 
 		sbus_attach_common(sc, obio, ma-ma_node, special4m);
+#endif
 	} else {
 		printf(obio on this machine?\n);
 	}



CVS commit: src/sys/arch/sparc/dev

2013-02-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 12 22:24:48 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
break some more long lines


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.71 src/sys/arch/sparc/dev/cgfourteen.c:1.72
--- src/sys/arch/sparc/dev/cgfourteen.c:1.71	Thu Feb  7 16:14:30 2013
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Feb 12 22:24:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.71 2013/02/07 16:14:30 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.72 2013/02/12 22:24:47 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -150,7 +150,8 @@ static int  cg14_do_cursor(struct cgfour
 
 #if NSX  0
 static void cg14_wait_idle(struct cgfourteen_softc *);
-static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int, uint32_t);
+static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int,
+uint32_t);
 static void cg14_invert(struct cgfourteen_softc *, int, int, int, int);
 static void cg14_bitblt(void *, int, int, int, int, int, int, int);
 
@@ -283,7 +284,8 @@ cgfourteenattach(device_t parent, device
 			 sa-sa_size,
 			 0 /*BUS_SPACE_MAP_LINEAR*/,
 			 bh) != 0) {
-		printf(%s: cannot map control registers\n, device_xname(self));
+		printf(%s: cannot map control registers\n,
+		device_xname(self));
 		return;
 	}
 	sc-sc_regh = bh;
@@ -1326,8 +1328,10 @@ cg14_bitblt(void *cookie, int xs, int ys
 			dptr = daddr;
 			cnt = wi;
 			if (pre  0) {
-sta(sptr, ASI_SX, SX_LDB(32, pre - 1, sptr  7));
-sta(dptr, ASI_SX, SX_STB(32, pre - 1, dptr  7));
+sta(sptr, ASI_SX,
+SX_LDB(32, pre - 1, sptr  7));
+sta(dptr, ASI_SX,
+SX_STB(32, pre - 1, dptr  7));
 cnt -= pre;
 sptr += pre;
 dptr += pre;
@@ -1342,8 +1346,10 @@ cg14_bitblt(void *cookie, int xs, int ys
 cnt -= num  2;
 			}
 			if (cnt  0) {
-sta(sptr, ASI_SX, SX_LDB(32, cnt - 1, sptr  7));
-sta(dptr, ASI_SX, SX_STB(32, cnt - 1, dptr  7));
+sta(sptr, ASI_SX,
+SX_LDB(32, cnt - 1, sptr  7));
+sta(dptr, ASI_SX,
+SX_STB(32, cnt - 1, dptr  7));
 			}
 			saddr += skip;
 			daddr += skip;
@@ -1362,8 +1368,10 @@ cg14_bitblt(void *cookie, int xs, int ys
 cnt -= 32;
 			}
 			if (cnt  0) {
-sta(sptr, ASI_SX, SX_LDB(32, cnt - 1, sptr  7));
-sta(dptr, ASI_SX, SX_STB(32, cnt - 1, dptr  7));
+sta(sptr, ASI_SX,
+SX_LDB(32, cnt - 1, sptr  7));
+sta(dptr, ASI_SX,
+SX_STB(32, cnt - 1, dptr  7));
 			}
 			saddr += skip;
 			daddr += skip;
@@ -1416,7 +1424,8 @@ cg14_putchar(void *cookie, int row, int 
 			uint32_t reg;
 			for (i = 0; i  he; i++) {
 reg = *data8;
-sx_write(sc-sc_sx, SX_QUEUED(R_MASK), reg  24);
+sx_write(sc-sc_sx, SX_QUEUED(R_MASK),
+reg  24);
 sta(addr, ASI_SX, SX_STBS(8, wi - 1, addr  7));
 data8++;
 addr += stride;
@@ -1428,7 +1437,8 @@ cg14_putchar(void *cookie, int row, int 
 			uint32_t reg;
 			for (i = 0; i  he; i++) {
 reg = *data16;
-sx_write(sc-sc_sx, SX_QUEUED(R_MASK), reg  16);
+sx_write(sc-sc_sx, SX_QUEUED(R_MASK),
+reg  16);
 sta(addr, ASI_SX, SX_STBS(8, wi - 1, addr  7));
 data16++;
 addr += stride;



CVS commit: src/sys/arch/sparc/dev

2013-02-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb  7 16:14:30 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
- implement buttom-up copies in cg14_bitblt() so scrolling down works now
- use more registers when copying
- use hardware to draw the cursor
- use putchar() for horizontal scrolling since byte-wise overlapping copy
  ops wouldn't be any faster anyway


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.70 src/sys/arch/sparc/dev/cgfourteen.c:1.71
--- src/sys/arch/sparc/dev/cgfourteen.c:1.70	Wed Feb  6 04:10:54 2013
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Feb  7 16:14:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.70 2013/02/06 04:10:54 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.71 2013/02/07 16:14:30 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -151,12 +151,13 @@ static int  cg14_do_cursor(struct cgfour
 #if NSX  0
 static void cg14_wait_idle(struct cgfourteen_softc *);
 static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int, uint32_t);
+static void cg14_invert(struct cgfourteen_softc *, int, int, int, int);
 static void cg14_bitblt(void *, int, int, int, int, int, int, int);
 
 #if 0
-static void cg14_cursor(void *, int, int, int);
 static void cg14_putchar_aa(void *, int, int, u_int, long);
 #endif
+static void cg14_cursor(void *, int, int, int);
 static void cg14_putchar(void *, int, int, u_int, long);
 static void cg14_copycols(void *, int, int, int, int);
 static void cg14_erasecols(void *, int, int, int, long);
@@ -360,14 +361,13 @@ cgfourteenattach(device_t parent, device
 		sc-sc_fbaddr, 0, 0, 0)  0xf000;
 		aprint_normal_dev(sc-sc_dev, using %s\n, 
 		device_xname(sc-sc_sx-sc_dev));
-		aprint_normal_dev(sc-sc_dev, fb paddr: %08x\n,
+		aprint_debug_dev(sc-sc_dev, fb paddr: %08x\n,
 		sc-sc_fb_paddr);
-#if 0
 		sx_write(sc-sc_sx, SX_PAGE_BOUND_LOWER, sc-sc_fb_paddr);
 		sx_write(sc-sc_sx, SX_PAGE_BOUND_UPPER,
 		sc-sc_fb_paddr + 0x03ff);
-#endif
 	}
+	cg14_wait_idle(sc);
 #endif
 	cg14_setup_wsdisplay(sc, isconsole);
 #endif
@@ -1012,7 +1012,13 @@ cg14_init_screen(void *cookie, struct vc
 
 	ri-ri_bits = (char *)sc-sc_fb.fb_pixels;
 #if NSX  0
-	if (sc-sc_sx == NULL)
+	/*
+	 * unaligned copies with horizontal overlap are slow, so don't bother
+	 * handling them in cg14_bitblt() and use putchar() instead
+	 */
+	if (sc-sc_sx != NULL) {
+		scr-scr_flags |= VCONS_NO_COPYCOLS;
+	} else
 #endif
 	scr-scr_flags |= VCONS_DONT_READ;
 
@@ -1034,8 +1040,8 @@ cg14_init_screen(void *cookie, struct vc
 		ri-ri_ops.copycols = cg14_copycols;
 		ri-ri_ops.eraserows = cg14_eraserows;
 		ri-ri_ops.erasecols = cg14_erasecols;
-#if 0
 		ri-ri_ops.cursor = cg14_cursor;
+#if 0
 		if (FONT_IS_ALPHA(ri-ri_font)) {
 			ri-ri_ops.putchar = cg14_putchar_aa;
 		} else
@@ -1184,25 +1190,112 @@ cg14_rectfill(struct cgfourteen_softc *s
  uint32_t colour)
 {
 	uint32_t addr, pptr;
-	int line, cnt;
+	int line, cnt, pre, words;
 	int stride = sc-sc_fb.fb_type.fb_width;
 
 	addr = sc-sc_fb_paddr + x + stride * y;
 	sx_write(sc-sc_sx, SX_QUEUED(8), colour);
 	sx_write(sc-sc_sx, SX_QUEUED(9), colour);
+	/*
+	 * Calculate the number of pixels we need to do one by one
+	 * until we're 32bit aligned, then do the rest in 32bit
+	 * mode. Assumes that stride is always a multiple of 4. 
+	 */ 
+	pre = addr  3;
+	if (pre != 0) pre = 4 - pre;
 	for (line = 0; line  he; line++) {
 		pptr = addr;
 		cnt = wi;
-		while(cnt  32) {
-			sta(pptr, ASI_SX, SX_STBS(8, 31, pptr  7));
-			pptr += 32;
-			cnt -= 32;
+		if (pre) {
+			sta(pptr, ASI_SX, SX_STBS(8, pre - 1, pptr  7));
+			pptr += pre;
+			cnt -= pre;
 		}
+		/* now do the aligned pixels in 32bit chunks */
+		while(cnt  31) {
+			words = min(32, cnt  2);
+			sta(pptr, ASI_SX, SX_STS(8, words - 1, pptr  7));
+			pptr += words  2;
+			cnt -= words  2;
+		}
+		/* do any remaining pixels byte-wise again */
 		if (cnt  0)
 			sta(pptr, ASI_SX, SX_STBS(8, cnt - 1, pptr  7));
 		addr += stride;
 	}
-	cg14_wait_idle(sc);
+}
+
+static void
+cg14_invert(struct cgfourteen_softc *sc, int x, int y, int wi, int he)
+{
+	uint32_t addr, pptr;
+	int line, cnt, pre, words;
+	int stride = sc-sc_fb.fb_type.fb_width;
+
+	addr = sc-sc_fb_paddr + x + stride * y;
+	sx_write(sc-sc_sx, SX_ROP_CONTROL, 0x33); /* ~src a */
+	/*
+	 * Calculate the number of pixels we need to do one by one
+	 * until we're 32bit aligned, then do the rest in 32bit
+	 * mode. Assumes that stride is always a multiple of 4. 
+	 */ 
+	pre = addr  3;
+	if (pre != 0) pre = 4 - pre;
+	for (line = 0; line  he; line++) {
+		pptr = addr;
+		cnt = wi;
+		if (pre) {
+			sta(pptr, ASI_SX, SX_LDB(8, pre - 1, pptr  7));
+			sx_write(sc-sc_sx, SX_INSTRUCTIONS,
+			  

CVS commit: src/sys/arch/sparc/dev

2013-02-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb  6 20:39:03 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add SX_ROP instruction


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.2 src/sys/arch/sparc/dev/sxreg.h:1.3
--- src/sys/arch/sparc/dev/sxreg.h:1.2	Wed Feb  6 04:06:29 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed Feb  6 20:39:03 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.2 2013/02/06 04:06:29 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.3 2013/02/06 20:39:03 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -161,4 +161,14 @@
 #define SX_STBS(reg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE_SELECT \
 | SX_UBYTE_0 | (reg  7) | (o))
 
+/* ROP instruction */
+#define SX_ROPB	(0x0  21)	/* mask bits apply to bytes */
+#define SX_ROPM	(0x1  21)	/* mask bits apply to each bit */
+#define SX_ROPL	(0x2  21)	/* mask bits apply per register */
+#define SX_SELB	(0x4  21)	/* byte select scalar */
+#define SX_SELV (0x6  21)	/* register select vector */
+#define SX_SELS (0x7  21)	/* register select scalar */
+
+#define SX_ROP(sa, sb, d, cnt) (0x9000 | ((cnt)  24) | SX_ROPL | \
+		((sa)  14) | (sb) | ((d)  7))
 #endif /* SXREG_H */



CVS commit: src/sys/arch/sparc/dev

2013-02-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb  5 21:45:40 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c cgfourteenvar.h

Log Message:
throw out RASTERCONSOLE goo


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/dev/cgfourteenvar.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.68 src/sys/arch/sparc/dev/cgfourteen.c:1.69
--- src/sys/arch/sparc/dev/cgfourteen.c:1.68	Sat Oct 27 17:18:11 2012
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Feb  5 21:45:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.68 2012/10/27 17:18:11 chs Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.69 2013/02/05 21:45:39 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -128,8 +128,6 @@ static struct fbdriver cgfourteenfbdrive
 	cgfourteenpoll, cgfourteenmmap, nokqfilter
 };
 
-extern struct tty *fbconstty;
-
 static void cg14_set_video(struct cgfourteen_softc *, int);
 static int  cg14_get_video(struct cgfourteen_softc *);
 static int  cg14_get_cmap(struct fbcmap *, union cg14cmap *, int);
@@ -149,10 +147,6 @@ static int  cg14_do_cursor(struct cgfour
struct wsdisplay_cursor *);
 #endif
 
-#if defined(RASTERCONSOLE)  (NWSDISPLAY  0)
-#error You can't have it both ways - either RASTERCONSOLE or wsdisplay
-#endif
-
 /*
  * Match a cgfourteen.
  */
@@ -184,18 +178,6 @@ cgfourteenmatch(device_t parent, struct 
  */
 #define COLOUR_OFFSET (256*1024)
 
-#ifdef RASTERCONSOLE
-static void cg14_set_rcons_luts(struct cgfourteen_softc *sc)
-{
-	int i;
-
-	for (i=0;iCG14_CLUT_SIZE;i++) sc-sc_xlut-xlut_lut[i] = 0x22;
-	for (i=0;iCG14_CLUT_SIZE;i++) sc-sc_clut2-clut_lut[i] = 0x00ff;
-	sc-sc_clut2-clut_lut[0] = 0x00ff;
-	sc-sc_clut2-clut_lut[255] = 0;
-}
-#endif /* RASTERCONSOLE */
-
 #if NWSDISPLAY  0
 static int	cg14_ioctl(void *, void *, u_long, void *, int, struct lwp *);
 static paddr_t	cg14_mmap(void *, void *, off_t, int);
@@ -315,40 +297,6 @@ cgfourteenattach(device_t parent, device
 	/* See if we're the console */
 isconsole = fb_is_console(node);
 
-#if defined(RASTERCONSOLE)
-	if (isconsole) {
-		printf( (console)\n);
-		/* *sbus*_bus_map?  but that's how we map the regs... */
-		if (sbus_bus_map( sc-sc_bustag,
-  sc-sc_physadr[CG14_PXL_IDX].sbr_slot,
-  sc-sc_physadr[CG14_PXL_IDX].sbr_offset +
-0x0380,
-  1152 * 900, BUS_SPACE_MAP_LINEAR,
-  bh) != 0) {
-			printf(%s: cannot map pixels\n,
-			device_xname(sc-sc_dev));
-			return;
-		}
-		sc-sc_rcfb = sc-sc_fb;
-		sc-sc_rcfb.fb_type.fb_type = FBTYPE_SUN3COLOR;
-		sc-sc_rcfb.fb_type.fb_depth = 8;
-		sc-sc_rcfb.fb_linebytes = 1152;
-		sc-sc_rcfb.fb_type.fb_size = roundup(1152*900,NBPG);
-		sc-sc_rcfb.fb_pixels = (void *)bh;
-
-		printf(vram at %p\n,(void *)bh);
-		/* XXX should use actual screen size */
-
-		for (i = 0; i  ramsize; i++)
-		((unsigned char *)bh)[i] = 0;
-		fbrcons_init(sc-sc_rcfb);
-		cg14_set_rcons_luts(sc);
-		sc-sc_ctl-ctl_mctl = CG14_MCTL_ENABLEVID | 
-		CG14_MCTL_PIXMODE_32 | CG14_MCTL_POWERCTL;
-	} else
-		printf(\n);
-#endif
-
 #if NWSDISPLAY  0
 	prom_getprop(sa-sa_node, address, 4, items, ptr);
 	if (fbva[1] == 0) {

Index: src/sys/arch/sparc/dev/cgfourteenvar.h
diff -u src/sys/arch/sparc/dev/cgfourteenvar.h:1.13 src/sys/arch/sparc/dev/cgfourteenvar.h:1.14
--- src/sys/arch/sparc/dev/cgfourteenvar.h:1.13	Tue Aug 31 21:14:57 2010
+++ src/sys/arch/sparc/dev/cgfourteenvar.h	Tue Feb  5 21:45:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteenvar.h,v 1.13 2010/08/31 21:14:57 macallan Exp $ */
+/*	$NetBSD: cgfourteenvar.h,v 1.14 2013/02/05 21:45:39 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -74,9 +74,6 @@ struct cg14_cursor {		/* cg14 hardware c
 struct cgfourteen_softc {
 	device_t	sc_dev;		/* base device */
 	struct fbdevice	sc_fb;		/* frame buffer device */
-#ifdef RASTERCONSOLE
-	struct fbdevice	sc_rcfb;	/* sc_fb variant for rcons */
-#endif
 	bus_space_tag_t	sc_bustag;
 	struct sbus_reg	sc_physadr[2];	/* phys addrs of h/w */
 	bus_space_handle_t sc_regh;	/* register space */



CVS commit: src/sys/arch/sparc/dev

2013-02-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb  6 04:06:29 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: sx.c sxreg.h

Log Message:
fix typos, deal with hardware insanity


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc/dev/sx.c \
src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sx.c
diff -u src/sys/arch/sparc/dev/sx.c:1.1 src/sys/arch/sparc/dev/sx.c:1.2
--- src/sys/arch/sparc/dev/sx.c:1.1	Tue Feb  5 21:52:48 2013
+++ src/sys/arch/sparc/dev/sx.c	Wed Feb  6 04:06:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sx.c,v 1.1 2013/02/05 21:52:48 macallan Exp $	*/
+/*	$NetBSD: sx.c,v 1.2 2013/02/06 04:06:29 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sx.c,v 1.1 2013/02/05 21:52:48 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: sx.c,v 1.2 2013/02/06 04:06:29 macallan Exp $);
 
 #include locators.h
 
@@ -50,8 +50,6 @@ __KERNEL_RCSID(0, $NetBSD: sx.c,v 1.1 2
 #include sparc/dev/sxvar.h
 #include sparc/dev/sxreg.h
 
-
-
 /* autoconfiguration driver */
 static	int sx_match(device_t, struct cfdata *, void *);
 static	void sx_attach(device_t, device_t, void *);
@@ -111,11 +109,11 @@ sx_attach(device_t parent, device_t self
 	sx_write(sc, SX_CONTROL_STATUS, SX_PB | SX_GO);
 
 #ifdef SX_DEBUG
-	sta(0xfc00, ASI_SX, SX_LD(8, 31));
+	sta(0xfc00, ASI_SX, SX_LD(8, 31, 0));
 	for (i = 1; i  60; i++)
-		sta(0xfc00 + (i * 1280), ASI_SX, SX_ST(8, 31));
+		sta(0xfc00 + (i * 1280), ASI_SX, SX_ST(8, 31, 0));
 	for (i = 900; i  1000; i++)
-		sta(0xfc00 + (i * 1280) + 600, ASI_SX, SX_ST(0, 31));
+		sta(0xfc00 + (i * 1280) + 600, ASI_SX, SX_ST(0, 31, 0));
 
 	for (i = 0; i  0x30; i+= 16) {
 		printf(%08x:, i);
Index: src/sys/arch/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.1 src/sys/arch/sparc/dev/sxreg.h:1.2
--- src/sys/arch/sparc/dev/sxreg.h:1.1	Tue Feb  5 21:52:48 2013
+++ src/sys/arch/sparc/dev/sxreg.h	Wed Feb  6 04:06:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.1 2013/02/05 21:52:48 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.2 2013/02/06 04:06:29 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -53,6 +53,12 @@
 /* write registers via pseudo instructions */
 #define SX_QUEUED_R0		0x0300
 #define SX_QUEUED_R1		0x0304	/* and so on until R127 */
+#define SX_QUEUED(r)		(0x300 + (r  2))
+
+/* special purpose registers */
+#define R_ZERO	0
+#define R_SCAM	1
+#define R_MASK	2	/* bitmask for SX_STORE_SELECT */
 
 /*
  * registers are repeated at 0x1000 with certain parts read only
@@ -99,7 +105,7 @@
 #define SX_STORE_COND	(0x4  19)	/* conditional write with mask */
 #define SX_STORE_CLAMP	(0x2  19)
 #define SX_STORE_MASK	(0x1  19)	/* apply plane mask */
-#define SX_STORE_SELECT	(0x9  19)	/* expand with plane reg dest[0]/dest[1] */
+#define SX_STORE_SELECT	(0x8  19)	/* expand with plane reg dest[0]/dest[1] */
 #define SX_LOAD		(0xa  19)
 #define SX_STORE	(0x0  19)
 
@@ -138,13 +144,21 @@
 #define SX_PACKED	(0x1f  14)
 
 
-#define SX_LD(dreg, cnt)  (0x8000 | (cnt  23) | SX_STORE | SX_LONG | (dreg  7))
-#define SX_LDB(dreg, cnt) (0x8000 | (cnt  23) | SX_STORE | SX_UBYTE_0 | (dreg  7))
-#define SX_LDP(dreg, cnt) (0x8000 | (cnt  23) | SX_STORE | SX_PACKED | (dreg  7))
-#define SX_ST(sreg, cnt)  (0x8000 | (cnt  23) | SX_LOAD  | SX_LONG | (sreg  7))
-#define SX_STB(sreg, cnt) (0x8000 | (cnt  23) | SX_LOAD  | SX_UBYTE_0 | (sreg  7))
-#define SX_STP(sreg, cnt) (0x8000 | (cnt  23) | SX_LOAD  | SX_PACKED | (sreg  7))
-#define SX_STS(sreg, cnt) (0x8000 | (cnt  23) | SX_STORE_SELECT | SX_LONG | (sreg  7))
-#define SX_STBS(reg, cnt) (0x8000 | (cnt  23) | SX_STORE_SELECT | SX_UBYTE_0 | (reg  7))
+#define SX_LD(dreg, cnt, o)  (0x8000 | ((cnt)  23) | SX_LOAD | \
+SX_LONG | (dreg  7) | (o))
+#define SX_LDB(dreg, cnt, o) (0x8000 | ((cnt)  23) | SX_LOAD | \
+SX_UBYTE_0 | (dreg  7) | (o))
+#define SX_LDP(dreg, cnt, o) (0x8000 | ((cnt)  23) | SX_LOAD | \
+SX_PACKED | (dreg  7) | (o))
+#define SX_ST(sreg, cnt, o)  (0x8000 | ((cnt)  23) | SX_STORE | \
+SX_LONG | (sreg  7) | (o))
+#define SX_STB(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
+SX_UBYTE_0 | (sreg  7) | (o))
+#define SX_STP(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE | \
+SX_PACKED | (sreg  7) | (o))
+#define SX_STS(sreg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE_SELECT \
+| SX_LONG | (sreg  7) | (o))
+#define SX_STBS(reg, cnt, o) (0x8000 | ((cnt)  23) | SX_STORE_SELECT \
+| SX_UBYTE_0 | (reg  7) | (o))
 
 #endif /* SXREG_H */



CVS commit: src/sys/arch/sparc/dev

2013-02-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb  6 04:10:55 UTC 2013

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c cgfourteenvar.h

Log Message:
use SX for basic hardware acceleration
not quite complete yet but good enough to be useful
missing things include:
- backwards blits
- ROP support
- the cursor is still drawn by software


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/dev/cgfourteenvar.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.69 src/sys/arch/sparc/dev/cgfourteen.c:1.70
--- src/sys/arch/sparc/dev/cgfourteen.c:1.69	Tue Feb  5 21:45:39 2013
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Feb  6 04:10:54 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.69 2013/02/05 21:45:39 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.70 2013/02/06 04:10:54 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -53,8 +53,6 @@
 
 /*
  * Driver for Campus-II on-board mbus-based video (cgfourteen).
- * Provides minimum emulation of a Sun cgthree 8-bit framebuffer to
- * allow X to run.
  *
  * Does not handle interrupts, even though they can occur.
  *
@@ -68,6 +66,9 @@
  */
 #undef CG14_MAP_REGS
 
+#include opt_wsemul.h
+#include sx.h
+
 #include sys/param.h
 #include sys/systm.h
 #include sys/buf.h
@@ -96,10 +97,11 @@
 
 #include dev/wscons/wsdisplay_vconsvar.h
 
+#include sparc/sparc/asm.h
 #include sparc/dev/cgfourteenreg.h
 #include sparc/dev/cgfourteenvar.h
-
-#include opt_wsemul.h
+#include sparc/dev/sxreg.h
+#include sparc/dev/sxvar.h
 
 /* autoconfiguration driver */
 static int	cgfourteenmatch(device_t, struct cfdata *, void *);
@@ -145,6 +147,23 @@ static void cg14_set_depth(struct cgfour
 static void cg14_move_cursor(struct cgfourteen_softc *, int, int);
 static int  cg14_do_cursor(struct cgfourteen_softc *,
struct wsdisplay_cursor *);
+
+#if NSX  0
+static void cg14_wait_idle(struct cgfourteen_softc *);
+static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int, uint32_t);
+static void cg14_bitblt(void *, int, int, int, int, int, int, int);
+
+#if 0
+static void cg14_cursor(void *, int, int, int);
+static void cg14_putchar_aa(void *, int, int, u_int, long);
+#endif
+static void cg14_putchar(void *, int, int, u_int, long);
+static void cg14_copycols(void *, int, int, int, int);
+static void cg14_erasecols(void *, int, int, int, long);
+static void cg14_copyrows(void *, int, int, int);
+static void cg14_eraserows(void *, int, int, long);
+#endif /* NSX  0 */
+
 #endif
 
 /*
@@ -212,6 +231,10 @@ cgfourteenattach(device_t parent, device
 	int i, isconsole, items;
 	uint32_t fbva[2] = {0, 0};
 	uint32_t *ptr = fbva;
+#if NSX  0
+	device_t dv;
+	deviter_t di;
+#endif
 
 	sc-sc_dev = self;
 	sc-sc_opens = 0;
@@ -320,6 +343,32 @@ cgfourteenattach(device_t parent, device
 		printf(\n);
 
 	sc-sc_depth = 8;
+
+#if NSX  0
+	/* see if we've got an SX to help us */
+	sc-sc_sx = NULL;
+	for (dv = deviter_first(di, DEVITER_F_ROOT_FIRST);
+	dv != NULL;
+	dv = deviter_next(di)) {
+		if (device_is_a(dv, sx)) {
+			sc-sc_sx = device_private(dv);
+		}
+	}
+	deviter_release(di);
+	if (sc-sc_sx != NULL) {
+		sc-sc_fb_paddr = bus_space_mmap(sc-sc_bustag,
+		sc-sc_fbaddr, 0, 0, 0)  0xf000;
+		aprint_normal_dev(sc-sc_dev, using %s\n, 
+		device_xname(sc-sc_sx-sc_dev));
+		aprint_normal_dev(sc-sc_dev, fb paddr: %08x\n,
+		sc-sc_fb_paddr);
+#if 0
+		sx_write(sc-sc_sx, SX_PAGE_BOUND_LOWER, sc-sc_fb_paddr);
+		sx_write(sc-sc_sx, SX_PAGE_BOUND_UPPER,
+		sc-sc_fb_paddr + 0x03ff);
+#endif
+	}
+#endif
 	cg14_setup_wsdisplay(sc, isconsole);
 #endif
 
@@ -962,6 +1011,9 @@ cg14_init_screen(void *cookie, struct vc
 	ri-ri_flg = RI_CENTER | RI_FULLCLEAR;
 
 	ri-ri_bits = (char *)sc-sc_fb.fb_pixels;
+#if NSX  0
+	if (sc-sc_sx == NULL)
+#endif
 	scr-scr_flags |= VCONS_DONT_READ;
 
 	if (existing) {
@@ -976,6 +1028,21 @@ cg14_init_screen(void *cookie, struct vc
 	sc-sc_fb.fb_type.fb_width / ri-ri_font-fontwidth);
 
 	ri-ri_hw = scr;
+#if NSX  0
+	if (sc-sc_sx != NULL) {
+		ri-ri_ops.copyrows = cg14_copyrows;
+		ri-ri_ops.copycols = cg14_copycols;
+		ri-ri_ops.eraserows = cg14_eraserows;
+		ri-ri_ops.erasecols = cg14_erasecols;
+#if 0
+		ri-ri_ops.cursor = cg14_cursor;
+		if (FONT_IS_ALPHA(ri-ri_font)) {
+			ri-ri_ops.putchar = cg14_putchar_aa;
+		} else
+#endif
+			ri-ri_ops.putchar = cg14_putchar;
+	}
+#endif /* NSX  0 */
 }
 
 static void
@@ -1104,4 +1171,405 @@ cg14_do_cursor(struct cgfourteen_softc *
 	}
 	return 0;
 }
+
+#if NSX  0
+
+static void
+cg14_wait_idle(struct cgfourteen_softc *sc)
+{
+}
+
+static void
+cg14_rectfill(struct cgfourteen_softc *sc, int x, int y, int wi, int he,
+ uint32_t colour)
+{
+	uint32_t addr, pptr;
+	int line, cnt;
+	int 

CVS commit: src/sys/arch/sparc/dev

2012-09-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Sep 23 09:54:04 UTC 2012

Modified Files:
src/sys/arch/sparc/dev: sbus.c

Log Message:
Wrap sbuserr_handler and sbus_error with:
  #if (defined(SUN4M)  !defined(MSIIEP)) || defined(SUN4D)
to give them the same scope as the definitions in ../sparc/intr.c.
Allows SUN4C-only kernels to compile.
OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/sparc/dev/sbus.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/sparc/dev/sbus.c
diff -u src/sys/arch/sparc/dev/sbus.c:1.77 src/sys/arch/sparc/dev/sbus.c:1.78
--- src/sys/arch/sparc/dev/sbus.c:1.77	Sun Jul 29 00:04:05 2012
+++ src/sys/arch/sparc/dev/sbus.c	Sun Sep 23 09:54:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbus.c,v 1.77 2012/07/29 00:04:05 matt Exp $ */
+/*	$NetBSD: sbus.c,v 1.78 2012/09/23 09:54:04 jdc Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sbus.c,v 1.77 2012/07/29 00:04:05 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: sbus.c,v 1.78 2012/09/23 09:54:04 jdc Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -113,8 +113,10 @@ void	sbus_attach_mainbus(device_t, devic
 void	sbus_attach_iommu(device_t, device_t, void *);
 void	sbus_attach_xbox(device_t, device_t, void *);
 
+#if (defined(SUN4M)  !defined(MSIIEP)) || defined(SUN4D)
 static	int sbus_error(void);
 extern	int (*sbuserr_handler)(void);
+#endif
 
 CFATTACH_DECL_NEW(sbus_mainbus, sizeof(struct sbus_softc),
 sbus_match_mainbus, sbus_attach_mainbus, NULL, NULL);
@@ -311,7 +313,9 @@ sbus_attach_iommu(device_t parent, devic
 	printf(: clock = %s MHz\n, clockfreq(sc-sc_clockfreq));
 
 	sbus_sc = sc;
+#if (defined(SUN4M)  !defined(MSIIEP)) || defined(SUN4D)
 	sbuserr_handler = sbus_error;
+#endif
 	sbus_attach_common(sc, sbus, node, NULL);
 }
 
@@ -594,6 +598,7 @@ sbus_intr_establish(bus_space_tag_t t, i
 	return (ih);
 }
 
+#if (defined(SUN4M)  !defined(MSIIEP)) || defined(SUN4D)
 static int
 sbus_error(void)
 {
@@ -625,3 +630,4 @@ static	int straytime, nstray;
 
 	return (0);
 }
+#endif



CVS commit: src/sys/arch/sparc/dev

2012-03-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 25 08:48:40 UTC 2012

Modified Files:
src/sys/arch/sparc/dev: tctrl.c

Log Message:
Make explicitly clear that we mean raw I/O on device passthru, not just
generic passthru.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sparc/dev/tctrl.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/sparc/dev/tctrl.c
diff -u src/sys/arch/sparc/dev/tctrl.c:1.54 src/sys/arch/sparc/dev/tctrl.c:1.55
--- src/sys/arch/sparc/dev/tctrl.c:1.54	Tue Mar 13 18:40:28 2012
+++ src/sys/arch/sparc/dev/tctrl.c	Sun Mar 25 08:48:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tctrl.c,v 1.54 2012/03/13 18:40:28 elad Exp $	*/
+/*	$NetBSD: tctrl.c,v 1.55 2012/03/25 08:48:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tctrl.c,v 1.54 2012/03/13 18:40:28 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: tctrl.c,v 1.55 2012/03/25 08:48:40 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1150,7 +1150,7 @@ tctrlioctl(dev_t dev, u_long cmd, void *
 	case TCTRL_CMD_REQ:
 		reqn = (struct tctrl_req *)data;
 		if ((i = kauth_authorize_device_passthru(l-l_cred,
-		dev, KAUTH_REQ_DEVICE_PASSTHRU_ALL, data)) != 0 
+		dev, KAUTH_REQ_DEVICE_RAWIO_PASSTHRU_ALL, data)) != 0 
 		(reqn-cmdbuf[0] == TS102_OP_CTL_BITPORT ||
 		(reqn-cmdbuf[0] = TS102_OP_CTL_WATCHDOG 
 		reqn-cmdbuf[0] = TS102_OP_CTL_SECURITY_KEY) ||



CVS commit: src/sys/arch/sparc/dev

2012-01-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 11 15:54:44 UTC 2012

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
use rasops_init(0, 0)


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.66 src/sys/arch/sparc/dev/cgfourteen.c:1.67
--- src/sys/arch/sparc/dev/cgfourteen.c:1.66	Wed Apr 13 23:31:25 2011
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Jan 11 15:54:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.66 2011/04/13 23:31:25 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.67 2012/01/11 15:54:44 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1020,8 +1020,7 @@ cg14_init_screen(void *cookie, struct vc
 		ri-ri_flg |= RI_CLEAR;
 	}
 
-	rasops_init(ri, sc-sc_fb.fb_type.fb_height / 8,
-	 sc-sc_fb.fb_type.fb_width / 8);
+	rasops_init(ri, 0, 0);
 	ri-ri_caps = WSSCREEN_WSCOLORS;
 
 	rasops_reconfig(ri,



CVS commit: src/sys/arch/sparc/dev

2011-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep  8 15:34:07 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: ms_pckbport.c

Log Message:
Correct copy/paste of function name in error printf.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/dev/ms_pckbport.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/sparc/dev/ms_pckbport.c
diff -u src/sys/arch/sparc/dev/ms_pckbport.c:1.6 src/sys/arch/sparc/dev/ms_pckbport.c:1.7
--- src/sys/arch/sparc/dev/ms_pckbport.c:1.6	Fri Jul  1 18:50:41 2011
+++ src/sys/arch/sparc/dev/ms_pckbport.c	Thu Sep  8 15:34:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ms_pckbport.c,v 1.6 2011/07/01 18:50:41 dyoung Exp $ */
+/*	$NetBSD: ms_pckbport.c,v 1.7 2011/09/08 15:34:07 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -27,7 +27,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ms_pckbport.c,v 1.6 2011/07/01 18:50:41 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ms_pckbport.c,v 1.7 2011/09/08 15:34:07 jakllsch Exp $);
 
 /*
  * Attach PS/2 mouse at pckbport aux port
@@ -152,7 +152,7 @@
 	res = pckbport_enqueue_cmd(sc-sc_kbctag, sc-sc_kbcslot,
 cmd, 1, 0, 1, NULL);
 	if (res) {
-		printf(pms_enable: command error\n);
+		printf(%s: command error\n, __func__);
 		return (res);
 	}
 



CVS commit: src/sys/arch/sparc/dev

2011-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep  8 15:36:42 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: ms_pckbport.c

Log Message:
Another copy/paste problem with a function name in a error printf.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/dev/ms_pckbport.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/sparc/dev/ms_pckbport.c
diff -u src/sys/arch/sparc/dev/ms_pckbport.c:1.7 src/sys/arch/sparc/dev/ms_pckbport.c:1.8
--- src/sys/arch/sparc/dev/ms_pckbport.c:1.7	Thu Sep  8 15:34:07 2011
+++ src/sys/arch/sparc/dev/ms_pckbport.c	Thu Sep  8 15:36:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ms_pckbport.c,v 1.7 2011/09/08 15:34:07 jakllsch Exp $ */
+/*	$NetBSD: ms_pckbport.c,v 1.8 2011/09/08 15:36:42 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -27,7 +27,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ms_pckbport.c,v 1.7 2011/09/08 15:34:07 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: ms_pckbport.c,v 1.8 2011/09/08 15:36:42 jakllsch Exp $);
 
 /*
  * Attach PS/2 mouse at pckbport aux port
@@ -172,7 +172,7 @@
 	res = pckbport_enqueue_cmd(sc-sc_kbctag, sc-sc_kbcslot,
 cmd, 1, 0, 1, NULL);
 	if (res)
-		printf(pms_disable: command error\n);
+		printf(%s: command error\n, __func__);
 
 	pckbport_slot_enable(sc-sc_kbctag, sc-sc_kbcslot, 0);
 



CVS commit: src/sys/arch/sparc/dev

2011-07-17 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jul 18 00:05:35 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: cgeight.c cgfour.c cgtwo.c

Log Message:
convert to use device_t, cfdata_t and CFATTACH_DECL_NEW().

XXX: compile time tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc/dev/cgeight.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/sparc/dev/cgfour.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sparc/dev/cgtwo.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/sparc/dev/cgeight.c
diff -u src/sys/arch/sparc/dev/cgeight.c:1.46 src/sys/arch/sparc/dev/cgeight.c:1.47
--- src/sys/arch/sparc/dev/cgeight.c:1.46	Wed Jun 11 21:25:31 2008
+++ src/sys/arch/sparc/dev/cgeight.c	Mon Jul 18 00:05:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgeight.c,v 1.46 2008/06/11 21:25:31 drochner Exp $	*/
+/*	$NetBSD: cgeight.c,v 1.47 2011/07/18 00:05:35 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cgeight.c,v 1.46 2008/06/11 21:25:31 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: cgeight.c,v 1.47 2011/07/18 00:05:35 mrg Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -127,7 +127,6 @@
 
 /* per-display variables */
 struct cgeight_softc {
-	struct device	sc_dev;		/* base device */
 	struct fbdevice	sc_fb;		/* frame buffer device */
 	bus_space_tag_t	sc_bustag;
 	bus_addr_t	sc_paddr;	/* phys address for device mmap() */
@@ -137,15 +136,15 @@
 };
 
 /* autoconfiguration driver */
-static void	cgeightattach(struct device *, struct device *, void *);
-static int	cgeightmatch(struct device *, struct cfdata *, void *);
+static void	cgeightattach(device_t, device_t, void *);
+static int	cgeightmatch(device_t, cfdata_t, void *);
 #if defined(SUN4)
-static void	cgeightunblank(struct device *);
+static void	cgeightunblank(device_t);
 #endif
 
 static int	cg8_pfour_probe(void *, void *);
 
-CFATTACH_DECL(cgeight, sizeof(struct cgeight_softc),
+CFATTACH_DECL_NEW(cgeight, sizeof(struct cgeight_softc),
 cgeightmatch, cgeightattach, NULL, NULL);
 
 extern struct cfdriver cgeight_cd;
@@ -175,7 +174,7 @@
  * Match a cgeight.
  */
 static int
-cgeightmatch(struct device *parent, struct cfdata *cf, void *aux)
+cgeightmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	union obio_attach_args *uoba = aux;
 	struct obio4_attach_args *oba;
@@ -202,7 +201,7 @@
  * Attach a display.  We need to notice if it is the console, too.
  */
 static void
-cgeightattach(struct device *parent, struct device *self, void *aux)
+cgeightattach(device_t parent, device_t self, void *aux)
 {
 #if defined(SUN4)
 	union obio_attach_args *uoba = aux;
@@ -221,15 +220,16 @@
 			  sizeof(uint32_t),
 			  BUS_SPACE_MAP_LINEAR,
 			  bh) != 0) {
-		printf(%s: cannot map pfour register\n, self-dv_xname);
+		printf(%s: cannot map pfour register\n,
+			device_xname(self));
 		return;
 	}
 	fb-fb_pfour = (volatile uint32_t *)bh;
 
 	fb-fb_driver = cgeightfbdriver;
-	fb-fb_device = sc-sc_dev;
+	fb-fb_device = self;
 	fb-fb_type.fb_type = FBTYPE_MEMCOLOR;
-	fb-fb_flags = device_cfdata(sc-sc_dev)-cf_flags  FB_USERMASK;
+	fb-fb_flags = device_cfdata(self)-cf_flags  FB_USERMASK;
 	fb-fb_flags |= FB_PFOUR;
 
 	ramsize = PFOUR_COLOR_OFF_END - PFOUR_COLOR_OFF_OVERLAY;
@@ -285,7 +285,8 @@
 			  sizeof(struct fbcontrol),
 			  BUS_SPACE_MAP_LINEAR,
 			  bh) != 0) {
-		printf(%s: cannot map control registers\n, self-dv_xname);
+		printf(%s: cannot map control registers\n,
+			device_xname(self));
 		return;
 	}
 	sc-sc_fbc = (volatile struct fbcontrol *)bh;
@@ -481,7 +482,7 @@
  * Undo the effect of an FBIOSVIDEO that turns the video off.
  */
 static void
-cgeightunblank(struct device *dev)
+cgeightunblank(device_t dev)
 {
 
 	cgeight_set_video(device_private(dev), 1);

Index: src/sys/arch/sparc/dev/cgfour.c
diff -u src/sys/arch/sparc/dev/cgfour.c:1.45 src/sys/arch/sparc/dev/cgfour.c:1.46
--- src/sys/arch/sparc/dev/cgfour.c:1.45	Wed Jun 11 21:25:31 2008
+++ src/sys/arch/sparc/dev/cgfour.c	Mon Jul 18 00:05:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfour.c,v 1.45 2008/06/11 21:25:31 drochner Exp $	*/
+/*	$NetBSD: cgfour.c,v 1.46 2011/07/18 00:05:35 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cgfour.c,v 1.45 2008/06/11 21:25:31 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: cgfour.c,v 1.46 2011/07/18 00:05:35 mrg Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -125,7 +125,6 @@
 
 /* per-display variables */
 struct cgfour_softc {
-	struct device	sc_dev;		/* base device */
 	struct fbdevice	sc_fb;		/* frame buffer device */
 	bus_space_tag_t	sc_bustag;
 	bus_addr_t	sc_paddr;	/* phys address for device mmap() */
@@ -135,8 +134,8 @@
 };
 
 /* autoconfiguration driver */
-static int	cgfourmatch(struct device *, struct 

CVS commit: src/sys/arch/sparc/dev

2011-07-17 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jul 18 00:31:13 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: bootbus.c cgsix_obio.c ebus.c rtc.c tctrl.c
vme_machdep.c

Log Message:
convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t.
(cgsix_obio.c was only partially converted with the rest of the cgsix code
when it was changed some time ago.)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc/dev/bootbus.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/dev/cgsix_obio.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sparc/dev/ebus.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/dev/rtc.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc/dev/tctrl.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc/dev/vme_machdep.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/sparc/dev/bootbus.c
diff -u src/sys/arch/sparc/dev/bootbus.c:1.18 src/sys/arch/sparc/dev/bootbus.c:1.19
--- src/sys/arch/sparc/dev/bootbus.c:1.18	Fri Jul  1 18:50:41 2011
+++ src/sys/arch/sparc/dev/bootbus.c	Mon Jul 18 00:31:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $	*/
+/*	$NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -50,7 +50,6 @@
 #include locators.h
 
 struct bootbus_softc {
-	struct device sc_dev;
 	int sc_node;/* our OBP node */
 
 	bus_space_tag_t sc_st;			/* ours */
@@ -60,11 +59,10 @@
 static int bootbus_match(device_t, cfdata_t, void *);
 static void bootbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(bootbus, sizeof(struct bootbus_softc),
+CFATTACH_DECL_NEW(bootbus, sizeof(struct bootbus_softc),
 bootbus_match, bootbus_attach, NULL, NULL);
 
-static int bootbus_submatch(struct device *, struct cfdata *,
-			const int *, void *);
+static int bootbus_submatch(device_t, cfdata_t, const int *, void *);
 static int bootbus_print(void *, const char *);
 
 static int bootbus_setup_attach_args(struct bootbus_softc *, bus_space_tag_t,

Index: src/sys/arch/sparc/dev/cgsix_obio.c
diff -u src/sys/arch/sparc/dev/cgsix_obio.c:1.24 src/sys/arch/sparc/dev/cgsix_obio.c:1.25
--- src/sys/arch/sparc/dev/cgsix_obio.c:1.24	Fri Jul  1 18:50:41 2011
+++ src/sys/arch/sparc/dev/cgsix_obio.c	Mon Jul 18 00:31:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $ */
+/*	$NetBSD: cgsix_obio.c,v 1.25 2011/07/18 00:31:13 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: cgsix_obio.c,v 1.25 2011/07/18 00:31:13 mrg Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -68,7 +68,7 @@
 static void	cgsixattach(device_t, device_t, void *);
 static int	cg6_pfour_probe(void *, void *);
 
-CFATTACH_DECL(cgsix_obio, sizeof(struct cgsix_softc),
+CFATTACH_DECL_NEW(cgsix_obio, sizeof(struct cgsix_softc),
 cgsixmatch, cgsixattach, NULL, NULL);
 
 /*

Index: src/sys/arch/sparc/dev/ebus.c
diff -u src/sys/arch/sparc/dev/ebus.c:1.32 src/sys/arch/sparc/dev/ebus.c:1.33
--- src/sys/arch/sparc/dev/ebus.c:1.32	Fri Jul  1 18:50:41 2011
+++ src/sys/arch/sparc/dev/ebus.c	Mon Jul 18 00:31:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus.c,v 1.32 2011/07/01 18:50:41 dyoung Exp $ */
+/*	$NetBSD: ebus.c,v 1.33 2011/07/18 00:31:13 mrg Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ebus.c,v 1.32 2011/07/01 18:50:41 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ebus.c,v 1.33 2011/07/18 00:31:13 mrg Exp $);
 
 #if defined(DEBUG)  !defined(EBUS_DEBUG)
 #define EBUS_DEBUG
@@ -82,7 +82,7 @@
 #endif
 
 struct ebus_softc {
-	struct device			sc_dev;
+	device_t			sc_dev;
 	device_t			sc_parent;	/* PCI bus */
 
 	intsc_node;	/* PROM node */
@@ -100,7 +100,7 @@
 static int	ebus_match(device_t, cfdata_t, void *);
 static void	ebus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ebus, sizeof(struct ebus_softc),
+CFATTACH_DECL_NEW(ebus, sizeof(struct ebus_softc),
 ebus_match, ebus_attach, NULL, NULL);
 
 static int	ebus_setup_attach_args(struct ebus_softc *, bus_space_tag_t,
@@ -212,7 +212,7 @@
 
 	if (wiring_map != NULL) {
 		printf(%s: global ebus wiring map already initalized\n,
-		device_xname(sc-sc_dev));
+		device_xname(sc-sc_dev));
 		return (0);
 	}
 
@@ -250,6 +250,8 @@
 	int node, error;
 	char devinfo[256];
 
+	sc-sc_dev = self;
+
 #ifdef BLINK
 	callout_init(ebus_blink_ch, 0);
 #endif

Index: src/sys/arch/sparc/dev/rtc.c
diff -u 

CVS commit: src/sys/arch/sparc/dev

2011-07-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jul  1 18:50:42 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: bootbus.c cgsix_obio.c com_ebus.c com_obio.c
dma_obio.c ebus.c esp_obio.c if_ie_obio.c if_le_obio.c
kbd_pckbport.c ms_pckbport.c obio.c rtc.c sbus.c sw.c tctrl.c
ts102.c vme_machdep.c

Log Message:
#include sys/bus.h instead of machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/dev/bootbus.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sparc/dev/cgsix_obio.c \
src/sys/arch/sparc/dev/com_obio.c src/sys/arch/sparc/dev/esp_obio.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/dev/com_ebus.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc/dev/dma_obio.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sparc/dev/ebus.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/sparc/dev/if_ie_obio.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sparc/dev/if_le_obio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/dev/kbd_pckbport.c \
src/sys/arch/sparc/dev/ms_pckbport.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/sparc/dev/obio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/dev/rtc.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/sparc/dev/sbus.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/dev/sw.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/sparc/dev/tctrl.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/dev/ts102.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sparc/dev/vme_machdep.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/sparc/dev/bootbus.c
diff -u src/sys/arch/sparc/dev/bootbus.c:1.17 src/sys/arch/sparc/dev/bootbus.c:1.18
--- src/sys/arch/sparc/dev/bootbus.c:1.17	Sun Sep 20 16:18:21 2009
+++ src/sys/arch/sparc/dev/bootbus.c	Fri Jul  1 18:50:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $	*/
+/*	$NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -42,7 +42,7 @@
 #include sys/device.h
 
 #include machine/autoconf.h
-#include machine/bus.h
+#include sys/bus.h
 
 #include sparc/sparc/cpuunitvar.h
 #include sparc/dev/bootbusvar.h

Index: src/sys/arch/sparc/dev/cgsix_obio.c
diff -u src/sys/arch/sparc/dev/cgsix_obio.c:1.23 src/sys/arch/sparc/dev/cgsix_obio.c:1.24
--- src/sys/arch/sparc/dev/cgsix_obio.c:1.23	Fri Dec 12 18:50:13 2008
+++ src/sys/arch/sparc/dev/cgsix_obio.c	Fri Jul  1 18:50:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgsix_obio.c,v 1.23 2008/12/12 18:50:13 macallan Exp $ */
+/*	$NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cgsix_obio.c,v 1.23 2008/12/12 18:50:13 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -51,7 +51,7 @@
 #include sys/syslog.h
 #endif
 
-#include machine/bus.h
+#include sys/bus.h
 #include machine/autoconf.h
 #include machine/eeprom.h
 
Index: src/sys/arch/sparc/dev/com_obio.c
diff -u src/sys/arch/sparc/dev/com_obio.c:1.23 src/sys/arch/sparc/dev/com_obio.c:1.24
--- src/sys/arch/sparc/dev/com_obio.c:1.23	Sat Nov 21 04:16:51 2009
+++ src/sys/arch/sparc/dev/com_obio.c	Fri Jul  1 18:50:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_obio.c,v 1.23 2009/11/21 04:16:51 rmind Exp $	*/
+/*	$NetBSD: com_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: com_obio.c,v 1.23 2009/11/21 04:16:51 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: com_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,7 +78,7 @@
 #include sys/device.h
 #include sys/termios.h
 
-#include machine/bus.h
+#include sys/bus.h
 #include machine/autoconf.h
 #include machine/intr.h
 
Index: src/sys/arch/sparc/dev/esp_obio.c
diff -u src/sys/arch/sparc/dev/esp_obio.c:1.23 src/sys/arch/sparc/dev/esp_obio.c:1.24
--- src/sys/arch/sparc/dev/esp_obio.c:1.23	Mon Apr 28 20:23:35 2008
+++ src/sys/arch/sparc/dev/esp_obio.c	Fri Jul  1 18:50:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp_obio.c,v 1.23 2008/04/28 20:23:35 martin Exp $	*/
+/*	$NetBSD: esp_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: esp_obio.c,v 1.23 2008/04/28 20:23:35 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: esp_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $);
 
 #include sys/types.h
 #include 

CVS commit: src/sys/arch/sparc/dev

2011-06-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 20 16:33:42 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: tctrl.c

Log Message:
Initialize sensor states before registering


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sparc/dev/tctrl.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/sparc/dev/tctrl.c
diff -u src/sys/arch/sparc/dev/tctrl.c:1.50 src/sys/arch/sparc/dev/tctrl.c:1.51
--- src/sys/arch/sparc/dev/tctrl.c:1.50	Sat Nov 21 04:16:51 2009
+++ src/sys/arch/sparc/dev/tctrl.c	Mon Jun 20 16:33:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tctrl.c,v 1.50 2009/11/21 04:16:51 rmind Exp $	*/
+/*	$NetBSD: tctrl.c,v 1.51 2011/06/20 16:33:42 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tctrl.c,v 1.50 2009/11/21 04:16:51 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: tctrl.c,v 1.51 2011/06/20 16:33:42 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1261,16 +1261,19 @@
 	(void)strlcpy(sc-sc_sensor[0].desc, Case temperature,
 	sizeof(sc-sc_sensor[0].desc));
 	sc-sc_sensor[0].units = ENVSYS_STEMP;
+	sc-sc_sensor[0].state = ENVSYS_SINVALID;
 
 	/* battery voltage */
 	(void)strlcpy(sc-sc_sensor[1].desc, Internal battery voltage,
 	sizeof(sc-sc_sensor[1].desc));
 	sc-sc_sensor[1].units = ENVSYS_SVOLTS_DC;
+	sc-sc_sensor[1].state = ENVSYS_SINVALID;
 
 	/* DC voltage */
 	(void)strlcpy(sc-sc_sensor[2].desc, DC-In voltage,
 	sizeof(sc-sc_sensor[2].desc));
 	sc-sc_sensor[2].units = ENVSYS_SVOLTS_DC;
+	sc-sc_sensor[2].state = ENVSYS_SINVALID;
 
 	for (i = 0; i  ENVSYS_NUMSENSORS; i++) {
 		if (sysmon_envsys_sensor_attach(sc-sc_sme,



CVS commit: src/sys/arch/sparc/dev

2011-04-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 13 23:31:25 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
use the same function whenever we change colour depth
also, when opening the fb device switch to 32bit and back to 8 on close, not
the other way around


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.65 src/sys/arch/sparc/dev/cgfourteen.c:1.66
--- src/sys/arch/sparc/dev/cgfourteen.c:1.65	Tue Aug 31 21:14:57 2010
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Apr 13 23:31:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.65 2010/08/31 21:14:57 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.66 2011/04/13 23:31:25 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -477,20 +477,10 @@
 	case CG14_SET_PIXELMODE: {
 		int depth = *(int *)data;
 
-		switch (depth) {
-		case 8:
-			bus_space_write_1(sc-sc_bustag, sc-sc_regh,
-			CG14_MCTL, CG14_MCTL_ENABLEVID | 
-			CG14_MCTL_PIXMODE_8 | CG14_MCTL_POWERCTL);
-			break;
-		case 32:
-			bus_space_write_1(sc-sc_bustag, sc-sc_regh,
-			CG14_MCTL, CG14_MCTL_ENABLEVID | 
-			CG14_MCTL_PIXMODE_32 | CG14_MCTL_POWERCTL);
-			break;
-		default:
+		if (sc-sc_mode == WSDISPLAYIO_MODE_EMUL)
 			return EINVAL;
-		}
+
+		cg14_set_depth(sc, depth);
 		}
 		break;
 	default:
@@ -586,6 +576,7 @@
 static void
 cg14_init(struct cgfourteen_softc *sc)
 {
+#if 0
 	volatile uint32_t *clut;
 	volatile uint8_t  *xlut;
 	int i;
@@ -613,12 +604,16 @@
 	 */
 	sc-sc_ctl-ctl_mctl = CG14_MCTL_ENABLEVID | CG14_MCTL_PIXMODE_8 |
 		CG14_MCTL_POWERCTL;
+#else
+	cg14_set_depth(sc, 32);
+#endif
 }
 
 static void
 /* Restore the state saved on cg14_init */
 cg14_reset(struct cgfourteen_softc *sc)
 {
+#if 0
 	volatile uint32_t *clut;
 	volatile uint8_t  *xlut;
 	int i;
@@ -646,6 +641,9 @@
 		clut[i] = sc-sc_saveclut.cm_chip[i];
 		xlut[i] = sc-sc_savexlut[i];
 	}
+#else
+	cg14_set_depth(sc, 8);
+#endif
 }
 
 /* Enable/disable video display; power down monitor if DPMS-capable */
@@ -932,10 +930,12 @@
 		bus_space_write_1(sc-sc_bustag,
 		sc-sc_regh,
 		CG14_CURSOR_CONTROL, 0);
+
 		cg14_set_depth(sc, 8);
 		cg14_init_cmap(sc);
 		vcons_redraw_screen(ms);
 	} else {
+
 		cg14_set_depth(sc, 32);
 	}
 }
@@ -1038,6 +1038,7 @@
 
 	if (sc-sc_depth == depth)
 		return;
+
 	switch (depth) {
 		case 8:
 			bus_space_write_1(sc-sc_bustag, sc-sc_regh,



CVS commit: src/sys/arch/sparc/dev

2010-08-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 31 21:14:58 UTC 2010

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c cgfourteenvar.h

Log Message:
remove shadow framebuffer support, use VCONS_DONT_READ instead


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/dev/cgfourteenvar.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.64 src/sys/arch/sparc/dev/cgfourteen.c:1.65
--- src/sys/arch/sparc/dev/cgfourteen.c:1.64	Thu Jun 10 13:21:13 2010
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Aug 31 21:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.64 2010/06/10 13:21:13 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.65 2010/08/31 21:14:57 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -366,8 +366,6 @@
 		sc-sc_fb.fb_pixels = (void *)fbva[1];
 	}
 
-	sc-sc_shadowfb = kmem_alloc(ramsize, KM_NOSLEEP);
-
 	if (isconsole)
 		printf( (console)\n);
 	else
@@ -785,10 +783,6 @@
 		memset(sc-sc_fb.fb_pixels,
 		   (defattr  16)  0xff,
 		   ri-ri_stride * ri-ri_height);
-		if (sc-sc_shadowfb != NULL)
-			memset(sc-sc_shadowfb,
-			   (defattr  16)  0xff,
-			   ri-ri_stride * ri-ri_height);
 		sc-sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
 		sc-sc_defaultscreen_descr.textops = ri-ri_ops;
@@ -1019,11 +1013,8 @@
 	ri-ri_stride = ri-ri_width;
 	ri-ri_flg = RI_CENTER | RI_FULLCLEAR;
 
-	if (sc-sc_shadowfb != NULL) {
-		ri-ri_bits = sc-sc_shadowfb;
-		ri-ri_hwbits = (char *)sc-sc_fb.fb_pixels;
-	} else 
-		ri-ri_bits = (char *)sc-sc_fb.fb_pixels;
+	ri-ri_bits = (char *)sc-sc_fb.fb_pixels;
+	scr-scr_flags |= VCONS_DONT_READ;
 
 	if (existing) {
 		ri-ri_flg |= RI_CLEAR;

Index: src/sys/arch/sparc/dev/cgfourteenvar.h
diff -u src/sys/arch/sparc/dev/cgfourteenvar.h:1.12 src/sys/arch/sparc/dev/cgfourteenvar.h:1.13
--- src/sys/arch/sparc/dev/cgfourteenvar.h:1.12	Thu Jun 10 13:21:13 2010
+++ src/sys/arch/sparc/dev/cgfourteenvar.h	Tue Aug 31 21:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteenvar.h,v 1.12 2010/06/10 13:21:13 macallan Exp $ */
+/*	$NetBSD: cgfourteenvar.h,v 1.13 2010/08/31 21:14:57 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -87,15 +87,14 @@
 	struct	cg14_cursor sc_cursor;	/* Hardware cursor state */
 	union 	cg14cmap sc_saveclut; 	/* a place to stash PROM state */
 	size_t	sc_vramsize;
+	int 	sc_depth;	/* current colour depth */
 #if NWSDISPLAY  0
 	struct  vcons_data sc_vd;
-	struct vcons_screen sc_console_screen;
-	struct wsscreen_descr sc_defaultscreen_descr;
+	struct 	vcons_screen sc_console_screen;
+	struct 	wsscreen_descr sc_defaultscreen_descr;
 	const struct wsscreen_descr *sc_screens[1];
-	struct wsscreen_list sc_screenlist;
-	void *sc_shadowfb;
-	int sc_mode;	/* wsdisplay mode - EMUL, DUMB etc. */
-	int sc_depth;	/* current colour depth */
+	struct 	wsscreen_list sc_screenlist;
+	int 	sc_mode;	/* wsdisplay mode - EMUL, DUMB etc. */
 #endif
 
 	uint8_t	sc_savexlut[256];



CVS commit: src/sys/arch/sparc/dev

2010-06-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 26 01:42:57 UTC 2010

Modified Files:
src/sys/arch/sparc/dev: zs.c

Log Message:
Establish interrupt handlers with proper softc per each zs device
rather than sharing them among all zs devices and searching softc
in handlers.

The latter method is derived from ancient sun3 zs driver which tried
to reduce overhead on autovectored interrupts, but nowadays such hack
might cause recursive global locks on modern SMP capable framework.

Fixes 5.99.30 sparc panic during startup reported by Hauke Fath
on tech-kern@:
http://mail-index.NetBSD.org/tech-kern/2010/06/19/msg008374.html
and also tested by Jochen Kunz on SS20 with both serial and kbd console.

Ok'ed by mrg@ and dyo...@.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/sparc/dev/zs.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/sparc/dev/zs.c
diff -u src/sys/arch/sparc/dev/zs.c:1.118 src/sys/arch/sparc/dev/zs.c:1.119
--- src/sys/arch/sparc/dev/zs.c:1.118	Fri Jun  4 06:04:15 2010
+++ src/sys/arch/sparc/dev/zs.c	Sat Jun 26 01:42:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.118 2010/06/04 06:04:15 macallan Exp $	*/
+/*	$NetBSD: zs.c,v 1.119 2010/06/26 01:42:57 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.118 2010/06/04 06:04:15 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.119 2010/06/26 01:42:57 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -171,12 +171,8 @@
 
 extern struct cfdriver zs_cd;
 
-/* softintr(9) cookie, shared by all instances of this driver */
-static void *zs_sicookie;
-
 /* Interrupt handlers. */
 static int zshard(void *);
-static void zssoft(void *);
 
 static int zs_get_speed(struct zs_chanstate *);
 
@@ -396,7 +392,6 @@
 	struct zsc_attach_args zsc_args;
 	struct zs_chanstate *cs;
 	int channel;
-	static int didintr, prevpri;
 #if (NKBD  0) || (NMS  0)
 	int ch0_is_cons = 0;
 #endif
@@ -407,12 +402,11 @@
 		return;
 	}
 
-	if (!didintr) {
-		zs_sicookie = softint_establish(SOFTINT_SERIAL, zssoft, NULL);
-		if (zs_sicookie == NULL) {
-			aprint_error(: cannot establish soft int handler\n);
-			return;
-		}
+	zsc-zsc_sicookie = softint_establish(SOFTINT_SERIAL,
+	(void (*)(void *))zsc_intr_soft, zsc);
+	if (zsc-zsc_sicookie == NULL) {
+		aprint_error(: cannot establish soft int handler\n);
+		return;
 	}
 	aprint_normal( softpri %d\n, IPL_SOFTSERIAL);
 
@@ -566,17 +560,9 @@
 	}
 
 	/*
-	 * Now safe to install interrupt handlers.  Note the arguments
-	 * to the interrupt handlers aren't used.  Note, we only do this
-	 * once since both SCCs interrupt at the same level and vector.
+	 * Now safe to install interrupt handlers.
 	 */
-	if (!didintr) {
-		didintr = 1;
-		prevpri = pri;
-		bus_intr_establish(zsc-zsc_bustag, pri, IPL_SERIAL,
-   zshard, NULL);
-	} else if (pri != prevpri)
-		panic(broken zs interrupt scheme);
+	bus_intr_establish(zsc-zsc_bustag, pri, IPL_SERIAL, zshard, zsc);
 
 	evcnt_attach_dynamic(zsc-zsc_intrcnt, EVCNT_TYPE_INTR, NULL,
 	device_xname(zsc-zsc_dev), intr);
@@ -625,81 +611,29 @@
 static volatile int zssoftpending;
 
 /*
- * Our ZS chips all share a common, autovectored interrupt,
- * so we have to look at all of them on each interrupt.
+ * Our ZS chips all share a common interrupt level,
+ * but we establish zshard handler per each ZS chips
+ * to avoid holding unnecessary locks in interrupt context.
  */
 static int
 zshard(void *arg)
 {
-	struct zsc_softc *zsc;
-	int unit, rr3, rval, softreq;
+	struct zsc_softc *zsc = arg;
+	int rr3, rval;
 
-	rval = softreq = 0;
-	for (unit = 0; unit  zs_cd.cd_ndevs; unit++) {
-		struct zs_chanstate *cs;
-
-		zsc = device_lookup_private(zs_cd, unit);
-		if (zsc == NULL)
-			continue;
-		rr3 = zsc_intr_hard(zsc);
-		/* Count up the interrupts. */
-		if (rr3) {
-			rval |= rr3;
-			zsc-zsc_intrcnt.ev_count++;
-		}
-		if ((cs = zsc-zsc_cs[0]) != NULL)
-			softreq |= cs-cs_softreq;
-		if ((cs = zsc-zsc_cs[1]) != NULL)
-			softreq |= cs-cs_softreq;
-	}
-
-	/* We are at splzs here, so no need to lock. */
-	if (softreq  (zssoftpending == 0)) {
-		zssoftpending = 1;
-		softint_schedule(zs_sicookie);
+	rval = 0;
+	rr3 = zsc_intr_hard(zsc);
+	/* Count up the interrupts. */
+	if (rr3) {
+		rval = rr3;
+		zsc-zsc_intrcnt.ev_count++;
 	}
+	if (zsc-zsc_cs[0]-cs_softreq || zsc-zsc_cs[1]-cs_softreq)
+		softint_schedule(zsc-zsc_sicookie);
 	return (rval);
 }
 
 /*
- * Similar scheme as for zshard (look at all of them)
- */
-static void
-zssoft(void *arg)
-{
-	struct zsc_softc *zsc;
-	int unit;
-
-	/* This is not the only ISR on this IPL. */
-	if (zssoftpending == 0)
-		return;
-
-	/*
-	 * The soft intr. bit will be set by zshard only if
-	 * the variable zssoftpending is zero.  The order of
-	 * these next two statements prevents our 

CVS commit: src/sys/arch/sparc/dev

2010-06-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun 10 13:21:13 UTC 2010

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c cgfourteenvar.h

Log Message:
Add a couple more hw offset definitions, add an ioctl() to set colour depth
which works like Solaris and Linux, and finally make mmap() behave like an
actual CG14. This should be all we need to get Xorg's suncg14 driver going.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc/dev/cgfourteenvar.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.63 src/sys/arch/sparc/dev/cgfourteen.c:1.64
--- src/sys/arch/sparc/dev/cgfourteen.c:1.63	Tue Jun  8 06:30:41 2010
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Jun 10 13:21:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.63 2010/06/08 06:30:41 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.64 2010/06/10 13:21:13 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -281,7 +281,10 @@
 		return;
 	}
 	sc-sc_regh = bh;
-
+	sc-sc_regaddr = BUS_ADDR(sa-sa_slot, sa-sa_offset);
+	sc-sc_fbaddr = BUS_ADDR(sc-sc_physadr[CG14_PXL_IDX].sbr_slot,
+sc-sc_physadr[CG14_PXL_IDX].sbr_offset);
+	
 	sc-sc_ctl   = (struct cg14ctl  *) (bh);
 	sc-sc_hwc   = (struct cg14curs *) (bh + CG14_OFFSET_CURS);
 	sc-sc_dac   = (struct cg14dac  *) (bh + CG14_OFFSET_DAC);
@@ -473,6 +476,25 @@
 		cg14_set_video(sc, *(int *)data);
 		break;
 
+	case CG14_SET_PIXELMODE: {
+		int depth = *(int *)data;
+
+		switch (depth) {
+		case 8:
+			bus_space_write_1(sc-sc_bustag, sc-sc_regh,
+			CG14_MCTL, CG14_MCTL_ENABLEVID | 
+			CG14_MCTL_PIXMODE_8 | CG14_MCTL_POWERCTL);
+			break;
+		case 32:
+			bus_space_write_1(sc-sc_bustag, sc-sc_regh,
+			CG14_MCTL, CG14_MCTL_ENABLEVID | 
+			CG14_MCTL_PIXMODE_32 | CG14_MCTL_POWERCTL);
+			break;
+		default:
+			return EINVAL;
+		}
+		}
+		break;
 	default:
 		return (ENOTTY);
 	}
@@ -501,34 +523,13 @@
 /*
  * Return the address that would map the given device at the given
  * offset, allowing for the given protection, or return -1 for error.
- *
- * Since we're pretending to be a cg8, we put the main video RAM at the
- *  same place the cg8 does, at offset 256k.  The cg8 has an enable
- *  plane in the 256k space; our enable plane works differently.  We
- *  can't emulate the enable plane very well, but all X uses it for is
- *  to clear it at startup - so we map the first page of video RAM over
- *  and over to fill that 256k space.  We also map some other views of
- *  the video RAM space.
- *
- * Our memory map thus looks like
- *
- *	mmap range		space	base offset
- *	-0004	vram	0 (multi-mapped - see above)
- *	0004-00434800	vram	
- *	0100-0140	vram	0100
- *	0200-0220	vram	0200
- *	0280-02a0	vram	0280
- *	0300-0310	vram	0300
- *	0340-0350	vram	0340
- *	0380-0390	vram	0380
- *	03c0-03d0	vram	03c0
- *	1000-1001	regs	 (only if CG14_MAP_REGS)
- */
+  */
 paddr_t
 cgfourteenmmap(dev_t dev, off_t off, int prot)
 {
 	struct cgfourteen_softc *sc =
 	device_lookup_private(cgfourteen_cd, minor(dev));
+	off_t offset = -1;
 
 	if (off  PGOFSET)
 		panic(cgfourteenmmap);
@@ -536,43 +537,40 @@
 	if (off  0)
 		return (-1);
 
-#if defined(CG14_MAP_REGS) /* XXX: security hole */
-	/*
-	 * Map the control registers into user space. Should only be
-	 * used for debugging!
-	 */
-	if ((u_int)off = 0x1000  (u_int)off  0x1000 + 16*4096) {
-		off -= 0x1000;
-		return (bus_space_mmap(sc-sc_bustag,
-			BUS_ADDR(sc-sc_physadr[CG14_CTL_IDX].sbr_slot,
-   sc-sc_physadr[CG14_CTL_IDX].sbr_offset),
-			off, prot, BUS_SPACE_MAP_LINEAR));
-	}
-#endif
-
-	if (off  COLOUR_OFFSET)
-		off = 0;
-	else if (off  COLOUR_OFFSET+(1152*900*4))
-		off -= COLOUR_OFFSET;
-	else {
-		switch (off  20) {
-			case 0x010: case 0x011: case 0x012: case 0x013:
-			case 0x020: case 0x021:
-			case 0x028: case 0x029:
-			case 0x030:
-			case 0x034:
-			case 0x038:
-			case 0x03c:
-break;
-			default:
-return(-1);
-		}
-	}
-
-	return (bus_space_mmap(sc-sc_bustag,
-		BUS_ADDR(sc-sc_physadr[CG14_PXL_IDX].sbr_slot,
-			   sc-sc_physadr[CG14_PXL_IDX].sbr_offset),
-		off, prot, BUS_SPACE_MAP_LINEAR));
+	if (off = 0  off  0x1) {
+		offset = sc-sc_regaddr;
+	} else if (off = CG14_CURSOR_VOFF 
+		   off  (CG14_CURSOR_VOFF + 0x1000)) {
+		offset = sc-sc_regaddr + CG14_OFFSET_CURS;
+		off -= CG14_CURSOR_VOFF;
+	} else if (off = CG14_DIRECT_VOFF 
+		   off  (CG14_DIRECT_VOFF + sc-sc_vramsize)) {
+		offset = sc-sc_fbaddr + CG14_FB_VRAM;
+		off -= CG14_DIRECT_VOFF;
+	} else if (off = CG14_BGR_VOFF 
+		   off  (CG14_BGR_VOFF + sc-sc_vramsize)) {
+		offset = sc-sc_fbaddr + CG14_FB_CBGR;
+		off -= CG14_BGR_VOFF;
+	} else if 

CVS commit: src/sys/arch/sparc/dev

2010-06-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun  8 06:30:42 UTC 2010

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
get rid of the cg3/cg8 'emulation' kludge since we have the xf86-video-suncg14
driver now
this will probably need some work in cgfourteenmmap() to match what the
driver expects from a cg14


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.62 src/sys/arch/sparc/dev/cgfourteen.c:1.63
--- src/sys/arch/sparc/dev/cgfourteen.c:1.62	Thu Aug 27 20:52:18 2009
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Jun  8 06:30:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.62 2009/08/27 20:52:18 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.63 2010/06/08 06:30:41 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -68,13 +68,6 @@
  */
 #undef CG14_MAP_REGS
 
-/*
- * The following enables 24-bit operation: when opened, the framebuffer
- * will switch to 24-bit mode (actually 32-bit mode), and provide a
- * simple cg8 emulation.
- */
-#define CG14_CG8
-
 #include sys/param.h
 #include sys/systm.h
 #include sys/buf.h
@@ -250,16 +243,9 @@
 	/* Mask out invalid flags from the user. */
 	fb-fb_flags = device_cfdata(sc-sc_dev)-cf_flags  FB_USERMASK;
 
-	/*
-	 * We're emulating a cg3/8, so represent ourselves as one
-	 */
-#ifdef CG14_CG8
-	fb-fb_type.fb_type = FBTYPE_MEMCOLOR;
+	fb-fb_type.fb_type = FBTYPE_MDICOLOR;
 	fb-fb_type.fb_depth = 32;
-#else
-	fb-fb_type.fb_type = FBTYPE_SUN3COLOR;
-	fb-fb_type.fb_depth = 8;
-#endif
+
 	fb_setsize_obp(fb, sc-sc_fb.fb_type.fb_depth, 1152, 900, node);
 	ramsize = roundup(fb-fb_type.fb_height * fb-fb_linebytes, NBPG);
 
@@ -308,13 +294,9 @@
 	/*
 	 * Let the user know that we're here
 	 */
-#ifdef CG14_CG8
-	printf(: cgeight emulated at %dx%dx24bpp,
-		fb-fb_type.fb_width, fb-fb_type.fb_height);
-#else
-	printf(: cgthree emulated at %dx%dx8bpp,
+	printf(: %dx%d,
 		fb-fb_type.fb_width, fb-fb_type.fb_height);
-#endif
+
 	/*
 	 * Enable the video.
 	 */
@@ -474,9 +456,6 @@
 	case FBIOPUTCMAP:
 		/* copy to software map */
 #define p ((struct fbcmap *)data)
-#ifdef CG14_CG8
-		p-index = 0xff;
-#endif
 		error = cg14_put_cmap(p, sc-sc_cmap, CG14_CLUT_SIZE);
 		if (error)
 			return (error);
@@ -633,25 +612,11 @@
 		sc-sc_savexlut[i] = xlut[i];
 	}
 
-#ifdef CG14_CG8
-	/*
-	 * Enable the video, and put in 24 bit mode.
-	 */
-	sc-sc_ctl-ctl_mctl = CG14_MCTL_ENABLEVID | CG14_MCTL_PIXMODE_32 |
-		CG14_MCTL_POWERCTL;
-
-	/*
-	 * Zero the xlut to enable direct-color mode
-	 */
-	for (i = 0; i  CG14_CLUT_SIZE; i++)
-		sc-sc_xlut-xlut_lut[i] = 0;
-#else
 	/*
 	 * Enable the video and put it in 8 bit mode
 	 */
 	sc-sc_ctl-ctl_mctl = CG14_MCTL_ENABLEVID | CG14_MCTL_PIXMODE_8 |
 		CG14_MCTL_POWERCTL;
-#endif
 }
 
 static void
@@ -930,6 +895,7 @@
 
 	return 0;
 }
+
 static int
 cg14_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
 	struct lwp *l)



CVS commit: src/sys/arch/sparc/dev

2010-06-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun  4 06:04:15 UTC 2010

Modified Files:
src/sys/arch/sparc/dev: zs.c

Log Message:
make sure we pass a valid consdev pointer to the console keyboard so kbd
knows it's console and passes the right flags to wskbd, now the wskbd will
not drop off the mux when leaving event mode.
Symptoms: now the keyboard should no longer be dead when leaving X and there
  should be no more panics caused by it
I tested this on an SS5 and an SS20, may need some more attention and zs.c
sure could use some cleanup - there are a few differences to sparc64 that
really don't make much sense to me, like not passing console flags to zstty
which sparc64 does but sparc avoids, which caused this problem in the first
place.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/sparc/dev/zs.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/sparc/dev/zs.c
diff -u src/sys/arch/sparc/dev/zs.c:1.117 src/sys/arch/sparc/dev/zs.c:1.118
--- src/sys/arch/sparc/dev/zs.c:1.117	Sun Jan 17 16:23:43 2010
+++ src/sys/arch/sparc/dev/zs.c	Fri Jun  4 06:04:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.117 2010/01/17 16:23:43 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.118 2010/06/04 06:04:15 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.117 2010/01/17 16:23:43 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.118 2010/06/04 06:04:15 macallan Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -454,6 +454,9 @@
 		 * mouse line disciplines for SUN4 machines below.
 		 * Also, don't set the console flags, otherwise we
 		 * tell zstty_attach() to attach as console.
+		 * XXX
+		 * is this still necessary? sparc64 passes the console flags to
+		 * zstty etc. 
 		 */
 		if (zsc-zsc_promunit == 1) {
 			if ((hwflags  ZS_HWFLAG_CONSOLE_INPUT) != 0 
@@ -535,8 +538,16 @@
 			struct tty *tp = zstty_get_tty_from_dev(child);
 			kma.kmta_tp = tp;
 			kma.kmta_dev = tp-t_dev;
-			kma.kmta_consdev = zsc_args.consdev;
 
+			/*
+			 * we need to pass a consdev since that's how kbd knows
+			 * it's the console keyboard
+			 */
+			if (hwflags  ZS_HWFLAG_CONSOLE_INPUT) {
+kma.kmta_consdev = zs_consdev;
+			} else
+kma.kmta_consdev = zsc_args.consdev;
+			
 			/* Attach 'em if we got 'em. */
 #if (NKBD  0)
 			if (channel == 0) {



CVS commit: src/sys/arch/sparc/dev

2009-12-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 19 10:34:18 UTC 2009

Modified Files:
src/sys/arch/sparc/dev: audioamd.c fd.c

Log Message:
Disable fast trap handlers which invoke software interrupts
in sparc/amd7930intr.s and sparc/bsd_fdintr.s until they are
rewritten to adapt new MI softint(9) API.

No particular comments on PR port-sparc/42192, but
this fixes timeout problem on floppy access on my SPARCstation 1+.

XXX: floppy support on sun4m seems to have another problem (data overrun).


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/dev/audioamd.c
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/sparc/dev/fd.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/sparc/dev/audioamd.c
diff -u src/sys/arch/sparc/dev/audioamd.c:1.24 src/sys/arch/sparc/dev/audioamd.c:1.25
--- src/sys/arch/sparc/dev/audioamd.c:1.24	Thu Sep 17 12:38:11 2009
+++ src/sys/arch/sparc/dev/audioamd.c	Sat Dec 19 10:34:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: audioamd.c,v 1.24 2009/09/17 12:38:11 tsutsui Exp $	*/
+/*	$NetBSD: audioamd.c,v 1.25 2009/12/19 10:34:18 tsutsui Exp $	*/
 /*	NetBSD: am7930_sparc.c,v 1.44 1999/03/14 22:29:00 jonathan Exp 	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: audioamd.c,v 1.24 2009/09/17 12:38:11 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: audioamd.c,v 1.25 2009/12/19 10:34:18 tsutsui Exp $);
 
 #include audio.h
 #if NAUDIO  0
@@ -308,7 +308,13 @@
 	sc-sc_au.au_bt = sc-sc_bt;
 	sc-sc_au.au_bh = sc-sc_bh;
 	(void)bus_intr_establish2(sc-sc_bt, pri, IPL_HIGH,
-  am7930hwintr, sc, amd7930_trap);
+  am7930hwintr, sc,
+#ifdef notyet /* XXX amd7930intr.s needs to be fixed for MI softint(9) */
+  amd7930_trap
+#else
+  NULL
+#endif
+  );
 
 	sc-sc_sicookie = softint_establish(SOFTINT_SERIAL, am7930swintr, sc);
 	if (sc-sc_sicookie == NULL) {

Index: src/sys/arch/sparc/dev/fd.c
diff -u src/sys/arch/sparc/dev/fd.c:1.146 src/sys/arch/sparc/dev/fd.c:1.147
--- src/sys/arch/sparc/dev/fd.c:1.146	Mon May 25 19:22:53 2009
+++ src/sys/arch/sparc/dev/fd.c	Sat Dec 19 10:34:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.146 2009/05/25 19:22:53 jnemeth Exp $	*/
+/*	$NetBSD: fd.c,v 1.147 2009/12/19 10:34:18 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.146 2009/05/25 19:22:53 jnemeth Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.147 2009/12/19 10:34:18 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -639,7 +639,13 @@
 
 	fdciop = fdc-sc_io;
 	if (bus_intr_establish2(fdc-sc_bustag, pri, 0,
-fdc_c_hwintr, fdc, fdchwintr) == NULL) {
+fdc_c_hwintr, fdc,
+#ifdef notyet /* XXX bsd_fdintr.s needs to be fixed for MI softint(9) */
+fdchwintr
+#else
+NULL
+#endif
+) == NULL) {
 		printf(\n%s: cannot register interrupt handler\n,
 			fdc-sc_dev.dv_xname);
 		return (-1);



CVS commit: src/sys/arch/sparc/dev

2009-09-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 20 16:18:21 UTC 2009

Modified Files:
src/sys/arch/sparc/dev: bootbus.c ebus.c if_ie_obio.c rtc.c
vme_machdep.c

Log Message:
- use device_t and cfdriver_t
- use device_private() and device_xname()
- use proper types or variables for device_t/softc


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/dev/bootbus.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc/dev/ebus.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sparc/dev/if_ie_obio.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/dev/rtc.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sparc/dev/vme_machdep.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/sparc/dev/bootbus.c
diff -u src/sys/arch/sparc/dev/bootbus.c:1.16 src/sys/arch/sparc/dev/bootbus.c:1.17
--- src/sys/arch/sparc/dev/bootbus.c:1.16	Mon Apr 28 20:23:35 2008
+++ src/sys/arch/sparc/dev/bootbus.c	Sun Sep 20 16:18:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootbus.c,v 1.16 2008/04/28 20:23:35 martin Exp $	*/
+/*	$NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bootbus.c,v 1.16 2008/04/28 20:23:35 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -57,8 +57,8 @@
 	bus_space_tag_t sc_bustag;		/* passed on to children */
 };
 
-static int bootbus_match(struct device *, struct cfdata *, void *);
-static void bootbus_attach(struct device *, struct device *, void *);
+static int bootbus_match(device_t, cfdata_t, void *);
+static void bootbus_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(bootbus, sizeof(struct bootbus_softc),
 bootbus_match, bootbus_attach, NULL, NULL);
@@ -72,7 +72,7 @@
 static void bootbus_destroy_attach_args(struct bootbus_attach_args *);
 
 static int
-bootbus_match(struct device *parent, struct cfdata *cf, void *aux)
+bootbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct cpuunit_attach_args *cpua = aux;
 
@@ -83,9 +83,9 @@
 }
 
 static void
-bootbus_attach(struct device *parent, struct device *self, void *aux)
+bootbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct bootbus_softc *sc = (void *) self;
+	struct bootbus_softc *sc = device_private(self);
 	struct cpuunit_attach_args *cpua = aux;
 	int node, error;
 
@@ -112,7 +112,7 @@
 	sc-sc_bustag-ranges);
 	if (error) {
 		printf(%s: error %d getting \ranges\ property\n,
-		sc-sc_dev.dv_xname, error);
+		device_xname(self), error);
 		panic(bootbus_attach);
 	}
 
@@ -124,7 +124,7 @@
 		if (bootbus_setup_attach_args(sc, sc-sc_bustag, node, baa))
 			panic(bootbus_attach: failed to set up attach args);
 
-		(void) config_found_sm_loc(sc-sc_dev, bootbus, NULL, baa,
+		(void) config_found_sm_loc(self, bootbus, NULL, baa,
 	   bootbus_print, bootbus_submatch);
 
 		bootbus_destroy_attach_args(baa);
@@ -132,8 +132,7 @@
 }
 
 static int
-bootbus_submatch(struct device *parent, struct cfdata *cf,
-		 const int *ldesc, void *aux)
+bootbus_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct bootbus_attach_args *baa = aux;
 

Index: src/sys/arch/sparc/dev/ebus.c
diff -u src/sys/arch/sparc/dev/ebus.c:1.30 src/sys/arch/sparc/dev/ebus.c:1.31
--- src/sys/arch/sparc/dev/ebus.c:1.30	Thu May 29 14:51:26 2008
+++ src/sys/arch/sparc/dev/ebus.c	Sun Sep 20 16:18:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus.c,v 1.30 2008/05/29 14:51:26 mrg Exp $ */
+/*	$NetBSD: ebus.c,v 1.31 2009/09/20 16:18:21 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ebus.c,v 1.30 2008/05/29 14:51:26 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: ebus.c,v 1.31 2009/09/20 16:18:21 tsutsui Exp $);
 
 #if defined(DEBUG)  !defined(EBUS_DEBUG)
 #define EBUS_DEBUG
@@ -83,7 +83,7 @@
 
 struct ebus_softc {
 	struct device			sc_dev;
-	struct device			*sc_parent;	/* PCI bus */
+	device_t			sc_parent;	/* PCI bus */
 
 	intsc_node;	/* PROM node */
 
@@ -97,8 +97,8 @@
 	intsc_nreg;
 };
 
-static int	ebus_match(struct device *, struct cfdata *, void *);
-static void	ebus_attach(struct device *, struct device *, void *);
+static int	ebus_match(device_t, cfdata_t, void *);
+static void	ebus_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(ebus, sizeof(struct ebus_softc),
 ebus_match, ebus_attach, NULL, NULL);
@@ -181,7 +181,7 @@
 
 
 static int
-ebus_match(struct device *parent, struct cfdata *match, void *aux)
+ebus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 	char name[10];
@@ -212,7 +212,7 @@
 
 	if (wiring_map != NULL) {
 		printf(%s: global ebus wiring map already initalized\n,
-		   sc-sc_dev.dv_xname);
+		

CVS commit: src/sys/arch/sparc/dev

2009-09-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Sep 17 12:38:11 UTC 2009

Modified Files:
src/sys/arch/sparc/dev: audioamd.c

Log Message:
Use device_t, cfdriver_t, device_private(), device_xname(),
and appropriate types and variables for device_t/softc.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sparc/dev/audioamd.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/sparc/dev/audioamd.c
diff -u src/sys/arch/sparc/dev/audioamd.c:1.23 src/sys/arch/sparc/dev/audioamd.c:1.24
--- src/sys/arch/sparc/dev/audioamd.c:1.23	Mon Dec  3 15:34:20 2007
+++ src/sys/arch/sparc/dev/audioamd.c	Thu Sep 17 12:38:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: audioamd.c,v 1.23 2007/12/03 15:34:20 ad Exp $	*/
+/*	$NetBSD: audioamd.c,v 1.24 2009/09/17 12:38:11 tsutsui Exp $	*/
 /*	NetBSD: am7930_sparc.c,v 1.44 1999/03/14 22:29:00 jonathan Exp 	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: audioamd.c,v 1.23 2007/12/03 15:34:20 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: audioamd.c,v 1.24 2009/09/17 12:38:11 tsutsui Exp $);
 
 #include audio.h
 #if NAUDIO  0
@@ -100,12 +100,12 @@
 	kmutex_t	sc_lock;
 };
 
-void	audioamd_mainbus_attach(struct device *, struct device *, void *);
-int	audioamd_mainbus_match(struct device *, struct cfdata *, void *);
-void	audioamd_obio_attach(struct device *, struct device *, void *);
-int	audioamd_obio_match(struct device *, struct cfdata *, void *);
-void	audioamd_sbus_attach(struct device *, struct device *, void *);
-int	audioamd_sbus_match(struct device *, struct cfdata *, void *);
+int	audioamd_mainbus_match(device_t, cfdata_t, void *);
+void	audioamd_mainbus_attach(device_t, device_t, void *);
+int	audioamd_obio_match(device_t, cfdata_t, void *);
+void	audioamd_obio_attach(device_t, device_t, void *);
+int	audioamd_sbus_match(device_t, cfdata_t, void *);
+void	audioamd_sbus_attach(device_t, device_t, void *);
 void	audioamd_attach(struct audioamd_softc *, int);
 
 CFATTACH_DECL(audioamd_mainbus, sizeof(struct audioamd_softc),
@@ -187,7 +187,7 @@
 
 
 int
-audioamd_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+audioamd_mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma;
 
@@ -198,7 +198,7 @@
 }
 
 int
-audioamd_obio_match(struct device *parent, struct cfdata *cf, void *aux)
+audioamd_obio_match(device_t parent, cfdata_t cf, void *aux)
 {
 	union obio_attach_args *uoba;
 
@@ -210,7 +210,7 @@
 }
 
 int
-audioamd_sbus_match(struct device *parent, struct cfdata *cf, void *aux)
+audioamd_sbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct sbus_attach_args *sa;
 
@@ -219,14 +219,14 @@
 }
 
 void
-audioamd_mainbus_attach(struct device *parent, struct device *self, void *aux)
+audioamd_mainbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct mainbus_attach_args *ma;
 	struct audioamd_softc *sc;
 	bus_space_handle_t bh;
 
 	ma = aux;
-	sc = (struct audioamd_softc *)self;
+	sc = device_private(self);
 	sc-sc_bt = ma-ma_bustag;
 
 	if (bus_space_map(
@@ -235,7 +235,7 @@
 			AM7930_DREG_SIZE,
 			BUS_SPACE_MAP_LINEAR,
 			bh) != 0) {
-		printf(%s: cannot map registers\n, self-dv_xname);
+		printf(%s: cannot map registers\n, device_xname(self));
 		return;
 	}
 	sc-sc_bh = bh;
@@ -243,7 +243,7 @@
 }
 
 void
-audioamd_obio_attach(struct device *parent, struct device *self, void *aux)
+audioamd_obio_attach(device_t parent, device_t self, void *aux)
 {
 	union obio_attach_args *uoba;
 	struct sbus_attach_args *sa;
@@ -252,14 +252,14 @@
 
 	uoba = aux;
 	sa = uoba-uoba_sbus;
-	sc = (struct audioamd_softc *)self;
+	sc = device_private(self);
 	sc-sc_bt = sa-sa_bustag;
 
 	if (sbus_bus_map(sa-sa_bustag,
 			 sa-sa_slot, sa-sa_offset,
 			 AM7930_DREG_SIZE,
 			 0, bh) != 0) {
-		printf(%s: cannot map registers\n, self-dv_xname);
+		printf(%s: cannot map registers\n, device_xname(self));
 		return;
 	}
 	sc-sc_bh = bh;
@@ -267,21 +267,21 @@
 }
 
 void
-audioamd_sbus_attach(struct device *parent, struct device *self, void *aux)
+audioamd_sbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct sbus_attach_args *sa;
 	struct audioamd_softc *sc;
 	bus_space_handle_t bh;
 
 	sa = aux;
-	sc = (struct audioamd_softc *)self;
+	sc = device_private(self);
 	sc-sc_bt = sa-sa_bustag;
 
 	if (sbus_bus_map(sa-sa_bustag,
 			 sa-sa_slot, sa-sa_offset,
 			 AM7930_DREG_SIZE,
 			 0, bh) != 0) {
-		printf(%s: cannot map registers\n, self-dv_xname);
+		printf(%s: cannot map registers\n, device_xname(self));
 		return;
 	}
 	sc-sc_bh = bh;
@@ -291,10 +291,12 @@
 void
 audioamd_attach(struct audioamd_softc *sc, int pri)
 {
+	device_t self;
 
 	/*
 	 * Set up glue for MI code early; we use some of it here.
 	 */
+	self = sc-sc_am7930.sc_dev;
 	sc-sc_am7930.sc_glue = audioamd_glue;
 	mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_HIGH);
 
@@ -311,7 +313,7 @@
 	

CVS commit: src/sys/arch/sparc/dev

2009-07-14 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Tue Jul 14 20:57:22 UTC 2009

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
Enclose the argument to #error in quotes, to protect an embedded single
quote.  Part of PR 41255 from Kurt Lidl.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.60 src/sys/arch/sparc/dev/cgfourteen.c:1.61
--- src/sys/arch/sparc/dev/cgfourteen.c:1.60	Tue May 26 03:31:12 2009
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Jul 14 20:57:22 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.60 2009/05/26 03:31:12 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.61 2009/07/14 20:57:22 apb Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -157,7 +157,7 @@
 #endif
 
 #if defined(RASTERCONSOLE)  (NWSDISPLAY  0)
-#error You can't have it both ways - either RASTERCONSOLE or wsdisplay
+#error You can't have it both ways - either RASTERCONSOLE or wsdisplay
 #endif
 
 /*



CVS commit: src/sys/arch/sparc/dev

2009-05-25 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon May 25 19:22:54 UTC 2009

Modified Files:
src/sys/arch/sparc/dev: fd.c

Log Message:
Convert shutdownhook_establish() to pmf_device_register1().

XXX  This should be done as part of an overall plan to support
power management and device detachment.  However, in order to do
that, I would first have to invent sbus_intr_disestablish().  This
is being done at this time in order to aid in the effort to eliminate
shutdownhook_establish().

This was based on the sys/arch/sparc64/fd.c change.  Thanks to jdc@
for testing this version.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/arch/sparc/dev/fd.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/sparc/dev/fd.c
diff -u src/sys/arch/sparc/dev/fd.c:1.145 src/sys/arch/sparc/dev/fd.c:1.146
--- src/sys/arch/sparc/dev/fd.c:1.145	Wed Mar 18 16:00:14 2009
+++ src/sys/arch/sparc/dev/fd.c	Mon May 25 19:22:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.145 2009/03/18 16:00:14 cegger Exp $	*/
+/*	$NetBSD: fd.c,v 1.146 2009/05/25 19:22:53 jnemeth Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.145 2009/03/18 16:00:14 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.146 2009/05/25 19:22:53 jnemeth Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -282,8 +282,6 @@
 	int sc_cylin;		/* where we think the head is */
 	int sc_opts;		/* user-set options */
 
-	void	*sc_sdhook;	/* shutdownhook cookie */
-
 	TAILQ_ENTRY(fd_softc) sc_drivechain;
 	int sc_ops;		/* I/O ops since last switch */
 	struct bufq_state *sc_q;/* pending I/O requests */
@@ -293,6 +291,8 @@
 /* floppy driver configuration */
 int	fdmatch(struct device *, struct cfdata *, void *);
 void	fdattach(struct device *, struct device *, void *);
+bool	fdshutdown(device_t, int);
+bool	fdsuspend(device_t PMF_FN_PROTO);
 
 CFATTACH_DECL(fd, sizeof(struct fd_softc),
 fdmatch, fdattach, NULL, NULL);
@@ -791,9 +791,25 @@
 	mountroothook_establish(fd_mountroot_hook, fd-sc_dv);
 
 	/* Make sure the drive motor gets turned off at shutdown time. */
-	fd-sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
+	if (!pmf_device_register1(self, fdsuspend, NULL, fdshutdown))
+		aprint_error_dev(self, couldn't establish power handler\n);
+}
+
+bool fdshutdown(device_t self, int how)
+{
+	struct fd_softc *fd = device_private(self);
+
+	fd_motor_off(fd);
+	return true;
 }
 
+bool fdsuspend(device_t self PMF_FN_ARGS)
+{
+
+	return fdshutdown(self, boothowto);
+}
+
+
 inline struct fd_type *
 fd_dev_to_type(struct fd_softc *fd, dev_t dev)
 {



CVS commit: src/sys/arch/sparc/dev

2009-05-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 26 03:31:12 UTC 2009

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
use BUS_SPACE_MAP_LARGE to map the framebuffer


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.59 src/sys/arch/sparc/dev/cgfourteen.c:1.60
--- src/sys/arch/sparc/dev/cgfourteen.c:1.59	Sat May 16 16:55:24 2009
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue May 26 03:31:12 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.59 2009/05/16 16:55:24 cegger Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.60 2009/05/26 03:31:12 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -367,10 +367,11 @@
 #if NWSDISPLAY  0
 	prom_getprop(sa-sa_node, address, 4, items, ptr);
 	if (fbva[1] == 0) {
-		if (sparc_bus_map_large( sc-sc_bustag,
+		if (sbus_bus_map( sc-sc_bustag,
 		sc-sc_physadr[CG14_PXL_IDX].sbr_slot,
 		sc-sc_physadr[CG14_PXL_IDX].sbr_offset,
-		ramsize, BUS_SPACE_MAP_LINEAR, bh) != 0) {
+		ramsize, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_LARGE,
+		bh) != 0) {
 			printf(%s: cannot map pixels\n, 
 device_xname(sc-sc_dev));
 			return;



CVS commit: src/sys/arch/sparc/dev

2009-05-16 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sat May 16 16:55:24 UTC 2009

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c zs.c zs_kgdb.c

Log Message:
KNF, same object code generated


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/sparc/dev/zs.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sparc/dev/zs_kgdb.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.58 src/sys/arch/sparc/dev/cgfourteen.c:1.59
--- src/sys/arch/sparc/dev/cgfourteen.c:1.58	Thu Apr 16 16:57:21 2009
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sat May 16 16:55:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.58 2009/04/16 16:57:21 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.59 2009/05/16 16:55:24 cegger Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -271,7 +271,7 @@
 			self-dv_xname, sa-sa_nreg);
 		return;
 	}
-	memcpy( sc-sc_physadr, sa-sa_reg,
+	memcpy(sc-sc_physadr, sa-sa_reg,
 	  sa-sa_nreg * sizeof(struct sbus_reg));
 
 	sc-sc_vramsize = sc-sc_physadr[CG14_PXL_IDX].sbr_size;

Index: src/sys/arch/sparc/dev/zs.c
diff -u src/sys/arch/sparc/dev/zs.c:1.113 src/sys/arch/sparc/dev/zs.c:1.114
--- src/sys/arch/sparc/dev/zs.c:1.113	Wed Mar 18 17:06:46 2009
+++ src/sys/arch/sparc/dev/zs.c	Sat May 16 16:55:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.113 2009/03/18 17:06:46 cegger Exp $	*/
+/*	$NetBSD: zs.c,v 1.114 2009/05/16 16:55:24 cegger Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.113 2009/03/18 17:06:46 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.114 2009/05/16 16:55:24 cegger Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -475,8 +475,8 @@
 		cs-cs_reg_csr  = zc-zc_csr;
 		cs-cs_reg_data = zc-zc_data;
 
-		memcpy( cs-cs_creg, zs_init_reg, 16);
-		memcpy( cs-cs_preg, zs_init_reg, 16);
+		memcpy(cs-cs_creg, zs_init_reg, 16);
+		memcpy(cs-cs_preg, zs_init_reg, 16);
 
 		/* XXX: Consult PROM properties for this?! */
 		cs-cs_defspeed = zs_get_speed(cs);

Index: src/sys/arch/sparc/dev/zs_kgdb.c
diff -u src/sys/arch/sparc/dev/zs_kgdb.c:1.20 src/sys/arch/sparc/dev/zs_kgdb.c:1.21
--- src/sys/arch/sparc/dev/zs_kgdb.c:1.20	Wed Mar 18 17:06:46 2009
+++ src/sys/arch/sparc/dev/zs_kgdb.c	Sat May 16 16:55:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs_kgdb.c,v 1.20 2009/03/18 17:06:46 cegger Exp $	*/
+/*	$NetBSD: zs_kgdb.c,v 1.21 2009/05/16 16:55:24 cegger Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs_kgdb.c,v 1.20 2009/03/18 17:06:46 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs_kgdb.c,v 1.21 2009/05/16 16:55:24 cegger Exp $);
 
 #include opt_kgdb.h
 
@@ -111,7 +111,7 @@
 {
 	int s, tconst;
 
-	memcpy( cs-cs_preg, zs_kgdb_regs, 16);
+	memcpy(cs-cs_preg, zs_kgdb_regs, 16);
 
 	if (iena) {
 		cs-cs_preg[1] = ZSWR1_RIE | ZSWR1_SIE;