Skip to contentSkip to conversation

Patch?: Untested advansys, pci2220i and BusLogic 2.5.6-pre3 scsi drivers, using my scsi.c changes

PATCH Adam J. Richter 2 participants 2 messages Mar 7, 2002 – Mar 19, 2002

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

If anyone is feeling particularly brave or bored, here are
three untested SCSI drivers for linux-2.5.6-pre3 that I hope fix them for the new DMA mapping requirements.

These changes use a little facility that I have added to my scsi.c
that provides two flags, by which a scsi host driver can ask the central scsi code take care of doing DMA mapping for scatter/gather lists, DMA mapping of sense_buffer, or both. I have included these changes for hosts.h and scsi.[ch] in the patch. I posted a patch for this facility yesterday, but I have changed it slightly since then to provide a mechanism by which scsi drivers see all requests as gather/scatter list, even ones submitted with scsi_request->use_sg=0, which should further simplify drivers. This facility makes it a lot easier to port to the new linux-2.5 DMA mapping requirements, and makes the drivers smaller. With approximately 90 scsi drivers, I think it will make a big difference.

Anyhow, I would appreciate it if anyone interested would
take a look at this patch or even try it, to help me spot any mistakes.

Signature · 4 lines
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
[email protected]     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."
drivers/scsi/hosts.h +5 -0
@@ -286,6 +286,11 @@
 
     unsigned highmem_io:1;
 
+    /* Have the high level code automatically handle DMA mapping of
+       Scsi_Request->request_buffer and Scsi_Request->sense_buf. */
+    unsigned dma_map_request:1;
+    unsigned dma_map_sense:1;
+
     /*
      * Name of proc directory
      */
drivers/scsi/scsi.h +10 -5
@@ -449,8 +449,6 @@
  */
 void scsi_resize_dma_pool(void);
 int scsi_init_minimal_dma_pool(void);
-void *scsi_malloc(unsigned int);
-int scsi_free(void *, unsigned int);
 
 /*
  * Prototypes for functions in scsi_merge.c
@@ -734,6 +732,7 @@
 
 	struct timer_list eh_timeout;	/* Used to time out the command. */
 	void *request_buffer;		/* Actual requested buffer */
+	dma_addr_t request_dma_addr;
 
 	/* These elements define the operation we ultimately want to perform */
 	unsigned char data_cmnd[MAX_COMMAND_SIZE];
@@ -746,6 +745,11 @@
 	unsigned bufflen;	/* Size of data buffer */
 	void *buffer;		/* Data buffer */
 
+	struct scatterlist sg_single; /* Convenience value for sg for
+                                         a transfer of a single range. */
+	struct scatterlist *sg;
+	unsigned short sg_cnt;
+
 	unsigned underflow;	/* Return error if less than
 				   this amount is transferred */
 	unsigned old_underflow;	/* save underflow here when reusing the
@@ -768,6 +772,7 @@
 						 * when CHECK CONDITION is
 						 * received on original command 
 						 * (auto-sense) */
+	dma_addr_t sense_dma_addr;
 
 	unsigned flags;
 
@@ -791,11 +796,11 @@
 	Scsi_Pointer SCp;	/* Scratchpad used by some host adapters */
 
 	unsigned char *host_scribble;	/* The host adapter is allowed to
-					   * call scsi_malloc and get some memory
+					   * call kmalloc and get some memory
 					   * and hang it here.     The host adapter
-					   * is also expected to call scsi_free
+					   * is also expected to call kfree
 					   * to release this memory.  (The memory
-					   * obtained by scsi_malloc is guaranteed
+					   * obtained by kmalloc(...,GFP_DMA) is guaranteed
 					   * to be at an address < 16Mb). */
 
 	int result;		/* Status code from lower level driver */
drivers/scsi/scsi.c +57 -0

75 lines not on this page · raw message

drivers/scsi/advansys.h +2 -0
@@ -119,6 +119,8 @@
      * by enabling clustering, I/O throughput increases as well. \
      */ \
     use_clustering:             ENABLE_CLUSTERING, \
+    dma_map_request:		1, \
+    dma_map_sense:		1, \
 }
 #endif
 #endif /* _ADVANSYS_H */
drivers/scsi/advansys.c +196 -228

853 lines not on this page · raw message

drivers/scsi/pci2220i.h +2 -0
@@ -56,5 +56,7 @@
 	present:		0,			\
 	unchecked_isa_dma:	0,			\
 	use_clustering:		DISABLE_CLUSTERING,	\
+	dma_map_request:	1,			\
+	dma_map_sense:		0,			\
 }
 #endif
drivers/scsi/pci2220i.c +44 -15

107 lines not on this page · raw message

drivers/scsi/BusLogic.h +35 -23

106 lines not on this page · raw message

drivers/scsi/BusLogic.c +109 -47

273 lines not on this page · raw message

#1 lore raw

advansys driver doesn't detect tape drive properly in 2.5.6

Hi. I have your advansys driver which compiles under 2.5.6, but its not detecting the tape drive properly, it doesn't give the vendor or model number and I saw type 18 and 22 and it gives 0 for the ansi revision.

Any assistance would be appreciated.

Signature · 2 lines
         John Covici
         [email protected]