[174] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: gcc/buslogic scsi problem

daemon@ATHENA.MIT.EDU (Andrew Walker)
Tue May 16 02:55:29 1995

From: andy@keo.kvaerner.no (Andrew Walker)
To: baba@beckman.uiuc.edu
Date: Tue, 16 May 1995 08:26:36 +0200 (MET DST)
Cc: hjl@nynexst.com, linux-gcc@vger.rutgers.edu, linux-scsi@vger.rutgers.edu
In-Reply-To: <199505152141.OAA18774@dandelion.com> from "Leonard N. Zubkoff" at May 15, 95 02:41:35 pm

Leonard N. Zubkoff wrote:
> 
>   From: Baba Z Buehler <baba@beckman.uiuc.edu>
>   Date: Mon, 15 May 1995 14:43:02 -0500
> 
>   hjl@nynexst.com (H.J. Lu) writes:
> 
>   > > 
>   > > 
>   > > It appears that something in the new gcc/ld.so/binutils breaks the BusLogic
>   > > SCSI driver.  Things work fine in a 1.2.8 kernel compiled with gcc 2.5.8,
>   > > however with a 1.2.8 kernel compiled with gcc-950430, ld.so 1.6.6 and binut
>   > ils
>   > > 2.5.2l.14 it doesn't work.
>   > > 
>   > > I also tried a 1.2.7 ELF kernel with HJ's patches, and get the same thing:
>   > > 
>   > > BusLogic SCSI: buslogic_out: failed(1): BusLogic SCSI: buslogic_stat: statu
>   > s=18 intrflags=84
>   > > BusLogic SCSI: setup_mailboxes: failed setting up mailboxes.
>   > > scsi : 0 hosts.
>   > > scsi : detected total.
>   > > 
>   > > 
>   > > These are the settings I'm using to build the a.out 1.2.8 kernel:
>   > > 
>   > > AS      =/usr/i486-linuxaout/bin/as
>   > > LD      =/usr/i486-linuxaout/bin/ld -m i386linux 
>   > > HOSTCC  =gcc -b i486-linuxaout -I$(TOPDIR)/include
>   > > CC      =gcc -b i486-linuxaout -D__KERNEL__ -I$(TOPDIR)/include
>   > > 
>   > 
>   > I suspect there was a bug in the BusLogic SCSI code.
>   > 
> 
>   (I'm cross-posting to linux-scsi in case anyone has seen this)
> 
> 
>   I've got this controller and drive for a couple more days for testing, and I'm
>   planning on ordering one.  Any ideas on how I might track the problem down?  I
>   haven't poked around the kernel scsi code much.
> 
> I thought this had already been tracked down to this alpha version of GCC having
> broken use of the PACKED attribute on data structures?
> 
> Fix the compiler if you want the driver to compile correctly, or use an earlier
> compiler like 2.6.3 that works properly.
> 
> 		Leonard
> 

In case you guys can't find the original reference to this, here is my original
posting:

> From andy Mon May  8 08:50:45 1995
> Subject: Latest GCC ss950430 doesn't grok __attribute__((packed))
> To: hjl@nynexst.com (H.J. Lu)
> Date: Mon, 8 May 1995 08:50:45 +0200 (MET DST)
> Cc: lnz@dandelion.com (Leonard N. Zubkoff),
>         linux-gcc@vger.rutgers.edu (GCC list at vger),
>         linux-scsi@vger.rutgers.edu (SCSI list at vger)
> X-Mailer: ELM [version 2.4 PL24]
> MIME-Version: 1.0
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit
> Content-Length: 1384      
> Status: RO
> 
> 
> The latest snapshot of GCC - ss950430 doesn't seem to honour the __atribute__((packed))
> directive any more. The Buslogic driver used this feature in the following way to define
> a 6 byte struct cmd, but the latest snapshot ignored PACKED and aligned the 'base' field
> of the cmd struct on a 4 byte boundary. This broke the driver as the Buslogic expects
> a 4 byte address in bytes 2-5 of this command.
> 
> In linux/drivers/scsi/buslogic.h, line 47:
> 
> #define PACKED __attribute__((packed))
> 
> In linux/drivers/scsi/buslogic.c, lines 801-806:
> 
>     struct mailbox *mb = HOSTDATA(shpnt)->mb;
>     struct ccb *ccb = HOSTDATA(shpnt)->ccbs;
>     struct {
>         unsigned char cmd, count;
>         void *base PACKED;
>     } cmd = { CMD_INITEXTMB, BUSLOGIC_MAILBOXES, mb };
> 
> I got around this by defining:
> 
>     struct {
>         unsigned char cmd, count;
>         unsigned char base[4];
>     } cmd = { CMD_INITEXTMB, BUSLOGIC_MAILBOXES };
>     memcpy(cmd.base, &mb, 4);
> 
> Is there a reason why __atribute__((packed)) is ignored? If so, what's the cleanest
> workaround. I noticed that the Ultrastor drivers also use the PACKED definition so
> they might also be broken by the latest snapshot.
> 
> -Andy



-- 
Andy Walker                              Kvaerner Engineering a.s.
Andrew.Walker@keo.kvaerner.no            P.O. Box 222, N-1324 Lysaker, Norway

   ......if the answer isn't violence, neither is it silence......


home help back first fref pref prev next nref lref last post