From: jpt@uh.msc.edu (Joseph Thomas)
Newsgroups: comp.unix.bsd
Subject: 386BSD: Problem in wd.c (?) - affects swap, non-atatched drive(s)
Date: 11 Dec 92 17:59:51 GMT
Organization: Minnesota Supercomputer Center, Minneapolis, MN


	Okay - here's a problems I haven't seen talked about and it's
not in the FAQ. Before I go chase it down and come up with some (possibly
unique to my system) fix, has anyone else run across this ??? Thanks.


	I'm running a 386/40C with a generic MFM controller and two
disks attached. I configured the kernel to support swap on wd1 but,
when swapon is called, I get an error of (something like)

	"swapon add device: failed: device not configured"

I checked the files and yes, the swap partition was configured into
the table ( $SYS/compile/$NAME/swap386bsd.c ). I didn't go any further
on this until I tried adding a second (MFM) controller last night.
I couldn't get the kernel to boot and after some effort, found that
the two problems seem to be related. [BTW: Controller one is set for primary
address, IRQ14, controller two is set for secondary address, IRQ 15.
Machine runs DOS and kernel finds controllers...]


	When 386bsd boots, it would find and report both controllers,
but would then hang. By inserting printf's, I came up with the following:

	In wd.c, there is a call to wdgetctlr() which then attempts
to issue a "Get Parameters" command (#8 ??). On my controllers, this
returns an error status of "Command Aborted" (#4). This leaves the
kernel not knowing anything about the drives at this point.

Implications:

	When going through the configuration steps (is isa_config(),
swap_conf(), etc.), the kernel does not know the name or geometry
of the drive. isa_config() can print out the controller information
(eg. wd0 at 0x3f0 IRQ 15 on isa) but not the drive information
(eg. <MAXTOR-XT1290>). Later, when swap is configured, swap_conf()
looks through the swdevt[] to add up all the sizes of available
devices. (This is done for interleaving when all devices are turned
on. Normally, only the "root" swap partition is marked available.
Later, swapon() will mark the space for its argument as available.)
Point is - swap_conf() needs to know the size of this partition/device
up front and it doesn't. The size of wd1b remains as zero.

	As for the second controller, the kernel can talk to and issue
commands, but appears to hang sometime after issuing wdgetctlr() commands
for the two drives it thinks might be attached there. [Strange - I haven'd
config'd any drives to that controller, but then I couldn't find where the
drive tables were setup anyways...] 

	The chain of events seems to be something like:

		wdprobe() for controller 0
		wdattach() controller 0
		wdgetctlr() looks for drive 0 on controller 0 - fails
		wdgetctlr() look for drive 1 on controller 0 - fails
	(someone) readdisklabel() for drive 0, controller 0
	(someone) readdisklabel() for drive 1, controller 0
		wdprobe() for controller 1
		wdattach() controller 1
		wdgetctlr() looks for drive 0 on controller 1 - fails
		wdgetcltr() looks for drive 1 on controller 1 - fails

		MACHINE HUNG


Anyone have any ideas??? Thought it was worth asking before I really
dig into this (not that I've had time before now - but things look good
for the next week or two).

Thanks again.
Newsgroups: comp.unix.bsd