1 /* QLogic qed NIC Driver
2  * Copyright (c) 2015 QLogic Corporation
3  *
4  * This software is available under the terms of the GNU General Public License
5  * (GPL) Version 2, available from the file COPYING in the main directory of
6  * this source tree.
7  */
8 
9 #ifndef __STORAGE_COMMON__
10 #define __STORAGE_COMMON__
11 
12 #define NUM_OF_CMDQS_CQS (NUM_OF_GLOBAL_QUEUES / 2)
13 #define BDQ_NUM_RESOURCES (4)
14 
15 #define BDQ_ID_RQ                        (0)
16 #define BDQ_ID_IMM_DATA          (1)
17 #define BDQ_NUM_IDS          (2)
18 
19 #define BDQ_MAX_EXTERNAL_RING_SIZE (1 << 15)
20 
21 struct scsi_bd {
22 	struct regpair address;
23 	struct regpair opaque;
24 };
25 
26 struct scsi_bdq_ram_drv_data {
27 	__le16 external_producer;
28 	__le16 reserved0[3];
29 };
30 
31 struct scsi_drv_cmdq {
32 	__le16 cmdq_cons;
33 	__le16 reserved0;
34 	__le32 reserved1;
35 };
36 
37 struct scsi_init_func_params {
38 	__le16 num_tasks;
39 	u8 log_page_size;
40 	u8 debug_mode;
41 	u8 reserved2[12];
42 };
43 
44 struct scsi_init_func_queues {
45 	struct regpair glbl_q_params_addr;
46 	__le16 rq_buffer_size;
47 	__le16 cq_num_entries;
48 	__le16 cmdq_num_entries;
49 	u8 bdq_resource_id;
50 	u8 q_validity;
51 #define SCSI_INIT_FUNC_QUEUES_RQ_VALID_MASK        0x1
52 #define SCSI_INIT_FUNC_QUEUES_RQ_VALID_SHIFT       0
53 #define SCSI_INIT_FUNC_QUEUES_IMM_DATA_VALID_MASK  0x1
54 #define SCSI_INIT_FUNC_QUEUES_IMM_DATA_VALID_SHIFT 1
55 #define SCSI_INIT_FUNC_QUEUES_CMD_VALID_MASK       0x1
56 #define SCSI_INIT_FUNC_QUEUES_CMD_VALID_SHIFT      2
57 #define SCSI_INIT_FUNC_QUEUES_RESERVED_VALID_MASK  0x1F
58 #define SCSI_INIT_FUNC_QUEUES_RESERVED_VALID_SHIFT 3
59 	u8 num_queues;
60 	u8 queue_relative_offset;
61 	u8 cq_sb_pi;
62 	u8 cmdq_sb_pi;
63 	__le16 cq_cmdq_sb_num_arr[NUM_OF_CMDQS_CQS];
64 	__le16 reserved0;
65 	u8 bdq_pbl_num_entries[BDQ_NUM_IDS];
66 	struct regpair bdq_pbl_base_address[BDQ_NUM_IDS];
67 	__le16 bdq_xoff_threshold[BDQ_NUM_IDS];
68 	__le16 bdq_xon_threshold[BDQ_NUM_IDS];
69 	__le16 cmdq_xoff_threshold;
70 	__le16 cmdq_xon_threshold;
71 	__le32 reserved1;
72 };
73 
74 struct scsi_ram_per_bdq_resource_drv_data {
75 	struct scsi_bdq_ram_drv_data drv_data_per_bdq_id[BDQ_NUM_IDS];
76 };
77 
78 struct scsi_sge {
79 	struct regpair sge_addr;
80 	__le16 sge_len;
81 	__le16 reserved0;
82 	__le32 reserved1;
83 };
84 
85 struct scsi_terminate_extra_params {
86 	__le16 unsolicited_cq_count;
87 	__le16 cmdq_count;
88 	u8 reserved[4];
89 };
90 
91 #endif /* __STORAGE_COMMON__ */
92