Skip to contentSkip to conversation

using dma_get_required_mask() in sym2

PATCH/Example James Bottomley 1 participant 1 message Jun 28, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This patch shows how to use dma_get_required_mask() to make the sym2 driver select the correct descriptor format on the fly (instead of having to have it compiled in to the driver).

I've compiled and booted it on my 64 bit system with a 53c875

James

===== drivers/scsi/Kconfig 1.73 vs edited =====

drivers/scsi/Kconfig +0 -23
@@ -947,29 +947,6 @@
 	  Please read <file:Documentation/scsi/sym53c8xx_2.txt> for more
 	  information.
 
-config SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
-	int "DMA addressing mode"
-	depends on SCSI_SYM53C8XX_2
-	default "1"
-	---help---
-	  This option only applies to PCI-SCSI chips that are PCI DAC
-	  capable (875A, 895A, 896, 1010-33, 1010-66, 1000).
-
-	  When set to 0, the driver will program the chip to only perform
-	  32-bit DMA.  When set to 1, the chip will be able to perform DMA
-	  to addresses up to 1TB.  When set to 2, the driver supports the
-	  full 64-bit DMA address range, but can only address 16 segments
-	  of 4 GB each.  This limits the total addressable range to 64 GB.
-
-	  Most machines with less than 4GB of memory should use a setting
-	  of 0 for best performance.  If your machine has 4GB of memory
-	  or more, you should set this option to 1 (the default).
-
-	  The still experimental value 2 (64 bit DMA addressing with 16
-	  x 4GB segments limitation) can be used on systems that require
-	  PCI address bits past bit 39 to be set for the addressing of
-	  memory using PCI DAC cycles.
-
 config SCSI_SYM53C8XX_DEFAULT_TAGS
 	int "default tagged command queue depth"
 	depends on SCSI_SYM53C8XX_2

===== drivers/scsi/sym53c8xx_2/sym_fw.c 1.5 vs edited =====

drivers/scsi/sym53c8xx_2/sym_fw.c +1 -3
@@ -193,18 +193,16 @@
 		scripta0->start[0]	= cpu_to_scr(SCR_NO_OP);
 	}
 
-#if   SYM_CONF_DMA_ADDRESSING_MODE == 2
 	/*
 	 *  Remove useless 64 bit DMA specific SCRIPTS, 
 	 *  when this feature is not available.
 	 */
-	if (!np->use_dac) {
+	if (np->dma_addressing_mode != SYM_DMA_64_BIT) {
 		scripta0->is_dmap_dirty[0] = cpu_to_scr(SCR_NO_OP);
 		scripta0->is_dmap_dirty[1] = 0;
 		scripta0->is_dmap_dirty[2] = cpu_to_scr(SCR_NO_OP);
 		scripta0->is_dmap_dirty[3] = 0;
 	}
-#endif
 
 #ifdef SYM_CONF_IARB_SUPPORT
 	/*

===== drivers/scsi/sym53c8xx_2/sym_fw2.h 1.5 vs edited =====

drivers/scsi/sym53c8xx_2/sym_fw2.h +0 -4
@@ -74,9 +74,7 @@
 #else
 	u32 select		[  4];
 #endif
-#if	SYM_CONF_DMA_ADDRESSING_MODE == 2
 	u32 is_dmap_dirty	[  4];
-#endif
 	u32 wf_sel_done		[  2];
 	u32 sel_done		[  2];
 	u32 send_ident		[  2];
@@ -342,13 +340,11 @@
 	 *  Patched with NOOP for chips that donnot 
 	 *  support DAC addressing.
 	 */
-#if	SYM_CONF_DMA_ADDRESSING_MODE == 2
 }/*-------------------------< IS_DMAP_DIRTY >--------------------*/,{
 	SCR_FROM_REG (HX_REG),
 		0,
 	SCR_INT ^ IFTRUE (MASK (HX_DMAP_DIRTY, HX_DMAP_DIRTY)),
 		SIR_DMAP_DIRTY,
-#endif
 }/*-------------------------< WF_SEL_DONE >----------------------*/,{
 	SCR_INT ^ IFFALSE (WHEN (SCR_MSG_OUT)),
 		SIR_SEL_ATN_NO_MSG_OUT,

===== drivers/scsi/sym53c8xx_2/sym_glue.c 1.44 vs edited =====

drivers/scsi/sym53c8xx_2/sym_glue.c +24 -17

51 lines not on this page · raw message

===== drivers/scsi/sym53c8xx_2/sym_hipd.c 1.18 vs edited =====

drivers/scsi/sym53c8xx_2/sym_hipd.c +17 -21
@@ -871,19 +871,23 @@
 	 *  64 bit addressing  (895A/896/1010) ?
 	 */
 	if (np->features & FE_DAC) {
-#if   SYM_CONF_DMA_ADDRESSING_MODE == 0
-		np->rv_ccntl1	|= (DDAC);
-#elif SYM_CONF_DMA_ADDRESSING_MODE == 1
-		if (!np->use_dac)
+		switch (np->dma_addressing_mode) {
+		case SYM_DMA_32_BIT:
 			np->rv_ccntl1	|= (DDAC);
-		else
-			np->rv_ccntl1	|= (XTIMOD | EXTIBMV);
-#elif SYM_CONF_DMA_ADDRESSING_MODE == 2
-		if (!np->use_dac)
-			np->rv_ccntl1	|= (DDAC);
-		else
-			np->rv_ccntl1	|= (0 | EXTIBMV);
-#endif
+			break;
+		case SYM_DMA_40_BIT:
+			if (!np->use_dac)
+				np->rv_ccntl1	|= (DDAC);
+			else
+				np->rv_ccntl1	|= (XTIMOD | EXTIBMV);
+			break;
+		case SYM_DMA_64_BIT:
+			if (!np->use_dac)
+				np->rv_ccntl1	|= (DDAC);
+			else
+				np->rv_ccntl1	|= (0 | EXTIBMV);
+			break;
+		}
 	}
 
 	/*
@@ -1443,7 +1447,6 @@
 	return 0;
 }
 
-#if SYM_CONF_DMA_ADDRESSING_MODE == 2
 /*
  *  Lookup the 64 bit DMA segments map.
  *  This is only used if the direct mapping 
@@ -1495,7 +1498,6 @@
 	}
 	np->dmap_dirty = 0;
 }
-#endif
 
 /*
  *  Prepare the next negotiation message if needed.
@@ -1598,14 +1600,12 @@
 	np->last_cp = cp;
 #endif
 
-#if   SYM_CONF_DMA_ADDRESSING_MODE == 2
 	/*
 	 *  Make SCRIPTS aware of the 64 bit DMA 
 	 *  segment registers not being up-to-date.
 	 */
 	if (np->dmap_dirty)
 		cp->host_xflags |= HX_DMAP_DIRTY;
-#endif
 
 	/*
 	 *  Optionnaly, set the IO timeout condition.
@@ -1877,17 +1877,15 @@
 		OUTB (nc_ccntl1, np->rv_ccntl1);
 	}
 
-#if	SYM_CONF_DMA_ADDRESSING_MODE == 2
 	/*
 	 *  Set up scratch C and DRS IO registers to map the 32 bit 
 	 *  DMA address range our data structures are located in.
 	 */
-	if (np->use_dac) {
+	if (np->use_dac && np->dma_addressing_mode == SYM_DMA_64_BIT) {
 		np->dmap_bah[0] = 0;	/* ??? */
 		OUTL (nc_scrx[0], np->dmap_bah[0]);
 		OUTL (nc_drs, np->dmap_bah[0]);
 	}
-#endif
 
 	/*
 	 *  If phase mismatch handled by scripts (895A/896/1010),
@@ -4474,7 +4472,6 @@
 	if (DEBUG_FLAGS & DEBUG_TINY) printf ("I#%d", num);
 
 	switch (num) {
-#if   SYM_CONF_DMA_ADDRESSING_MODE == 2
 	/*
 	 *  SCRIPTS tell us that we may have to update 
 	 *  64 bit DMA segment registers.
@@ -4482,7 +4479,6 @@
 	case SIR_DMAP_DIRTY:
 		sym_update_dmap_regs(np);
 		goto out;
-#endif
 	/*
 	 *  Command has been completed with error condition 
 	 *  or has been auto-sensed.

===== drivers/scsi/sym53c8xx_2/sym_hipd.h 1.6 vs edited =====

drivers/scsi/sym53c8xx_2/sym_hipd.h +47 -40

144 lines not on this page · raw message