The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/chio.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: chio.h,v 1.9 1997/09/29 17:32:26 mjacob Exp $  */
    2 
    3 /*-
    4  * SPDX-License-Identifier: BSD-4-Clause
    5  *
    6  * Copyright (c) 1996 Jason R. Thorpe <thorpej@and.com>
    7  * All rights reserved.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. All advertising materials mentioning features or use of this software
   18  *    must display the following acknowledgements:
   19  *      This product includes software developed by Jason R. Thorpe
   20  *      for And Communications, http://www.and.com/
   21  * 4. The name of the author may not be used to endorse or promote products
   22  *    derived from this software without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   27  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   32  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  * $FreeBSD: releng/12.0/sys/sys/chio.h 327288 2017-12-28 14:26:33Z pfg $
   37  */
   38 
   39 #ifndef _SYS_CHIO_H_
   40 #define _SYS_CHIO_H_
   41 
   42 #ifndef _KERNEL
   43 #include <sys/types.h>
   44 #endif
   45 #include <sys/ioccom.h>
   46 
   47 /*
   48  * Element types.  Used as "to" and "from" type indicators in move
   49  * and exchange operations.
   50  *
   51  * Note that code in sys/scsi/ch.c relies on these values (uses them
   52  * as offsets in an array, and other evil), so don't muck with them
   53  * unless you know what you're doing.
   54  */
   55 #define CHET_MT         0       /* medium transport (picker) */
   56 #define CHET_ST         1       /* storage transport (slot) */
   57 #define CHET_IE         2       /* import/export (portal) */
   58 #define CHET_DT         3       /* data transfer (drive) */
   59 #define CHET_MAX        CHET_DT
   60 
   61 /*
   62  * Maximum length of a volume identification string
   63  */
   64 #define CH_VOLTAG_MAXLEN        32
   65 
   66 /*
   67  * Structure used to execute a MOVE MEDIUM command.
   68  */
   69 struct changer_move {
   70         u_int16_t       cm_fromtype;    /* element type to move from */
   71         u_int16_t       cm_fromunit;    /* logical unit of from element */
   72         u_int16_t       cm_totype;      /* element type to move to */
   73         u_int16_t       cm_tounit;      /* logical unit of to element */
   74         u_int16_t       cm_flags;       /* misc. flags */
   75 };
   76 
   77 /* cm_flags */
   78 #define CM_INVERT       0x01    /* invert media */
   79 
   80 /*
   81  * Structure used to execute an EXCHANGE MEDIUM command.  In an
   82  * exchange operation, the following steps occur:
   83  *
   84  *      - media from source is moved to first destination.
   85  *
   86  *      - media previously occupying first destination is moved
   87  *        to the second destination.
   88  *
   89  * The second destination may or may not be the same as the source.
   90  * In the case of a simple exchange, the source and second destination
   91  * are the same.
   92  */
   93 struct changer_exchange {
   94         u_int16_t       ce_srctype;     /* element type of source */
   95         u_int16_t       ce_srcunit;     /* logical unit of source */
   96         u_int16_t       ce_fdsttype;    /* element type of first destination */
   97         u_int16_t       ce_fdstunit;    /* logical unit of first destination */
   98         u_int16_t       ce_sdsttype;    /* element type of second destination */
   99         u_int16_t       ce_sdstunit;    /* logical unit of second destination */
  100         u_int16_t       ce_flags;       /* misc. flags */
  101 };
  102 
  103 /* ce_flags */
  104 #define CE_INVERT1      0x01    /* invert media 1 */
  105 #define CE_INVERT2      0x02    /* invert media 2 */
  106 
  107 /*
  108  * Structure used to execute a POSITION TO ELEMENT command.  This
  109  * moves the current picker in front of the specified element.
  110  */
  111 struct changer_position {
  112         u_int16_t       cp_type;        /* element type */
  113         u_int16_t       cp_unit;        /* logical unit of element */
  114         u_int16_t       cp_flags;       /* misc. flags */
  115 };
  116 
  117 /* cp_flags */
  118 #define CP_INVERT       0x01    /* invert picker */
  119 
  120 /*
  121  * Data returned by CHIOGPARAMS.
  122  */
  123 struct changer_params {
  124         u_int16_t       cp_npickers;    /* number of pickers */
  125         u_int16_t       cp_nslots;      /* number of slots */
  126         u_int16_t       cp_nportals;    /* number of import/export portals */
  127         u_int16_t       cp_ndrives;     /* number of drives */
  128 };
  129 
  130 /*
  131  * Command used to get element status.
  132  */
  133 
  134 struct changer_voltag {
  135         u_char          cv_volid[CH_VOLTAG_MAXLEN+1];
  136         u_int16_t       cv_serial;
  137 };
  138 
  139 typedef struct changer_voltag changer_voltag_t;
  140 
  141 /*
  142  * Flags definitions for ces_status
  143  * Not all flags have meaning for all element types.
  144  */
  145 typedef enum {
  146         CES_STATUS_FULL   = 0x001,      /* element is full */
  147         CES_STATUS_IMPEXP = 0x002,      /* media deposited by operator */
  148         CES_STATUS_EXCEPT = 0x004,      /* element in abnormal state */
  149         CES_PICKER_MASK   = 0x005,      /* flags valid for pickers */
  150         CES_STATUS_ACCESS = 0x008,      /* media accessible by picker */
  151         CES_SLOT_MASK     = 0x00c,      /* flags valid for slots */
  152         CES_DRIVE_MASK    = 0x00c,      /* flags valid for drives */
  153         CES_STATUS_EXENAB = 0x010,      /* element supports exporting */
  154         CES_STATUS_INENAB = 0x020,      /* element supports importing */
  155         CES_PORTAL_MASK   = 0x03f,      /* flags valid for portals */
  156         CES_INVERT        = 0x040,      /* invert bit */
  157         CES_SOURCE_VALID  = 0x080,      /* source address (ces_source) valid */
  158         CES_SCSIID_VALID  = 0x100,      /* ces_scsi_id is valid */
  159         CES_LUN_VALID     = 0x200,      /* ces_scsi_lun is valid */
  160         CES_PIV           = 0x400       /* ces_protocol_id is valid */
  161 } ces_status_flags;
  162 
  163 struct changer_element_status {
  164         u_int8_t                ces_type;         /* element type */
  165         u_int16_t               ces_addr;         /* logical element address */
  166         u_int16_t               ces_int_addr;     /* changer element address */
  167         ces_status_flags        ces_flags;        /* 
  168                                                    * see CESTATUS definitions
  169                                                    * below 
  170                                                    */ 
  171         u_int8_t                ces_sensecode;    /* 
  172                                                    * additional sense
  173                                                    * code for element */
  174         u_int8_t                ces_sensequal;    /*
  175                                                    * additional sense
  176                                                    * code qualifier 
  177                                                    */
  178         u_int8_t                ces_source_type;  /* 
  179                                                    * element type of
  180                                                    * source address 
  181                                                    */
  182         u_int16_t               ces_source_addr;  /* 
  183                                                    * source address of medium
  184                                                    */
  185         changer_voltag_t        ces_pvoltag;      /* primary volume tag */
  186         changer_voltag_t        ces_avoltag;      /* alternate volume tag */
  187         u_int8_t                ces_scsi_id;      /* SCSI id of element */
  188         u_int8_t                ces_scsi_lun;     /* SCSI lun of element */
  189 
  190         /*
  191          * Data members for SMC3 and later versions
  192          */
  193         u_int8_t                ces_medium_type;
  194 #define CES_MEDIUM_TYPE_UNKNOWN         0       /* Medium type unspecified */
  195 #define CES_MEDIUM_TYPE_DATA            1       /* Data medium */
  196 #define CES_MEDIUM_TYPE_CLEANING        2       /* Cleaning medium */
  197 #define CES_MEDIUM_TYPE_DIAGNOSTIC      3       /* Diagnostic medium */
  198 #define CES_MEDIUM_TYPE_WORM            4       /* WORM medium */
  199 #define CES_MEDIUM_TYPE_MICROCODE       5       /* Microcode image medium */
  200 
  201         u_int8_t                ces_protocol_id;
  202 #define CES_PROTOCOL_ID_FCP_4   0       /* Fiber channel */
  203 #define CES_PROTOCOL_ID_SPI_5   1       /* Parallel SCSI */
  204 #define CES_PROTOCOL_ID_SSA_S3P 2       /* SSA */
  205 #define CES_PROTOCOL_ID_SBP_3   3       /* IEEE 1394 */
  206 #define CES_PROTOCOL_ID_SRP     4       /* SCSI Remote DMA */
  207 #define CES_PROTOCOL_ID_ISCSI   5       /* iSCSI */
  208 #define CES_PROTOCOL_ID_SPL     6       /* SAS */
  209 #define CES_PROTOCOL_ID_ADT_2   7       /* Automation/Drive Interface */
  210 #define CES_PROTOCOL_ID_ACS_2   8       /* ATA */
  211 
  212         u_int8_t                ces_assoc;
  213 #define CES_ASSOC_LOGICAL_UNIT  0
  214 #define CES_ASSOC_TARGET_PORT   1
  215 #define CES_ASSOC_TARGET_DEVICE 2
  216 
  217         u_int8_t                ces_designator_type;
  218 #define CES_DESIGNATOR_TYPE_VENDOR_SPECIFIC     0
  219 #define CES_DESIGNATOR_TYPE_T10_VENDOR_ID       1
  220 #define CES_DESIGNATOR_TYPE_EUI_64              2
  221 #define CES_DESIGNATOR_TYPE_NAA                 3
  222 #define CES_DESIGNATOR_TYPE_TARGET_PORT_ID      4
  223 #define CES_DESIGNATOR_TYPE_TARGET_PORT_GRP     5
  224 #define CES_DESIGNATOR_TYPE_LOGICAL_UNIT_GRP    6
  225 #define CES_DESIGNATOR_TYPE_MD5_LOGICAL_UNIT_ID 7
  226 #define CES_DESIGNATOR_TYPE_SCSI_NAME_STRING    8
  227 
  228         u_int8_t                ces_code_set;
  229 #define CES_CODE_SET_RESERVED   0
  230 #define CES_CODE_SET_BINARY     1
  231 #define CES_CODE_SET_ASCII      2
  232 #define CES_CODE_SET_UTF_8      3
  233 
  234         u_int8_t                ces_designator_length;
  235 
  236 #define CES_MAX_DESIGNATOR_LENGTH (1 << 8)
  237         u_int8_t                ces_designator[CES_MAX_DESIGNATOR_LENGTH + 1];
  238 };
  239 
  240 struct changer_element_status_request {
  241         u_int16_t                       cesr_element_type;
  242         u_int16_t                       cesr_element_base;
  243         u_int16_t                       cesr_element_count;
  244 
  245         u_int16_t                       cesr_flags;
  246 #define CESR_VOLTAGS    0x01
  247 
  248         struct changer_element_status   *cesr_element_status;
  249 };
  250 
  251 
  252 struct changer_set_voltag_request {
  253         u_int16_t               csvr_type;
  254         u_int16_t               csvr_addr;
  255 
  256         u_int16_t               csvr_flags;
  257 #define CSVR_MODE_MASK          0x0f    /* mode mask, acceptable modes below: */
  258 #define CSVR_MODE_SET           0x00    /* set volume tag if not set */
  259 #define CSVR_MODE_REPLACE       0x01    /* unconditionally replace volume tag */
  260 #define CSVR_MODE_CLEAR         0x02    /* clear volume tag */
  261 
  262 #define CSVR_ALTERNATE          0x10    /* set to work with alternate voltag */
  263 
  264         changer_voltag_t        csvr_voltag;
  265 };
  266 
  267 
  268 #define CESTATUS_BITS   \
  269         "\2\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
  270 
  271 #define CHIOMOVE        _IOW('c', 0x01, struct changer_move)
  272 #define CHIOEXCHANGE    _IOW('c', 0x02, struct changer_exchange)
  273 #define CHIOPOSITION    _IOW('c', 0x03, struct changer_position)
  274 #define CHIOGPICKER     _IOR('c', 0x04, int)
  275 #define CHIOSPICKER     _IOW('c', 0x05, int)
  276 #define CHIOGPARAMS     _IOR('c', 0x06, struct changer_params)
  277 #define CHIOIELEM       _IOW('c', 0x07, u_int32_t)
  278 #define OCHIOGSTATUS    _IOW('c', 0x08, struct changer_element_status_request)
  279 #define CHIOSETVOLTAG   _IOW('c', 0x09, struct changer_set_voltag_request)
  280 #define CHIOGSTATUS     _IOW('c', 0x0A, struct changer_element_status_request)
  281 
  282 #endif /* !_SYS_CHIO_H_ */

Cache object: 469e3b2f7b33ffad374535863782714b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.