Home | History | Annotate | Line # | Download | only in scsipi
ses.h revision 1.2
      1  1.2   perry /* $NetBSD: ses.h,v 1.2 2005/02/27 00:27:48 perry Exp $ */
      2  1.1  mjacob /*
      3  1.1  mjacob  * Copyright (C) 2000 National Aeronautics & Space Administration
      4  1.1  mjacob  * All rights reserved.
      5  1.1  mjacob  *
      6  1.1  mjacob  * Redistribution and use in source and binary forms, with or without
      7  1.1  mjacob  * modification, are permitted provided that the following conditions
      8  1.1  mjacob  * are met:
      9  1.1  mjacob  * 1. Redistributions of source code must retain the above copyright
     10  1.1  mjacob  *    notice, this list of conditions and the following disclaimer.
     11  1.1  mjacob  * 2. The name of the author may not be used to endorse or promote products
     12  1.1  mjacob  *    derived from this software without specific prior written permission
     13  1.1  mjacob  *
     14  1.1  mjacob  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     15  1.1  mjacob  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     16  1.1  mjacob  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     17  1.1  mjacob  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     18  1.1  mjacob  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     19  1.1  mjacob  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     20  1.1  mjacob  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     21  1.1  mjacob  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     22  1.1  mjacob  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     23  1.1  mjacob  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24  1.1  mjacob  */
     25  1.1  mjacob 
     26  1.1  mjacob 
     27  1.1  mjacob #define	SESIOC			(('s' - 040) << 8)
     28  1.1  mjacob #define	SESIOC_GETNOBJ		_IO(SESIOC, 1)
     29  1.1  mjacob #define	SESIOC_GETOBJMAP	_IO(SESIOC, 2)
     30  1.1  mjacob #define	SESIOC_GETENCSTAT	_IO(SESIOC, 3)
     31  1.1  mjacob #define	SESIOC_SETENCSTAT	_IO(SESIOC, 4)
     32  1.1  mjacob #define	SESIOC_GETOBJSTAT	_IO(SESIOC, 5)
     33  1.1  mjacob #define	SESIOC_SETOBJSTAT	_IO(SESIOC, 6)
     34  1.1  mjacob #define	SESIOC_GETTEXT		_IO(SESIOC, 7)
     35  1.1  mjacob #define	SESIOC_INIT		_IO(SESIOC, 8)
     36  1.1  mjacob 
     37  1.1  mjacob /*
     38  1.1  mjacob  * Platform Independent Definitions for SES devices.
     39  1.1  mjacob  */
     40  1.1  mjacob /*
     41  1.1  mjacob  * SCSI Based Environmental Services Application Defines
     42  1.1  mjacob  *
     43  1.1  mjacob  * Based almost entirely on SCSI-3 SES Revision 8A specification,
     44  1.1  mjacob  * but slightly abstracted as the underlying device may in fact
     45  1.1  mjacob  * be a SAF-TE or vendor unique device.
     46  1.1  mjacob  */
     47  1.1  mjacob /*
     48  1.1  mjacob  * SES Driver Operations:
     49  1.1  mjacob  * (The defines themselves are platform and access method specific)
     50  1.1  mjacob  *
     51  1.1  mjacob  * SESIOC_GETNOBJ
     52  1.1  mjacob  * SESIOC_GETOBJMAP
     53  1.1  mjacob  * SESIOC_GETENCSTAT
     54  1.1  mjacob  * SESIOC_SETENCSTAT
     55  1.1  mjacob  * SESIOC_GETOBJSTAT
     56  1.1  mjacob  * SESIOC_SETOBJSTAT
     57  1.1  mjacob  * SESIOC_INIT
     58  1.1  mjacob  *
     59  1.1  mjacob  *
     60  1.1  mjacob  * An application finds out how many objects an SES instance
     61  1.1  mjacob  * is managing by performing a SESIOC_GETNOBJ operation. It then
     62  1.1  mjacob  * performs a SESIOC_GETOBJMAP to get the map that contains the
     63  1.1  mjacob  * object identifiers for all objects (see ses_object below).
     64  1.1  mjacob  * This information is static.
     65  1.2   perry  *
     66  1.1  mjacob  * The application may perform SESIOC_GETOBJSTAT operations to retrieve
     67  1.1  mjacob  * status on an object (see the ses_objstat structure below), SESIOC_SETOBJSTAT
     68  1.1  mjacob  * operations to set status for an object.
     69  1.1  mjacob  *
     70  1.1  mjacob  * Similarly overall enclosure status me be fetched or set via
     71  1.1  mjacob  * SESIOC_GETENCSTAT or  SESIOC_SETENCSTAT operations (see ses_encstat below).
     72  1.1  mjacob  *
     73  1.1  mjacob  * Readers should note that there is nothing that requires either a set
     74  1.1  mjacob  * or a clear operation to actually latch and do anything in the target.
     75  1.1  mjacob  *
     76  1.1  mjacob  * A SESIOC_INIT operation causes the enclosure to be initialized.
     77  1.1  mjacob  */
     78  1.1  mjacob 
     79  1.1  mjacob typedef struct {
     80  1.1  mjacob 	unsigned int	obj_id;		/* Object Identifier */
     81  1.1  mjacob 	unsigned char	subencid;	/* SubEnclosure ID */
     82  1.1  mjacob 	unsigned char	object_type;	/* Object Type */
     83  1.1  mjacob } ses_object;
     84  1.1  mjacob 
     85  1.1  mjacob /* Object Types */
     86  1.1  mjacob #define	SESTYP_UNSPECIFIED	0x00
     87  1.1  mjacob #define	SESTYP_DEVICE		0x01
     88  1.1  mjacob #define	SESTYP_POWER		0x02
     89  1.1  mjacob #define	SESTYP_FAN		0x03
     90  1.1  mjacob #define	SESTYP_THERM		0x04
     91  1.1  mjacob #define	SESTYP_DOORLOCK		0x05
     92  1.1  mjacob #define	SESTYP_ALARM		0x06
     93  1.1  mjacob #define	SESTYP_ESCC		0x07	/* Enclosure SCC */
     94  1.1  mjacob #define	SESTYP_SCC		0x08	/* SCC */
     95  1.1  mjacob #define	SESTYP_NVRAM		0x09
     96  1.1  mjacob #define	SESTYP_UPS		0x0b
     97  1.1  mjacob #define	SESTYP_DISPLAY		0x0c
     98  1.1  mjacob #define	SESTYP_KEYPAD		0x0d
     99  1.1  mjacob #define	SESTYP_SCSIXVR		0x0f
    100  1.1  mjacob #define	SESTYP_LANGUAGE		0x10
    101  1.1  mjacob #define	SESTYP_COMPORT		0x11
    102  1.1  mjacob #define	SESTYP_VOM		0x12
    103  1.1  mjacob #define	SESTYP_AMMETER		0x13
    104  1.1  mjacob #define	SESTYP_SCSI_TGT		0x14
    105  1.1  mjacob #define	SESTYP_SCSI_INI		0x15
    106  1.1  mjacob #define	SESTYP_SUBENC		0x16
    107  1.1  mjacob 
    108  1.1  mjacob /*
    109  1.1  mjacob  * Overall Enclosure Status
    110  1.1  mjacob  */
    111  1.1  mjacob typedef unsigned char ses_encstat;
    112  1.1  mjacob #define	SES_ENCSTAT_UNRECOV		0x1
    113  1.1  mjacob #define	SES_ENCSTAT_CRITICAL		0x2
    114  1.1  mjacob #define	SES_ENCSTAT_NONCRITICAL		0x4
    115  1.1  mjacob #define	SES_ENCSTAT_INFO		0x8
    116  1.1  mjacob 
    117  1.1  mjacob /*
    118  1.1  mjacob  * Object Status
    119  1.1  mjacob  */
    120  1.1  mjacob typedef struct {
    121  1.1  mjacob 	unsigned int	obj_id;
    122  1.1  mjacob 	unsigned char	cstat[4];
    123  1.1  mjacob } ses_objstat;
    124  1.1  mjacob 
    125  1.1  mjacob /* Summary SES Status Defines, Common Status Codes */
    126  1.1  mjacob #define	SES_OBJSTAT_UNSUPPORTED		0
    127  1.1  mjacob #define	SES_OBJSTAT_OK			1
    128  1.1  mjacob #define	SES_OBJSTAT_CRIT		2
    129  1.1  mjacob #define	SES_OBJSTAT_NONCRIT		3
    130  1.1  mjacob #define	SES_OBJSTAT_UNRECOV		4
    131  1.1  mjacob #define	SES_OBJSTAT_NOTINSTALLED	5
    132  1.1  mjacob #define	SES_OBJSTAT_UNKNOWN		6
    133  1.1  mjacob #define	SES_OBJSTAT_NOTAVAIL		7
    134  1.1  mjacob 
    135  1.1  mjacob /*
    136  1.1  mjacob  * For control pages, cstat[0] is the same for the
    137  1.1  mjacob  * enclosure and is common across all device types.
    138  1.1  mjacob  *
    139  1.1  mjacob  * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP
    140  1.1  mjacob  * are checked, otherwise bits that are specific to the device
    141  1.1  mjacob  * type in the other 3 bytes of cstat or checked.
    142  1.1  mjacob  */
    143  1.1  mjacob #define	SESCTL_CSEL		0x80
    144  1.1  mjacob #define	SESCTL_PRDFAIL		0x40
    145  1.1  mjacob #define	SESCTL_DISABLE		0x20
    146  1.1  mjacob #define	SESCTL_RSTSWAP		0x10
    147  1.1  mjacob 
    148  1.1  mjacob 
    149  1.1  mjacob /* Control bits, Device Elements, byte 2 */
    150  1.1  mjacob #define	SESCTL_DRVLCK	0x40	/* "DO NOT REMOVE" */
    151  1.1  mjacob #define	SESCTL_RQSINS	0x08	/* RQST INSERT */
    152  1.1  mjacob #define	SESCTL_RQSRMV	0x04	/* RQST REMOVE */
    153  1.1  mjacob #define	SESCTL_RQSID	0x02	/* RQST IDENT */
    154  1.1  mjacob /* Control bits, Device Elements, byte 3 */
    155  1.1  mjacob #define	SESCTL_RQSFLT	0x20	/* RQST FAULT */
    156  1.1  mjacob #define	SESCTL_DEVOFF	0x10	/* DEVICE OFF */
    157  1.1  mjacob 
    158  1.1  mjacob /* Control bits, Generic, byte 3 */
    159  1.1  mjacob #define	SESCTL_RQSTFAIL	0x40
    160  1.1  mjacob #define	SESCTL_RQSTON	0x20
    161  1.1  mjacob 
    162  1.1  mjacob /*
    163  1.1  mjacob  * Getting text for an object type is a little
    164  1.1  mjacob  * trickier because it's string data that can
    165  1.1  mjacob  * go up to 64 KBytes. Build this union and
    166  1.1  mjacob  * fill the obj_id with the id of the object who's
    167  1.1  mjacob  * help text you want, and if text is available,
    168  1.1  mjacob  * obj_text will be filled in, null terminated.
    169  1.1  mjacob  */
    170  1.1  mjacob 
    171  1.1  mjacob typedef union {
    172  1.1  mjacob 	unsigned int obj_id;
    173  1.1  mjacob 	char obj_text[1];
    174  1.1  mjacob } ses_hlptxt;
    175