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/dev/ic/isp_stds.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: isp_stds.h,v 1.2 2008/03/11 05:33:30 mjacob Exp $ */
    2 /*-
    3  *  Copyright (c) 1997-2008 by Matthew Jacob
    4  *  All rights reserved.
    5  * 
    6  *  Redistribution and use in source and binary forms, with or without
    7  *  modification, are permitted provided that the following conditions
    8  *  are met:
    9  * 
   10  *  1. Redistributions of source code must retain the above copyright
   11  *     notice, this list of conditions and the following disclaimer.
   12  *  2. Redistributions in binary form must reproduce the above copyright
   13  *     notice, this list of conditions and the following disclaimer in the
   14  *     documentation and/or other materials provided with the distribution.
   15  * 
   16  *  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   17  *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   19  *  ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
   20  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21  *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22  *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   24  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  *  SUCH DAMAGE.
   27  * 
   28  * 
   29  *  Matthew Jacob
   30  *  Feral Software
   31  *  421 Laurel Avenue
   32  *  Menlo Park, CA 94025
   33  *  USA
   34  * 
   35  *  gplbsd at feral com
   36  */
   37 /*
   38  * Structures that derive directly from public standards.
   39  */
   40 #ifndef _ISP_STDS_H
   41 #define _ISP_STDS_H
   42 
   43 /*
   44  * FC Frame Header
   45  *
   46  * Source: dpANS-X3.xxx-199x, section 18 (AKA FC-PH-2)
   47  *
   48  */
   49 typedef struct {
   50         uint8_t         r_ctl;
   51         uint8_t         d_id[3];
   52         uint8_t         cs_ctl;
   53         uint8_t         s_id[3];
   54         uint8_t         type;
   55         uint8_t         f_ctl;
   56         uint8_t         seq_id;
   57         uint8_t         df_ctl;
   58         uint16_t        seq_cnt;
   59         uint16_t        ox_id;
   60         uint16_t        rx_id;
   61         uint32_t        parameter;
   62 } fc_hdr_t;
   63 
   64 /*
   65  * FCP_CMND_IU Payload
   66  *
   67  * Source: NICTS T10, Project 1144D, Revision 07a, Section 9 (AKA fcp2-r07a)
   68  *
   69  * Notes:
   70  *      When additional cdb length is defined in fcp_cmnd_alen_datadir,
   71  *      bits 2..7, the actual cdb length is 16 + ((fcp_cmnd_alen_datadir>>2)*4),
   72  *      with the datalength following in MSB format just after.
   73  */
   74 typedef struct {
   75         uint8_t         fcp_cmnd_lun[8];
   76         uint8_t         fcp_cmnd_crn;
   77         uint8_t         fcp_cmnd_task_attribute;
   78         uint8_t         fcp_cmnd_task_management;
   79         uint8_t         fcp_cmnd_alen_datadir;
   80         union {
   81                 struct {
   82                         uint8_t         fcp_cmnd_cdb[16];
   83                         uint32_t        fcp_cmnd_dl;
   84                 } sf;
   85                 struct {
   86                         uint8_t         fcp_cmnd_cdb[1];
   87                 } lf;
   88         } cdb_dl;
   89 } fcp_cmnd_iu_t;
   90 
   91 
   92 #define FCP_CMND_TASK_ATTR_SIMPLE       0x00
   93 #define FCP_CMND_TASK_ATTR_HEAD         0x01
   94 #define FCP_CMND_TASK_ATTR_ORDERED      0x02
   95 #define FCP_CMND_TASK_ATTR_ACA          0x04
   96 #define FCP_CMND_TASK_ATTR_UNTAGGED     0x05
   97 #define FCP_CMND_TASK_ATTR_MASK         0x07
   98 
   99 #define FCP_CMND_ADDTL_CDBLEN_SHIFT     2
  100 
  101 #define FCP_CMND_DATA_WRITE             0x01
  102 #define FCP_CMND_DATA_READ              0x02
  103 
  104 #define FCP_CMND_DATA_DIR_MASK          0x03
  105 
  106 #define FCP_CMND_TMF_CLEAR_ACA          0x40
  107 #define FCP_CMND_TMF_TGT_RESET          0x20
  108 #define FCP_CMND_TMF_LUN_RESET          0x10
  109 #define FCP_CMND_TMF_CLEAR_TASK_SET     0x04
  110 #define FCP_CMND_TMF_ABORT_TASK_SET     0x02
  111 
  112 /*
  113  * Basic CT IU Header
  114  *
  115  * Source: X3.288-199x Generic Services 2 Rev 5.3 (FC-GS-2) Section 4.3.1
  116  */
  117 
  118 typedef struct {
  119         uint8_t         ct_revision;
  120         uint8_t         ct_in_id[3];
  121         uint8_t         ct_fcs_type;
  122         uint8_t         ct_fcs_subtype;
  123         uint8_t         ct_options;
  124         uint8_t         ct_reserved0;
  125         uint16_t        ct_cmd_resp;
  126         uint16_t        ct_bcnt_resid;
  127         uint8_t         ct_reserved1;
  128         uint8_t         ct_reason;
  129         uint8_t         ct_explanation;
  130         uint8_t         ct_vunique;
  131 } ct_hdr_t;
  132 #define CT_REVISION             1
  133 #define CT_FC_TYPE_FC           0xFC
  134 #define CT_FC_SUBTYPE_NS        0x02
  135 
  136 /*
  137  * RFT_ID Requet CT_IU
  138  *
  139  * Source: NCITS xxx-200x Generic Services- 5 Rev 8.5 Section 5.2.5.30
  140  */
  141 typedef struct {
  142         ct_hdr_t        rftid_hdr;
  143         uint8_t         rftid_reserved;
  144         uint8_t         rftid_portid[3];
  145         uint32_t        rftid_fc4types[8];
  146 } rft_id_t;
  147 
  148 /*
  149  * FCP Response IU Bits of interest
  150  * Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08)
  151  */
  152 #define FCP_CONF_REQ                    0x10
  153 #define FCP_RESID_UNDERFLOW             0x08
  154 #define FCP_RESID_OVERFLOW              0x04
  155 #define FCP_SNSLEN_VALID                0x02
  156 #define FCP_RSPLEN_VALID                0x01
  157 
  158 /*
  159  * FCP Response Code Definitions
  160  * Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08)
  161  */
  162 #define FCP_RSPNS_CODE_OFFSET           3
  163 
  164 #define FCP_RSPNS_TMF_DONE              0
  165 #define FCP_RSPNS_DLBRSTX               1
  166 #define FCP_RSPNS_BADCMND               2
  167 #define FCP_RSPNS_EROFS                 3
  168 #define FCP_RSPNS_TMF_REJECT            4
  169 #define FCP_RSPNS_TMF_FAILED            5
  170 
  171 
  172 /* unconverted miscellany */
  173 /*
  174  * Basic FC Link Service defines
  175  */
  176 /*
  177  * These are in the R_CTL field.
  178  */
  179 #define ABTS                    0x81
  180 #define BA_ACC                  0x84    /* of ABORT SEQUENCE */
  181 #define BA_RJT                  0x85    /* of ABORT SEQUENCE */
  182 
  183 /*
  184  * Link Service Accept/Reject
  185  */
  186 #define LS_ACC                  0x8002
  187 #define LS_RJT                  0x8001
  188 
  189 /*
  190  * FC ELS Codes- bits 31-24 of the first payload word of an ELS frame.
  191  */
  192 #define PLOGI                   0x03
  193 #define FLOGI                   0x04
  194 #define LOGO                    0x05
  195 #define ABTX                    0x06
  196 #define PRLI                    0x20
  197 #define PRLO                    0x21
  198 #define SCN                     0x22
  199 #define TPRLO                   0x24
  200 #define PDISC                   0x50
  201 #define ADISC                   0x52
  202 #define RNC                     0x53
  203 
  204 /*
  205  * FC4 defines
  206  */
  207 #define FC4_IP          5       /* ISO/EEC 8802-2 LLC/SNAP */
  208 #define FC4_SCSI        8       /* SCSI-3 via Fibre Channel Protocol (FCP) */
  209 #define FC4_FC_SVC      0x20    /* Fibre Channel Services */
  210 
  211 #ifndef MSG_ABORT
  212 #define MSG_ABORT               0x06
  213 #endif
  214 #ifndef MSG_BUS_DEV_RESET
  215 #define MSG_BUS_DEV_RESET       0x0c
  216 #endif
  217 #ifndef MSG_ABORT_TAG
  218 #define MSG_ABORT_TAG           0x0d
  219 #endif
  220 #ifndef MSG_CLEAR_QUEUE
  221 #define MSG_CLEAR_QUEUE         0x0e
  222 #endif
  223 #ifndef MSG_REL_RECOVERY
  224 #define MSG_REL_RECOVERY        0x10
  225 #endif
  226 #ifndef MSG_TERM_IO_PROC
  227 #define MSG_TERM_IO_PROC        0x11
  228 #endif
  229 #ifndef MSG_LUN_RESET
  230 #define MSG_LUN_RESET           0x17
  231 #endif
  232 
  233 #endif  /* _ISP_STDS_H */

Cache object: f4884d138d3c7683c4b407b30493aefd


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