David Robinson wrote:
> On my Minix system, I noticed that there are two instances of the at_wini
> driver running. Why are there two instances of the driver running?
Historically, the ATA driver only managed up to 8 drives or channels
which is the upper number chose by MS-DOS 5.0, and the maximum number of
normal PC-AT-class machines, that is, up to 4 ATA interfaces each with 2
channels, usually known as "master" and "slave". This upper number of 8
is even cast into the sub-device numbering scheme within the minor
device number, where only drive d0 to d7 are allowed.
Furthermore, for compatibility reasons (particularly with the BIOS
bootstrapping system), the first 4 channels are "compatibility" copies
of the ones as reported from the BIOS subsystem; as a result, c0d0 and
c0d4 usually behaves the same.
Of course, being able to address at most 2 ATA interfaces is not enough,
particularly with SATA disks (using the legacy "IDE" interface) where
only channel 0 serves usually. So to support quietly many machines,
MINIX chooses to start two instances of the at_disk driver, serving
controller c0 and controller c1; the latter is not subject to the
compatibility mapping, so serves really 4 interfaces. As a result, a
standard MINIX system is able to serve 6 different ATA interfaces, or 12
channels, which is enough to support any non-special needs.
> From /usr/src/drivers/ramdisk/rc, I see the following:
>
> /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
> /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 instance=1
>
I am not sure of the details, but I think that in '-dev /dev/c0d0', the
'd0' part does not matter, only the controller number does; the reason
is because there are no entries in the /dev file system, nor in the
numbering scheme for devices, to designate a controller as a whole,
without any reference to one of its attached drives. In MINIX a
controller is a major device, which is what is linked to a given driver;
but in the UNIX way, only devices, ie major+minor, can be named.
> I'm confused because the device files passed to at_wini (/dev/c0d0 and
> /dev/c1d0) don't appear to have any mounted filesystems.
Well I believe this is explained in
http://wiki.minix3.org/UsersGuide/DiskPartitions
In the PC architecture, file systems are not mounted on drives, rather
on independent partition of them.
The work to perform that mapping is in lib/libblockdriver/drvlib.c
Antoine