Subject: IDE drive fails probe/attach/open
To: None <port-i386@NetBSD.ORG>
From: Michael L. VanLoon -- HeadCandy.com <michaelv@MindBender.serv.net>
List: port-i386
Date: 01/01/1997 14:27:25
I've been seeing this for some time, and can't figure out what's
causing it.  Normally it's not a big deal, because I have fairly long
uptimes, but with the recent storms in the Pacific Northwest, and
fluctuating power, I'm running into it more.

What happens is when the machine is cold booted (turned off and then
back on -- reset doesn't cause this), if my IDE drive is turned off in
the BIOS, it will fail to open/attach completely after probing.
I. e. I see all the right stuff during probe time, but before the
kernel finishes auto-configuring, I get an error that makes the IDE
drive unusable.  If I then turn the drive on in the BIOS, reboot, turn
the drive off in the BIOS, and reboot again, it continues to work
correctly forever forward, until I turn the machine off and cold boot
it again.

In other words, if the IDE drive is not probed by the BIOS during
cold boot, NetBSD can't use it.  If I let the BIOS probe the IDE
drive -- even if I don't actually boot off it -- then NetBSD seems to
be happy.

This is the dmesg output I see when the probe fails:


     ----- >8 ---------- begin failure dmesg output ---------- 8< -----
NetBSD 1.2 (MINDBENDER) #411: Wed Jan  1 01:06:32 PST 1997
    michaelv@MindBender.serv.net:/u/src/sys/arch/i386/compile/MINDBENDER
CPU: Pentium (GenuineIntel 586-class CPU)
real mem  = 66715648
avail mem = 53395456
using 2430 buffers containing 9953280 bytes of memory
mainbus0 (root)
isa0 at mainbus0
com0 at isa0 port 0x3e8-0x3ef irq 9: ESP, 1024 byte fifo
com1 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com2 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
lpt0 at isa0 port 0x378-0x37f: polled
lpt1 at isa0 port 0x278-0x27f: polled
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 drive 0: 1549MB, 3148 cyl, 16 head, 63 sec, 512 bytes/sec <WDC AC31600H>
wd0: using 16-sector 16-bit pio transfers, lba addressing
ed0 at isa0 port 0x300-0x31f iomem 0xd0000-0xd3fff irq 10
ed0: address 00:00:c0:5d:2e:07, type WD8013EBT (16-bit)
npx0 at isa0 port 0xf0-0xff: using exception 16
vt0 at isa0 port 0x60-0x6f irq 1: unknown s3, 80 col, color, 9 scr, mf2-kbd, [R3.32]
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
pci0 at mainbus0 bus 0: configuration mode 1
vendor Intel, unknown product 0x122d (class bridge, subclass host, revision 0x02) at pci0 dev 0 function 0 not configured
vendor Intel, unknown product 0x122e (class bridge, subclass ISA, revision 0x02) at pci0 dev 7 function 0 not configured
ahc0 at pci0 dev 11 function 0
ahc0: interrupting at irq 12
ahc0: Reading SEEPROM...done.
ahc0: aic7880 Wide Channel, SCSI Id=7, 16 SCBs
ahc0: Reseting Channel A
ahc0: Downloading Sequencer Program...Done
scsibus0 at ahc0
ahc0: target 0 synchronous at 10.0MHz, offset = 0xf
ahc0: target 0 Tagged Queuing Device
sd0 at scsibus0 targ 0 lun 0: <HP, C3323-300, 5011> SCSI2 0/direct fixed
sd0: 1003MB, 2982 cyl, 7 head, 98 sec, 512 bytes/sec
ahc0: target 1 synchronous at 10.0MHz, offset = 0xf
ahc0: target 1 Tagged Queuing Device
sd1 at scsibus0 targ 1 lun 0: <HP, C3323-300, 5011> SCSI2 0/direct fixed
sd1: 1003MB, 2982 cyl, 7 head, 98 sec, 512 bytes/sec
ahc0: target 2 synchronous at 10.0MHz, offset = 0x8
sd2 at scsibus0 targ 2 lun 0: <QUANTUM, LPS540S, 590S> SCSI2 0/direct fixed
sd2: 516MB, 2740 cyl, 4 head, 96 sec, 512 bytes/sec
ahc0: target 5 synchronous at 4.0MHz, offset = 0xf
cd0 at scsibus0 targ 5 lun 0: <SONY, CD-ROM CDU-55S, 1.0t> SCSI2 5/cdrom removable
S3 968 (class display, subclass VGA, revision 0x00) at pci0 dev 12 function 0 not configured
biomask 5040 netmask 5440 ttymask 565a
wd0d: hard error reading fsbn 0 (wd0 bn 0; cn 0 tn 0 sn 0)
wd0d: hard error reading fsbn 0 (wd0 bn 0; cn 0 tn 0 sn 0)
wd0: dos partition I/O error

 Aperture driver for XFree86 version 1.5
     ----- >8 ----------  end failure dmesg output  ---------- 8< -----


And this is the dmesg output I see during a successful boot.  This is
after turning the IDE drive on in the BIOS, proceeding to the boot
block boot prompt, hitting reset, turning the drive back off in the
BIOS, and fully booting:


     ----- >8 ---------- begin success dmesg output ---------- 8< -----
NetBSD 1.2 (MINDBENDER) #411: Wed Jan  1 01:06:32 PST 1997
    michaelv@MindBender.serv.net:/u/src/sys/arch/i386/compile/MINDBENDER
CPU: Pentium (GenuineIntel 586-class CPU)
real mem  = 66715648
avail mem = 53395456
using 2430 buffers containing 9953280 bytes of memory
mainbus0 (root)
isa0 at mainbus0
com0 at isa0 port 0x3e8-0x3ef irq 9: ESP, 1024 byte fifo
com1 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com2 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
lpt0 at isa0 port 0x378-0x37f: polled
lpt1 at isa0 port 0x278-0x27f: polled
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 drive 0: 1549MB, 3148 cyl, 16 head, 63 sec, 512 bytes/sec <WDC AC31600H>
wd0: using 16-sector 16-bit pio transfers, lba addressing
ed0 at isa0 port 0x300-0x31f iomem 0xd0000-0xd3fff irq 10
ed0: address 00:00:c0:5d:2e:07, type WD8013EBT (16-bit)
npx0 at isa0 port 0xf0-0xff: using exception 16
vt0 at isa0 port 0x60-0x6f irq 1: unknown s3, 80 col, color, 9 scr, mf2-kbd, [R3.32]
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
pci0 at mainbus0 bus 0: configuration mode 1
vendor Intel, unknown product 0x122d (class bridge, subclass host, revision 0x02) at pci0 dev 0 function 0 not configured
vendor Intel, unknown product 0x122e (class bridge, subclass ISA, revision 0x02) at pci0 dev 7 function 0 not configured
ahc0 at pci0 dev 11 function 0
ahc0: interrupting at irq 12
ahc0: Reading SEEPROM...done.
ahc0: aic7880 Wide Channel, SCSI Id=7, 16 SCBs
ahc0: Reseting Channel A
ahc0: Downloading Sequencer Program...Done
scsibus0 at ahc0
ahc0: target 0 synchronous at 10.0MHz, offset = 0xf
ahc0: target 0 Tagged Queuing Device
sd0 at scsibus0 targ 0 lun 0: <HP, C3323-300, 5011> SCSI2 0/direct fixed
sd0: 1003MB, 2982 cyl, 7 head, 98 sec, 512 bytes/sec
ahc0: target 1 synchronous at 10.0MHz, offset = 0xf
ahc0: target 1 Tagged Queuing Device
sd1 at scsibus0 targ 1 lun 0: <HP, C3323-300, 5011> SCSI2 0/direct fixed
sd1: 1003MB, 2982 cyl, 7 head, 98 sec, 512 bytes/sec
ahc0: target 2 synchronous at 10.0MHz, offset = 0x8
sd2 at scsibus0 targ 2 lun 0: <QUANTUM, LPS540S, 590S> SCSI2 0/direct fixed
sd2: 516MB, 2740 cyl, 4 head, 96 sec, 512 bytes/sec
ahc0: target 5 synchronous at 4.0MHz, offset = 0xf
cd0 at scsibus0 targ 5 lun 0: <SONY, CD-ROM CDU-55S, 1.0t> SCSI2 5/cdrom removable
S3 968 (class display, subclass VGA, revision 0x00) at pci0 dev 12 function 0 not configured
biomask 5040 netmask 5440 ttymask 565a

 Aperture driver for XFree86 version 1.5
     ----- >8 ----------  end success dmesg output  ---------- 8< -----


I've tried rearranging things in my config file, and even tried
building and booting a GENERIC kernel, with the same results.  Has
anyone else seen this?  Any ideas where the conflict might be arising?

I've also noticed that it takes the entire wd.c timeout (10 seconds?)
when probing in the broken case, before continuing after the wd probe.
So, one other thing I've tried in the past is to increase the timeout
for some of the defines in wd.c.  This only increases the time it
takes to boot, but doesn't make this problem go away.

The reason this is a pain is because if my system reboots while I'm
not home (flakey power, you know...), it will never finish booting,
since fstab won't be able to fsck and mount the IDE drives, and I'm
not there to do the BIOS trick.

FWIW, the drive is a 1.6GB Western Digital Caviar.  But I've also seen
the same thing with a 540MB Wetern Digital.  I know the 1.6 is using
LBA, and believe the 540 probably was, also.

If you're wondering why I even bother with an IDE drive, it works like
this...  All my "normal" work drives are SCSI, attached to a PCI SCSI
controller.  My /usr is a ccd over two SCSI drives, and I have a
couple altroots.  But, I also have a second complete alternate boot
root and /usr on the IDE drive.  This not only gives me redundancy in
drives, but in controllers (I can still boot and limp along even if my
SCSI controller fails).  Additionally, I have a daily script that
backs up strategic parts of several directories into tarballs, which
get placed on a SCSI drive and on the IDE drive.  I don't use the IDE
drive for any normal operations, except for this backup function.

To further beat this dead horse, here is my current config file:


     ----- >8 ---------- begin config file ---------- 8< -----
# original config file:
# GENERICAHBBT -- Generic machine w/ahb and bt drivers -- distribution floppy
#
# STINGRAY -- Config for Michael VanLoon's i386 box stingray.cc.iastate.edu
# MINDBENDER -- modified for change to MindBender.HeadCandy.com
#

machine		i386
#options	I386_CPU
options		I486_CPU
options		I586_CPU
options		MINDBENDER

maxusers	64

options		TIMEZONE=480
options		DST=1

options 	DUMMY_NOPS		# slow nops needed?
options		INSECURE		# allow /dev/mem writing by X
#options	USER_LDT		# for WINE
options		MACHINE_NONCONTIG	# non-contiguous memory hole (640k-1MB)
options		COMPAT_09		# backwards NetBSD-0.9 compat
options		COMPAT_10		# backwards NetBSD-1.0 compat
options		COMPAT_11		# backwards NetBSD-1.1 compat
options		COMPAT_12		# backwards NetBSD-1.2 compat
options		COMPAT_43		# backwards 4.3BSD compat
#options	TCP_COMPAT_42		# backwards 4.2/BNR2 net compat
options		COMPAT_NOMID		# compat with 386BSD, BSDI, NetBSD 0.8
options		SWAPPAGER		# swap pager
options		VNODEPAGER		# vnode pager -- mmap of files
options		DEVPAGER		# device pager -- mmap of devices
options		KTRACE			# syscall kernel tracing
options		FIFO			# FIFOs/pipes
options		FFS			# Unix File System/Fast File System
options		FDESC			# File Descriptor fs
options		KERNFS			# Kernel fs
options		PROCFS			# Process fs
options		PORTAL			# Portal fs
options		MSDOSFS			# MS-DOS fs
options		UMAPFS			# UMAP fs
options		UNION			# Union fs
options		QUOTA			# quotas
options		MFS			# Memory fs
options		NULLFS			# Null fs
options		CD9660			# ISO-9660 & Rock Ridge CD-ROM fs
options		INET			# internet/IP services
options		NFSCLIENT		# NFS client capability
options		NFSSERVER		# NFS server capability
options		GATEWAY			# route between interfaces
options		PPP_BSDCOMP
options		PPP_DEFLATE
#options	NS			# XNS networking
#options	ISO			# ISO OSI networking
#options	TPIP			# TPIP OSI
#options	EON			# OSI tunneling over IP
#options	CCITT			# CCITT X.25
#options	LLC			# LLC X.25
#options	HDLC			# HDLC X.25
options		XSERVER			# allow X server
options		UCONSOLE		# allow user console grabbing (X)
options		LKM			# loadable kernel modules
options		COMPAT_FREEBSD		# Run FreeBSD binaries
options		COMPAT_IBCS2		# iBCS2 compat (SCO & ISC)
options		COMPAT_SVR4		# SVR4 compat
options		COMPAT_LINUX		# Run Linux binaries
#options	MATH_EMULATE		# software FP emulation?

options		COM_ESP			# use Hayes ESP port
options		COM_HAYESP		# use Hayes ESP port
#options	COMCONSOLE=2		# serial-port console
#options	COMADDR=0x2f8		# on our com2 (0-x), PC COM2 (1-4)

options		SYSVMSG			# System V message queues; see msg.h
options		SYSVSEM			# System V semaphores; see sem.h
options		SYSVSHM			# System V shared memory
options		SHMMAXPGS=4096

options		PCVT_NSCREENS=9		# number of virtual terminals
options		PCVT_PRETTYSCRNS	# make screen-saver do something
options		PCVT_INHIBIT_NUMLOCK=0	# keep that damn thing on!!!
options		FAT_CURSOR=1

# Debugging stuff:
makeoptions	DEBUG="-g"		# compile full symbol table
options		DDB			# kernel low-level debugger
#options	DIAGNOSTIC		# generate diagnostic messages
options		EISAVERBOSE
options		PCIVERBOSE
options		AHC_TAGENABLE
options		CCDDEBUG
options		BUFCACHE=15		# buffer cache uses 15% of RAM

config		netbsd	root on sd0 swap on sd0 and sd1 and sd2 and sd3 and wd0

# Bus interface:
mainbus0 at root

isa0	at mainbus0
eisa0	at mainbus0
pci0	at mainbus0 bus ?

ppb*	at pci? dev ? function ?
pci*	at ppb? bus ?

# Math coprocessor/emulation support:
npx0	at isa? port 0xf0 irq 13	# math coprocessor

# Console drivers:
#pc0	at isa? port 0x60 irq 1		# generic PC console device
vt0	at isa? port 0x60 irq 1		# virtual terminals

# AT ST506 (IDE/MFM/RLL/ESDI) hard drives:
wdc0	at isa? port 0x1f0 irq 14	# ST506, ESDI, and IDE controllers
#wdc1	at isa? port 0x170 irq ?
wd*	at wdc? drive ?

# Floppy drives:
fdc0	at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
fd*	at fdc? drive ?

#wt0	at isa? port 0x300 irq 5 drq 1	# Archive and Wangtek QIC tape drives

# Hayes ESP board:
com0	at isa? port 0x3e8 irq 9	# at PC COM3

# "standard" PeeCee com ports:
com1	at isa? port 0x3f8 irq 4	# at PC COM1
com2	at isa? port 0x2f8 irq 3	# at PC COM2
#com2	at isa? port 0x3e8 irq 5	# at PC COM3
#com3	at isa? port 0x2e8 irq 9	# at PC COM4

# BocaBoard quad-16550 with normal com driver:
#boca0	at isa? port 0x180 irq 12	# BOCA 8-port serial card
#com*	at boca? slave?

# Parallel ports:
lpt0	at isa? port 0x378		# at PC LPT1
lpt1	at isa? port 0x278		# at PC LPT2

# Logitech bus mouse:
#lms0	at isa? port 0x23c irq 9	# Logictech bus mouse
#mms0	at isa? port 0x23c irq 5	# Microsoft InPort mouse
#pms0	at isa? port 0x60 irq 12	# PS/2 auxiliary port mouse

# SCSI controllers and devices:
#bt*	at isa? port ? irq ? drq ?	# BusLogic BT742-based SCSI controllers
bt0	at isa? port 0x330 irq ? drq ?	# BusLogic BT5xx SCSI controllers
bt1	at isa? port 0x334 irq ? drq ?	# BusLogic BT5xx SCSI controllers
#bt*	at eisa? port ? irq ? drq ?	# BusLogic BT7xx SCSI controllers
#bt*	at pci? port ? irq ? drq ?	# BusLogic BT9xx SCSI controllers

ahb*    at eisa?			# Adaptec 174[024] SCSI controllers
ahc*	at pci? dev? function?		# Adaptec 2940 PCI

scsibus* at bt?
scsibus* at ahb?
scsibus* at ahc?

# DPT experimental development driver:
#dpt0	at eisa?			# DPT SCSI Caching/RAID controller
#scsibus* at dpt?

sd*	at scsibus? target ? lun ?	# SCSI disk drives
st*	at scsibus? target ? lun ?	# SCSI tape drives
cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
ch*	at scsibus? target ? lun ?	# SCSI autochangers

# Ethernet drivers:
ed0	at isa? port 0x300 iomem 0xd0000 irq 10	# WD/SMC, 3C503, and NE[12]000
#ed1	at isa? port 0x280 iomem 0xd0000 irq 10	# WD/SMC, 3C503, and NE[12]000
#ep0	at eisa?				# 3C59x ethernet cards
#ie0	at isa? port 0x360 iomem 0xd0000 irq 7	# StarLAN & 3C507
#le0	at isa? port 0x320 irq 10 drq 7		# IsoLan, NE2100, and DEPCA
de0	at pci? dev? function?			# DEC 21x40 ethernet cards

# Sound devices:
#sb0	at isa? port 0x220 irq 5 drq 1	# SoundBlaster
#wss0	at isa? port 0x530 irq 7 drq 0	# Windows Sound System
#pas0	at isa? port 0x220 irq 7 drq 1	# ProAudio Spectrum
# GUS flags is record drq for full-duplex:
#gus0	at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound
#spkr0	at isa? ...

# Pseudo devices:
pseudo-device	loop	1		# network loopback
pseudo-device	bpfilter 4		# packet filter
pseudo-device	sl	2		# CSLIP
pseudo-device	ppp	2		# PPP
pseudo-device	tun	2		# network tunneling over tty
pseudo-device	pty	64		# pseudo-terminals
pseudo-device	tb	1		# tablet line discipline
pseudo-device	vnd	4		# paging to files
pseudo-device	ccd	4		# concatenated disk device
     ----- >8 ----------  end config file  ---------- 8< -----


-----------------------------------------------------------------------------
  Michael L. VanLoon                           michaelv@MindBender.serv.net
        --<  Free your mind and your machine -- NetBSD free un*x  >--
    NetBSD working ports: 386+PC, Mac 68k, Amiga, Atari 68k, HP300, Sun3,
        Sun4/4c/4m, DEC MIPS, DEC Alpha, PC532, VAX, MVME68k, arm32...
    NetBSD ports in progress: PICA, others...
-----------------------------------------------------------------------------