1*fcf3ce44SJohn Forte /* 2*fcf3ce44SJohn Forte * CDDL HEADER START 3*fcf3ce44SJohn Forte * 4*fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5*fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6*fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7*fcf3ce44SJohn Forte * 8*fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10*fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11*fcf3ce44SJohn Forte * and limitations under the License. 12*fcf3ce44SJohn Forte * 13*fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14*fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16*fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17*fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18*fcf3ce44SJohn Forte * 19*fcf3ce44SJohn Forte * CDDL HEADER END 20*fcf3ce44SJohn Forte */ 21*fcf3ce44SJohn Forte /* 22*fcf3ce44SJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*fcf3ce44SJohn Forte * Use is subject to license terms. 24*fcf3ce44SJohn Forte */ 25*fcf3ce44SJohn Forte 26*fcf3ce44SJohn Forte #ifndef _FCPVAR_H 27*fcf3ce44SJohn Forte #define _FCPVAR_H 28*fcf3ce44SJohn Forte 29*fcf3ce44SJohn Forte 30*fcf3ce44SJohn Forte 31*fcf3ce44SJohn Forte #ifdef __cplusplus 32*fcf3ce44SJohn Forte extern "C" { 33*fcf3ce44SJohn Forte #endif 34*fcf3ce44SJohn Forte 35*fcf3ce44SJohn Forte #include <sys/types.h> 36*fcf3ce44SJohn Forte 37*fcf3ce44SJohn Forte /* 38*fcf3ce44SJohn Forte * Maximum number of times FCP will re-issue a REPORTS_LUNS command if the 39*fcf3ce44SJohn Forte * device couldn't return all of them in the submitted buffer. 40*fcf3ce44SJohn Forte */ 41*fcf3ce44SJohn Forte #define FCP_MAX_REPORTLUNS_ATTEMPTS 2 42*fcf3ce44SJohn Forte /* 43*fcf3ce44SJohn Forte * Maximum number of LUNs supported. This limit is enforced to accommodate 44*fcf3ce44SJohn Forte * certain HBAs. 45*fcf3ce44SJohn Forte */ 46*fcf3ce44SJohn Forte #define FCP_MAX_LUNS_SUPPORTED 65535 47*fcf3ce44SJohn Forte 48*fcf3ce44SJohn Forte /* 49*fcf3ce44SJohn Forte * Stuff to be defined in fc_ulpif.h FIXIT 50*fcf3ce44SJohn Forte */ 51*fcf3ce44SJohn Forte #define PORT_DEVICE_CREATE 0x40 52*fcf3ce44SJohn Forte #define SCMD_REPORT_LUN 0xa0 /* SCSI cmd to report on LUNs */ 53*fcf3ce44SJohn Forte #define SCMD_INQUIRY_LWWN_SIZE 32 /* Max WWN size */ 54*fcf3ce44SJohn Forte #define SCMD_INQUIRY_PAGE83 0xF0 /* Internal opcode for page 0x83 */ 55*fcf3ce44SJohn Forte #define FC4_SCSI_FCP 0x08 /* our (SCSI) FC4 type number */ 56*fcf3ce44SJohn Forte 57*fcf3ce44SJohn Forte #define FCP_QUEUE_DELAY (4) 58*fcf3ce44SJohn Forte #define FCP_FAILED_DELAY 20 59*fcf3ce44SJohn Forte #define FCP_RESET_DELAY 3 /* target reset delay of 3 secs */ 60*fcf3ce44SJohn Forte #define FCP_OFFLINE_DELAY 20 /* 20 seconds is 2*RA_TOV_els */ 61*fcf3ce44SJohn Forte 62*fcf3ce44SJohn Forte /* 63*fcf3ce44SJohn Forte * Highest possible timeout value to indicate 64*fcf3ce44SJohn Forte * the watch thread to return the I/O 65*fcf3ce44SJohn Forte */ 66*fcf3ce44SJohn Forte #define FCP_INVALID_TIMEOUT (0xFFFFFFFF) 67*fcf3ce44SJohn Forte 68*fcf3ce44SJohn Forte /* 69*fcf3ce44SJohn Forte * The max inquiry page 83 size as expected in the code today 70*fcf3ce44SJohn Forte * is 0xf0 bytes. Defining a constant to make it easy incase 71*fcf3ce44SJohn Forte * this needs to be changed at a later time. 72*fcf3ce44SJohn Forte */ 73*fcf3ce44SJohn Forte #define SCMD_MAX_INQUIRY_PAGE83_SIZE 0xF0 74*fcf3ce44SJohn Forte /* 75*fcf3ce44SJohn Forte * Events generated for Target drivers; "SUNW,sf:" prefix 76*fcf3ce44SJohn Forte * is a legacy fcal stuff hardcoded into ssd via the use of 77*fcf3ce44SJohn Forte * FCAL_INSERT_EVENT defined in an fcal header file; We 78*fcf3ce44SJohn Forte * just need to continue to use this. 79*fcf3ce44SJohn Forte */ 80*fcf3ce44SJohn Forte #define FCAL_INSERT_EVENT "SUNW,sf:DEVICE-INSERTION.1" 81*fcf3ce44SJohn Forte #define FCAL_REMOVE_EVENT "SUNW,sf:DEVICE-REMOVAL.1" 82*fcf3ce44SJohn Forte 83*fcf3ce44SJohn Forte /* 84*fcf3ce44SJohn Forte * for debug trace 85*fcf3ce44SJohn Forte */ 86*fcf3ce44SJohn Forte #define FCP_STACK_DEPTH 14 87*fcf3ce44SJohn Forte 88*fcf3ce44SJohn Forte 89*fcf3ce44SJohn Forte /* 90*fcf3ce44SJohn Forte * All the stuff above needs to move intp appropriate header files. 91*fcf3ce44SJohn Forte */ 92*fcf3ce44SJohn Forte 93*fcf3ce44SJohn Forte #define FCP_NUM_HASH 128 94*fcf3ce44SJohn Forte 95*fcf3ce44SJohn Forte #define FCP_HASH(x) ((x[0] + x[1] + x[2] + x[3] +\ 96*fcf3ce44SJohn Forte x[4] + x[5] + x[6] + x[7]) & \ 97*fcf3ce44SJohn Forte (FCP_NUM_HASH-1)) 98*fcf3ce44SJohn Forte 99*fcf3ce44SJohn Forte #define FCP_STATEC_MASK (FC_STATE_OFFLINE | FC_STATE_ONLINE |\ 100*fcf3ce44SJohn Forte FC_STATE_LOOP | FC_STATE_NAMESERVICE |\ 101*fcf3ce44SJohn Forte FC_STATE_RESET |\ 102*fcf3ce44SJohn Forte FC_STATE_RESET_REQUESTED |\ 103*fcf3ce44SJohn Forte FC_STATE_LIP | FC_STATE_DEVICE_CHANGE) 104*fcf3ce44SJohn Forte 105*fcf3ce44SJohn Forte #define PKT_PRIV_SIZE 2 106*fcf3ce44SJohn Forte 107*fcf3ce44SJohn Forte #ifdef KSTATS_CODE 108*fcf3ce44SJohn Forte /* 109*fcf3ce44SJohn Forte * fcp_stats : Statistics provided for fcp. 110*fcf3ce44SJohn Forte */ 111*fcf3ce44SJohn Forte struct fcp_stats { 112*fcf3ce44SJohn Forte uint_t version; /* version of this struct */ 113*fcf3ce44SJohn Forte uint_t lip_count; /* lips forced by fcp */ 114*fcf3ce44SJohn Forte uint_t link_reset_count; /* lip failures, ie, no ONLINE */ 115*fcf3ce44SJohn Forte /* response after forcing lip */ 116*fcf3ce44SJohn Forte uint_t ncmds; /* outstanding commands */ 117*fcf3ce44SJohn Forte uint_t throttle_limit; /* current throttle limit */ 118*fcf3ce44SJohn Forte char drvr_name[MAXNAMELEN]; /* Name of driver, NULL term. */ 119*fcf3ce44SJohn Forte }; 120*fcf3ce44SJohn Forte #endif 121*fcf3ce44SJohn Forte 122*fcf3ce44SJohn Forte /* 123*fcf3ce44SJohn Forte * Structure fcp_port 124*fcf3ce44SJohn Forte * -------------------- 125*fcf3ce44SJohn Forte * 126*fcf3ce44SJohn Forte * This structure is the FCP representation of an N_Port on a local FC HBA card. 127*fcf3ce44SJohn Forte * This is the master structure off of which all the others will be hanging at 128*fcf3ce44SJohn Forte * some point and is the Solaris per-instance soft-state structure. 129*fcf3ce44SJohn Forte */ 130*fcf3ce44SJohn Forte struct fcp_port { 131*fcf3ce44SJohn Forte /* 132*fcf3ce44SJohn Forte * This mutex protects the access to this structure (or most of its 133*fcf3ce44SJohn Forte * fields). 134*fcf3ce44SJohn Forte */ 135*fcf3ce44SJohn Forte kmutex_t port_mutex; 136*fcf3ce44SJohn Forte /* 137*fcf3ce44SJohn Forte * This is the link to the next fcp_port structure in the global 138*fcf3ce44SJohn Forte * list. The head of the global list is fcp_port_head and is 139*fcf3ce44SJohn Forte * defined in fcp.c. This field is NULL for the last element of 140*fcf3ce44SJohn Forte * the global list. 141*fcf3ce44SJohn Forte */ 142*fcf3ce44SJohn Forte struct fcp_port *port_next; 143*fcf3ce44SJohn Forte /* 144*fcf3ce44SJohn Forte * This field points to the head of a list of internal requests that 145*fcf3ce44SJohn Forte * will be retried later. Examples of internal requests are: 146*fcf3ce44SJohn Forte * 'Send a PRLI ELS', 'Send a PRLO ELS', 'Send a PLOGI ELS' or 147*fcf3ce44SJohn Forte * 'Send an Inquiry command'. If the submission of the request to the 148*fcf3ce44SJohn Forte * fp/fctl module failed (for a set of specific reasons) and the 149*fcf3ce44SJohn Forte * request can be resubmitted later, it is queued here. The watchdog 150*fcf3ce44SJohn Forte * timer (fcp_watch()) will walk this queue and resubmit the requests. 151*fcf3ce44SJohn Forte */ 152*fcf3ce44SJohn Forte struct fcp_ipkt *port_ipkt_list; 153*fcf3ce44SJohn Forte /* 154*fcf3ce44SJohn Forte * This seems to be used as a temporary device counter during a 155*fcf3ce44SJohn Forte * discovery process (or reconfiguration as some comments put it). 156*fcf3ce44SJohn Forte * It seems to be initialized in fcp_statec_callback() with the 157*fcf3ce44SJohn Forte * number of devices that fp/fctl saw after the line came up and 158*fcf3ce44SJohn Forte * is supposed to reached zero when the reconfiguration process is 159*fcf3ce44SJohn Forte * over. 160*fcf3ce44SJohn Forte */ 161*fcf3ce44SJohn Forte int port_tmp_cnt; 162*fcf3ce44SJohn Forte /* 163*fcf3ce44SJohn Forte * This is supposed to indicate the state of this port. It is a 164*fcf3ce44SJohn Forte * bitmap which means several bits can be set simultaneously. The list 165*fcf3ce44SJohn Forte * of the different bits and their meaning is given further down in 166*fcf3ce44SJohn Forte * this file. 167*fcf3ce44SJohn Forte */ 168*fcf3ce44SJohn Forte uint32_t port_state; 169*fcf3ce44SJohn Forte /* 170*fcf3ce44SJohn Forte * This field is initialized at the very end of the function 171*fcf3ce44SJohn Forte * fcp_handle_port_attach() if the attachment of the port was 172*fcf3ce44SJohn Forte * successful. It is set to the value stored in lbolt64 at the 173*fcf3ce44SJohn Forte * time of the attachment. This value is only used in the function 174*fcf3ce44SJohn Forte * fcp_scsi_bus_config(). It is used to determine the value of the 175*fcf3ce44SJohn Forte * parameter timeout when ndi_busop_bus_config() and cv_wait() are 176*fcf3ce44SJohn Forte * called. It actually serves to figure out how long the enumeration 177*fcf3ce44SJohn Forte * can be delayed (the max value being FCP_INIT_WAIT_TIMEOUT). 178*fcf3ce44SJohn Forte */ 179*fcf3ce44SJohn Forte int64_t port_attach_time; 180*fcf3ce44SJohn Forte /* 181*fcf3ce44SJohn Forte * This field contains the topology of the SAN the port is connected 182*fcf3ce44SJohn Forte * to. 183*fcf3ce44SJohn Forte */ 184*fcf3ce44SJohn Forte uint32_t port_topology; 185*fcf3ce44SJohn Forte /* 186*fcf3ce44SJohn Forte * This field contains the local port ID. It is provided by fp/fctl 187*fcf3ce44SJohn Forte * when calling fcp_statec_callback() and fcp_port_attach(). This 188*fcf3ce44SJohn Forte * value is used to build Fibre Channel headers (like for PLOGI or 189*fcf3ce44SJohn Forte * PRLI). 190*fcf3ce44SJohn Forte */ 191*fcf3ce44SJohn Forte uint32_t port_id; 192*fcf3ce44SJohn Forte /* 193*fcf3ce44SJohn Forte * This field keeps track of the physical port state (fcp_port being 194*fcf3ce44SJohn Forte * more like the FCP software port state). The information stored here 195*fcf3ce44SJohn Forte * is provided by fp/fctl except in two instances: in 196*fcf3ce44SJohn Forte * fcp_handle_port_attach() and fcp_handle_port_resume(). The values 197*fcf3ce44SJohn Forte * this field can take are defined in fctl.h. 198*fcf3ce44SJohn Forte */ 199*fcf3ce44SJohn Forte uint32_t port_phys_state; 200*fcf3ce44SJohn Forte /* 201*fcf3ce44SJohn Forte * This field points to the first element of a list of fcp_reset_elem 202*fcf3ce44SJohn Forte * structures. Those structures are created when the target driver 203*fcf3ce44SJohn Forte * calls fcp_reset_target(). The target or the LUN specified by the 204*fcf3ce44SJohn Forte * target driver is reset by sending a Task Management command. After 205*fcf3ce44SJohn Forte * the response has been received, a fcp_reset_elem structure is 206*fcf3ce44SJohn Forte * queued here and will remain queued for FCP_RESET_DELAY. While 207*fcf3ce44SJohn Forte * the fcp_reset_elem structure is in this queue the LUNs of 208*fcf3ce44SJohn Forte * the target to reset or the LUN to reset is set to LUN_BUSY state. 209*fcf3ce44SJohn Forte * In fcp_watch() the timeout is tested. If the timout has expired, 210*fcf3ce44SJohn Forte * the fcp_reset_elem structure is unqueued and freed, and all the 211*fcf3ce44SJohn Forte * active commands for the target or LUNs are aborted. 212*fcf3ce44SJohn Forte */ 213*fcf3ce44SJohn Forte struct fcp_reset_elem *port_reset_list; 214*fcf3ce44SJohn Forte /* 215*fcf3ce44SJohn Forte * This points to the first element of a list of fcp_tgt_elem 216*fcf3ce44SJohn Forte * structures. This list is a list of targets to offline. The list 217*fcf3ce44SJohn Forte * is walked in fcp_watch(). After the target is offlined the 218*fcf3ce44SJohn Forte * structure fcp_tgt_elem is freed. 219*fcf3ce44SJohn Forte */ 220*fcf3ce44SJohn Forte struct fcp_tgt_elem *port_offline_tgts; 221*fcf3ce44SJohn Forte /* 222*fcf3ce44SJohn Forte * This points to the first element of a list of fcp_lun_elem 223*fcf3ce44SJohn Forte * structures. This list is a list of LUNs to offline. The list 224*fcf3ce44SJohn Forte * is walked in fcp_watch(). After the lun is offlined the 225*fcf3ce44SJohn Forte * structure fcp_lun_elem is freed. 226*fcf3ce44SJohn Forte */ 227*fcf3ce44SJohn Forte struct fcp_lun_elem *port_offline_luns; 228*fcf3ce44SJohn Forte /* 229*fcf3ce44SJohn Forte * This field is a counter initialized to 1 when the port attaches. 230*fcf3ce44SJohn Forte * It is incremented when the line goes from online to offline and 231*fcf3ce44SJohn Forte * vice versa. It is also incremented when the port detaches. The 232*fcf3ce44SJohn Forte * value stored in this counter is used as a reference in time of the 233*fcf3ce44SJohn Forte * link state. For example, when the line comes up internal requests 234*fcf3ce44SJohn Forte * are generated (fcp_ipkt) such as PRLI and INQUIRY. Those requests 235*fcf3ce44SJohn Forte * are tagged with the value contained in this field at the time the 236*fcf3ce44SJohn Forte * request is built. When the callback for the request is called, the 237*fcf3ce44SJohn Forte * current value of port_link_cnt is checked against the one set in 238*fcf3ce44SJohn Forte * the internal request structure. If they don't match, it means the 239*fcf3ce44SJohn Forte * the request is not relevant anymore to the current line state and 240*fcf3ce44SJohn Forte * must be discarded (in between a request is issued and the callback 241*fcf3ce44SJohn Forte * routine is called the line may have bounced). This is the way FCP 242*fcf3ce44SJohn Forte * identifies the requests that were hanging out when the state of the 243*fcf3ce44SJohn Forte * line changed. 244*fcf3ce44SJohn Forte */ 245*fcf3ce44SJohn Forte uint32_t port_link_cnt; 246*fcf3ce44SJohn Forte /* 247*fcf3ce44SJohn Forte * This field, as its name suggests, specifies a deadline for the 248*fcf3ce44SJohn Forte * overall discovery process. It is initialized in three cases: 249*fcf3ce44SJohn Forte * 250*fcf3ce44SJohn Forte * 1) When the line goes from the offline state to the online state. 251*fcf3ce44SJohn Forte * 2) When the FP/FCTL called fcp_statec_callback() indicating that 252*fcf3ce44SJohn Forte * a notification was received from the fabric indicating that a new 253*fcf3ce44SJohn Forte * port showed up or that one disappeared. 254*fcf3ce44SJohn Forte * 3) In the fcp_create_on_demand() function (called because of an 255*fcf3ce44SJohn Forte * ioctl). 256*fcf3ce44SJohn Forte * 257*fcf3ce44SJohn Forte * In all instances it is set to: 258*fcf3ce44SJohn Forte * 259*fcf3ce44SJohn Forte * fcp_watchdog_time + FCP_ICMD_DEADLINE 260*fcf3ce44SJohn Forte * 261*fcf3ce44SJohn Forte * In all those instances a discovery process is started or extended 262*fcf3ce44SJohn Forte * (2). The value stored in port_deadline is only checked in one 263*fcf3ce44SJohn Forte * function: fcp_is_retryable(). That function checks if an 264*fcf3ce44SJohn Forte * internal command (fcp_ipkt) is retryable or not. Usually 265*fcf3ce44SJohn Forte * there's a counter that limits the number of times a command is 266*fcf3ce44SJohn Forte * retried (Max value is FCP_MAX_RETRIES). However, even if the 267*fcf3ce44SJohn Forte * counter hasn't exceeded that value, the command will not be retried 268*fcf3ce44SJohn Forte * past the deadline. This means that the discovery process has to 269*fcf3ce44SJohn Forte * be finished before port_deadline. In other words, an internal 270*fcf3ce44SJohn Forte * command retry capability is limited numerically and in time. 271*fcf3ce44SJohn Forte */ 272*fcf3ce44SJohn Forte int port_deadline; 273*fcf3ce44SJohn Forte /* 274*fcf3ce44SJohn Forte * This is the Node WWN of the local port. It is initialized 275*fcf3ce44SJohn Forte * during the port attachment. 276*fcf3ce44SJohn Forte */ 277*fcf3ce44SJohn Forte la_wwn_t port_nwwn; 278*fcf3ce44SJohn Forte /* 279*fcf3ce44SJohn Forte * This is the Port WWN of the local port. It is initialized during 280*fcf3ce44SJohn Forte * the port attachment. 281*fcf3ce44SJohn Forte */ 282*fcf3ce44SJohn Forte la_wwn_t port_pwwn; 283*fcf3ce44SJohn Forte /* 284*fcf3ce44SJohn Forte * This is the fp/fctl port handle. 285*fcf3ce44SJohn Forte */ 286*fcf3ce44SJohn Forte opaque_t *port_fp_handle; 287*fcf3ce44SJohn Forte /* 288*fcf3ce44SJohn Forte * The following 4 fields handle the queue of fcp_pkt outstanding for 289*fcf3ce44SJohn Forte * this port. 290*fcf3ce44SJohn Forte * 291*fcf3ce44SJohn Forte * port_pkt_mutex Protects the access to the queue 292*fcf3ce44SJohn Forte * port_pkt_head Points to the head of the queue 293*fcf3ce44SJohn Forte * port_pkt_tail Points to the tail of the queue 294*fcf3ce44SJohn Forte * port_npkts Number of commands outstanding (used only when 295*fcf3ce44SJohn Forte * DEBUG is defined). 296*fcf3ce44SJohn Forte */ 297*fcf3ce44SJohn Forte kmutex_t port_pkt_mutex; 298*fcf3ce44SJohn Forte uint32_t port_npkts; 299*fcf3ce44SJohn Forte struct fcp_pkt *port_pkt_head; 300*fcf3ce44SJohn Forte struct fcp_pkt *port_pkt_tail; 301*fcf3ce44SJohn Forte /* 302*fcf3ce44SJohn Forte * This field is the counter of allocated and currently active 303*fcf3ce44SJohn Forte * fcp_ipkt. 304*fcf3ce44SJohn Forte */ 305*fcf3ce44SJohn Forte int port_ipkt_cnt; 306*fcf3ce44SJohn Forte /* 307*fcf3ce44SJohn Forte * Port instance provided by FP/FCTL. It is actually deduced using 308*fcf3ce44SJohn Forte * ddi_get_instance() in fcp_port_attach(). 309*fcf3ce44SJohn Forte */ 310*fcf3ce44SJohn Forte uint32_t port_instance; 311*fcf3ce44SJohn Forte /* 312*fcf3ce44SJohn Forte * Maximum number of exchanges the underlying physical FibreChannel 313*fcf3ce44SJohn Forte * port can handle. This field is initialized during the port 314*fcf3ce44SJohn Forte * attachment but is never used. 315*fcf3ce44SJohn Forte */ 316*fcf3ce44SJohn Forte uint32_t port_max_exch; 317*fcf3ce44SJohn Forte /* 318*fcf3ce44SJohn Forte * This port stores the behavior expected of the underlying FCA driver 319*fcf3ce44SJohn Forte * when a port reset occurs. The values stored here are defined in the 320*fcf3ce44SJohn Forte * file fc_types.h. 321*fcf3ce44SJohn Forte */ 322*fcf3ce44SJohn Forte fc_reset_action_t port_reset_action; 323*fcf3ce44SJohn Forte /* 324*fcf3ce44SJohn Forte * This port stores the DMA behavior of the underlying FCA driver. It 325*fcf3ce44SJohn Forte * is checked only once in fcp_prepare_pkt() and, as the comment 326*fcf3ce44SJohn Forte * suggests, to work around an issue with an Intel PCI bridge. 327*fcf3ce44SJohn Forte */ 328*fcf3ce44SJohn Forte fc_dma_behavior_t port_cmds_dma_flags; 329*fcf3ce44SJohn Forte /* 330*fcf3ce44SJohn Forte * The value stored here indicates if the underlying FCA driver 331*fcf3ce44SJohn Forte * supports DMA transfers with non SCSI data (Ex: PRLI request). 332*fcf3ce44SJohn Forte */ 333*fcf3ce44SJohn Forte fc_fcp_dma_t port_fcp_dma; 334*fcf3ce44SJohn Forte /* 335*fcf3ce44SJohn Forte * This field contains the size of the private space required by the 336*fcf3ce44SJohn Forte * underlying FCA driver in a FibreChannel packet (fc_packet_t). 337*fcf3ce44SJohn Forte */ 338*fcf3ce44SJohn Forte uint32_t port_priv_pkt_len; 339*fcf3ce44SJohn Forte /* 340*fcf3ce44SJohn Forte * This field contains the port's modlink info. It is provided by 341*fcf3ce44SJohn Forte * FP/FCTL during the port attachment. 342*fcf3ce44SJohn Forte */ 343*fcf3ce44SJohn Forte struct modlinkage port_fp_modlinkage; 344*fcf3ce44SJohn Forte /* 345*fcf3ce44SJohn Forte * DMA attributes for data packets, commands and responses. 346*fcf3ce44SJohn Forte */ 347*fcf3ce44SJohn Forte ddi_dma_attr_t port_data_dma_attr; 348*fcf3ce44SJohn Forte ddi_dma_attr_t port_cmd_dma_attr; 349*fcf3ce44SJohn Forte ddi_dma_attr_t port_resp_dma_attr; 350*fcf3ce44SJohn Forte ddi_device_acc_attr_t port_dma_acc_attr; 351*fcf3ce44SJohn Forte /* 352*fcf3ce44SJohn Forte * Field containing the hba_tran structure registered with SCSA. 353*fcf3ce44SJohn Forte */ 354*fcf3ce44SJohn Forte struct scsi_hba_tran *port_tran; 355*fcf3ce44SJohn Forte /* 356*fcf3ce44SJohn Forte * Device info structure provided by fp/fctl when the port attaches and 357*fcf3ce44SJohn Forte * representing the local physical fibre channel port. 358*fcf3ce44SJohn Forte */ 359*fcf3ce44SJohn Forte dev_info_t *port_dip; 360*fcf3ce44SJohn Forte /* 361*fcf3ce44SJohn Forte * Head of the list of callback routines to call when a bus reset 362*fcf3ce44SJohn Forte * occurs. This list is populated by the targets drivers by calling 363*fcf3ce44SJohn Forte * fcp_scsi_reset_notify() (tran_reset_notify(9E)). 364*fcf3ce44SJohn Forte */ 365*fcf3ce44SJohn Forte struct scsi_reset_notify_entry *port_reset_notify_listf; 366*fcf3ce44SJohn Forte /* 367*fcf3ce44SJohn Forte * for framework event management 368*fcf3ce44SJohn Forte */ 369*fcf3ce44SJohn Forte ndi_event_definition_t *port_ndi_event_defs; 370*fcf3ce44SJohn Forte ndi_event_hdl_t port_ndi_event_hdl; 371*fcf3ce44SJohn Forte ndi_event_set_t port_ndi_events; 372*fcf3ce44SJohn Forte /* 373*fcf3ce44SJohn Forte * hash lists of targets attached to this port. The hashing is based 374*fcf3ce44SJohn Forte * on the WWN. 375*fcf3ce44SJohn Forte */ 376*fcf3ce44SJohn Forte struct fcp_tgt *port_tgt_hash_table[FCP_NUM_HASH]; 377*fcf3ce44SJohn Forte /* 378*fcf3ce44SJohn Forte * per-Port control flag. By default mpxio is enabled on ports unless 379*fcf3ce44SJohn Forte * explicitly disabled through driver.conf. 380*fcf3ce44SJohn Forte */ 381*fcf3ce44SJohn Forte int port_mpxio; 382*fcf3ce44SJohn Forte /* 383*fcf3ce44SJohn Forte * Value used as a flag to determine if the throttling has been 384*fcf3ce44SJohn Forte * set/initialized in the FCA driver. 385*fcf3ce44SJohn Forte */ 386*fcf3ce44SJohn Forte int port_notify; 387*fcf3ce44SJohn Forte /* 388*fcf3ce44SJohn Forte * This field contains a string initialized at attachment time and used 389*fcf3ce44SJohn Forte * when calling the function the function fc_trace_debug() (through 390*fcf3ce44SJohn Forte * the macro FCP_TRACE and FCP_DTRACE) to identify the port that 391*fcf3ce44SJohn Forte * logged the message. 392*fcf3ce44SJohn Forte */ 393*fcf3ce44SJohn Forte char port_instbuf[24]; 394*fcf3ce44SJohn Forte uchar_t port_boot_wwn[FC_WWN_SIZE]; 395*fcf3ce44SJohn Forte 396*fcf3ce44SJohn Forte #ifdef DEBUG 397*fcf3ce44SJohn Forte /* 398*fcf3ce44SJohn Forte * Use once in fcp_finish_init() when calling getpcstack(). 399*fcf3ce44SJohn Forte */ 400*fcf3ce44SJohn Forte int port_finish_depth; 401*fcf3ce44SJohn Forte pc_t port_finish_stack[FCP_STACK_DEPTH]; 402*fcf3ce44SJohn Forte #endif /* DEBUG */ 403*fcf3ce44SJohn Forte /* 404*fcf3ce44SJohn Forte * Condition variable used during the bus enumeration process. 405*fcf3ce44SJohn Forte */ 406*fcf3ce44SJohn Forte kcondvar_t port_config_cv; 407*fcf3ce44SJohn Forte /* 408*fcf3ce44SJohn Forte * Size (in bytes) required to hold the cookies of a scatter/gather 409*fcf3ce44SJohn Forte * list. 410*fcf3ce44SJohn Forte */ 411*fcf3ce44SJohn Forte int port_dmacookie_sz; 412*fcf3ce44SJohn Forte }; 413*fcf3ce44SJohn Forte 414*fcf3ce44SJohn Forte /* 415*fcf3ce44SJohn Forte * We need to save the target change count values in a map tag so as 416*fcf3ce44SJohn Forte * to uniquely identify the cause and handle it better as they change 417*fcf3ce44SJohn Forte * counts are bound to change upon receiving more state changes. 418*fcf3ce44SJohn Forte */ 419*fcf3ce44SJohn Forte typedef int fcp_map_tag_t; 420*fcf3ce44SJohn Forte 421*fcf3ce44SJohn Forte /* 422*fcf3ce44SJohn Forte * fcp_state definitions. 423*fcf3ce44SJohn Forte */ 424*fcf3ce44SJohn Forte #define FCP_STATE_INIT 0x0001 425*fcf3ce44SJohn Forte #define FCP_STATE_OFFLINE 0x0002 426*fcf3ce44SJohn Forte #define FCP_STATE_ONLINE 0x0004 427*fcf3ce44SJohn Forte #define FCP_STATE_SUSPENDED 0x0008 428*fcf3ce44SJohn Forte #define FCP_STATE_POWER_DOWN 0x0010 429*fcf3ce44SJohn Forte #define FCP_STATE_ONLINING 0x0020 430*fcf3ce44SJohn Forte #define FCP_STATE_DETACHING 0x0040 431*fcf3ce44SJohn Forte #define FCP_STATE_IN_WATCHDOG 0x0080 432*fcf3ce44SJohn Forte #define FCP_STATE_IN_MDI 0x0100 /* Not in S8/S9 */ 433*fcf3ce44SJohn Forte #define FCP_STATE_NS_REG_FAILED 0x0200 /* Diff value from S8/S9 */ 434*fcf3ce44SJohn Forte /* 435*fcf3ce44SJohn Forte * FCP_STATE_IN_CB_DEVC indicates that we're handling a state change 436*fcf3ce44SJohn Forte * notification that will be changing the state of devices. This is an 437*fcf3ce44SJohn Forte * indication to fcp_scsi_start that the target's status might change. 438*fcf3ce44SJohn Forte */ 439*fcf3ce44SJohn Forte #define FCP_STATE_IN_CB_DEVC 0x0400 440*fcf3ce44SJohn Forte 441*fcf3ce44SJohn Forte #define FCP_MAX_DEVICES 127 442*fcf3ce44SJohn Forte 443*fcf3ce44SJohn Forte /* To remember that dip was allocated for a lun on this target. */ 444*fcf3ce44SJohn Forte 445*fcf3ce44SJohn Forte #define FCP_DEVICE_CREATED 0x1 446*fcf3ce44SJohn Forte 447*fcf3ce44SJohn Forte #define FCP_EVENT_TAG_INSERT 0 448*fcf3ce44SJohn Forte #define FCP_EVENT_TAG_REMOVE 1 449*fcf3ce44SJohn Forte 450*fcf3ce44SJohn Forte /* 451*fcf3ce44SJohn Forte * fcp_pkt: FCP packet 452*fcf3ce44SJohn Forte * --------------------- 453*fcf3ce44SJohn Forte * 454*fcf3ce44SJohn Forte * This structure is the one initialized/created in the tran_init_pkt(9E). It 455*fcf3ce44SJohn Forte * embeds the fc_packet structure eventually passed to fp/fctl as well as 456*fcf3ce44SJohn Forte * the scsi_pkt returned by tran_init_pkt(9E) to the target driver. There is 457*fcf3ce44SJohn Forte * a 1-to-1 correlation between the scsi_pkt, the fcp_pkt and the 458*fcf3ce44SJohn Forte * fc_packet. 459*fcf3ce44SJohn Forte * 460*fcf3ce44SJohn Forte * This is what a fcp_pkt looks like after allocation: 461*fcf3ce44SJohn Forte * 462*fcf3ce44SJohn Forte * +================================+ 463*fcf3ce44SJohn Forte * +---> | struct scsi_pkt | 464*fcf3ce44SJohn Forte * | | | 465*fcf3ce44SJohn Forte * | +--- | pkt_ha_private | 466*fcf3ce44SJohn Forte * | | | | 467*fcf3ce44SJohn Forte * | | +================================+ 468*fcf3ce44SJohn Forte * | | 469*fcf3ce44SJohn Forte * | | +================================+ 470*fcf3ce44SJohn Forte * | +--> | struct fcp_pkt | <---------+ 471*fcf3ce44SJohn Forte * +----- | cmd_pkt | | 472*fcf3ce44SJohn Forte * | cmd_fp_pkt | ---+ | 473*fcf3ce44SJohn Forte * +--------->| cmd_fcp_rsp[] | | | 474*fcf3ce44SJohn Forte * | +------->| cmd_fcp_cmd[] | | | 475*fcf3ce44SJohn Forte * | | |--------------------------------| | | 476*fcf3ce44SJohn Forte * | | | struct fc_packet | <--+ | 477*fcf3ce44SJohn Forte * | | | | | 478*fcf3ce44SJohn Forte * | | | pkt_ulp_private | ----------+ 479*fcf3ce44SJohn Forte * | | | pkt_fca_private | -----+ 480*fcf3ce44SJohn Forte * | | | pkt_data_cookie | ---+ | 481*fcf3ce44SJohn Forte * | | | pkt_cmdlen | | | 482*fcf3ce44SJohn Forte * | |(a) | pkt_rsplen | | | 483*fcf3ce44SJohn Forte * | +--------| .......... pkt_cmd ........... | ---|-|-------+ 484*fcf3ce44SJohn Forte * | (a) | pkt_cmd_cookie | ---|-|-----+ | 485*fcf3ce44SJohn Forte * +----------| .......... pkt_resp .......... | ---|-|---+ | | 486*fcf3ce44SJohn Forte * | pkt_resp_cookie | ---|-|-+ | | | 487*fcf3ce44SJohn Forte * | pkt_cmd_dma | | | | | | | 488*fcf3ce44SJohn Forte * | pkt_cmd_acc | | | | | | | 489*fcf3ce44SJohn Forte * +================================+ | | | | | | 490*fcf3ce44SJohn Forte * | dma_cookies | <--+ | | | | | 491*fcf3ce44SJohn Forte * | | | | | | | 492*fcf3ce44SJohn Forte * +================================+ | | | | | 493*fcf3ce44SJohn Forte * | fca_private | <----+ | | | | 494*fcf3ce44SJohn Forte * | | | | | | 495*fcf3ce44SJohn Forte * +================================+ | | | | 496*fcf3ce44SJohn Forte * | | | | 497*fcf3ce44SJohn Forte * | | | | 498*fcf3ce44SJohn Forte * +================================+ (b) | | | | 499*fcf3ce44SJohn Forte * | fcp_resp cookies | <------+ | | | 500*fcf3ce44SJohn Forte * | | | | | 501*fcf3ce44SJohn Forte * +================================+ | | | 502*fcf3ce44SJohn Forte * | | | 503*fcf3ce44SJohn Forte * +================================+ (b) | | | 504*fcf3ce44SJohn Forte * | fcp_resp | <--------+ | | 505*fcf3ce44SJohn Forte * | (DMA resources associated) | | | 506*fcf3ce44SJohn Forte * +================================+ | | 507*fcf3ce44SJohn Forte * | | 508*fcf3ce44SJohn Forte * | | 509*fcf3ce44SJohn Forte * | | 510*fcf3ce44SJohn Forte * +================================+ (b) | | 511*fcf3ce44SJohn Forte * | fcp_cmd cookies | <----------+ | 512*fcf3ce44SJohn Forte * | | | 513*fcf3ce44SJohn Forte * +================================+ | 514*fcf3ce44SJohn Forte * | 515*fcf3ce44SJohn Forte * +================================+ (b) | 516*fcf3ce44SJohn Forte * | fcp_cmd | <------------+ 517*fcf3ce44SJohn Forte * | (DMA resources associated) | 518*fcf3ce44SJohn Forte * +================================+ 519*fcf3ce44SJohn Forte * 520*fcf3ce44SJohn Forte * 521*fcf3ce44SJohn Forte * (a) The underlying FCA does NOT support DMA for this field 522*fcf3ce44SJohn Forte * (b) The underlying FCA supports DMA for this field 523*fcf3ce44SJohn Forte */ 524*fcf3ce44SJohn Forte struct fcp_pkt { 525*fcf3ce44SJohn Forte /* 526*fcf3ce44SJohn Forte * The two following fields are used to queue fcp_pkt in the double 527*fcf3ce44SJohn Forte * link list of the lun structure. The packet is queued in 528*fcf3ce44SJohn Forte * tran_init_pkt(9E) and unqueued in tran_destroy_pkt(9E). 529*fcf3ce44SJohn Forte */ 530*fcf3ce44SJohn Forte struct fcp_pkt *cmd_forw; 531*fcf3ce44SJohn Forte struct fcp_pkt *cmd_back; 532*fcf3ce44SJohn Forte /* 533*fcf3ce44SJohn Forte * This field is used to queue the packet in the single link list of the 534*fcf3ce44SJohn Forte * port structure. The port keeps a list of all the commands issued 535*fcf3ce44SJohn Forte * through it and scans it, for example, when all of those commands 536*fcf3ce44SJohn Forte * have to be aborted. 537*fcf3ce44SJohn Forte */ 538*fcf3ce44SJohn Forte struct fcp_pkt *cmd_next; 539*fcf3ce44SJohn Forte /* 540*fcf3ce44SJohn Forte * This field points back to the scsi_pkt. 541*fcf3ce44SJohn Forte */ 542*fcf3ce44SJohn Forte struct scsi_pkt *cmd_pkt; 543*fcf3ce44SJohn Forte /* 544*fcf3ce44SJohn Forte * This field points to the field cmd_fc_packet defined further in this 545*fcf3ce44SJohn Forte * same structure. 546*fcf3ce44SJohn Forte */ 547*fcf3ce44SJohn Forte struct fc_packet *cmd_fp_pkt; 548*fcf3ce44SJohn Forte /* 549*fcf3ce44SJohn Forte * Structure where the FCP_CMD information unit is going to be built. 550*fcf3ce44SJohn Forte */ 551*fcf3ce44SJohn Forte fcp_cmd_t cmd_fcp_cmd; 552*fcf3ce44SJohn Forte /* 553*fcf3ce44SJohn Forte * State of the packet. The values for the state seem to indicate 554*fcf3ce44SJohn Forte * that it isn't a bitmap. However, in several instances the code 555*fcf3ce44SJohn Forte * treats it as a bitmap doing a "&= ~FCP_PKT_ISSUED" to it 556*fcf3ce44SJohn Forte * eventhough the value stored is always checked using "!=" and "==". 557*fcf3ce44SJohn Forte */ 558*fcf3ce44SJohn Forte uint_t cmd_state; 559*fcf3ce44SJohn Forte /* 560*fcf3ce44SJohn Forte * This field is a bitmap indicating if 561*fcf3ce44SJohn Forte * the cmd is queued 562*fcf3ce44SJohn Forte */ 563*fcf3ce44SJohn Forte uint_t cmd_flags; 564*fcf3ce44SJohn Forte /* Contains the number of bytes DMA mappped. */ 565*fcf3ce44SJohn Forte uint_t cmd_dmacount; 566*fcf3ce44SJohn Forte /* 567*fcf3ce44SJohn Forte * Contains the timeout value for the packet. This is not a delay or 568*fcf3ce44SJohn Forte * a delta but an absolute value. 569*fcf3ce44SJohn Forte */ 570*fcf3ce44SJohn Forte uint_t cmd_timeout; 571*fcf3ce44SJohn Forte /* 572*fcf3ce44SJohn Forte * This array is used to store the FCP_RSP information unit returned by 573*fcf3ce44SJohn Forte * the device when the underlying FCA cannot DMA it in. 574*fcf3ce44SJohn Forte */ 575*fcf3ce44SJohn Forte char cmd_fcp_rsp[FCP_MAX_RSP_IU_SIZE]; 576*fcf3ce44SJohn Forte /* 577*fcf3ce44SJohn Forte * This is the fc_packet structure used to forward the request to 578*fcf3ce44SJohn Forte * fp/fctl. 579*fcf3ce44SJohn Forte */ 580*fcf3ce44SJohn Forte struct fc_packet cmd_fc_packet; 581*fcf3ce44SJohn Forte }; 582*fcf3ce44SJohn Forte 583*fcf3ce44SJohn Forte /* 584*fcf3ce44SJohn Forte * fcp_ipkt : Packet for internal commands. 585*fcf3ce44SJohn Forte * ------------------------------------------ 586*fcf3ce44SJohn Forte * 587*fcf3ce44SJohn Forte * +================================+ 588*fcf3ce44SJohn Forte * | struct fcp_ipkt | <---------+ 589*fcf3ce44SJohn Forte * | (kmem_zalloc()) | | 590*fcf3ce44SJohn Forte * | ipkt_fpkt | ---+ | 591*fcf3ce44SJohn Forte * | | | | 592*fcf3ce44SJohn Forte * | ipkt_cmdlen = cmd_len | | | 593*fcf3ce44SJohn Forte * | | | | 594*fcf3ce44SJohn Forte * | | | | 595*fcf3ce44SJohn Forte * | | | | 596*fcf3ce44SJohn Forte * |--------------------------------| | | 597*fcf3ce44SJohn Forte * | struct fc_packet | <--+ | 598*fcf3ce44SJohn Forte * | | | 599*fcf3ce44SJohn Forte * | pkt_ulp_private | ----------+ 600*fcf3ce44SJohn Forte * | pkt_fca_private | -----+ 601*fcf3ce44SJohn Forte * | pkt_data_cookie | ---+ | 602*fcf3ce44SJohn Forte * | pkt_cmdlen | | | 603*fcf3ce44SJohn Forte * | pkt_rsplen | | | 604*fcf3ce44SJohn Forte * | pkt_cmd ...................... | ---|-|-------+ 605*fcf3ce44SJohn Forte * | pkt_cmd_cookie | ---|-|-----+ | 606*fcf3ce44SJohn Forte * | pkt_resp ..................... | ---|-|---+ | | 607*fcf3ce44SJohn Forte * | pkt_resp_cookie | ---|-|-+ | | | 608*fcf3ce44SJohn Forte * | pkt_cmd_dma | | | | | | | 609*fcf3ce44SJohn Forte * | pkt_cmd_acc | | | | | | | 610*fcf3ce44SJohn Forte * +================================+ | | | | | | 611*fcf3ce44SJohn Forte * | dma_cookies | <--+ | | | | | 612*fcf3ce44SJohn Forte * | | | | | | | 613*fcf3ce44SJohn Forte * | | | | | | | 614*fcf3ce44SJohn Forte * | | | | | | | 615*fcf3ce44SJohn Forte * +================================+ | | | | | 616*fcf3ce44SJohn Forte * | fca_private | <----+ | | | | 617*fcf3ce44SJohn Forte * | | | | | | 618*fcf3ce44SJohn Forte * | | | | | | 619*fcf3ce44SJohn Forte * | | | | | | 620*fcf3ce44SJohn Forte * +================================+ | | | | 621*fcf3ce44SJohn Forte * | | | | 622*fcf3ce44SJohn Forte * | | | | 623*fcf3ce44SJohn Forte * +================================+ (b) | | | | 624*fcf3ce44SJohn Forte * | fcp_resp cookies | <------+ | | | 625*fcf3ce44SJohn Forte * | | | | | 626*fcf3ce44SJohn Forte * +================================+ | | | 627*fcf3ce44SJohn Forte * | | | 628*fcf3ce44SJohn Forte * +================================+ (b) | | | 629*fcf3ce44SJohn Forte * | fcp_resp | <--------+ | | 630*fcf3ce44SJohn Forte * | (DMA resources associated) | | | 631*fcf3ce44SJohn Forte * +================================+ | | 632*fcf3ce44SJohn Forte * | | 633*fcf3ce44SJohn Forte * | | 634*fcf3ce44SJohn Forte * | | 635*fcf3ce44SJohn Forte * +================================+ (b) | | 636*fcf3ce44SJohn Forte * | fcp_cmd cookies | <----------+ | 637*fcf3ce44SJohn Forte * | | | 638*fcf3ce44SJohn Forte * +================================+ | 639*fcf3ce44SJohn Forte * | 640*fcf3ce44SJohn Forte * +================================+ (b) | 641*fcf3ce44SJohn Forte * | fcp_cmd | <------------+ 642*fcf3ce44SJohn Forte * | (DMA resources associated) | 643*fcf3ce44SJohn Forte * +================================+ 644*fcf3ce44SJohn Forte * 645*fcf3ce44SJohn Forte * (a) The underlying FCA does NOT support DMA for this field 646*fcf3ce44SJohn Forte * (b) The underlying FCA supports DMA for this field 647*fcf3ce44SJohn Forte */ 648*fcf3ce44SJohn Forte struct fcp_ipkt { 649*fcf3ce44SJohn Forte /* 650*fcf3ce44SJohn Forte * Pointer to the port (fcp_port) in behalf of which this internal 651*fcf3ce44SJohn Forte * packet was allocated. 652*fcf3ce44SJohn Forte */ 653*fcf3ce44SJohn Forte struct fcp_port *ipkt_port; 654*fcf3ce44SJohn Forte /* 655*fcf3ce44SJohn Forte * Pointer to the target (fcp_tgt) in behalf of which this internal 656*fcf3ce44SJohn Forte * packet was allocated. 657*fcf3ce44SJohn Forte */ 658*fcf3ce44SJohn Forte struct fcp_tgt *ipkt_tgt; 659*fcf3ce44SJohn Forte /* 660*fcf3ce44SJohn Forte * Pointer to the lun (fcp_lun) in behalf of which this internal 661*fcf3ce44SJohn Forte * packet was allocated. This field is only meaningful when the 662*fcf3ce44SJohn Forte * internal packet has been allocated for a "scsi passthru" command or 663*fcf3ce44SJohn Forte * for an internal SCSI command such as REPORT LUNs and INQUIRY. 664*fcf3ce44SJohn Forte */ 665*fcf3ce44SJohn Forte struct fcp_lun *ipkt_lun; 666*fcf3ce44SJohn Forte /* 667*fcf3ce44SJohn Forte * Fields used to queue the internal packet into the double linked list 668*fcf3ce44SJohn Forte * of the FCP port (fcp_port). 669*fcf3ce44SJohn Forte */ 670*fcf3ce44SJohn Forte struct fcp_ipkt *ipkt_next; 671*fcf3ce44SJohn Forte struct fcp_ipkt *ipkt_prev; 672*fcf3ce44SJohn Forte /* 673*fcf3ce44SJohn Forte * This field points to the field ipkt_fc_packet defined farther in 674*fcf3ce44SJohn Forte * this same structure. 675*fcf3ce44SJohn Forte */ 676*fcf3ce44SJohn Forte struct fc_packet *ipkt_fpkt; 677*fcf3ce44SJohn Forte /* 678*fcf3ce44SJohn Forte * This is the timeout value for the internal packet. It seems to 679*fcf3ce44SJohn Forte * increase with the number of retries. It is initialized like this 680*fcf3ce44SJohn Forte * in the code: 681*fcf3ce44SJohn Forte * 682*fcf3ce44SJohn Forte * icmd->ipkt_restart = fcp_watchdog_time + icmd->ipkt_retries++ 683*fcf3ce44SJohn Forte * 684*fcf3ce44SJohn Forte * First time ipkt_retries is zero. As it increases, the timeout 685*fcf3ce44SJohn Forte * value for the internal packet also increases. 686*fcf3ce44SJohn Forte */ 687*fcf3ce44SJohn Forte uint32_t ipkt_restart; 688*fcf3ce44SJohn Forte /* 689*fcf3ce44SJohn Forte * Link state counter when the internal packet was built. 690*fcf3ce44SJohn Forte */ 691*fcf3ce44SJohn Forte uint32_t ipkt_link_cnt; 692*fcf3ce44SJohn Forte int ipkt_cause; 693*fcf3ce44SJohn Forte uint32_t ipkt_cmdlen; 694*fcf3ce44SJohn Forte uint32_t ipkt_resplen; 695*fcf3ce44SJohn Forte uint32_t ipkt_datalen; 696*fcf3ce44SJohn Forte /* 697*fcf3ce44SJohn Forte * Counter of the times an internal packet has been retried. Its 698*fcf3ce44SJohn Forte * value is checked against FCP_MAX_RETRIES. 699*fcf3ce44SJohn Forte */ 700*fcf3ce44SJohn Forte uint32_t ipkt_retries; 701*fcf3ce44SJohn Forte uint32_t ipkt_change_cnt; 702*fcf3ce44SJohn Forte int ipkt_nodma; 703*fcf3ce44SJohn Forte /* 704*fcf3ce44SJohn Forte * Semaphore used to wait for completion on. 705*fcf3ce44SJohn Forte */ 706*fcf3ce44SJohn Forte ksema_t ipkt_sema; 707*fcf3ce44SJohn Forte /* 708*fcf3ce44SJohn Forte * Opcode indicating what internal command the packet contains (PLOGI, 709*fcf3ce44SJohn Forte * PRLI, INQUIRY...). 710*fcf3ce44SJohn Forte */ 711*fcf3ce44SJohn Forte uchar_t ipkt_opcode; 712*fcf3ce44SJohn Forte /* 713*fcf3ce44SJohn Forte * FC packet. 714*fcf3ce44SJohn Forte */ 715*fcf3ce44SJohn Forte struct fc_packet ipkt_fc_packet; 716*fcf3ce44SJohn Forte }; 717*fcf3ce44SJohn Forte 718*fcf3ce44SJohn Forte /* 719*fcf3ce44SJohn Forte * cmd_state definitions 720*fcf3ce44SJohn Forte */ 721*fcf3ce44SJohn Forte #define FCP_PKT_IDLE 0x1 722*fcf3ce44SJohn Forte #define FCP_PKT_ISSUED 0x2 723*fcf3ce44SJohn Forte #define FCP_PKT_ABORTING 0x3 724*fcf3ce44SJohn Forte 725*fcf3ce44SJohn Forte /* 726*fcf3ce44SJohn Forte * These are the defined cmd_flags for this structure. 727*fcf3ce44SJohn Forte */ 728*fcf3ce44SJohn Forte #define CFLAG_IN_QUEUE 0x2000 /* command in fcp queue */ 729*fcf3ce44SJohn Forte 730*fcf3ce44SJohn Forte /* 731*fcf3ce44SJohn Forte * Target structure 732*fcf3ce44SJohn Forte * ---------------- 733*fcf3ce44SJohn Forte * 734*fcf3ce44SJohn Forte * This structure holds the information relative to a SCSI target. This 735*fcf3ce44SJohn Forte * structure doesn't represent the object registered with the OS (NDI or 736*fcf3ce44SJohn Forte * MPxIO...). 737*fcf3ce44SJohn Forte */ 738*fcf3ce44SJohn Forte struct fcp_tgt { 739*fcf3ce44SJohn Forte /* 740*fcf3ce44SJohn Forte * This field is used to queue the target structure in one of the 741*fcf3ce44SJohn Forte * buckets of the fcp_port target hash table port_tgt_hash_table[]. 742*fcf3ce44SJohn Forte */ 743*fcf3ce44SJohn Forte struct fcp_tgt *tgt_next; 744*fcf3ce44SJohn Forte /* Points to the fcp_port the target belongs to. */ 745*fcf3ce44SJohn Forte struct fcp_port *tgt_port; 746*fcf3ce44SJohn Forte /* 747*fcf3ce44SJohn Forte * This field is a bitmap indicating the state of the target. Several 748*fcf3ce44SJohn Forte * bits can be set simultaneously. 749*fcf3ce44SJohn Forte */ 750*fcf3ce44SJohn Forte uint32_t tgt_state; 751*fcf3ce44SJohn Forte /* 752*fcf3ce44SJohn Forte * State controlling if the LUNs attached to this target will be 753*fcf3ce44SJohn Forte * automatically onlined or not. 754*fcf3ce44SJohn Forte */ 755*fcf3ce44SJohn Forte uint32_t tgt_node_state; 756*fcf3ce44SJohn Forte /* 757*fcf3ce44SJohn Forte * Mutex protecting this structure. 758*fcf3ce44SJohn Forte */ 759*fcf3ce44SJohn Forte kmutex_t tgt_mutex; 760*fcf3ce44SJohn Forte /* 761*fcf3ce44SJohn Forte * List of LUNs (single link list). 762*fcf3ce44SJohn Forte */ 763*fcf3ce44SJohn Forte struct fcp_lun *tgt_lun; 764*fcf3ce44SJohn Forte opaque_t tgt_fca_dev; 765*fcf3ce44SJohn Forte /* 766*fcf3ce44SJohn Forte * Number of LUNs in this target. 767*fcf3ce44SJohn Forte */ 768*fcf3ce44SJohn Forte uint_t tgt_lun_cnt; 769*fcf3ce44SJohn Forte /* 770*fcf3ce44SJohn Forte * Counter of LUNs to probe. It is used during the discovery 771*fcf3ce44SJohn Forte * process. Starts with the number of LUNs returned by REPORT_LUN 772*fcf3ce44SJohn Forte * and is decremented until it reaches zero. 773*fcf3ce44SJohn Forte */ 774*fcf3ce44SJohn Forte uint_t tgt_tmp_cnt; 775*fcf3ce44SJohn Forte /* 776*fcf3ce44SJohn Forte * fp/fctl handle for the "port_device". 777*fcf3ce44SJohn Forte */ 778*fcf3ce44SJohn Forte opaque_t tgt_pd_handle; 779*fcf3ce44SJohn Forte /* 780*fcf3ce44SJohn Forte * Node World Wide Name. 781*fcf3ce44SJohn Forte */ 782*fcf3ce44SJohn Forte la_wwn_t tgt_node_wwn; 783*fcf3ce44SJohn Forte /* 784*fcf3ce44SJohn Forte * Port World Wide Name. 785*fcf3ce44SJohn Forte */ 786*fcf3ce44SJohn Forte la_wwn_t tgt_port_wwn; 787*fcf3ce44SJohn Forte /* 788*fcf3ce44SJohn Forte * Fibre Channel Port ID. 789*fcf3ce44SJohn Forte */ 790*fcf3ce44SJohn Forte uint32_t tgt_d_id; 791*fcf3ce44SJohn Forte /* 792*fcf3ce44SJohn Forte * Fibre Channel Port ID. Uses bit fields to represent it. 793*fcf3ce44SJohn Forte */ 794*fcf3ce44SJohn Forte uint32_t tgt_hard_addr; 795*fcf3ce44SJohn Forte /* 796*fcf3ce44SJohn Forte * Becomes 1 when the LUNs are created. 797*fcf3ce44SJohn Forte */ 798*fcf3ce44SJohn Forte uchar_t tgt_device_created; 799*fcf3ce44SJohn Forte /* 800*fcf3ce44SJohn Forte * Counter of how many REPORT_LUN commands were sent. It is used to 801*fcf3ce44SJohn Forte * allow the REPORT_LUN command to be sent twice in case the buffer 802*fcf3ce44SJohn Forte * allocated the first time wasn't big enough. 803*fcf3ce44SJohn Forte */ 804*fcf3ce44SJohn Forte uchar_t tgt_report_lun_cnt; 805*fcf3ce44SJohn Forte /* 806*fcf3ce44SJohn Forte * This field is incremented each time the field tgt_state is updated. 807*fcf3ce44SJohn Forte * Its use is similar to the use of the field port_link_cnt in the 808*fcf3ce44SJohn Forte * fcp_port structure. The internal packets are, for example, tagged 809*fcf3ce44SJohn Forte * with the value stored here. 810*fcf3ce44SJohn Forte */ 811*fcf3ce44SJohn Forte uint32_t tgt_change_cnt; 812*fcf3ce44SJohn Forte /* 813*fcf3ce44SJohn Forte * This field contains the cause of the last change in state. 814*fcf3ce44SJohn Forte */ 815*fcf3ce44SJohn Forte int tgt_statec_cause; 816*fcf3ce44SJohn Forte /* 817*fcf3ce44SJohn Forte * The following two fields indicate whether the remote port is an 818*fcf3ce44SJohn Forte * FCP initiator or an FCP target. They are treated as booleans. 819*fcf3ce44SJohn Forte */ 820*fcf3ce44SJohn Forte uchar_t tgt_icap; /* Initiator */ 821*fcf3ce44SJohn Forte uchar_t tgt_tcap; /* Target */ 822*fcf3ce44SJohn Forte #ifdef DEBUG 823*fcf3ce44SJohn Forte /* 824*fcf3ce44SJohn Forte * Updated in fcp_call_finish_init_held() when DEBUG is defined 825*fcf3ce44SJohn Forte */ 826*fcf3ce44SJohn Forte int tgt_tmp_cnt_depth; 827*fcf3ce44SJohn Forte pc_t tgt_tmp_cnt_stack[FCP_STACK_DEPTH]; 828*fcf3ce44SJohn Forte #endif /* DEBUG */ 829*fcf3ce44SJohn Forte /* 830*fcf3ce44SJohn Forte * This field holds the timer id of the timer started when a LUN 831*fcf3ce44SJohn Forte * reconfiguration is needed for the target. The reconfiguration 832*fcf3ce44SJohn Forte * is done in the timeout function. 833*fcf3ce44SJohn Forte */ 834*fcf3ce44SJohn Forte timeout_id_t tgt_tid; 835*fcf3ce44SJohn Forte int tgt_done; 836*fcf3ce44SJohn Forte /* 837*fcf3ce44SJohn Forte * Bitmap used to trace the discovery process. 838*fcf3ce44SJohn Forte */ 839*fcf3ce44SJohn Forte uint32_t tgt_trace; 840*fcf3ce44SJohn Forte /* 841*fcf3ce44SJohn Forte * This field is used when the code is sorting out which devices 842*fcf3ce44SJohn Forte * were known which ones are new and which ones went away. 843*fcf3ce44SJohn Forte */ 844*fcf3ce44SJohn Forte uint32_t tgt_aux_state; 845*fcf3ce44SJohn Forte /* 846*fcf3ce44SJohn Forte * Number of internal packets allocated in behalf of the target. 847*fcf3ce44SJohn Forte */ 848*fcf3ce44SJohn Forte int tgt_ipkt_cnt; 849*fcf3ce44SJohn Forte /* 850*fcf3ce44SJohn Forte * used to detect user unconfig when auto configuration is enabled. 851*fcf3ce44SJohn Forte */ 852*fcf3ce44SJohn Forte uint32_t tgt_manual_config_only; 853*fcf3ce44SJohn Forte }; 854*fcf3ce44SJohn Forte 855*fcf3ce44SJohn Forte /* 856*fcf3ce44SJohn Forte * Target States 857*fcf3ce44SJohn Forte */ 858*fcf3ce44SJohn Forte #define FCP_TGT_INIT 0x01 859*fcf3ce44SJohn Forte #define FCP_TGT_BUSY 0x02 860*fcf3ce44SJohn Forte #define FCP_TGT_MARK 0x04 861*fcf3ce44SJohn Forte #define FCP_TGT_OFFLINE 0x08 862*fcf3ce44SJohn Forte #define FCP_TGT_ORPHAN 0x80 863*fcf3ce44SJohn Forte #define FCP_TGT_ILLREQ 0x10 864*fcf3ce44SJohn Forte 865*fcf3ce44SJohn Forte /* 866*fcf3ce44SJohn Forte * Target Aux Stat 867*fcf3ce44SJohn Forte */ 868*fcf3ce44SJohn Forte #define FCP_TGT_TAGGED 0x01 869*fcf3ce44SJohn Forte 870*fcf3ce44SJohn Forte /* 871*fcf3ce44SJohn Forte * Target discovery tracing 872*fcf3ce44SJohn Forte */ 873*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_1 0x00000001 874*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_2 0x00000002 875*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_3 0x00000004 876*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_4 0x00000008 877*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_5 0x00000010 878*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_6 0x00000020 879*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_7 0x00000040 880*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_8 0x00000080 881*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_9 0x00000100 882*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_10 0x00000200 883*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_11 0x00000400 884*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_12 0x00000800 885*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_13 0x00001000 886*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_14 0x00002000 887*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_15 0x00004000 888*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_16 0x00008000 889*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_17 0x00010000 890*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_18 0x00020000 891*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_19 0x00040000 892*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_20 0x00080000 893*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_21 0x00100000 894*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_22 0x00200000 895*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_23 0x00400000 896*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_24 0x00800000 897*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_25 0x01000000 898*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_26 0x02000000 899*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_27 0x04000000 900*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_28 0x08000000 901*fcf3ce44SJohn Forte #define FCP_TGT_TRACE_29 0x10000000 902*fcf3ce44SJohn Forte 903*fcf3ce44SJohn Forte #ifndef __lock_lint 904*fcf3ce44SJohn Forte 905*fcf3ce44SJohn Forte #define FCP_TGT_TRACE(ptgt, tcount, bit) {\ 906*fcf3ce44SJohn Forte if (ptgt) {\ 907*fcf3ce44SJohn Forte if (ptgt->tgt_change_cnt == tcount) {\ 908*fcf3ce44SJohn Forte ptgt->tgt_trace |= bit;\ 909*fcf3ce44SJohn Forte }\ 910*fcf3ce44SJohn Forte }\ 911*fcf3ce44SJohn Forte } 912*fcf3ce44SJohn Forte 913*fcf3ce44SJohn Forte #else /* __lock_lint */ 914*fcf3ce44SJohn Forte 915*fcf3ce44SJohn Forte #define FCP_TGT_TRACE(ptgt, tcount, bit) 916*fcf3ce44SJohn Forte 917*fcf3ce44SJohn Forte #endif /* __lock_lint */ 918*fcf3ce44SJohn Forte 919*fcf3ce44SJohn Forte 920*fcf3ce44SJohn Forte /* 921*fcf3ce44SJohn Forte * state change cause 922*fcf3ce44SJohn Forte */ 923*fcf3ce44SJohn Forte #define FCP_CAUSE_TGT_CHANGE 0x01 924*fcf3ce44SJohn Forte #define FCP_CAUSE_LINK_CHANGE 0x02 925*fcf3ce44SJohn Forte #define FCP_CAUSE_LINK_DOWN 0x04 926*fcf3ce44SJohn Forte #define FCP_CAUSE_USER_CREATE 0x08 927*fcf3ce44SJohn Forte 928*fcf3ce44SJohn Forte 929*fcf3ce44SJohn Forte /* 930*fcf3ce44SJohn Forte * Target node states (applicable to LUNs behind the target) 931*fcf3ce44SJohn Forte */ 932*fcf3ce44SJohn Forte #define FCP_TGT_NODE_NONE 0x00 /* No node exists */ 933*fcf3ce44SJohn Forte #define FCP_TGT_NODE_ON_DEMAND 0x01 /* create only upon request */ 934*fcf3ce44SJohn Forte #define FCP_TGT_NODE_PRESENT 0x02 /* Node exists; rediscover it */ 935*fcf3ce44SJohn Forte 936*fcf3ce44SJohn Forte 937*fcf3ce44SJohn Forte #define FCP_NO_CHANGE 0x1 938*fcf3ce44SJohn Forte #define FCP_LINK_CHANGE 0x2 939*fcf3ce44SJohn Forte #define FCP_DEV_CHANGE 0x3 940*fcf3ce44SJohn Forte 941*fcf3ce44SJohn Forte 942*fcf3ce44SJohn Forte /* hotplug event struct */ 943*fcf3ce44SJohn Forte struct fcp_hp_event { 944*fcf3ce44SJohn Forte int (*callback)(); 945*fcf3ce44SJohn Forte void *arg; 946*fcf3ce44SJohn Forte }; 947*fcf3ce44SJohn Forte 948*fcf3ce44SJohn Forte /* 949*fcf3ce44SJohn Forte * We talk to both NDI and MDI framework to enumerate our child devices. 950*fcf3ce44SJohn Forte * We internally define a generic child handle and assign either dev_info 951*fcf3ce44SJohn Forte * or mdi_pathinfo handle depending on the device. 952*fcf3ce44SJohn Forte */ 953*fcf3ce44SJohn Forte typedef void *child_info_t; 954*fcf3ce44SJohn Forte 955*fcf3ce44SJohn Forte #define CIP(child) ((child_info_t *)(child)) 956*fcf3ce44SJohn Forte #define DIP(child) ((dev_info_t *)(child)) 957*fcf3ce44SJohn Forte #define PIP(child) ((mdi_pathinfo_t *)(child)) 958*fcf3ce44SJohn Forte 959*fcf3ce44SJohn Forte /* 960*fcf3ce44SJohn Forte * LUN structure 961*fcf3ce44SJohn Forte * ------------- 962*fcf3ce44SJohn Forte * 963*fcf3ce44SJohn Forte * This structure holds the information relative to a SCSI LUN. This 964*fcf3ce44SJohn Forte * structure is the one representing the object registered with the OS (NDI 965*fcf3ce44SJohn Forte * or MPxIO...). 966*fcf3ce44SJohn Forte */ 967*fcf3ce44SJohn Forte struct fcp_lun { 968*fcf3ce44SJohn Forte /* 969*fcf3ce44SJohn Forte * Mutex protecting the access to this structure. 970*fcf3ce44SJohn Forte */ 971*fcf3ce44SJohn Forte kmutex_t lun_mutex; 972*fcf3ce44SJohn Forte /* 973*fcf3ce44SJohn Forte * Logical unit number. It is a SCSI3 format. 974*fcf3ce44SJohn Forte */ 975*fcf3ce44SJohn Forte fcp_ent_addr_t lun_addr; 976*fcf3ce44SJohn Forte /* 977*fcf3ce44SJohn Forte * The two following fields are respectively the head and tail of a 978*fcf3ce44SJohn Forte * double link list of fcp_packets. It is populated in 979*fcf3ce44SJohn Forte * tran_init_pkt(9E) (fcp_scsi_init_pkt) and emptied in 980*fcf3ce44SJohn Forte * tran_destroy_pkt(9E) (fcp_scsi_destroy_pkt). 981*fcf3ce44SJohn Forte */ 982*fcf3ce44SJohn Forte struct fcp_pkt *lun_pkt_head; 983*fcf3ce44SJohn Forte struct fcp_pkt *lun_pkt_tail; 984*fcf3ce44SJohn Forte /* 985*fcf3ce44SJohn Forte * This field is treated like a union. It may contain the dev_info_t 986*fcf3ce44SJohn Forte * or the mdi_pathinfo_t depending on how the device associated with 987*fcf3ce44SJohn Forte * this LUN was registered. 988*fcf3ce44SJohn Forte */ 989*fcf3ce44SJohn Forte child_info_t *lun_cip; 990*fcf3ce44SJohn Forte /* 991*fcf3ce44SJohn Forte * Online/Offline event count. 992*fcf3ce44SJohn Forte */ 993*fcf3ce44SJohn Forte int lun_event_count; 994*fcf3ce44SJohn Forte /* 995*fcf3ce44SJohn Forte * Back pointer to the target the LUN belongs to. 996*fcf3ce44SJohn Forte */ 997*fcf3ce44SJohn Forte struct fcp_tgt *lun_tgt; 998*fcf3ce44SJohn Forte /* 999*fcf3ce44SJohn Forte * Bit map reflecting the state of the LUN. 1000*fcf3ce44SJohn Forte */ 1001*fcf3ce44SJohn Forte uint_t lun_state; 1002*fcf3ce44SJohn Forte /* 1003*fcf3ce44SJohn Forte * LUN type (disk, tape...). The value stored here is taken from the 1004*fcf3ce44SJohn Forte * inquiry data. 1005*fcf3ce44SJohn Forte */ 1006*fcf3ce44SJohn Forte uchar_t lun_type; 1007*fcf3ce44SJohn Forte /* 1008*fcf3ce44SJohn Forte * This field is incremented each time fcp_scsi_tgt_init() 1009*fcf3ce44SJohn Forte * (tran_tgt_init(9E)) is called and decremented each time 1010*fcf3ce44SJohn Forte * fcp_scsi_tgt_free() (tran_tgt_free(9E)) is called. The 1011*fcf3ce44SJohn Forte * incrementation and decrementation will also have an effect on 1012*fcf3ce44SJohn Forte * lun_state bit FCP_SCSI_LUN_TGT_INIT. 1013*fcf3ce44SJohn Forte */ 1014*fcf3ce44SJohn Forte uchar_t lun_tgt_count; 1015*fcf3ce44SJohn Forte /* 1016*fcf3ce44SJohn Forte * LUN number as it is returned by REPORT_LUNS. 1017*fcf3ce44SJohn Forte */ 1018*fcf3ce44SJohn Forte uint16_t lun_num; 1019*fcf3ce44SJohn Forte /* 1020*fcf3ce44SJohn Forte * Pointer to the next LUN. 1021*fcf3ce44SJohn Forte */ 1022*fcf3ce44SJohn Forte struct fcp_lun *lun_next; 1023*fcf3ce44SJohn Forte /* 1024*fcf3ce44SJohn Forte * SCSI Host Bus Adapter (HBA) driver transport vector structure. 1025*fcf3ce44SJohn Forte */ 1026*fcf3ce44SJohn Forte struct scsi_hba_tran *lun_tran; 1027*fcf3ce44SJohn Forte /* 1028*fcf3ce44SJohn Forte * per-Lun control flag. A value of '1' means the LUN is managed by 1029*fcf3ce44SJohn Forte * mpxio. A value of '0' means the LUN has been physically enumerated 1030*fcf3ce44SJohn Forte * as a child of corresponding port driver node. 1031*fcf3ce44SJohn Forte */ 1032*fcf3ce44SJohn Forte int lun_mpxio; 1033*fcf3ce44SJohn Forte /* 1034*fcf3ce44SJohn Forte * Length of the GUID. 1035*fcf3ce44SJohn Forte */ 1036*fcf3ce44SJohn Forte size_t lun_guid_size; 1037*fcf3ce44SJohn Forte /* 1038*fcf3ce44SJohn Forte * Pointer to a buffer that contains the GUID. 1039*fcf3ce44SJohn Forte */ 1040*fcf3ce44SJohn Forte char *lun_guid; 1041*fcf3ce44SJohn Forte /* 1042*fcf3ce44SJohn Forte * Pointer to a buffer that contains the old GUID. 1043*fcf3ce44SJohn Forte */ 1044*fcf3ce44SJohn Forte char *lun_old_guid; 1045*fcf3ce44SJohn Forte /* 1046*fcf3ce44SJohn Forte * Length of the old GUID 1047*fcf3ce44SJohn Forte */ 1048*fcf3ce44SJohn Forte size_t lun_old_guid_size; 1049*fcf3ce44SJohn Forte /* 1050*fcf3ce44SJohn Forte * Bitmap used to track the LUN discovery process. 1051*fcf3ce44SJohn Forte */ 1052*fcf3ce44SJohn Forte uint32_t lun_trace; 1053*fcf3ce44SJohn Forte /* 1054*fcf3ce44SJohn Forte * Bitmap representing the SCSI capabilities. 1055*fcf3ce44SJohn Forte */ 1056*fcf3ce44SJohn Forte uchar_t lun_cap; 1057*fcf3ce44SJohn Forte /* 1058*fcf3ce44SJohn Forte * LUN inquiry data (as returned by the INQUIRY command). 1059*fcf3ce44SJohn Forte */ 1060*fcf3ce44SJohn Forte struct scsi_inquiry lun_inq; 1061*fcf3ce44SJohn Forte }; 1062*fcf3ce44SJohn Forte 1063*fcf3ce44SJohn Forte 1064*fcf3ce44SJohn Forte /* 1065*fcf3ce44SJohn Forte * Lun discovery tracing 1066*fcf3ce44SJohn Forte */ 1067*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_1 0x0000001 1068*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_2 0x0000002 1069*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_3 0x0000004 1070*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_4 0x0000008 1071*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_5 0x0000010 1072*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_6 0x0000020 1073*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_7 0x0000040 1074*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_8 0x0000080 1075*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_9 0x0000100 1076*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_10 0x0000200 1077*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_11 0x0000400 1078*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_12 0x0000800 1079*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_13 0x0001000 1080*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_14 0x0002000 1081*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_15 0x0004000 1082*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_16 0x0008000 1083*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_17 0x0010000 1084*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_18 0x0020000 1085*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_19 0x0040000 1086*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_20 0x0080000 1087*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_21 0x0100000 1088*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_22 0x0200000 1089*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_23 0x0400000 1090*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_24 0x0800000 1091*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_25 0x1000000 1092*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_26 0x2000000 1093*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_27 0x4000000 1094*fcf3ce44SJohn Forte #define FCP_LUN_TRACE_28 0x8000000 1095*fcf3ce44SJohn Forte 1096*fcf3ce44SJohn Forte 1097*fcf3ce44SJohn Forte #define FCP_LUN_TRACE(plun, bit) {\ 1098*fcf3ce44SJohn Forte if (plun && plun->lun_tgt) {\ 1099*fcf3ce44SJohn Forte mutex_enter(&plun->lun_tgt->tgt_mutex);\ 1100*fcf3ce44SJohn Forte plun->lun_trace |= bit;\ 1101*fcf3ce44SJohn Forte mutex_exit(&plun->lun_tgt->tgt_mutex);\ 1102*fcf3ce44SJohn Forte }\ 1103*fcf3ce44SJohn Forte } 1104*fcf3ce44SJohn Forte 1105*fcf3ce44SJohn Forte #define FCP_LUN_CAP_RESET 0x01 1106*fcf3ce44SJohn Forte 1107*fcf3ce44SJohn Forte /* 1108*fcf3ce44SJohn Forte * Lun State -- these have the same values as the target states so 1109*fcf3ce44SJohn Forte * that they can be interchanged (in cases where the same state occurs 1110*fcf3ce44SJohn Forte * for both targets and luns) 1111*fcf3ce44SJohn Forte */ 1112*fcf3ce44SJohn Forte 1113*fcf3ce44SJohn Forte #define FCP_LUN_INIT FCP_TGT_INIT 1114*fcf3ce44SJohn Forte #define FCP_LUN_BUSY FCP_TGT_BUSY 1115*fcf3ce44SJohn Forte #define FCP_LUN_MARK FCP_TGT_MARK 1116*fcf3ce44SJohn Forte #define FCP_LUN_OFFLINE FCP_TGT_OFFLINE 1117*fcf3ce44SJohn Forte #define FCP_SCSI_LUN_TGT_INIT 0x20 /* target/LUNs all inited */ 1118*fcf3ce44SJohn Forte #define FCP_LUN_DISAPPEARED 0x40 1119*fcf3ce44SJohn Forte /* 1120*fcf3ce44SJohn Forte * Use the below flag with caution as it is can cause a delay in 1121*fcf3ce44SJohn Forte * fcp_scsi_start() which is in the normal I/O performance path 1122*fcf3ce44SJohn Forte */ 1123*fcf3ce44SJohn Forte #define FCP_LUN_ONLINING 0x80 1124*fcf3ce44SJohn Forte /* 1125*fcf3ce44SJohn Forte * Set the below flag when the DTYPE or GUID of a LUN changes during discovery 1126*fcf3ce44SJohn Forte */ 1127*fcf3ce44SJohn Forte #define FCP_LUN_CHANGED 0x100 1128*fcf3ce44SJohn Forte /* 1129*fcf3ce44SJohn Forte * This flag is used specifically for the special lun: lun 0. 1130*fcf3ce44SJohn Forte */ 1131*fcf3ce44SJohn Forte #define FCP_LUN_DEVICE_NOT_CONNECTED 0x200 1132*fcf3ce44SJohn Forte 1133*fcf3ce44SJohn Forte /* 1134*fcf3ce44SJohn Forte * Report Lun Format 1135*fcf3ce44SJohn Forte */ 1136*fcf3ce44SJohn Forte struct fcp_reportlun_resp { 1137*fcf3ce44SJohn Forte uint32_t num_lun; /* num LUNs * 8 */ 1138*fcf3ce44SJohn Forte uint32_t reserved; 1139*fcf3ce44SJohn Forte longlong_t lun_string[1]; 1140*fcf3ce44SJohn Forte }; 1141*fcf3ce44SJohn Forte 1142*fcf3ce44SJohn Forte /* 1143*fcf3ce44SJohn Forte * This structure actually represents a request executed by the hot plug task. 1144*fcf3ce44SJohn Forte */ 1145*fcf3ce44SJohn Forte struct fcp_hp_elem { 1146*fcf3ce44SJohn Forte /* 1147*fcf3ce44SJohn Forte * FCP port concerned by the request. 1148*fcf3ce44SJohn Forte */ 1149*fcf3ce44SJohn Forte struct fcp_port *port; 1150*fcf3ce44SJohn Forte /* 1151*fcf3ce44SJohn Forte * LUN concerned by the request. 1152*fcf3ce44SJohn Forte */ 1153*fcf3ce44SJohn Forte struct fcp_lun *lun; 1154*fcf3ce44SJohn Forte /* 1155*fcf3ce44SJohn Forte * dev_info_t or mdi_pathinfo_t pointer. 1156*fcf3ce44SJohn Forte */ 1157*fcf3ce44SJohn Forte child_info_t *cip; 1158*fcf3ce44SJohn Forte /* 1159*fcf3ce44SJohn Forte * What to do (offline, online...). 1160*fcf3ce44SJohn Forte */ 1161*fcf3ce44SJohn Forte int what; 1162*fcf3ce44SJohn Forte /* 1163*fcf3ce44SJohn Forte * FLags used when calling NDI fucntions. 1164*fcf3ce44SJohn Forte */ 1165*fcf3ce44SJohn Forte int flags; 1166*fcf3ce44SJohn Forte /* 1167*fcf3ce44SJohn Forte * Link state change count when the structure was created. 1168*fcf3ce44SJohn Forte */ 1169*fcf3ce44SJohn Forte int link_cnt; 1170*fcf3ce44SJohn Forte /* 1171*fcf3ce44SJohn Forte * Target state change count when the structure was created. 1172*fcf3ce44SJohn Forte */ 1173*fcf3ce44SJohn Forte int tgt_cnt; 1174*fcf3ce44SJohn Forte /* 1175*fcf3ce44SJohn Forte * Online/Offline count when this event was queued. 1176*fcf3ce44SJohn Forte */ 1177*fcf3ce44SJohn Forte int event_cnt; 1178*fcf3ce44SJohn Forte /* 1179*fcf3ce44SJohn Forte * This is the flag protected by the mutex and condition variable 1180*fcf3ce44SJohn Forte * defined further in this structure. It is the flag indicating 1181*fcf3ce44SJohn Forte * that the hot plug task is done with the treatment of the structure. 1182*fcf3ce44SJohn Forte */ 1183*fcf3ce44SJohn Forte int wait; 1184*fcf3ce44SJohn Forte /* 1185*fcf3ce44SJohn Forte * This is where the result of the request is returned when the sender 1186*fcf3ce44SJohn Forte * waits for the completion. 1187*fcf3ce44SJohn Forte */ 1188*fcf3ce44SJohn Forte int result; 1189*fcf3ce44SJohn Forte /* 1190*fcf3ce44SJohn Forte * Condition variable used when wait is true. 1191*fcf3ce44SJohn Forte */ 1192*fcf3ce44SJohn Forte kcondvar_t cv; 1193*fcf3ce44SJohn Forte /* 1194*fcf3ce44SJohn Forte * Mutex used in conjunction with the previous condition variable. 1195*fcf3ce44SJohn Forte */ 1196*fcf3ce44SJohn Forte kmutex_t mutex; 1197*fcf3ce44SJohn Forte }; 1198*fcf3ce44SJohn Forte 1199*fcf3ce44SJohn Forte 1200*fcf3ce44SJohn Forte struct fcp_reset_elem { 1201*fcf3ce44SJohn Forte struct fcp_reset_elem *next; 1202*fcf3ce44SJohn Forte struct fcp_tgt *tgt; 1203*fcf3ce44SJohn Forte struct fcp_lun *lun; 1204*fcf3ce44SJohn Forte clock_t timeout; 1205*fcf3ce44SJohn Forte uint_t tgt_cnt; 1206*fcf3ce44SJohn Forte }; 1207*fcf3ce44SJohn Forte 1208*fcf3ce44SJohn Forte /* 1209*fcf3ce44SJohn Forte * This structure is used to offline targets. It is queued in the FCP port 1210*fcf3ce44SJohn Forte * structure single linked list port_offline_tgts and walked by the watchdog 1211*fcf3ce44SJohn Forte * timer. 1212*fcf3ce44SJohn Forte */ 1213*fcf3ce44SJohn Forte struct fcp_tgt_elem { 1214*fcf3ce44SJohn Forte /* 1215*fcf3ce44SJohn Forte * Points to the next element of the list. 1216*fcf3ce44SJohn Forte */ 1217*fcf3ce44SJohn Forte struct fcp_tgt_elem *next; 1218*fcf3ce44SJohn Forte /* 1219*fcf3ce44SJohn Forte * Points to the target to offline. 1220*fcf3ce44SJohn Forte */ 1221*fcf3ce44SJohn Forte struct fcp_tgt *ptgt; 1222*fcf3ce44SJohn Forte /* 1223*fcf3ce44SJohn Forte * Absolute time after which the target must be offlined. 1224*fcf3ce44SJohn Forte */ 1225*fcf3ce44SJohn Forte int time; 1226*fcf3ce44SJohn Forte /* 1227*fcf3ce44SJohn Forte * Link state change count when the structure was created. 1228*fcf3ce44SJohn Forte */ 1229*fcf3ce44SJohn Forte int link_cnt; 1230*fcf3ce44SJohn Forte /* 1231*fcf3ce44SJohn Forte * Target state change count when the structure was created. 1232*fcf3ce44SJohn Forte */ 1233*fcf3ce44SJohn Forte int tgt_cnt; 1234*fcf3ce44SJohn Forte /* 1235*fcf3ce44SJohn Forte * Flags providing information for the offline (when calling mdi or 1236*fcf3ce44SJohn Forte * ndi). 1237*fcf3ce44SJohn Forte */ 1238*fcf3ce44SJohn Forte int flags; 1239*fcf3ce44SJohn Forte }; 1240*fcf3ce44SJohn Forte 1241*fcf3ce44SJohn Forte /* 1242*fcf3ce44SJohn Forte * This structure is used to offline LUNs. It is queued in the FCP port 1243*fcf3ce44SJohn Forte * structure single linked list port_offline_luns and walked by the watchdog 1244*fcf3ce44SJohn Forte * timer. 1245*fcf3ce44SJohn Forte */ 1246*fcf3ce44SJohn Forte struct fcp_lun_elem { 1247*fcf3ce44SJohn Forte /* 1248*fcf3ce44SJohn Forte * Points to the next element of the list. 1249*fcf3ce44SJohn Forte */ 1250*fcf3ce44SJohn Forte struct fcp_lun_elem *next; 1251*fcf3ce44SJohn Forte /* 1252*fcf3ce44SJohn Forte * Points to the LUN to offline. 1253*fcf3ce44SJohn Forte */ 1254*fcf3ce44SJohn Forte struct fcp_lun *plun; 1255*fcf3ce44SJohn Forte /* 1256*fcf3ce44SJohn Forte * Absolute time after which the LUN must be offlined. 1257*fcf3ce44SJohn Forte */ 1258*fcf3ce44SJohn Forte int time; 1259*fcf3ce44SJohn Forte /* 1260*fcf3ce44SJohn Forte * Link state change count when the structure was created. 1261*fcf3ce44SJohn Forte */ 1262*fcf3ce44SJohn Forte int link_cnt; 1263*fcf3ce44SJohn Forte /* 1264*fcf3ce44SJohn Forte * Target state change count when the structure was created. 1265*fcf3ce44SJohn Forte */ 1266*fcf3ce44SJohn Forte int tgt_cnt; 1267*fcf3ce44SJohn Forte /* 1268*fcf3ce44SJohn Forte * Flags providing information for the offline (when calling mdi or 1269*fcf3ce44SJohn Forte * ndi). 1270*fcf3ce44SJohn Forte */ 1271*fcf3ce44SJohn Forte int flags; 1272*fcf3ce44SJohn Forte }; 1273*fcf3ce44SJohn Forte 1274*fcf3ce44SJohn Forte /* 1275*fcf3ce44SJohn Forte * LUN masking 1276*fcf3ce44SJohn Forte */ 1277*fcf3ce44SJohn Forte typedef struct fcp_black_list_entry { 1278*fcf3ce44SJohn Forte /* 1279*fcf3ce44SJohn Forte * Points to the next element of the list. 1280*fcf3ce44SJohn Forte */ 1281*fcf3ce44SJohn Forte struct fcp_black_list_entry *next; 1282*fcf3ce44SJohn Forte /* 1283*fcf3ce44SJohn Forte * Port WWN of the target. 1284*fcf3ce44SJohn Forte */ 1285*fcf3ce44SJohn Forte la_wwn_t wwn; 1286*fcf3ce44SJohn Forte /* 1287*fcf3ce44SJohn Forte * LUN number which need to be masked. 1288*fcf3ce44SJohn Forte */ 1289*fcf3ce44SJohn Forte uint32_t lun; 1290*fcf3ce44SJohn Forte /* 1291*fcf3ce44SJohn Forte * Counter of access times. 1292*fcf3ce44SJohn Forte */ 1293*fcf3ce44SJohn Forte int masked; 1294*fcf3ce44SJohn Forte } fcp_black_list_entry_t; 1295*fcf3ce44SJohn Forte 1296*fcf3ce44SJohn Forte #define ADDR2FCP(ap) (struct fcp_port *) \ 1297*fcf3ce44SJohn Forte ((ap)->a_hba_tran->tran_hba_private) 1298*fcf3ce44SJohn Forte #define ADDR2LUN(ap) (struct fcp_lun *)((ap)->a_hba_tran->tran_tgt_private) 1299*fcf3ce44SJohn Forte #define CMD2PKT(cmd) ((cmd)->cmd_pkt) 1300*fcf3ce44SJohn Forte #define PKT2CMD(pkt) ((struct fcp_pkt *)pkt->pkt_ha_private) 1301*fcf3ce44SJohn Forte 1302*fcf3ce44SJohn Forte /* 1303*fcf3ce44SJohn Forte * timeout values 1304*fcf3ce44SJohn Forte */ 1305*fcf3ce44SJohn Forte #define FCP_ELS_TIMEOUT 20 /* 20 seconds */ 1306*fcf3ce44SJohn Forte #define FCP_SCSI_CMD_TIMEOUT 25 /* 30 seconds */ 1307*fcf3ce44SJohn Forte #define FCP_POLL_TIMEOUT 60 /* 60 seconds */ 1308*fcf3ce44SJohn Forte #define FCP_TIMEOUT_DELTA 2 /* 2 seconds */ 1309*fcf3ce44SJohn Forte #define FCP_ICMD_DEADLINE 120 /* 60 seconds */ 1310*fcf3ce44SJohn Forte #define FCP_MAX_RETRIES 4 1311*fcf3ce44SJohn Forte 1312*fcf3ce44SJohn Forte 1313*fcf3ce44SJohn Forte #if !defined(__lint) 1314*fcf3ce44SJohn Forte _NOTE(MUTEX_PROTECTS_DATA(fcp_port::port_mutex, 1315*fcf3ce44SJohn Forte fcp_port::port_state fcp_tgt::tgt_change_cnt 1316*fcf3ce44SJohn Forte fcp_port::fcp_next fcp_port::port_tgt_hash_table 1317*fcf3ce44SJohn Forte fcp_port::port_link_cnt fcp_port::port_reset_list 1318*fcf3ce44SJohn Forte fcp_port::port_tmp_cnt fcp_port::port_ipkt_list 1319*fcf3ce44SJohn Forte fcp_tgt::tgt_next)) 1320*fcf3ce44SJohn Forte 1321*fcf3ce44SJohn Forte _NOTE(MUTEX_PROTECTS_DATA(fcp_port::port_pkt_mutex, 1322*fcf3ce44SJohn Forte fcp_port::port_pkt_head fcp_port::port_pkt_tail 1323*fcf3ce44SJohn Forte fcp_port::port_npkts)) 1324*fcf3ce44SJohn Forte 1325*fcf3ce44SJohn Forte _NOTE(MUTEX_PROTECTS_DATA(fcp_tgt::tgt_mutex, 1326*fcf3ce44SJohn Forte fcp_tgt::tgt_state fcp_tgt::tgt_device_created 1327*fcf3ce44SJohn Forte fcp_tgt::tgt_icap fcp_tgt::tgt_tcap 1328*fcf3ce44SJohn Forte fcp_tgt::tgt_tid fcp_tgt::tgt_pd_handle fcp_tgt::tgt_tmp_cnt 1329*fcf3ce44SJohn Forte fcp_tgt::tgt_statec_cause fcp_lun::lun_next fcp_lun::lun_state)) 1330*fcf3ce44SJohn Forte 1331*fcf3ce44SJohn Forte _NOTE(LOCK_ORDER(fcp_port::fcp_mutex fcp_tgt::tgt_mutex)) 1332*fcf3ce44SJohn Forte _NOTE(LOCK_ORDER(fcp_tgt::tgt_mutex fcp_lun::lun_mutex)) 1333*fcf3ce44SJohn Forte 1334*fcf3ce44SJohn Forte _NOTE(MUTEX_PROTECTS_DATA(fcp_lun::lun_mutex, 1335*fcf3ce44SJohn Forte fcp_lun::lun_pkt_head fcp_lun::lun_pkt_tail 1336*fcf3ce44SJohn Forte fcp_lun::lun_cip fcp_lun::lun_mpxio)) 1337*fcf3ce44SJohn Forte 1338*fcf3ce44SJohn Forte _NOTE(DATA_READABLE_WITHOUT_LOCK( fcp_tgt::tgt_state)) 1339*fcf3ce44SJohn Forte _NOTE(DATA_READABLE_WITHOUT_LOCK( fcp_tgt::tgt_pd_handle)) 1340*fcf3ce44SJohn Forte 1341*fcf3ce44SJohn Forte _NOTE(DATA_READABLE_WITHOUT_LOCK(fcp_tgt::tgt_tid)) 1342*fcf3ce44SJohn Forte 1343*fcf3ce44SJohn Forte 1344*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("Safe Data", 1345*fcf3ce44SJohn Forte fcp_port::port_dma_acc_attr 1346*fcf3ce44SJohn Forte fcp_port::port_fcp_dma fcp_port::fcp_tran 1347*fcf3ce44SJohn Forte fcp_port::port_ndi_events fcp_port::port_ndi_event_defs 1348*fcf3ce44SJohn Forte fcp_port::port_pkt_cache fcp_port::port_dip fcp_port::port_phys_state 1349*fcf3ce44SJohn Forte fcp_port::port_reset_action fcp_port::port_cmds_dma_flags 1350*fcf3ce44SJohn Forte fcp_port::port_fp_handle fcp_port::port_instance 1351*fcf3ce44SJohn Forte fcp_port::port_fp_modlinkage fcp_port::port_max_exch 1352*fcf3ce44SJohn Forte fcp_port::port_priv_pkt_len fcp_port::port_id 1353*fcf3ce44SJohn Forte fcp_port::port_topology fcp_port::port_deadline fcp_port::port_mpxio 1354*fcf3ce44SJohn Forte fcp_tgt::tgt_d_id fcp_tgt::tgt_hard_addr fcp_tgt::tgt_lun_cnt 1355*fcf3ce44SJohn Forte fcp_tgt::tgt_port fcp_lun::lun_num fcp_lun::lun_tgt 1356*fcf3ce44SJohn Forte fcp_lun::lun_type 1357*fcf3ce44SJohn Forte fcp_lun::lun_guid_size fcp_lun::lun_guid 1358*fcf3ce44SJohn Forte fcp_hp_elem::lun fcp_hp_elem::flags fcp_hp_elem::cip 1359*fcf3ce44SJohn Forte fcp_hp_elem::what fcp_hp_elem::tgt_cnt fcp_hp_elem::tgt_cnt 1360*fcf3ce44SJohn Forte fcp_hp_elem::link_cnt fcp_reset_elem fcp_pkt fcp_ipkt 1361*fcf3ce44SJohn Forte scsi_pkt scsi_arq_status scsi_device scsi_hba_tran scsi_cdb)) 1362*fcf3ce44SJohn Forte #endif /* __lint */ 1363*fcf3ce44SJohn Forte 1364*fcf3ce44SJohn Forte #define FCP_CP_IN(s, d, handle, len) (ddi_rep_get8((handle), \ 1365*fcf3ce44SJohn Forte (uint8_t *)(d), (uint8_t *)(s), \ 1366*fcf3ce44SJohn Forte (len), DDI_DEV_AUTOINCR)) 1367*fcf3ce44SJohn Forte 1368*fcf3ce44SJohn Forte #define FCP_CP_OUT(s, d, handle, len) (ddi_rep_put8((handle), \ 1369*fcf3ce44SJohn Forte (uint8_t *)(s), (uint8_t *)(d), \ 1370*fcf3ce44SJohn Forte (len), DDI_DEV_AUTOINCR)) 1371*fcf3ce44SJohn Forte 1372*fcf3ce44SJohn Forte #define FCP_ONLINE 0x1 1373*fcf3ce44SJohn Forte #define FCP_OFFLINE 0x2 1374*fcf3ce44SJohn Forte #define FCP_MPXIO_PATH_CLEAR_BUSY 0x3 1375*fcf3ce44SJohn Forte #define FCP_MPXIO_PATH_SET_BUSY 0x4 1376*fcf3ce44SJohn Forte 1377*fcf3ce44SJohn Forte #define FCP_IDLE 0x00 1378*fcf3ce44SJohn Forte #define FCP_OPEN 0x01 1379*fcf3ce44SJohn Forte #define FCP_EXCL 0x02 1380*fcf3ce44SJohn Forte #define FCP_BUSY 0x04 1381*fcf3ce44SJohn Forte 1382*fcf3ce44SJohn Forte #define LFA(x) (x & 0xFFFF00) 1383*fcf3ce44SJohn Forte #define FCP_SET 1 1384*fcf3ce44SJohn Forte #define FCP_RESET 0 1385*fcf3ce44SJohn Forte 1386*fcf3ce44SJohn Forte /* init() and attach() wait timeout values (in usecs) */ 1387*fcf3ce44SJohn Forte #define FCP_INIT_WAIT_TIMEOUT 60000000 /* 60 seconds */ 1388*fcf3ce44SJohn Forte #define FCP_ATTACH_WAIT_TIMEOUT 10000000 /* 10 seconds */ 1389*fcf3ce44SJohn Forte 1390*fcf3ce44SJohn Forte #ifdef TRUE 1391*fcf3ce44SJohn Forte #undef TRUE 1392*fcf3ce44SJohn Forte #endif 1393*fcf3ce44SJohn Forte #define TRUE 1 1394*fcf3ce44SJohn Forte 1395*fcf3ce44SJohn Forte #ifdef FALSE 1396*fcf3ce44SJohn Forte #undef FALSE 1397*fcf3ce44SJohn Forte #endif 1398*fcf3ce44SJohn Forte #define FALSE 0 1399*fcf3ce44SJohn Forte 1400*fcf3ce44SJohn Forte #define UNDEFINED -1 1401*fcf3ce44SJohn Forte 1402*fcf3ce44SJohn Forte /* for softstate */ 1403*fcf3ce44SJohn Forte #define FCP_INIT_ITEMS 5 1404*fcf3ce44SJohn Forte 1405*fcf3ce44SJohn Forte #ifdef __cplusplus 1406*fcf3ce44SJohn Forte } 1407*fcf3ce44SJohn Forte #endif 1408*fcf3ce44SJohn Forte 1409*fcf3ce44SJohn Forte #endif /* _FCPVAR_H */ 1410