Newsgroups: comp.os.minix
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!chi-news.cic.net!usc!howland.reston.ans.net!EU.net!sun4nl!cs.vu.nl!kjb
From: kjb@cs.vu.nl (Kees J Bot)
Subject: XT, AT, or PS/2?
Nntp-Posting-Host: flits.cs.vu.nl
Sender: news@cs.vu.nl
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Date: Sun, 12 Nov 1995 14:26:18 GMT
Message-ID: <DHxpFu.DIt.0.-s@cs.vu.nl>
Lines: 74

One of the first questions that Minix needs answered when it starts up
is the type of machine it is running on.  It does this by looking at the
machine type at address 0xFFFFE.

Alas it often guesses wrong as has been testified by people who try to
run Minix on a PS/2.  Minix does not always recognize that a machine has
an MCA bus.  It has also happened that an IBM machine was mistakenly
though to have an MCA bus, instead of a normal AT bus.

The result of Minix guessing wrong is that it will become deaf to
interrupts causing it to hang early in the bootup.

You can fix Minix' wrong assumptions by setting the 'bus' variable to
'xt', 'ps', 'at', or 'mca'.  This should not be necessary, so I'm trying
to find a better solution.

The solution may be to let the Boot Monitor figure out what 'bus' must
be.  There is a BIOS call (int 0x15, function 0xC0) that returns the
address of a table of system configuration data.  The "feature byte 1"
in this data contains a number of feature bits that can be used to set
'bus'.

This is what my test machine's configuration data is:

Machine	    CPU   Config address   Config data
 AT         386      fe6f5         08 00 fc 01 00 70 00 00 00 00

Config bytes 2 (0xFC) and 3 (0x01) contain the machine model and submodel
bytes that Minix currently uses to guess 'bus'.  Byte 5 (0x70) is
feature byte 1 that may be more useful to set 'bus'.

I would like to use the following code to compute 'bus':

	if (config_address == 0) {
		/* Old XT that doesn't know this BIOS call. */
		bus="xt";
	} else
	if (config_data[5] & 0x02) {
		/* This system has a Micro Channel bus. */
		bus="mca";
	} else
	if (config_data[5] & 0x40) {
		/* There is a second interrupt controller for IRQ 8-15. */
		bus="at";
	} else {
		/* Newer XT. */
		bus="xt";
	}

Why am I telling you all this?  Why don't I just implement it?  Well, I
am thoroughly confused by all the different PS/2 models out there, so it
would be nice if people would first run a small test I have cooked up.
Get the file

	ftp://ftp.cs.vu.nl/pub/kjb/features

write it onto a floppy raw (cat features >/dev/fd0) and boot your
machine from this floppy.  The feature data and the bus setting computed
from it will appear on your screen.

Boot your system normally, hit ESC, set 'bus' to the value found and use
'boot' to boot your system.

If it doesn't work then I would like to know what the feature data of
your machine is.  From this data I may be able to improve things.

You may have noticed that I left out the 'bus=ps' setting.  This is
because I am hoping that the weird old PS/2's that only work with this
setting are extinct.  There is a lot of badly understood code in Minix
that deals with this beast (if (ps) ...) that I would love to remove to
clean things up.
--
	                        Kees J. Bot  (kjb@cs.vu.nl)
	              Systems Programmer, Vrije Universiteit Amsterdam
