bms@bdt.UUCP (Vance Chin) (07/11/90)
Recently, there have been a number of articles on the net concerning
the problems associated with booting an ST/hard disk system. Most of
the articles have dealt with specific solutions and haven't gone into
any real detail about the problems and their causes. I've decided to
take a crack at defining these problems and discussing the pros and
cons of various solutions.
The Disk
As I'm sure we all know, hard disks are basically mechanical devices.
This means that they operate orders of magnitude slower than the
microprocessors they're generally used with. When you turn a disk on
it could be 40 seconds before you'll be able to read any data. How a
disk and its controller (embedded and otherwise) behaves during power-up
places it in one of three groups.
The first group responds to any command with a "drive not ready" status
until the disk is up to speed and ready to read and write. Drives from
manufacturers like Micropolis, Imprimis, Priam, and Quantum fall into
this group.
The second group, upon receiving a command, holds the SCSI bus busy
until either the disk is ready, or a period of time (15-40 sec.) has
elapsed. The hard disk then will either execute the command (disk is
ready) or respond with "drive not ready" status (timeout). This group
notably includes Adaptec controllers.
The third group responds by not responding. If the drive is not up to
speed and ready to go it will not go busy in response to an SCSI select
phase. This group notably includes Seagate SCSI drives.
Each of the above groups has its problems. The first group requires that
the computer's boot code pole the drive until ready. The second group
requires that the command timeouts be greater than the controllers
timeout to prevent the SCSI bus from becoming hung. The third group
requires that you wait around for the maximum power-up delay before
deciding to boot the floppy.
The Computer
Inside your ST is a power-up reset circuit. Its purpose is to delay
operation of the computer until the power has stabalized, any additional
delay only gives you more time to twiddle your thumbs.
The ROMs
When it comes to hard disks the TOS ROMs really missed. The hard disk
boot code manages NOT to work with drives in all three catagories. They
don't pole for drive ready, they just try to read sector 0. They don't
allow for long command execution times, you get 2 seconds. They don't
delay than boot, they just boot.
The Boot Sequence
It's important to know how the ST comes up in order to know where we can
reasonably make changes. After reset goes away the ST first tries to
boot the cartridge at various levels. It then loads sector 0 off the
floppy and executes it if the checksum is correct. Next, for each of
the 8 DMA devices, sector 0 is read, checksummed, and executed if the
checksum is correct. Only after attempting to boot DMA devices does the
ST try to run programs from the auto folder.
The Solutions
1) Big Capacitor in Reset Circuit
Increasing the value of the power-up reset capacitor is a quick and
dirty way of making the computer wait before accessing the hard disk.
It has the side affect of making you wait no matter what the situation
is, if you just push the reset button you wait, if you get a fast
power-up hard drive you wait, if you're only booting a floppy you wait.
2) Sophisticated Big Capacitor in Reset Circuit
Along the same lines as the first possible solution is a circuit that
only adds a delay the when power is applied and not when the reset
button is pushed. This eliminates some of the more annoying aspects
of solution 1 but still can make you wait. In addition you've now got
to build this circuit from scratch.
NOTE: The above solutions can be reasonably applied in unattended systems
like BBSs.
3) Hard Disk Cartridge
Making a cartridge with code on it to make sure the hard disk is
ready before booting would definitely work. You could even have
different versions for different catagories of hard disks. However
it does preclude using the cartridge port for anything else.
4) Bootable Floppy
The "waitboot" utility included on the BMS distribution disk is an
example of what can be put on the boot sector of a floppy. Waitboot
operates by poling DMA device 0 until either it can read sector 0
or 40 seconds have elasped. This means that you only wait as long
as it takes the drive to come ready. It also has the side effect
of clearing a "unit attention" status.
5) New ROMs
This is the only real solution to the problem. If you're going to
support hard disks you might as well have a booter sophisticated
enough to do the job. This means poling the SCSI devices until
they come ready and then loading and executing the boot sector.
Handling things like "unit attention" statuses and devices that
don't respond until ready are also part of this. Unfortunately
this can really only be done by Atari as it would significantly
increase the size of the boot code.
However, we can fix one bug in the existing ROMs. Within the DMA
bus boot code there exists two timeouts, one is applied during
the transfer of command bytes to the device, and the other is
used to recover in case a device dies while executing a command.
The first timeout is 50 milliseconds, this is really too short
but can be left alone. The second timeout is 2 seconds, why? I
have no idea. This timeout ONLY comes into play if the device
has successfully received a command. By altering one bit in the
ROMs from my 1040ST I've extended the timeout to 42 seconds, this
allows single switch booting of my ST/hard disk (group 2) system.
It's interesting to note that if Atari had put a reasonable value
in here in the first place the original SH204 would have booted.
The byte to be changed is at address $fc05da in the TOS 1.4 ROMs,
the original value is $01 the new value is $21. I realize that
this is only a cure for systems that use Adaptec controllers, but
it is a real bug and should be fixed.
6) Auto Folder Programs
If you're using a hard disk from either group 1 or group 3 an auto
folder program can be useful. When the ST tries to boot a DMA
device it will get either "drive not ready" status (group 1) or
no response (group 3). Both cases result in the floppy auto folder
being executed. A program that simply delays then reboots would
work but will probably need to be tailored for each system to
minimize unnessasary delays. A better approach would be to pole
DMA devices until ready then reboot. When used with group 2 hard
disks auto folder programs won't work unless the controller has
timed out (this would be the case if you'd modified your ROMs as
above). This also won't get rid of a "unit attention" status as
it will be recreated each time the system reboots.
What To Do
The ideal solution would allow single switch booting without requiring
you to put in a floppy. This is possible if you have a group 2 disk
and modify your ROMs. If you're using a group 1 or group 3 disk, or you
don't want to modify your ROMs then waitboot should work. I'd stay
away from reset circuit mods and auto folder programs.bms@bdt.UUCP (Vance Chin) (07/11/90)
Sorry! Forgot to include my signature with the Single Switch System Boot article. Chris Rhodin Berkeley Microsystems bms@bdt.UUCP