Path: utzoo!attcan!uunet!oddjob!mimsy!eneevax!umd5!ames!coherent!dplatt
From: dplatt@coherent.com (Dave Platt)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Disk-driver incompatibility with System 6.0 may have been found
Keywords: disk driver System 6.0 _Status
Message-ID: <6683@coherent.com>
Date: 14 Jul 88 20:25:52 GMT
References: <6569@coherent.com>
Reply-To: dplatt@coherent.com (Dave Platt)
Distribution: comp
Organization: Coherent Thought Inc., Palo Alto CA
Lines: 75

I've received some confirmation from various quarters that Apple has, in
fact, changed the SCSI-disk-driver interface somewhat in System 6.0, and
that this change is causing a number of third-party SCSI drivers to
malfunction.

All drivers (disk drivers, sound drivers, desk accessories, etc.)
provide a "status" interface which accepts a ParamBlk.  The ParamBlk
contains a "csCode" in which the caller identifies the particular kind
of status information being requested, and a "csParam" record in which
the driver stores the resulting status information.  Inside Mac states
that the meanings of the csCode and csParam are driver-specific.

In its sample SCSI driver (on which many third-party drivers are based),
Apple simply stubbed out the status routine... it returned a "not
implemented" error code for all csCode inputs.  Prior to the release of
System 6.0, Apple system software apparently did not call the _Status
trap for disk drivers, and did not require drivers to return status
information.

Some third-party SCSI drivers (including the one used by Micah, and
perhaps the one used by Rodime as well) use the _Status call to retrieve
device-specific information from the driver... Micah's driver apparently
returns a portion of the SCSI "sense" information to the caller, based
on the csCode.  Based on what I've been able to read in IM, the tech
notes, etc., this is a legitimate use of the _Status call;  it doesn't
seem to violate any of Apple's published guidelines.

In System 6.0, Apple has added code to Disk First Aid 1.4, and
apparently to the disk-initialization package, that assumes that a
_Status call with csCode=6 returns some driver information having to do
with disk capacities.  If a driver can't return the indicated data, it
_must_ return an error code of some sort (Apple's drivers for the HD20SC
return a "not implemented" code).  In effect, Apple has preempted all
other vendors' uses of a csCode=6 status call.

This wouldn't have been a terrible problem, except that it appears that
Apple made this change without notifying third-party disk developers
that the change was going to occur (let alone documenting what this code
is supposed to do)!  As a result, disk drivers that use the _Status
interface for vendor-specific purposes tend to break under System 6.0.

I've looked through IM and the tech notes available to me (most of
them), and I can't see any indication that Apple ever declared a
specific range of csCode values to be "reserved for Apple use" (as
they've done with resource numbers, etc.).

BOO!  HISS!

I seem to call that Apple has taken some hits in the past, for changing
The Rules "on the fly" and breaking programs that had previously been
entirely legitimate and by-the-book.  Apple has certainly taken some bad
press for releasing System 6.0 in a not-entirely-debugged state, without
allowing adequate time for third-party testing and compatibility
checking.  Based on what I've seen, it appears that Apple goofed in both
of these ways when it decided to change the disk-driver interface.

[Robert Heinlein once wrote that every army, regardless of its formal
 organization structure, is actually composed of three parts: the
 Surprise Party Department, the Practical Joke Department, and the Fairy
 Godmother Department (the latter consisting of a single GS-3 clerk who's
 usually out sick).  I think the Surprise Party Department gets the
 credit for this latest little snafu.]

Fortunately, the problems that result from this little bobble aren't too
hard to work around... boot System 4.2 before formatting, initializing,
or erasing your third-party disk drives if you've noticed problems under
6.0.  I haven't seen any problems occur while actually _using_ one of
the affected disks under 6.0, as long as it was initialized under an
earlier version of the system.

-- 
Dave Platt                                             VOICE: (415) 493-8805
  USNAIL: Coherent Thought Inc.  3350 West Bayshore #205  Palo Alto CA 94303
  UUCP: ...!{ames,sun,uunet}!coherent!dplatt     DOMAIN: dplatt@coherent.com
  INTERNET:   coherent!dplatt@ames.arpa,    ...@sun.com,    ...@uunet.uu.net