1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22*7ff83669SZhong Wang * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fcf3ce44SJohn Forte * Use is subject to license terms. 24fcf3ce44SJohn Forte */ 25fcf3ce44SJohn Forte 26fcf3ce44SJohn Forte #ifndef _FC_PORTIF_H 27fcf3ce44SJohn Forte #define _FC_PORTIF_H 28fcf3ce44SJohn Forte 29fcf3ce44SJohn Forte #include <sys/note.h> 30fcf3ce44SJohn Forte 31fcf3ce44SJohn Forte #ifdef __cplusplus 32fcf3ce44SJohn Forte extern "C" { 33fcf3ce44SJohn Forte #endif 34fcf3ce44SJohn Forte 35fcf3ce44SJohn Forte /* 36fcf3ce44SJohn Forte * To remove the port WWN from the orphan list; An orphan list 37fcf3ce44SJohn Forte * scan typically happens during ONLINE processing (after a LIP 38fcf3ce44SJohn Forte * in Public loop or link reset) or during RSCN validation. 39fcf3ce44SJohn Forte */ 40fcf3ce44SJohn Forte #define FC_ORPHAN_SCAN_LIMIT 15 41fcf3ce44SJohn Forte 42fcf3ce44SJohn Forte /* 43fcf3ce44SJohn Forte * Show a limited tolerance on the number of LOGOs that an 44fcf3ce44SJohn Forte * N/NL_Port can send; Beyond that it'll be removed entirely 45fcf3ce44SJohn Forte * from the port driver's data base. The tolerance counter 46fcf3ce44SJohn Forte * is reset after each link reset. 47fcf3ce44SJohn Forte */ 48fcf3ce44SJohn Forte #define FC_LOGO_TOLERANCE_LIMIT 16 49fcf3ce44SJohn Forte #define FC_LOGO_TOLERANCE_TIME_LIMIT 5000000 /* 5 seconds */ 50fcf3ce44SJohn Forte 51fcf3ce44SJohn Forte /* 52fcf3ce44SJohn Forte * ns_flags field definitions in struct 53fcf3ce44SJohn Forte * fctl_ns_req_t 54fcf3ce44SJohn Forte */ 55fcf3ce44SJohn Forte #define FCTL_NS_FILL_NS_MAP 0x01 56fcf3ce44SJohn Forte #define FCTL_NS_GET_DEV_COUNT 0x02 57fcf3ce44SJohn Forte #define FCTL_NS_NO_DATA_BUF 0x04 58fcf3ce44SJohn Forte #define FCTL_NS_BUF_IS_USERLAND 0x08 59fcf3ce44SJohn Forte #define FCTL_NS_BUF_IS_FC_PORTMAP 0x10 60fcf3ce44SJohn Forte #define FCTL_NS_CREATE_DEVICE 0x20 61fcf3ce44SJohn Forte #define FCTL_NS_VALIDATE_PD 0x40 62fcf3ce44SJohn Forte #define FCTL_NS_ASYNC_REQUEST 0x80 63fcf3ce44SJohn Forte #define FCTL_GAN_START_ID 0xFFFFFF 64fcf3ce44SJohn Forte 65fcf3ce44SJohn Forte 66fcf3ce44SJohn Forte 67fcf3ce44SJohn Forte /* 68fcf3ce44SJohn Forte * Values for the fp_soft_state field in the fc_local_port_t struct. 69fcf3ce44SJohn Forte * 70fcf3ce44SJohn Forte * Notice below that in two cases, suspend and pm-suspend,there 71fcf3ce44SJohn Forte * is no usage of _IN_, which means the bits will stay even after 72fcf3ce44SJohn Forte * suspend/pm-suspend is complete they are cleared at the time of 73fcf3ce44SJohn Forte * resume/pm-resume. 74fcf3ce44SJohn Forte */ 75fcf3ce44SJohn Forte 76fcf3ce44SJohn Forte /* 77fcf3ce44SJohn Forte * FP_SOFT_IN_DETACH is set in fp_detach_handler(), which is called from 78fcf3ce44SJohn Forte * fp_detach() for the DDI_DETACH flag. FP_SOFT_IN_DETACH is checked in 79fcf3ce44SJohn Forte * numerous places. It is never explicitly cleared -- apparently the code 80fcf3ce44SJohn Forte * relies on ddi_softstate_free(9F) to clear it. 81fcf3ce44SJohn Forte */ 82fcf3ce44SJohn Forte #define FP_SOFT_IN_DETACH 0x0002 83fcf3ce44SJohn Forte 84fcf3ce44SJohn Forte /* 85fcf3ce44SJohn Forte * FP_SOFT_SUSPEND is set in fp_suspend_handler() and cleared in 86fcf3ce44SJohn Forte * fp_resume_handler. It is tested in a number of placed in fp and fctl, 87fcf3ce44SJohn Forte * including fp_job_handler(). 88fcf3ce44SJohn Forte */ 89fcf3ce44SJohn Forte #define FP_SOFT_SUSPEND 0x0004 90fcf3ce44SJohn Forte 91fcf3ce44SJohn Forte /* 92fcf3ce44SJohn Forte * FP_SOFT_POWER_DOWN is set in fp_power_down() and cleared in fp_power_up(). 93fcf3ce44SJohn Forte * It is tested in a number of different places in fp/fctl. 94fcf3ce44SJohn Forte */ 95fcf3ce44SJohn Forte #define FP_SOFT_POWER_DOWN 0x0008 96fcf3ce44SJohn Forte #define FP_SOFT_IN_STATEC_CB 0x0010 97fcf3ce44SJohn Forte #define FP_SOFT_IN_UNSOL_CB 0x0020 98fcf3ce44SJohn Forte #define FP_SOFT_IN_LINK_RESET 0x0040 99fcf3ce44SJohn Forte #define FP_SOFT_BAD_LINK 0x0080 100fcf3ce44SJohn Forte #define FP_SOFT_IN_FCA_RESET 0x0100 101fcf3ce44SJohn Forte #define FP_DETACH_INPROGRESS 0x0200 102fcf3ce44SJohn Forte #define FP_DETACH_FAILED 0x0400 103fcf3ce44SJohn Forte #define FP_SOFT_NO_PMCOMP 0x0800 104*7ff83669SZhong Wang #define FP_SOFT_FCA_IS_NODMA 0x1000 105fcf3ce44SJohn Forte 106fcf3ce44SJohn Forte /* 107fcf3ce44SJohn Forte * Instruct the port driver to just accept logins from these addresses 108fcf3ce44SJohn Forte */ 109fcf3ce44SJohn Forte #define FC_MUST_ACCEPT_D_ID(x) (FC_WELL_KNOWN_ADDR(x) || (x) == 0) 110fcf3ce44SJohn Forte 111fcf3ce44SJohn Forte #define FC_IS_REAL_DEVICE(x) (!FC_MUST_ACCEPT_D_ID(x)) 112fcf3ce44SJohn Forte 113fcf3ce44SJohn Forte /* 114fcf3ce44SJohn Forte * Bit definitions for fp_options field in fc_local_port_t 115fcf3ce44SJohn Forte * structure for Feature and Hack additions to make 116fcf3ce44SJohn Forte * the driver code a real hairball. 117fcf3ce44SJohn Forte */ 118fcf3ce44SJohn Forte #define FP_NS_SMART_COUNT 0x01 119fcf3ce44SJohn Forte #define FP_SEND_RJT 0x02 120fcf3ce44SJohn Forte #define FP_CORE_ON_OFFLINE_TIMEOUT 0x04 121fcf3ce44SJohn Forte #define FP_RESET_CORE_ON_OFFLINE_TIMEOUT 0x08 122fcf3ce44SJohn Forte #define FP_TARGET_MODE 0x10 123fcf3ce44SJohn Forte 124fcf3ce44SJohn Forte 125fcf3ce44SJohn Forte /* 126fcf3ce44SJohn Forte * Values for fp_pm_level in the fc_local_port_t struct. Tracks current PM 127fcf3ce44SJohn Forte * level for the local port. 128fcf3ce44SJohn Forte */ 129fcf3ce44SJohn Forte #define FP_PM_PORT_DOWN 0 130fcf3ce44SJohn Forte #define FP_PM_PORT_UP 1 131fcf3ce44SJohn Forte 132fcf3ce44SJohn Forte 133fcf3ce44SJohn Forte /* 134fcf3ce44SJohn Forte * FC port compoment for PM. Used with pm_raise_power() and friends. 135fcf3ce44SJohn Forte */ 136fcf3ce44SJohn Forte #define FP_PM_COMPONENT 0 137fcf3ce44SJohn Forte 138fcf3ce44SJohn Forte 139fcf3ce44SJohn Forte #define FCTL_WWN_SIZE(wwn) \ 140fcf3ce44SJohn Forte (sizeof ((wwn)->raw_wwn) / sizeof ((wwn)->raw_wwn[0])) 141fcf3ce44SJohn Forte 142fcf3ce44SJohn Forte 143fcf3ce44SJohn Forte /* 144fcf3ce44SJohn Forte * Structure for issuing a work request to the per-instance "job handler" 145fcf3ce44SJohn Forte * thread. Primarily allocated/initialized by fctl_alloc_job() and freed by 146*7ff83669SZhong Wang * fctl_dealloc_job(). fctl keeps a kmem_cache of these structs anchored by the 147fcf3ce44SJohn Forte * fctl_job_cache global variable. The cache is created at fctl's _init(9E) and 148fcf3ce44SJohn Forte * destroyed at fctl's _fini(9E). See also fctl_cache_constructor() 149fcf3ce44SJohn Forte * and fctl_cache_destructor(). 150fcf3ce44SJohn Forte */ 151fcf3ce44SJohn Forte typedef struct job_request { 152fcf3ce44SJohn Forte /* 153*7ff83669SZhong Wang * ID code for the job or task to be performed. Set by fctl_alloc_job() 154fcf3ce44SJohn Forte * and read by fp_job_handler(). 155fcf3ce44SJohn Forte */ 156fcf3ce44SJohn Forte int job_code; 157fcf3ce44SJohn Forte 158fcf3ce44SJohn Forte /* 159fcf3ce44SJohn Forte * Completion status of the request. Typically FC_SUCCESS or 160fcf3ce44SJohn Forte * FC_FAILURE, but may make use of other error code values (such as 161fcf3ce44SJohn Forte * FC_OFFLINE, FC_BADCMD, FC_NO_MAP, and friends). The complete set 162fcf3ce44SJohn Forte * of values is not clearly specified. 163fcf3ce44SJohn Forte */ 164fcf3ce44SJohn Forte int job_result; 165fcf3ce44SJohn Forte 166fcf3ce44SJohn Forte /* Execution control flags (defined below) */ 167fcf3ce44SJohn Forte int job_flags; 168fcf3ce44SJohn Forte 169fcf3ce44SJohn Forte /* 170fcf3ce44SJohn Forte * This allows multiple concurrent operations using the same 171fcf3ce44SJohn Forte * job_request_t struct, such as a PLOGI to a group of remote ports 172fcf3ce44SJohn Forte * (see fp_plogi_group()). 173fcf3ce44SJohn Forte * 174fcf3ce44SJohn Forte * This is why this scheme needs the job_mutex to protect 175fcf3ce44SJohn Forte * the job_counter variable, plus the additional job_port_sema for 176fcf3ce44SJohn Forte * synchronizing thread(s). 177fcf3ce44SJohn Forte */ 178fcf3ce44SJohn Forte int job_counter; 179fcf3ce44SJohn Forte 180fcf3ce44SJohn Forte 181fcf3ce44SJohn Forte opaque_t job_cb_arg; /* callback func arg */ 182fcf3ce44SJohn Forte 183fcf3ce44SJohn Forte kmutex_t job_mutex; 184fcf3ce44SJohn Forte ksema_t job_fctl_sema; 185fcf3ce44SJohn Forte ksema_t job_port_sema; 186fcf3ce44SJohn Forte 187fcf3ce44SJohn Forte 188fcf3ce44SJohn Forte void (*job_comp) (opaque_t, uchar_t result); 189fcf3ce44SJohn Forte fc_packet_t **job_ulp_pkts; 190fcf3ce44SJohn Forte uint32_t job_ulp_listlen; /* packet list length */ 191fcf3ce44SJohn Forte void *job_private; /* caller's private */ 192fcf3ce44SJohn Forte void *job_arg; /* caller's argument */ 193fcf3ce44SJohn Forte 194fcf3ce44SJohn Forte /* 195fcf3ce44SJohn Forte * Pointer for singly-liked list of outstanding job_request structs, 196fcf3ce44SJohn Forte * maintained on a per-instance basis by the fp_port_head and 197fcf3ce44SJohn Forte * fp_port_tail pointers in the fc_local_port_t struct. 198fcf3ce44SJohn Forte */ 199*7ff83669SZhong Wang struct job_request *job_next; 200fcf3ce44SJohn Forte } job_request_t; 201fcf3ce44SJohn Forte 202fcf3ce44SJohn Forte 203fcf3ce44SJohn Forte #if !defined(__lint) 204fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", 205fcf3ce44SJohn Forte job_request::job_code job_request::job_result job_request::job_flags 206fcf3ce44SJohn Forte job_request::job_cb_arg job_request::job_comp 207fcf3ce44SJohn Forte job_request::job_ulp_pkts job_request::job_ulp_listlen 208fcf3ce44SJohn Forte job_request::job_private job_request::job_arg)) 209fcf3ce44SJohn Forte _NOTE(MUTEX_PROTECTS_DATA(fc_local_port::fp_mutex, job_request::job_next)) 210fcf3ce44SJohn Forte _NOTE(MUTEX_PROTECTS_DATA(job_request::job_mutex, job_request::job_counter)) 211fcf3ce44SJohn Forte #endif /* __lint */ 212fcf3ce44SJohn Forte 213fcf3ce44SJohn Forte 214fcf3ce44SJohn Forte /* 215fcf3ce44SJohn Forte * Values for the job_code field in the job_request_t struct. 216fcf3ce44SJohn Forte */ 217fcf3ce44SJohn Forte #define JOB_ATTACH_ULP 1 /* ULP call to fc_ulp_add() */ 218fcf3ce44SJohn Forte #define JOB_PORT_STARTUP 2 219fcf3ce44SJohn Forte #define JOB_PORT_GETMAP 3 220fcf3ce44SJohn Forte #define JOB_PORT_GETMAP_PLOGI_ALL 4 221fcf3ce44SJohn Forte #define JOB_PLOGI_ONE 5 222fcf3ce44SJohn Forte #define JOB_PLOGI_GROUP 6 223fcf3ce44SJohn Forte #define JOB_LOGO_ONE 7 224fcf3ce44SJohn Forte #define JOB_PORT_OFFLINE 8 225fcf3ce44SJohn Forte #define JOB_PORT_ONLINE 9 226fcf3ce44SJohn Forte 227fcf3ce44SJohn Forte /* Prepare the local port and the driver softstate for a DDI_DETACH. */ 228fcf3ce44SJohn Forte #define JOB_PORT_SHUTDOWN 10 229fcf3ce44SJohn Forte 230fcf3ce44SJohn Forte /* Handle an unsolicited request in the job thread */ 231fcf3ce44SJohn Forte #define JOB_UNSOL_REQUEST 11 232fcf3ce44SJohn Forte 233fcf3ce44SJohn Forte #define JOB_NS_CMD 12 234fcf3ce44SJohn Forte #define JOB_LINK_RESET 13 235fcf3ce44SJohn Forte #define JOB_ULP_NOTIFY 14 236fcf3ce44SJohn Forte 237fcf3ce44SJohn Forte #define JOB_FCIO_LOGIN 15 238fcf3ce44SJohn Forte #define JOB_FCIO_LOGOUT 16 239fcf3ce44SJohn Forte 240fcf3ce44SJohn Forte /* 241fcf3ce44SJohn Forte * This is used for requests that will not actually be dispatched to the job 242fcf3ce44SJohn Forte * thread. 243fcf3ce44SJohn Forte */ 244fcf3ce44SJohn Forte #define JOB_DUMMY 127 245fcf3ce44SJohn Forte 246fcf3ce44SJohn Forte 247fcf3ce44SJohn Forte /* 248fcf3ce44SJohn Forte * Bitmask values for the job_flags field in the job_request_t struct. 249fcf3ce44SJohn Forte * 250fcf3ce44SJohn Forte * JOB_TYPE_FCTL_ASYNC is set in various places in fp and fctl. If set then 251fcf3ce44SJohn Forte * fctl_jobdone() will call the completion function in the job_comp field and 252*7ff83669SZhong Wang * deallocate the job_request_t struct. If not set then fctl_jobdone() will 253fcf3ce44SJohn Forte * sema_v() the job_fctl_sema to wake up any waiting thread. This bit is also 254fcf3ce44SJohn Forte * checked in fc_ulp_login(): if *clear* then fc_ulp_login() will call 255fcf3ce44SJohn Forte * fctl_jobwait() in order to block the calling thread in the job_fctl_sema, and 256fcf3ce44SJohn Forte * then call fctl_dealloc_job() after fctl_jobwait() returns. 257fcf3ce44SJohn Forte * 258fcf3ce44SJohn Forte * JOB_TYPE_FP_ASYNC is set in various places in fp. If set then fp_jobdone() 259fcf3ce44SJohn Forte * will call fctl_jobdone(); if clear then fp_jobdone() will sema_v() the 260*7ff83669SZhong Wang * job_port_sema in the job_request_t. fp_port_shutdown() also looks for 261fcf3ce44SJohn Forte * JOB_TYPE_FP_ASYNC. Just to keep thing interesting, JOB_TYPE_FP_ASYNC is 262fcf3ce44SJohn Forte * also set in fp_validate_area_domain() and cleared in fp_fcio_login() and 263fcf3ce44SJohn Forte * fp_ns_get_devcount() 264fcf3ce44SJohn Forte * 265fcf3ce44SJohn Forte * The apparent purpose of all this is to allow nested job requests to 266fcf3ce44SJohn Forte * occur in parallel. 267fcf3ce44SJohn Forte * 268fcf3ce44SJohn Forte * JOB_CANCEL_ULP_NOTIFICATION appears to be intended to the number of 269fcf3ce44SJohn Forte * state change callbacks that are reported to ULPs when mutiple state 270fcf3ce44SJohn Forte * changes are being processed in parallel. 271fcf3ce44SJohn Forte */ 272fcf3ce44SJohn Forte #define JOB_TYPE_FCTL_ASYNC 0x01 273fcf3ce44SJohn Forte #define JOB_TYPE_FP_ASYNC 0x02 274fcf3ce44SJohn Forte #define JOB_CANCEL_ULP_NOTIFICATION 0x10 275fcf3ce44SJohn Forte 276fcf3ce44SJohn Forte 277fcf3ce44SJohn Forte 278fcf3ce44SJohn Forte typedef struct fc_port_clist { 279fcf3ce44SJohn Forte opaque_t clist_port; /* port handle */ 280fcf3ce44SJohn Forte uint32_t clist_state; /* port state */ 281fcf3ce44SJohn Forte uint32_t clist_len; /* map len */ 282fcf3ce44SJohn Forte uint32_t clist_size; /* alloc len */ 283*7ff83669SZhong Wang fc_portmap_t *clist_map; /* changelist */ 284fcf3ce44SJohn Forte uint32_t clist_flags; /* port topology */ 285fcf3ce44SJohn Forte uint32_t clist_wait; /* for synchronous requests */ 286fcf3ce44SJohn Forte kmutex_t clist_mutex; /* clist lock */ 287fcf3ce44SJohn Forte kcondvar_t clist_cv; /* clist cv */ 288fcf3ce44SJohn Forte } fc_port_clist_t; 289fcf3ce44SJohn Forte 290fcf3ce44SJohn Forte #if !defined(__lint) 291fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per state change", fc_port_clist)) 292fcf3ce44SJohn Forte #endif /* __lint */ 293fcf3ce44SJohn Forte 294fcf3ce44SJohn Forte /* 295fcf3ce44SJohn Forte * The cmd_size and resp_size shouldn't include the CT HEADER. 296fcf3ce44SJohn Forte * 297fcf3ce44SJohn Forte * For commands like GAN, the ns_resp_size should indicate the 298fcf3ce44SJohn Forte * total number of bytes allocated in the ns_resp_buf to get all 299fcf3ce44SJohn Forte * the NS objects. 300fcf3ce44SJohn Forte */ 301fcf3ce44SJohn Forte typedef struct fctl_ns_req { 302fcf3ce44SJohn Forte int ns_result; 303fcf3ce44SJohn Forte uint32_t ns_gan_index; 304fcf3ce44SJohn Forte uint32_t ns_gan_sid; 305fcf3ce44SJohn Forte uint32_t ns_flags; 306fcf3ce44SJohn Forte uint16_t ns_cmd_code; /* NS command code */ 307fcf3ce44SJohn Forte caddr_t ns_cmd_buf; /* NS command buffer */ 308fcf3ce44SJohn Forte uint16_t ns_cmd_size; /* NS command length */ 309fcf3ce44SJohn Forte uint16_t ns_resp_size; /* NS response length */ 310fcf3ce44SJohn Forte caddr_t ns_data_buf; /* User buffer */ 311fcf3ce44SJohn Forte uint32_t ns_data_len; /* User buffer length */ 312fcf3ce44SJohn Forte uint32_t ns_gan_max; 313fcf3ce44SJohn Forte fc_ct_header_t ns_resp_hdr; 314fcf3ce44SJohn Forte fc_remote_port_t *ns_pd; 315fcf3ce44SJohn Forte } fctl_ns_req_t; 316fcf3ce44SJohn Forte 317fcf3ce44SJohn Forte #if !defined(__lint) 318fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per state change", fctl_ns_req)) 319fcf3ce44SJohn Forte #endif /* __lint */ 320fcf3ce44SJohn Forte 321fcf3ce44SJohn Forte /* 322fcf3ce44SJohn Forte * Orphan list of Port WWNs 323fcf3ce44SJohn Forte */ 324fcf3ce44SJohn Forte typedef struct fc_orphan { 325fcf3ce44SJohn Forte int orp_nscan; /* Number of scans */ 326fcf3ce44SJohn Forte clock_t orp_tstamp; /* When it disappeared */ 327fcf3ce44SJohn Forte la_wwn_t orp_pwwn; /* Port WWN */ 328fcf3ce44SJohn Forte struct fc_orphan *orp_next; /* Next orphan */ 329fcf3ce44SJohn Forte } fc_orphan_t; 330fcf3ce44SJohn Forte 331*7ff83669SZhong Wang #define FC_GET_RSP(x_port, x_handle, x_dest, x_src, x_size, x_flag) \ 332*7ff83669SZhong Wang { \ 333*7ff83669SZhong Wang if (!((x_port)->fp_soft_state & FP_SOFT_FCA_IS_NODMA)) {\ 334*7ff83669SZhong Wang ddi_rep_get8((x_handle), (uint8_t *)(x_dest), \ 335*7ff83669SZhong Wang (uint8_t *)(x_src), (x_size), \ 336*7ff83669SZhong Wang (x_flag)); \ 337*7ff83669SZhong Wang } else { \ 338*7ff83669SZhong Wang bcopy((x_src), (x_dest), (x_size)); \ 339*7ff83669SZhong Wang } \ 340*7ff83669SZhong Wang } 341*7ff83669SZhong Wang 342*7ff83669SZhong Wang #define FC_SET_CMD(x_port, x_handle, x_src, x_dest, x_size, x_flag) \ 343*7ff83669SZhong Wang { \ 344*7ff83669SZhong Wang if (!((x_port)->fp_soft_state & FP_SOFT_FCA_IS_NODMA)) {\ 345*7ff83669SZhong Wang ddi_rep_put8((x_handle), (uint8_t *)(x_src), \ 346*7ff83669SZhong Wang (uint8_t *)(x_dest), (x_size), \ 347*7ff83669SZhong Wang (x_flag)); \ 348*7ff83669SZhong Wang } else { \ 349*7ff83669SZhong Wang bcopy((x_src), (x_dest), (x_size)); \ 350*7ff83669SZhong Wang } \ 351*7ff83669SZhong Wang } 352*7ff83669SZhong Wang 353fcf3ce44SJohn Forte #if !defined(__lint) 354fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("scans don't interleave", 355*7ff83669SZhong Wang fc_orphan::orp_nscan fc_orphan::orp_pwwn fc_orphan::orp_tstamp)) 356fcf3ce44SJohn Forte _NOTE(MUTEX_PROTECTS_DATA(fc_local_port::fp_mutex, fc_orphan::orp_next)) 357fcf3ce44SJohn Forte #endif /* __lint */ 358fcf3ce44SJohn Forte 359fcf3ce44SJohn Forte fc_remote_node_t *fctl_create_remote_node(la_wwn_t *nwwn, int sleep); 360fcf3ce44SJohn Forte void fctl_destroy_remote_node(fc_remote_node_t *rnp); 361fcf3ce44SJohn Forte fc_remote_port_t *fctl_create_remote_port(fc_local_port_t *port, 362fcf3ce44SJohn Forte la_wwn_t *node_wwn, la_wwn_t *port_wwn, uint32_t d_id, 363fcf3ce44SJohn Forte uchar_t recepient, int sleep); 364fcf3ce44SJohn Forte int fctl_destroy_remote_port(fc_local_port_t *port, fc_remote_port_t *pd); 365fcf3ce44SJohn Forte fc_remote_port_t *fctl_alloc_remote_port(fc_local_port_t *port, 366fcf3ce44SJohn Forte la_wwn_t *port_wwn, uint32_t d_id, uchar_t recepient, int sleep); 367fcf3ce44SJohn Forte void fctl_dealloc_remote_port(fc_remote_port_t *pd); 368fcf3ce44SJohn Forte void fctl_release_remote_port(fc_remote_port_t *pd); 369fcf3ce44SJohn Forte void fctl_destroy_all_remote_ports(fc_local_port_t *port); 370fcf3ce44SJohn Forte void fctl_link_remote_port_to_remote_node(fc_remote_node_t *rnp, 371fcf3ce44SJohn Forte fc_remote_port_t *pd); 372fcf3ce44SJohn Forte int fctl_unlink_remote_port_from_remote_node(fc_remote_node_t *rnp, 373fcf3ce44SJohn Forte fc_remote_port_t *pd); 374fcf3ce44SJohn Forte 375fcf3ce44SJohn Forte job_request_t *fctl_alloc_job(int job_code, int job_flags, 376fcf3ce44SJohn Forte void (*comp) (opaque_t, uchar_t), opaque_t arg, int sleep); 377fcf3ce44SJohn Forte void fctl_dealloc_job(job_request_t *job); 378fcf3ce44SJohn Forte void fctl_enque_job(fc_local_port_t *port, job_request_t *job); 379fcf3ce44SJohn Forte void fctl_priority_enque_job(fc_local_port_t *port, job_request_t *job); 380fcf3ce44SJohn Forte job_request_t *fctl_deque_job(fc_local_port_t *port); 381fcf3ce44SJohn Forte void fctl_jobwait(job_request_t *job); 382fcf3ce44SJohn Forte void fctl_jobdone(job_request_t *job); 383fcf3ce44SJohn Forte 384fcf3ce44SJohn Forte void fctl_attach_ulps(fc_local_port_t *port, fc_attach_cmd_t cmd, 385fcf3ce44SJohn Forte struct modlinkage *linkage); 386fcf3ce44SJohn Forte int fctl_detach_ulps(fc_local_port_t *port, fc_detach_cmd_t cmd, 387fcf3ce44SJohn Forte struct modlinkage *linkage); 388fcf3ce44SJohn Forte 389fcf3ce44SJohn Forte void fctl_add_port(fc_local_port_t *port); 390fcf3ce44SJohn Forte void fctl_remove_port(fc_local_port_t *port); 391fcf3ce44SJohn Forte int fctl_busy_port(fc_local_port_t *port); 392fcf3ce44SJohn Forte void fctl_idle_port(fc_local_port_t *port); 393fcf3ce44SJohn Forte 394fcf3ce44SJohn Forte fc_remote_port_t *fctl_get_remote_port_by_did(fc_local_port_t *port, 395fcf3ce44SJohn Forte uint32_t d_id); 396fcf3ce44SJohn Forte fc_remote_port_t *fctl_hold_remote_port_by_did(fc_local_port_t *port, 397fcf3ce44SJohn Forte uint32_t d_id); 398fcf3ce44SJohn Forte fc_remote_port_t *fctl_get_remote_port_by_pwwn(fc_local_port_t *port, 399fcf3ce44SJohn Forte la_wwn_t *pwwn); 400fcf3ce44SJohn Forte fc_remote_port_t *fctl_hold_remote_port_by_pwwn(fc_local_port_t *port, 401fcf3ce44SJohn Forte la_wwn_t *pwwn); 402fcf3ce44SJohn Forte fc_remote_port_t * 403fcf3ce44SJohn Forte fctl_get_remote_port_by_pwwn_mutex_held(fc_local_port_t *port, 404fcf3ce44SJohn Forte la_wwn_t *pwwn); 405fcf3ce44SJohn Forte fc_remote_node_t *fctl_get_remote_node_by_nwwn(la_wwn_t *node_wwn); 406fcf3ce44SJohn Forte fc_remote_node_t *fctl_lock_remote_node_by_nwwn(la_wwn_t *node_wwn); 407fcf3ce44SJohn Forte fc_remote_port_t *fctl_lookup_pd_by_did(fc_local_port_t *port, uint32_t d_id); 408fcf3ce44SJohn Forte fc_remote_port_t *fctl_lookup_pd_by_index(fc_local_port_t *port, 409fcf3ce44SJohn Forte uint32_t index); 410fcf3ce44SJohn Forte fc_remote_port_t *fctl_lookup_pd_by_wwn(fc_local_port_t *port, la_wwn_t wwn); 411fcf3ce44SJohn Forte 412fcf3ce44SJohn Forte void fctl_enlist_did_table(fc_local_port_t *port, fc_remote_port_t *pd); 413fcf3ce44SJohn Forte void fctl_delist_did_table(fc_local_port_t *port, fc_remote_port_t *pd); 414fcf3ce44SJohn Forte void fctl_enlist_pwwn_table(fc_local_port_t *port, fc_remote_port_t *pd); 415fcf3ce44SJohn Forte void fctl_delist_pwwn_table(fc_local_port_t *port, fc_remote_port_t *pd); 416fcf3ce44SJohn Forte int fctl_enlist_nwwn_table(fc_remote_node_t *rnp, int sleep); 417fcf3ce44SJohn Forte void fctl_delist_nwwn_table(fc_remote_node_t *rnp); 418fcf3ce44SJohn Forte 419fcf3ce44SJohn Forte void fctl_ulp_statec_cb(void *arg); 420fcf3ce44SJohn Forte void fctl_ulp_unsol_cb(fc_local_port_t *port, fc_unsol_buf_t *buf, 421fcf3ce44SJohn Forte uchar_t type); 422fcf3ce44SJohn Forte int fctl_ulp_port_ioctl(fc_local_port_t *port, dev_t dev, int cmd, 423fcf3ce44SJohn Forte intptr_t data, int mode, cred_t *credp, int *rval); 424fcf3ce44SJohn Forte 425fcf3ce44SJohn Forte void fctl_fillout_map(fc_local_port_t *port, fc_portmap_t **map, 426fcf3ce44SJohn Forte uint32_t *len, int whole_map, int justcopy, int orphan); 427fcf3ce44SJohn Forte void fctl_copy_portmap_held(fc_portmap_t *map, fc_remote_port_t *pd); 428fcf3ce44SJohn Forte void fctl_copy_portmap(fc_portmap_t *map, fc_remote_port_t *pd); 429fcf3ce44SJohn Forte 430fcf3ce44SJohn Forte fctl_ns_req_t *fctl_alloc_ns_cmd(uint32_t cmd_len, uint32_t resp_len, 431fcf3ce44SJohn Forte uint32_t data_len, uint32_t ns_flags, int sleep); 432fcf3ce44SJohn Forte void fctl_free_ns_cmd(fctl_ns_req_t *ns_cmd); 433fcf3ce44SJohn Forte 434fcf3ce44SJohn Forte int fctl_remove_if_orphan(fc_local_port_t *port, la_wwn_t *pwwn); 435fcf3ce44SJohn Forte int fctl_add_orphan_held(fc_local_port_t *port, fc_remote_port_t *pd); 436fcf3ce44SJohn Forte int fctl_add_orphan(fc_local_port_t *port, fc_remote_port_t *pd, int sleep); 437fcf3ce44SJohn Forte void fctl_remove_oldies(fc_local_port_t *port); 438fcf3ce44SJohn Forte 439fcf3ce44SJohn Forte int fctl_is_wwn_zero(la_wwn_t *wwn); 440fcf3ce44SJohn Forte int fctl_wwn_cmp(la_wwn_t *src, la_wwn_t *dst); 441fcf3ce44SJohn Forte int fctl_atoi(caddr_t string, int base); 442fcf3ce44SJohn Forte int fctl_count_fru_ports(fc_local_port_t *port, int npivflag); 443fcf3ce44SJohn Forte fc_local_port_t *fctl_get_adapter_port_by_index(fc_local_port_t *port, 444fcf3ce44SJohn Forte uint32_t port_index); 445fcf3ce44SJohn Forte 446fcf3ce44SJohn Forte void fctl_tc_constructor(timed_counter_t *tc, uint32_t max_value, 447fcf3ce44SJohn Forte clock_t timer); 448fcf3ce44SJohn Forte void fctl_tc_destructor(timed_counter_t *tc); 449fcf3ce44SJohn Forte boolean_t fctl_tc_increment(timed_counter_t *tc); 450fcf3ce44SJohn Forte void fctl_tc_reset(timed_counter_t *tc); 451fcf3ce44SJohn Forte 452fcf3ce44SJohn Forte #ifdef __cplusplus 453fcf3ce44SJohn Forte } 454fcf3ce44SJohn Forte #endif 455fcf3ce44SJohn Forte 456fcf3ce44SJohn Forte #endif /* _FC_PORTIF_H */ 457