[comp.sys.mac.programmer] Disk spunup/not mounting ?

phil@vaxphw.enet.dec.com (Phil Hunt) (09/22/89)

Hi everyone,

Well, I now have an INIT written that will spinup a DEC disk drive on a mac by
sending the SCSI START command to the drive, then it waits 4 seconds for the
drive to spin up....

A problem though....Most of the time, the Finder will not mount the drive..It
does some times and if I reboot with the drive still spun up, it always does.

I know the 4-seconds is enough for the drive to complete spinning up, actually
about 13 other inits run after mine, so it has been spun up over 10 seconds by
the time the Finder loads.....

Any ideas why it doesn't get mounted by the Finder?
==================================================================
Phil Hunt                      "Wherever you go, there you are!!!"
Digital Equipment Corporation                 Phone: (508)486-2164 
ENET:        VAXPHW::PHIL
USENET:      phil@vaxphw.enet.dec.com
MOREUSENET:  phil%vaxphw.dec@decwrl.enet.dec.com
EVENMORE:    ....!decwrl!dec-vaxphw!phil

steve@cpdaux.UUCP (Steve Lemke) (09/22/89)

In article <4879@shlump.nac.dec.com> phil@vaxphw.enet.dec.com (Phil Hunt) writes:
}Hi everyone,
}
}Well, I now have an INIT written that will spinup a DEC disk drive on a mac by
}sending the SCSI START command to the drive, then it waits 4 seconds for the
}drive to spin up....
}
}A problem though....Most of the time, the Finder will not mount the drive..It
}does some times and if I reboot with the drive still spun up, it always does.
}
}I know the 4-seconds is enough for the drive to complete spinning up, actually
}about 13 other inits run after mine, so it has been spun up over 10 seconds by
}the time the Finder loads.....
}
}Any ideas why it doesn't get mounted by the Finder?

I believe the drive must be "on" and "ready" when the machine turns on (or
within a few seconds thereafter), as in BEFORE a drive starts to boot.
Perhaps someone can verify this.  Are you able to mount it from the control
panel from "SCSI" or "SCSI Probe"?  If so, you may be interested in a program
called "Mounter" or something like that that can be "Set Startup..." to and
it will mount any ready drives.  I'm not sure where to get it, though.
-- 
----- Steve Lemke ------------------- "MS-DOS (OS/2, etc.) - just say no!"
----- Internet: cpdaux!steve@apple.com                GEnie:  LEMKE
----- Or try:   apple!cpdaux!steve               CompuServe:  73627,570
----- Quote:    "What'd I go to college for?"   "You had fun, didn't you?"

ts@cup.portal.com (Tim W Smith) (09/23/89)

By the time the Mac gets around to running your INIT, it is too late.
The sequence at boot time is somethine like this ( for the exact
sequence, check the tech notes ):

	1. For each SCSI disk, load the driver for that disk

	2. Mount the disk that the System file is on

	3. Run INITs

	4. Most disk drivers loaded in step 1 have set the dNeedTime
	bit.  When they get called because of this, they post disk
	insertion events so that the Finder will mount their
	volumes

Since your disk has not yet been spun up by step 1, it's driver is
not loaded.  When you reboot, it has been spun up, so it then works.

This does not explain your report of it working sometimes the first
time.  Is it possible that it was already spun up from a previous
use?

Anyway, you will need to change your INIT to load the driver from the
disk after it spins up.  The information you need is in IM IV.  This is
what you have to do:

	1. Read block 0 of the disk.  This contains the Driver
	Descriptor Map.  This will tell you where the driver is
	on the disk.

	2. Allocate a non-relocatable block in the system heap big
	enough to hold the driver.

	3. Read the driver from the disk into this block.

	4. Read block 1 from the disk into another non-relocatable
	block in the system heap.

	5. Put the address of this block in A0, and put the SCSI id
	of the driver in D5.

	6. JSR to the start of the driver.  It will install itself
	and return to you.

You may want to change your INIT to check first to see if the driver
has already been installed, just for safety.  Do this by looking at
the entry in the unit table for your SCSI disk and seeing if it is
non-zero.  SCSI device N is supposed to use entry 32+N.

						Tim Smith