Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: VAXstation 3100/30 KA420 SCSI DMA problem on netboot (and fix)



Hm, interesting bug :-)

So on KA420 the whole 128k DMA memory is enabled by the firmware if booted from a SCSI disk, but not from network?

I do not have any docs for either of the 3100's, but if it works for you on real hardware it sounds correct.  So go ahead!

About the /m76, no idea.  We leave it for now until someone with that hardware can test if it is needed.

Thanks for searching for this!

-- Ragge

Den 2024-02-16 kl. 11:59, skrev Izumi Tsutsui:
Hi,

I have had a problem that SCSI DMA transfer corruptions on
my VAXstation 3100/30 (KA420) on netboot for a year.

For example, "fsck(8) right after newfs(8)" always reports
a "ROOT INODE UNALLOCATED" error.  This happens even on
NetBSD/vax 1.6.2 GENERIC.

The similar newfs(8) and fsck(8) work fine if the bootloader
is loaded from DKA0 (i.e. sd0), so I had to install NetBSD/vax
files into a target SCSI disk on other NetBSD/i386 host. Once
NetBSD/vax GENERIC boots from sd0, all SCSI transfers work fine.

After a few hours investigation yesterday, it turns out the "Big DMA"
settings (that allows 128KB DMA rather than KA410 compatible 16KB DMA)
for KA420 in current implementation seem incorrect.

Actually "dd if=/dev/rsd0a bs=16k" doesn't cause any problem
but "dd if=/dev/rsd0a bs=64k" outputs incorrect data in every
16KB blocks.

arch/vax/include/ka420.h has the following register:

#define KA420_STC_MODE	0x200C00E0	/* Storage Controller Mode register */
On the other hand, arch/vax/vsbus/vsbus.c has the following lines:

		if (vax_boardtype == VAX_BTYP_410) {
			dbase = KA410_DMA_BASE;
			dsize = KA410_DMA_SIZE;
		} else {
			dbase = KA420_DMA_BASE;
			dsize = KA420_DMA_SIZE;
			*(volatile char *)(sc->sc_vsregs + 0xe0) = 1; /* Big DMA */
		}
"sc->sc_vsregs" is a region mapped from PA 0x20080000, so
the above "Big DMA" line writes the value into 0x200800E0.
But reading around 0x200800E0 doesn't show any valid value (all 0xff).

I guess this "Big DMA" register should be the above KA420_STC_MODE
(i.e. KA420_SCS_BASE (== 0x200C0080 + 0x60)), and the attached
patch actually fix the SCSI transfer issue my KA420.

I think it's okay to commit it, but I'd like to confirm that
this fix is reasonable and acceptable by VAX authorities.

The only concern is whether KA430 (3100/76) would also require
the "Big DMA" settings (at KA420_STC_MODE) or not.

---
Index: vsa/ncr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/vsa/ncr.c,v
retrieving revision 1.51
diff -u -p -d -r1.51 ncr.c
--- vsa/ncr.c	20 Dec 2023 15:34:46 -0000	1.51
+++ vsa/ncr.c	16 Feb 2024 02:53:19 -0000
@@ -66,6 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.51
  #include <machine/sid.h>
  #include <machine/scb.h>
  #include <machine/clock.h>
+#include <machine/ka420.h>
#include "ioconf.h" @@ -208,6 +209,16 @@ si_vsbus_attach(device_t parent, device_
  	else
  		target = (clk_page[0xbc/2] >> tweak) & 7;
+ /*
+	 * Explicitly enable upto 128KB "Big DMA" on KA420.
+	 * (It looks KA420 firmware doesn't enable it on network boot)
+	 */
+#define STC_MODE_OFF	(KA420_STC_MODE - KA420_SCS_BASE)
+	if (vax_boardtype == VAX_BTYP_420) {
+		bus_space_write_1(ncr_sc->sc_regt, ncr_sc->sc_regh,
+		    STC_MODE_OFF, 1);
+	}
+
  	aprint_normal("\n");
  	aprint_normal_dev(self, "NCR5380, SCSI ID %d\n", target);
Index: vsa/vsbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/vsa/vsbus.c,v
retrieving revision 1.68
diff -u -p -d -r1.68 vsbus.c
--- vsa/vsbus.c	12 Dec 2022 18:22:32 -0000	1.68
+++ vsa/vsbus.c	16 Feb 2024 02:53:19 -0000
@@ -146,7 +146,6 @@ vsbus_attach(device_t parent, device_t s
  		} else {
  			dbase = KA420_DMA_BASE;
  			dsize = KA420_DMA_SIZE;
-			*(volatile char *)(sc->sc_vsregs + 0xe0) = 1; /* Big DMA */
  		}
  		sc->sc_dmasize = dsize;
  		sc->sc_dmaaddr = uvm_km_alloc(kernel_map, dsize, 0,



Thanks,
---
Izumi Tsutsui



Home | Main Index | Thread Index | Old Index