cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

storage_common.h (3853B)


      1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
      2/* QLogic qed NIC Driver
      3 * Copyright (c) 2015-2017  QLogic Corporation
      4 * Copyright (c) 2019-2020 Marvell International Ltd.
      5 */
      6
      7#ifndef __STORAGE_COMMON__
      8#define __STORAGE_COMMON__
      9
     10/*********************/
     11/* SCSI CONSTANTS */
     12/*********************/
     13
     14#define SCSI_MAX_NUM_OF_CMDQS		(NUM_OF_GLOBAL_QUEUES / 2)
     15#define BDQ_NUM_RESOURCES		(4)
     16
     17#define BDQ_ID_RQ			(0)
     18#define BDQ_ID_IMM_DATA			(1)
     19#define BDQ_ID_TQ			(2)
     20#define BDQ_NUM_IDS			(3)
     21
     22#define SCSI_NUM_SGES_SLOW_SGL_THR	8
     23
     24#define BDQ_MAX_EXTERNAL_RING_SIZE	BIT(15)
     25
     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
     49/* SCSI buffer descriptor */
     50struct scsi_bd {
     51	struct regpair address;
     52	union scsi_opaque opaque;
     53};
     54
     55/* Scsi Drv BDQ struct */
     56struct scsi_bdq_ram_drv_data {
     57	__le16 external_producer;
     58	__le16 reserved0[3];
     59};
     60
     61/* SCSI SGE entry */
     62struct scsi_sge {
     63	struct regpair sge_addr;
     64	__le32 sge_len;
     65	__le32 reserved;
     66};
     67
     68/* Cached SGEs section */
     69struct scsi_cached_sges {
     70	struct scsi_sge sge[4];
     71};
     72
     73/* Scsi Drv CMDQ struct */
     74struct scsi_drv_cmdq {
     75	__le16 cmdq_cons;
     76	__le16 reserved0;
     77	__le32 reserved1;
     78};
     79
     80/* Common SCSI init params passed by driver to FW in function init ramrod */
     81struct scsi_init_func_params {
     82	__le16 num_tasks;
     83	u8 log_page_size;
     84	u8 log_page_size_conn;
     85	u8 debug_mode;
     86	u8 reserved2[11];
     87};
     88
     89/* SCSI RQ/CQ/CMDQ firmware function init parameters */
     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;
     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
    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];
    110	u8 num_queues;
    111	u8 queue_relative_offset;
    112	u8 cq_sb_pi;
    113	u8 cmdq_sb_pi;
    114	u8 bdq_pbl_num_entries[BDQ_NUM_IDS];
    115	u8 reserved1;
    116	struct regpair bdq_pbl_base_address[BDQ_NUM_IDS];
    117	__le16 bdq_xoff_threshold[BDQ_NUM_IDS];
    118	__le16 cmdq_xoff_threshold;
    119	__le16 bdq_xon_threshold[BDQ_NUM_IDS];
    120	__le16 cmdq_xon_threshold;
    121};
    122
    123/* Scsi Drv BDQ Data struct (2 BDQ IDs: 0 - RQ, 1 - Immediate Data) */
    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
    128/* SCSI SGL types */
    129enum scsi_sgl_mode {
    130	SCSI_TX_SLOW_SGL,
    131	SCSI_FAST_SGL,
    132	MAX_SCSI_SGL_MODE
    133};
    134
    135/* SCSI SGL parameters */
    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;
    143};
    144
    145/* SCSI terminate connection params */
    146struct scsi_terminate_extra_params {
    147	__le16 unsolicited_cq_count;
    148	__le16 cmdq_count;
    149	u8 reserved[4];
    150};
    151
    152/* SCSI Task Queue Element */
    153struct scsi_tqe {
    154	__le16 itid;
    155};
    156
    157#endif /* __STORAGE_COMMON__ */