From f2f57c1e61c49352d0059bf762d6dad5ddafb484 Mon Sep 17 00:00:00 2001 From: nat Date: Sat, 18 Feb 2023 13:28:05 +0000 Subject: [PATCH] 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. --- sys/arch/mac68k/conf/GENERICSBC | 9 +++++---- sys/arch/mac68k/conf/INSTALLSBC | 9 +++++---- sys/arch/mac68k/dev/sbc.c | 5 +++-- sys/arch/mac68k/dev/sbcvar.h | 13 +++++++------ 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/sys/arch/mac68k/conf/GENERICSBC b/sys/arch/mac68k/conf/GENERICSBC index 2d4eabb4fa78..d84c3a226f27 100644 --- a/sys/arch/mac68k/conf/GENERICSBC +++ b/sys/arch/mac68k/conf/GENERICSBC @@ -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 diff --git a/sys/arch/mac68k/conf/INSTALLSBC b/sys/arch/mac68k/conf/INSTALLSBC index 47f881025075..7136d8ee97bf 100644 --- a/sys/arch/mac68k/conf/INSTALLSBC +++ b/sys/arch/mac68k/conf/INSTALLSBC @@ -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 diff --git a/sys/arch/mac68k/dev/sbc.c b/sys/arch/mac68k/dev/sbc.c index 6114cc6d4afb..3c2655850dae 100644 --- a/sys/arch/mac68k/dev/sbc.c +++ b/sys/arch/mac68k/dev/sbc.c @@ -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 -__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_sc, int phase, int datalen, u_char *data) 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); diff --git a/sys/arch/mac68k/dev/sbcvar.h b/sys/arch/mac68k/dev/sbcvar.h index 54e666b83ab4..af15b2097290 100644 --- a/sys/arch/mac68k/dev/sbcvar.h +++ b/sys/arch/mac68k/dev/sbcvar.h @@ -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;