1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2009 Emulex. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _EMLXS_EXTERN_H 28 #define _EMLXS_EXTERN_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 extern void *emlxs_soft_state; 35 extern uint32_t emlxs_instance[MAX_FC_BRDS]; 36 extern uint32_t emlxs_instance_count; 37 extern char emlxs_revision[32]; 38 extern char emlxs_version[32]; 39 extern char emlxs_name[64]; 40 extern char emlxs_label[64]; 41 42 extern emlxs_device_t emlxs_device; 43 extern uint32_t emlxs_instance[MAX_FC_BRDS]; 44 extern uint32_t emlxs_instance_count; 45 46 extern ddi_device_acc_attr_t emlxs_data_acc_attr; 47 extern ddi_device_acc_attr_t emlxs_dev_acc_attr; 48 extern ddi_dma_lim_t emlxs_dma_lim; 49 extern uint32_t emlxs_diag_state; 50 extern emlxs_config_t emlxs_cfg[]; 51 extern ddi_dma_attr_t emlxs_dma_attr; 52 extern ddi_dma_attr_t emlxs_dma_attr_ro; 53 extern ddi_dma_attr_t emlxs_dma_attr_fcip_rsp; 54 extern ddi_dma_attr_t emlxs_dma_attr_1sg; 55 56 /* Module emlxs_msg.c External Routine Declarations */ 57 extern void emlxs_msg_printf(emlxs_port_t *port, 58 const uint32_t fileno, 59 const uint32_t line, 60 emlxs_msg_t *msg, 61 const char *fmt, ...); 62 extern uint32_t emlxs_msg_log_create(emlxs_hba_t *hba); 63 extern uint32_t emlxs_msg_log_destroy(emlxs_hba_t *hba); 64 extern uint32_t emlxs_msg_log_get(emlxs_hba_t *hba, 65 emlxs_log_req_t *req, 66 emlxs_log_resp_t *resp); 67 68 /* Module emlxs_event.c External Routine Declarations */ 69 extern void emlxs_timer_check_events(emlxs_hba_t *hba); 70 71 extern uint32_t emlxs_event_queue_create(emlxs_hba_t *hba); 72 73 extern void emlxs_event_queue_destroy(emlxs_hba_t *hba); 74 75 extern void emlxs_event(emlxs_port_t *port, 76 emlxs_event_t *evt, void *bp, 77 uint32_t size); 78 extern void emlxs_log_dump_event(emlxs_port_t *port, 79 uint8_t *buffer, uint32_t size); 80 extern void emlxs_log_link_event(emlxs_port_t *port); 81 82 extern uint32_t emlxs_log_ct_event(emlxs_port_t *port, 83 uint8_t *payload, uint32_t size, 84 uint32_t rxid); 85 extern void emlxs_log_rscn_event(emlxs_port_t *port, 86 uint8_t *payload, uint32_t size); 87 extern void emlxs_log_vportrscn_event(emlxs_port_t *port, 88 uint8_t *payload, uint32_t size); 89 extern uint32_t emlxs_get_dfc_event(emlxs_port_t *port, 90 emlxs_dfc_event_t *dfc_event, 91 uint32_t sleep); 92 extern uint32_t emlxs_kill_dfc_event(emlxs_port_t *port, 93 emlxs_dfc_event_t *dfc_event); 94 extern uint32_t emlxs_get_dfc_eventinfo(emlxs_port_t *port, 95 HBA_EVENTINFO *eventinfo, 96 uint32_t *eventcount, 97 uint32_t *missed); 98 extern void emlxs_log_temp_event(emlxs_port_t *port, 99 uint32_t type, uint32_t temp); 100 extern void emlxs_log_fcoe_event(emlxs_port_t *port, 101 menlo_init_rsp_t *init_rsp); 102 extern void emlxs_log_async_event(emlxs_port_t *port, 103 IOCB *iocb); 104 105 #ifdef SAN_DIAG_SUPPORT 106 extern uint32_t emlxs_get_sd_event(emlxs_port_t *port, 107 emlxs_dfc_event_t *dfc_event, 108 uint32_t sleep); 109 extern void emlxs_log_sd_basic_els_event(emlxs_port_t *port, 110 uint32_t subcat, HBA_WWN *portname, 111 HBA_WWN *nodename); 112 extern void emlxs_log_sd_prlo_event(emlxs_port_t *port, 113 HBA_WWN *portname); 114 extern void emlxs_log_sd_lsrjt_event(emlxs_port_t *port, 115 HBA_WWN *remoteport, uint32_t orig_cmd, 116 uint32_t reason, uint32_t reason_expl); 117 extern void emlxs_log_sd_fc_bsy_event(emlxs_port_t *port, 118 HBA_WWN *remoteport); 119 extern void emlxs_log_sd_fc_rdchk_event(emlxs_port_t *port, 120 HBA_WWN *remoteport, uint32_t lun, 121 uint32_t opcode, uint32_t fcp_param); 122 extern void emlxs_log_sd_scsi_event(emlxs_port_t *port, 123 uint32_t type, HBA_WWN *remoteport, 124 int32_t lun); 125 extern void emlxs_log_sd_scsi_check_event( 126 emlxs_port_t *port, 127 HBA_WWN *remoteport, uint32_t lun, 128 uint32_t cmdcode, uint32_t sensekey, 129 uint32_t asc, uint32_t ascq); 130 #endif /* SAN_DIAG_SUPPORT */ 131 132 /* Module emlxs_solaris.c External Routine Declarations */ 133 extern int32_t emlxs_pkt_abort(opaque_t fca_port_handle, 134 fc_packet_t *pkt, int32_t sleep); 135 extern char *emlxs_state_xlate(uint8_t state); 136 extern char *emlxs_error_xlate(uint8_t errno); 137 extern void emlxs_mem_free(emlxs_hba_t *hba, 138 MBUF_INFO *buf_info); 139 extern uint8_t *emlxs_mem_alloc(emlxs_hba_t *hba, 140 MBUF_INFO *buf_info); 141 extern int emlxs_map_bus(emlxs_hba_t *hba); 142 extern void emlxs_unmap_bus(emlxs_hba_t *hba); 143 extern fc_unsol_buf_t *emlxs_ub_find(emlxs_port_t *port, 144 uint32_t token); 145 extern fc_unsol_buf_t *emlxs_ub_get(emlxs_port_t *port, uint32_t size, 146 uint32_t type, uint32_t resv); 147 extern int32_t emlxs_log_printf(int32_t f, int32_t type, 148 int32_t num, int32_t brdno, 149 const char *fmt, ...); 150 extern void emlxs_set_pkt_state(emlxs_buf_t *sbp, 151 uint32_t iostat, uint8_t localstat, 152 uint32_t lock); 153 extern char *emlxs_elscmd_xlate(uint32_t cmd); 154 extern char *emlxs_ctcmd_xlate(uint32_t cmd); 155 extern char *emlxs_rmcmd_xlate(uint32_t cmd); 156 extern char *emlxs_wwn_xlate(char *buffer, uint8_t *wwn); 157 extern int32_t emlxs_transport(opaque_t fca_port_handle, 158 fc_packet_t *pkt); 159 extern int32_t emlxs_pkt_uninit(opaque_t fca_port_handle, 160 fc_packet_t *pkt); 161 extern int32_t emlxs_pkt_init(opaque_t fca_port_handle, 162 fc_packet_t *pkt, int32_t sleep); 163 extern void emlxs_pkt_complete(emlxs_buf_t *sbp, 164 uint32_t iostat, uint8_t localstat, 165 uint32_t doneq); 166 167 #ifdef SAN_DIAG_SUPPORT 168 extern void emlxs_update_sd_bucket(emlxs_buf_t *sbp); 169 #endif /* SAN_DIAG_SUPPORT */ 170 171 extern uint32_t emlxs_get_instance(int32_t ddiinst); 172 extern char *emlxs_mscmd_xlate(uint16_t cmd); 173 extern int32_t emlxs_reset(opaque_t fca_port_handle, 174 uint32_t cmd); 175 extern void emlxs_swap_service_params(SERV_PARM *sp); 176 extern void emlxs_swap_fcp_pkt(emlxs_buf_t *sbp); 177 extern void emlxs_swap_ct_pkt(emlxs_buf_t *sbp); 178 extern void emlxs_swap_els_pkt(emlxs_buf_t *sbp); 179 extern int emlxs_ub_release(opaque_t fca_port_handle, 180 uint32_t count, uint64_t tokens[]); 181 extern void emlxs_swap_els_ub(fc_unsol_buf_t *ubp); 182 extern void emlxs_unswap_pkt(emlxs_buf_t *sbp); 183 extern uint32_t emlxs_get_key(emlxs_hba_t *hba, MAILBOXQ *mbq); 184 extern int emlxs_pm_busy_component(dev_info_t *dip); 185 extern int emlxs_pm_idle_component(dev_info_t *dip); 186 extern void emlxs_pm_idle_timer(dev_info_t *dip); 187 extern void emlxs_shutdown_thread(emlxs_hba_t *hba, 188 void *arg1, void *arg2); 189 extern uint32_t emlxs_set_parm(emlxs_hba_t *hba, uint32_t index, 190 uint32_t new_value); 191 extern void emlxs_ub_destroy(emlxs_port_t *port, 192 emlxs_unsol_buf_t *pool); 193 extern void emlxs_ub_callback(emlxs_port_t *port, 194 fc_unsol_buf_t *ubp); 195 extern void emlxs_ub_flush(emlxs_port_t *port); 196 extern uint32_t emlxs_check_parm(emlxs_hba_t *hba, 197 uint32_t index, uint32_t new_value); 198 extern int32_t emlxs_port_manage(opaque_t fca_port_handle, 199 fc_fca_pm_t *pm); 200 extern void emlxs_port_init(emlxs_port_t *port); 201 extern void emlxs_get_fcode_version(emlxs_hba_t *hba); 202 203 extern void emlxs_swap32_buffer(uint8_t *buffer, 204 uint32_t size); 205 extern void emlxs_swap32_bcopy(uint8_t *src, 206 uint8_t *dst, uint32_t size); 207 208 #ifdef MENLO_SUPPORT 209 extern char *emlxs_menlo_cmd_xlate(uint32_t cmd); 210 extern char *emlxs_menlo_rsp_xlate(uint32_t rsp); 211 #endif /* MENLO_SUPPORT */ 212 213 #ifdef FMA_SUPPORT 214 extern void emlxs_fm_init(emlxs_hba_t *hba); 215 extern void emlxs_fm_fini(emlxs_hba_t *hba); 216 extern int emlxs_fm_check_acc_handle(emlxs_hba_t *hba, 217 ddi_acc_handle_t handle); 218 extern int emlxs_fm_check_dma_handle(emlxs_hba_t *hba, 219 ddi_dma_handle_t handle); 220 extern void emlxs_fm_ereport(emlxs_hba_t *hba, 221 char *detail); 222 extern void emlxs_fm_service_impact(emlxs_hba_t *hba, 223 int impact); 224 extern int emlxs_fm_error_cb(dev_info_t *dip, 225 ddi_fm_error_t *err, 226 const void *impl_data); 227 extern void emlxs_check_dma(emlxs_hba_t *hba, 228 emlxs_buf_t *sbp); 229 #endif /* FMA_SUPPORT */ 230 231 /* Module emlxs_pkt.c External Routine Declarations */ 232 extern int32_t emlxs_pkt_send(fc_packet_t *pkt, uint32_t now); 233 extern void emlxs_pkt_free(fc_packet_t *pkt); 234 extern void emlxs_pkt_callback(fc_packet_t *pkt); 235 extern fc_packet_t *emlxs_pkt_alloc(emlxs_port_t *port, 236 uint32_t cmdlen, uint32_t rsplen, 237 uint32_t datalen, int32_t sleep); 238 239 /* Module emlxs_clock.c External Routine Declarations */ 240 extern void emlxs_timer_checks(emlxs_hba_t *hba); 241 extern void emlxs_timer_start(emlxs_hba_t *hba); 242 extern void emlxs_timer_stop(emlxs_hba_t *hba); 243 extern void emlxs_link_timeout(emlxs_hba_t *hba); 244 extern clock_t emlxs_timeout(emlxs_hba_t *hba, 245 uint32_t timeout); 246 247 /* Module emlxs_dhchap.c External Routine Declarations */ 248 #ifdef DHCHAP_SUPPORT 249 extern int emlxs_dhchap_state_machine(emlxs_port_t *port, 250 CHANNEL *cp, IOCBQ *iocbq, 251 MATCHMAP *mp, NODELIST *node, int evt); 252 253 extern void emlxs_dhc_attach(emlxs_hba_t *hba); 254 extern void emlxs_dhc_detach(emlxs_hba_t *hba); 255 extern void emlxs_dhc_authrsp_timeout(emlxs_port_t *port, 256 void *node, void *null); 257 extern void emlxs_dhc_reauth_timeout(emlxs_port_t *port, 258 void *newtimeout, void *node); 259 extern void emlxs_dhc_auth_stop(emlxs_port_t *port, 260 emlxs_node_t *node); 261 extern int emlxs_dhc_auth_start(emlxs_port_t *port, 262 emlxs_node_t *node, uint8_t *sbp, 263 uint8_t *ubp); 264 extern void emlxs_dhc_init_sp(emlxs_port_t *port, 265 uint32_t did, SERV_PARM *sp, 266 char **msg); 267 extern uint32_t emlxs_dhc_verify_login(emlxs_port_t *port, 268 uint32_t sid, SERV_PARM *sp); 269 extern void emlxs_dhc_status(emlxs_port_t *port, 270 emlxs_node_t *ndlp, uint32_t reason, 271 uint32_t explaination); 272 extern void emlxs_dhc_state(emlxs_port_t *port, 273 emlxs_node_t *ndlp, uint32_t state, 274 uint32_t reason, 275 uint32_t explaination); 276 extern uint32_t emlxs_dhc_init_auth(emlxs_hba_t *hba, 277 uint8_t *lwwpn, uint8_t *rwwpn); 278 extern uint32_t emlxs_dhc_get_auth_cfg(emlxs_hba_t *hba, 279 dfc_fcsp_config_t *fcsp_cfg); 280 extern uint32_t emlxs_dhc_get_auth_key(emlxs_hba_t *hba, 281 dfc_auth_password_t *dfc_auth_pwd); 282 extern uint32_t emlxs_dhc_add_auth_cfg(emlxs_hba_t *hba, 283 dfc_fcsp_config_t *fcsp_cfg, 284 dfc_password_t *dfc_pwd); 285 extern uint32_t emlxs_dhc_delete_auth_cfg(emlxs_hba_t *hba, 286 dfc_fcsp_config_t *fcsp_cfg, 287 dfc_password_t *dfc_pwd); 288 extern uint32_t emlxs_dhc_set_auth_key(emlxs_hba_t *hba, 289 dfc_auth_password_t *dfc_pwd); 290 extern uint32_t emlxs_dhc_get_auth_status(emlxs_hba_t *hba, 291 dfc_auth_status_t *fcsp_status); 292 extern uint32_t emlxs_dhc_get_auth_cfg_table(emlxs_hba_t *hba, 293 dfc_fcsp_config_t *fcsp_cfg); 294 extern uint32_t emlxs_dhc_get_auth_key_table(emlxs_hba_t *hba, 295 dfc_auth_password_t *auth_pwd); 296 #endif /* DHCHAP_SUPPORT */ 297 298 /* Module emlxs_node.c External Routine Declarations */ 299 extern void emlxs_node_timeout(emlxs_port_t *port, 300 NODELIST *ndlp, uint32_t ringno); 301 extern void emlxs_node_open(emlxs_port_t *port, 302 NODELIST *ndlp, uint32_t ringno); 303 extern void emlxs_node_close(emlxs_port_t *port, 304 NODELIST *ndlp, uint32_t ringno, 305 int32_t timeout); 306 extern NODELIST *emlxs_node_find_did(emlxs_port_t *port, 307 uint32_t did); 308 extern NODELIST *emlxs_node_find_rpi(emlxs_port_t *port, 309 uint32_t rpi); 310 extern void emlxs_node_destroy_all(emlxs_port_t *port); 311 extern NODELIST *emlxs_node_find_mac(emlxs_port_t *port, 312 uint8_t *mac); 313 extern void emlxs_node_add(emlxs_port_t *port, 314 NODELIST *ndlp); 315 extern void emlxs_node_rm(emlxs_port_t *port, 316 NODELIST *ndlp); 317 extern NODELIST *emlxs_node_find_wwpn(emlxs_port_t *port, 318 uint8_t *wwpn); 319 extern NODELIST *emlxs_node_find_index(emlxs_port_t *port, 320 uint32_t index, uint32_t nports_only); 321 extern uint32_t emlxs_nport_count(emlxs_port_t *port); 322 323 /* Module emlxs_els.c External Routine Declarations */ 324 extern int32_t emlxs_els_handle_event(emlxs_hba_t *hba, 325 CHANNEL *cp, IOCBQ *temp); 326 extern int32_t emlxs_els_handle_unsol_req(emlxs_port_t *port, 327 CHANNEL *cp, IOCBQ *iocbq, 328 MATCHMAP *mp, uint32_t size); 329 extern uint32_t emlxs_generate_rscn(emlxs_port_t *port, 330 uint32_t d_id); 331 extern int32_t emlxs_ct_handle_event(emlxs_hba_t *hba, 332 CHANNEL *cp, IOCBQ *temp); 333 extern int32_t emlxs_ct_handle_unsol_req(emlxs_port_t *port, 334 CHANNEL *cp, IOCBQ *iocbq, 335 MATCHMAP *mp, uint32_t size); 336 extern int32_t emlxs_els_reply(emlxs_port_t *port, 337 IOCBQ *iocbq, uint32_t type, 338 uint32_t type2, uint32_t reason, 339 uint32_t explain); 340 extern void emlxs_send_logo(emlxs_port_t *port, 341 uint32_t d_id); 342 extern void emlxs_reset_link_thread(emlxs_hba_t *hba, 343 void *arg1, void *arg2); 344 extern uint32_t emlxs_process_unsol_flogi(emlxs_port_t *port, 345 IOCBQ *iocbq, MATCHMAP *mp, 346 uint32_t size, char *buffer); 347 extern uint32_t emlxs_process_unsol_plogi(emlxs_port_t *port, 348 IOCBQ *iocbq, MATCHMAP *mp, 349 uint32_t size, char *buffer); 350 extern uint32_t emlxs_ub_send_login_acc(emlxs_port_t *port, 351 fc_unsol_buf_t *ubp); 352 353 #ifdef MENLO_SUPPORT 354 extern int emlxs_menlo_handle_event(emlxs_hba_t *hba, 355 CHANNEL *cp, IOCBQ *iocbq); 356 #endif /* MENLO_SUPPORT */ 357 358 /* Module emlxs_ip.c External Routine Declarations */ 359 extern int32_t emlxs_ip_handle_event(emlxs_hba_t *hba, 360 CHANNEL *cp, IOCBQ *temp); 361 extern int emlxs_ip_handle_rcv_seq_list(emlxs_hba_t *hba, 362 CHANNEL *cp, IOCBQ *saveq); 363 extern int emlxs_ip_handle_unsol_req(emlxs_port_t *port, 364 CHANNEL *cp, IOCBQ *iocbq, MATCHMAP *mp, 365 uint32_t size); 366 extern int emlxs_create_xri(emlxs_port_t *port, 367 CHANNEL *cp, NODELIST *ndlp); 368 extern int emlxs_handle_create_xri(emlxs_hba_t *hba, 369 CHANNEL *cp, IOCBQ *temp); 370 extern int emlxs_handle_xri_aborted(emlxs_hba_t *hba, 371 CHANNEL *cp, IOCBQ *temp); 372 373 /* Module emlxs_mbox.c External Routine Declarations */ 374 extern void emlxs_mb_config_msi(emlxs_hba_t *hba, 375 MAILBOXQ *mbq, uint32_t *intr_map, 376 uint32_t intr_count); 377 extern void emlxs_mb_config_msix(emlxs_hba_t *hba, 378 MAILBOXQ *mbq, uint32_t *intr_map, 379 uint32_t intr_count); 380 extern void emlxs_mb_read_lnk_stat(emlxs_hba_t *hba, 381 MAILBOXQ *mbq); 382 extern void emlxs_mb_config_link(emlxs_hba_t *hba, 383 MAILBOXQ *mbq); 384 extern void emlxs_mb_config_ring(emlxs_hba_t *hba, 385 int32_t ring, MAILBOXQ *mbq); 386 extern void emlxs_mb_init_link(emlxs_hba_t *hba, 387 MAILBOXQ *mbq, uint32_t topology, 388 uint32_t linkspeed); 389 extern void emlxs_mb_down_link(emlxs_hba_t *hba, 390 MAILBOXQ *mbq); 391 extern uint32_t emlxs_mb_read_la(emlxs_hba_t *hba, 392 MAILBOXQ *mbq); 393 extern void emlxs_mb_read_nv(emlxs_hba_t *hba, 394 MAILBOXQ *mbq); 395 extern void emlxs_mb_read_rev(emlxs_hba_t *hba, 396 MAILBOXQ *mbq, uint32_t v3); 397 extern uint32_t emlxs_mb_read_rpi(emlxs_hba_t *hba, 398 uint32_t rpi, MAILBOXQ *mbq, 399 uint32_t flg); 400 extern uint32_t emlxs_mb_read_xri(emlxs_hba_t *hba, 401 uint32_t xri, MAILBOXQ *mbq, 402 uint32_t flg); 403 extern uint32_t emlxs_mb_read_sparam(emlxs_hba_t *hba, 404 MAILBOXQ *mbq); 405 extern uint32_t emlxs_mb_reg_did(emlxs_port_t *port, 406 uint32_t did, SERV_PARM *param, 407 emlxs_buf_t *sbp, fc_unsol_buf_t *ubp, 408 IOCBQ *iocbq); 409 extern void emlxs_disable_tc(emlxs_hba_t *hba, 410 MAILBOXQ *mbq); 411 extern uint32_t emlxs_mb_run_biu_diag(emlxs_hba_t *hba, 412 MAILBOXQ *mbq, uint64_t in, 413 uint64_t out); 414 extern uint32_t emlxs_mb_unreg_rpi(emlxs_port_t *port, 415 uint32_t rpi, emlxs_buf_t *sbp, 416 fc_unsol_buf_t *ubp, IOCBQ *iocbq); 417 extern uint32_t emlxs_mb_unreg_did(emlxs_port_t *port, 418 uint32_t did, emlxs_buf_t *sbp, 419 fc_unsol_buf_t *ubp, IOCBQ *iocbq); 420 extern void emlxs_mb_dump_vpd(emlxs_hba_t *hba, 421 MAILBOXQ *mbq, uint32_t offset); 422 extern void emlxs_mb_dump_fcoe(emlxs_hba_t *hba, 423 MAILBOXQ *mbq, uint32_t offset); 424 extern void emlxs_mb_config_farp(emlxs_hba_t *hba, 425 MAILBOXQ *mbq); 426 extern void emlxs_mb_read_config(emlxs_hba_t *hba, 427 MAILBOXQ *mbq); 428 extern void emlxs_mb_put(emlxs_hba_t *hba, 429 MAILBOXQ *mbq); 430 extern MAILBOXQ *emlxs_mb_get(emlxs_hba_t *hba); 431 extern void emlxs_mb_clear_la(emlxs_hba_t *hba, 432 MAILBOXQ *mbq); 433 extern void emlxs_mb_set_var(emlxs_hba_t *hba, 434 MAILBOXQ *mbq, uint32_t addr, 435 uint32_t value); 436 extern void emlxs_mb_reset_ring(emlxs_hba_t *hba, 437 MAILBOXQ *mbq, uint32_t ringno); 438 extern char *emlxs_mb_cmd_xlate(uint8_t command); 439 extern void emlxs_mb_read_status(emlxs_hba_t *hba, 440 MAILBOXQ *mbq); 441 extern int emlxs_cmpl_init_vpi(void *arg1, MAILBOXQ *mbq); 442 extern uint32_t emlxs_mb_init_vpi(emlxs_port_t *port); 443 extern int emlxs_cmpl_reg_vpi(void *arg1, MAILBOXQ *mbq); 444 extern uint32_t emlxs_mb_reg_vpi(emlxs_port_t *port, 445 emlxs_buf_t *sbp); 446 extern int emlxs_cmpl_unreg_vpi(void *arg1, MAILBOXQ *mbq); 447 extern uint32_t emlxs_mb_unreg_vpi(emlxs_port_t *port); 448 extern void emlxs_mb_fini(emlxs_hba_t *hba, 449 MAILBOX *mb, uint32_t mbxStatus); 450 extern void emlxs_mb_flush(emlxs_hba_t *hba); 451 extern void emlxs_mb_heartbeat(emlxs_hba_t *hba, 452 MAILBOXQ *mbq); 453 extern void emlxs_mb_request_features(emlxs_hba_t *hba, 454 MAILBOXQ *mbq); 455 extern int emlxs_mb_resume_rpi(emlxs_hba_t *hba, 456 emlxs_buf_t *sbp, uint16_t rpi); 457 extern void emlxs_mb_noop(emlxs_hba_t *hba, 458 MAILBOXQ *mbq); 459 extern int emlxs_mbext_noop(emlxs_hba_t *hba, 460 MAILBOXQ *mbq); 461 extern void emlxs_mb_resetport(emlxs_hba_t *hba, 462 MAILBOXQ *mbq); 463 extern void emlxs_mb_eq_create(emlxs_hba_t *hba, 464 MAILBOXQ *mbq, uint32_t num); 465 extern void emlxs_mb_cq_create(emlxs_hba_t *hba, 466 MAILBOXQ *mbq, uint32_t num); 467 extern void emlxs_mb_wq_create(emlxs_hba_t *hba, 468 MAILBOXQ *mbq, uint32_t num); 469 extern void emlxs_mb_rq_create(emlxs_hba_t *hba, 470 MAILBOXQ *mbq, uint32_t num); 471 extern void emlxs_mb_mq_create(emlxs_hba_t *hba, 472 MAILBOXQ *mbq); 473 extern void emlxs_mb_reg_fcfi(emlxs_hba_t *hba, 474 MAILBOXQ *mbq, FCFIobj_t *fcfp); 475 extern int emlxs_mb_unreg_fcfi(emlxs_hba_t *hba, 476 FCFIobj_t *fcfp); 477 extern int emlxs_mb_reg_vfi(emlxs_hba_t *hba, 478 MAILBOXQ *mb, VFIobj_t *vfip, 479 emlxs_port_t *vpip); 480 extern int emlxs_mb_unreg_vfi(emlxs_hba_t *hba, 481 VFIobj_t *vfip); 482 extern int emlxs_mbext_read_fcf_table(emlxs_hba_t *hba, 483 MAILBOXQ *mbq, uint32_t index); 484 extern int emlxs_mbext_add_fcf_table(emlxs_hba_t *hba, 485 MAILBOXQ *mbq, uint32_t index); 486 extern void emlxs_mb_async_event(emlxs_hba_t *hba, 487 MAILBOXQ *mbq); 488 extern int32_t emlxs_mb_check_sparm(emlxs_hba_t *hba, 489 SERV_PARM *nsp); 490 extern void emlxs_cmpl_mbox(emlxs_hba_t *hba, MAILBOXQ *mq); 491 extern void emlxs_mb_dump(emlxs_hba_t *hba, MAILBOXQ *mbq, 492 uint32_t offset, uint32_t words); 493 extern void emlxs_mb_retry(emlxs_hba_t *hba, MAILBOXQ *mbq); 494 extern void emlxs_mb_init(emlxs_hba_t *hba, MAILBOXQ *mbq, 495 uint32_t flag, uint32_t tmo); 496 extern void emlxs_mb_config_hbq(emlxs_hba_t *hba, 497 MAILBOXQ *mbq, int hbq_id); 498 499 /* Module emlxs_mem.c External Routine Declarations */ 500 extern MATCHMAP *emlxs_mem_get_vaddr(emlxs_hba_t *hba, 501 RING *rp, uint64_t mapbp); 502 extern uint8_t *emlxs_mem_get(emlxs_hba_t *hba, 503 uint32_t seg_id, uint32_t priority); 504 extern uint8_t *emlxs_mem_put(emlxs_hba_t *hba, 505 uint32_t seg_id, uint8_t *bp); 506 extern int32_t emlxs_mem_free_buffer(emlxs_hba_t *hba); 507 extern int32_t emlxs_mem_alloc_buffer(emlxs_hba_t *hba); 508 extern void emlxs_mem_map_vaddr(emlxs_hba_t *hba, 509 RING *rp, MATCHMAP *mp, uint32_t *haddr, 510 uint32_t *laddr); 511 extern MATCHMAP *emlxs_mem_buf_alloc(emlxs_hba_t *hba, 512 uint32_t size); 513 extern MATCHMAP *emlxs_mem_buf_free(emlxs_hba_t *hba, 514 MATCHMAP *mp); 515 extern uint32_t emlxs_hbq_alloc(emlxs_hba_t *hba, 516 uint32_t hbq_id); 517 extern MEMSEG *emlxs_mem_pool_alloc(emlxs_hba_t *hba, 518 MEMSEG *seg); 519 extern void emlxs_mem_pool_free(emlxs_hba_t *hba, 520 MEMSEG *seg); 521 extern uint8_t *emlxs_mem_pool_get(emlxs_hba_t *hba, 522 MEMSEG *seg, uint32_t priority); 523 extern MEMSEG *emlxs_mem_pool_put(emlxs_hba_t *hba, 524 MEMSEG *seg, uint8_t *bp); 525 526 /* Module emlxs_hba.c External Routine Declarations */ 527 extern void emlxs_decode_firmware_rev(emlxs_hba_t *hba, 528 emlxs_vpd_t *vp); 529 extern uint32_t emlxs_init_adapter_info(emlxs_hba_t *hba); 530 extern uint32_t emlxs_strtol(char *str, uint32_t base); 531 extern uint64_t emlxs_strtoll(char *str, uint32_t base); 532 extern void emlxs_decode_version(uint32_t version, 533 char *buffer); 534 extern char *emlxs_ffstate_xlate(uint32_t new_state); 535 extern char *emlxs_ring_xlate(uint32_t ringno); 536 extern void emlxs_proc_channel(emlxs_hba_t *hba, 537 CHANNEL *cp, void *arg2); 538 extern void emlxs_pcix_mxr_update(emlxs_hba_t *hba, 539 uint32_t verbose); 540 extern void emlxs_restart_thread(emlxs_hba_t *hba, 541 void *arg1, void *arg2); 542 extern void emlxs_fw_show(emlxs_hba_t *hba); 543 extern void emlxs_proc_channel_event(emlxs_hba_t *hba, 544 CHANNEL *cp, IOCBQ *iocbq); 545 546 #ifdef MODFW_SUPPORT 547 extern void emlxs_fw_load(emlxs_hba_t *hba, 548 emlxs_firmware_t *fw); 549 extern void emlxs_fw_unload(emlxs_hba_t *hba, 550 emlxs_firmware_t *fw); 551 #endif /* MODFW_SUPPORT */ 552 553 #ifdef MSI_SUPPORT 554 extern int32_t emlxs_msi_add(emlxs_hba_t *hba); 555 extern int32_t emlxs_msi_remove(emlxs_hba_t *hba); 556 extern int32_t emlxs_msi_init(emlxs_hba_t *hba, uint32_t max); 557 extern int32_t emlxs_msi_uninit(emlxs_hba_t *hba); 558 #endif /* MSI_SUPPORT */ 559 560 extern int32_t emlxs_intx_add(emlxs_hba_t *hba); 561 extern int32_t emlxs_intx_remove(emlxs_hba_t *hba); 562 extern int32_t emlxs_intx_init(emlxs_hba_t *hba, uint32_t max); 563 extern int32_t emlxs_intx_uninit(emlxs_hba_t *hba); 564 565 extern void emlxs_parse_prog_types(emlxs_hba_t *hba, 566 char *types); 567 extern int32_t emlxs_parse_vpd(emlxs_hba_t *hba, uint8_t *vpd, 568 uint32_t size); 569 extern int32_t emlxs_parse_fcoe(emlxs_hba_t *hba, uint8_t *p, 570 uint32_t size); 571 572 extern void emlxs_decode_label(char *label, char *buffer, 573 int bige); 574 extern void emlxs_build_prog_types(emlxs_hba_t *hba, 575 char *prog_types); 576 extern void emlxs_process_link_speed(emlxs_hba_t *hba); 577 578 extern uint32_t emlxs_iotag_flush(emlxs_hba_t *hba); 579 580 extern int emlxs_pci_model_count; 581 extern emlxs_model_t emlxs_pci_model[]; 582 583 extern int emlxs_fw_count; 584 extern emlxs_firmware_t emlxs_fw_table[]; 585 586 587 /* Module emlxs_sli3.c External Routine Declarations */ 588 extern emlxs_sli_api_t emlxs_sli3_api; 589 590 extern int emlxs_handle_rcv_seq(emlxs_hba_t *hba, 591 CHANNEL *cp, IOCBQ *iocbq); 592 extern void emlxs_update_HBQ_index(emlxs_hba_t *hba, 593 uint32_t hbq_id); 594 extern void emlxs_hbq_free_all(emlxs_hba_t *hba, 595 uint32_t hbq_id); 596 597 /* Module emlxs_sli4.c External Routine Declarations */ 598 extern int emlxs_sli4_unreg_all_rpi_by_port( 599 emlxs_port_t *port); 600 extern emlxs_sli_api_t emlxs_sli4_api; 601 602 extern FCFIobj_t *emlxs_sli4_assign_fcfi(emlxs_hba_t *hba, 603 FCF_RECORD_t *fcfrec); 604 extern void emlxs_data_dump(emlxs_hba_t *hba, char *str, 605 uint32_t *data, int cnt, int err); 606 extern void emlxs_ue_dump(emlxs_hba_t *hba, char *str); 607 608 extern RPIobj_t *emlxs_sli4_find_rpi(emlxs_hba_t *hba, 609 uint16_t rpi); 610 extern XRIobj_t *emlxs_sli4_find_xri(emlxs_hba_t *hba, 611 uint16_t xri); 612 613 extern RPIobj_t *emlxs_sli4_alloc_rpi(emlxs_port_t *port); 614 615 extern void emlxs_sli4_free_rpi(emlxs_hba_t *hba, 616 RPIobj_t *xp); 617 extern VFIobj_t *emlxs_sli4_alloc_vfi(emlxs_hba_t *hba, 618 FCFIobj_t *fp); 619 extern void emlxs_sli4_free_vfi(emlxs_hba_t *hba, 620 VFIobj_t *xp); 621 extern void emlxs_sli4_free_fcfi(emlxs_hba_t *hba, 622 FCFIobj_t *xp); 623 extern void emlxs_sli4_free_xri(emlxs_hba_t *hba, 624 emlxs_buf_t *sbp, XRIobj_t *xp); 625 extern FCFIobj_t *emlxs_sli4_bind_fcfi(emlxs_hba_t *hba); 626 627 extern uint32_t emlxs_sli4_unreserve_xri(emlxs_hba_t *hba, 628 uint16_t xri); 629 630 /* Module emlxs_diag.c External Routine Declarations */ 631 extern uint32_t emlxs_diag_post_run(emlxs_hba_t *hba); 632 extern uint32_t emlxs_diag_biu_run(emlxs_hba_t *hba, 633 uint32_t pattern); 634 extern uint32_t emlxs_diag_pattern[256]; 635 extern uint32_t emlxs_diag_echo_run(emlxs_port_t *port, 636 uint32_t did, uint32_t pattern); 637 638 /* Module emlxs_download.c External Routine Declarations */ 639 extern int32_t emlxs_fw_download(emlxs_hba_t *hba, 640 caddr_t buffer, uint32_t len, 641 uint32_t offline); 642 extern uint32_t emlxs_get_max_sram(emlxs_hba_t *hba, 643 uint32_t *MaxRbusSize, 644 uint32_t *MaxIbusSize); 645 extern uint32_t emlxs_get_load_list(emlxs_hba_t *hba, 646 PROG_ID *load_list); 647 extern uint32_t emlxs_read_wakeup_parms(emlxs_hba_t *hba, 648 PWAKE_UP_PARMS WakeUpParms, 649 uint32_t verbose); 650 extern int32_t emlxs_cfl_download(emlxs_hba_t *hba, 651 uint32_t region, caddr_t buffer, 652 uint32_t len); 653 654 extern int32_t emlxs_boot_code_disable(emlxs_hba_t *hba); 655 extern int32_t emlxs_boot_code_enable(emlxs_hba_t *hba); 656 extern int32_t emlxs_boot_code_state(emlxs_hba_t *hba); 657 658 extern int32_t emlxs_sli4_read_fw_version(emlxs_hba_t *hba, 659 emlxs_firmware_t *fw); 660 661 /* Module emlxs_fcp.c External Routine Declarations */ 662 extern int emlxs_power_up(emlxs_hba_t *hba); 663 extern int emlxs_power_down(emlxs_hba_t *hba); 664 extern int emlxs_reset_link(emlxs_hba_t *hba, 665 uint32_t linkup, uint32_t wait); 666 extern emlxs_buf_t *emlxs_unregister_pkt(CHANNEL *cp, 667 uint16_t iotag, uint32_t forced); 668 extern uint16_t emlxs_register_pkt(CHANNEL *cp, 669 emlxs_buf_t *sbp); 670 671 extern IOCBQ *emlxs_create_abort_xri_cn(emlxs_port_t *port, 672 NODELIST *ndlp, uint16_t iotag, 673 CHANNEL *cp, uint8_t class, 674 int32_t flag); 675 extern IOCBQ *emlxs_create_close_xri_cn(emlxs_port_t *port, 676 NODELIST *ndlp, uint16_t iotag, 677 CHANNEL *cp); 678 extern IOCBQ *emlxs_create_abort_xri_cx(emlxs_port_t *port, 679 NODELIST *ndlp, uint16_t xid, 680 CHANNEL *cp, uint8_t class, 681 int32_t flag); 682 extern IOCBQ *emlxs_create_close_xri_cx(emlxs_port_t *port, 683 NODELIST *ndlp, uint16_t xid, 684 CHANNEL *cp); 685 extern void emlxs_abort_ct_exchange(emlxs_hba_t *hba, 686 emlxs_port_t *port, uint32_t rxid); 687 extern void emlxs_abort_els_exchange(emlxs_hba_t *hba, 688 emlxs_port_t *port, uint32_t rxid); 689 extern void emlxs_abort_fct_exchange(emlxs_hba_t *hba, 690 emlxs_port_t *port, uint32_t rxid); 691 extern emlxs_buf_t *emlxs_chipq_get(CHANNEL *cp, uint16_t iotag); 692 extern void emlxs_chipq_put(CHANNEL *cp, emlxs_buf_t *sbp); 693 extern uint32_t emlxs_chipq_node_flush(emlxs_port_t *port, 694 CHANNEL *cp, NODELIST *ndlp, 695 emlxs_buf_t *fpkt); 696 extern uint32_t emlxs_chipq_lun_flush(emlxs_port_t *port, 697 NODELIST *ndlp, uint32_t lun, 698 emlxs_buf_t *fpkt); 699 extern uint32_t emlxs_chipq_node_check(emlxs_port_t *port, 700 CHANNEL *cp, NODELIST *ndlp); 701 702 extern IOCBQ *emlxs_tx_get(CHANNEL *cp, uint32_t lock); 703 extern void emlxs_tx_put(IOCBQ *iocbq, uint32_t lock); 704 extern void emlxs_tx_move(NODELIST *ndlp, CHANNEL *from, 705 CHANNEL *to, uint32_t cmd, 706 emlxs_buf_t *fpkt, uint32_t lock); 707 708 extern uint32_t emlxs_tx_node_check(emlxs_port_t *port, 709 NODELIST *ndlp, CHANNEL *cp); 710 extern uint32_t emlxs_tx_node_flush(emlxs_port_t *port, 711 NODELIST *ndlp, CHANNEL *cp, 712 uint32_t shutdown, emlxs_buf_t *fpkt); 713 extern uint32_t emlxs_tx_lun_flush(emlxs_port_t *port, 714 NODELIST *ndlp, uint32_t lun, 715 emlxs_buf_t *fpkt); 716 extern uint32_t emlxs_tx_channel_flush(emlxs_hba_t *hba, 717 CHANNEL *cp, emlxs_buf_t *fpkt); 718 719 extern void emlxs_linkdown(emlxs_hba_t *hba); 720 extern void emlxs_linkup(emlxs_hba_t *hba); 721 extern void emlxs_port_online(emlxs_port_t *port); 722 extern int32_t emlxs_port_offline(emlxs_port_t *port, 723 uint32_t scope); 724 extern void emlxs_ffcleanup(emlxs_hba_t *hba); 725 extern int32_t emlxs_offline(emlxs_hba_t *hba); 726 extern int32_t emlxs_online(emlxs_hba_t *hba); 727 extern int32_t emlxs_post_buffer(emlxs_hba_t *hba, 728 RING *rp, int16_t cnt); 729 extern void emlxs_ff_start(emlxs_hba_t *hba); 730 extern void emlxs_handle_fcp_event(emlxs_hba_t *hba, 731 CHANNEL *rp, IOCBQ *temp); 732 extern int emlxs_fct_handle_abort(emlxs_hba_t *hba, 733 CHANNEL *rp, IOCBQ *iocbq); 734 735 /* Module emlxs_thread.c External Routine Declarations */ 736 extern void emlxs_taskq_destroy(emlxs_taskq_t *taskq); 737 extern void emlxs_taskq_create(emlxs_hba_t *hba, 738 emlxs_taskq_t *taskq); 739 extern uint32_t emlxs_taskq_dispatch(emlxs_taskq_t *taskq, 740 void (*func) (), void *arg); 741 extern void emlxs_thread_create(emlxs_hba_t *hba, 742 emlxs_thread_t *ethread); 743 extern void emlxs_thread_destroy(emlxs_thread_t *ethread); 744 extern void emlxs_thread_trigger1(emlxs_thread_t *ethread, 745 void (*func) ()); 746 extern void emlxs_thread_trigger2(emlxs_thread_t *ethread, 747 void (*func) (), CHANNEL *cp); 748 extern void emlxs_thread_spawn(emlxs_hba_t *hba, 749 void (*func) (), void *arg1, 750 void *arg2); 751 extern void emlxs_thread_spawn_create(emlxs_hba_t *hba); 752 extern void emlxs_thread_spawn_destroy(emlxs_hba_t *hba); 753 754 /* Module emlxs_dfc.c External Routine Declarations */ 755 extern int32_t emlxs_dfc_manage(emlxs_hba_t *hba, void *dfc, 756 int32_t mode); 757 extern int32_t emlxs_dfc_handle_event(emlxs_hba_t *hba, 758 CHANNEL *cp, IOCBQ *temp); 759 extern int emlxs_dfc_handle_unsol_req(emlxs_port_t *port, 760 CHANNEL *cp, IOCBQ *iocbq, 761 MATCHMAP *mp, uint32_t size); 762 extern void emlxs_fcoe_attention_thread(emlxs_hba_t *hba, 763 void *arg1, void *arg2); 764 extern uint32_t emlxs_set_hba_mode(emlxs_hba_t *hba, uint32_t mode); 765 extern uint32_t emlxs_get_dump_region(emlxs_hba_t *hba, uint32_t region, 766 uint8_t *buffer, uint32_t *psize); 767 extern int32_t emlxs_send_menlo_cmd(emlxs_hba_t *hba, uint8_t *cmd_buf, 768 uint32_t cmd_size, uint8_t *rsp_buf, 769 uint32_t *rsp_size); 770 771 #ifdef SFCT_SUPPORT 772 /* Module emlxs_fct.c External Routine Declarations */ 773 extern void emlxs_fct_link_down(emlxs_port_t *port); 774 extern void emlxs_fct_link_up(emlxs_port_t *port); 775 extern void emlxs_fct_init(emlxs_hba_t *hba); 776 extern void emlxs_fct_detach(emlxs_hba_t *hba); 777 extern int emlxs_fct_handle_unsol_els(emlxs_port_t *port, 778 CHANNEL *cp, IOCBQ *iocbq, MATCHMAP *mp, 779 uint32_t size); 780 extern int emlxs_fct_handle_unsol_req(emlxs_port_t *port, 781 CHANNEL *cp, IOCBQ *iocbq, MATCHMAP *mp, 782 uint32_t size); 783 extern int emlxs_fct_handle_fcp_event(emlxs_hba_t *hba, 784 CHANNEL *cp, IOCBQ *iocbq); 785 extern void emlxs_fct_bind_port(emlxs_port_t *port); 786 extern void emlxs_fct_unbind_port(emlxs_port_t *port); 787 extern void emlxs_fct_unsol_callback(emlxs_port_t *port, 788 fct_cmd_t *fct_cmd); 789 extern void emlxs_fct_attach(emlxs_hba_t *hba); 790 extern int emlxs_fct_port_shutdown(emlxs_port_t *port); 791 extern int emlxs_fct_port_initialize(emlxs_port_t *port); 792 793 #ifdef MODSYM_SUPPORT 794 extern int emlxs_fct_modopen(); 795 extern void emlxs_fct_modclose(); 796 #endif /* MODSYM_SUPPORT */ 797 798 #ifdef FCT_IO_TRACE 799 extern void emlxs_fct_io_trace(emlxs_port_t *, 800 fct_cmd_t *, uint32_t); 801 #endif /* FCT_IO_TRACE */ 802 #endif /* SFCT_SUPPORT */ 803 804 #ifdef DUMP_SUPPORT 805 /* Module emlxs_dump.c External Routine Declarations */ 806 extern uint32_t emlxs_dump_drv_event(emlxs_hba_t *hba); 807 extern uint32_t emlxs_dump_user_event(emlxs_hba_t *hba); 808 extern uint32_t emlxs_dump_temp_event(emlxs_hba_t *hba, 809 uint32_t tempType, uint32_t temp); 810 extern void emlxs_dump_drv_thread(emlxs_hba_t *hba, 811 void *arg1, void *arg2); 812 extern void emlxs_dump_user_thread(emlxs_hba_t *hba, 813 void *arg1, void *arg2); 814 extern void emlxs_dump_temp_thread(emlxs_hba_t *hba, 815 void *arg1, void *arg2); 816 extern uint32_t emlxs_ftell(emlxs_file_t *fp); 817 extern uint32_t emlxs_get_dump(emlxs_hba_t *hba, uint8_t *buffer, 818 uint32_t *buflen); 819 extern void emlxs_dump_wait(emlxs_hba_t *hba); 820 extern void emlxs_dump(emlxs_hba_t *hba, uint32_t type, 821 uint32_t temp_type, uint32_t temp); 822 823 extern emlxs_file_t *emlxs_fopen(emlxs_hba_t *hba, uint32_t file_type); 824 extern void emlxs_fflush(emlxs_file_t *fp); 825 extern uint32_t emlxs_fclose(emlxs_file_t *fp); 826 extern uint32_t emlxs_dump_word_dmpfile(emlxs_file_t *fpDmpFile, 827 uint8_t *pBuffer, uint32_t bufferLen, 828 int fSwap); 829 #endif /* DUMP_SUPPORT */ 830 831 #ifdef __cplusplus 832 } 833 #endif 834 835 #endif /* _EMLXS_EXTERN_H */ 836