CVS commit: src/sys/arch/hp700/gsc

2013-10-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct 19 14:01:42 UTC 2013

Modified Files:
src/sys/arch/hp700/gsc: lpt_gsc.c

Log Message:
Remove unused variable.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp700/gsc/lpt_gsc.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/hp700/gsc/lpt_gsc.c
diff -u src/sys/arch/hp700/gsc/lpt_gsc.c:1.14 src/sys/arch/hp700/gsc/lpt_gsc.c:1.15
--- src/sys/arch/hp700/gsc/lpt_gsc.c:1.14	Fri Jul  1 18:33:09 2011
+++ src/sys/arch/hp700/gsc/lpt_gsc.c	Sat Oct 19 14:01:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpt_gsc.c,v 1.14 2011/07/01 18:33:09 dyoung Exp $	*/
+/*	$NetBSD: lpt_gsc.c,v 1.15 2013/10/19 14:01:42 skrll Exp $	*/
 
 /*	$OpenBSD: lpt_gsc.c,v 1.6 2000/07/21 17:41:06 mickey Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lpt_gsc.c,v 1.14 2011/07/01 18:33:09 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt_gsc.c,v 1.15 2013/10/19 14:01:42 skrll Exp $");
 
 #include 
 #include 
@@ -139,7 +139,7 @@ lpt_gsc_probe(device_t parent, cfdata_t 
 	bus_space_handle_t ioh;
 	bus_addr_t base;
 	uint8_t mask, data;
-	int i, rv;
+	int i;
 
 	if (ga->ga_type.iodc_type != HPPA_TYPE_FIO ||
 	ga->ga_type.iodc_sv_model != HPPA_FIO_CENT)
@@ -165,7 +165,6 @@ lpt_gsc_probe(device_t parent, cfdata_t 
 	if (bus_space_map(ga->ga_iot, base, LPT_NPORTS, 0, &ioh))
 		return 0;
 
-	rv = 0;
 	mask = 0xff;
 
 	data = 0x55;/* Alternating zeros */



CVS commit: src/sys/arch/hp700/gsc

2013-10-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct 19 13:18:03 UTC 2013

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
Actually return any error.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.27 src/sys/arch/hp700/gsc/harmony.c:1.28
--- src/sys/arch/hp700/gsc/harmony.c:1.27	Thu Feb 23 21:41:23 2012
+++ src/sys/arch/hp700/gsc/harmony.c	Sat Oct 19 13:18:03 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.27 2012/02/23 21:41:23 skrll Exp $	*/
+/*	$NetBSD: harmony.c,v 1.28 2013/10/19 13:18:03 skrll Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -919,7 +919,7 @@ harmony_get_port(void *vsc, mixer_ctrl_t
 		err = 0;
 		break;
 	}
-	return 0;
+	return err;
 }
 
 int



CVS commit: src/sys/arch/hp700/gsc

2012-10-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 10 17:00:37 UTC 2012

Modified Files:
src/sys/arch/hp700/gsc: fdc_gsc.c

Log Message:
Split softc/device_t


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp700/gsc/fdc_gsc.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/hp700/gsc/fdc_gsc.c
diff -u src/sys/arch/hp700/gsc/fdc_gsc.c:1.10 src/sys/arch/hp700/gsc/fdc_gsc.c:1.11
--- src/sys/arch/hp700/gsc/fdc_gsc.c:1.10	Fri Jul  1 18:33:09 2011
+++ src/sys/arch/hp700/gsc/fdc_gsc.c	Wed Oct 10 17:00:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdc_gsc.c,v 1.10 2011/07/01 18:33:09 dyoung Exp $	*/
+/*	$NetBSD: fdc_gsc.c,v 1.11 2012/10/10 17:00:37 skrll Exp $	*/
 
 /*	$OpenBSD: fdc_gsc.c,v 1.1 1998/09/30 04:45:46 mickey Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 1.10 2011/07/01 18:33:09 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 1.11 2012/10/10 17:00:37 skrll Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 
 int fdc_gsc_probe(device_t, cfdata_t, void *);
 void fdc_gsc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(fdc_gsc, sizeof(struct fdc_softc),
+CFATTACH_DECL_NEW(fdc_gsc, sizeof(struct fdc_softc),
 fdc_gsc_probe, fdc_gsc_attach, NULL, NULL);
 
 int



CVS commit: src/sys/arch/hp700/gsc

2012-02-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 23 21:41:23 UTC 2012

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
Don't take sc_intr_lock in harmony_trigger_input it's already taken by
our caller.

Found by /usr/tests/include/t_paths.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.26 src/sys/arch/hp700/gsc/harmony.c:1.27
--- src/sys/arch/hp700/gsc/harmony.c:1.26	Thu Feb  2 19:42:59 2012
+++ src/sys/arch/hp700/gsc/harmony.c	Thu Feb 23 21:41:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.26 2012/02/02 19:42:59 tls Exp $	*/
+/*	$NetBSD: harmony.c,v 1.27 2012/02/23 21:41:23 skrll Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -1259,12 +1259,12 @@ int
 harmony_trigger_input(void *vsc, void *start, void *end, int blksize,
 void (*intr)(void *), void *intrarg, const audio_params_t *param)
 {
-	struct harmony_softc *sc;
-	struct harmony_channel *c;
+	struct harmony_softc *sc = vsc;
+	struct harmony_channel *c = &sc->sc_capture;
 	struct harmony_dma *d;
 
-	sc = vsc;
-	c = &sc->sc_capture;
+	KASSERT(mutex_owned(&sc->sc_intr_lock));
+
 	for (d = sc->sc_dmas; d->d_kva != start; d = d->d_next)
 		continue;
 	if (d == NULL) {
@@ -1273,8 +1273,6 @@ harmony_trigger_input(void *vsc, void *s
 		return EINVAL;
 	}
 
-	mutex_spin_enter(&sc->sc_intr_lock);
-
 	c->c_intr = intr;
 	c->c_intrarg = intrarg;
 	c->c_blksz = blksize;
@@ -1288,8 +1286,6 @@ harmony_trigger_input(void *vsc, void *s
 	harmony_start_cp(sc, 1);
 	harmony_intr_enable(sc);
 
-	mutex_spin_exit(&sc->sc_intr_lock);
-
 	return 0;
 }
 



CVS commit: src/sys/arch/hp700/gsc

2012-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb  4 16:31:19 UTC 2012

Modified Files:
src/sys/arch/hp700/gsc: if_ie_gsc.c

Log Message:
G/C some unused code.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hp700/gsc/if_ie_gsc.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/hp700/gsc/if_ie_gsc.c
diff -u src/sys/arch/hp700/gsc/if_ie_gsc.c:1.25 src/sys/arch/hp700/gsc/if_ie_gsc.c:1.26
--- src/sys/arch/hp700/gsc/if_ie_gsc.c:1.25	Fri Jul  1 18:33:09 2011
+++ src/sys/arch/hp700/gsc/if_ie_gsc.c	Sat Feb  4 16:31:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie_gsc.c,v 1.25 2011/07/01 18:33:09 dyoung Exp $	*/
+/*	$NetBSD: if_ie_gsc.c,v 1.26 2012/02/04 16:31:19 skrll Exp $	*/
 
 /*	$OpenBSD: if_ie_gsc.c,v 1.6 2001/01/12 22:57:04 mickey Exp $	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.25 2011/07/01 18:33:09 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.26 2012/02/04 16:31:19 skrll Exp $");
 
 #include 
 #include 
@@ -70,15 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,
 
 #define	I82596_DEBUG	I82586_DEBUG
 
-/*
- * XXX fredette - I'm defining these on a hunch.  When things
- * appear to be working, remove these.
- */
-#if 1
-#define fdcache_small fdcache
-#define pdcache_small pdcache
-#endif
-
 #ifdef __for_reference_only
 struct ie_gsc_regs {
 	uint32_t	ie_reset;



CVS commit: src/sys/arch/hp700/gsc

2011-02-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Feb 15 10:35:39 UTC 2011

Modified Files:
src/sys/arch/hp700/gsc: hil_gsc.c

Log Message:
- make local functions static
- remove parentheses from return
- use aprint_error(9)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hp700/gsc/hil_gsc.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/hp700/gsc/hil_gsc.c
diff -u src/sys/arch/hp700/gsc/hil_gsc.c:1.1 src/sys/arch/hp700/gsc/hil_gsc.c:1.2
--- src/sys/arch/hp700/gsc/hil_gsc.c:1.1	Tue Feb 15 10:32:56 2011
+++ src/sys/arch/hp700/gsc/hil_gsc.c	Tue Feb 15 10:35:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hil_gsc.c,v 1.1 2011/02/15 10:32:56 tsutsui Exp $	*/
+/*	$NetBSD: hil_gsc.c,v 1.2 2011/02/15 10:35:39 tsutsui Exp $	*/
 /*	$OpenBSD: hil_gsc.c,v 1.5 2005/12/22 07:09:52 miod Exp $	*/
 /*
  * Copyright (c) 2003, Miodrag Vallat.
@@ -45,8 +45,8 @@
 
 #include 
 
-int	hil_gsc_match(device_t, cfdata_t, void *);
-void	hil_gsc_attach(device_t, device_t, void *);
+static int	hil_gsc_match(device_t, cfdata_t, void *);
+static void	hil_gsc_attach(device_t, device_t, void *);
 
 struct hil_gsc_softc {
 	struct hil_softc sc_hs;
@@ -64,9 +64,9 @@
 
 	if (ga->ga_type.iodc_type != HPPA_TYPE_FIO ||
 	ga->ga_type.iodc_sv_model != HPPA_FIO_HIL)
-		return (0);
+		return 0;
 
-	return (1);
+	return 1;
 }
 
 void
@@ -81,7 +81,7 @@
 	sc->sc_bst = ga->ga_iot;
 	if (bus_space_map(ga->ga_iot, ga->ga_hpa,
 	HILMAPSIZE, 0, &sc->sc_bsh)) {
-		printf(": couldn't map hil controller\n");
+		aprint_error(": couldn't map hil controller\n");
 		return;
 	}
 



CVS commit: src/sys/arch/hp700/gsc

2011-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  4 11:00:31 UTC 2011

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
A better workaround hack for PR 41448

Bound the wait loop


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.21 src/sys/arch/hp700/gsc/harmony.c:1.22
--- src/sys/arch/hp700/gsc/harmony.c:1.21	Fri Feb  4 10:56:03 2011
+++ src/sys/arch/hp700/gsc/harmony.c	Fri Feb  4 11:00:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.21 2011/02/04 10:56:03 skrll Exp $	*/
+/*	$NetBSD: harmony.c,v 1.22 2011/02/04 11:00:30 skrll Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -98,7 +98,10 @@
 int	harmony_set_params(void *, int, int, audio_params_t *,
 audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
 int	harmony_round_blocksize(void *, int, int, const audio_params_t *);
+
+int	harmony_control_wait(struct harmony_softc *);
 int	harmony_commit_settings(void *);
+
 int	harmony_halt_output(void *);
 int	harmony_halt_input(void *);
 int	harmony_getdev(void *, struct audio_device *);
@@ -623,6 +626,24 @@
 }
 
 int
+harmony_control_wait(struct harmony_softc *sc)
+{
+	uint32_t reg;
+	int j = 0;
+
+	while (j < 10) {
+		/* Wait for it to come out of control mode */
+		reg = READ_REG(sc, HARMONY_CNTL);
+		if ((reg & CNTL_C) == 0)
+			return 0;
+		DELAY(5);		/* wait 0.05 */
+		j++;
+	}
+
+	return 1;
+}
+
+int
 harmony_commit_settings(void *vsc)
 {
 	struct harmony_softc *sc;
@@ -669,24 +690,12 @@
 	offsetof(struct harmony_empty, playback[0][0]),
 	PLAYBACK_EMPTYS * HARMONY_BUFSIZE, BUS_DMASYNC_PREWRITE);
 
-	for (;;) {
-		/* Wait for it to come out of control mode */
-		reg = READ_REG(sc, HARMONY_CNTL);
-		if ((reg & CNTL_C) == 0)
-			break;
-	}
+	harmony_control_wait(sc);
 
 	bus_space_write_4(sc->sc_bt, sc->sc_bh, HARMONY_CNTL,
 	sc->sc_cntlbits | CNTL_C);
 
-#if 0
-	for (;;) {
-		/* Wait for it to come out of control mode */
-		reg = READ_REG(sc, HARMONY_CNTL);
-		if ((reg & CNTL_C) == 0)
-			break;
-	}
-#endif
+	harmony_control_wait(sc);
 
 	sc->sc_need_commit = 0;
 



CVS commit: src/sys/arch/hp700/gsc

2011-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  4 10:56:03 UTC 2011

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
Replace multiple spaces with 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.20 src/sys/arch/hp700/gsc/harmony.c:1.21
--- src/sys/arch/hp700/gsc/harmony.c:1.20	Fri Feb  4 07:44:53 2011
+++ src/sys/arch/hp700/gsc/harmony.c	Fri Feb  4 10:56:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.20 2011/02/04 07:44:53 skrll Exp $	*/
+/*	$NetBSD: harmony.c,v 1.21 2011/02/04 10:56:03 skrll Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -92,26 +92,26 @@
 #include 
 #include 
 
-int harmony_open(void *, int);
-voidharmony_close(void *);
-int harmony_query_encoding(void *, struct audio_encoding *);
-int harmony_set_params(void *, int, int, audio_params_t *,
+int	harmony_open(void *, int);
+void	harmony_close(void *);
+int	harmony_query_encoding(void *, struct audio_encoding *);
+int	harmony_set_params(void *, int, int, audio_params_t *,
 audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
-int harmony_round_blocksize(void *, int, int, const audio_params_t *);
-int harmony_commit_settings(void *);
-int harmony_halt_output(void *);
-int harmony_halt_input(void *);
-int harmony_getdev(void *, struct audio_device *);
-int harmony_set_port(void *, mixer_ctrl_t *);
-int harmony_get_port(void *, mixer_ctrl_t *);
-int harmony_query_devinfo(void *, mixer_devinfo_t *);
-void * harmony_allocm(void *, int, size_t, struct malloc_type *, int);
-voidharmony_freem(void *, void *, struct malloc_type *);
-size_t  harmony_round_buffersize(void *, int, size_t);
-int harmony_get_props(void *);
-int harmony_trigger_output(void *, void *, void *, int,
+int	harmony_round_blocksize(void *, int, int, const audio_params_t *);
+int	harmony_commit_settings(void *);
+int	harmony_halt_output(void *);
+int	harmony_halt_input(void *);
+int	harmony_getdev(void *, struct audio_device *);
+int	harmony_set_port(void *, mixer_ctrl_t *);
+int	harmony_get_port(void *, mixer_ctrl_t *);
+int	harmony_query_devinfo(void *, mixer_devinfo_t *);
+void *	harmony_allocm(void *, int, size_t, struct malloc_type *, int);
+void	harmony_freem(void *, void *, struct malloc_type *);
+size_t	harmony_round_buffersize(void *, int, size_t);
+int	harmony_get_props(void *);
+int	harmony_trigger_output(void *, void *, void *, int,
 void (*)(void *), void *, const audio_params_t *);
-int harmony_trigger_input(void *, void *, void *, int,
+int	harmony_trigger_input(void *, void *, void *, int,
 void (*)(void *), void *, const audio_params_t *);
 
 const struct audio_hw_if harmony_sa_hw_if = {



CVS commit: src/sys/arch/hp700/gsc

2011-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  4 07:44:53 UTC 2011

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
Commit a hack workaround for PR 41448.

Not sure if this has any negative effects, but I'd rather have a system
that reboots than has working audio.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.19 src/sys/arch/hp700/gsc/harmony.c:1.20
--- src/sys/arch/hp700/gsc/harmony.c:1.19	Tue Feb  1 18:33:24 2011
+++ src/sys/arch/hp700/gsc/harmony.c	Fri Feb  4 07:44:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.19 2011/02/01 18:33:24 skrll Exp $	*/
+/*	$NetBSD: harmony.c,v 1.20 2011/02/04 07:44:53 skrll Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -679,12 +679,14 @@
 	bus_space_write_4(sc->sc_bt, sc->sc_bh, HARMONY_CNTL,
 	sc->sc_cntlbits | CNTL_C);
 
+#if 0
 	for (;;) {
 		/* Wait for it to come out of control mode */
 		reg = READ_REG(sc, HARMONY_CNTL);
 		if ((reg & CNTL_C) == 0)
 			break;
 	}
+#endif
 
 	sc->sc_need_commit = 0;
 



CVS commit: src/sys/arch/hp700/gsc

2010-03-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 30 07:59:15 UTC 2010

Modified Files:
src/sys/arch/hp700/gsc: if_ie_gsc.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hp700/gsc/if_ie_gsc.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/hp700/gsc/if_ie_gsc.c
diff -u src/sys/arch/hp700/gsc/if_ie_gsc.c:1.20 src/sys/arch/hp700/gsc/if_ie_gsc.c:1.21
--- src/sys/arch/hp700/gsc/if_ie_gsc.c:1.20	Tue Nov  3 05:07:25 2009
+++ src/sys/arch/hp700/gsc/if_ie_gsc.c	Tue Mar 30 07:59:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie_gsc.c,v 1.20 2009/11/03 05:07:25 snj Exp $	*/
+/*	$NetBSD: if_ie_gsc.c,v 1.21 2010/03/30 07:59:15 skrll Exp $	*/
 
 /*	$OpenBSD: if_ie_gsc.c,v 1.6 2001/01/12 22:57:04 mickey Exp $	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.20 2009/11/03 05:07:25 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.21 2010/03/30 07:59:15 skrll Exp $");
 
 #include 
 #include 
@@ -419,7 +419,7 @@
 	 * physical addresses.
 	 */
 	if (bus_dmamem_alloc(gsc->iemt, sc->sc_msize, PAGE_SIZE, 0,
-			 &seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_24BIT)) {
+	&seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_24BIT)) {
 		printf (": can't allocate %d bytes of DMA memory\n",
 			sc->sc_msize);
 		return;



CVS commit: src/sys/arch/hp700/gsc

2009-08-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug  8 14:19:43 UTC 2009

Modified Files:
src/sys/arch/hp700/gsc: gscbus.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hp700/gsc/gscbus.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/hp700/gsc/gscbus.c
diff -u src/sys/arch/hp700/gsc/gscbus.c:1.16 src/sys/arch/hp700/gsc/gscbus.c:1.17
--- src/sys/arch/hp700/gsc/gscbus.c:1.16	Sat Aug  8 14:18:51 2009
+++ src/sys/arch/hp700/gsc/gscbus.c	Sat Aug  8 14:19:43 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscbus.c,v 1.16 2009/08/08 14:18:51 skrll Exp $	*/
+/*	$NetBSD: gscbus.c,v 1.17 2009/08/08 14:19:43 skrll Exp $	*/
 
 /*	$OpenBSD: gscbus.c,v 1.13 2001/08/01 20:32:04 miod Exp $	*/
 
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gscbus.c,v 1.16 2009/08/08 14:18:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gscbus.c,v 1.17 2009/08/08 14:19:43 skrll Exp $");
 
 #define GSCDEBUG
 
@@ -154,7 +154,7 @@
 
 	/* Add the I/O subsystem's interrupt register. */
 	ga->ga_int_reg->int_reg_dev = device_xname(parent);
-	sc->sc_ih = hp700_intr_establish(sc->sc_dev, IPL_NONE,	 NULL,
+	sc->sc_ih = hp700_intr_establish(sc->sc_dev, IPL_NONE, NULL,
 	ga->ga_int_reg, &int_reg_cpu, ga->ga_irq);
 
 	ga->ga_ca.ca_nmodules = MAXMODBUS;



CVS commit: src/sys/arch/hp700/gsc

2009-08-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug  8 14:18:51 UTC 2009

Modified Files:
src/sys/arch/hp700/gsc: gscbus.c

Log Message:
Use device_xname.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp700/gsc/gscbus.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/hp700/gsc/gscbus.c
diff -u src/sys/arch/hp700/gsc/gscbus.c:1.15 src/sys/arch/hp700/gsc/gscbus.c:1.16
--- src/sys/arch/hp700/gsc/gscbus.c:1.15	Thu May  7 15:34:49 2009
+++ src/sys/arch/hp700/gsc/gscbus.c	Sat Aug  8 14:18:51 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscbus.c,v 1.15 2009/05/07 15:34:49 skrll Exp $	*/
+/*	$NetBSD: gscbus.c,v 1.16 2009/08/08 14:18:51 skrll Exp $	*/
 
 /*	$OpenBSD: gscbus.c,v 1.13 2001/08/01 20:32:04 miod Exp $	*/
 
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gscbus.c,v 1.15 2009/05/07 15:34:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gscbus.c,v 1.16 2009/08/08 14:18:51 skrll Exp $");
 
 #define GSCDEBUG
 
@@ -153,7 +153,7 @@
 	aprint_normal("\n");
 
 	/* Add the I/O subsystem's interrupt register. */
-	ga->ga_int_reg->int_reg_dev = parent->dv_xname;
+	ga->ga_int_reg->int_reg_dev = device_xname(parent);
 	sc->sc_ih = hp700_intr_establish(sc->sc_dev, IPL_NONE,	 NULL,
 	ga->ga_int_reg, &int_reg_cpu, ga->ga_irq);
 



CVS commit: src/sys/arch/hp700/gsc

2009-05-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May  9 02:29:29 UTC 2009

Modified Files:
src/sys/arch/hp700/gsc: if_iee_gsc.c

Log Message:
Call bus_dmamap_sync(9) more properly on DMA polling.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp700/gsc/if_iee_gsc.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/hp700/gsc/if_iee_gsc.c
diff -u src/sys/arch/hp700/gsc/if_iee_gsc.c:1.10 src/sys/arch/hp700/gsc/if_iee_gsc.c:1.11
--- src/sys/arch/hp700/gsc/if_iee_gsc.c:1.10	Thu May  7 14:22:37 2009
+++ src/sys/arch/hp700/gsc/if_iee_gsc.c	Sat May  9 02:29:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iee_gsc.c,v 1.10 2009/05/07 14:22:37 tsutsui Exp $ */
+/* $NetBSD: if_iee_gsc.c,v 1.11 2009/05/09 02:29:29 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iee_gsc.c,v 1.10 2009/05/07 14:22:37 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iee_gsc.c,v 1.11 2009/05/09 02:29:29 tsutsui Exp $");
 
 /* autoconfig and device stuff */
 #include 
@@ -113,22 +113,24 @@
 {
 	struct iee_gsc_softc *sc_gsc = (struct iee_gsc_softc *)sc;
 	int n;
+	uint16_t ack;
 
 	SC_SCB->scb_cmd = cmd;
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCB_OFF, IEE_SCB_SZ,
-	BUS_DMASYNC_PREWRITE);
+	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 	/* Issue a Channel Attention to force the chip to read the cmd. */
 	bus_space_write_4(sc_gsc->sc_iot, sc_gsc->sc_ioh, IEE_GSC_CHANATT, 0);
 	/* Wait for the cmd to finish */
 	for (n = 0 ; n < 10; n++) {
 		DELAY(1);
 		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCB_OFF,
+		IEE_SCB_SZ, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+		ack = SC_SCB->scb_cmd;
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCB_OFF,
 		IEE_SCB_SZ, BUS_DMASYNC_PREREAD);
-		if (SC_SCB->scb_cmd == 0)
+		if (ack == 0)
 			break;
 	}
-	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCB_OFF, IEE_SCB_SZ,
-	BUS_DMASYNC_PREREAD);
 	if (n < 10)
 		return 0;
 	printf("%s: iee_gsc_cmd: timeout n=%d\n", device_xname(sc->sc_dev), n);
@@ -141,11 +143,13 @@
 	struct iee_gsc_softc *sc_gsc = (struct iee_gsc_softc *)sc;
 	int n;
 	uint32_t cmd;
+	uint16_t ack;
 
 	/* Make sure the bussy byte is set and the cache is flushed. */
 	SC_ISCP->iscp_bussy = IEE_ISCP_BUSSY;
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCP_OFF, IEE_SCP_SZ
-	+ IEE_ISCP_SZ + IEE_SCB_SZ, BUS_DMASYNC_PREWRITE);
+	+ IEE_ISCP_SZ + IEE_SCB_SZ,
+	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 	/* Setup the PORT Command with pointer to SCP. */
 	cmd = IEE_PORT_SCP | IEE_PHYS_SHMEM(IEE_SCP_OFF);
 	/* Write a word to IEE_GSC_RESET to initiate a Hardware reset. */
@@ -171,13 +175,14 @@
 	/* Wait for the chip to initialize and read SCP and ISCP. */
 	for (n = 0 ; n < 1000; n++) {
 		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_ISCP_OFF,
+		IEE_ISCP_SZ, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+		ack = SC_ISCP->iscp_bussy;
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_ISCP_OFF,
 		IEE_ISCP_SZ, BUS_DMASYNC_PREREAD);
-		if (SC_ISCP->iscp_bussy != IEE_ISCP_BUSSY)
+		if (ack != IEE_ISCP_BUSSY)
 			break;
 		DELAY(100);
 	}
-	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_ISCP_OFF,
-	IEE_ISCP_SZ, BUS_DMASYNC_PREREAD);
 	if (n < 1000) {
 		/* ACK interrupts we may have caused */
 		(sc->sc_iee_cmd)(sc, IEE_SCB_ACK);



CVS commit: src/sys/arch/hp700/gsc

2009-05-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu May  7 14:22:37 UTC 2009

Modified Files:
src/sys/arch/hp700/gsc: if_iee_gsc.c

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp700/gsc/if_iee_gsc.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/hp700/gsc/if_iee_gsc.c
diff -u src/sys/arch/hp700/gsc/if_iee_gsc.c:1.9 src/sys/arch/hp700/gsc/if_iee_gsc.c:1.10
--- src/sys/arch/hp700/gsc/if_iee_gsc.c:1.9	Thu May  7 14:13:01 2009
+++ src/sys/arch/hp700/gsc/if_iee_gsc.c	Thu May  7 14:22:37 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iee_gsc.c,v 1.9 2009/05/07 14:13:01 tsutsui Exp $ */
+/* $NetBSD: if_iee_gsc.c,v 1.10 2009/05/07 14:22:37 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iee_gsc.c,v 1.9 2009/05/07 14:13:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iee_gsc.c,v 1.10 2009/05/07 14:22:37 tsutsui Exp $");
 
 /* autoconfig and device stuff */
 #include 
@@ -71,9 +71,9 @@
 #include 
 
 #include "bpfilter.h"
-#if NBPFILTER > 0 
+#if NBPFILTER > 0
 #include 
-#endif 
+#endif
 
 #include 
 #include 
@@ -102,7 +102,7 @@
 	iee_gsc_match,
 	iee_gsc_attach,
 	iee_gsc_detach,
-	NULL
+	NULL
 );
 
 int iee_gsc_cmd(struct iee_softc *, u_int32_t);
@@ -122,7 +122,7 @@
 	/* Wait for the cmd to finish */
 	for (n = 0 ; n < 10; n++) {
 		DELAY(1);
-		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCB_OFF, 
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCB_OFF,
 		IEE_SCB_SZ, BUS_DMASYNC_PREREAD);
 		if (SC_SCB->scb_cmd == 0)
 			break;
@@ -144,7 +144,7 @@
 
 	/* Make sure the bussy byte is set and the cache is flushed. */
 	SC_ISCP->iscp_bussy = IEE_ISCP_BUSSY;
-	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCP_OFF, IEE_SCP_SZ 
+	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_SCP_OFF, IEE_SCP_SZ
 	+ IEE_ISCP_SZ + IEE_SCB_SZ, BUS_DMASYNC_PREWRITE);
 	/* Setup the PORT Command with pointer to SCP. */
 	cmd = IEE_PORT_SCP | IEE_PHYS_SHMEM(IEE_SCP_OFF);
@@ -170,13 +170,13 @@
 	bus_space_write_4(sc_gsc->sc_iot, sc_gsc->sc_ioh, IEE_GSC_CHANATT, 0);
 	/* Wait for the chip to initialize and read SCP and ISCP. */
 	for (n = 0 ; n < 1000; n++) {
-		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_ISCP_OFF, 
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_ISCP_OFF,
 		IEE_ISCP_SZ, BUS_DMASYNC_PREREAD);
 		if (SC_ISCP->iscp_bussy != IEE_ISCP_BUSSY)
 			break;
 		DELAY(100);
 	}
-	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_ISCP_OFF, 
+	bus_dmamap_sync(sc->sc_dmat, sc->sc_shmem_map, IEE_ISCP_OFF,
 	IEE_ISCP_SZ, BUS_DMASYNC_PREREAD);
 	if (n < 1000) {
 		/* ACK interrupts we may have caused */
@@ -218,18 +218,18 @@
 	else
 		sc->sc_type = I82596_CA;	/* LASI based */
 	/*
-	 * Pre PA7100LC CPUs don't support uncacheable mappings. So make 
-	 * descriptors align to cache lines. Needed to avoid race conditions 
-	 * caused by flushing cache lines that overlap multiple descriptors. 
+	 * Pre PA7100LC CPUs don't support uncacheable mappings. So make
+	 * descriptors align to cache lines. Needed to avoid race conditions
+	 * caused by flushing cache lines that overlap multiple descriptors.
 	 */
-cpu_type = hppa_cpu_info->hci_type;
+	cpu_type = hppa_cpu_info->hci_type;
 	if (cpu_type == hpcx || cpu_type == hpcxs || cpu_type == hpcxt)
 		sc->sc_cl_align = 32;
 	else
 		sc->sc_cl_align = 1;
 
 	sc_gsc->sc_iot = ga->ga_iot;
-	if (bus_space_map(sc_gsc->sc_iot, ga->ga_hpa, IEE_GSC_IO_SZ, 0, 
+	if (bus_space_map(sc_gsc->sc_iot, ga->ga_hpa, IEE_GSC_IO_SZ, 0,
 	&sc_gsc->sc_ioh)) {
 		aprint_error(": iee_gsc_attach: can't map I/O space\n");
 		return;
@@ -242,13 +242,13 @@
 		"DMA memory\n", (int)IEE_SHMEM_MAX);
 		return;
 	}
-	if (bus_dmamem_map(sc->sc_dmat, &sc->sc_dma_segs, rsegs, IEE_SHMEM_MAX, 
+	if (bus_dmamem_map(sc->sc_dmat, &sc->sc_dma_segs, rsegs, IEE_SHMEM_MAX,
 	(void **)&sc->sc_shmem_addr, BUS_DMA_NOWAIT) != 0) {
 		aprint_error(": iee_gsc_attach: can't map DMA memory\n");
 		bus_dmamem_free(sc->sc_dmat, &sc->sc_dma_segs, rsegs);
 		return;
 	}
-	if (bus_dmamap_create(sc->sc_dmat, IEE_SHMEM_MAX, rsegs, 
+	if (bus_dmamap_create(sc->sc_dmat, IEE_SHMEM_MAX, rsegs,
 	IEE_SHMEM_MAX, 0, BUS_DMA_NOWAIT, &sc->sc_shmem_map) != 0) {
 		aprint_error(": iee_gsc_attach: can't create DMA map\n");
 		bus_dmamem_unmap(sc->sc_dmat, sc->sc_shmem_addr, IEE_SHMEM_MAX);
@@ -276,11 +276,11 @@
 		 *	715/50, 735/99: Rev A1? (per PR port-hp700/35531)
 		 *	735/125: Rev C
 		 */
-		SC_SCP->scp_sysbus = IEE_SYSBUS_INT | 
+		SC_SCP->scp_sysbus = IEE_SYSBUS_INT |
 		IEE_SYSBUS_TRG | IEE_SYSBUS_LIEAR | IEE_SYSBUS_STD;
 		sc->sc_flags = IEE_NEED_SWAP | IEE_REV_A;
 	} else {
-		SC_SCP->scp_sysbus = IEE_SYSBUS_BE | IEE_SYSBUS_INT | 
+		SC_SCP->scp_sysbus = IEE_SYSBUS_BE | IEE_SYSBUS_INT |
 		IEE_SYSBUS_TRG | IEE_SYSBUS

CVS commit: src/sys/arch/hp700/gsc

2009-05-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu May  7 14:13:01 UTC 2009

Modified Files:
src/sys/arch/hp700/gsc: if_iee_gsc.c

Log Message:
Some earlier machines like 715/50 and 735/99 have the i82596DX Rev A chip
which doesn't support 32-bit big endian mode enabled by IEE_SYSBUS_BE bit,
so don't rely on the IEE_SYSBUS_BE mode on old HPPA_FIO_LAN models and
use IEE_REV_A quirk flag recently added into MI i82596.c.

Tested on HP9000 735/125 by me and also tested on 715/50 by skrll@
with netbsd-5 branch.  Closes MD part of PR port-hp700/35531.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hp700/gsc/if_iee_gsc.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/hp700/gsc/if_iee_gsc.c
diff -u src/sys/arch/hp700/gsc/if_iee_gsc.c:1.8 src/sys/arch/hp700/gsc/if_iee_gsc.c:1.9
--- src/sys/arch/hp700/gsc/if_iee_gsc.c:1.8	Thu Apr 30 07:01:26 2009
+++ src/sys/arch/hp700/gsc/if_iee_gsc.c	Thu May  7 14:13:01 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iee_gsc.c,v 1.8 2009/04/30 07:01:26 skrll Exp $ */
+/* $NetBSD: if_iee_gsc.c,v 1.9 2009/05/07 14:13:01 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iee_gsc.c,v 1.8 2009/04/30 07:01:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iee_gsc.c,v 1.9 2009/05/07 14:13:01 tsutsui Exp $");
 
 /* autoconfig and device stuff */
 #include 
@@ -194,7 +194,8 @@
 	struct gsc_attach_args *ga = aux;
 
 	if (ga->ga_type.iodc_type == HPPA_TYPE_FIO
-	&& ga->ga_type.iodc_sv_model == HPPA_FIO_GLAN)
+	&& (ga->ga_type.iodc_sv_model == HPPA_FIO_LAN
+	|| ga->ga_type.iodc_sv_model == HPPA_FIO_GLAN))
 		/* beat old ie(4) i82586 driver */
 		return 10;
 	return 0;
@@ -216,7 +217,6 @@
 		sc->sc_type = I82596_DX;	/* ASP(2) based */
 	else
 		sc->sc_type = I82596_CA;	/* LASI based */
-	sc->sc_flags = IEE_NEED_SWAP;
 	/*
 	 * Pre PA7100LC CPUs don't support uncacheable mappings. So make 
 	 * descriptors align to cache lines. Needed to avoid race conditions 
@@ -266,8 +266,24 @@
 	memset(sc->sc_shmem_addr, 0, IEE_SHMEM_MAX);
 
 	/* Setup SYSBUS byte. */
-	SC_SCP->scp_sysbus = IEE_SYSBUS_BE | IEE_SYSBUS_INT | 
-	IEE_SYSBUS_TRG | IEE_SYSBUS_LIEAR | IEE_SYSBUS_STD;
+	if (ga->ga_type.iodc_sv_model == HPPA_FIO_LAN) {
+		/*
+		 * Some earlier machines have 82596DX Rev A1 chip
+		 * which doesn't have IEE_SYSBUS_BE for 32-bit BE pointers.
+		 *
+		 * XXX: How can we detect chip revision at runtime?
+		 *	Should we check cpu_models instead?
+		 *	715/50, 735/99: Rev A1? (per PR port-hp700/35531)
+		 *	735/125: Rev C
+		 */
+		SC_SCP->scp_sysbus = IEE_SYSBUS_INT | 
+		IEE_SYSBUS_TRG | IEE_SYSBUS_LIEAR | IEE_SYSBUS_STD;
+		sc->sc_flags = IEE_NEED_SWAP | IEE_REV_A;
+	} else {
+		SC_SCP->scp_sysbus = IEE_SYSBUS_BE | IEE_SYSBUS_INT | 
+		IEE_SYSBUS_TRG | IEE_SYSBUS_LIEAR | IEE_SYSBUS_STD;
+		sc->sc_flags = IEE_NEED_SWAP;
+	}
 
 	sc_gsc->sc_ih = hp700_intr_establish(self, IPL_NET,
 	iee_intr, sc, ga->ga_int_reg, ga->ga_irq);



CVS commit: src/sys/arch/hp700/gsc

2009-04-16 Thread Matt Fleming
Module Name:src
Committed By:   mjf
Date:   Thu Apr 16 12:56:07 UTC 2009

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
Add a license with my name on it. Suggested by skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.14 src/sys/arch/hp700/gsc/harmony.c:1.15
--- src/sys/arch/hp700/gsc/harmony.c:1.14	Wed Apr 15 20:07:58 2009
+++ src/sys/arch/hp700/gsc/harmony.c	Thu Apr 16 12:56:07 2009
@@ -1,7 +1,36 @@
-/*	$NetBSD: harmony.c,v 1.14 2009/04/15 20:07:58 mjf Exp $	*/
+/*	$NetBSD: harmony.c,v 1.15 2009/04/16 12:56:07 mjf Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Fleming.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 /*
  * Copyright (c) 2003 Jason L. Wright (ja...@thought.net)
  * All rights reserved.



CVS commit: src/sys/arch/hp700/gsc

2009-04-15 Thread Matt Fleming
Module Name:src
Committed By:   mjf
Date:   Wed Apr 15 20:07:58 UTC 2009

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
Get audio capture fully working with harmony(4) and fix PR/35239.

skrll@ reports that with this patch he can record and playback audio.
Suprisingly the bug was actually with playback and not with capture.
When not capturing or playing audio we write to or read from "empty
buffers", the problem was that playback and capture were using the same
buffer and the playback code managed to pick up a bit of data that was
written from the capture code.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.13 src/sys/arch/hp700/gsc/harmony.c:1.14
--- src/sys/arch/hp700/gsc/harmony.c:1.13	Tue Sep 23 14:07:11 2008
+++ src/sys/arch/hp700/gsc/harmony.c	Wed Apr 15 20:07:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.13 2008/09/23 14:07:11 mjf Exp $	*/
+/*	$NetBSD: harmony.c,v 1.14 2009/04/15 20:07:58 mjf Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -133,6 +133,8 @@
 void harmony_tick_cp(void *);
 void harmony_try_more(struct harmony_softc *, int, int,
 	struct harmony_channel *);
+static void harmony_empty_input(struct harmony_softc *);
+static void harmony_empty_output(struct harmony_softc *);
 
 #if NRND > 0
 void harmony_acc_tmo(void *);
@@ -243,7 +245,7 @@
 	for (i = 0; i < CAPTURE_EMPTYS; i++)
 		sc->sc_capture_paddrs[i] =
 		sc->sc_empty_map->dm_segs[0].ds_addr +
-		offsetof(struct harmony_empty, playback[i][0]);
+		offsetof(struct harmony_empty, capture[i][0]);
 
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_empty_map,
 	offsetof(struct harmony_empty, playback[0][0]),
@@ -663,6 +665,18 @@
 	return 0;
 }
 
+static void
+harmony_empty_output(struct harmony_softc *sc)
+{
+
+	WRITE_REG(sc, HARMONY_PNXTADD,
+	sc->sc_playback_paddrs[sc->sc_playback_empty]);
+	SYNC_REG(sc, HARMONY_PNXTADD, BUS_SPACE_BARRIER_WRITE);
+
+	if (++sc->sc_playback_empty == PLAYBACK_EMPTYS)
+		sc->sc_playback_empty = 0;
+}
+
 int
 harmony_halt_output(void *vsc)
 {
@@ -670,9 +684,23 @@
 
 	sc = vsc;
 	sc->sc_playing = 0;
+
+	harmony_empty_output(sc);
 	return 0;
 }
 
+static void
+harmony_empty_input(struct harmony_softc *sc)
+{
+
+	WRITE_REG(sc, HARMONY_RNXTADD,
+	sc->sc_capture_paddrs[sc->sc_capture_empty]);
+	SYNC_REG(sc, HARMONY_RNXTADD, BUS_SPACE_BARRIER_WRITE);
+
+	if (++sc->sc_capture_empty == CAPTURE_EMPTYS)
+		sc->sc_capture_empty = 0;
+}
+
 int
 harmony_halt_input(void *vsc)
 {
@@ -680,6 +708,8 @@
 
 	sc = vsc;
 	sc->sc_capturing = 0;
+
+	harmony_empty_input(sc);
 	return 0;
 }
 
@@ -1097,12 +1127,9 @@
 	bus_size_t togo;
 
 	c = &sc->sc_capture;
-	if (sc->sc_capturing == 0) {
-		WRITE_REG(sc, HARMONY_RNXTADD,
-		sc->sc_capture_paddrs[sc->sc_capture_empty]);
-		if (++sc->sc_capture_empty == CAPTURE_EMPTYS)
-			sc->sc_capture_empty = 0;
-	} else {
+	if (sc->sc_capturing == 0)
+		harmony_empty_input(sc);
+	else {
 		d = c->c_current;
 		togo = c->c_segsz - c->c_cnt;
 		if (togo == 0) {
@@ -1143,12 +1170,9 @@
 	bus_size_t togo;
 
 	c = &sc->sc_playback;
-	if (sc->sc_playing == 0) {
-		WRITE_REG(sc, HARMONY_PNXTADD,
-		sc->sc_playback_paddrs[sc->sc_playback_empty]);
-		if (++sc->sc_playback_empty == PLAYBACK_EMPTYS)
-			sc->sc_playback_empty = 0;
-	} else {
+	if (sc->sc_playing == 0)
+		harmony_empty_output(sc);
+	else {
 		d = c->c_current;
 		togo = c->c_segsz - c->c_cnt;
 		if (togo == 0) {