Re: aic7xxx (O2 scsi) DMA coherency

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

 



On Thu, 3 Jan 2002, Ralf Baechle wrote:

> On Thu, Jan 03, 2002 at 10:51:51PM +0100, Vivien Chappelier wrote:
> 
> > > > 	This tells the aic7xxx to use DMA safe memory for I/O.
> > > 
> > > That seems totally inappropriate. The unchecked dma option is for
> > > ancient ISA DMA controllers that didnt do the 16Mb check. If you
> > > find you need it debug your pci remapper
> > 
> > This is used when scaning for devices (drivers/scsi/scsi_scan.c) . When
> > this flag is not set, the code uses memory from the stack (unsigned char
> > scsi_result0[256]; in scan_scsis) instead of kmallocating it DMA safe as
> > it should on non-coherent systems. Maybe this is the thing to change?
> 
> Indeed, it is.  I thought this one died ages ago.

Here is a patch to fix that then. It forces allocation of DMA safe
memory in any case. I've not looked at the PPC64 patch however.

regards,
Vivien Chappelier.
--- linux/drivers/scsi/scsi_scan.c	Thu Dec 20 18:31:09 2001
+++ linux.patch/drivers/scsi/scsi_scan.c	Fri Jan  4 13:17:31 2002
@@ -283,7 +283,6 @@
 	unsigned int lun;
 	unsigned int max_dev_lun;
 	unsigned char *scsi_result;
-	unsigned char scsi_result0[256];
 	Scsi_Device *SDpnt;
 	Scsi_Device *SDtail;
 	unsigned int sparse_lun;
@@ -305,8 +304,7 @@
 		scsi_initialize_queue(SDpnt, shpnt);
 		SDpnt->request_queue.queuedata = (void *) SDpnt;
 		/* Make sure we have something that is valid for DMA purposes */
-		scsi_result = ((!shpnt->unchecked_isa_dma)
-			       ? &scsi_result0[0] : kmalloc(512, GFP_DMA));
+		scsi_result = kmalloc(512, GFP_DMA);
 	}
 
 	if (scsi_result == NULL) {
@@ -463,7 +461,7 @@
 	}
 
 	/* If we allocated a buffer so we could do DMA, free it now */
-	if (scsi_result != &scsi_result0[0] && scsi_result != NULL) {
+	if (scsi_result != NULL) {
 		kfree(scsi_result);
 	} {
 		Scsi_Device *sdev;

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux