1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /* Copyright 2015 QLogic Corporation */
  23 
  24 /*
  25  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29 #ifndef _QL_APPS_H
  30 #define _QL_APPS_H
  31 
  32 /*
  33  * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
  34  *
  35  * ***********************************************************************
  36  * *                                                                    **
  37  * *                            NOTICE                                  **
  38  * *            COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION              **
  39  * *                    ALL RIGHTS RESERVED                             **
  40  * *                                                                    **
  41  * ***********************************************************************
  42  *
  43  */
  44 
  45 #ifdef  __cplusplus
  46 extern "C" {
  47 #endif
  48 
  49 #include <sys/scsi/scsi_types.h>
  50 
  51 /* f/w trace sizes */
  52 #define FWEXTSIZE               (0x4000 * 4)    /* bytes - 16kb multiples */
  53 #define FWFCESIZE               (0x4000 * 4)    /* bytes - 16kb multiples */
  54 
  55 /*
  56  * ISP8100 Extended Initialization Control Block
  57  */
  58 typedef struct ql_ext_icb_8100 {
  59         uint8_t version[2];
  60         /*
  61          * BIT 0 = FCF VLAN ID Match
  62          * BIT 1 = FCF Fabric Name Match
  63          * BIT 2-7 = Reserved
  64          */
  65         uint8_t fcf_vlan_match;
  66         uint8_t reserved_6[3];
  67         uint8_t fcf_vlan_id[2];
  68         uint8_t fcf_fabric_name[8];
  69         uint8_t reserved_7[14];
  70         uint8_t spma_proposed_mac_address[6];
  71         uint8_t reserved_8[28];
  72 } ql_ext_icb_8100_t;
  73 
  74 /*
  75  * Name:        Adapter Revsion Level Structure
  76  *
  77  * Purpose:     Supply various revision levels of h/w and driver
  78  *
  79  * Used by:
  80  *              qlctest utility
  81  *
  82  */
  83 typedef struct ql_adapter_revlvl {
  84         uint16_t isp2200;                       /* 2200 chip rev level */
  85         uint16_t risc;                          /* risc rev level */
  86         uint16_t frmbfr;                        /* frame buffer rev level */
  87         uint16_t riscrom;                       /* risc rom rev level */
  88         char qlddv[16];                         /* ql driver version string */
  89 } ql_adapter_revlvl_t;
  90 
  91 /*
  92  * Name:        Application Mailbox Interface Structure
  93  *
  94  * Purpose:     Used to pass mailbox data between app and driver.
  95  *
  96  * Used by:
  97  *              qlctest utility
  98  *
  99  */
 100 typedef struct app_mbx_cmd {
 101         uint16_t        mb[32];
 102         uint8_t         reserved1[32];
 103 } app_mbx_cmd_t;
 104 
 105 /*
 106  * Name:        Diagnostic Loopback Parameter Structure
 107  *
 108  * Purpose:     Used for loopback parameter data
 109  *
 110  * Used by:
 111  *              qlctest utility
 112  *
 113  */
 114 #ifndef apps_64bit
 115 typedef struct lbp {
 116         uint16_t        options;
 117         uint32_t        transfer_count;
 118         uint16_t        transfer_segment_count;
 119         uint16_t        receive_segment_count;
 120         uint32_t        transfer_data_address;
 121         uint32_t        receive_data_address;
 122         uint32_t        iteration_count;
 123 } lbp_t;
 124 #else
 125 typedef struct lbp {
 126         uint16_t        options;
 127         uint32_t        transfer_count;
 128         uint16_t        transfer_segment_count;
 129         uint16_t        receive_segment_count;
 130         uint64_t        transfer_data_address;
 131         uint64_t        receive_data_address;
 132         uint32_t        iteration_count;
 133 } lbp_t;
 134 #endif
 135 
 136 /*
 137  * Defines used by:
 138  *                      qlctest utility
 139  *
 140  * Prupose:
 141  *      diag switch clause hooks provided for requested diagnostic
 142  *      functionality (Check command Queue, Revision Level, Firmwware
 143  *      Checksum, Self Test, Loopback Mailbox, Loopback Data, Execute
 144  *      Firmware and send ECHO.
 145  */
 146 #define QL_DIAG_CHKCMDQUE               0
 147 #define QL_DIAG_FMWCHKSUM               1
 148 #define QL_DIAG_SLFTST                  2
 149 #define QL_DIAG_REVLVL                  3
 150 #define QL_DIAG_LPBMBX                  4
 151 #define QL_DIAG_LPBDTA                  5
 152 #define QL_DIAG_EXEFMW                  6
 153 #define QL_GET_ADAPTER_FEATURE_BITS     7
 154 #define QL_SET_ADAPTER_FEATURE_BITS     8
 155 #define QL_SET_ADAPTER_NVRAM_DEFAULTS   9
 156 #define QL_DIAG_ECHO                    10
 157 
 158 /*
 159  * Defines used for:
 160  *                      qladm utility
 161  *                      qlctest utility
 162  *
 163  * Purpose:
 164  *      Driver IOCTL numbers for nvram dump/load, and driverop
 165  *      functions. NB: 300 --> 399 are reserved for qla2x00 foapi's
 166  */
 167 #define QL_UTIL_LOAD    100
 168 #define QL_UTIL_DUMP    101
 169 #define QL_FOAPI_START  300
 170 #define QL_FOAPI_END    399
 171 #define QL_ADM_OP       402
 172 
 173 /*
 174  * Purpose:
 175  *      QLA_ADM_OP command definitions
 176  *
 177  * Used by:
 178  *              qladm utility
 179  *              qlctest utility
 180  */
 181 typedef enum ql_adm_cmd {
 182         QL_EXTENDED_LOGGING,
 183         QL_ADAPTER_INFO,
 184         QL_DEVICE_LIST,
 185         QL_LOOP_RESET,
 186         QL_FW_DUMP,
 187         QL_FW_DUMP_TRIGGER,
 188         QL_BEACON_ENABLE,
 189         QL_BEACON_DISABLE,
 190         QL_NVRAM_LOAD,
 191         QL_NVRAM_DUMP,
 192         QL_FLASH_LOAD,
 193         QL_PROP_UPDATE_INT,
 194         QL_UPDATE_PROPERTIES,
 195         QL_VPD_LOAD,
 196         QL_VPD_DUMP,
 197         QL_VPD_GETTAG,
 198         QL_UPD_FWMODULE
 199 } ql_adm_cmd_t;
 200 
 201 /*
 202  * Purpose:
 203  *      QLA_ADM_OP Parameter Interface Structure
 204  *
 205  * Used by:
 206  *              qladm utility
 207  *              qlctest utility
 208  */
 209 typedef struct ql_adm_op {
 210         uint64_t        buffer;
 211         uint32_t        length;
 212         uint32_t        option;
 213         ql_adm_cmd_t    cmd;    /* driver_op command */
 214 } ql_adm_op_t;
 215 
 216 /*
 217  * Purpose:
 218  *      QLA_ADM_OP parameter data structure
 219  *
 220  * Used by:
 221  *              qladm utility
 222  *              qlctest utility
 223  */
 224 #define MAX_PROP_LENGTH 256
 225 typedef struct ql_adapter_info {
 226         uint8_t         wwpn[8];
 227         uint32_t        d_id;
 228         uint32_t        flash_size;
 229         uint16_t        device_id;
 230         char            fw_ver[MAX_PROP_LENGTH];
 231         char            fcode_ver[MAX_PROP_LENGTH];
 232         char            driver_ver[MAX_PROP_LENGTH];
 233 } ql_adapter_info_t;
 234 
 235 /*
 236  * Purpose:
 237  *      QLA_ADM_OP data types (Fibre channel port types)
 238  *
 239  * Used by:
 240  *              qladm utility
 241  *              qlctest utility
 242  */
 243 typedef enum ql_port_type {
 244         FCT_UNKNOWN,
 245         FCT_TAPE,
 246         FCT_INITIATOR,
 247         FCT_TARGET
 248 } ql_port_type_t;
 249 
 250 /*
 251  * Purpose:
 252  *      QLA_ADM_OP Device Information Structure
 253  *
 254  * Used by:
 255  *              qladm utility
 256  *              qlctest utility
 257  */
 258 typedef struct ql_device_info {
 259         uint8_t         wwpn[8];
 260         uint32_t        address;
 261         ql_port_type_t  type;
 262         uint16_t        loop_id;
 263 } ql_device_info_t;
 264 
 265 #ifdef  __cplusplus
 266 }
 267 #endif
 268 
 269 #endif /* _QL_APPS_H */