Subject: port-i386/1418: fix probe in bt742a.c so Adaptecs are ignored
To: None <gnats-bugs@gnats.netbsd.org>
From: Alistair G. Crooks <agc@uts.amdahl.com>
List: netbsd-bugs
Date: 08/29/1995 01:28:28
>Number: 1418
>Category: port-i386
>Synopsis: Fix to probe in bt742a.c to ignore Adaptecs
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Aug 29 04:35:02 1995
>Last-Modified:
>Originator: Alistair G. Crooks
>Organization:
Amdahl Corporation
>Release: August 19th 1995
>Environment:
386clone, NetBSD/i386 1.0A (19th August sources)
System: NetBSD pumpy.osg.uk.amdahl.com 1.0A NetBSD 1.0A (PUMPY) #1: Sun Aug 27 10:04:51 BST 1995 root@pumpy.osg.uk.amdahl.com:/usr/src/sys/arch/i386/compile/PUMPY i386
>Description:
(Apologies if you see this twice - I think the first one was lost).
The GENERIC kernel for the i386 port has the BusLogic and the
Adaptec boards defined. Unfortunately, the BusLogic probe in
/sys/dev/isa/bt742a.c will find a false positive in an Adaptec
board, and will then hang the SCSI bus if there is no BusLogic
installed. This code, inspired by the FreeBSD driver, tests
the board information on a BusLogic board - an Adaptec board
will fail this test, and so BusLogic and Adaptec probes can
co-exist again.
This has been tested only on a machine with an Adaptec 1542CF.
There's still room for improvement in the comments to this
driver, and the bt message needs to be moved after this
`get board info' code.
>How-To-Repeat:
Try booting a GENERIC kernel on an i386 box with an Adaptec
and no BusLogic installed. The SCSI bus will eventually hang.
>Fix:
Index: bt742a.c
===================================================================
RCS file: /local/cvs/src/sys/dev/isa/bt742a.c,v
retrieving revision 1.1.1.5
diff -c -r1.1.1.5 bt742a.c
*** bt742a.c 1995/08/24 13:36:18 1.1.1.5
--- bt742a.c 1995/08/28 10:35:57
***************
*** 128,133 ****
--- 128,139 ----
#define BT_MBX_INIT_EXTENDED 0x81 /* Mbx initialization */
#define BT_INQUIRE_EXTENDED 0x8D /* Adapter Setup Inquiry */
+ #define BT_GET_BOARD_INFO 0x8b /* Get H/W ID and Revision */
+ struct bt_board_info {
+ u_char id[4]; /* i.e bt742a -> '7','4','2','A' */
+ u_char ver[2]; /* i.e Board Revision 'H' -> 'H', 0x00 */
+ };
+
/* Follows command appeared at FirmWare 3.31 */
#define BT_ROUND_ROBIN 0x8f /* Enable/Disable(default) round robin */
#define BT_DISABLE 0x00 /* Parameter value for Disable */
***************
*** 959,964 ****
--- 965,971 ----
u_char ad[4];
volatile int i, sts;
struct bt_extended_inquire info;
+ struct bt_board_info binfo;
struct bt_config conf;
/*
***************
*** 980,985 ****
--- 987,1001 ----
#endif
return ENXIO;
}
+
+ /*
+ * Check this REALLY is a bt - aha boards return ENXIO here.
+ */
+ delay(10000);
+ i = bt_cmd(bt, 1, sizeof(binfo), 0, &binfo, BT_GET_BOARD_INFO,
+ sizeof(binfo));
+ if (i)
+ return i;
/*
* Check that we actually know how to use this board.
>Audit-Trail:
>Unformatted: