diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-07-16 04:00:31 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-16 05:20:59 -0400 |
commit | 51cf22495ae2fe60ba28123e04059cff4ddd9461 (patch) | |
tree | 4af08aebb126b410bf3254ef3c1203abc462660c /drivers/scsi | |
parent | d274a9878bcd028712ea4f3d96db72b63d3eba4d (diff) |
aha1542: convert to use the data buffer accessors
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/aha1542.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index cbbfbc9f3e0f..961a1882cb7e 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -61,15 +61,15 @@ static void BAD_DMA(void *address, unsigned int length) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | static void BAD_SG_DMA(Scsi_Cmnd * SCpnt, | 63 | static void BAD_SG_DMA(Scsi_Cmnd * SCpnt, |
64 | struct scatterlist *sgpnt, | 64 | struct scatterlist *sgp, |
65 | int nseg, | 65 | int nseg, |
66 | int badseg) | 66 | int badseg) |
67 | { | 67 | { |
68 | printk(KERN_CRIT "sgpnt[%d:%d] page %p/0x%llx length %u\n", | 68 | printk(KERN_CRIT "sgpnt[%d:%d] page %p/0x%llx length %u\n", |
69 | badseg, nseg, | 69 | badseg, nseg, |
70 | page_address(sgpnt[badseg].page) + sgpnt[badseg].offset, | 70 | page_address(sgp->page) + sgp->offset, |
71 | (unsigned long long)SCSI_SG_PA(&sgpnt[badseg]), | 71 | (unsigned long long)SCSI_SG_PA(sgp), |
72 | sgpnt[badseg].length); | 72 | sgp->length); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * Not safe to continue. | 75 | * Not safe to continue. |
@@ -691,7 +691,7 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
691 | memcpy(ccb[mbo].cdb, cmd, ccb[mbo].cdblen); | 691 | memcpy(ccb[mbo].cdb, cmd, ccb[mbo].cdblen); |
692 | 692 | ||
693 | if (SCpnt->use_sg) { | 693 | if (SCpnt->use_sg) { |
694 | struct scatterlist *sgpnt; | 694 | struct scatterlist *sg; |
695 | struct chain *cptr; | 695 | struct chain *cptr; |
696 | #ifdef DEBUG | 696 | #ifdef DEBUG |
697 | unsigned char *ptr; | 697 | unsigned char *ptr; |
@@ -699,23 +699,21 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
699 | int i; | 699 | int i; |
700 | ccb[mbo].op = 2; /* SCSI Initiator Command w/scatter-gather */ | 700 | ccb[mbo].op = 2; /* SCSI Initiator Command w/scatter-gather */ |
701 | SCpnt->host_scribble = kmalloc(512, GFP_KERNEL | GFP_DMA); | 701 | SCpnt->host_scribble = kmalloc(512, GFP_KERNEL | GFP_DMA); |
702 | sgpnt = (struct scatterlist *) SCpnt->request_buffer; | ||
703 | cptr = (struct chain *) SCpnt->host_scribble; | 702 | cptr = (struct chain *) SCpnt->host_scribble; |
704 | if (cptr == NULL) { | 703 | if (cptr == NULL) { |
705 | /* free the claimed mailbox slot */ | 704 | /* free the claimed mailbox slot */ |
706 | HOSTDATA(SCpnt->device->host)->SCint[mbo] = NULL; | 705 | HOSTDATA(SCpnt->device->host)->SCint[mbo] = NULL; |
707 | return SCSI_MLQUEUE_HOST_BUSY; | 706 | return SCSI_MLQUEUE_HOST_BUSY; |
708 | } | 707 | } |
709 | for (i = 0; i < SCpnt->use_sg; i++) { | 708 | scsi_for_each_sg(SCpnt, sg, SCpnt->use_sg, i) { |
710 | if (sgpnt[i].length == 0 || SCpnt->use_sg > 16 || | 709 | if (sg->length == 0 || SCpnt->use_sg > 16 || |
711 | (((int) sgpnt[i].offset) & 1) || (sgpnt[i].length & 1)) { | 710 | (((int) sg->offset) & 1) || (sg->length & 1)) { |
712 | unsigned char *ptr; | 711 | unsigned char *ptr; |
713 | printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i); | 712 | printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i); |
714 | for (i = 0; i < SCpnt->use_sg; i++) { | 713 | scsi_for_each_sg(SCpnt, sg, SCpnt->use_sg, i) { |
715 | printk(KERN_CRIT "%d: %p %d\n", i, | 714 | printk(KERN_CRIT "%d: %p %d\n", i, |
716 | (page_address(sgpnt[i].page) + | 715 | (page_address(sg->page) + |
717 | sgpnt[i].offset), | 716 | sg->offset), sg->length); |
718 | sgpnt[i].length); | ||
719 | }; | 717 | }; |
720 | printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr); | 718 | printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr); |
721 | ptr = (unsigned char *) &cptr[i]; | 719 | ptr = (unsigned char *) &cptr[i]; |
@@ -723,10 +721,10 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
723 | printk("%02x ", ptr[i]); | 721 | printk("%02x ", ptr[i]); |
724 | panic("Foooooooood fight!"); | 722 | panic("Foooooooood fight!"); |
725 | }; | 723 | }; |
726 | any2scsi(cptr[i].dataptr, SCSI_SG_PA(&sgpnt[i])); | 724 | any2scsi(cptr[i].dataptr, SCSI_SG_PA(sg)); |
727 | if (SCSI_SG_PA(&sgpnt[i]) + sgpnt[i].length - 1 > ISA_DMA_THRESHOLD) | 725 | if (SCSI_SG_PA(sg) + sg->length - 1 > ISA_DMA_THRESHOLD) |
728 | BAD_SG_DMA(SCpnt, sgpnt, SCpnt->use_sg, i); | 726 | BAD_SG_DMA(SCpnt, sg, SCpnt->use_sg, i); |
729 | any2scsi(cptr[i].datalen, sgpnt[i].length); | 727 | any2scsi(cptr[i].datalen, sg->length); |
730 | }; | 728 | }; |
731 | any2scsi(ccb[mbo].datalen, SCpnt->use_sg * sizeof(struct chain)); | 729 | any2scsi(ccb[mbo].datalen, SCpnt->use_sg * sizeof(struct chain)); |
732 | any2scsi(ccb[mbo].dataptr, SCSI_BUF_PA(cptr)); | 730 | any2scsi(ccb[mbo].dataptr, SCSI_BUF_PA(cptr)); |