]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - include/linux/qed/storage_common.h
Merge tag 'kbuild-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
[mirror_ubuntu-jammy-kernel.git] / include / linux / qed / storage_common.h
CommitLineData
1f4d4ed6 1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
7a9b6b8f 2/* QLogic qed NIC Driver
e8f1cb50 3 * Copyright (c) 2015-2017 QLogic Corporation
663eacd8 4 * Copyright (c) 2019-2020 Marvell International Ltd.
7a9b6b8f
YM
5 */
6
7#ifndef __STORAGE_COMMON__
8#define __STORAGE_COMMON__
9
a2e7699e
TT
10/*********************/
11/* SCSI CONSTANTS */
12/*********************/
7a9b6b8f 13
da090917 14#define SCSI_MAX_NUM_OF_CMDQS (NUM_OF_GLOBAL_QUEUES / 2)
a2e7699e 15#define BDQ_NUM_RESOURCES (4)
7a9b6b8f 16
a2e7699e
TT
17#define BDQ_ID_RQ (0)
18#define BDQ_ID_IMM_DATA (1)
da090917
TT
19#define BDQ_ID_TQ (2)
20#define BDQ_NUM_IDS (3)
be086e7c 21
a2e7699e 22#define SCSI_NUM_SGES_SLOW_SGL_THR 8
7a9b6b8f 23
a2e7699e
TT
24#define BDQ_MAX_EXTERNAL_RING_SIZE BIT(15)
25
da090917
TT
26/* SCSI op codes */
27#define SCSI_OPCODE_COMPARE_AND_WRITE (0x89)
28#define SCSI_OPCODE_READ_10 (0x28)
29#define SCSI_OPCODE_WRITE_6 (0x0A)
30#define SCSI_OPCODE_WRITE_10 (0x2A)
31#define SCSI_OPCODE_WRITE_12 (0xAA)
32#define SCSI_OPCODE_WRITE_16 (0x8A)
33#define SCSI_OPCODE_WRITE_AND_VERIFY_10 (0x2E)
34#define SCSI_OPCODE_WRITE_AND_VERIFY_12 (0xAE)
35#define SCSI_OPCODE_WRITE_AND_VERIFY_16 (0x8E)
36
37/* iSCSI Drv opaque */
38struct iscsi_drv_opaque {
39 __le16 reserved_zero[3];
40 __le16 opaque;
41};
42
43/* Scsi 2B/8B opaque union */
44union scsi_opaque {
45 struct regpair fcoe_opaque;
46 struct iscsi_drv_opaque iscsi_opaque;
47};
48
a2e7699e 49/* SCSI buffer descriptor */
7a9b6b8f
YM
50struct scsi_bd {
51 struct regpair address;
da090917 52 union scsi_opaque opaque;
7a9b6b8f
YM
53};
54
a2e7699e 55/* Scsi Drv BDQ struct */
7a9b6b8f
YM
56struct scsi_bdq_ram_drv_data {
57 __le16 external_producer;
58 __le16 reserved0[3];
59};
60
a2e7699e 61/* SCSI SGE entry */
be086e7c
MY
62struct scsi_sge {
63 struct regpair sge_addr;
64 __le32 sge_len;
65 __le32 reserved;
66};
67
a2e7699e 68/* Cached SGEs section */
be086e7c
MY
69struct scsi_cached_sges {
70 struct scsi_sge sge[4];
71};
72
a2e7699e 73/* Scsi Drv CMDQ struct */
7a9b6b8f
YM
74struct scsi_drv_cmdq {
75 __le16 cmdq_cons;
76 __le16 reserved0;
77 __le32 reserved1;
78};
79
a2e7699e 80/* Common SCSI init params passed by driver to FW in function init ramrod */
7a9b6b8f
YM
81struct scsi_init_func_params {
82 __le16 num_tasks;
83 u8 log_page_size;
6459d936 84 u8 log_page_size_conn;
7a9b6b8f 85 u8 debug_mode;
6459d936 86 u8 reserved2[11];
7a9b6b8f
YM
87};
88
a2e7699e 89/* SCSI RQ/CQ/CMDQ firmware function init parameters */
7a9b6b8f
YM
90struct scsi_init_func_queues {
91 struct regpair glbl_q_params_addr;
92 __le16 rq_buffer_size;
93 __le16 cq_num_entries;
94 __le16 cmdq_num_entries;
95 u8 bdq_resource_id;
96 u8 q_validity;
a2e7699e
TT
97#define SCSI_INIT_FUNC_QUEUES_RQ_VALID_MASK 0x1
98#define SCSI_INIT_FUNC_QUEUES_RQ_VALID_SHIFT 0
99#define SCSI_INIT_FUNC_QUEUES_IMM_DATA_VALID_MASK 0x1
100#define SCSI_INIT_FUNC_QUEUES_IMM_DATA_VALID_SHIFT 1
101#define SCSI_INIT_FUNC_QUEUES_CMD_VALID_MASK 0x1
102#define SCSI_INIT_FUNC_QUEUES_CMD_VALID_SHIFT 2
da090917
TT
103#define SCSI_INIT_FUNC_QUEUES_TQ_VALID_MASK 0x1
104#define SCSI_INIT_FUNC_QUEUES_TQ_VALID_SHIFT 3
105#define SCSI_INIT_FUNC_QUEUES_SOC_EN_MASK 0x1
106#define SCSI_INIT_FUNC_QUEUES_SOC_EN_SHIFT 4
107#define SCSI_INIT_FUNC_QUEUES_SOC_NUM_OF_BLOCKS_LOG_MASK 0x7
108#define SCSI_INIT_FUNC_QUEUES_SOC_NUM_OF_BLOCKS_LOG_SHIFT 5
109 __le16 cq_cmdq_sb_num_arr[SCSI_MAX_NUM_OF_CMDQS];
7a9b6b8f
YM
110 u8 num_queues;
111 u8 queue_relative_offset;
112 u8 cq_sb_pi;
113 u8 cmdq_sb_pi;
7a9b6b8f 114 u8 bdq_pbl_num_entries[BDQ_NUM_IDS];
da090917 115 u8 reserved1;
7a9b6b8f
YM
116 struct regpair bdq_pbl_base_address[BDQ_NUM_IDS];
117 __le16 bdq_xoff_threshold[BDQ_NUM_IDS];
7a9b6b8f 118 __le16 cmdq_xoff_threshold;
da090917 119 __le16 bdq_xon_threshold[BDQ_NUM_IDS];
7a9b6b8f 120 __le16 cmdq_xon_threshold;
7a9b6b8f
YM
121};
122
a2e7699e 123/* Scsi Drv BDQ Data struct (2 BDQ IDs: 0 - RQ, 1 - Immediate Data) */
7a9b6b8f
YM
124struct scsi_ram_per_bdq_resource_drv_data {
125 struct scsi_bdq_ram_drv_data drv_data_per_bdq_id[BDQ_NUM_IDS];
126};
127
a2e7699e 128/* SCSI SGL types */
be086e7c
MY
129enum scsi_sgl_mode {
130 SCSI_TX_SLOW_SGL,
131 SCSI_FAST_SGL,
132 MAX_SCSI_SGL_MODE
133};
134
a2e7699e 135/* SCSI SGL parameters */
be086e7c
MY
136struct scsi_sgl_params {
137 struct regpair sgl_addr;
138 __le32 sgl_total_length;
139 __le32 sge_offset;
140 __le16 sgl_num_sges;
141 u8 sgl_index;
142 u8 reserved;
7a9b6b8f
YM
143};
144
a2e7699e 145/* SCSI terminate connection params */
7a9b6b8f
YM
146struct scsi_terminate_extra_params {
147 __le16 unsolicited_cq_count;
148 __le16 cmdq_count;
149 u8 reserved[4];
150};
151
da090917
TT
152/* SCSI Task Queue Element */
153struct scsi_tqe {
154 __le16 itid;
155};
156
7a9b6b8f 157#endif /* __STORAGE_COMMON__ */