Subject: Re: kern/23276
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: netbsd-bugs
Date: 11/22/2005 15:50:02
The following reply was made to PR kern/23276; it has been noted by GNATS.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: kern/23276
Date: Wed, 23 Nov 2005 00:49:01 +0900

 >Synopsis:       aic7xxx driver tries to use leftover (bogus) BIOS settings for cards without SEEPROM.
 
 I posted the attached patch on port-sgimips,
 but I'd also like to file it to gnats:
 
 ---
 The problem is ARCS BIOS on O2 uses conservative xfer settings (async)
 on boot. This patch provides an option to ignore them but preserve
 host adapter settings (host ID, termination) by BIOS.
 ---
 Izumi Tsutsui
 
 Index: sys/dev/ic/aic7xxx.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/aic7xxx.c,v
 retrieving revision 1.116
 diff -u -r1.116 aic7xxx.c
 --- sys/dev/ic/aic7xxx.c	10 Sep 2005 19:15:44 -0000	1.116
 +++ sys/dev/ic/aic7xxx.c	20 Oct 2005 15:46:24 -0000
 @@ -4634,12 +4634,19 @@
  	/* Grab the disconnection disable table and invert it for our needs */
  	if ((ahc->flags & AHC_USEDEFAULTS) != 0) {
  		printf("%s: Host Adapter Bios disabled.  Using default SCSI "
 -			"device parameters\n", ahc_name(ahc));
 +			"host/target device parameters\n", ahc_name(ahc));
  		ahc->flags |= AHC_EXTENDED_TRANS_A|AHC_EXTENDED_TRANS_B|
  			      AHC_TERM_ENB_A|AHC_TERM_ENB_B;
  		discenable = ALL_TARGETS_MASK;
  		if ((ahc->features & AHC_ULTRA) != 0)
  			ultraenb = ALL_TARGETS_MASK;
 +	} else if ((ahc->flags & AHC_DEFAULTTARGETCONF) != 0) {
 +		printf("%s: Host Adapter has no SEEPROM. Using default SCSI"
 +		    " target device parameters\n", ahc_name(ahc));
 +		ahc->flags |= AHC_EXTENDED_TRANS_A|AHC_EXTENDED_TRANS_B;
 +		discenable = ALL_TARGETS_MASK;
 +		if ((ahc->features & AHC_ULTRA) != 0)
 +			ultraenb = ALL_TARGETS_MASK;
  	} else {
  		discenable = ~((ahc_inb(ahc, DISC_DSB + 1) << 8)
  			   | ahc_inb(ahc, DISC_DSB));
 @@ -4670,7 +4677,7 @@
  					    target_id, &tstate);
  		/* Default to async narrow across the board */
  		memset(tinfo, 0, sizeof(*tinfo));
 -		if (ahc->flags & AHC_USEDEFAULTS) {
 +		if (ahc->flags & (AHC_USEDEFAULTS | AHC_DEFAULTTARGETCONF)) {
  			if ((ahc->features & AHC_WIDE) != 0)
  				tinfo->user.width = MSG_EXT_WDTR_BUS_16_BIT;
  
 Index: sys/dev/ic/aic7xxxvar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/aic7xxxvar.h,v
 retrieving revision 1.49
 diff -u -r1.49 aic7xxxvar.h
 --- sys/dev/ic/aic7xxxvar.h	28 Jun 2005 00:32:28 -0000	1.49
 +++ sys/dev/ic/aic7xxxvar.h	20 Oct 2005 15:46:24 -0000
 @@ -415,8 +415,7 @@
  	AHC_USEDEFAULTS	      = 0x004,  /*
  					 * For cards without an seeprom
  					 * or a BIOS to initialize the chip's
 -					 * SRAM, we use the default target
 -					 * settings.
 +					 * SRAM, we use the default settings.
  					 */
  	AHC_SEQUENCER_DEBUG   = 0x008,
  	AHC_SHARED_SRAM	      = 0x010,
 @@ -455,7 +454,8 @@
  	AHC_LSCBS_ENABLED     = 0x2000000, /* 64Byte SCBs enabled */
  	AHC_SCB_CONFIG_USED   = 0x4000000, /* No SEEPROM but SCB2 had info. */
  	AHC_NO_BIOS_INIT      = 0x8000000, /* No BIOS left over settings. */
 -	AHC_DISABLE_PCI_PERR  = 0x10000000
 +	AHC_DISABLE_PCI_PERR  = 0x10000000,
 +	AHC_DEFAULTTARGETCONF = 0x20000000
  } ahc_flag;
  
  /************************* Hardware  SCB Definition ***************************/
 Index: sys/dev/pci/ahc_pci.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/ahc_pci.c,v
 retrieving revision 1.51
 diff -u -r1.51 ahc_pci.c
 --- sys/dev/pci/ahc_pci.c	28 Jun 2005 00:28:41 -0000	1.51
 +++ sys/dev/pci/ahc_pci.c	20 Oct 2005 15:46:25 -0000
 @@ -1042,6 +1042,9 @@
  			printf("%s: Using left over BIOS settings\n",
  				ahc_name(ahc));
  			ahc->flags &= ~AHC_USEDEFAULTS;
 +#ifdef AHC_IGNORE_BIOSTARGETSETTINGS
 +			ahc->flags |= AHC_DEFAULTTARGETCONF;
 +#endif
  			ahc->flags |= AHC_BIOS_ENABLED;
  		} else {
  			/*
 
 ---