Subject: Re: [help] how to spin down sca hdds in SS5
To: Jack Lloyd <lloyd@acm.jhu.edu>
From: Brian A. Seklecki <lavalamp@spiritual-machines.org>
List: port-sparc
Date: 07/15/2002 13:01:28
On Mon, 15 Jul 2002 @ 11:04am (-0400), Jack Lloyd wrote:

JL> On Mon, 15 Jul 2002, Brian A. Seklecki wrote:
JL>
JL> > On Mon, 15 Jul 2002 @ 11:54am (+0900), henry nelson wrote:
JL> >
JL> > hn> Thanks for all of the help everyone has given me.  As a result, I have
JL> > hn> 20020317-1.5.3_ALPHA running on a SparcStation 5, with two identical
JL> > hn> Seagate 2GB SCA drives, and most importantly, an sbus 10base2 nic in
JL> > hn> addition to the onboard le0.
JL> > hn>
JL> > hn> BIG PROBLEM.  The disks are going to burn up if I can't figure out a way
JL> > hn> to spin them down and keep them that way except for brief actual use periods.
JL> > hn> I used it once for about an hour, and you could poach eggs on those hdds!
JL> >
JL> > ...mmm, maybe umount(8) the filesystems on the disk, then use scsictl(8)
JL> > to 'detatch' the ID/LUN from the bus/chain.  This will minimize activity
JL> > on the disks. As for sending a signal to spin down...does one even exist?
JL> >
JL> > ...afaik, spinning down disks is part of the apm 1.1 spec that exists in
JL> > i386 hardware...no support exists for sparc.
JL> >
JL> > anyone else?
JL>
JL> I haven't been able to find anything on how to do it (and I can't just turn
JL> of the disk because there's only one). My problem isn't heat (my SS5 ran
JL> for over a year perfectly solid), but noise. The single SCA disk in there
JL> is louder than the whole of my Athlon (which has 3 or 4 large fans, two
JL> hard drives, etc). I finally turned it off because, even stuck in my
JL> closet, the racket was driving me nuts.
JL>
JL> I don't believe SCSI (or at least what's in the SS5) knows how to spin down

The command to SPIN UP a disk is in sys/sys/dev/scsipi/scsipi_base.c:

/*
 * scsipi_start:
 *
 *      Send a START UNIT.
 */
int
scsipi_start(periph, type, flags)
        struct scsipi_periph *periph;
        int type, flags;
{
        struct scsipi_start_stop scsipi_cmd;

        if (periph->periph_quirks & PQUIRK_NOSTARTUNIT)
                return 0;

        memset(&scsipi_cmd, 0, sizeof(scsipi_cmd));
        scsipi_cmd.opcode = START_STOP;
        scsipi_cmd.byte2 = 0x00;
        scsipi_cmd.how = type;

        return (scsipi_command(periph,
            (struct scsipi_generic *) &scsipi_cmd, sizeof(scsipi_cmd),
            0, 0, SCSIPIRETRIES, (type & SSS_START) ? 60000 : 10000,
            NULL, flags));
}

...and from the header:

#define START_STOP              0x1b
struct scsipi_start_stop {
            u_int8_t opcode;
            u_int8_t byte2;
            u_int8_t unused[2];
            u_int8_t how;
#define SSS_STOP                0x00
#define SSS_START               0x01
#define SSS_LOEJ                0x02
            u_int8_t control;
};


... and of course, everywhere you look on the web, you come accross the scsi command reference from Linux:

http://www.tldp.org/HOWTO/SCSI-Programming-HOWTO-23.html

..which indicates that 0x1b is the opcode to stop/start.

sys/sbin/scsictl/scsictl.c:


/*
 * device_stop:
 *
 *      Issue a stop to a SCSI device.
 */
void
device_stop(argc, argv)
        int argc;
        char *argv[];
{
        struct scsipi_start_stop cmd;

        /* No arguments. */
        if (argc != 0)
                usage();

        memset(&cmd, 0, sizeof(cmd));

        cmd.opcode = START_STOP;
        cmd.how = SSS_STOP;

        scsi_command(fd, &cmd, sizeof(cmd), NULL, 0, 10000, 0);

        return;
}

-lava



JL> the disk. Anyone know of an SBUS IDE card? That would work. <shudder>
JL>
JL> So if anyone finds a way to do this, please mention it on port-sparc. :)
JL>
JL> -Jack
JL>

later -           | _BonaFide[] = { coder, author, | /~\ The ASCII Ribbon
Brian A. Seklecki | problem solver, scholar, BOFH, | \ / Campaign Against
                  | vegetarian, runner, NetBSD     |  X  Exchange, Outlook
                  | advocate, spiritual machine }; | / \ & HTML Email

PGP: 0111 4618 0111 4618 4AB2 24EB C853 6611 75C4 A91E A7A7 4973

"Microsoft Windoze: 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition."