Home | History | Annotate | Line # | Download | only in scsipi
ses.h revision 1.4
      1  1.4  dholland /* $NetBSD: ses.h,v 1.4 2015/09/06 06:01:01 dholland 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.4  dholland #include <sys/ioccom.h>
     27  1.1    mjacob 
     28  1.1    mjacob #define	SESIOC			(('s' - 040) << 8)
     29  1.1    mjacob #define	SESIOC_GETNOBJ		_IO(SESIOC, 1)
     30  1.1    mjacob #define	SESIOC_GETOBJMAP	_IO(SESIOC, 2)
     31  1.1    mjacob #define	SESIOC_GETENCSTAT	_IO(SESIOC, 3)
     32  1.1    mjacob #define	SESIOC_SETENCSTAT	_IO(SESIOC, 4)
     33  1.1    mjacob #define	SESIOC_GETOBJSTAT	_IO(SESIOC, 5)
     34  1.1    mjacob #define	SESIOC_SETOBJSTAT	_IO(SESIOC, 6)
     35  1.1    mjacob #define	SESIOC_GETTEXT		_IO(SESIOC, 7)
     36  1.1    mjacob #define	SESIOC_INIT		_IO(SESIOC, 8)
     37  1.1    mjacob 
     38  1.1    mjacob /*
     39  1.1    mjacob  * Platform Independent Definitions for SES devices.
     40  1.1    mjacob  */
     41  1.1    mjacob /*
     42  1.1    mjacob  * SCSI Based Environmental Services Application Defines
     43  1.1    mjacob  *
     44  1.1    mjacob  * Based almost entirely on SCSI-3 SES Revision 8A specification,
     45  1.1    mjacob  * but slightly abstracted as the underlying device may in fact
     46  1.1    mjacob  * be a SAF-TE or vendor unique device.
     47  1.1    mjacob  */
     48  1.1    mjacob /*
     49  1.1    mjacob  * SES Driver Operations:
     50  1.1    mjacob  * (The defines themselves are platform and access method specific)
     51  1.1    mjacob  *
     52  1.1    mjacob  * SESIOC_GETNOBJ
     53  1.1    mjacob  * SESIOC_GETOBJMAP
     54  1.1    mjacob  * SESIOC_GETENCSTAT
     55  1.1    mjacob  * SESIOC_SETENCSTAT
     56  1.1    mjacob  * SESIOC_GETOBJSTAT
     57  1.1    mjacob  * SESIOC_SETOBJSTAT
     58  1.1    mjacob  * SESIOC_INIT
     59  1.1    mjacob  *
     60  1.1    mjacob  *
     61  1.1    mjacob  * An application finds out how many objects an SES instance
     62  1.1    mjacob  * is managing by performing a SESIOC_GETNOBJ operation. It then
     63  1.1    mjacob  * performs a SESIOC_GETOBJMAP to get the map that contains the
     64  1.1    mjacob  * object identifiers for all objects (see ses_object below).
     65  1.1    mjacob  * This information is static.
     66  1.2     perry  *
     67  1.1    mjacob  * The application may perform SESIOC_GETOBJSTAT operations to retrieve
     68  1.1    mjacob  * status on an object (see the ses_objstat structure below), SESIOC_SETOBJSTAT
     69  1.1    mjacob  * operations to set status for an object.
     70  1.1    mjacob  *
     71  1.1    mjacob  * Similarly overall enclosure status me be fetched or set via
     72  1.1    mjacob  * SESIOC_GETENCSTAT or  SESIOC_SETENCSTAT operations (see ses_encstat below).
     73  1.1    mjacob  *
     74  1.1    mjacob  * Readers should note that there is nothing that requires either a set
     75  1.1    mjacob  * or a clear operation to actually latch and do anything in the target.
     76  1.1    mjacob  *
     77  1.1    mjacob  * A SESIOC_INIT operation causes the enclosure to be initialized.
     78  1.1    mjacob  */
     79  1.1    mjacob 
     80  1.1    mjacob typedef struct {
     81  1.1    mjacob 	unsigned int	obj_id;		/* Object Identifier */
     82  1.1    mjacob 	unsigned char	subencid;	/* SubEnclosure ID */
     83  1.1    mjacob 	unsigned char	object_type;	/* Object Type */
     84  1.1    mjacob } ses_object;
     85  1.1    mjacob 
     86  1.1    mjacob /* Object Types */
     87  1.1    mjacob #define	SESTYP_UNSPECIFIED	0x00
     88  1.1    mjacob #define	SESTYP_DEVICE		0x01
     89  1.1    mjacob #define	SESTYP_POWER		0x02
     90  1.1    mjacob #define	SESTYP_FAN		0x03
     91  1.1    mjacob #define	SESTYP_THERM		0x04
     92  1.1    mjacob #define	SESTYP_DOORLOCK		0x05
     93  1.1    mjacob #define	SESTYP_ALARM		0x06
     94  1.1    mjacob #define	SESTYP_ESCC		0x07	/* Enclosure SCC */
     95  1.1    mjacob #define	SESTYP_SCC		0x08	/* SCC */
     96  1.1    mjacob #define	SESTYP_NVRAM		0x09
     97  1.1    mjacob #define	SESTYP_UPS		0x0b
     98  1.1    mjacob #define	SESTYP_DISPLAY		0x0c
     99  1.1    mjacob #define	SESTYP_KEYPAD		0x0d
    100  1.1    mjacob #define	SESTYP_SCSIXVR		0x0f
    101  1.1    mjacob #define	SESTYP_LANGUAGE		0x10
    102  1.1    mjacob #define	SESTYP_COMPORT		0x11
    103  1.1    mjacob #define	SESTYP_VOM		0x12
    104  1.1    mjacob #define	SESTYP_AMMETER		0x13
    105  1.1    mjacob #define	SESTYP_SCSI_TGT		0x14
    106  1.1    mjacob #define	SESTYP_SCSI_INI		0x15
    107  1.1    mjacob #define	SESTYP_SUBENC		0x16
    108  1.1    mjacob 
    109  1.1    mjacob /*
    110  1.1    mjacob  * Overall Enclosure Status
    111  1.1    mjacob  */
    112  1.1    mjacob typedef unsigned char ses_encstat;
    113  1.1    mjacob #define	SES_ENCSTAT_UNRECOV		0x1
    114  1.1    mjacob #define	SES_ENCSTAT_CRITICAL		0x2
    115  1.1    mjacob #define	SES_ENCSTAT_NONCRITICAL		0x4
    116  1.1    mjacob #define	SES_ENCSTAT_INFO		0x8
    117  1.1    mjacob 
    118  1.1    mjacob /*
    119  1.1    mjacob  * Object Status
    120  1.1    mjacob  */
    121  1.1    mjacob typedef struct {
    122  1.1    mjacob 	unsigned int	obj_id;
    123  1.1    mjacob 	unsigned char	cstat[4];
    124  1.1    mjacob } ses_objstat;
    125  1.1    mjacob 
    126  1.1    mjacob /* Summary SES Status Defines, Common Status Codes */
    127  1.1    mjacob #define	SES_OBJSTAT_UNSUPPORTED		0
    128  1.1    mjacob #define	SES_OBJSTAT_OK			1
    129  1.1    mjacob #define	SES_OBJSTAT_CRIT		2
    130  1.1    mjacob #define	SES_OBJSTAT_NONCRIT		3
    131  1.1    mjacob #define	SES_OBJSTAT_UNRECOV		4
    132  1.1    mjacob #define	SES_OBJSTAT_NOTINSTALLED	5
    133  1.1    mjacob #define	SES_OBJSTAT_UNKNOWN		6
    134  1.1    mjacob #define	SES_OBJSTAT_NOTAVAIL		7
    135  1.1    mjacob 
    136  1.1    mjacob /*
    137  1.1    mjacob  * For control pages, cstat[0] is the same for the
    138  1.1    mjacob  * enclosure and is common across all device types.
    139  1.1    mjacob  *
    140  1.1    mjacob  * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP
    141  1.1    mjacob  * are checked, otherwise bits that are specific to the device
    142  1.1    mjacob  * type in the other 3 bytes of cstat or checked.
    143  1.1    mjacob  */
    144  1.1    mjacob #define	SESCTL_CSEL		0x80
    145  1.1    mjacob #define	SESCTL_PRDFAIL		0x40
    146  1.1    mjacob #define	SESCTL_DISABLE		0x20
    147  1.1    mjacob #define	SESCTL_RSTSWAP		0x10
    148  1.1    mjacob 
    149  1.1    mjacob 
    150  1.1    mjacob /* Control bits, Device Elements, byte 2 */
    151  1.1    mjacob #define	SESCTL_DRVLCK	0x40	/* "DO NOT REMOVE" */
    152  1.1    mjacob #define	SESCTL_RQSINS	0x08	/* RQST INSERT */
    153  1.1    mjacob #define	SESCTL_RQSRMV	0x04	/* RQST REMOVE */
    154  1.1    mjacob #define	SESCTL_RQSID	0x02	/* RQST IDENT */
    155  1.1    mjacob /* Control bits, Device Elements, byte 3 */
    156  1.1    mjacob #define	SESCTL_RQSFLT	0x20	/* RQST FAULT */
    157  1.1    mjacob #define	SESCTL_DEVOFF	0x10	/* DEVICE OFF */
    158  1.1    mjacob 
    159  1.1    mjacob /* Control bits, Generic, byte 3 */
    160  1.1    mjacob #define	SESCTL_RQSTFAIL	0x40
    161  1.1    mjacob #define	SESCTL_RQSTON	0x20
    162  1.1    mjacob 
    163  1.1    mjacob /*
    164  1.1    mjacob  * Getting text for an object type is a little
    165  1.1    mjacob  * trickier because it's string data that can
    166  1.1    mjacob  * go up to 64 KBytes. Build this union and
    167  1.1    mjacob  * fill the obj_id with the id of the object who's
    168  1.1    mjacob  * help text you want, and if text is available,
    169  1.1    mjacob  * obj_text will be filled in, null terminated.
    170  1.1    mjacob  */
    171  1.1    mjacob 
    172  1.1    mjacob typedef union {
    173  1.1    mjacob 	unsigned int obj_id;
    174  1.1    mjacob 	char obj_text[1];
    175  1.1    mjacob } ses_hlptxt;
    176