Subject: port-hp300/460: scsi slaves treated as unit's
To: None <gnats-admin>
From: Jason R. Thorpe <thorpej@mail.CS.ORST.EDU>
List: netbsd-bugs
Date: 09/05/1994 13:20:20
>Number:         460
>Category:       port-hp300
>Synopsis:       scsi slaves treated as unit's
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep  5 13:20:19 1994
>Originator:     Jason R. Thorpe
>Organization:
	Department of Computer Science
	Oregon State University
>Release:        NetBSD 1.0_BETA (sup'd 9/4/94)
>Environment:
System: NetBSD santiam 1.0_BETA NetBSD 1.0_BETA (SANTIAM) #0: Thu Aug 11 13:42:08 PDT 1994 thorpej@santiam:/tmp_mnt/hurricane/NetBSD/src/sys/arch/hp300/compile/SANTIAM hp300


>Description:
	When attempting to place root and swap on a device other than
	slave 0, autoconf.c generates a warning:

		WARNING: using device at unit 0 of controller

	This is due to scsi being fundamentally different
	from hpib.  hpib drives have 1 controller per disk, whereas
	many drives hang off of a scsi controller.  These drives
	hanging off of the controller are being incorrectly treated
	as units, similar to the hp7946 (which has a disk at unit 0
	and a tape at unit 1).  The code always assumes unit 0, which
	in the case of scsi, is not necessarily correct.
>How-To-Repeat:
	bits from my kernel config:

	config netbsd root on sd0 swap on sd0b

	master          scsi0   at scode?
	master          scsi1   at scode?
	master          scsi2   at scode?
	master          scsi3   at scode?
	disk            sd0     at scsi0 slave 5
	disk            sd1     at scsi0 slave 6
	disk            sd2     at scsi0 slave 2
	disk            sd3     at scsi0 slave 3
	disk            sd4     at scsi0 slave 4
	disk            sd5     at scsi0 slave 5
	disk            sd6     at scsi0 slave 6
	disk            sd7     at scsi1 slave 0
	disk            sd8     at scsi1 slave 1
	disk            sd9     at scsi1 slave 2
	disk		sd10	at scsi0 slave 0
	tape            st0     at scsi? slave ?
	tape            st1     at scsi? slave ?

Note that scsi0, slave 0 is a cdrom drive...

Upon booting a kernel configured in this manner, after the autoconf
sequence, the warning message is generated and the kernel reports:

	changing root device to sd10a

...and then panics with a zero-divide trap, because the drive is
empty.  This behavior is not exihibited if booting off of an hpib
disk, no matter which slave, since the disk is always at unit 0 (at
least it is on all of my hpib disks...)

Note - just umplugging the cdrom won't do it, since sd0 is still at
slave (and therefore unit) 5 of scsi0

>Fix:
	Well, I can describe how I'd do it...

	Determine whether or not the root/swap is being done
	on a scsi disk.  If so, then set the unit # check to
	the slave id, and also use that number whenever unit 0
	is assumed.  If the disk is not scsi, then perhaps just
	default to unit 0, as the code does now.  Essentially, the following
	(at line 1024 of autoconf.c) is incorrect:

	if (unit != 0)
		printf("WARNING: using device at unit 0 of controller\n");
	
	mindev = hd->hp_unit;

	Actual code is unknown to me at the moment...But after enough
	coffee, I'm sure I can come up with something...
>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------