Port-vax archive

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

Re: VAXstation 4000 TURBOchannel not working



Am 23.03.2016 um 18:55 schrieb David Brownlee:
You probably don't need to probe for the TC adapter itself as scanning
the TC space behind it the usual way for a ROM signature should just do,
and you need to do this anyway to know what's there.  An empty adapter
does not really buy you anything.

Entirely cosmetic, but Its nice to see in a dmesg if its there :)

True, and it only means reading a single bit in a register...

My fiddling yielded the following patches (attached) so far to finally get the VS4000 to recognize my PMAD-AA. Yes needs clean-up. I did not test it extensively yet (interrupts etc.)... The PMAD-AA is quite simple and one of the early TC options ("proto" ROM space), no DMA or to be correct: only DMA to the option SRAM, not to system memory.

dmesg excerpt:

[...]
tc0 at vsbus0 csr 0x36000000 vec 514 ipl 15 maskbit 2: 12.5 MHz clock
le1 at tc0 slot 0 offset 0x0: address 08:00:2b:xx:xx:xx
le1: 32 receive buffers, 8 transmit buffers
[...]

The kernel panics when I try to map the complete TC address space for the option (64 MB!) *and* the TC SGMAP ("vax_map_physmem: kernel map full"). It seems to barely work when I skip the SGMAP, which is not needed right now. Furthermore the info I found from Roger Ivie suggests that the VS4000/60 cannot DMA over TC reliably at all, while the /90 can. But there are still enough options performing nicely without DMA.
Is it possible to increase the VAX kernel map, or what to do here?

For "tc at vsbus" to match correctly, a fake interrupt vector seemed to be necessary (sc_mask and scb_fake()). I stole this from spx.c, but what would be the right way to do it (and which vector to choose)?

I also filed kern/50849 some time ago concerning a too strict option ROM header check (included in the patches).

Now as a last point, if someone would be willing to send me a spare DMA-capable TC option (SCSI probably), I would also try to get this supported.

Regards,
Felix
Index: tc_vsbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/vsa/tc_vsbus.c,v
retrieving revision 1.7
diff -u -r1.7 tc_vsbus.c
--- tc_vsbus.c	5 Jun 2011 16:12:50 -0000	1.7
+++ tc_vsbus.c	23 Mar 2016 19:27:23 -0000
@@ -35,6 +35,7 @@
 
 #include <machine/pte.h>
 #include <machine/scb.h>
+#include <machine/sid.h>
 #include <machine/vsbus.h>
 #include <dev/tc/tcvar.h>
 
@@ -82,10 +83,30 @@
 	return NULL;
 }
 
+#define	KA4x_BWF0	0x20080014
+#define	KA4x_BWF0_ADP	0x80000000
+
 int
 tcbus_match(device_t parent, cfdata_t cfdata, void *aux)
 {
-	return 0;
+	struct vsbus_softc *sc = device_private(parent);
+	volatile int *bwf0;
+	int adp;
+
+	if (vax_boardtype != VAX_BTYP_46 && vax_boardtype != VAX_BTYP_49)
+		return 0;
+
+	bwf0 = (volatile int *)vax_map_physmem(KA4x_BWF0, 1);
+	adp = *bwf0 & KA4x_BWF0_ADP;
+	vax_unmap_physmem((vaddr_t)bwf0, 1);
+
+	/* XXX Assume a found "bus adaptor" is the TC bus adaptor. */
+	if (adp) {
+		sc->sc_mask = 0x04; /* XXX - should be generated */
+		scb_fake(0x14c, 0x15);
+	}
+
+	return adp ? 20 : 0;
 }
 
 #define	KA4x_TURBO	0x30000000
@@ -98,29 +119,43 @@
 	struct vsbus_attach_args * const va = aux;
 	struct tcbus_softc * const sc = device_private(self);
 	struct tcbus_attach_args tba;
+#if 0
 	struct pte *pte;
 	const size_t nentries = 32768;
 	int error;
 	int i;
+#endif
 
-	error = bus_space_map(va->va_memt, KA4x_TURBO, 0x10000,
+#if 0
+	error = bus_space_map(va->va_memt, KA4x_TURBO, 0x4000000,
 	    BUS_SPACE_MAP_LINEAR, &sc->sc_memh);
 	if (error) {
 		aprint_error(": failed to map TC slot 0: %d\n", error);
 		return;
 	}
+#else
+	sc->sc_memh = vax_map_physmem(KA4x_TURBO, 0x4000000 / VAX_NBPG);
+	if (!sc->sc_memh) {
+		aprint_error(": failed to map TC slot 0\n");
+		return;
+	}
+#endif
 
 	sc->sc_slots[0].tcs_addr = sc->sc_memh;
 	sc->sc_slots[0].tcs_cookie = sc;
 
+	tba.tba_busname = "tc";
+	tba.tba_memt = va->va_memt;
 	tba.tba_speed = TC_SPEED_12_5_MHZ;
-	tba.tba_slots = sc->sc_slots;
 	tba.tba_nslots = 1;
+	tba.tba_slots = sc->sc_slots;
+	tba.tba_nbuiltins = 0;
 	tba.tba_intr_evcnt = tcbus_intr_evcnt;
 	tba.tba_intr_establish = tcbus_intr_establish;
 	tba.tba_intr_disestablish = tcbus_intr_disestablish;
 	tba.tba_get_dma_tag = tcbus_get_dma_tag;
 
+#if 0
 	vax_sgmap_dmatag_init(&sc->sc_dmatag, sc, nentries);
 	pte = (struct pte *) vax_map_physmem(KA4x_TURBOMAPS,
 	    nentries * sizeof(pte[0]));
@@ -134,11 +169,14 @@
 	 */
 	vax_sgmap_init(&sc->sc_dmatag, &sc->sc_sgmap, "tc_sgmap",
 	     sc->sc_dmatag._wbase, sc->sc_dmatag._wsize, pte, 0);
+#endif
 
+#if 0
 	aprint_normal("\n");
 
 	aprint_verbose_dev(self, "32K entry DMA SGMAP at PA 0x%x (VA %p)\n",
 	     KA4x_TURBOMAPS, pte);
+#endif
 
 	tcbus_dmat = &sc->sc_dmatag;
 
Index: tc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/tc/tc.c,v
retrieving revision 1.51
diff -u -r1.51 tc.c
--- tc.c	4 Jun 2011 01:57:34 -0000	1.51
+++ tc.c	23 Mar 2016 19:00:32 -0000
@@ -201,9 +201,7 @@
 
 static const tc_offset_t tc_slot_romoffs[] = {
 	TC_SLOT_ROM,
-#ifndef __vax__
 	TC_SLOT_PROTOROM,
-#endif
 };
 
 int
@@ -229,7 +227,7 @@
 		if (romp->tcr_stride.v != 4)
 			continue;
 
-		for (j = 0; j < 4; j++)
+		for (j = 0; j < romp->tcr_width.v; j++)
 			if (romp->tcr_test[j+0*romp->tcr_stride.v] != 0x55 ||
 			    romp->tcr_test[j+1*romp->tcr_stride.v] != 0x00 ||
 			    romp->tcr_test[j+2*romp->tcr_stride.v] != 0xaa ||


Home | Main Index | Thread Index | Old Index