18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * QLogic Fibre Channel HBA Driver
48c2ecf20Sopenharmony_ci * Copyright (c)  2003-2014 QLogic Corporation
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include "qla_def.h"
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/*
108c2ecf20Sopenharmony_ci * Firmware Dump structure definition
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct qla2300_fw_dump {
148c2ecf20Sopenharmony_ci	__be16 hccr;
158c2ecf20Sopenharmony_ci	__be16 pbiu_reg[8];
168c2ecf20Sopenharmony_ci	__be16 risc_host_reg[8];
178c2ecf20Sopenharmony_ci	__be16 mailbox_reg[32];
188c2ecf20Sopenharmony_ci	__be16 resp_dma_reg[32];
198c2ecf20Sopenharmony_ci	__be16 dma_reg[48];
208c2ecf20Sopenharmony_ci	__be16 risc_hdw_reg[16];
218c2ecf20Sopenharmony_ci	__be16 risc_gp0_reg[16];
228c2ecf20Sopenharmony_ci	__be16 risc_gp1_reg[16];
238c2ecf20Sopenharmony_ci	__be16 risc_gp2_reg[16];
248c2ecf20Sopenharmony_ci	__be16 risc_gp3_reg[16];
258c2ecf20Sopenharmony_ci	__be16 risc_gp4_reg[16];
268c2ecf20Sopenharmony_ci	__be16 risc_gp5_reg[16];
278c2ecf20Sopenharmony_ci	__be16 risc_gp6_reg[16];
288c2ecf20Sopenharmony_ci	__be16 risc_gp7_reg[16];
298c2ecf20Sopenharmony_ci	__be16 frame_buf_hdw_reg[64];
308c2ecf20Sopenharmony_ci	__be16 fpm_b0_reg[64];
318c2ecf20Sopenharmony_ci	__be16 fpm_b1_reg[64];
328c2ecf20Sopenharmony_ci	__be16 risc_ram[0xf800];
338c2ecf20Sopenharmony_ci	__be16 stack_ram[0x1000];
348c2ecf20Sopenharmony_ci	__be16 data_ram[1];
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistruct qla2100_fw_dump {
388c2ecf20Sopenharmony_ci	__be16 hccr;
398c2ecf20Sopenharmony_ci	__be16 pbiu_reg[8];
408c2ecf20Sopenharmony_ci	__be16 mailbox_reg[32];
418c2ecf20Sopenharmony_ci	__be16 dma_reg[48];
428c2ecf20Sopenharmony_ci	__be16 risc_hdw_reg[16];
438c2ecf20Sopenharmony_ci	__be16 risc_gp0_reg[16];
448c2ecf20Sopenharmony_ci	__be16 risc_gp1_reg[16];
458c2ecf20Sopenharmony_ci	__be16 risc_gp2_reg[16];
468c2ecf20Sopenharmony_ci	__be16 risc_gp3_reg[16];
478c2ecf20Sopenharmony_ci	__be16 risc_gp4_reg[16];
488c2ecf20Sopenharmony_ci	__be16 risc_gp5_reg[16];
498c2ecf20Sopenharmony_ci	__be16 risc_gp6_reg[16];
508c2ecf20Sopenharmony_ci	__be16 risc_gp7_reg[16];
518c2ecf20Sopenharmony_ci	__be16 frame_buf_hdw_reg[16];
528c2ecf20Sopenharmony_ci	__be16 fpm_b0_reg[64];
538c2ecf20Sopenharmony_ci	__be16 fpm_b1_reg[64];
548c2ecf20Sopenharmony_ci	__be16 risc_ram[0xf000];
558c2ecf20Sopenharmony_ci	u8	queue_dump[];
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistruct qla24xx_fw_dump {
598c2ecf20Sopenharmony_ci	__be32	host_status;
608c2ecf20Sopenharmony_ci	__be32	host_reg[32];
618c2ecf20Sopenharmony_ci	__be32	shadow_reg[7];
628c2ecf20Sopenharmony_ci	__be16	mailbox_reg[32];
638c2ecf20Sopenharmony_ci	__be32	xseq_gp_reg[128];
648c2ecf20Sopenharmony_ci	__be32	xseq_0_reg[16];
658c2ecf20Sopenharmony_ci	__be32	xseq_1_reg[16];
668c2ecf20Sopenharmony_ci	__be32	rseq_gp_reg[128];
678c2ecf20Sopenharmony_ci	__be32	rseq_0_reg[16];
688c2ecf20Sopenharmony_ci	__be32	rseq_1_reg[16];
698c2ecf20Sopenharmony_ci	__be32	rseq_2_reg[16];
708c2ecf20Sopenharmony_ci	__be32	cmd_dma_reg[16];
718c2ecf20Sopenharmony_ci	__be32	req0_dma_reg[15];
728c2ecf20Sopenharmony_ci	__be32	resp0_dma_reg[15];
738c2ecf20Sopenharmony_ci	__be32	req1_dma_reg[15];
748c2ecf20Sopenharmony_ci	__be32	xmt0_dma_reg[32];
758c2ecf20Sopenharmony_ci	__be32	xmt1_dma_reg[32];
768c2ecf20Sopenharmony_ci	__be32	xmt2_dma_reg[32];
778c2ecf20Sopenharmony_ci	__be32	xmt3_dma_reg[32];
788c2ecf20Sopenharmony_ci	__be32	xmt4_dma_reg[32];
798c2ecf20Sopenharmony_ci	__be32	xmt_data_dma_reg[16];
808c2ecf20Sopenharmony_ci	__be32	rcvt0_data_dma_reg[32];
818c2ecf20Sopenharmony_ci	__be32	rcvt1_data_dma_reg[32];
828c2ecf20Sopenharmony_ci	__be32	risc_gp_reg[128];
838c2ecf20Sopenharmony_ci	__be32	lmc_reg[112];
848c2ecf20Sopenharmony_ci	__be32	fpm_hdw_reg[192];
858c2ecf20Sopenharmony_ci	__be32	fb_hdw_reg[176];
868c2ecf20Sopenharmony_ci	__be32	code_ram[0x2000];
878c2ecf20Sopenharmony_ci	__be32	ext_mem[1];
888c2ecf20Sopenharmony_ci};
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_cistruct qla25xx_fw_dump {
918c2ecf20Sopenharmony_ci	__be32	host_status;
928c2ecf20Sopenharmony_ci	__be32	host_risc_reg[32];
938c2ecf20Sopenharmony_ci	__be32	pcie_regs[4];
948c2ecf20Sopenharmony_ci	__be32	host_reg[32];
958c2ecf20Sopenharmony_ci	__be32	shadow_reg[11];
968c2ecf20Sopenharmony_ci	__be32	risc_io_reg;
978c2ecf20Sopenharmony_ci	__be16	mailbox_reg[32];
988c2ecf20Sopenharmony_ci	__be32	xseq_gp_reg[128];
998c2ecf20Sopenharmony_ci	__be32	xseq_0_reg[48];
1008c2ecf20Sopenharmony_ci	__be32	xseq_1_reg[16];
1018c2ecf20Sopenharmony_ci	__be32	rseq_gp_reg[128];
1028c2ecf20Sopenharmony_ci	__be32	rseq_0_reg[32];
1038c2ecf20Sopenharmony_ci	__be32	rseq_1_reg[16];
1048c2ecf20Sopenharmony_ci	__be32	rseq_2_reg[16];
1058c2ecf20Sopenharmony_ci	__be32	aseq_gp_reg[128];
1068c2ecf20Sopenharmony_ci	__be32	aseq_0_reg[32];
1078c2ecf20Sopenharmony_ci	__be32	aseq_1_reg[16];
1088c2ecf20Sopenharmony_ci	__be32	aseq_2_reg[16];
1098c2ecf20Sopenharmony_ci	__be32	cmd_dma_reg[16];
1108c2ecf20Sopenharmony_ci	__be32	req0_dma_reg[15];
1118c2ecf20Sopenharmony_ci	__be32	resp0_dma_reg[15];
1128c2ecf20Sopenharmony_ci	__be32	req1_dma_reg[15];
1138c2ecf20Sopenharmony_ci	__be32	xmt0_dma_reg[32];
1148c2ecf20Sopenharmony_ci	__be32	xmt1_dma_reg[32];
1158c2ecf20Sopenharmony_ci	__be32	xmt2_dma_reg[32];
1168c2ecf20Sopenharmony_ci	__be32	xmt3_dma_reg[32];
1178c2ecf20Sopenharmony_ci	__be32	xmt4_dma_reg[32];
1188c2ecf20Sopenharmony_ci	__be32	xmt_data_dma_reg[16];
1198c2ecf20Sopenharmony_ci	__be32	rcvt0_data_dma_reg[32];
1208c2ecf20Sopenharmony_ci	__be32	rcvt1_data_dma_reg[32];
1218c2ecf20Sopenharmony_ci	__be32	risc_gp_reg[128];
1228c2ecf20Sopenharmony_ci	__be32	lmc_reg[128];
1238c2ecf20Sopenharmony_ci	__be32	fpm_hdw_reg[192];
1248c2ecf20Sopenharmony_ci	__be32	fb_hdw_reg[192];
1258c2ecf20Sopenharmony_ci	__be32	code_ram[0x2000];
1268c2ecf20Sopenharmony_ci	__be32	ext_mem[1];
1278c2ecf20Sopenharmony_ci};
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_cistruct qla81xx_fw_dump {
1308c2ecf20Sopenharmony_ci	__be32	host_status;
1318c2ecf20Sopenharmony_ci	__be32	host_risc_reg[32];
1328c2ecf20Sopenharmony_ci	__be32	pcie_regs[4];
1338c2ecf20Sopenharmony_ci	__be32	host_reg[32];
1348c2ecf20Sopenharmony_ci	__be32	shadow_reg[11];
1358c2ecf20Sopenharmony_ci	__be32	risc_io_reg;
1368c2ecf20Sopenharmony_ci	__be16	mailbox_reg[32];
1378c2ecf20Sopenharmony_ci	__be32	xseq_gp_reg[128];
1388c2ecf20Sopenharmony_ci	__be32	xseq_0_reg[48];
1398c2ecf20Sopenharmony_ci	__be32	xseq_1_reg[16];
1408c2ecf20Sopenharmony_ci	__be32	rseq_gp_reg[128];
1418c2ecf20Sopenharmony_ci	__be32	rseq_0_reg[32];
1428c2ecf20Sopenharmony_ci	__be32	rseq_1_reg[16];
1438c2ecf20Sopenharmony_ci	__be32	rseq_2_reg[16];
1448c2ecf20Sopenharmony_ci	__be32	aseq_gp_reg[128];
1458c2ecf20Sopenharmony_ci	__be32	aseq_0_reg[32];
1468c2ecf20Sopenharmony_ci	__be32	aseq_1_reg[16];
1478c2ecf20Sopenharmony_ci	__be32	aseq_2_reg[16];
1488c2ecf20Sopenharmony_ci	__be32	cmd_dma_reg[16];
1498c2ecf20Sopenharmony_ci	__be32	req0_dma_reg[15];
1508c2ecf20Sopenharmony_ci	__be32	resp0_dma_reg[15];
1518c2ecf20Sopenharmony_ci	__be32	req1_dma_reg[15];
1528c2ecf20Sopenharmony_ci	__be32	xmt0_dma_reg[32];
1538c2ecf20Sopenharmony_ci	__be32	xmt1_dma_reg[32];
1548c2ecf20Sopenharmony_ci	__be32	xmt2_dma_reg[32];
1558c2ecf20Sopenharmony_ci	__be32	xmt3_dma_reg[32];
1568c2ecf20Sopenharmony_ci	__be32	xmt4_dma_reg[32];
1578c2ecf20Sopenharmony_ci	__be32	xmt_data_dma_reg[16];
1588c2ecf20Sopenharmony_ci	__be32	rcvt0_data_dma_reg[32];
1598c2ecf20Sopenharmony_ci	__be32	rcvt1_data_dma_reg[32];
1608c2ecf20Sopenharmony_ci	__be32	risc_gp_reg[128];
1618c2ecf20Sopenharmony_ci	__be32	lmc_reg[128];
1628c2ecf20Sopenharmony_ci	__be32	fpm_hdw_reg[224];
1638c2ecf20Sopenharmony_ci	__be32	fb_hdw_reg[208];
1648c2ecf20Sopenharmony_ci	__be32	code_ram[0x2000];
1658c2ecf20Sopenharmony_ci	__be32	ext_mem[1];
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_cistruct qla83xx_fw_dump {
1698c2ecf20Sopenharmony_ci	__be32	host_status;
1708c2ecf20Sopenharmony_ci	__be32	host_risc_reg[48];
1718c2ecf20Sopenharmony_ci	__be32	pcie_regs[4];
1728c2ecf20Sopenharmony_ci	__be32	host_reg[32];
1738c2ecf20Sopenharmony_ci	__be32	shadow_reg[11];
1748c2ecf20Sopenharmony_ci	__be32	risc_io_reg;
1758c2ecf20Sopenharmony_ci	__be16	mailbox_reg[32];
1768c2ecf20Sopenharmony_ci	__be32	xseq_gp_reg[256];
1778c2ecf20Sopenharmony_ci	__be32	xseq_0_reg[48];
1788c2ecf20Sopenharmony_ci	__be32	xseq_1_reg[16];
1798c2ecf20Sopenharmony_ci	__be32	xseq_2_reg[16];
1808c2ecf20Sopenharmony_ci	__be32	rseq_gp_reg[256];
1818c2ecf20Sopenharmony_ci	__be32	rseq_0_reg[32];
1828c2ecf20Sopenharmony_ci	__be32	rseq_1_reg[16];
1838c2ecf20Sopenharmony_ci	__be32	rseq_2_reg[16];
1848c2ecf20Sopenharmony_ci	__be32	rseq_3_reg[16];
1858c2ecf20Sopenharmony_ci	__be32	aseq_gp_reg[256];
1868c2ecf20Sopenharmony_ci	__be32	aseq_0_reg[32];
1878c2ecf20Sopenharmony_ci	__be32	aseq_1_reg[16];
1888c2ecf20Sopenharmony_ci	__be32	aseq_2_reg[16];
1898c2ecf20Sopenharmony_ci	__be32	aseq_3_reg[16];
1908c2ecf20Sopenharmony_ci	__be32	cmd_dma_reg[64];
1918c2ecf20Sopenharmony_ci	__be32	req0_dma_reg[15];
1928c2ecf20Sopenharmony_ci	__be32	resp0_dma_reg[15];
1938c2ecf20Sopenharmony_ci	__be32	req1_dma_reg[15];
1948c2ecf20Sopenharmony_ci	__be32	xmt0_dma_reg[32];
1958c2ecf20Sopenharmony_ci	__be32	xmt1_dma_reg[32];
1968c2ecf20Sopenharmony_ci	__be32	xmt2_dma_reg[32];
1978c2ecf20Sopenharmony_ci	__be32	xmt3_dma_reg[32];
1988c2ecf20Sopenharmony_ci	__be32	xmt4_dma_reg[32];
1998c2ecf20Sopenharmony_ci	__be32	xmt_data_dma_reg[16];
2008c2ecf20Sopenharmony_ci	__be32	rcvt0_data_dma_reg[32];
2018c2ecf20Sopenharmony_ci	__be32	rcvt1_data_dma_reg[32];
2028c2ecf20Sopenharmony_ci	__be32	risc_gp_reg[128];
2038c2ecf20Sopenharmony_ci	__be32	lmc_reg[128];
2048c2ecf20Sopenharmony_ci	__be32	fpm_hdw_reg[256];
2058c2ecf20Sopenharmony_ci	__be32	rq0_array_reg[256];
2068c2ecf20Sopenharmony_ci	__be32	rq1_array_reg[256];
2078c2ecf20Sopenharmony_ci	__be32	rp0_array_reg[256];
2088c2ecf20Sopenharmony_ci	__be32	rp1_array_reg[256];
2098c2ecf20Sopenharmony_ci	__be32	queue_control_reg[16];
2108c2ecf20Sopenharmony_ci	__be32	fb_hdw_reg[432];
2118c2ecf20Sopenharmony_ci	__be32	at0_array_reg[128];
2128c2ecf20Sopenharmony_ci	__be32	code_ram[0x2400];
2138c2ecf20Sopenharmony_ci	__be32	ext_mem[1];
2148c2ecf20Sopenharmony_ci};
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci#define EFT_NUM_BUFFERS		4
2178c2ecf20Sopenharmony_ci#define EFT_BYTES_PER_BUFFER	0x4000
2188c2ecf20Sopenharmony_ci#define EFT_SIZE		((EFT_BYTES_PER_BUFFER) * (EFT_NUM_BUFFERS))
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci#define FCE_NUM_BUFFERS		64
2218c2ecf20Sopenharmony_ci#define FCE_BYTES_PER_BUFFER	0x400
2228c2ecf20Sopenharmony_ci#define FCE_SIZE		((FCE_BYTES_PER_BUFFER) * (FCE_NUM_BUFFERS))
2238c2ecf20Sopenharmony_ci#define fce_calc_size(b)	((FCE_BYTES_PER_BUFFER) * (b))
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_cistruct qla2xxx_fce_chain {
2268c2ecf20Sopenharmony_ci	__be32	type;
2278c2ecf20Sopenharmony_ci	__be32	chain_size;
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci	__be32	size;
2308c2ecf20Sopenharmony_ci	__be32	addr_l;
2318c2ecf20Sopenharmony_ci	__be32	addr_h;
2328c2ecf20Sopenharmony_ci	__be32	eregs[8];
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/* used by exchange off load and extended login offload */
2368c2ecf20Sopenharmony_cistruct qla2xxx_offld_chain {
2378c2ecf20Sopenharmony_ci	__be32	type;
2388c2ecf20Sopenharmony_ci	__be32	chain_size;
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	__be32	size;
2418c2ecf20Sopenharmony_ci	__be32	reserved;
2428c2ecf20Sopenharmony_ci	__be64	addr;
2438c2ecf20Sopenharmony_ci};
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_cistruct qla2xxx_mq_chain {
2468c2ecf20Sopenharmony_ci	__be32	type;
2478c2ecf20Sopenharmony_ci	__be32	chain_size;
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	__be32	count;
2508c2ecf20Sopenharmony_ci	__be32	qregs[4 * QLA_MQ_SIZE];
2518c2ecf20Sopenharmony_ci};
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_cistruct qla2xxx_mqueue_header {
2548c2ecf20Sopenharmony_ci	__be32	queue;
2558c2ecf20Sopenharmony_ci#define TYPE_REQUEST_QUEUE	0x1
2568c2ecf20Sopenharmony_ci#define TYPE_RESPONSE_QUEUE	0x2
2578c2ecf20Sopenharmony_ci#define TYPE_ATIO_QUEUE		0x3
2588c2ecf20Sopenharmony_ci	__be32	number;
2598c2ecf20Sopenharmony_ci	__be32	size;
2608c2ecf20Sopenharmony_ci};
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_cistruct qla2xxx_mqueue_chain {
2638c2ecf20Sopenharmony_ci	__be32	type;
2648c2ecf20Sopenharmony_ci	__be32	chain_size;
2658c2ecf20Sopenharmony_ci};
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci#define DUMP_CHAIN_VARIANT	0x80000000
2688c2ecf20Sopenharmony_ci#define DUMP_CHAIN_FCE		0x7FFFFAF0
2698c2ecf20Sopenharmony_ci#define DUMP_CHAIN_MQ		0x7FFFFAF1
2708c2ecf20Sopenharmony_ci#define DUMP_CHAIN_QUEUE	0x7FFFFAF2
2718c2ecf20Sopenharmony_ci#define DUMP_CHAIN_EXLOGIN	0x7FFFFAF3
2728c2ecf20Sopenharmony_ci#define DUMP_CHAIN_EXCHG	0x7FFFFAF4
2738c2ecf20Sopenharmony_ci#define DUMP_CHAIN_LAST		0x80000000
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_cistruct qla2xxx_fw_dump {
2768c2ecf20Sopenharmony_ci	uint8_t signature[4];
2778c2ecf20Sopenharmony_ci	__be32	version;
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci	__be32 fw_major_version;
2808c2ecf20Sopenharmony_ci	__be32 fw_minor_version;
2818c2ecf20Sopenharmony_ci	__be32 fw_subminor_version;
2828c2ecf20Sopenharmony_ci	__be32 fw_attributes;
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	__be32 vendor;
2858c2ecf20Sopenharmony_ci	__be32 device;
2868c2ecf20Sopenharmony_ci	__be32 subsystem_vendor;
2878c2ecf20Sopenharmony_ci	__be32 subsystem_device;
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	__be32	fixed_size;
2908c2ecf20Sopenharmony_ci	__be32	mem_size;
2918c2ecf20Sopenharmony_ci	__be32	req_q_size;
2928c2ecf20Sopenharmony_ci	__be32	rsp_q_size;
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci	__be32	eft_size;
2958c2ecf20Sopenharmony_ci	__be32	eft_addr_l;
2968c2ecf20Sopenharmony_ci	__be32	eft_addr_h;
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	__be32	header_size;
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci	union {
3018c2ecf20Sopenharmony_ci		struct qla2100_fw_dump isp21;
3028c2ecf20Sopenharmony_ci		struct qla2300_fw_dump isp23;
3038c2ecf20Sopenharmony_ci		struct qla24xx_fw_dump isp24;
3048c2ecf20Sopenharmony_ci		struct qla25xx_fw_dump isp25;
3058c2ecf20Sopenharmony_ci		struct qla81xx_fw_dump isp81;
3068c2ecf20Sopenharmony_ci		struct qla83xx_fw_dump isp83;
3078c2ecf20Sopenharmony_ci	} isp;
3088c2ecf20Sopenharmony_ci};
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci#define QL_MSGHDR "qla2xxx"
3118c2ecf20Sopenharmony_ci#define QL_DBG_DEFAULT1_MASK    0x1e400000
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci#define ql_log_fatal		0 /* display fatal errors */
3148c2ecf20Sopenharmony_ci#define ql_log_warn		1 /* display critical errors */
3158c2ecf20Sopenharmony_ci#define ql_log_info		2 /* display all recovered errors */
3168c2ecf20Sopenharmony_ci#define ql_log_all		3 /* This value is only used by ql_errlev.
3178c2ecf20Sopenharmony_ci				   * No messages will use this value.
3188c2ecf20Sopenharmony_ci				   * This should be always highest value
3198c2ecf20Sopenharmony_ci				   * as compared to other log levels.
3208c2ecf20Sopenharmony_ci				   */
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ciextern uint ql_errlev;
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_civoid __attribute__((format (printf, 4, 5)))
3258c2ecf20Sopenharmony_ciql_dbg(uint, scsi_qla_host_t *vha, uint, const char *fmt, ...);
3268c2ecf20Sopenharmony_civoid __attribute__((format (printf, 4, 5)))
3278c2ecf20Sopenharmony_ciql_dbg_pci(uint, struct pci_dev *pdev, uint, const char *fmt, ...);
3288c2ecf20Sopenharmony_civoid __attribute__((format (printf, 4, 5)))
3298c2ecf20Sopenharmony_ciql_dbg_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_civoid __attribute__((format (printf, 4, 5)))
3338c2ecf20Sopenharmony_ciql_log(uint, scsi_qla_host_t *vha, uint, const char *fmt, ...);
3348c2ecf20Sopenharmony_civoid __attribute__((format (printf, 4, 5)))
3358c2ecf20Sopenharmony_ciql_log_pci(uint, struct pci_dev *pdev, uint, const char *fmt, ...);
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_civoid __attribute__((format (printf, 4, 5)))
3388c2ecf20Sopenharmony_ciql_log_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci/* Debug Levels */
3418c2ecf20Sopenharmony_ci/* The 0x40000000 is the max value any debug level can have
3428c2ecf20Sopenharmony_ci * as ql2xextended_error_logging is of type signed int
3438c2ecf20Sopenharmony_ci */
3448c2ecf20Sopenharmony_ci#define ql_dbg_init	0x40000000 /* Init Debug */
3458c2ecf20Sopenharmony_ci#define ql_dbg_mbx	0x20000000 /* MBX Debug */
3468c2ecf20Sopenharmony_ci#define ql_dbg_disc	0x10000000 /* Device Discovery Debug */
3478c2ecf20Sopenharmony_ci#define ql_dbg_io	0x08000000 /* IO Tracing Debug */
3488c2ecf20Sopenharmony_ci#define ql_dbg_dpc	0x04000000 /* DPC Thead Debug */
3498c2ecf20Sopenharmony_ci#define ql_dbg_async	0x02000000 /* Async events Debug */
3508c2ecf20Sopenharmony_ci#define ql_dbg_timer	0x01000000 /* Timer Debug */
3518c2ecf20Sopenharmony_ci#define ql_dbg_user	0x00800000 /* User Space Interations Debug */
3528c2ecf20Sopenharmony_ci#define ql_dbg_taskm	0x00400000 /* Task Management Debug */
3538c2ecf20Sopenharmony_ci#define ql_dbg_aer	0x00200000 /* AER/EEH Debug */
3548c2ecf20Sopenharmony_ci#define ql_dbg_multiq	0x00100000 /* MultiQ Debug */
3558c2ecf20Sopenharmony_ci#define ql_dbg_p3p	0x00080000 /* P3P specific Debug */
3568c2ecf20Sopenharmony_ci#define ql_dbg_vport	0x00040000 /* Virtual Port Debug */
3578c2ecf20Sopenharmony_ci#define ql_dbg_buffer	0x00020000 /* For dumping the buffer/regs */
3588c2ecf20Sopenharmony_ci#define ql_dbg_misc	0x00010000 /* For dumping everything that is not
3598c2ecf20Sopenharmony_ci				    * not covered by upper categories
3608c2ecf20Sopenharmony_ci				    */
3618c2ecf20Sopenharmony_ci#define ql_dbg_verbose	0x00008000 /* More verbosity for each level
3628c2ecf20Sopenharmony_ci				    * This is to be used with other levels where
3638c2ecf20Sopenharmony_ci				    * more verbosity is required. It might not
3648c2ecf20Sopenharmony_ci				    * be applicable to all the levels.
3658c2ecf20Sopenharmony_ci				    */
3668c2ecf20Sopenharmony_ci#define ql_dbg_tgt	0x00004000 /* Target mode */
3678c2ecf20Sopenharmony_ci#define ql_dbg_tgt_mgt	0x00002000 /* Target mode management */
3688c2ecf20Sopenharmony_ci#define ql_dbg_tgt_tmr	0x00001000 /* Target mode task management */
3698c2ecf20Sopenharmony_ci#define ql_dbg_tgt_dif  0x00000800 /* Target mode dif */
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ciextern int qla27xx_dump_mpi_ram(struct qla_hw_data *, uint32_t, uint32_t *,
3728c2ecf20Sopenharmony_ci	uint32_t, void **);
3738c2ecf20Sopenharmony_ciextern int qla24xx_dump_ram(struct qla_hw_data *, uint32_t, __be32 *,
3748c2ecf20Sopenharmony_ci	uint32_t, void **);
3758c2ecf20Sopenharmony_ciextern void qla24xx_pause_risc(struct device_reg_24xx __iomem *,
3768c2ecf20Sopenharmony_ci	struct qla_hw_data *);
3778c2ecf20Sopenharmony_ciextern int qla24xx_soft_reset(struct qla_hw_data *);
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_cistatic inline int
3808c2ecf20Sopenharmony_ciql_mask_match(uint level)
3818c2ecf20Sopenharmony_ci{
3828c2ecf20Sopenharmony_ci	if (ql2xextended_error_logging == 1)
3838c2ecf20Sopenharmony_ci		ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK;
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci	return (level & ql2xextended_error_logging) == level;
3868c2ecf20Sopenharmony_ci}
387