SUMMARY: Macintosh CDROM on a Sun

From: Bonfield (jkb@mrc-lmb.cam.ac.uk)
Date: Thu Nov 05 1992 - 16:29:40 CST


Here's my original posting:

>Hello,
> We've got a Macintosh CDROM which we would like to connect up to a Sun
>SPARCStation 1. Has anyone had any experience and/or success of this before?
>Is it possible even?
>
> Cheers,
> James.
>

Thanks for the replies you sent me, but unfortunately I've been unable to
connect this drive up to the Sun. It's a Sony drive. The Sun drives are also
Sony but this apparently doesn't help particularly much. We don't have the
specs for the drive so it looks like the end here (for a while anyway).

I did recieve information regarding connecting Toshiba drives to Suns,
together with a program to change the sector read size to 512 bytes (as
required by Suns). Hopefully this will help others out there with similar
problems.

James Bonfield (jkb@mrc-lmba.cam.ac.uk) Tel: 0223 402499 Fax: 0223 412282
Medical Research Council Laboratory of Molecular Biology,
Hills Road, Cambridge, CB2 2QH, England.

Here are some replies which are hopefully useful to someone.

-----------------------------------------------------------------------------
>From xrsbg@thebes.gsfc.nasa.gov

I have gone the other way; Sun CD drive on a mac. They are not exactly
the same but both are Sony drives. I would bet that it would work..

-----------------------------------------------------------------------------
>From rpage@bigbrother.matrox.com (Real Page)

Tried once, did not work!
It made the SS1 crash..... :(

-----------------------------------------------------------------------------
>From ups!kevin@fourx.Aus.Sun.COM (Kevin Sheehan)

It is possible if the disk is HSFS (High Sierra File System, or ISO 9660) format,
or UFS (Unix) format (not likely). If you have one of the MacOS file system
formats, I'd suspect you are SOL unless you can write your own VFS ops.

Hmm, sounds like a product there...

-----------------------------------------------------------------------------
>From Perry_Hutchison.Portland@xerox.com

I have no info on a Mac CDROM specifically, but have a method which
works for the Toshiba XM3201B. Something similar might be applicable
to other drives.

The usual problem with non-Sun CDROM drives is that practically every
CDROM on the market defaults to a 2Kb sector size, but Sun had to be
different and set theirs for 512 bytes. Something about making life
easier for the boot ROM, which doesn't know a CDROM from any other SCSI
disk. The symptom of this is data overrun errors when trying to access
the CDROM. If this is the problem which you are running into, I could
send you a program to be run out of /etc/rc.local to set the drive's
sector size to 512 bytes before trying to access it -- of course this
will not allow you to boot from it, and there might be problems if some
sort of error later caused the esp driver to reset the SCSI bus.

-----------------------------------------------------------------------------
>From daveg@exlog.com (David Galloway)

I have a Macintosh CD-Rom which I have successfully connected up to a Sun
SPARC 1+.
The CD-ROM is a TOSHIBA but I have to use the user-scsi to program the CD-ROM
to ignore the overrun on read data. The layman's terms are that the CD-ROM
reads 2k Blocks and the SUN will only read 512 byte blocks.

The list came through for me a while back :-

>From: rkling@austin.intel.com (Ralph Kling)
> YES, it is possible! I have managed to connect one to a SS-2.
> However, there are a few differences between the SUN (=SONY) drive
> and the Toshiba drive. In particular, the SUN drive seems to use
> a default transfer block size of 512 bytes versus 2048 for the
> Toshiba. I wrote a little program that uses SUNs user-scsi-driver
> to correct this. You have to run that before trying to mount the
> drive! The "unrecognized vendor" message can be neglected.
> If you want to use the CD-audio capabilities you'll have to write
> your own driver (also via SUNs user-scsi-driver) since those commands
> are totally different from the SUN drive. Call Toshiba of America
> (sorry, I lost the number) and order the CD rom drive spec from them
> (will cost you $15).
> One more thing: The scsi-id for the CD rom needs to be 6.
> Good luck!!!
>
> Ralph
>
>
> Here is the program to set the transfer length to 512 bytes:

        -----------
        # include <sys/types.h>
        # include <sys/buf.h>
        # include <sun/dkio.h>
        # include <scsi/targets/srdef.h>
        # include <scsi/impl/uscsi.h>
        # include <strings.h>

        # include <stdio.h>

        char cdrom[] = "/dev/rsr0";

        extern char * cdrom_status();

        /* group 0 commands */

        #define TEST 0x00
        #define REZERO 0x01
        #define SENSEREQ 0x03
        #define READ 0x08
        #define SEEK 0x0b
        #define NOP 0x0d
        #define INQ 0x12
        #define MODESEL 0x15
        #define RESERVE 0x16
        #define RELEASE 0x17
        #define MODESENSE 0x1a
        #define STARTSTOP 0x1b
        #define DIAGRCV 0x1c
        #define DIAGSND 0x1d
        #define MEDIUMLOCK 0x1e

        /* group 1 commands */

        #define READCAP 0x25
        #define READEXT 0x28
        #define SEEKEXT 0x2b

        /* group 6 commands */

        #define AUDIOTRACK 0xc0
        #define AUDIOPLAY 0xc1
        #define AUDIOSTILL 0xc2
        #define AUDIOSTOP 0xc3
        #define EJECT 0xc4
        #define CLOSE 0xc5
        #define AUDIOSUB 0xc6
        #define AUDIODISK 0xc7
        #define ROMMODE 0xc8

        /***/

        #define CMDLEN(cmd) ((cmd >= 0x20) ? 10 : 6)

        /***/

        main() {
                int fd;
                int i;
                struct uscsi_cmd ucmd;
                char * s_command;
                char * s_buffer;

                if ((fd = open(cdrom, 0)) == -1) {
                        fprintf(stderr, "open: ");
                        perror(cdrom);
                        exit(1);
                }
                s_command = (char *) malloc(10);
                if (s_command == NULL) {
                        printf("malloc error (command)\n");
                        exit(-1);
                }
                bzero(s_command, 10);
                s_buffer = (char *) malloc(256);
                if (s_buffer == NULL) {
                        printf("malloc error (buffer)\n");
                        exit(-1);
                }
                bzero(s_buffer, 256);
                s_command[0] = MODESEL;
                s_command[1] = 0x10;
                s_command[4] = 12;
                s_buffer[3] = 0x08;
                s_buffer[10] = 0x02;
                ucmd.uscsi_cdb = s_command;
                ucmd.uscsi_cdblen = 6;
                ucmd.uscsi_bufaddr = s_buffer;
                ucmd.uscsi_buflen = 4096;
                ucmd.uscsi_flags = USCSI_WRITE;
                i = ioctl(fd, USCSICMD, ucmd);
                close(fd);
                exit(i);
        }
>**************** end of Ralph's goodie ****************



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:52 CDT