Subject: kern/6347: ncr driver cannot deal with five or more disks
To: None <gnats-bugs@gnats.netbsd.org>
From: C Kane <ckane@best.com>
List: netbsd-bugs
Date: 10/22/1998 17:24:45
>Number:         6347
>Category:       kern
>Synopsis:       ncr driver cannot deal with five or more disks
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 22 17:35:00 1998
>Last-Modified:
>Originator:     C Kane
>Organization:
>Release:        NetBSD-1.3H/i386
>Environment:
System: NetBSD ckane5 1.3H NetBSD 1.3H (ckane5) #2: Mon Oct 19 21:52:45 PDT 1998 root@ckane5:/usr/netbsd-current/src/sys/arch/i386/compile/ckane5 i386

>Description:
	If there are five or more drives on a SCSI bus attached to an
	NCR controller, only the first four drives will be configured.
	The rest will not be usable.

	Here's a snippet from dmesg:
	  sd4 at scsibus0 targ 4 lun 0: <SEAGATE, ST32430W, HP04> SCSI2 0/direct fixed
	  sd4(ncr0:4:0): WIDE SCSI (16 bit) enabled
	  sd4(ncr0:4:0): 20.0 MB/s (100 ns, offset 15)
	  sd4: drive offline

	The entire dmesg output is included below.

	In addition, the ncr driver fails to recognize if the card is
	differential or single-ended, always calling the card single-ended
	even when it is not:
	  ncr0: single-ended, open drain IRQ driver, using on-chip SRAM

>How-To-Repeat:
	Put five or more drives on a SCSI bus attached to an NCR
	controller.

>Fix:
	A fix (but probably not *the* fix) for this is to change line 169
	of /usr/src/sys/dev/pci/ncr.c.  The original line is:
	        #define MAX_START   (MAX_TARGET + 7 * SCSI_NCR_DFLT_TAGS + 8)
	The new line is:
	        #define MAX_START (256)
	This seems to be the approach taken by FreeBSD (in addition to moving
	to CAM).

	The real problem is that the ncr driver will allocate no more than
	MAX_START-2 CCBs, and it seems to throw them away frivolously.
	Without changing how the CCBs are allocated, if there were no more
	than 15 normal disk drives on the ncr SCSI bus, then MAX_START would
	need to be about 156, but if there were any devices with more than one
	active LUN, MAX_START would need to be higher, which might be why
	FreeBSD chose 256.



Here's the complete dmesg output:

NetBSD 1.3H (ckane4a) #4: Wed Oct 14 01:10:07 PDT 1998
    root@ckane4:/usr/netbsd-current/src/sys/arch/i386/compile/ckane4a
cpu0: family 5 model 4 step 1
cpu0: Intel Pentium/MMX (586-class)
real mem  = 83492864
avail mem = 73207808
using 1044 buffers containing 4276224 bytes of memory
mainbus0 (root)
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o enabled, memory enabled
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82437FX System Controller (TSC) (rev. 0x02)
pcib0 at pci0 dev 7 function 0
pcib0: Intel 82371FB PCI-to-ISA Bridge (PIIX) (rev. 0x02)
Intel 82371FB IDE controller (PIIX) (IDE mass storage, interface 0x80, revision
0x02) at pci0 dev 7 function 1 not configured
vga1 at pci0 dev 8 function 0: S3 Trio32/64 (rev. 0x43)
wsdisplay0 at vga1: console (80x25, vt100 emulation)
ncr0 at pci0 dev 15 function 0: ncr 53c875 fast20 wide scsi
ncr0: interrupting at irq 10
ncr0: minsync=12, maxsync=137, maxoffs=16, 128 dwords burst, large dma fifo
ncr0: single-ended, open drain IRQ driver, using on-chip SRAM
scsibus0 at ncr0: 16 targets
sd0 at scsibus0 targ 0 lun 0: <SEAGATE, ST32430W, HP04> SCSI2 0/direct fixed
sd0(ncr0:0:0): WIDE SCSI (16 bit) enabled
sd0(ncr0:0:0): 20.0 MB/s (100 ns, offset 15)
sd0: 2048MB, 3992 cyl, 9 head, 116 sec, 512 bytes/sect x 4194685 sectors
sd1 at scsibus0 targ 1 lun 0: <SEAGATE, ST32430W, HP04> SCSI2 0/direct fixed
sd1(ncr0:1:0): WIDE SCSI (16 bit) enabled
sd1(ncr0:1:0): 20.0 MB/s (100 ns, offset 15)
sd1: 2048MB, 3992 cyl, 9 head, 116 sec, 512 bytes/sect x 4194685 sectors
sd2 at scsibus0 targ 2 lun 0: <SEAGATE, ST32430W, HP04> SCSI2 0/direct fixed
sd2(ncr0:2:0): WIDE SCSI (16 bit) enabled
sd2(ncr0:2:0): 20.0 MB/s (100 ns, offset 15)
sd2: 2048MB, 3992 cyl, 9 head, 116 sec, 512 bytes/sect x 4194685 sectors
sd3 at scsibus0 targ 3 lun 0: <SEAGATE, ST32430W, HP05> SCSI2 0/direct fixed
sd3(ncr0:3:0): WIDE SCSI (16 bit) enabled
sd3(ncr0:3:0): 20.0 MB/s (100 ns, offset 15)
sd3: 2048MB, 3992 cyl, 9 head, 116 sec, 512 bytes/sect x 4194685 sectors
sd4 at scsibus0 targ 4 lun 0: <SEAGATE, ST32430W, HP04> SCSI2 0/direct fixed
sd4(ncr0:4:0): WIDE SCSI (16 bit) enabled
sd4(ncr0:4:0): 20.0 MB/s (100 ns, offset 15)
sd4: drive offline
fxp0 at pci0 dev 16 function 0: Intel EtherExpress Pro 10+/100B Ethernet
fxp0: interrupting at irq 11
fxp0: Ethernet address 00:a0:c9:00:13:44
PHY oui 0x80017 model 0x0 rev 0x0 at fxp0 phy 1 not configured
isa0 at pcib0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 channel 0 drive 0: <ST5660A>
wd0: using 32-sector pio transfers, lba mode
wd0: 520MB, 1057 cyl, 16 head, 63 sec, 512 bytes/sect x 1066184 sectors
wd0: using 32-bits pio transfers
wd0: PIO mode 4, DMA mode 2
sb0 at isa0 port 0x220-0x237 irq 5 drq 1: dsp v3.02
midi0 at sb0: <SB MIDI UART>
audio0 at sb0
opl0 at sb0: model OPL3
midi1 at opl0: <Yamaha OPL3>
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pmsprobe: command error
pcppi0 at isa0 port 0x61
midi2 at pcppi0: <PC speaker>
spkr0 at pcppi0
sysbeep0 at pcppi0
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
>Audit-Trail:
>Unformatted: