Subject: Re: Presence of one disk trashes another
To: None <darcy@NetBSD.org>
From: Greg A. Woods <woods@weird.com>
List: tech-kern
Date: 11/01/2003 23:44:43
[ On Saturday, November 1, 2003 at 05:14:24 (-0500), D'Arcy J.M. Cain wrote: ]
> Subject: Presence of one disk trashes another
>
> We have STL2 boards with the aic7899 on board.  They work fine under NetBSD 
> 1.6.1 with one drive as follows:
> 
> When we add a second drive the system halts with disk errors showing on the 
> screen.

You need the "new" AHC driver (or FreeBSD :-).

Using suggestions from Lucio De Re and Pascal Renauld I've back-ported
the new AHC driver from -current to the netbsd-1-6 branch.  The porting
effort was "extremely painless".  :-)

I've only tested the GENERIC kernel on a couple of adapters, but one
system I've done a fair bit of testing on also has the integrated
aic7899 on an Intel STL/2 board and it's working exceptionally well with
everything I can throw at it.  (The onboard FXP gave me some problems
the other day but I'm unable to reproduce them after a reboot.)

Here are the notes I took while doing the back-port.  I think they are
complete (I can build a release (on i386 -- my alpha is still crawling
along on just one CPU through the build I started on it this afternoon).

-------------------- sys/dev/ic/README.aic-ahc --------------------

The following files were copied from -current to update the ahc driver.

[ last updated 2003/10/22 ]

sys/arch/i386/isa/ahc_isa.c			[[ locally patched for CFATTACH_DECL() stuff ]]
sys/dev/cardbus/ahc_cardbus.c			[[ locally patched for CFATTACH_DECL() stuff ]]
sys/dev/eisa/ahc_eisa.c				[[ locally patched for CFATTACH_DECL() stuff ]]
sys/dev/ic/aic77xx.c
sys/dev/ic/aic77xxreg.h
sys/dev/ic/aic77xxvar.h
sys/dev/ic/aic7xxx.c
sys/dev/ic/aic7xxx_cam.h
sys/dev/ic/aic7xxx_inline.h
sys/dev/ic/aic7xxx_osm.c
sys/dev/ic/aic7xxx_osm.h
sys/dev/ic/aic7xxx_seeprom.c
sys/dev/ic/aic7xxxvar.h
sys/dev/ic/iha.c   
sys/dev/ic/ihareg.h
sys/dev/ic/ihavar.h
sys/dev/ic/smc93cx6.c
sys/dev/ic/smc93cx6var.h
sys/dev/microcode/aic7xxx/Makefile		[[ locally patched to remove 79xx* stuff ]]
sys/dev/microcode/aic7xxx/aic7xxx.reg
sys/dev/microcode/aic7xxx/aic7xxx.seq
sys/dev/microcode/aic7xxx/aic7xxx_reg.h
sys/dev/microcode/aic7xxx/aic7xxx_seq.h
sys/dev/microcode/aic7xxx/aicasm.c
sys/dev/microcode/aic7xxx/aicasm.h
sys/dev/microcode/aic7xxx/aicasm_gram.y
sys/dev/microcode/aic7xxx/aicasm_insformat.h
sys/dev/microcode/aic7xxx/aicasm_macro_gram.y
sys/dev/microcode/aic7xxx/aicasm_macro_scan.l
sys/dev/microcode/aic7xxx/aicasm_scan.l
sys/dev/microcode/aic7xxx/aicasm_symbol.c
sys/dev/microcode/aic7xxx/aicasm_symbol.h
sys/dev/pci/ahc_pci.c				[[ locally patched for CFATTACH_DECL() stuff ]]
sys/dev/scsipi/scsi_all.h
sys/dev/scsipi/scsi_iu.h
sys/dev/scsipi/scsi_message.h
sys/dev/scsipi/scsiconf.h


The fix I've used for now for CFATTACH_DECL() are patches like this one
suggested by Lucio:

Index: ahc_pci.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/sys/dev/pci/ahc_pci.c,v
retrieving revision 1.43
diff -c -c -r1.43 ahc_pci.c
*** ahc_pci.c	18 Aug 2003 09:16:22 -0000	1.43
--- ahc_pci.c	22 Oct 2003 20:29:12 -0000
***************
*** 705,712 ****
--- 705,718 ----
  void ahc_pci_attach __P((struct device *, struct device *, void *));
  
  
+ #ifdef CFATTACH_DECL
  CFATTACH_DECL(ahc_pci, sizeof(struct ahc_softc),
      ahc_pci_probe, ahc_pci_attach, NULL, NULL);
+ #else
+ const struct cfattach ahc_pci_ca = {
+ 	sizeof(struct ahc_softc), ahc_pci_probe, ahc_pci_attach
+ };
+ #endif
  
  const struct ahc_pci_identity *
  ahc_find_pci_device(id, subid, func)


The following wee patch is also needed:

Index: sys/conf/files
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/sys/conf/files,v
retrieving revision 1.530.2.1
diff -c -r1.530.2.1 files
*** sys/conf/files	12 Dec 2002 23:48:37 -0000	1.530.2.1
--- sys/conf/files	22 Oct 2003 20:40:15 -0000
***************
*** 277,282 ****
--- 277,283 ----
  define	ahc_seeprom
  define	ahc_aic77xx
  file	dev/ic/aic7xxx.c		ahc
+ file	dev/ic/aic7xxx_osm.c		ahc
  file	dev/ic/aic7xxx_seeprom.c	ahc_seeprom
  file	dev/ic/aic77xx.c		ahc_aic77xx


-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>