[parisc-linux-cvs] 2.4.18-pa59 DIFF PARISC support for sym2 driver

Grant Grundler grundler@dsl2.external.hp.com
Fri, 26 Jul 2002 00:37:36 -0600


Grant Grundler wrote:
> Log message:
> 2.4.18-pa59 add PARISC support to sym2 driver
> 
> o fix bug in pdc_get_initiator()
> o fix counterpart bug in sym1 driver
> o add PARISC support to sym2 driver
> 
> sym2 driver tested on c3000 and it works fine.

The missing "!" bothered me a bit when I was working
on the sym53c8xx.c driver originally. But I figured it
was just me not getting the logic right and I somehow
convinced myself that since it worked it was right.
Well, it was wrong and the upper bits (parity) got masked
for *every* interface...none were ever getting set to
narrow properly.

grant

Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.329
diff -u -p -r1.329 Makefile
--- Makefile	24 Jul 2002 19:10:28 -0000	1.329
+++ Makefile	26 Jul 2002 05:59:41 -0000
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 18
-EXTRAVERSION = -pa58
+EXTRAVERSION = -pa59
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
Index: arch/parisc/kernel/firmware.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/firmware.c,v
retrieving revision 1.43
diff -u -p -r1.43 firmware.c
--- arch/parisc/kernel/firmware.c	7 Apr 2002 21:11:46 -0000	1.43
+++ arch/parisc/kernel/firmware.c	26 Jul 2002 05:59:41 -0000
@@ -507,12 +507,11 @@ int pdc_get_initiator( struct hardware_p
 
 /* BCJ-XXXX series boxes. E.G. "9000/785/C3000" */
 #define IS_SPROCKETS() (strlen(boot_cpu_data.pdc.sys_model_name) == 14 && \
-	strncmp(boot_cpu_data.pdc.sys_model_name, "9000/785", 9) == 0)
+	strncmp(boot_cpu_data.pdc.sys_model_name, "9000/785", 8) == 0)
 
 	retval = mem_pdc_call(PDC_INITIATOR, PDC_GET_INITIATOR, 
 			      __pa(pdc_result), __pa(hwpath));
 
-
 	if (retval >= PDC_OK) {
 		*scsi_id = (unsigned char) pdc_result[0];
 
@@ -534,10 +533,12 @@ int pdc_get_initiator( struct hardware_p
 		** pdc_result[3]	PDC suggested SCSI rate
 		*/
 
+		/*
+		** XXX REVISIT: Doesn't look like PAT PDC does the same.
+		** Problem is A500 also exports 50-pin SE SCSI port.
+		*/
 		if (IS_SPROCKETS()) {
 			/*
-			** Revisit: PAT PDC do the same thing?
-			** A500 also exports 50-pin SE SCSI.
 			**	0 == 8-bit
 			**	1 == 16-bit
 			*/
Index: drivers/scsi/sym53c8xx.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/sym53c8xx.c,v
retrieving revision 1.17
diff -u -p -r1.17 sym53c8xx.c
--- drivers/scsi/sym53c8xx.c	30 Jan 2002 08:14:47 -0000	1.17
+++ drivers/scsi/sym53c8xx.c	26 Jul 2002 05:59:45 -0000
@@ -7104,7 +7104,7 @@ static int ncr_reset_scsi_bus(ncb_p np, 
 		INB(nc_sbcl);	/* req ack bsy sel atn msg cd io    */
 
 #ifdef CONFIG_PARISC
-	if (np->maxwide)
+	if (!np->maxwide)
 #else
 	if (!(np->features & FE_WIDE))
 #endif
Index: drivers/scsi/sym53c8xx_2/sym_hipd.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/sym53c8xx_2/sym_hipd.c,v
retrieving revision 1.3
diff -u -p -r1.3 sym_hipd.c
--- drivers/scsi/sym53c8xx_2/sym_hipd.c	3 Jan 2002 22:37:19 -0000	1.3
+++ drivers/scsi/sym53c8xx_2/sym_hipd.c	26 Jul 2002 05:59:49 -0000
@@ -289,7 +289,11 @@ int sym_reset_scsi_bus(hcb_p np, int ena
 		((INW(nc_sbdl) & 0xff00) << 10) |	/* d15-8    */
 		INB(nc_sbcl);	/* req ack bsy sel atn msg cd io    */
 
+#ifdef CONFIG_PARISC
+	if (!np->maxwide)
+#else
 	if (!(np->features & FE_WIDE))
+#endif
 		term &= 0x3ffff;
 
 	if (term != (2<<7)) {
@@ -744,6 +748,12 @@ static int sym_prepare_setting(hcb_p np,
 	u32	period;
 	int i;
 
+#ifdef CONFIG_PARISC
+	unsigned long pdc_period;
+	char scsi_mode = -1;
+	struct hardware_path hwpath;
+#endif
+
 	/*
 	 *  Wide ?
 	 */
@@ -800,6 +810,31 @@ static int sym_prepare_setting(hcb_p np,
 	 * Btw, 'period' is in tenths of nanoseconds.
 	 */
 	period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
+
+#if defined(CONFIG_PARISC)
+	/* Host firmware (PDC) keeps a table for crippling SCSI capabilities.
+	 * Many newer machines export one channel of 53c896 chip
+	 * as SE, 50-pin HD.  Also used for Multi-initiator SCSI clusters
+	 * to set the SCSI Initiator ID.
+	 */
+	get_pci_node_path(np->s.device, &hwpath);
+	if (pdc_get_initiator(&hwpath, &np->myaddr, &pdc_period, &np->maxwide, &scsi_mode))
+	{
+		if (scsi_mode >= 0) {
+			/* C3000 PDC reports period/mode */
+			SYM_SETUP_SCSI_DIFF = 0;
+			switch(scsi_mode) {
+			case 0:	np->scsi_mode = SMODE_SE; break;
+			case 1:	np->scsi_mode = SMODE_HVD; break;
+			case 2:	np->scsi_mode = SMODE_LVD; break;
+			default:	break;
+			}
+		}
+
+		period = (u32) pdc_period;
+	}
+#endif
+
 	if	(period <= 250)		np->minsync = 10;
 	else if	(period <= 303)		np->minsync = 11;
 	else if	(period <= 500)		np->minsync = 12;