Subject: port-i386/2051: Ultrastor 14f probe can hang bus
To: None <gnats-bugs@NetBSD.ORG>
From: Mike Long <mike.long@analog.com>
List: netbsd-bugs
Date: 02/08/1996 02:19:35
>Number:         2051
>Category:       port-i386
>Synopsis:       Ultrastor 14f probe can hang bus
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb  8 02:35:10 1996
>Last-Modified:
>Originator:     Mike Long <mike.long@analog.com>
>Organization:
	nonesuch
>Release:        960207
>Environment:
System: NetBSD azathoth 1.1A NetBSD 1.1A (NOIDE) #0: Wed Feb 7 01:30:23 EST 1996 root@azathoth:/usr/src/sys/arch/i386/compile/NOIDE i386

>Description:
	Attempting to boot a INSTALLOTHER kernel on an i386 PC with a
BT445C card located at I/O port 0x334 will fail.  The Ultrastor 14f
probe routine performs an inw(0x334), which hangs the bus.

>How-To-Repeat:
	install a BT445C (BIOS 4.83, firmware 4.21) at 0x334.
	boot from the NetBSD 1.1 kcoth-11.fs floppy.
>Fix:
	Apply the patch below.  This patch should be back-propagated
to NetBSD 1.1, or some potential users with BT445Cs will be unable to
install NetBSD.

The first hunk fixes the bug.  The second fixes a typo in a comment,
and the third updates the code so that it will compile with UHATEST
defined.

*** /sys/dev/isa/ultra14f.c.orig        Thu Dec 28 07:24:57 1995
--- /sys/dev/isa/ultra14f.c     Thu Feb  8 00:58:32 1996
***************
*** 917,921 ****
                return ENXIO;
  
!       model = htons(inw(iobase + U14_ID));
        if ((model & 0xfff0) != 0x5640)
                return ENXIO;
--- 917,927 ----
                return ENXIO;
  
!       /*
!        * Don't use inw() here, because that may hang the bus if some
!        * other ill-behaved hardware (e.g. certain BT445C revs) lives
!        * there.
!        */
!       model = (inb(iobase + U14_ID + 1) << 8)
!               | inb(iobase + U14_ID);
        if ((model & 0xfff0) != 0x5640)
                return ENXIO;
***************
*** 925,929 ****
        switch (model & 0x000f) {
        case 0x0001:
!               /* This is a 34f, and doens't need an ISA DMA channel. */
                uha->sc_drq = DRQUNK;
                break;
--- 931,935 ----
        switch (model & 0x000f) {
        case 0x0001:
!               /* This is a 34f, and doesn't need an ISA DMA channel. */
                uha->sc_drq = DRQUNK;
                break;
***************
*** 1362,1368 ****
  
        printf("mscp:%x op:%x cmdlen:%d senlen:%d\n",
!               mscp, mscp->opcode, mscp->cdblen, mscp->senselen);
        printf("        sg:%d sgnum:%x datlen:%d hstat:%x tstat:%x flags:%x\n",
!               mscp->sgth, mscp->sg_num, mscp->datalen, mscp->host_stat,
                mscp->target_stat, mscp->flags);
        show_scsi_cmd(mscp->xs);
--- 1368,1375 ----
  
        printf("mscp:%x op:%x cmdlen:%d senlen:%d\n",
!               mscp, mscp->opcode, mscp->scsi_cmd_length,
!               mscp->req_sense_length);
        printf("        sg:%d sgnum:%x datlen:%d hstat:%x tstat:%x flags:%x\n",
!               mscp->sgth, mscp->sg_num, mscp->data_length, mscp->host_stat,
                mscp->target_stat, mscp->flags);
        show_scsi_cmd(mscp->xs);

>Audit-Trail:
>Unformatted: