Module Name:    src
Committed By:   nat
Date:           Sat Feb 18 13:28:05 UTC 2023

Modified Files:
        src/sys/arch/mac68k/conf: GENERICSBC INSTALLSBC
        src/sys/arch/mac68k/dev: sbc.c sbcvar.h

Log Message:
Introduce a flag to disable PDMA when writing.

The use of pdma when writing would always cause a panic on my Powerbook 160,
possibly others as well.

As posted to tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mac68k/conf/GENERICSBC
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/conf/INSTALLSBC
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/mac68k/dev/sbc.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mac68k/dev/sbcvar.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/mac68k/conf/GENERICSBC
diff -u src/sys/arch/mac68k/conf/GENERICSBC:1.56 src/sys/arch/mac68k/conf/GENERICSBC:1.57
--- src/sys/arch/mac68k/conf/GENERICSBC:1.56	Thu Mar 27 20:00:24 2008
+++ src/sys/arch/mac68k/conf/GENERICSBC	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERICSBC,v 1.56 2008/03/27 20:00:24 hauke Exp $
+# $NetBSD: GENERICSBC,v 1.57 2023/02/18 13:28:05 nat Exp $
 #
 # GENERICSBC machine description file
 
@@ -12,7 +12,8 @@ include		"arch/mac68k/conf/GENERIC"
 
 no ncrscsi0				# SCSI NCR 5380
 
-# SBC_PDMA      0x01    Use PDMA for polled transfers
-# SBC_INTR      0x02    Allow SCSI IRQ/DRQ interrupts
-# SBC_RESELECT  0x04    Allow disconnect/reselect
+# SBC_PDMA		0x01    Use PDMA for polled transfers
+# SBC_INTR		0x02    Allow SCSI IRQ/DRQ interrupts
+# SBC_RESELECT		0x04    Allow disconnect/reselect
+# SBC_PDMA_NO_WRITE	0x08    Disallow PDMA for writing
 sbc0	at obio? addr 0 flags 0x1	# MI SCSI NCR 5380

Index: src/sys/arch/mac68k/conf/INSTALLSBC
diff -u src/sys/arch/mac68k/conf/INSTALLSBC:1.32 src/sys/arch/mac68k/conf/INSTALLSBC:1.33
--- src/sys/arch/mac68k/conf/INSTALLSBC:1.32	Thu Mar 27 20:00:24 2008
+++ src/sys/arch/mac68k/conf/INSTALLSBC	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALLSBC,v 1.32 2008/03/27 20:00:24 hauke Exp $
+# $NetBSD: INSTALLSBC,v 1.33 2023/02/18 13:28:05 nat Exp $
 #
 # INSTALLSBC machine description file
 
@@ -12,7 +12,8 @@ include		"arch/mac68k/conf/INSTALL"
 
 no ncrscsi0				# SCSI NCR 5380
 
-# SBC_PDMA      0x01    Use PDMA for polled transfers
-# SBC_INTR      0x02    Allow SCSI IRQ/DRQ interrupts
-# SBC_RESELECT  0x04    Allow disconnect/reselect
+# SBC_PDMA		0x01    Use PDMA for polled transfers
+# SBC_INTR		0x02    Allow SCSI IRQ/DRQ interrupts
+# SBC_RESELECT		0x04    Allow disconnect/reselect
+# SBC_PDMA_NO_WRITE	0x08    Disallow PDMA for writing
 sbc0	at obio? addr 0 flags 0x1	# MI SCSI NCR 5380

Index: src/sys/arch/mac68k/dev/sbc.c
diff -u src/sys/arch/mac68k/dev/sbc.c:1.58 src/sys/arch/mac68k/dev/sbc.c:1.59
--- src/sys/arch/mac68k/dev/sbc.c:1.58	Sat Feb 18 13:17:45 2023
+++ src/sys/arch/mac68k/dev/sbc.c	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbc.c,v 1.58 2023/02/18 13:17:45 nat Exp $	*/
+/*	$NetBSD: sbc.c,v 1.59 2023/02/18 13:28:05 nat Exp $	*/
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.58 2023/02/18 13:17:45 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.59 2023/02/18 13:28:05 nat Exp $");
 
 #include "opt_ddb.h"
 
@@ -318,6 +318,7 @@ sbc_pdma_out(struct ncr5380_softc *ncr_s
 
 	if (datalen < ncr_sc->sc_min_dma_len ||
 	    (sc->sc_options & SBC_PDMA) == 0 ||
+	    (sc->sc_options & SBC_PDMA_NO_WRITE) ||
 	    (ncr_sc->sc_current != NULL &&
 	    (ncr_sc->sc_current->sr_xs->xs_control & XS_CTL_POLL)))
 		return ncr5380_pio_out(ncr_sc, phase, datalen, data);

Index: src/sys/arch/mac68k/dev/sbcvar.h
diff -u src/sys/arch/mac68k/dev/sbcvar.h:1.12 src/sys/arch/mac68k/dev/sbcvar.h:1.13
--- src/sys/arch/mac68k/dev/sbcvar.h:1.12	Sun Dec 11 12:18:02 2005
+++ src/sys/arch/mac68k/dev/sbcvar.h	Sat Feb 18 13:28:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbcvar.h,v 1.12 2005/12/11 12:18:02 christos Exp $	*/
+/*	$NetBSD: sbcvar.h,v 1.13 2023/02/18 13:28:05 nat Exp $	*/
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -77,11 +77,12 @@ struct sbc_softc {
  * The options code is based on the sparc 'si' driver's version of
  * the same.
  */     
-#define	SBC_PDMA	0x01	/* Use PDMA for polled transfers */
-#define	SBC_INTR	0x02	/* Allow SCSI IRQ/DRQ interrupts */
-#define	SBC_RESELECT	0x04	/* Allow disconnect/reselect */
-#define	SBC_OPTIONS_MASK	(SBC_RESELECT|SBC_INTR|SBC_PDMA)
-#define	SBC_OPTIONS_BITS	"\10\3RESELECT\2INTR\1PDMA"
+#define	SBC_PDMA		0x01	/* Use PDMA for polled transfers */
+#define	SBC_INTR		0x02	/* Allow SCSI IRQ/DRQ interrupts */
+#define	SBC_RESELECT		0x04	/* Allow disconnect/reselect */
+#define	SBC_PDMA_NO_WRITE	0x08	/* No PDMA for writes */
+#define	SBC_OPTIONS_MASK (SBC_PDMA_NO_WRITE|SBC_RESELECT|SBC_INTR|SBC_PDMA)
+#define	SBC_OPTIONS_BITS	"\10\4NOWRITE3RESELECT\2INTR\1PDMA"
 
 extern int	sbc_debug;
 extern int	sbc_link_flags;

Reply via email to