X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Faha152x.c;h=a09b2d3fdf5a30ced18a487b799fa7598be05455;hb=79d8c7a8c888a7c2ab9dd4249495b24575b3f9a6;hp=f08e71e0205a5f5a3e538701d44e80bd9a4822ca;hpb=347c53dca73fca317d57781f510f5ff4f6c0d0d7;p=linux-2.6-omap-h63xx.git diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index f08e71e0205..a09b2d3fdf5 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -1,6 +1,6 @@ /* aha152x.c -- Adaptec AHA-152x driver - * Author: Jürgen E. Fischer, fischer@norbit.de - * Copyright 1993-2004 Jürgen E. Fischer + * Author: Jürgen E. Fischer, fischer@norbit.de + * Copyright 1993-2004 Jürgen E. Fischer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -260,6 +260,7 @@ #include #include #include +#include #include "aha152x.h" static LIST_HEAD(aha152x_host_list); @@ -357,7 +358,7 @@ enum { check_condition = 0x0800, /* requesting sense after CHECK CONDITION */ }; -MODULE_AUTHOR("Jürgen Fischer"); +MODULE_AUTHOR("Jürgen Fischer"); MODULE_DESCRIPTION(AHA152X_REVID); MODULE_LICENSE("GPL"); @@ -558,9 +559,7 @@ struct aha152x_hostdata { struct aha152x_scdata { Scsi_Cmnd *next; /* next sc in queue */ struct completion *done;/* semaphore to block on */ - unsigned char aha_orig_cmd_len; - unsigned char aha_orig_cmnd[MAX_COMMAND_SIZE]; - int aha_orig_resid; + struct scsi_eh_save ses; }; /* access macros for hostdata */ @@ -613,7 +612,7 @@ struct aha152x_scdata { #define SCNEXT(SCpnt) SCDATA(SCpnt)->next #define SCSEM(SCpnt) SCDATA(SCpnt)->done -#define SG_ADDRESS(buffer) ((char *) (page_address((buffer)->page)+(buffer)->offset)) +#define SG_ADDRESS(buffer) ((char *) sg_virt((buffer))) /* state handling */ static void seldi_run(struct Scsi_Host *shpnt); @@ -1017,16 +1016,10 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete, SCp.buffers_residual : left buffers in list SCp.phase : current state of the command */ - if ((phase & (check_condition|resetting)) || !scsi_sglist(SCpnt)) { - if (phase & check_condition) { - SCpnt->SCp.ptr = SCpnt->sense_buffer; - SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer); - scsi_set_resid(SCpnt, sizeof(SCpnt->sense_buffer)); - } else { - SCpnt->SCp.ptr = NULL; - SCpnt->SCp.this_residual = 0; - scsi_set_resid(SCpnt, 0); - } + if ((phase & resetting) || !scsi_sglist(SCpnt)) { + SCpnt->SCp.ptr = NULL; + SCpnt->SCp.this_residual = 0; + scsi_set_resid(SCpnt, 0); SCpnt->SCp.buffer = NULL; SCpnt->SCp.buffers_residual = 0; } else { @@ -1439,15 +1432,10 @@ static void run(struct work_struct *work) */ static irqreturn_t intr(int irqno, void *dev_id) { - struct Scsi_Host *shpnt = (struct Scsi_Host *)dev_id; + struct Scsi_Host *shpnt = dev_id; unsigned long flags; unsigned char rev, dmacntrl0; - if (!shpnt) { - printk(KERN_ERR "aha152x: catched interrupt %d for unknown controller.\n", irqno); - return IRQ_NONE; - } - /* * Read a couple of registers that are known to not be all 1's. If * we read all 1's (-1), that means that either: @@ -1561,10 +1549,7 @@ static void busfree_run(struct Scsi_Host *shpnt) } #endif - /* restore old command */ - memcpy(cmd->cmnd, sc->aha_orig_cmnd, sizeof(cmd->cmnd)); - cmd->cmd_len = sc->aha_orig_cmd_len; - scsi_set_resid(cmd, sc->aha_orig_resid); + scsi_eh_restore_cmnd(cmd, &sc->ses); cmd->SCp.Status = SAM_STAT_CHECK_CONDITION; @@ -1587,22 +1572,10 @@ static void busfree_run(struct Scsi_Host *shpnt) DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr)); #endif - /* save old command */ sc = SCDATA(ptr); /* It was allocated in aha152x_internal_queue? */ BUG_ON(!sc); - memcpy(sc->aha_orig_cmnd, ptr->cmnd, - sizeof(ptr->cmnd)); - sc->aha_orig_cmd_len = ptr->cmd_len; - sc->aha_orig_resid = scsi_get_resid(ptr); - - ptr->cmnd[0] = REQUEST_SENSE; - ptr->cmnd[1] = 0; - ptr->cmnd[2] = 0; - ptr->cmnd[3] = 0; - ptr->cmnd[4] = sizeof(ptr->sense_buffer); - ptr->cmnd[5] = 0; - ptr->cmd_len = 6; + scsi_eh_prep_cmnd(ptr, &sc->ses, NULL, 0, ~0); DO_UNLOCK(flags); aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);