Subject: Re: KA53 asc/clock bug
To: None <port-vax@NetBSD.org>
From: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
List: port-vax
Date: 08/05/2007 22:25:19
--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Jul 29, 2007 at 11:05:22AM +0200, Hans Rosenfeld wrote:
> In asc_vsbus_attach() the SCSI id for the controller is read from some
> clock chip NVRAM. This causes a segv in kernel mode for the KA53 which
> seems to lack the clock chip. OpenBSD uses a hardcoded SCSI id 6 for all
> systems but KA46, but since the existing code works with KA48 and KA49
> too I made the hardcoded value a special case for the KA53.

I just noticed that the patch doesn't work as intended for kernel
configurations which exclude KA46, KA48 and KA49. The clk_page is still
referenced, but since it is not defined anywhere the kernel cannot be
linked.

I made a new patch that references clk_page only if VAX46, VAX48 or
VAX49 are defined.


-- 
%SYSTEM-F-ANARCHISM, The operating system has been overthrown

--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="asc_vsbus.diff"

Index: asc_vsbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/vsa/asc_vsbus.c,v
retrieving revision 1.35
diff -u -r1.35 asc_vsbus.c
--- asc_vsbus.c	4 Mar 2007 19:21:56 -0000	1.35
+++ asc_vsbus.c	5 Aug 2007 20:24:35 -0000
@@ -249,8 +249,14 @@
 	error = bus_dmamap_create(asc->sc_dmat, ASC_MAXXFERSIZE, 1, 
 	    ASC_MAXXFERSIZE, 0, BUS_DMA_NOWAIT, &asc->sc_dmamap);
 
-	/* SCSI ID is store in the clock NVRAM at magic address 0xbc */
-	sc->sc_id = (clk_page[0xbc/2] >> clk_tweak) & 7;
+#if defined(VAX46) || defined(VAX48) || defined(VAX49) || defined(VAXANY)
+	if(vax_boardtype != VAX_BTYP_53)
+		/* SCSI ID is store in the clock NVRAM at magic address 0xbc */
+		sc->sc_id = (clk_page[0xbc/2] >> clk_tweak) & 7;
+	else
+#endif
+		sc->sc_id = 6; /* XXX need to get this from VMB */
+
 	sc->sc_freq = ASC_FREQUENCY;
 
 	/* gimme MHz */

--envbJBWh7q8WU6mo--