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-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: chio.h,v 1.12 2008/04/28 20:24:10 martin Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 1996, 1999 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
    9  * NASA Ames Research Center.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   30  * POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 #ifndef _SYS_CHIO_H_
   34 #define _SYS_CHIO_H_
   35 
   36 /*
   37  * Element types.  Used as "to" and "from" type indicators in move
   38  * and exchange operations.
   39  *
   40  * Note that code in sys/dev/scsipi/ch.c relies on these values (uses
   41  * them as offsets in an array, and other evil), so don't muck with them
   42  * unless you know what you're doing.
   43  */
   44 #define CHET_MT         0       /* medium transport (picker) */
   45 #define CHET_ST         1       /* storage transport (slot) */
   46 #define CHET_IE         2       /* import/export (portal) */
   47 #define CHET_DT         3       /* data transfer (drive) */
   48 
   49 /*
   50  * Structure used to execute a MOVE MEDIUM command.
   51  */
   52 struct changer_move_request {
   53         int     cm_fromtype;    /* element type to move from */
   54         int     cm_fromunit;    /* logical unit of from element */
   55         int     cm_totype;      /* element type to move to */
   56         int     cm_tounit;      /* logical unit of to element */
   57         int     cm_flags;       /* misc. flags */
   58 };
   59 
   60 /* cm_flags */
   61 #define CM_INVERT       0x01    /* invert media */
   62 
   63 /*
   64  * Structure used to execute an EXCHANGE MEDIUM command.  In an
   65  * exchange operation, the following steps occur:
   66  *
   67  *      - media from source is moved to first destination.
   68  *
   69  *      - media previously occupying first destination is moved
   70  *        to the second destination.
   71  *
   72  * The second destination may or may not be the same as the source.
   73  * In the case of a simple exchange, the source and second destination
   74  * are the same.
   75  */
   76 struct changer_exchange_request {
   77         int     ce_srctype;     /* element type of source */
   78         int     ce_srcunit;     /* logical unit of source */
   79         int     ce_fdsttype;    /* element type of first destination */
   80         int     ce_fdstunit;    /* logical unit of first destination */
   81         int     ce_sdsttype;    /* element type of second destination */
   82         int     ce_sdstunit;    /* logical unit of second destination */
   83         int     ce_flags;       /* misc. flags */
   84 };
   85 
   86 /* ce_flags */
   87 #define CE_INVERT1      0x01    /* invert media 1 */
   88 #define CE_INVERT2      0x02    /* invert media 2 */
   89 
   90 /*
   91  * Structure used to execute a POSITION TO ELEMENT command.  This
   92  * moves the current picker in front of the specified element.
   93  */
   94 struct changer_position_request {
   95         int     cp_type;        /* element type */
   96         int     cp_unit;        /* logical unit of element */
   97         int     cp_flags;       /* misc. flags */
   98 };
   99 
  100 /* cp_flags */
  101 #define CP_INVERT       0x01    /* invert picker */
  102 
  103 /*
  104  * Data returned by CHIOGPARAMS.
  105  */
  106 struct changer_params {
  107         int     cp_curpicker;   /* current picker */
  108         int     cp_npickers;    /* number of pickers */
  109         int     cp_nslots;      /* number of slots */
  110         int     cp_nportals;    /* number of import/export portals */
  111         int     cp_ndrives;     /* number of drives */
  112 };
  113 
  114 /*
  115  * Old-style command used to get element status.
  116  */
  117 struct ochanger_element_status_request {
  118         int     cesr_type;      /* element type */
  119         uint8_t *cesr_data;     /* pre-allocated data storage */
  120 };
  121 
  122 /*
  123  * Structure of a changer volume tag.
  124  */
  125 #define CHANGER_VOLTAG_SIZE     32      /* same as SCSI voltag size */
  126 struct changer_voltag {
  127         char    cv_tag[CHANGER_VOLTAG_SIZE + 1];        /* ASCII tag */
  128         uint16_t cv_serial;                             /* serial number */
  129 };
  130 
  131 /*
  132  * Data returned by CHIOGSTATUS.
  133  */
  134 struct changer_element_status {
  135         int     ces_flags;      /* CESTATUS_* flags; see below */
  136 
  137         /*
  138          * The following is only valid on Data Transport elements (drives).
  139          */
  140         char    ces_xname[16];  /* external name of drive device */
  141 
  142         /*
  143          * The following fieds indicate the element the medium was
  144          * moved from in order to arrive in this element.
  145          */
  146         int     ces_from_type;  /* type of element */
  147         int     ces_from_unit;  /* logical unit of element */
  148 
  149         /*
  150          * Volume tag information.
  151          */
  152         struct changer_voltag ces_pvoltag;      /* primary volume tag */
  153         struct changer_voltag ces_avoltag;      /* alternate volume tag */
  154 
  155         size_t  ces_vendor_len; /* length of any vendor-specific data */
  156 
  157         /*
  158          * These two fields are only valid if CESTATUS_EXCEPT is
  159          * set in ces_flags, and are only valid on SCSI changers.
  160          */
  161         uint8_t ces_asc;        /* Additional Sense Code */
  162         uint8_t ces_ascq;       /* Additional Sense Code Qualifier */
  163 
  164         /*
  165          * These two fields may be useful if ces_xname is not valid.
  166          * They indicate the target and lun of a drive element.  These
  167          * are only valid on SCSI changers.
  168          */
  169         uint8_t ces_target;     /* SCSI target of drive */
  170         uint8_t ces_lun;        /* SCSI LUN of drive */
  171 };
  172 
  173 /*
  174  * Flags for changer_element_status.  These are flags that are returned
  175  * by hardware.  Not all flags have meaning for all element types.
  176  */
  177 #define CESTATUS_FULL           0x0001  /* element is full */
  178 #define CESTATUS_IMPEXP         0x0002  /* media deposited by operator */
  179 #define CESTATUS_EXCEPT         0x0004  /* element in abnormal state */
  180 #define CESTATUS_ACCESS         0x0008  /* media accessible by picker */
  181 #define CESTATUS_EXENAB         0x0010  /* element supports exporting */
  182 #define CESTATUS_INENAB         0x0020  /* element supports importing */
  183 
  184 #define CESTATUS_PICKER_MASK    0x0005  /* flags valid for pickers */
  185 #define CESTATUS_SLOT_MASK      0x000c  /* flags valid for slots */
  186 #define CESTATUS_PORTAL_MASK    0x003f  /* flags valid for portals */
  187 #define CESTATUS_DRIVE_MASK     0x000c  /* flags valid for drives */
  188 
  189 #define CESTATUS_INVERTED       0x0040  /* medium inverted from storage */
  190 #define CESTATUS_NOTBUS         0x0080  /* drive not on same bus as changer */
  191 
  192 /*
  193  * These changer_element_status flags indicate the validity of fields
  194  * in the returned data.
  195  */
  196 #define CESTATUS_STATUS_VALID   0x0100  /* entire structure valid */
  197 #define CESTATUS_XNAME_VALID    0x0200  /* ces_xname valid */
  198 #define CESTATUS_FROM_VALID     0x0400  /* ces_from_* valid */
  199 #define CESTATUS_PVOL_VALID     0x0800  /* ces_pvoltag valid */
  200 #define CESTATUS_AVOL_VALID     0x1000  /* ces_avoltag valid */
  201 #define CESTATUS_TARGET_VALID   0x2000  /* ces_target valid */
  202 #define CESTATUS_LUN_VALID      0x4000  /* ces_lun valid */
  203 
  204 #define CESTATUS_BITS   \
  205         "\2\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
  206 
  207 /*
  208  * Command used to get element status.
  209  */
  210 struct changer_element_status_request {
  211         int     cesr_type;      /* element type */
  212         int     cesr_unit;      /* start at this unit */
  213         int     cesr_count;     /* for this many units */
  214         int     cesr_flags;     /* flags; see below */
  215                                 /* pre-allocated data storage */
  216         /*
  217          * These fields point to the data to be returned to the
  218          * user:
  219          *
  220          *      cesr_deta: pointer to array of cesr_count status descriptors
  221          *
  222          *      cesr_vendor_data: pointer to array of void *'s which point
  223          *      to pre-allocated areas for vendor-specific data.  Optional.
  224          */
  225         struct changer_element_status *cesr_data;
  226         void    **cesr_vendor_data;
  227 };
  228 
  229 #define CESR_VOLTAGS            0x01    /* request volume tags */
  230 
  231 /*
  232  * Command used to modify a media element's volume tag.
  233  */
  234 struct changer_set_voltag_request {
  235         int     csvr_type;      /* element type */
  236         int     csvr_unit;      /* unit to modify */
  237         int     csvr_flags;     /* flags; see below */
  238                                 /* the actual volume tag; ignored if clearing
  239                                    the tag */
  240         struct changer_voltag csvr_voltag;
  241 };
  242 
  243 #define CSVR_MODE_SET           0x00    /* set volume tag if not set */
  244 #define CSVR_MODE_REPLACE       0x01    /* unconditionally replace volume tag */
  245 #define CSVR_MODE_CLEAR         0x02    /* clear volume tag */
  246 #define CSVR_MODE_MASK          0x0f
  247 #define CSVR_ALTERNATE          0x10    /* modify alternate volume tag */
  248 
  249 /*
  250  * Changer events.
  251  *
  252  * When certain events occur, the kernel can indicate this by setting
  253  * a bit in a bitmask.
  254  *
  255  * When a read is issued to the changer, the kernel returns this event
  256  * bitmask.  The read never blocks; if no events are pending, the bitmask
  257  * will be all-clear.
  258  *
  259  * A process may select for read to wait for an event to occur.
  260  *
  261  * The event mask is cleared when the changer is closed.
  262  */
  263 #define CHANGER_EVENT_SIZE              sizeof(u_int)
  264 #define CHEV_ELEMENT_STATUS_CHANGED     0x00000001
  265 
  266 /*
  267  * ioctls applicable to changers.
  268  */
  269 #define CHIOMOVE        _IOW('c', 0x01, struct changer_move_request)
  270 #define CHIOEXCHANGE    _IOW('c', 0x02, struct changer_exchange_request)
  271 #define CHIOPOSITION    _IOW('c', 0x03, struct changer_position_request)
  272 #define CHIOGPICKER     _IOR('c', 0x04, int)
  273 #define CHIOSPICKER     _IOW('c', 0x05, int)
  274 #define CHIOGPARAMS     _IOR('c', 0x06, struct changer_params)
  275 #define CHIOIELEM        _IO('c', 0x07)
  276 #define OCHIOGSTATUS    _IOW('c', 0x08, struct ochanger_element_status_request)
  277 #define CHIOGSTATUS     _IOW('c', 0x09, struct changer_element_status_request)
  278 #define CHIOSVOLTAG     _IOW('c', 0x0a, struct changer_set_voltag_request)
  279 
  280 #endif /* _SYS_CHIO_H_ */

Cache object: 623105814a18407cd5d50b3cd7f4b081


[ 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.