X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fultrastor.c;h=1d3b02976d74328e78a99e9bfe7eed60d464d486;hb=b80ca4f7ee36c26d300c5a8f429e73372d153379;hp=56906aba5ee351ffce54935f69acaaae7a19c5a7;hpb=5d347c8abaab1e8c24272a53099c22482855783e;p=linux-2.6 diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c index 56906aba5e..1d3b02976d 100644 --- a/drivers/scsi/ultrastor.c +++ b/drivers/scsi/ultrastor.c @@ -675,16 +675,15 @@ static const char *ultrastor_info(struct Scsi_Host * shpnt) static inline void build_sg_list(struct mscp *mscp, struct scsi_cmnd *SCpnt) { - struct scatterlist *sl; + struct scatterlist *sg; long transfer_length = 0; int i, max; - sl = (struct scatterlist *) SCpnt->request_buffer; - max = SCpnt->use_sg; - for (i = 0; i < max; i++) { - mscp->sglist[i].address = isa_page_to_bus(sl[i].page) + sl[i].offset; - mscp->sglist[i].num_bytes = sl[i].length; - transfer_length += sl[i].length; + max = scsi_sg_count(SCpnt); + scsi_for_each_sg(SCpnt, sg, max, i) { + mscp->sglist[i].address = isa_page_to_bus(sg_page(sg)) + sg->offset; + mscp->sglist[i].num_bytes = sg->length; + transfer_length += sg->length; } mscp->number_of_sg_list = max; mscp->transfer_data = isa_virt_to_bus(mscp->sglist); @@ -730,19 +729,19 @@ static int ultrastor_queuecommand(struct scsi_cmnd *SCpnt, my_mscp->target_id = SCpnt->device->id; my_mscp->ch_no = 0; my_mscp->lun = SCpnt->device->lun; - if (SCpnt->use_sg) { + if (scsi_sg_count(SCpnt)) { /* Set scatter/gather flag in SCSI command packet */ my_mscp->sg = TRUE; build_sg_list(my_mscp, SCpnt); } else { /* Unset scatter/gather flag in SCSI command packet */ my_mscp->sg = FALSE; - my_mscp->transfer_data = isa_virt_to_bus(SCpnt->request_buffer); - my_mscp->transfer_data_length = SCpnt->request_bufflen; + my_mscp->transfer_data = isa_virt_to_bus(scsi_sglist(SCpnt)); + my_mscp->transfer_data_length = scsi_bufflen(SCpnt); } my_mscp->command_link = 0; /*???*/ my_mscp->scsi_command_link_id = 0; /*???*/ - my_mscp->length_of_sense_byte = sizeof SCpnt->sense_buffer; + my_mscp->length_of_sense_byte = SCSI_SENSE_BUFFERSIZE; my_mscp->length_of_scsi_cdbs = SCpnt->cmd_len; memcpy(my_mscp->scsi_cdbs, SCpnt->cmnd, my_mscp->length_of_scsi_cdbs); my_mscp->adapter_status = 0; @@ -1198,5 +1197,6 @@ static struct scsi_host_template driver_template = { .cmd_per_lun = ULTRASTOR_MAX_CMDS_PER_LUN, .unchecked_isa_dma = 1, .use_clustering = ENABLE_CLUSTERING, + .use_sg_chaining = ENABLE_SG_CHAINING, }; #include "scsi_module.c"