fix scsi/aha15*.c for 2.5.60

fix scsi/aha15*.c for 2.5.60

Post by Randy.Dunla » Thu, 13 Feb 2003 07:40:06



Hi,

Here are patches to aha152x.c and aha1542.c so that they will build
in 2.5.60.

Please review and apply or comment...

Thanks,
~Randy

[ scsi-aha15xyz-2560.patch 14K ]
patch_name:     scsi-aha15xyz-2560.patch
patch_version:  2003-02-11.21:20:32
author:         Randy.Dunlap <rddun...@osdl.org>
description:    repair scsi/aha152x.c and aha1542.c for 2.5.60
product:        Linux
product_versions: linux-2560
changelog:      _
URL:            _
requires:       _
conflicts:      _
diffstat:       =
 aha152x.c |   78 ++++++++++++++++++++++++++++++++------------------------
 aha1542.c |   86 +++++++++++++++++++++++++++++++-------------------------------
 2 files changed, 88 insertions(+), 76 deletions(-)

diff -Naur ./drivers/scsi/aha152x.c%SYN ./drivers/scsi/aha152x.c
--- ./drivers/scsi/aha152x.c%SYN        Mon Feb 10 10:37:57 2003
+++ ./drivers/scsi/aha152x.c    Tue Feb 11 20:56:26 2003
@@ -306,9 +306,9 @@
 #define ERR_LEAD       KERN_ERR        LEAD
 #define DEBUG_LEAD     KERN_DEBUG      LEAD
 #define CMDINFO(cmd) \
-                       (cmd) ? ((cmd)->host->host_no) : -1, \
-                        (cmd) ? ((cmd)->target & 0x0f) : -1, \
-                       (cmd) ? ((cmd)->lun & 0x07) : -1
+                       (cmd) ? ((cmd)->device->host->host_no) : -1, \
+                        (cmd) ? ((cmd)->device->id & 0x0f) : -1, \
+                       (cmd) ? ((cmd)->device->lun & 0x07) : -1

 #define DELAY_DEFAULT 1000

@@ -583,8 +583,8 @@

 #define DATA_LEN               (HOSTDATA(shpnt)->data_len)

-#define SYNCRATE               (HOSTDATA(shpnt)->syncrate[CURRENT_SC->target])
-#define SYNCNEG                        (HOSTDATA(shpnt)->syncneg[CURRENT_SC->target])
+#define SYNCRATE               (HOSTDATA(shpnt)->syncrate[CURRENT_SC->device->id])
+#define SYNCNEG                        (HOSTDATA(shpnt)->syncneg[CURRENT_SC->device->id])

 #define DELAY                  (HOSTDATA(shpnt)->delay)
 #define EXT_TRANS              (HOSTDATA(shpnt)->ext_trans)
@@ -771,7 +771,7 @@
        Scsi_Cmnd *ptr, *prev;

        for (ptr = *SC, prev = NULL;
-            ptr && ((ptr->target != target) || (ptr->lun != lun));
+            ptr && ((ptr->device->id != target) || (ptr->device->lun != lun));
             prev = ptr, ptr = SCNEXT(ptr))
             ;

@@ -1476,7 +1476,7 @@
  */
 int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct semaphore *sem, int phase, Scsi_Cmnd *done_SC, void (*done)(Scsi_Cmnd *))
 {
-       struct Scsi_Host *shpnt = SCpnt->host;
+       struct Scsi_Host *shpnt = SCpnt->device->host;
        unsigned long flags;

 #if defined(AHA152X_DEBUG)
@@ -1589,7 +1589,7 @@
  */
 int aha152x_abort(Scsi_Cmnd *SCpnt)
 {
-       struct Scsi_Host *shpnt = SCpnt->host;
+       struct Scsi_Host *shpnt = SCpnt->device->host;
        Scsi_Cmnd *ptr;
        unsigned long flags;

@@ -1641,7 +1641,7 @@
 {
        Scsi_Cmnd        *SCp   = (Scsi_Cmnd *)p;
        struct semaphore *sem   = SCSEM(SCp);
-       struct Scsi_Host *shpnt = SCp->host;
+       struct Scsi_Host *shpnt = SCp->device->host;

        /* remove command from issue queue */
        if(remove_SC(&ISSUE_SC, SCp)) {
@@ -1663,10 +1663,11 @@
  */
 int aha152x_device_reset(Scsi_Cmnd * SCpnt)
 {
-       struct Scsi_Host *shpnt = SCpnt->host;
+       struct Scsi_Host *shpnt = SCpnt->device->host;
        DECLARE_MUTEX_LOCKED(sem);
        struct timer_list timer;
-       Scsi_Cmnd cmnd;
+       Scsi_Cmnd *cmd;
+       int ret;

 #if defined(AHA152X_DEBUG)
        if(HOSTDATA(shpnt)->debug & debug_eh) {
@@ -1680,31 +1681,42 @@
                return FAILED;
        }

-       cmnd.cmd_len         = 0;
-       cmnd.host            = SCpnt->host;
-       cmnd.target          = SCpnt->target;
-       cmnd.lun             = SCpnt->lun;
-       cmnd.use_sg          = 0;
-       cmnd.request_buffer  = 0;
-       cmnd.request_bufflen = 0;
+       spin_unlock_irq(shpnt->host_lock);
+       cmd = scsi_get_command(SCpnt->device, GFP_ATOMIC);
+       if (!cmd) {
+               spin_lock_irq(shpnt->host_lock);
+               return FAILED;
+       }
+
+       cmd->cmd_len         = 0;
+       cmd->device->host    = SCpnt->device->host;
+       cmd->device->id      = SCpnt->device->id;
+       cmd->device->lun     = SCpnt->device->lun;
+       cmd->use_sg          = 0;
+       cmd->request_buffer  = 0;
+       cmd->request_bufflen = 0;

        init_timer(&timer);
-       timer.data     = (unsigned long) &cmnd;
+       timer.data     = (unsigned long) cmd;
        timer.expires  = jiffies + 100*HZ;   /* 10s */
        timer.function = (void (*)(unsigned long)) timer_expired;

-       aha152x_internal_queue(&cmnd, &sem, resetting, 0, internal_done);
+       aha152x_internal_queue(cmd, &sem, resetting, 0, internal_done);

        add_timer(&timer);
        down(&sem);

        del_timer(&timer);

-       if(cmnd.SCp.phase & resetted) {
-               return SUCCESS;
+       if(cmd->SCp.phase & resetted) {
+               ret = SUCCESS;
        } else {
-               return FAILED;
+               ret = FAILED;
        }
+
+       scsi_put_command(cmd);
+       spin_lock_irq(shpnt->host_lock);
+       return ret;
 }

 void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
@@ -1738,7 +1750,7 @@
  */
 int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
 {
-       struct Scsi_Host *shpnt = SCpnt->host;
+       struct Scsi_Host *shpnt = SCpnt->device->host;
        unsigned long flags;

 #if defined(AHA152X_DEBUG)
@@ -1822,7 +1834,7 @@
        aha152x_bus_reset(SCpnt);

        DPRINTK(debug_eh, DEBUG_LEAD "resetting ports\n", CMDINFO(SCpnt));
-       reset_ports(SCpnt->host);
+       reset_ports(SCpnt->device->host);

        return SUCCESS;
 }
@@ -2052,9 +2064,9 @@
                                        cmnd->cmnd[4]         = sizeof(ptr->sense_buffer);
                                        cmnd->cmnd[5]         = 0;
                                        cmnd->cmd_len              = 6;
-                                       cmnd->host            = ptr->host;
-                                       cmnd->target          = ptr->target;
-                                       cmnd->lun             = ptr->lun;
+                                       cmnd->device->host    = ptr->device->host;
+                                       cmnd->device->id      = ptr->device->id;
+                                       cmnd->device->lun     = ptr->device->lun;
                                        cmnd->use_sg          = 0;
                                        cmnd->request_buffer  = ptr->sense_buffer;
                                        cmnd->request_bufflen = sizeof(ptr->sense_buffer);
@@ -2113,7 +2125,7 @@
                /* clear selection timeout */
                SETPORT(SSTAT1, SELTO);

-               SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->target);
+               SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->device->id);
                SETPORT(SXFRCTL1, (PARITY ? ENSPCHK : 0 ) | ENSTIMER);
                SETPORT(SCSISEQ, ENSELO | ENAUTOATNO | (DISCONNECTED_SC ? ENRESELI : 0));
        } else {
@@ -2152,7 +2164,7 @@

        SETPORT(SSTAT0, CLRSELDO);

-       ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->lun));
+       ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));

        if (CURRENT_SC->SCp.phase & aborting) {
                ADDMSGO(ABORT);
@@ -2472,7 +2484,7 @@
 {
        if(MSGOLEN==0) {
                if((CURRENT_SC->SCp.phase & syncneg) && SYNCNEG==2 && SYNCRATE==0) {
-                       ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->lun));
+                       ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
                } else {
                        printk(INFO_LEAD "unexpected MESSAGE OUT phase; rejecting\n", CMDINFO(CURRENT_SC));
                        ADDMSGO(MESSAGE_REJECT);
@@ -3376,7 +3388,7 @@
 static void show_command(Scsi_Cmnd *ptr)
 {
        printk(KERN_DEBUG "0x%08x: target=%d; lun=%d; cmnd=(",
-              (unsigned int) ptr, ptr->target, ptr->lun);
+              (unsigned int) ptr, ptr->device->id, ptr->device->lun);

        print_command(ptr->cmnd);

@@ -3441,7 +3453,7 @@
        int i;

        SPRINTF("0x%08x: target=%d; lun=%d; cmnd=( ",
-               (unsigned int) ptr, ptr->target, ptr->lun);
+               (unsigned int) ptr, ptr->device->id, ptr->device->lun);

        for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
                SPRINTF("0x%02x ", ptr->cmnd[i]);
diff -Naur ./drivers/scsi/aha1542.c%SYN ./drivers/scsi/aha1542.c
--- ./drivers/scsi/aha1542.c%SYN        Mon Feb 10 10:38:39 2003
+++ ./drivers/scsi/aha1542.c    Tue Feb 11 21:19:43 2003
@@ -597,8 +597,8 @@
        unchar ahacmd = CMD_START_SCSI;
        unchar direction;
        unchar *cmd = (unchar *) SCpnt->cmnd;
-       unchar target = SCpnt->target;
-       unchar lun = SCpnt->lun;
+       unchar target = SCpnt->device->id;
+       unchar lun = SCpnt->device->lun;
        unsigned long flags;
        void *buff = SCpnt->request_buffer;
        int bufflen = SCpnt->request_bufflen;
@@ -608,8 +608,8 @@

        DEB(int i);

-       mb = HOSTDATA(SCpnt->host)->mb;
-       ccb = HOSTDATA(SCpnt->host)->ccb;
+       mb = HOSTDATA(SCpnt->device->host)->mb;
+       ccb = HOSTDATA(SCpnt->device->host)->ccb;

        DEB(if (target > 1) {
            SCpnt->result = DID_TIME_OUT << 16;
@@ -653,25 +653,25 @@
           is how the host adapter will scan for them */

        spin_lock_irqsave(&aha1542_lock, flags);
-       mbo = HOSTDATA(SCpnt->host)->aha1542_last_mbo_used + 1;
+       mbo = HOSTDATA(SCpnt->device->host)->aha1542_last_mbo_used + 1;
        if (mbo >= AHA1542_MAILBOXES)
                mbo = 0;

        do {
-               if (mb[mbo].status == 0 && HOSTDATA(SCpnt->host)->SCint[mbo] == NULL)
+               if (mb[mbo].status == 0 && HOSTDATA(SCpnt->device->host)->SCint[mbo] == NULL)
                        break;
                mbo++;
                if (mbo >= AHA1542_MAILBOXES)
                        mbo = 0;
-       } while (mbo != HOSTDATA(SCpnt->host)->aha1542_last_mbo_used);
+       } while (mbo != HOSTDATA(SCpnt->device->host)->aha1542_last_mbo_used);

-       if (mb[mbo].status || HOSTDATA(SCpnt->host)->SCint[mbo])
+       if (mb[mbo].status || HOSTDATA(SCpnt->device->host)->SCint[mbo])
                panic("Unable to find empty mailbox for aha1542.\n");

-       HOSTDATA(SCpnt->host)->SCint[mbo] = SCpnt;        /* This will effectively prevent someone else from
+       HOSTDATA(SCpnt->device->host)->SCint[mbo] = SCpnt;     /* This will effectively prevent someone else from
                                                           screwing with this cdb. */

-       HOSTDATA(SCpnt->host)->aha1542_last_mbo_used = mbo;
+       HOSTDATA(SCpnt->device->host)->aha1542_last_mbo_used = mbo;
        spin_unlock_irqrestore(&aha1542_lock, flags);

 #ifdef DEBUG
@@ -762,7 +762,7 @@
                    aha1542_stat());
                SCpnt->scsi_done = done;
                mb[mbo].status = 1;
-               aha1542_out(SCpnt->host->io_port, &ahacmd, 1);        /* start scsi command */
+               aha1542_out(SCpnt->device->host->io_port, &ahacmd, 1);     /* start scsi command */
                DEB(aha1542_stat());
        } else
                printk("aha1542_queuecommand: done can't be NULL\n");
@@ -1356,7 +1356,7 @@
         */

        printk(KERN_ERR "aha1542.c: Unable to abort command for target %d\n",
-              SCpnt->target);
+              SCpnt->device->id);
        return FAILED;
 }

@@ -1368,36 +1368,36 @@
 {
        unsigned long flags;
        struct mailbox *mb;
-       unchar target = SCpnt->target;
-       unchar lun = SCpnt->lun;
+       unchar target = SCpnt->device->id;
+       unchar lun = SCpnt->device->lun;
        int mbo;
        struct ccb *ccb;
        unchar ahacmd = CMD_START_SCSI;

-       ccb = HOSTDATA(SCpnt->host)->ccb;
-       mb = HOSTDATA(SCpnt->host)->mb;
+       ccb = HOSTDATA(SCpnt->device->host)->ccb;
+       mb = HOSTDATA(SCpnt->device->host)->mb;

        spin_lock_irqsave(&aha1542_lock, flags);
-       mbo = HOSTDATA(SCpnt->host)->aha1542_last_mbo_used + 1;
+       mbo = HOSTDATA(SCpnt->device->host)->aha1542_last_mbo_used + 1;
        if (mbo >= AHA1542_MAILBOXES)
                mbo
...

read more »

 
 
 

fix scsi/aha15*.c for 2.5.60

Post by Rudmer van Dij » Fri, 14 Feb 2003 00:50:09



Quote:> Hi,

> Here are patches to aha152x.c and aha1542.c so that they will build
> in 2.5.60.

> Please review and apply or comment...

well it applies, compiles, but it gives a warning on depmod in make
modules_install:

<snip>
if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.5.60; fi
WARNING: /lib/modules/2.5.60/kernel/drivers/scsi/aha152x.ko needs unknown
symbol scsi_put_command
WARNING: /lib/modules/2.5.60/kernel/drivers/scsi/aha152x.ko needs unknown
symbol scsi_get_command

this is the relevant part of my .config:
CONFIG_SCSI=m
CONFIG_SCSI_AHA152X=m

this gives these modules in /lib/modules/2.5.60/kernel/drivers/scsi/:
aha152x.ko  scsi_mod.ko  sg.ko

what am i missing??

        Rudmer

Quote:

> Thanks,
> ~Randy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

fix scsi/aha15*.c for 2.5.60

Post by James Bottomle » Fri, 14 Feb 2003 00:50:13




> > Hi,

> > Here are patches to aha152x.c and aha1542.c so that they will build
> > in 2.5.60.

> > Please review and apply or comment...

> well it applies, compiles, but it gives a warning on depmod in make
> modules_install:

> <snip>
> if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.5.60; fi
> WARNING: /lib/modules/2.5.60/kernel/drivers/scsi/aha152x.ko needs unknown
> symbol scsi_put_command
> WARNING: /lib/modules/2.5.60/kernel/drivers/scsi/aha152x.ko needs unknown
> symbol scsi_get_command

> this is the relevant part of my .config:
> CONFIG_SCSI=m
> CONFIG_SCSI_AHA152X=m

> this gives these modules in /lib/modules/2.5.60/kernel/drivers/scsi/:
> aha152x.ko  scsi_mod.ko  sg.ko

> what am i missing??

Nothing really, the symbols need to be exported from the SCSI core.
I'll add them to the export list.

James

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

fix scsi/aha15*.c for 2.5.60

Post by Randy.Dunla » Fri, 14 Feb 2003 01:00:14


| > > Here are patches to aha152x.c and aha1542.c so that they will build
| > > in 2.5.60.
| > >
| > > Please review and apply or comment...
| >
| > well it applies, compiles, but it gives a warning on depmod in make
| > modules_install:
| >
| > <snip>
| > if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.5.60; fi
| > WARNING: /lib/modules/2.5.60/kernel/drivers/scsi/aha152x.ko needs unknown
| > symbol scsi_put_command
| > WARNING: /lib/modules/2.5.60/kernel/drivers/scsi/aha152x.ko needs unknown
| > symbol scsi_get_command
| >
| > this is the relevant part of my .config:
| > CONFIG_SCSI=m
| > CONFIG_SCSI_AHA152X=m
| >
| > this gives these modules in /lib/modules/2.5.60/kernel/drivers/scsi/:
| > aha152x.ko  scsi_mod.ko  sg.ko
| >
| > what am i missing??
|
| Nothing really, the symbols need to be exported from the SCSI core.
| I'll add them to the export list.

I generated a patch for Rudmer in case he needs it.

~Randy

patch_name:     scsi-exports-2560.patch
patch_version:  2003-02-12.14:44:43

description:    _
product:        Linux
product_versions: linux-2560
changelog:      _
URL:            _
requires:       _
conflicts:      _
diffstat:       TBD

diff -Naur ./drivers/scsi/scsi_syms.c%EXP ./drivers/scsi/scsi_syms.c
--- ./drivers/scsi/scsi_syms.c%EXP      Mon Feb 10 10:38:37 2003

 EXPORT_SYMBOL(scsi_slave_detach);
 EXPORT_SYMBOL(scsi_device_get);
 EXPORT_SYMBOL(scsi_device_put);
+EXPORT_SYMBOL(scsi_get_command);
+EXPORT_SYMBOL(scsi_put_command);

 /*
  * This symbol is for the highlevel drivers (e.g. sg) only.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

fix scsi/aha15*.c for 2.5.60

Post by Christoph Hellwi » Fri, 14 Feb 2003 01:40:08



> > this gives these modules in /lib/modules/2.5.60/kernel/drivers/scsi/:
> > aha152x.ko  scsi_mod.ko  sg.ko

> > what am i missing??

> Nothing really, the symbols need to be exported from the SCSI core.
> I'll add them to the export list.

it should _not_ be exported.  drivers are supposed to use the
request-based interface instead.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

fix scsi/aha15*.c for 2.5.60

Post by James Bottomle » Fri, 14 Feb 2003 16:20:05




> > > this gives these modules in /lib/modules/2.5.60/kernel/drivers/scsi/:
> > > aha152x.ko  scsi_mod.ko  sg.ko

> > > what am i missing??

> > Nothing really, the symbols need to be exported from the SCSI core.
> > I'll add them to the export list.

> it should _not_ be exported.  drivers are supposed to use the
> request-based interface instead.

Yes, if they issue commands via the mid-layer.  This one is queueing a
message (encapsulated as a pseudo command) on it's internal queue (which
is a cmd queue) to issue a bus device reset.  In this instance, it
cannot use the request based interface because the device will be
in_recovery when this happens, so it would never be issued.

Personally, it would be nice to have a messaging interface to get around
these problems, but I don't think that one's coming any time soon...

James

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. 2.5.60 fix ver_linux script for correct output from depmod

From the depmod man page:

BUGS
       depmod [ -V | --version ] should exit immediately.  Instead, it prints
       the version information and behaves as if no options were given.

A recent change to the ver_linux script replaced "rmmod" with "depmod",
to determine module-init-tools version, but the output looks like this:

[snip]
mount                  2.11n
module-init-tools      file
e2fsprogs              1.28
[snip]

The following patch adds a "| grep version" filter to the depmod -V output.

[snip]
mount                  2.11n
module-init-tools      2.4.22
e2fsprogs              1.28
[snip]

Steven

--- linux-2.5.60/scripts/ver_linux.orig Mon Feb 10 17:18:17 2003

 mount --version | awk -F\- '{print "mount                 ", $NF}'

-depmod -V  2>&1 | awk 'NR==1 {print "module-init-tools     ",$NF}'
+depmod -V  2>&1 | grep version | awk 'NR==1 {print "module-init-tools     ",$NF}'

 tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' |  awk \
 'NR==1 {print "e2fsprogs             ", $2}'

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. HELP settingup CHAT server

3. jiffies wrap fixes for 2.5.60

4. Microsoft claims that delaying Windows 98 could hurt the entire PC industry. Do you agree?

5. 2.5.60, cciss, fix array bounds overrun

6. Adaptec 1542B + 2 IDE drives

7. scsi/imm.c compile errors in 2.5.60

8. How do I convert an int to a string?

9. 2.5.60 - drivers/char/esp.c vs include/linux/serialP.h

10. Strange TCP with 2.5.60

11. Linux 2.5.60 cciss_scsi.c

12. 2.5.60 cheerleading...

13. 2.5.60: .o or .ko for CONFIG_MODVERSIONS?