162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * QLogic Fibre Channel HBA Driver
462306a36Sopenharmony_ci * Copyright (c)  2003-2014 QLogic Corporation
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef __QLA_GBL_H
762306a36Sopenharmony_ci#define	__QLA_GBL_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/interrupt.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/*
1262306a36Sopenharmony_ci * Global Function Prototypes in qla_init.c source file.
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ciextern int qla2x00_initialize_adapter(scsi_qla_host_t *);
1562306a36Sopenharmony_ciextern int qla24xx_post_prli_work(struct scsi_qla_host *vha, fc_port_t *fcport);
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciextern int qla2100_pci_config(struct scsi_qla_host *);
1862306a36Sopenharmony_ciextern int qla2300_pci_config(struct scsi_qla_host *);
1962306a36Sopenharmony_ciextern int qla24xx_pci_config(scsi_qla_host_t *);
2062306a36Sopenharmony_ciextern int qla25xx_pci_config(scsi_qla_host_t *);
2162306a36Sopenharmony_ciextern int qla2x00_reset_chip(struct scsi_qla_host *);
2262306a36Sopenharmony_ciextern int qla24xx_reset_chip(struct scsi_qla_host *);
2362306a36Sopenharmony_ciextern int qla2x00_chip_diag(struct scsi_qla_host *);
2462306a36Sopenharmony_ciextern int qla24xx_chip_diag(struct scsi_qla_host *);
2562306a36Sopenharmony_ciextern void qla2x00_config_rings(struct scsi_qla_host *);
2662306a36Sopenharmony_ciextern void qla24xx_config_rings(struct scsi_qla_host *);
2762306a36Sopenharmony_ciextern int qla2x00_reset_adapter(struct scsi_qla_host *);
2862306a36Sopenharmony_ciextern int qla24xx_reset_adapter(struct scsi_qla_host *);
2962306a36Sopenharmony_ciextern int qla2x00_nvram_config(struct scsi_qla_host *);
3062306a36Sopenharmony_ciextern int qla24xx_nvram_config(struct scsi_qla_host *);
3162306a36Sopenharmony_ciextern int qla81xx_nvram_config(struct scsi_qla_host *);
3262306a36Sopenharmony_ciextern void qla2x00_update_fw_options(struct scsi_qla_host *);
3362306a36Sopenharmony_ciextern void qla24xx_update_fw_options(scsi_qla_host_t *);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciextern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *);
3662306a36Sopenharmony_ciextern int qla24xx_load_risc(scsi_qla_host_t *, uint32_t *);
3762306a36Sopenharmony_ciextern int qla81xx_load_risc(scsi_qla_host_t *, uint32_t *);
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciextern int qla2x00_perform_loop_resync(scsi_qla_host_t *);
4062306a36Sopenharmony_ciextern int qla2x00_loop_resync(scsi_qla_host_t *);
4162306a36Sopenharmony_ciextern void qla2x00_clear_loop_id(fc_port_t *fcport);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciextern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *);
4462306a36Sopenharmony_ciextern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *);
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciextern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t);
4762306a36Sopenharmony_ciextern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool);
4862306a36Sopenharmony_ciextern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha,
4962306a36Sopenharmony_ci				   struct els_plogi *els_plogi);
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciextern int qla2x00_abort_isp(scsi_qla_host_t *);
5262306a36Sopenharmony_ciextern void qla2x00_abort_isp_cleanup(scsi_qla_host_t *);
5362306a36Sopenharmony_ciextern void qla2x00_quiesce_io(scsi_qla_host_t *);
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciextern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
5662306a36Sopenharmony_civoid qla_register_fcport_fn(struct work_struct *);
5762306a36Sopenharmony_ciextern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
5862306a36Sopenharmony_ciextern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *);
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciextern int qla2x00_get_thermal_temp(scsi_qla_host_t *, uint16_t *);
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ciextern void qla84xx_put_chip(struct scsi_qla_host *);
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciextern int qla2x00_async_login(struct scsi_qla_host *, fc_port_t *,
6562306a36Sopenharmony_ci    uint16_t *);
6662306a36Sopenharmony_ciextern int qla2x00_async_logout(struct scsi_qla_host *, fc_port_t *);
6762306a36Sopenharmony_ciextern int qla2x00_async_prlo(struct scsi_qla_host *, fc_port_t *);
6862306a36Sopenharmony_ciextern int qla2x00_async_adisc(struct scsi_qla_host *, fc_port_t *,
6962306a36Sopenharmony_ci    uint16_t *);
7062306a36Sopenharmony_ciextern int qla2x00_async_tm_cmd(fc_port_t *, uint32_t, uint64_t, uint32_t);
7162306a36Sopenharmony_cistruct qla_work_evt *qla2x00_alloc_work(struct scsi_qla_host *,
7262306a36Sopenharmony_ci    enum qla_work_type);
7362306a36Sopenharmony_ciextern int qla24xx_async_gnl(struct scsi_qla_host *, fc_port_t *);
7462306a36Sopenharmony_ciint qla2x00_post_work(struct scsi_qla_host *vha, struct qla_work_evt *e);
7562306a36Sopenharmony_ciextern void *qla2x00_alloc_iocbs_ready(struct qla_qpair *, srb_t *);
7662306a36Sopenharmony_ciextern int qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *, fc_port_t *);
7762306a36Sopenharmony_ciextern int qla24xx_async_abort_cmd(srb_t *, bool);
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ciextern void qla2x00_set_fcport_state(fc_port_t *fcport, int state);
8062306a36Sopenharmony_ciextern fc_port_t *
8162306a36Sopenharmony_ciqla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t );
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ciextern int __qla83xx_set_idc_control(scsi_qla_host_t *, uint32_t);
8462306a36Sopenharmony_ciextern int __qla83xx_get_idc_control(scsi_qla_host_t *, uint32_t *);
8562306a36Sopenharmony_ciextern void qla83xx_idc_audit(scsi_qla_host_t *, int);
8662306a36Sopenharmony_ciextern int qla83xx_nic_core_reset(scsi_qla_host_t *);
8762306a36Sopenharmony_ciextern void qla83xx_reset_ownership(scsi_qla_host_t *);
8862306a36Sopenharmony_ciextern int qla2xxx_mctp_dump(scsi_qla_host_t *);
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ciextern int
9162306a36Sopenharmony_ciqla2x00_alloc_outstanding_cmds(struct qla_hw_data *, struct req_que *);
9262306a36Sopenharmony_ciextern int qla2x00_init_rings(scsi_qla_host_t *);
9362306a36Sopenharmony_ciextern struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *,
9462306a36Sopenharmony_ci	int, int, bool);
9562306a36Sopenharmony_ciextern int qla2xxx_delete_qpair(struct scsi_qla_host *, struct qla_qpair *);
9662306a36Sopenharmony_civoid qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea);
9762306a36Sopenharmony_civoid qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha,
9862306a36Sopenharmony_ci				     struct event_arg *ea);
9962306a36Sopenharmony_civoid qla24xx_handle_relogin_event(scsi_qla_host_t *vha,
10062306a36Sopenharmony_ci				  struct event_arg *ea);
10162306a36Sopenharmony_ciint qla24xx_async_gpdb(struct scsi_qla_host *, fc_port_t *, u8);
10262306a36Sopenharmony_ciint qla24xx_async_prli(struct scsi_qla_host *, fc_port_t *);
10362306a36Sopenharmony_ciint qla24xx_async_notify_ack(scsi_qla_host_t *, fc_port_t *,
10462306a36Sopenharmony_ci	struct imm_ntfy_from_isp *, int);
10562306a36Sopenharmony_ciint qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *, u8*,
10662306a36Sopenharmony_ci    void *, u8);
10762306a36Sopenharmony_ciint qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *);
10862306a36Sopenharmony_ciint qla24xx_detect_sfp(scsi_qla_host_t *);
10962306a36Sopenharmony_ciint qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8);
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ciextern void qla28xx_get_aux_images(struct scsi_qla_host *,
11262306a36Sopenharmony_ci    struct active_regions *);
11362306a36Sopenharmony_ciextern void qla27xx_get_active_image(struct scsi_qla_host *,
11462306a36Sopenharmony_ci    struct active_regions *);
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_civoid qla2x00_async_prlo_done(struct scsi_qla_host *, fc_port_t *,
11762306a36Sopenharmony_ci    uint16_t *);
11862306a36Sopenharmony_ciextern int qla2x00_post_async_prlo_work(struct scsi_qla_host *, fc_port_t *,
11962306a36Sopenharmony_ci    uint16_t *);
12062306a36Sopenharmony_ciextern int qla2x00_post_async_prlo_done_work(struct scsi_qla_host *,
12162306a36Sopenharmony_ci    fc_port_t *, uint16_t *);
12262306a36Sopenharmony_ciint qla_post_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport);
12362306a36Sopenharmony_civoid qla_do_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport);
12462306a36Sopenharmony_ciint qla2x00_reserve_mgmt_server_loop_id(scsi_qla_host_t *);
12562306a36Sopenharmony_civoid qla_rscn_replay(fc_port_t *fcport);
12662306a36Sopenharmony_civoid qla24xx_free_purex_item(struct purex_item *item);
12762306a36Sopenharmony_ciextern bool qla24xx_risc_firmware_invalid(uint32_t *);
12862306a36Sopenharmony_civoid qla_init_iocb_limit(scsi_qla_host_t *);
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_civoid qla_edif_list_del(fc_port_t *fcport);
13162306a36Sopenharmony_civoid qla_edif_sadb_release(struct qla_hw_data *ha);
13262306a36Sopenharmony_ciint qla_edif_sadb_build_free_pool(struct qla_hw_data *ha);
13362306a36Sopenharmony_civoid qla_edif_sadb_release_free_pool(struct qla_hw_data *ha);
13462306a36Sopenharmony_civoid qla_chk_edif_rx_sa_delete_pending(scsi_qla_host_t *vha,
13562306a36Sopenharmony_ci		srb_t *sp, struct sts_entry_24xx *sts24);
13662306a36Sopenharmony_civoid qlt_chk_edif_rx_sa_delete_pending(scsi_qla_host_t *vha, fc_port_t *fcport,
13762306a36Sopenharmony_ci		struct ctio7_from_24xx *ctio);
13862306a36Sopenharmony_civoid qla2x00_release_all_sadb(struct scsi_qla_host *vha, struct fc_port *fcport);
13962306a36Sopenharmony_ciint qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsgjob);
14062306a36Sopenharmony_civoid qla_edif_sess_down(struct scsi_qla_host *vha, struct fc_port *sess);
14162306a36Sopenharmony_civoid qla_edif_clear_appdata(struct scsi_qla_host *vha,
14262306a36Sopenharmony_ci			    struct fc_port *fcport);
14362306a36Sopenharmony_ciconst char *sc_to_str(uint16_t cmd);
14462306a36Sopenharmony_civoid qla_adjust_iocb_limit(scsi_qla_host_t *vha);
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci/*
14762306a36Sopenharmony_ci * Global Data in qla_os.c source file.
14862306a36Sopenharmony_ci */
14962306a36Sopenharmony_ciextern char qla2x00_version_str[];
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ciextern struct kmem_cache *srb_cachep;
15262306a36Sopenharmony_ciextern struct kmem_cache *qla_tgt_plogi_cachep;
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ciextern int ql2xlogintimeout;
15562306a36Sopenharmony_ciextern int qlport_down_retry;
15662306a36Sopenharmony_ciextern int ql2xplogiabsentdevice;
15762306a36Sopenharmony_ciextern int ql2xloginretrycount;
15862306a36Sopenharmony_ciextern int ql2xfdmienable;
15962306a36Sopenharmony_ciextern int ql2xrdpenable;
16062306a36Sopenharmony_ciextern int ql2xsmartsan;
16162306a36Sopenharmony_ciextern int ql2xallocfwdump;
16262306a36Sopenharmony_ciextern int ql2xextended_error_logging;
16362306a36Sopenharmony_ciextern int ql2xextended_error_logging_ktrace;
16462306a36Sopenharmony_ciextern int ql2xiidmaenable;
16562306a36Sopenharmony_ciextern int ql2xmqsupport;
16662306a36Sopenharmony_ciextern int ql2xfwloadbin;
16762306a36Sopenharmony_ciextern int ql2xetsenable;
16862306a36Sopenharmony_ciextern int ql2xshiftctondsd;
16962306a36Sopenharmony_ciextern int ql2xdbwr;
17062306a36Sopenharmony_ciextern int ql2xasynctmfenable;
17162306a36Sopenharmony_ciextern int ql2xgffidenable;
17262306a36Sopenharmony_ciextern int ql2xenabledif;
17362306a36Sopenharmony_ciextern int ql2xenablehba_err_chk;
17462306a36Sopenharmony_ciextern int ql2xdontresethba;
17562306a36Sopenharmony_ciextern uint64_t ql2xmaxlun;
17662306a36Sopenharmony_ciextern int ql2xmdcapmask;
17762306a36Sopenharmony_ciextern int ql2xmdenable;
17862306a36Sopenharmony_ciextern int ql2xexlogins;
17962306a36Sopenharmony_ciextern int ql2xexchoffld;
18062306a36Sopenharmony_ciextern int ql2xiniexchg;
18162306a36Sopenharmony_ciextern int ql2xfwholdabts;
18262306a36Sopenharmony_ciextern int ql2xmvasynctoatio;
18362306a36Sopenharmony_ciextern int ql2xuctrlirq;
18462306a36Sopenharmony_ciextern int ql2xnvmeenable;
18562306a36Sopenharmony_ciextern int ql2xautodetectsfp;
18662306a36Sopenharmony_ciextern int ql2xenablemsix;
18762306a36Sopenharmony_ciextern int qla2xuseresexchforels;
18862306a36Sopenharmony_ciextern int ql2xdifbundlinginternalbuffers;
18962306a36Sopenharmony_ciextern int ql2xfulldump_on_mpifail;
19062306a36Sopenharmony_ciextern int ql2xsecenable;
19162306a36Sopenharmony_ciextern int ql2xenforce_iocb_limit;
19262306a36Sopenharmony_ciextern int ql2xabts_wait_nvme;
19362306a36Sopenharmony_ciextern u32 ql2xnvme_queues;
19462306a36Sopenharmony_ciextern int ql2xfc2target;
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ciextern int qla2x00_loop_reset(scsi_qla_host_t *);
19762306a36Sopenharmony_ciextern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
19862306a36Sopenharmony_ciextern int qla2x00_post_aen_work(struct scsi_qla_host *, enum
19962306a36Sopenharmony_ci    fc_host_event_code, u32);
20062306a36Sopenharmony_ciextern int qla2x00_post_idc_ack_work(struct scsi_qla_host *, uint16_t *);
20162306a36Sopenharmony_ciextern int qla2x00_post_async_login_work(struct scsi_qla_host *, fc_port_t *,
20262306a36Sopenharmony_ci    uint16_t *);
20362306a36Sopenharmony_ciextern int qla2x00_post_async_logout_work(struct scsi_qla_host *, fc_port_t *,
20462306a36Sopenharmony_ci    uint16_t *);
20562306a36Sopenharmony_ciextern int qla2x00_post_async_adisc_work(struct scsi_qla_host *, fc_port_t *,
20662306a36Sopenharmony_ci    uint16_t *);
20762306a36Sopenharmony_ciextern int qla2x00_set_exlogins_buffer(struct scsi_qla_host *);
20862306a36Sopenharmony_ciextern void qla2x00_free_exlogin_buffer(struct qla_hw_data *);
20962306a36Sopenharmony_ciextern int qla2x00_set_exchoffld_buffer(struct scsi_qla_host *);
21062306a36Sopenharmony_ciextern void qla2x00_free_exchoffld_buffer(struct qla_hw_data *);
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ciextern int qla81xx_restart_mpi_firmware(scsi_qla_host_t *);
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ciextern struct scsi_qla_host *qla2x00_create_host(const struct scsi_host_template *,
21562306a36Sopenharmony_ci	struct qla_hw_data *);
21662306a36Sopenharmony_ciextern void qla2x00_relogin(struct scsi_qla_host *);
21762306a36Sopenharmony_ciextern void qla2x00_do_work(struct scsi_qla_host *);
21862306a36Sopenharmony_ciextern void qla2x00_free_fcports(struct scsi_qla_host *);
21962306a36Sopenharmony_ciextern void qla2x00_free_fcport(fc_port_t *);
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ciextern void qla83xx_schedule_work(scsi_qla_host_t *, int);
22262306a36Sopenharmony_ciextern void qla83xx_service_idc_aen(struct work_struct *);
22362306a36Sopenharmony_ciextern void qla83xx_nic_core_unrecoverable_work(struct work_struct *);
22462306a36Sopenharmony_ciextern void qla83xx_idc_state_handler_work(struct work_struct *);
22562306a36Sopenharmony_ciextern void qla83xx_nic_core_reset_work(struct work_struct *);
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ciextern void qla83xx_idc_lock(scsi_qla_host_t *, uint16_t);
22862306a36Sopenharmony_ciextern void qla83xx_idc_unlock(scsi_qla_host_t *, uint16_t);
22962306a36Sopenharmony_ciextern int qla83xx_idc_state_handler(scsi_qla_host_t *);
23062306a36Sopenharmony_ciextern int qla83xx_set_drv_presence(scsi_qla_host_t *vha);
23162306a36Sopenharmony_ciextern int __qla83xx_set_drv_presence(scsi_qla_host_t *vha);
23262306a36Sopenharmony_ciextern int qla83xx_clear_drv_presence(scsi_qla_host_t *vha);
23362306a36Sopenharmony_ciextern int __qla83xx_clear_drv_presence(scsi_qla_host_t *vha);
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ciextern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32);
23662306a36Sopenharmony_ciextern void qla2x00_disable_board_on_pci_error(struct work_struct *);
23762306a36Sopenharmony_ciextern void qla2x00_sp_compl(srb_t *sp, int);
23862306a36Sopenharmony_ciextern void qla2xxx_qpair_sp_free_dma(srb_t *sp);
23962306a36Sopenharmony_ciextern void qla2xxx_qpair_sp_compl(srb_t *sp, int);
24062306a36Sopenharmony_ciextern void qla24xx_sched_upd_fcport(fc_port_t *);
24162306a36Sopenharmony_ciint qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *);
24262306a36Sopenharmony_ciint qla24xx_post_relogin_work(struct scsi_qla_host *vha);
24362306a36Sopenharmony_civoid qla2x00_wait_for_sess_deletion(scsi_qla_host_t *);
24462306a36Sopenharmony_civoid qla24xx_process_purex_rdp(struct scsi_qla_host *vha,
24562306a36Sopenharmony_ci			       struct purex_item *pkt);
24662306a36Sopenharmony_civoid qla_pci_set_eeh_busy(struct scsi_qla_host *);
24762306a36Sopenharmony_civoid qla_schedule_eeh_work(struct scsi_qla_host *);
24862306a36Sopenharmony_cistruct edif_sa_ctl *qla_edif_find_sa_ctl_by_index(fc_port_t *fcport,
24962306a36Sopenharmony_ci						  int index, int dir);
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci/*
25262306a36Sopenharmony_ci * Global Functions in qla_mid.c source file.
25362306a36Sopenharmony_ci */
25462306a36Sopenharmony_ciextern void qla_update_vp_map(struct scsi_qla_host *, int);
25562306a36Sopenharmony_ciextern struct scsi_host_template qla2xxx_driver_template;
25662306a36Sopenharmony_ciextern struct scsi_transport_template *qla2xxx_transport_vport_template;
25762306a36Sopenharmony_ciextern void qla2x00_timer(struct timer_list *);
25862306a36Sopenharmony_ciextern void qla2x00_start_timer(scsi_qla_host_t *, unsigned long);
25962306a36Sopenharmony_ciextern void qla24xx_deallocate_vp_id(scsi_qla_host_t *);
26062306a36Sopenharmony_ciextern int qla24xx_disable_vp (scsi_qla_host_t *);
26162306a36Sopenharmony_ciextern int qla24xx_enable_vp (scsi_qla_host_t *);
26262306a36Sopenharmony_ciextern int qla24xx_control_vp(scsi_qla_host_t *, int );
26362306a36Sopenharmony_ciextern int qla24xx_modify_vp_config(scsi_qla_host_t *);
26462306a36Sopenharmony_ciextern int qla2x00_send_change_request(scsi_qla_host_t *, uint16_t, uint16_t);
26562306a36Sopenharmony_ciextern void qla2x00_vp_stop_timer(scsi_qla_host_t *);
26662306a36Sopenharmony_ciextern int qla24xx_configure_vhba (scsi_qla_host_t *);
26762306a36Sopenharmony_ciextern void qla24xx_report_id_acquisition(scsi_qla_host_t *,
26862306a36Sopenharmony_ci    struct vp_rpt_id_entry_24xx *);
26962306a36Sopenharmony_ciextern void qla2x00_do_dpc_all_vps(scsi_qla_host_t *);
27062306a36Sopenharmony_ciextern int qla24xx_vport_create_req_sanity_check(struct fc_vport *);
27162306a36Sopenharmony_ciextern scsi_qla_host_t *qla24xx_create_vhost(struct fc_vport *);
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ciextern void qla2x00_sp_free_dma(srb_t *sp);
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ciextern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int);
27662306a36Sopenharmony_ciextern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *);
27762306a36Sopenharmony_ciextern int qla24xx_async_abort_cmd(srb_t *, bool);
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ciextern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *);
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ciextern int qla2x00_wait_for_hba_online(scsi_qla_host_t *);
28262306a36Sopenharmony_ciextern int qla2x00_wait_for_chip_reset(scsi_qla_host_t *);
28362306a36Sopenharmony_ciextern int qla2x00_wait_for_fcoe_ctx_reset(scsi_qla_host_t *);
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ciextern void qla2xxx_wake_dpc(struct scsi_qla_host *);
28662306a36Sopenharmony_ciextern void qla2x00_alert_all_vps(struct rsp_que *, uint16_t *);
28762306a36Sopenharmony_ciextern void qla2x00_async_event(scsi_qla_host_t *, struct rsp_que *,
28862306a36Sopenharmony_ci	uint16_t *);
28962306a36Sopenharmony_ciextern int  qla2x00_vp_abort_isp(scsi_qla_host_t *);
29062306a36Sopenharmony_civoid qla_adjust_buf(struct scsi_qla_host *);
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci/*
29362306a36Sopenharmony_ci * Global Function Prototypes in qla_iocb.c source file.
29462306a36Sopenharmony_ci */
29562306a36Sopenharmony_civoid qla_els_pt_iocb(struct scsi_qla_host *vha,
29662306a36Sopenharmony_ci	struct els_entry_24xx *pkt, struct qla_els_pt_arg *a);
29762306a36Sopenharmony_cicont_a64_entry_t *qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha,
29862306a36Sopenharmony_ci		struct req_que *que);
29962306a36Sopenharmony_ciextern uint16_t qla2x00_calc_iocbs_32(uint16_t);
30062306a36Sopenharmony_ciextern uint16_t qla2x00_calc_iocbs_64(uint16_t);
30162306a36Sopenharmony_ciextern void qla2x00_build_scsi_iocbs_32(srb_t *, cmd_entry_t *, uint16_t);
30262306a36Sopenharmony_ciextern void qla2x00_build_scsi_iocbs_64(srb_t *, cmd_entry_t *, uint16_t);
30362306a36Sopenharmony_ciextern void qla24xx_build_scsi_iocbs(srb_t *, struct cmd_type_7 *,
30462306a36Sopenharmony_ci	uint16_t, struct req_que *);
30562306a36Sopenharmony_ciextern uint32_t qla2xxx_get_next_handle(struct req_que *req);
30662306a36Sopenharmony_ciextern int qla2x00_start_scsi(srb_t *sp);
30762306a36Sopenharmony_ciextern int qla24xx_start_scsi(srb_t *sp);
30862306a36Sopenharmony_ciint qla2x00_marker(struct scsi_qla_host *, struct qla_qpair *,
30962306a36Sopenharmony_ci    uint16_t, uint64_t, uint8_t);
31062306a36Sopenharmony_ciextern int qla2x00_start_sp(srb_t *);
31162306a36Sopenharmony_ciextern int qla24xx_dif_start_scsi(srb_t *);
31262306a36Sopenharmony_ciextern int qla2x00_start_bidir(srb_t *, struct scsi_qla_host *, uint32_t);
31362306a36Sopenharmony_ciextern int qla2xxx_dif_start_scsi_mq(srb_t *);
31462306a36Sopenharmony_ciextern void qla2x00_init_async_sp(srb_t *sp, unsigned long tmo,
31562306a36Sopenharmony_ci				  void (*done)(struct srb *, int));
31662306a36Sopenharmony_ciextern unsigned long qla2x00_get_async_timeout(struct scsi_qla_host *);
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ciextern void *qla2x00_alloc_iocbs(struct scsi_qla_host *, srb_t *);
31962306a36Sopenharmony_ciextern void *__qla2x00_alloc_iocbs(struct qla_qpair *, srb_t *);
32062306a36Sopenharmony_ciextern int qla2x00_issue_marker(scsi_qla_host_t *, int);
32162306a36Sopenharmony_ciextern int qla24xx_walk_and_build_sglist_no_difb(struct qla_hw_data *, srb_t *,
32262306a36Sopenharmony_ci	struct dsd64 *, uint16_t, struct qla_tc_param *);
32362306a36Sopenharmony_ciextern int qla24xx_walk_and_build_sglist(struct qla_hw_data *, srb_t *,
32462306a36Sopenharmony_ci	struct dsd64 *, uint16_t, struct qla_tc_param *);
32562306a36Sopenharmony_ciextern int qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *, srb_t *,
32662306a36Sopenharmony_ci	struct dsd64 *, uint16_t, struct qla_tgt_cmd *);
32762306a36Sopenharmony_ciextern int qla24xx_get_one_block_sg(uint32_t, struct qla2_sgx *, uint32_t *);
32862306a36Sopenharmony_ciextern int qla24xx_configure_prot_mode(srb_t *, uint16_t *);
32962306a36Sopenharmony_ciextern int qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha,
33062306a36Sopenharmony_ci	struct qla_work_evt *e);
33162306a36Sopenharmony_civoid qla2x00_sp_release(struct kref *kref);
33262306a36Sopenharmony_civoid qla2x00_els_dcmd2_iocb_timeout(void *data);
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci/*
33562306a36Sopenharmony_ci * Global Function Prototypes in qla_mbx.c source file.
33662306a36Sopenharmony_ci */
33762306a36Sopenharmony_ciextern int
33862306a36Sopenharmony_ciqla2x00_load_ram(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ciextern int
34162306a36Sopenharmony_ciqla2x00_dump_ram(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ciextern int
34462306a36Sopenharmony_ciqla2x00_execute_fw(scsi_qla_host_t *, uint32_t);
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ciextern int
34762306a36Sopenharmony_ciqla2x00_get_fw_version(scsi_qla_host_t *);
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ciextern int
35062306a36Sopenharmony_ciqla2x00_get_fw_options(scsi_qla_host_t *, uint16_t *);
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ciextern int
35362306a36Sopenharmony_ciqla2x00_set_fw_options(scsi_qla_host_t *, uint16_t *);
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ciextern int
35662306a36Sopenharmony_ciqla2x00_mbx_reg_test(scsi_qla_host_t *);
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ciextern int
35962306a36Sopenharmony_ciqla2x00_verify_checksum(scsi_qla_host_t *, uint32_t);
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ciextern int
36262306a36Sopenharmony_ciqla2x00_issue_iocb(scsi_qla_host_t *, void *, dma_addr_t, size_t);
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ciextern int
36562306a36Sopenharmony_ciqla2x00_abort_command(srb_t *);
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ciextern int
36862306a36Sopenharmony_ciqla2x00_abort_target(struct fc_port *, uint64_t, int);
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ciextern int
37162306a36Sopenharmony_ciqla2x00_lun_reset(struct fc_port *, uint64_t, int);
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ciextern int
37462306a36Sopenharmony_ciqla2x00_get_adapter_id(scsi_qla_host_t *, uint16_t *, uint8_t *, uint8_t *,
37562306a36Sopenharmony_ci    uint8_t *, uint16_t *, uint16_t *);
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ciextern int
37862306a36Sopenharmony_ciqla2x00_get_retry_cnt(scsi_qla_host_t *, uint8_t *, uint8_t *, uint16_t *);
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ciextern int
38162306a36Sopenharmony_ciqla2x00_init_firmware(scsi_qla_host_t *, uint16_t);
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ciextern int
38462306a36Sopenharmony_ciqla2x00_get_port_database(scsi_qla_host_t *, fc_port_t *, uint8_t);
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_ciextern int
38762306a36Sopenharmony_ciqla24xx_get_port_database(scsi_qla_host_t *, u16, struct port_database_24xx *);
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ciextern int
39062306a36Sopenharmony_ciqla2x00_get_firmware_state(scsi_qla_host_t *, uint16_t *);
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ciextern int
39362306a36Sopenharmony_ciqla2x00_get_port_name(scsi_qla_host_t *, uint16_t, uint8_t *, uint8_t);
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_ciextern int
39662306a36Sopenharmony_ciqla24xx_link_initialize(scsi_qla_host_t *);
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ciextern int
39962306a36Sopenharmony_ciqla2x00_lip_reset(scsi_qla_host_t *);
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ciextern int
40262306a36Sopenharmony_ciqla2x00_send_sns(scsi_qla_host_t *, dma_addr_t, uint16_t, size_t);
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ciextern int
40562306a36Sopenharmony_ciqla2x00_login_fabric(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t,
40662306a36Sopenharmony_ci    uint16_t *, uint8_t);
40762306a36Sopenharmony_ciextern int
40862306a36Sopenharmony_ciqla24xx_login_fabric(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t,
40962306a36Sopenharmony_ci    uint16_t *, uint8_t);
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ciextern int
41262306a36Sopenharmony_ciqla2x00_login_local_device(scsi_qla_host_t *, fc_port_t *, uint16_t *,
41362306a36Sopenharmony_ci    uint8_t);
41462306a36Sopenharmony_ci
41562306a36Sopenharmony_ciextern int
41662306a36Sopenharmony_ciqla2x00_fabric_logout(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t);
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ciextern int
41962306a36Sopenharmony_ciqla24xx_fabric_logout(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t);
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ciextern int
42262306a36Sopenharmony_ciqla2x00_full_login_lip(scsi_qla_host_t *ha);
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ciextern int
42562306a36Sopenharmony_ciqla2x00_get_id_list(scsi_qla_host_t *, void *, dma_addr_t, uint16_t *);
42662306a36Sopenharmony_ci
42762306a36Sopenharmony_ciextern int
42862306a36Sopenharmony_ciqla2x00_get_resource_cnts(scsi_qla_host_t *);
42962306a36Sopenharmony_ci
43062306a36Sopenharmony_ciextern int
43162306a36Sopenharmony_ciqla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map,
43262306a36Sopenharmony_ci		u8 *num_entries);
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_ciextern int
43562306a36Sopenharmony_ciqla2x00_get_link_status(scsi_qla_host_t *, uint16_t, struct link_statistics *,
43662306a36Sopenharmony_ci    dma_addr_t);
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ciextern int
43962306a36Sopenharmony_ciqla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *,
44062306a36Sopenharmony_ci    dma_addr_t, uint16_t);
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ciextern int qla24xx_abort_command(srb_t *);
44362306a36Sopenharmony_ciextern int qla24xx_async_abort_command(srb_t *);
44462306a36Sopenharmony_ciextern int
44562306a36Sopenharmony_ciqla24xx_abort_target(struct fc_port *, uint64_t, int);
44662306a36Sopenharmony_ciextern int
44762306a36Sopenharmony_ciqla24xx_lun_reset(struct fc_port *, uint64_t, int);
44862306a36Sopenharmony_ciextern int
44962306a36Sopenharmony_ciqla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *, unsigned int,
45062306a36Sopenharmony_ci	uint64_t, enum nexus_wait_type);
45162306a36Sopenharmony_ciextern int
45262306a36Sopenharmony_ciqla2x00_system_error(scsi_qla_host_t *);
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ciextern int
45562306a36Sopenharmony_ciqla2x00_write_serdes_word(scsi_qla_host_t *, uint16_t, uint16_t);
45662306a36Sopenharmony_ciextern int
45762306a36Sopenharmony_ciqla2x00_read_serdes_word(scsi_qla_host_t *, uint16_t, uint16_t *);
45862306a36Sopenharmony_ci
45962306a36Sopenharmony_ciextern int
46062306a36Sopenharmony_ciqla8044_write_serdes_word(scsi_qla_host_t *, uint32_t, uint32_t);
46162306a36Sopenharmony_ciextern int
46262306a36Sopenharmony_ciqla8044_read_serdes_word(scsi_qla_host_t *, uint32_t, uint32_t *);
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ciextern int
46562306a36Sopenharmony_ciqla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t);
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ciextern int
46862306a36Sopenharmony_ciqla2x00_stop_firmware(scsi_qla_host_t *);
46962306a36Sopenharmony_ci
47062306a36Sopenharmony_ciextern int
47162306a36Sopenharmony_ciqla2x00_enable_eft_trace(scsi_qla_host_t *, dma_addr_t, uint16_t);
47262306a36Sopenharmony_ciextern int
47362306a36Sopenharmony_ciqla2x00_disable_eft_trace(scsi_qla_host_t *);
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ciextern int
47662306a36Sopenharmony_ciqla2x00_enable_fce_trace(scsi_qla_host_t *, dma_addr_t, uint16_t , uint16_t *,
47762306a36Sopenharmony_ci    uint32_t *);
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ciextern int
48062306a36Sopenharmony_ciqla2x00_disable_fce_trace(scsi_qla_host_t *, uint64_t *, uint64_t *);
48162306a36Sopenharmony_ci
48262306a36Sopenharmony_ciextern int
48362306a36Sopenharmony_ciqla82xx_set_driver_version(scsi_qla_host_t *, char *);
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ciextern int
48662306a36Sopenharmony_ciqla25xx_set_driver_version(scsi_qla_host_t *, char *);
48762306a36Sopenharmony_ci
48862306a36Sopenharmony_ciextern int
48962306a36Sopenharmony_ciqla25xx_set_els_cmds_supported(scsi_qla_host_t *);
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ciextern int
49262306a36Sopenharmony_ciqla24xx_get_buffer_credits(scsi_qla_host_t *, struct buffer_credit_24xx *,
49362306a36Sopenharmony_ci	dma_addr_t);
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ciextern int
49662306a36Sopenharmony_ciqla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint8_t *,
49762306a36Sopenharmony_ci	uint16_t, uint16_t, uint16_t, uint16_t);
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ciextern int
50062306a36Sopenharmony_ciqla2x00_write_sfp(scsi_qla_host_t *, dma_addr_t, uint8_t *,
50162306a36Sopenharmony_ci	uint16_t, uint16_t, uint16_t, uint16_t);
50262306a36Sopenharmony_ci
50362306a36Sopenharmony_ciextern int
50462306a36Sopenharmony_ciqla2x00_set_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t *);
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ciextern int qla84xx_verify_chip(struct scsi_qla_host *, uint16_t *);
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_ciextern int qla81xx_idc_ack(scsi_qla_host_t *, uint16_t *);
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ciextern int
51162306a36Sopenharmony_ciqla81xx_fac_get_sector_size(scsi_qla_host_t *, uint32_t *);
51262306a36Sopenharmony_ci
51362306a36Sopenharmony_ciextern int
51462306a36Sopenharmony_ciqla81xx_fac_do_write_enable(scsi_qla_host_t *, int);
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ciextern int
51762306a36Sopenharmony_ciqla81xx_fac_erase_sector(scsi_qla_host_t *, uint32_t, uint32_t);
51862306a36Sopenharmony_ci
51962306a36Sopenharmony_ciextern int qla81xx_fac_semaphore_access(scsi_qla_host_t *, int);
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_ciextern int
52262306a36Sopenharmony_ciqla2x00_get_xgmac_stats(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t *);
52362306a36Sopenharmony_ci
52462306a36Sopenharmony_ciextern int
52562306a36Sopenharmony_ciqla2x00_get_dcbx_params(scsi_qla_host_t *, dma_addr_t, uint16_t);
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ciextern int
52862306a36Sopenharmony_ciqla2x00_read_ram_word(scsi_qla_host_t *, uint32_t, uint32_t *);
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ciextern int
53162306a36Sopenharmony_ciqla2x00_write_ram_word(scsi_qla_host_t *, uint32_t, uint32_t);
53262306a36Sopenharmony_ci
53362306a36Sopenharmony_ciextern int
53462306a36Sopenharmony_ciqla81xx_write_mpi_register(scsi_qla_host_t *, uint16_t *);
53562306a36Sopenharmony_ciextern int qla2x00_get_data_rate(scsi_qla_host_t *);
53662306a36Sopenharmony_ciextern int qla24xx_set_fcp_prio(scsi_qla_host_t *, uint16_t, uint16_t,
53762306a36Sopenharmony_ci	uint16_t *);
53862306a36Sopenharmony_ciextern int
53962306a36Sopenharmony_ciqla81xx_get_port_config(scsi_qla_host_t *, uint16_t *);
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ciextern int
54262306a36Sopenharmony_ciqla81xx_set_port_config(scsi_qla_host_t *, uint16_t *);
54362306a36Sopenharmony_ci
54462306a36Sopenharmony_ciextern int
54562306a36Sopenharmony_ciqla2x00_port_logout(scsi_qla_host_t *, struct fc_port *);
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ciextern int
54862306a36Sopenharmony_ciqla2x00_dump_mctp_data(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ciextern int
55162306a36Sopenharmony_ciqla26xx_dport_diagnostics(scsi_qla_host_t *, void *, uint, uint);
55262306a36Sopenharmony_ci
55362306a36Sopenharmony_ciextern int
55462306a36Sopenharmony_ciqla26xx_dport_diagnostics_v2(scsi_qla_host_t *,
55562306a36Sopenharmony_ci			     struct qla_dport_diag_v2 *,  mbx_cmd_t *);
55662306a36Sopenharmony_ci
55762306a36Sopenharmony_ciint qla24xx_send_mb_cmd(struct scsi_qla_host *, mbx_cmd_t *);
55862306a36Sopenharmony_ciint qla24xx_gpdb_wait(struct scsi_qla_host *, fc_port_t *, u8);
55962306a36Sopenharmony_ciint qla24xx_gidlist_wait(struct scsi_qla_host *, void *, dma_addr_t,
56062306a36Sopenharmony_ci    uint16_t *);
56162306a36Sopenharmony_ciint __qla24xx_parse_gpdb(struct scsi_qla_host *, fc_port_t *,
56262306a36Sopenharmony_ci	struct port_database_24xx *);
56362306a36Sopenharmony_ciint qla24xx_get_port_login_templ(scsi_qla_host_t *, dma_addr_t,
56462306a36Sopenharmony_ci				 void *, uint16_t);
56562306a36Sopenharmony_ci
56662306a36Sopenharmony_ciextern int qla27xx_get_zio_threshold(scsi_qla_host_t *, uint16_t *);
56762306a36Sopenharmony_ciextern int qla27xx_set_zio_threshold(scsi_qla_host_t *, uint16_t);
56862306a36Sopenharmony_ciint qla24xx_res_count_wait(struct scsi_qla_host *, uint16_t *, int);
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ciextern int qla28xx_secure_flash_update(scsi_qla_host_t *, uint16_t, uint16_t,
57162306a36Sopenharmony_ci    uint32_t, dma_addr_t, uint32_t);
57262306a36Sopenharmony_ci
57362306a36Sopenharmony_ciextern int qla2xxx_read_remote_register(scsi_qla_host_t *, uint32_t,
57462306a36Sopenharmony_ci    uint32_t *);
57562306a36Sopenharmony_ciextern int qla2xxx_write_remote_register(scsi_qla_host_t *, uint32_t,
57662306a36Sopenharmony_ci    uint32_t);
57762306a36Sopenharmony_civoid qla_no_op_mb(struct scsi_qla_host *vha);
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci/*
58062306a36Sopenharmony_ci * Global Function Prototypes in qla_isr.c source file.
58162306a36Sopenharmony_ci */
58262306a36Sopenharmony_ciextern irqreturn_t qla2100_intr_handler(int, void *);
58362306a36Sopenharmony_ciextern irqreturn_t qla2300_intr_handler(int, void *);
58462306a36Sopenharmony_ciextern irqreturn_t qla24xx_intr_handler(int, void *);
58562306a36Sopenharmony_ciextern void qla2x00_process_response_queue(struct rsp_que *);
58662306a36Sopenharmony_ciextern void
58762306a36Sopenharmony_ciqla24xx_process_response_queue(struct scsi_qla_host *, struct rsp_que *);
58862306a36Sopenharmony_ciextern int qla2x00_request_irqs(struct qla_hw_data *, struct rsp_que *);
58962306a36Sopenharmony_ciextern void qla2x00_free_irqs(scsi_qla_host_t *);
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ciextern int qla2x00_get_data_rate(scsi_qla_host_t *);
59262306a36Sopenharmony_ciextern const char *qla2x00_get_link_speed_str(struct qla_hw_data *, uint16_t);
59362306a36Sopenharmony_ciextern srb_t *
59462306a36Sopenharmony_ciqla2x00_get_sp_from_handle(scsi_qla_host_t *, const char *, struct req_que *,
59562306a36Sopenharmony_ci	void *);
59662306a36Sopenharmony_ciextern void
59762306a36Sopenharmony_ciqla2x00_process_completed_request(struct scsi_qla_host *, struct req_que *,
59862306a36Sopenharmony_ci	uint32_t);
59962306a36Sopenharmony_ciextern irqreturn_t
60062306a36Sopenharmony_ciqla2xxx_msix_rsp_q(int irq, void *dev_id);
60162306a36Sopenharmony_ciextern irqreturn_t
60262306a36Sopenharmony_ciqla2xxx_msix_rsp_q_hs(int irq, void *dev_id);
60362306a36Sopenharmony_cifc_port_t *qla2x00_find_fcport_by_loopid(scsi_qla_host_t *, uint16_t);
60462306a36Sopenharmony_cifc_port_t *qla2x00_find_fcport_by_wwpn(scsi_qla_host_t *, u8 *, u8);
60562306a36Sopenharmony_cifc_port_t *qla2x00_find_fcport_by_nportid(scsi_qla_host_t *, port_id_t *, u8);
60662306a36Sopenharmony_civoid qla24xx_queue_purex_item(scsi_qla_host_t *, struct purex_item *,
60762306a36Sopenharmony_ci			      void (*process_item)(struct scsi_qla_host *,
60862306a36Sopenharmony_ci			      struct purex_item *));
60962306a36Sopenharmony_civoid __qla_consume_iocb(struct scsi_qla_host *, void **, struct rsp_que **);
61062306a36Sopenharmony_civoid qla2xxx_process_purls_iocb(void **pkt, struct rsp_que **rsp);
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_ci/*
61362306a36Sopenharmony_ci * Global Function Prototypes in qla_sup.c source file.
61462306a36Sopenharmony_ci */
61562306a36Sopenharmony_ciextern int qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *,
61662306a36Sopenharmony_ci    uint32_t, uint32_t);
61762306a36Sopenharmony_ciextern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, void *, uint32_t,
61862306a36Sopenharmony_ci    uint32_t);
61962306a36Sopenharmony_ciextern uint8_t *qla24xx_read_nvram_data(scsi_qla_host_t *, void *, uint32_t,
62062306a36Sopenharmony_ci    uint32_t);
62162306a36Sopenharmony_ciextern int qla2x00_write_nvram_data(scsi_qla_host_t *, void *, uint32_t,
62262306a36Sopenharmony_ci    uint32_t);
62362306a36Sopenharmony_ciextern int qla24xx_write_nvram_data(scsi_qla_host_t *, void *, uint32_t,
62462306a36Sopenharmony_ci    uint32_t);
62562306a36Sopenharmony_ciextern uint8_t *qla25xx_read_nvram_data(scsi_qla_host_t *, void *, uint32_t,
62662306a36Sopenharmony_ci    uint32_t);
62762306a36Sopenharmony_ciextern int qla25xx_write_nvram_data(scsi_qla_host_t *, void *, uint32_t,
62862306a36Sopenharmony_ci    uint32_t);
62962306a36Sopenharmony_ci
63062306a36Sopenharmony_ciextern int qla2x00_is_a_vp_did(scsi_qla_host_t *, uint32_t);
63162306a36Sopenharmony_cibool qla2x00_check_reg32_for_disconnect(scsi_qla_host_t *, uint32_t);
63262306a36Sopenharmony_cibool qla2x00_check_reg16_for_disconnect(scsi_qla_host_t *, uint16_t);
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_ciextern int qla2x00_beacon_on(struct scsi_qla_host *);
63562306a36Sopenharmony_ciextern int qla2x00_beacon_off(struct scsi_qla_host *);
63662306a36Sopenharmony_ciextern void qla2x00_beacon_blink(struct scsi_qla_host *);
63762306a36Sopenharmony_ciextern int qla24xx_beacon_on(struct scsi_qla_host *);
63862306a36Sopenharmony_ciextern int qla24xx_beacon_off(struct scsi_qla_host *);
63962306a36Sopenharmony_ciextern void qla24xx_beacon_blink(struct scsi_qla_host *);
64062306a36Sopenharmony_ciextern void qla83xx_beacon_blink(struct scsi_qla_host *);
64162306a36Sopenharmony_ciextern int qla82xx_beacon_on(struct scsi_qla_host *);
64262306a36Sopenharmony_ciextern int qla82xx_beacon_off(struct scsi_qla_host *);
64362306a36Sopenharmony_ciextern int qla83xx_wr_reg(scsi_qla_host_t *, uint32_t, uint32_t);
64462306a36Sopenharmony_ciextern int qla83xx_rd_reg(scsi_qla_host_t *, uint32_t, uint32_t *);
64562306a36Sopenharmony_ciextern int qla83xx_restart_nic_firmware(scsi_qla_host_t *);
64662306a36Sopenharmony_ciextern int qla83xx_access_control(scsi_qla_host_t *, uint16_t, uint32_t,
64762306a36Sopenharmony_ci				  uint32_t, uint16_t *);
64862306a36Sopenharmony_ci
64962306a36Sopenharmony_ciextern void *qla2x00_read_optrom_data(struct scsi_qla_host *, void *,
65062306a36Sopenharmony_ci					 uint32_t, uint32_t);
65162306a36Sopenharmony_ciextern int qla2x00_write_optrom_data(struct scsi_qla_host *, void *,
65262306a36Sopenharmony_ci				     uint32_t, uint32_t);
65362306a36Sopenharmony_ciextern void *qla24xx_read_optrom_data(struct scsi_qla_host *, void *,
65462306a36Sopenharmony_ci					 uint32_t, uint32_t);
65562306a36Sopenharmony_ciextern int qla24xx_write_optrom_data(struct scsi_qla_host *, void *,
65662306a36Sopenharmony_ci				     uint32_t, uint32_t);
65762306a36Sopenharmony_ciextern void *qla25xx_read_optrom_data(struct scsi_qla_host *, void *,
65862306a36Sopenharmony_ci					 uint32_t, uint32_t);
65962306a36Sopenharmony_ciextern void *qla8044_read_optrom_data(struct scsi_qla_host *,
66062306a36Sopenharmony_ci					 void *, uint32_t, uint32_t);
66162306a36Sopenharmony_ciextern void qla8044_watchdog(struct scsi_qla_host *vha);
66262306a36Sopenharmony_ci
66362306a36Sopenharmony_ciextern int qla2x00_get_flash_version(scsi_qla_host_t *, void *);
66462306a36Sopenharmony_ciextern int qla24xx_get_flash_version(scsi_qla_host_t *, void *);
66562306a36Sopenharmony_ciextern int qla82xx_get_flash_version(scsi_qla_host_t *, void *);
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ciextern int qla2xxx_get_flash_info(scsi_qla_host_t *);
66862306a36Sopenharmony_ciextern int qla2xxx_get_vpd_field(scsi_qla_host_t *, char *, char *, size_t);
66962306a36Sopenharmony_ci
67062306a36Sopenharmony_ciextern void qla2xxx_flash_npiv_conf(scsi_qla_host_t *);
67162306a36Sopenharmony_ciextern int qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *);
67262306a36Sopenharmony_ciextern int qla2x00_mailbox_passthru(struct bsg_job *bsg_job);
67362306a36Sopenharmony_ciint qla2x00_sys_ld_info(struct bsg_job *bsg_job);
67462306a36Sopenharmony_ciint __qla_copy_purex_to_buffer(struct scsi_qla_host *, void **,
67562306a36Sopenharmony_ci	struct rsp_que **, u8 *, u32);
67662306a36Sopenharmony_cistruct purex_item *qla27xx_copy_multiple_pkt(struct scsi_qla_host *vha,
67762306a36Sopenharmony_ci	void **pkt, struct rsp_que **rsp, bool is_purls, bool byte_order);
67862306a36Sopenharmony_ciint qla_mailbox_passthru(scsi_qla_host_t *vha, uint16_t *mbx_in,
67962306a36Sopenharmony_ci			 uint16_t *mbx_out);
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_ci/*
68262306a36Sopenharmony_ci * Global Function Prototypes in qla_dbg.c source file.
68362306a36Sopenharmony_ci */
68462306a36Sopenharmony_civoid qla2xxx_dump_fw(scsi_qla_host_t *vha);
68562306a36Sopenharmony_civoid qla2100_fw_dump(scsi_qla_host_t *vha);
68662306a36Sopenharmony_civoid qla2300_fw_dump(scsi_qla_host_t *vha);
68762306a36Sopenharmony_civoid qla24xx_fw_dump(scsi_qla_host_t *vha);
68862306a36Sopenharmony_civoid qla25xx_fw_dump(scsi_qla_host_t *vha);
68962306a36Sopenharmony_civoid qla81xx_fw_dump(scsi_qla_host_t *vha);
69062306a36Sopenharmony_civoid qla82xx_fw_dump(scsi_qla_host_t *vha);
69162306a36Sopenharmony_civoid qla8044_fw_dump(scsi_qla_host_t *vha);
69262306a36Sopenharmony_ci
69362306a36Sopenharmony_civoid qla27xx_fwdump(scsi_qla_host_t *vha);
69462306a36Sopenharmony_ciextern void qla27xx_mpi_fwdump(scsi_qla_host_t *, int);
69562306a36Sopenharmony_ciextern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *, void *);
69662306a36Sopenharmony_ciextern int qla27xx_fwdt_template_valid(void *);
69762306a36Sopenharmony_ciextern ulong qla27xx_fwdt_template_size(void *);
69862306a36Sopenharmony_ci
69962306a36Sopenharmony_ciextern void qla2xxx_dump_post_process(scsi_qla_host_t *, int);
70062306a36Sopenharmony_ciextern void ql_dump_regs(uint, scsi_qla_host_t *, uint);
70162306a36Sopenharmony_ciextern void ql_dump_buffer(uint, scsi_qla_host_t *, uint, const void *, uint);
70262306a36Sopenharmony_ci/*
70362306a36Sopenharmony_ci * Global Function Prototypes in qla_gs.c source file.
70462306a36Sopenharmony_ci */
70562306a36Sopenharmony_ciextern void *qla2x00_prep_ms_iocb(scsi_qla_host_t *, struct ct_arg *);
70662306a36Sopenharmony_ciextern void *qla24xx_prep_ms_iocb(scsi_qla_host_t *, struct ct_arg *);
70762306a36Sopenharmony_ciextern int qla2x00_ga_nxt(scsi_qla_host_t *, fc_port_t *);
70862306a36Sopenharmony_ciextern int qla2x00_gid_pt(scsi_qla_host_t *, sw_info_t *);
70962306a36Sopenharmony_ciextern int qla2x00_gpn_id(scsi_qla_host_t *, sw_info_t *);
71062306a36Sopenharmony_ciextern int qla2x00_gnn_id(scsi_qla_host_t *, sw_info_t *);
71162306a36Sopenharmony_ciextern void qla2x00_gff_id(scsi_qla_host_t *, sw_info_t *);
71262306a36Sopenharmony_ciextern int qla2x00_rft_id(scsi_qla_host_t *);
71362306a36Sopenharmony_ciextern int qla2x00_rff_id(scsi_qla_host_t *, u8);
71462306a36Sopenharmony_ciextern int qla2x00_rnn_id(scsi_qla_host_t *);
71562306a36Sopenharmony_ciextern int qla2x00_rsnn_nn(scsi_qla_host_t *);
71662306a36Sopenharmony_ciextern void *qla2x00_prep_ms_fdmi_iocb(scsi_qla_host_t *, uint32_t, uint32_t);
71762306a36Sopenharmony_ciextern void *qla24xx_prep_ms_fdmi_iocb(scsi_qla_host_t *, uint32_t, uint32_t);
71862306a36Sopenharmony_ciextern int qla2x00_fdmi_register(scsi_qla_host_t *);
71962306a36Sopenharmony_ciextern int qla2x00_gfpn_id(scsi_qla_host_t *, sw_info_t *);
72062306a36Sopenharmony_ciextern int qla2x00_gpsc(scsi_qla_host_t *, sw_info_t *);
72162306a36Sopenharmony_ciextern size_t qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *, size_t);
72262306a36Sopenharmony_ciextern int qla2x00_chk_ms_status(scsi_qla_host_t *, ms_iocb_entry_t *,
72362306a36Sopenharmony_ci	struct ct_sns_rsp *, const char *);
72462306a36Sopenharmony_ciextern void qla2x00_async_iocb_timeout(void *data);
72562306a36Sopenharmony_ci
72662306a36Sopenharmony_ciint qla24xx_post_gpsc_work(struct scsi_qla_host *, fc_port_t *);
72762306a36Sopenharmony_ciint qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);
72862306a36Sopenharmony_civoid qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *);
72962306a36Sopenharmony_ciint qla2x00_mgmt_svr_login(scsi_qla_host_t *);
73062306a36Sopenharmony_ciint qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool);
73162306a36Sopenharmony_ciint qla24xx_async_gpnft(scsi_qla_host_t *, u8, srb_t *);
73262306a36Sopenharmony_civoid qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *);
73362306a36Sopenharmony_civoid qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *);
73462306a36Sopenharmony_ciint qla24xx_post_gfpnid_work(struct scsi_qla_host *, fc_port_t *);
73562306a36Sopenharmony_ciint qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *);
73662306a36Sopenharmony_civoid qla24xx_handle_gfpnid_event(scsi_qla_host_t *, struct event_arg *);
73762306a36Sopenharmony_civoid qla24xx_sp_unmap(scsi_qla_host_t *, srb_t *);
73862306a36Sopenharmony_civoid qla_scan_work_fn(struct work_struct *);
73962306a36Sopenharmony_ciuint qla25xx_fdmi_port_speed_capability(struct qla_hw_data *);
74062306a36Sopenharmony_ciuint qla25xx_fdmi_port_speed_currently(struct qla_hw_data *);
74162306a36Sopenharmony_ci
74262306a36Sopenharmony_ci/*
74362306a36Sopenharmony_ci * Global Function Prototypes in qla_attr.c source file.
74462306a36Sopenharmony_ci */
74562306a36Sopenharmony_cistruct device_attribute;
74662306a36Sopenharmony_ciextern const struct attribute_group *qla2x00_host_groups[];
74762306a36Sopenharmony_cistruct fc_function_template;
74862306a36Sopenharmony_ciextern struct fc_function_template qla2xxx_transport_functions;
74962306a36Sopenharmony_ciextern struct fc_function_template qla2xxx_transport_vport_functions;
75062306a36Sopenharmony_ciextern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
75162306a36Sopenharmony_ciextern void qla2x00_free_sysfs_attr(scsi_qla_host_t *, bool);
75262306a36Sopenharmony_ciextern void qla2x00_init_host_attr(scsi_qla_host_t *);
75362306a36Sopenharmony_ciextern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
75462306a36Sopenharmony_ciextern int qla2x00_loopback_test(scsi_qla_host_t *, struct msg_echo_lb *, uint16_t *);
75562306a36Sopenharmony_ciextern int qla2x00_echo_test(scsi_qla_host_t *,
75662306a36Sopenharmony_ci	struct msg_echo_lb *, uint16_t *);
75762306a36Sopenharmony_ciextern int qla24xx_update_all_fcp_prio(scsi_qla_host_t *);
75862306a36Sopenharmony_ciextern int qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *,
75962306a36Sopenharmony_ci	struct qla_fcp_prio_cfg *, uint8_t);
76062306a36Sopenharmony_ci/*
76162306a36Sopenharmony_ci * Global Function Prototypes in qla_dfs.c source file.
76262306a36Sopenharmony_ci */
76362306a36Sopenharmony_ciextern int qla2x00_dfs_setup(scsi_qla_host_t *);
76462306a36Sopenharmony_ciextern int qla2x00_dfs_remove(scsi_qla_host_t *);
76562306a36Sopenharmony_ci
76662306a36Sopenharmony_ci/* Globa function prototypes for multi-q */
76762306a36Sopenharmony_ciextern int qla25xx_request_irq(struct qla_hw_data *, struct qla_qpair *,
76862306a36Sopenharmony_ci	struct qla_msix_entry *, int);
76962306a36Sopenharmony_ciextern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *);
77062306a36Sopenharmony_ciextern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *);
77162306a36Sopenharmony_ciextern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t,
77262306a36Sopenharmony_ci	uint16_t, int, uint8_t, bool);
77362306a36Sopenharmony_ciextern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t,
77462306a36Sopenharmony_ci	uint16_t, struct qla_qpair *, bool);
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ciextern void qla2x00_init_response_q_entries(struct rsp_que *);
77762306a36Sopenharmony_ciextern int qla25xx_delete_req_que(struct scsi_qla_host *, struct req_que *);
77862306a36Sopenharmony_ciextern int qla25xx_delete_rsp_que(struct scsi_qla_host *, struct rsp_que *);
77962306a36Sopenharmony_ciextern int qla25xx_delete_queues(struct scsi_qla_host *);
78062306a36Sopenharmony_ci
78162306a36Sopenharmony_ci/* qlafx00 related functions */
78262306a36Sopenharmony_ciextern int qlafx00_pci_config(struct scsi_qla_host *);
78362306a36Sopenharmony_ciextern int qlafx00_initialize_adapter(struct scsi_qla_host *);
78462306a36Sopenharmony_ciextern int qlafx00_soft_reset(scsi_qla_host_t *);
78562306a36Sopenharmony_ciextern int qlafx00_chip_diag(scsi_qla_host_t *);
78662306a36Sopenharmony_ciextern void qlafx00_config_rings(struct scsi_qla_host *);
78762306a36Sopenharmony_ciextern char *qlafx00_pci_info_str(struct scsi_qla_host *, char *, size_t);
78862306a36Sopenharmony_ciextern char *qlafx00_fw_version_str(struct scsi_qla_host *, char *, size_t);
78962306a36Sopenharmony_ciextern irqreturn_t qlafx00_intr_handler(int, void *);
79062306a36Sopenharmony_ciextern void qlafx00_enable_intrs(struct qla_hw_data *);
79162306a36Sopenharmony_ciextern void qlafx00_disable_intrs(struct qla_hw_data *);
79262306a36Sopenharmony_ciextern int qlafx00_abort_target(fc_port_t *, uint64_t, int);
79362306a36Sopenharmony_ciextern int qlafx00_lun_reset(fc_port_t *, uint64_t, int);
79462306a36Sopenharmony_ciextern int qlafx00_start_scsi(srb_t *);
79562306a36Sopenharmony_ciextern int qlafx00_abort_isp(scsi_qla_host_t *);
79662306a36Sopenharmony_ciextern int qlafx00_iospace_config(struct qla_hw_data *);
79762306a36Sopenharmony_ciextern int qlafx00_init_firmware(scsi_qla_host_t *, uint16_t);
79862306a36Sopenharmony_ciextern int qlafx00_driver_shutdown(scsi_qla_host_t *, int);
79962306a36Sopenharmony_ciextern int qlafx00_fw_ready(scsi_qla_host_t *);
80062306a36Sopenharmony_ciextern int qlafx00_configure_devices(scsi_qla_host_t *);
80162306a36Sopenharmony_ciextern int qlafx00_reset_initialize(scsi_qla_host_t *);
80262306a36Sopenharmony_ciextern int qlafx00_fx_disc(scsi_qla_host_t *, fc_port_t *, uint16_t);
80362306a36Sopenharmony_ciextern void qlafx00_process_aen(struct scsi_qla_host *, struct qla_work_evt *);
80462306a36Sopenharmony_ciextern int qlafx00_post_aenfx_work(struct scsi_qla_host *,  uint32_t,
80562306a36Sopenharmony_ci				   uint32_t *, int);
80662306a36Sopenharmony_ciextern uint32_t qlafx00_fw_state_show(struct device *,
80762306a36Sopenharmony_ci				      struct device_attribute *, char *);
80862306a36Sopenharmony_ciextern void qlafx00_get_host_speed(struct Scsi_Host *);
80962306a36Sopenharmony_ciextern void qlafx00_init_response_q_entries(struct rsp_que *);
81062306a36Sopenharmony_ci
81162306a36Sopenharmony_ciextern void qlafx00_tm_iocb(srb_t *, struct tsk_mgmt_entry_fx00 *);
81262306a36Sopenharmony_ciextern void qlafx00_abort_iocb(srb_t *, struct abort_iocb_entry_fx00 *);
81362306a36Sopenharmony_ciextern void qlafx00_fxdisc_iocb(srb_t *, struct fxdisc_entry_fx00 *);
81462306a36Sopenharmony_ciextern void qlafx00_timer_routine(scsi_qla_host_t *);
81562306a36Sopenharmony_ciextern int qlafx00_rescan_isp(scsi_qla_host_t *);
81662306a36Sopenharmony_ci
81762306a36Sopenharmony_ci/* qla82xx related functions */
81862306a36Sopenharmony_ci
81962306a36Sopenharmony_ci/* PCI related functions */
82062306a36Sopenharmony_ciextern int qla82xx_pci_config(struct scsi_qla_host *);
82162306a36Sopenharmony_ciextern int qla82xx_pci_mem_read_2M(struct qla_hw_data *, u64, void *, int);
82262306a36Sopenharmony_ciextern int qla82xx_pci_region_offset(struct pci_dev *, int);
82362306a36Sopenharmony_ciextern int qla82xx_iospace_config(struct qla_hw_data *);
82462306a36Sopenharmony_ci
82562306a36Sopenharmony_ci/* Initialization related functions */
82662306a36Sopenharmony_ciextern int qla82xx_reset_chip(struct scsi_qla_host *);
82762306a36Sopenharmony_ciextern void qla82xx_config_rings(struct scsi_qla_host *);
82862306a36Sopenharmony_ciextern void qla82xx_watchdog(scsi_qla_host_t *);
82962306a36Sopenharmony_ciextern int qla82xx_start_firmware(scsi_qla_host_t *);
83062306a36Sopenharmony_ci
83162306a36Sopenharmony_ci/* Firmware and flash related functions */
83262306a36Sopenharmony_ciextern int qla82xx_load_risc(scsi_qla_host_t *, uint32_t *);
83362306a36Sopenharmony_ciextern void *qla82xx_read_optrom_data(struct scsi_qla_host *, void *,
83462306a36Sopenharmony_ci					 uint32_t, uint32_t);
83562306a36Sopenharmony_ciextern int qla82xx_write_optrom_data(struct scsi_qla_host *, void *,
83662306a36Sopenharmony_ci				     uint32_t, uint32_t);
83762306a36Sopenharmony_ci
83862306a36Sopenharmony_ci/* Mailbox related functions */
83962306a36Sopenharmony_ciextern int qla82xx_abort_isp(scsi_qla_host_t *);
84062306a36Sopenharmony_ciextern int qla82xx_restart_isp(scsi_qla_host_t *);
84162306a36Sopenharmony_ci
84262306a36Sopenharmony_ci/* IOCB related functions */
84362306a36Sopenharmony_ciextern int qla82xx_start_scsi(srb_t *);
84462306a36Sopenharmony_ciextern void qla2x00_sp_free(srb_t *sp);
84562306a36Sopenharmony_ciextern void qla2x00_sp_timeout(struct timer_list *);
84662306a36Sopenharmony_ciextern void qla2x00_bsg_job_done(srb_t *sp, int);
84762306a36Sopenharmony_ciextern void qla2x00_bsg_sp_free(srb_t *sp);
84862306a36Sopenharmony_ciextern void qla2x00_start_iocbs(struct scsi_qla_host *, struct req_que *);
84962306a36Sopenharmony_ci
85062306a36Sopenharmony_ci/* Interrupt related */
85162306a36Sopenharmony_ciextern irqreturn_t qla82xx_intr_handler(int, void *);
85262306a36Sopenharmony_ciextern irqreturn_t qla82xx_msix_default(int, void *);
85362306a36Sopenharmony_ciextern irqreturn_t qla82xx_msix_rsp_q(int, void *);
85462306a36Sopenharmony_ciextern void qla82xx_enable_intrs(struct qla_hw_data *);
85562306a36Sopenharmony_ciextern void qla82xx_disable_intrs(struct qla_hw_data *);
85662306a36Sopenharmony_ciextern void qla82xx_poll(int, void *);
85762306a36Sopenharmony_ciextern void qla82xx_init_flags(struct qla_hw_data *);
85862306a36Sopenharmony_ci
85962306a36Sopenharmony_ci/* ISP 8021 hardware related */
86062306a36Sopenharmony_ciextern void qla82xx_set_drv_active(scsi_qla_host_t *);
86162306a36Sopenharmony_ciextern int qla82xx_wr_32(struct qla_hw_data *, ulong, u32);
86262306a36Sopenharmony_ciextern int qla82xx_rd_32(struct qla_hw_data *, ulong);
86362306a36Sopenharmony_ci
86462306a36Sopenharmony_ci/* ISP 8021 IDC */
86562306a36Sopenharmony_ciextern void qla82xx_clear_drv_active(struct qla_hw_data *);
86662306a36Sopenharmony_ciextern uint32_t  qla82xx_wait_for_state_change(scsi_qla_host_t *, uint32_t);
86762306a36Sopenharmony_ciextern int qla82xx_idc_lock(struct qla_hw_data *);
86862306a36Sopenharmony_ciextern void qla82xx_idc_unlock(struct qla_hw_data *);
86962306a36Sopenharmony_ciextern int qla82xx_device_state_handler(scsi_qla_host_t *);
87062306a36Sopenharmony_ciextern void qla8xxx_dev_failed_handler(scsi_qla_host_t *);
87162306a36Sopenharmony_ciextern void qla82xx_clear_qsnt_ready(scsi_qla_host_t *);
87262306a36Sopenharmony_ci
87362306a36Sopenharmony_ciextern void qla2x00_set_model_info(scsi_qla_host_t *, uint8_t *, size_t,
87462306a36Sopenharmony_ci				   const char *);
87562306a36Sopenharmony_ciextern int qla82xx_mbx_intr_enable(scsi_qla_host_t *);
87662306a36Sopenharmony_ciextern int qla82xx_mbx_intr_disable(scsi_qla_host_t *);
87762306a36Sopenharmony_ciextern void qla82xx_start_iocbs(scsi_qla_host_t *);
87862306a36Sopenharmony_ciextern int qla82xx_fcoe_ctx_reset(scsi_qla_host_t *);
87962306a36Sopenharmony_ciextern int qla82xx_check_md_needed(scsi_qla_host_t *);
88062306a36Sopenharmony_ciextern void qla82xx_chip_reset_cleanup(scsi_qla_host_t *);
88162306a36Sopenharmony_ciextern int qla81xx_set_led_config(scsi_qla_host_t *, uint16_t *);
88262306a36Sopenharmony_ciextern int qla81xx_get_led_config(scsi_qla_host_t *, uint16_t *);
88362306a36Sopenharmony_ciextern int qla82xx_mbx_beacon_ctl(scsi_qla_host_t *, int);
88462306a36Sopenharmony_ciextern const char *qdev_state(uint32_t);
88562306a36Sopenharmony_ciextern void qla82xx_clear_pending_mbx(scsi_qla_host_t *);
88662306a36Sopenharmony_ciextern int qla82xx_read_temperature(scsi_qla_host_t *);
88762306a36Sopenharmony_ciextern int qla8044_read_temperature(scsi_qla_host_t *);
88862306a36Sopenharmony_ciextern int qla2x00_read_sfp_dev(struct scsi_qla_host *, char *, int);
88962306a36Sopenharmony_ciextern int ql26xx_led_config(scsi_qla_host_t *, uint16_t, uint16_t *);
89062306a36Sopenharmony_ci
89162306a36Sopenharmony_ci/* BSG related functions */
89262306a36Sopenharmony_ciextern int qla24xx_bsg_request(struct bsg_job *);
89362306a36Sopenharmony_ciextern int qla24xx_bsg_timeout(struct bsg_job *);
89462306a36Sopenharmony_ciextern int qla84xx_reset_chip(scsi_qla_host_t *, uint16_t);
89562306a36Sopenharmony_ciextern int qla2x00_issue_iocb_timeout(scsi_qla_host_t *, void *,
89662306a36Sopenharmony_ci	dma_addr_t, size_t, uint32_t);
89762306a36Sopenharmony_ciextern int qla2x00_get_idma_speed(scsi_qla_host_t *, uint16_t,
89862306a36Sopenharmony_ci	uint16_t *, uint16_t *);
89962306a36Sopenharmony_ciextern int qla24xx_sadb_update(struct bsg_job *bsg_job);
90062306a36Sopenharmony_ciextern int qla_post_sa_replace_work(struct scsi_qla_host *vha,
90162306a36Sopenharmony_ci	 fc_port_t *fcport, uint16_t nport_handle, struct edif_sa_ctl *sa_ctl);
90262306a36Sopenharmony_ci
90362306a36Sopenharmony_ci/* 83xx related functions */
90462306a36Sopenharmony_civoid qla83xx_fw_dump(scsi_qla_host_t *vha);
90562306a36Sopenharmony_ci
90662306a36Sopenharmony_ci/* Minidump related functions */
90762306a36Sopenharmony_ciextern int qla82xx_md_get_template_size(scsi_qla_host_t *);
90862306a36Sopenharmony_ciextern int qla82xx_md_get_template(scsi_qla_host_t *);
90962306a36Sopenharmony_ciextern int qla82xx_md_alloc(scsi_qla_host_t *);
91062306a36Sopenharmony_ciextern void qla82xx_md_free(scsi_qla_host_t *);
91162306a36Sopenharmony_ciextern int qla82xx_md_collect(scsi_qla_host_t *);
91262306a36Sopenharmony_ciextern void qla82xx_md_prep(scsi_qla_host_t *);
91362306a36Sopenharmony_ciextern void qla82xx_set_reset_owner(scsi_qla_host_t *);
91462306a36Sopenharmony_ciextern int qla82xx_validate_template_chksum(scsi_qla_host_t *vha);
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci/* Function declarations for ISP8044 */
91762306a36Sopenharmony_ciextern int qla8044_idc_lock(struct qla_hw_data *ha);
91862306a36Sopenharmony_ciextern void qla8044_idc_unlock(struct qla_hw_data *ha);
91962306a36Sopenharmony_ciextern uint32_t qla8044_rd_reg(struct qla_hw_data *ha, ulong addr);
92062306a36Sopenharmony_ciextern void qla8044_wr_reg(struct qla_hw_data *ha, ulong addr, uint32_t val);
92162306a36Sopenharmony_ciextern void qla8044_read_reset_template(struct scsi_qla_host *ha);
92262306a36Sopenharmony_ciextern void qla8044_set_idc_dontreset(struct scsi_qla_host *ha);
92362306a36Sopenharmony_ciextern int qla8044_rd_direct(struct scsi_qla_host *vha, const uint32_t crb_reg);
92462306a36Sopenharmony_ciextern void qla8044_wr_direct(struct scsi_qla_host *vha,
92562306a36Sopenharmony_ci			      const uint32_t crb_reg, const uint32_t value);
92662306a36Sopenharmony_ciextern int qla8044_device_state_handler(struct scsi_qla_host *vha);
92762306a36Sopenharmony_ciextern void qla8044_clear_qsnt_ready(struct scsi_qla_host *vha);
92862306a36Sopenharmony_ciextern void qla8044_clear_drv_active(struct qla_hw_data *);
92962306a36Sopenharmony_civoid qla8044_get_minidump(struct scsi_qla_host *vha);
93062306a36Sopenharmony_ciint qla8044_collect_md_data(struct scsi_qla_host *vha);
93162306a36Sopenharmony_ciextern int qla8044_md_get_template(scsi_qla_host_t *);
93262306a36Sopenharmony_ciextern int qla8044_write_optrom_data(struct scsi_qla_host *, void *,
93362306a36Sopenharmony_ci				     uint32_t, uint32_t);
93462306a36Sopenharmony_ciextern irqreturn_t qla8044_intr_handler(int, void *);
93562306a36Sopenharmony_ciextern void qla82xx_mbx_completion(scsi_qla_host_t *, uint16_t);
93662306a36Sopenharmony_ciextern int qla8044_abort_isp(scsi_qla_host_t *);
93762306a36Sopenharmony_ciextern int qla8044_check_fw_alive(struct scsi_qla_host *);
93862306a36Sopenharmony_ciextern int qla_get_exlogin_status(scsi_qla_host_t *, uint16_t *,
93962306a36Sopenharmony_ci	uint16_t *);
94062306a36Sopenharmony_ciextern int qla_set_exlogin_mem_cfg(scsi_qla_host_t *vha, dma_addr_t phys_addr);
94162306a36Sopenharmony_ciextern int qla_get_exchoffld_status(scsi_qla_host_t *, uint16_t *, uint16_t *);
94262306a36Sopenharmony_ciextern int qla_set_exchoffld_mem_cfg(scsi_qla_host_t *);
94362306a36Sopenharmony_ciextern void qlt_handle_abts_recv(struct scsi_qla_host *, struct rsp_que *,
94462306a36Sopenharmony_ci	response_t *);
94562306a36Sopenharmony_ci
94662306a36Sopenharmony_cistruct scsi_qla_host *qla_find_host_by_d_id(struct scsi_qla_host *vha, be_id_t d_id);
94762306a36Sopenharmony_ciint qla24xx_async_notify_ack(scsi_qla_host_t *, fc_port_t *,
94862306a36Sopenharmony_ci	struct imm_ntfy_from_isp *, int);
94962306a36Sopenharmony_civoid qla24xx_do_nack_work(struct scsi_qla_host *, struct qla_work_evt *);
95062306a36Sopenharmony_civoid qlt_plogi_ack_link(struct scsi_qla_host *, struct qlt_plogi_ack_t *,
95162306a36Sopenharmony_ci	struct fc_port *, enum qlt_plogi_link_t);
95262306a36Sopenharmony_civoid qlt_plogi_ack_unref(struct scsi_qla_host *, struct qlt_plogi_ack_t *);
95362306a36Sopenharmony_ciextern void qlt_schedule_sess_for_deletion(struct fc_port *);
95462306a36Sopenharmony_ciextern struct fc_port *qlt_find_sess_invalidate_other(scsi_qla_host_t *,
95562306a36Sopenharmony_ci	uint64_t wwn, port_id_t port_id, uint16_t loop_id, struct fc_port **);
95662306a36Sopenharmony_civoid qla24xx_delete_sess_fn(struct work_struct *);
95762306a36Sopenharmony_civoid qlt_unknown_atio_work_fn(struct work_struct *);
95862306a36Sopenharmony_civoid qla_update_host_map(struct scsi_qla_host *, port_id_t);
95962306a36Sopenharmony_civoid qla_remove_hostmap(struct qla_hw_data *ha);
96062306a36Sopenharmony_civoid qlt_clr_qp_table(struct scsi_qla_host *vha);
96162306a36Sopenharmony_civoid qlt_set_mode(struct scsi_qla_host *);
96262306a36Sopenharmony_ciint qla2x00_set_data_rate(scsi_qla_host_t *vha, uint16_t mode);
96362306a36Sopenharmony_ciextern void qla24xx_process_purex_list(struct purex_list *);
96462306a36Sopenharmony_ciextern void qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp);
96562306a36Sopenharmony_ciextern void qla2x00_dfs_remove_rport(scsi_qla_host_t *vha, struct fc_port *fp);
96662306a36Sopenharmony_ciextern void qla_wait_nvme_release_cmd_kref(srb_t *sp);
96762306a36Sopenharmony_ciextern void qla_nvme_abort_set_option
96862306a36Sopenharmony_ci		(struct abort_entry_24xx *abt, srb_t *sp);
96962306a36Sopenharmony_ciextern void qla_nvme_abort_process_comp_status
97062306a36Sopenharmony_ci		(struct abort_entry_24xx *abt, srb_t *sp);
97162306a36Sopenharmony_cistruct scsi_qla_host *qla_find_host_by_vp_idx(struct scsi_qla_host *vha,
97262306a36Sopenharmony_ci	uint16_t vp_idx);
97362306a36Sopenharmony_ci
97462306a36Sopenharmony_ci/* nvme.c */
97562306a36Sopenharmony_civoid qla_nvme_unregister_remote_port(struct fc_port *fcport);
97662306a36Sopenharmony_ci
97762306a36Sopenharmony_ci/* qla_edif.c */
97862306a36Sopenharmony_cifc_port_t *qla2x00_find_fcport_by_pid(scsi_qla_host_t *vha, port_id_t *id);
97962306a36Sopenharmony_civoid qla_edb_eventcreate(scsi_qla_host_t *vha, uint32_t dbtype, uint32_t data, uint32_t data2,
98062306a36Sopenharmony_ci		fc_port_t *fcport);
98162306a36Sopenharmony_civoid qla_edb_stop(scsi_qla_host_t *vha);
98262306a36Sopenharmony_ciint32_t qla_edif_app_mgmt(struct bsg_job *bsg_job);
98362306a36Sopenharmony_civoid qla_enode_init(scsi_qla_host_t *vha);
98462306a36Sopenharmony_civoid qla_enode_stop(scsi_qla_host_t *vha);
98562306a36Sopenharmony_civoid qla_edif_flush_sa_ctl_lists(fc_port_t *fcport);
98662306a36Sopenharmony_civoid qla_edb_init(scsi_qla_host_t *vha);
98762306a36Sopenharmony_civoid qla_edif_timer(scsi_qla_host_t *vha);
98862306a36Sopenharmony_ciint qla28xx_start_scsi_edif(srb_t *sp);
98962306a36Sopenharmony_civoid qla24xx_sa_update_iocb(srb_t *sp, struct sa_update_28xx *sa_update_iocb);
99062306a36Sopenharmony_civoid qla24xx_sa_replace_iocb(srb_t *sp, struct sa_update_28xx *sa_update_iocb);
99162306a36Sopenharmony_civoid qla24xx_auth_els(scsi_qla_host_t *vha, void **pkt, struct rsp_que **rsp);
99262306a36Sopenharmony_civoid qla28xx_sa_update_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
99362306a36Sopenharmony_ci		struct sa_update_28xx *pkt);
99462306a36Sopenharmony_civoid qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea);
99562306a36Sopenharmony_ci
99662306a36Sopenharmony_ci#define QLA2XX_HW_ERROR			BIT_0
99762306a36Sopenharmony_ci#define QLA2XX_SHT_LNK_DWN		BIT_1
99862306a36Sopenharmony_ci#define QLA2XX_INT_ERR			BIT_2
99962306a36Sopenharmony_ci#define QLA2XX_CMD_TIMEOUT		BIT_3
100062306a36Sopenharmony_ci#define QLA2XX_RESET_CMD_ERR		BIT_4
100162306a36Sopenharmony_ci#define QLA2XX_TGT_SHT_LNK_DOWN		BIT_17
100262306a36Sopenharmony_ci
100362306a36Sopenharmony_ci#define QLA2XX_MAX_LINK_DOWN_TIME	100
100462306a36Sopenharmony_ci
100562306a36Sopenharmony_ciint qla2xxx_start_stats(struct Scsi_Host *shost, u32 flags);
100662306a36Sopenharmony_ciint qla2xxx_stop_stats(struct Scsi_Host *shost, u32 flags);
100762306a36Sopenharmony_ciint qla2xxx_reset_stats(struct Scsi_Host *shost, u32 flags);
100862306a36Sopenharmony_ci
100962306a36Sopenharmony_ciint qla2xxx_get_ini_stats(struct Scsi_Host *shost, u32 flags, void *data, u64 size);
101062306a36Sopenharmony_ciint qla2xxx_get_tgt_stats(struct Scsi_Host *shost, u32 flags,
101162306a36Sopenharmony_ci			  struct fc_rport *rport, void *data, u64 size);
101262306a36Sopenharmony_ciint qla2xxx_disable_port(struct Scsi_Host *shost);
101362306a36Sopenharmony_ciint qla2xxx_enable_port(struct Scsi_Host *shost);
101462306a36Sopenharmony_ci
101562306a36Sopenharmony_ciuint64_t qla2x00_get_num_tgts(scsi_qla_host_t *vha);
101662306a36Sopenharmony_ciuint64_t qla2x00_count_set_bits(u32 num);
101762306a36Sopenharmony_ciint qla_create_buf_pool(struct scsi_qla_host *, struct qla_qpair *);
101862306a36Sopenharmony_civoid qla_free_buf_pool(struct qla_qpair *);
101962306a36Sopenharmony_ciint qla_get_buf(struct scsi_qla_host *, struct qla_qpair *, struct qla_buf_dsc *);
102062306a36Sopenharmony_civoid qla_put_buf(struct qla_qpair *, struct qla_buf_dsc *);
102162306a36Sopenharmony_ci#endif /* _QLA_GBL_H */
1022