--- ppscsi.c 2005-10-16 18:49:35.000000000 +0400 +++ ppscsi.c 2009-03-05 23:27:03.000000000 +0400 @@ -49,7 +49,7 @@ */ -#define PPSC_VERSION "0.92" +#define PPSC_VERSION "0.93" #define PPSC_BASE #include "ppscsi.h" @@ -57,6 +57,8 @@ #include #include #include +#include +#include #include @@ -188,11 +190,11 @@ spin_unlock_irqrestore(&ppsc_spinlock,flags); } -static void ppsc_tq_int (void *data) +static void ppsc_tq_int (struct work_struct *work) { void (*con)(PHA *); unsigned long flags; - PHA *pha = (PHA *)data; + PHA *pha = container_of(work, PHA, wq); spin_lock_irqsave(&ppsc_spinlock,flags); @@ -422,17 +424,16 @@ bf &= (!((1<cur_cmd->device->id) & pha->slow_targets)); - r = pha->cur_cmd->use_sg; + r = scsi_sg_count(pha->cur_cmd); if (r) { b = 0; - p = (struct scatterlist *)pha->cur_cmd->request_buffer; + p = scsi_sglist(pha->cur_cmd); for (k=0;klength; p++; } - } else { - b = pha->cur_cmd->request_bufflen; - } + } else + b = scsi_bufflen(pha->cur_cmd); bf &= (b > 127); @@ -483,7 +484,7 @@ if ((!pha->cur_len) && pha->sg_count) { pha->sg_count--; pha->sg_list++; - pha->cur_buf = page_address(pha->sg_list->page) + pha->sg_list->offset; + pha->cur_buf = sg_virt(pha->sg_list); pha->cur_len = pha->sg_list->length; } } @@ -565,16 +566,15 @@ pha->data_dir = phase & PPSC_IO; pha->data_count = 0; - pha->sg_count = pha->cur_cmd->use_sg; + pha->sg_count = scsi_sg_count(pha->cur_cmd); if (pha->sg_count) { pha->sg_count--; - pha->sg_list = - (struct scatterlist *)pha->cur_cmd->request_buffer; - pha->cur_buf = page_address(pha->sg_list->page) + pha->sg_list->offset; + pha->sg_list = pha->sg_list = scsi_sglist(pha->cur_cmd); + pha->cur_buf = sg_virt(pha->sg_list); pha->cur_len = pha->sg_list->length; } else { - pha->cur_buf = pha->cur_cmd->request_buffer; - pha->cur_len = pha->cur_cmd->request_bufflen; + pha->cur_buf = (char *)pha->cur_cmd->sdb.table.sgl; + pha->cur_len = scsi_bufflen(pha->cur_cmd); } pha->last_phase = phase; @@ -620,7 +620,7 @@ if (pha->cur_cmd->cmnd[0] == REQUEST_SENSE) { - sb = (char *)pha->cur_cmd->request_buffer; + sb = (char *)pha->cur_cmd->sdb.table.sgl; printk("%s: Sense key: %x ASC: %x ASCQ: %x\n", pha->device, sb[2] & 0xff, sb[12] & 0xff, sb[13] & 0xff); @@ -815,9 +815,9 @@ cmd->cmnd[4] = sizeof(cmd->sense_buffer); cmd->cmnd[5] = 0; cmd->cmd_len = 6; - cmd->use_sg = 0; - cmd->request_buffer = (char *) cmd->sense_buffer; - cmd->request_bufflen = sizeof(cmd->sense_buffer); + cmd->sdb.table.nents = 0; + cmd->sdb.table.sgl = (void *) cmd->sense_buffer; + cmd->sdb.length = sizeof(cmd->sense_buffer); pha->cur_cmd = cmd; ppsc_do_claimed(pha,ppsc_start); @@ -1005,7 +1005,6 @@ static int ppsc_inquire (PHA *pha, int target, char *buf) { char inq[6] = {0x12,0,0,0,36,0}; - int i; struct scsi_cmnd cmd; struct scsi_device dev; @@ -1013,10 +1012,10 @@ dev.id = target; cmd.device = &dev; cmd.cmd_len = 6; - for (i=0;i<6;i++) cmd.cmnd[i] = inq[i]; - cmd.use_sg = 0; - cmd.request_buffer = buf; - cmd.request_bufflen = 36; + cmd.cmnd = inq; + cmd.sdb.table.nents = 0; + cmd.sdb.table.sgl = (void *) buf; + cmd.sdb.length = 36; return ppsc_command(&cmd); @@ -1047,8 +1046,9 @@ for (t=0;t<8;t++) { s = ppsc_inquire(pha,t,ibuf); if (s == DID_NO_CONNECT << 16) continue; - if (s) { f++; - break; + if (s) { + f++; + break; } if (V_FULL) { for (i=0;i<36;i++) @@ -1145,7 +1145,7 @@ pha->device[p+1] = '0' + i; pha->device[p+2] = 0; - INIT_WORK(&pha->wq, ppsc_tq_int, pha); + INIT_WORK(&pha->wq, ppsc_tq_int); init_timer (&pha->timer); pha->timer.data = (unsigned long) pha; --- ppscsi.h 2006-04-24 22:08:20.000000000 +0400 +++ ppscsi.h 2009-03-05 23:25:17.000000000 +0400 @@ -10,10 +10,9 @@ */ -#define PPSC_H_VERSION "0.92" +#define PPSC_H_VERSION "0.93" #include -#include #include #include #include @@ -325,19 +324,11 @@ {"host3",8,host3} }; #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) -MODULE_PARM(host0,"1-8i"); -MODULE_PARM(host1,"1-8i"); -MODULE_PARM(host2,"1-8i"); -MODULE_PARM(host3,"1-8i"); -MODULE_PARM(verbose,"i"); -#else module_param_array(host0, int, NULL, 0); module_param_array(host1, int, NULL, 0); module_param_array(host2, int, NULL, 0); module_param_array(host3, int, NULL, 0); module_param(verbose, int, 0); -#endif static struct ppsc_host_adapter host_structs[4];