This patch will map the sg buffers to kernel virtual memory space in the
functions idescsi_input_buffers() and idescsi_output_buffers().  Without
this patch, idescsi passes a null pointer to atapi_input_bytes() and
atapi_output_bytes() when sg pages are in high memory (i686
architecture).

I'm attaching as a file, too, as the text will certainly be wrapped.

(Sorry for the subject rename--I'm trying to use the correct format for
patch emails.)

Thanks
Stuart


Signed-off-by: Stuart Hayes <[EMAIL PROTECTED]>


--- linux-2.6.11.orig/drivers/scsi/ide-scsi.c   2005-03-09
14:13:48.000000000 -0500
+++ linux-2.6.11.new/drivers/scsi/ide-scsi.c    2005-03-09
13:56:38.000000000 -0500
@@ -143,6 +143,7 @@ static void idescsi_input_buffers (ide_d
 {
        int count;
        char *buf;
+       unsigned long flags;
 
        while (bcount) {
                if (pc->sg - (struct scatterlist *)
pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
@@ -151,8 +152,11 @@ static void idescsi_input_buffers (ide_d
                        return;
                }
                count = min(pc->sg->length - pc->b_count, bcount);
-               buf = page_address(pc->sg->page) + pc->sg->offset;
+               local_irq_save(flags);
+               buf = kmap_atomic(pc->sg->page, KM_USER0) +
pc->sg->offset;
                drive->hwif->atapi_input_bytes(drive, buf + pc->b_count,
count);
+               kunmap_atomic(buf - pc->sg->offset, KM_USER0);
+               local_irq_restore(flags);
                bcount -= count; pc->b_count += count;
                if (pc->b_count == pc->sg->length) {
                        pc->sg++;
@@ -165,6 +169,7 @@ static void idescsi_output_buffers (ide_
 {
        int count;
        char *buf;
+       unsigned long flags;
 
        while (bcount) {
                if (pc->sg - (struct scatterlist *)
pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
@@ -173,8 +178,11 @@ static void idescsi_output_buffers (ide_
                        return;
                }
                count = min(pc->sg->length - pc->b_count, bcount);
-               buf = page_address(pc->sg->page) + pc->sg->offset;
+               local_irq_save(flags);
+               buf = kmap_atomic(pc->sg->page, KM_USER0) +
pc->sg->offset;
                drive->hwif->atapi_output_bytes(drive, buf +
pc->b_count, count);
+               kunmap_atomic(buf - pc->sg->offset, KM_USER0);
+               local_irq_restore(flags);
                bcount -= count; pc->b_count += count;
                if (pc->b_count == pc->sg->length) {
                        pc->sg++;

Attachment: ide-scsi.2.6.11.try3.patch
Description: ide-scsi.2.6.11.try3.patch

Reply via email to