Port-m68k archive

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

Re: badaddr() panics when TT is enabled



isaki@ wrote:

> > However, this means we should implememnt some proper probe routine
> > for nono emulator that doesn't have si(4) SCSI.  Umm.
> 
> nono's news68k emulation is pretty incomplete quality (because
> we authors don't know about NEWS hardware at all).  I prefer that
> guest OS doesn't take care of such in-development emulators that
> run differently from the real hardware.
> 
> On the other hand, in general, it's welcome to make our probe
> routine more robust.

The following probe routine works both on real NWS-1750 and nono.

---
Index: sys/arch/news68k/dev/si.c
===================================================================
RCS file: /cvsroot/src/sys/arch/news68k/dev/si.c,v
retrieving revision 1.26
diff -u -p -d -r1.26 si.c
--- sys/arch/news68k/dev/si.c	20 Nov 2011 15:38:00 -0000	1.26
+++ sys/arch/news68k/dev/si.c	25 Apr 2023 22:28:44 -0000
@@ -72,6 +72,7 @@ struct si_softc {
 
 static int  si_match(device_t, cfdata_t, void *);
 static void si_attach(device_t, device_t, void *);
+static int  si_test(bus_addr_t);
 int  si_intr(int);
 
 static void si_dma_alloc(struct ncr5380_softc *);
@@ -112,12 +113,46 @@ si_match(device_t parent, cfdata_t cf, v
 	if (badaddr((void *)addr, 1))
 		return 0;
 
+	if (si_test(addr) == 0)
+		return 0;
+
 	ha->ha_size = SI_REGSIZE;
 
 	return 1;
 }
 
 /*
+ * Explicitly probe CXD1180 for Nono emulator.
+ * Partially taken from nca_isa.c.
+ */
+static int
+si_test(bus_addr_t addr)
+{
+	volatile uint8_t *cxd = (uint8_t *)addr;
+	uint8_t bcsr;
+
+#define SI_ODATA	0
+#define SI_ICMD		1
+#define SI_BUS_CSR	4
+	/* Reset the SCSI bus. */
+	*(cxd + SI_ICMD) = SCI_ICMD_RST;
+	*(cxd + SI_ODATA) = 0;
+
+	/* Hold reset for at least 25 microsconds. */
+	delay(500);
+	bcsr = *(cxd + SI_BUS_CSR);
+	*(cxd + SI_ICMD) = 0;
+
+	/* Check that status cleared. */
+	if (bcsr != SCI_BUS_RST) {
+		/* Assume Nono, no si(4) here (yet). */
+		return 0;
+	}
+
+	return 1;
+}
+
+/*
  * Card attach function
  */
 
---


> > I.e.
> > PTEST with level 0:       searches the ATC
> > PTEST with levels of 1-7: searches the translation tables
> >  ..to determine status information about the translation
> > 
> > I guess "PTEST, level 0" is more explicit, per Table 9-3 ?
> 
> How about the following comment that spans in two lines?
> (Both one and two space indentation seem to be used to represent
> line continuation)
> 
> +Lbe10a:
> +	ptestr	%d0,%a0@,#0		| only PTEST #0 can detect transparent
> +	pmove	%psr,%sp@		|   translation (TT0 or TT1).
> +	movw	%sp@,%d1
> +	btst	#6,%d1			| transparent (TT0 or TT1)?

Fine for me.

> > > Unfortunately, it's not possible to find spc0 and spc1 correctly
> > > by only using current spc_mainbus_match() on LUNA due to its hard-
> > > ware characteristics.
> > 
> > As you pointed out actually it doesn't cause bus error.
> > 
> > I'll add a machtype check and cleanup maimbus_attach_args later.
> 
> Nice.  (I prefer more strict way but it maybe excessive..)

Committed:
 https://mail-index.netbsd.org/source-changes/2023/04/23/msg144286.html

Thanks,
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index