From greg@greg.rim.or.jp  Sat Feb 17 22:01:57 1996
Received: from rayearth.rim.or.jp (uucp@rayearth.rim.or.jp [202.247.130.242])
          by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id WAA26684
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Feb 1996 22:01:47 -0800 (PST)
Received: (from uucp@localhost) by rayearth.rim.or.jp (8.7.3/3.4W3-uucp1) with UUCP
	id PAA07366 for FreeBSD-gnats-submit@freebsd.org; Sun, 18 Feb 1996 15:01:25 +0900 (JST)
Received: from apollon.greg.rim.or.jp (apollon.greg.rim.or.jp [172.31.1.2]) by atena.greg.rim.or.jp (8.6.12/3.4Wbeta6) with ESMTP id OAA27404 for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Feb 1996 14:56:05 +0900
Received: (from greg@localhost) by apollon.greg.rim.or.jp (8.7.3/3.4Wbeta6) id OAA19383; Sun, 18 Feb 1996 14:56:04 +0900 (JST)
Message-Id: <199602180556.OAA19383@apollon.greg.rim.or.jp>
Date: Sun, 18 Feb 1996 14:56:04 +0900 (JST)
From: greg@greg.rim.or.jp
Reply-To: greg@greg.rim.or.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: Problem about BT driver for PCI
X-Send-Pr-Version: 3.2

>Number:         1032
>Category:       kern
>Synopsis:       Problem about BT driver for PCI
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 17 22:10:01 PST 1996
>Closed-Date:    Sat Feb 17 23:49:52 PST 1996
>Last-Modified:  Tue Nov 27 18:52:47 PST 2001
>Originator:     Kensaku Masuda
>Release:        FreeBSD 2.2-960130-SNAP i386
>Organization:
Private
>Environment:

	CPU:       Pentium-90
	MEMORY:    32MB
	DISK:      1GB * 2 + 730MB
	SCSI CARD: BT-946 & NCR810

>Description:

		BT driver can not look up BT-946 PCI card, and driver
	don't find old revision BT-946. Ex) PCI product ID 0x0140.
	And Mother-board select the shared IRQ, driver will confusing.

bt0 <Buslogic 946 SCSI host adapter> rev 0 int a irq 9 on pci0:17
	.
	.
ncr0 <ncr 53c810 scsi> rev 2 int a irq 9 on pci 0:18


>How-To-Repeat:

	Use all SCSI controller at one time, system will hung up/system down.

>Fix:

	I make a patch.

diff -rc sys/i386/scsi/bt.c /usr/src/sys/i386/scsi/bt.c
*** sys/i386/scsi/bt.c	Fri Jan 26 08:03:07 1996
--- /usr/src/sys/i386/scsi/bt.c	Sat Feb 17 23:28:57 1996
***************
*** 263,268 ****
--- 263,269 ----
  
  static struct bt_found found[] =
  {
+ 	{ 0xfffc, 0},
  	{ 0x330, 0 },
  	{ 0x334, 0 },
  	{ 0x230, 0 },
***************
*** 561,566 ****
--- 562,573 ----
  	 * just return.
  	 */
  	stat = inb(BT_INTR_PORT);
+ #define BT_STAT_MASK \
+ 	(BT_STST | BT_DIAGF | BT_INIT | BT_IDLE | BT_CDF | BT_DF | BT_INVDCMD)
+ 	if((stat & BT_STAT_MASK) == 0) {
+ 		return;
+ 	}
+ #undef BT_STAT_MASK
  
  	/* Mail Box out empty ? */
  	if (stat & BT_MBOA) {
diff -rc sys/pci/bt9xx.c /usr/src/sys/pci/bt9xx.c
*** sys/pci/bt9xx.c	Wed Jan 24 06:46:57 1996
--- /usr/src/sys/pci/bt9xx.c	Sat Feb 17 23:59:21 1996
***************
*** 35,42 ****
  #include <i386/scsi/btreg.h>
  
  /* XXX Need more device IDs */
! #define PCI_BASEADR0	PCI_MAP_REG_START
! #define PCI_DEVICE_ID_BUSLOGIC_946	0x104B1040ul
  
  static char* bt_pci_probe __P((pcici_t tag, pcidi_t type));
  static void bt_pci_attach __P((pcici_t config_id, int unit));
--- 35,43 ----
  #include <i386/scsi/btreg.h>
  
  /* XXX Need more device IDs */
! #define PCI_BASEADR0			PCI_MAP_REG_START
! #define PCI_DEVICE_ID_BUSLOGIC_946	0x1040104Bul
! #define PCI_DEVICE_ID_BUSLOGIC_946_OLD	0x0140104Bul
  
  static char* bt_pci_probe __P((pcici_t tag, pcidi_t type));
  static void bt_pci_attach __P((pcici_t config_id, int unit));
***************
*** 55,60 ****
--- 56,64 ----
  bt_pci_probe (pcici_t tag, pcidi_t type)
  {
  	switch(type) {
+ 		case PCI_DEVICE_ID_BUSLOGIC_946_OLD:
+ 			return ("Buslogic 946 SCSI host adapter(Old revision)");
+ 			break;
  		case PCI_DEVICE_ID_BUSLOGIC_946:
  			return ("Buslogic 946 SCSI host adapter");
  			break;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: gibbs 
State-Changed-When: Sat Feb 17 23:49:52 PST 1996 
State-Changed-Why:  
The problem with properly id'ing BT946 cards (at least the newer revisions) 
was fixed in rev's 1.5 and 1.6 of sys/pci/bt9xx.c before this PR was made. 
The additional ID for the older revision cards as you noted in your PR 
has been committed to both the -stable and current branches as revision 1.7. 

As for adding entries to the bt_found table, any value other than 
the standard Buslogic ISA values could be assigned by a PCI BIOS 
so adding just one entry will only work for your motherboard and 
BIOS.  This problem was corrected by only doing conflic detection 
against the ISA compatibility addresses and allowing probes for 
any address in revision (rev 1.6 of sys/i386/bt.c).  Some versions 
of the BT946 can be double probed at a high address assigned by 
the PCI BIOS and at an ISA compatibility address.  If you own one 
of these cards, you will either have to disable the "compatibility 
feature" on your card, or configure a kernel that does not perform 
ISA probes("controller bt0" instead of "controller bt0 at isa?..."). 

Your patch to return immediately if the interrupt isn't for the current 
adapter was also committed in rev 1.7 of sys/i386/scsi/bt.c 

Please test the driver in either 2.1-stable or 2.2-current to ensure that 
it works for you. 

-- 
Justin T. Gibbs 
=========================================== 
FreeBSD: Turning PCs into workstations 
=========================================== 
>Unformatted:
