Linux 6.1.31 headers

This commit is contained in:
pepe
2023-06-07 11:35:51 +00:00
commit d6821a2e0a
980 changed files with 193325 additions and 0 deletions

276
scsi/cxlflash_ioctl.h Normal file
View File

@@ -0,0 +1,276 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* CXL Flash Device Driver
*
* Written by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>, IBM Corporation
* Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
*
* Copyright (C) 2015 IBM Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _CXLFLASH_IOCTL_H
#define _CXLFLASH_IOCTL_H
#include <linux/types.h>
/*
* Structure and definitions for all CXL Flash ioctls
*/
#define CXLFLASH_WWID_LEN 16
/*
* Structure and flag definitions CXL Flash superpipe ioctls
*/
#define DK_CXLFLASH_VERSION_0 0
struct dk_cxlflash_hdr {
__u16 version; /* Version data */
__u16 rsvd[3]; /* Reserved for future use */
__u64 flags; /* Input flags */
__u64 return_flags; /* Returned flags */
};
/*
* Return flag definitions available to all superpipe ioctls
*
* Similar to the input flags, these are grown from the bottom-up with the
* intention that ioctl-specific return flag definitions would grow from the
* top-down, allowing the two sets to co-exist. While not required/enforced
* at this time, this provides future flexibility.
*/
#define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL
#define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL
#define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL
/*
* General Notes:
* -------------
* The 'context_id' field of all ioctl structures contains the context
* identifier for a context in the lower 32-bits (upper 32-bits are not
* to be used when identifying a context to the AFU). That said, the value
* in its entirety (all 64-bits) is to be treated as an opaque cookie and
* should be presented as such when issuing ioctls.
*/
/*
* DK_CXLFLASH_ATTACH Notes:
* ------------------------
* Read/write access permissions are specified via the O_RDONLY, O_WRONLY,
* and O_RDWR flags defined in the fcntl.h header file.
*
* A valid adapter file descriptor (fd >= 0) is only returned on the initial
* attach (successful) of a context. When a context is shared(reused), the user
* is expected to already 'know' the adapter file descriptor associated with the
* context.
*/
#define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL
struct dk_cxlflash_attach {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 num_interrupts; /* Requested number of interrupts */
__u64 context_id; /* Returned context */
__u64 mmio_size; /* Returned size of MMIO area */
__u64 block_size; /* Returned block size, in bytes */
__u64 adap_fd; /* Returned adapter file descriptor */
__u64 last_lba; /* Returned last LBA on the device */
__u64 max_xfer; /* Returned max transfer size, blocks */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_detach {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context to detach */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_udirect {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context to own physical resources */
__u64 rsrc_handle; /* Returned resource handle */
__u64 last_lba; /* Returned last LBA on the device */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL
struct dk_cxlflash_uvirtual {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context to own virtual resources */
__u64 lun_size; /* Requested size, in 4K blocks */
__u64 rsrc_handle; /* Returned resource handle */
__u64 last_lba; /* Returned last LBA of LUN */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_release {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context owning resources */
__u64 rsrc_handle; /* Resource handle to release */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_resize {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context owning resources */
__u64 rsrc_handle; /* Resource handle of LUN to resize */
__u64 req_size; /* New requested size, in 4K blocks */
__u64 last_lba; /* Returned last LBA of LUN */
__u64 reserved[8]; /* Reserved for future use */
};
struct dk_cxlflash_clone {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id_src; /* Context to clone from */
__u64 context_id_dst; /* Context to clone to */
__u64 adap_fd_src; /* Source context adapter fd */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_VERIFY_SENSE_LEN 18
#define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL
struct dk_cxlflash_verify {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 context_id; /* Context owning resources to verify */
__u64 rsrc_handle; /* Resource handle of LUN */
__u64 hint; /* Reasons for verify */
__u64 last_lba; /* Returned last LBA of device */
__u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN]; /* SCSI sense data */
__u8 pad[6]; /* Pad to next 8-byte boundary */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL
struct dk_cxlflash_recover_afu {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u64 reason; /* Reason for recovery request */
__u64 context_id; /* Context to recover / updated ID */
__u64 mmio_size; /* Returned size of MMIO area */
__u64 adap_fd; /* Returned adapter file descriptor */
__u64 reserved[8]; /* Reserved for future use */
};
#define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN
#define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL
#define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL
#define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL
struct dk_cxlflash_manage_lun {
struct dk_cxlflash_hdr hdr; /* Common fields */
__u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN]; /* Page83 WWID, NAA-6 */
__u64 reserved[8]; /* Rsvd, future use */
};
union cxlflash_ioctls {
struct dk_cxlflash_attach attach;
struct dk_cxlflash_detach detach;
struct dk_cxlflash_udirect udirect;
struct dk_cxlflash_uvirtual uvirtual;
struct dk_cxlflash_release release;
struct dk_cxlflash_resize resize;
struct dk_cxlflash_clone clone;
struct dk_cxlflash_verify verify;
struct dk_cxlflash_recover_afu recover_afu;
struct dk_cxlflash_manage_lun manage_lun;
};
#define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls))
#define CXL_MAGIC 0xCA
#define CXL_IOWR(_n, _s) _IOWR(CXL_MAGIC, _n, struct _s)
/*
* CXL Flash superpipe ioctls start at base of the reserved CXL_MAGIC
* region (0x80) and grow upwards.
*/
#define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach)
#define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect)
#define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release)
#define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach)
#define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify)
#define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu)
#define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun)
#define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual)
#define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize)
#define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone)
/*
* Structure and flag definitions CXL Flash host ioctls
*/
#define HT_CXLFLASH_VERSION_0 0
struct ht_cxlflash_hdr {
__u16 version; /* Version data */
__u16 subcmd; /* Sub-command */
__u16 rsvd[2]; /* Reserved for future use */
__u64 flags; /* Input flags */
__u64 return_flags; /* Returned flags */
};
/*
* Input flag definitions available to all host ioctls
*
* These are grown from the bottom-up with the intention that ioctl-specific
* input flag definitions would grow from the top-down, allowing the two sets
* to co-exist. While not required/enforced at this time, this provides future
* flexibility.
*/
#define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL
#define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL
#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001
#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002
#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003
struct ht_cxlflash_lun_provision {
struct ht_cxlflash_hdr hdr; /* Common fields */
__u16 port; /* Target port for provision request */
__u16 reserved16[3]; /* Reserved for future use */
__u64 size; /* Size of LUN (4K blocks) */
__u64 lun_id; /* SCSI LUN ID */
__u8 wwid[CXLFLASH_WWID_LEN];/* Page83 WWID, NAA-6 */
__u64 max_num_luns; /* Maximum number of LUNs provisioned */
__u64 cur_num_luns; /* Current number of LUNs provisioned */
__u64 max_cap_port; /* Total capacity for port (4K blocks) */
__u64 cur_cap_port; /* Current capacity for port (4K blocks) */
__u64 reserved[8]; /* Reserved for future use */
};
#define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144 /* 256K */
#define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12
struct ht_cxlflash_afu_debug {
struct ht_cxlflash_hdr hdr; /* Common fields */
__u8 reserved8[4]; /* Reserved for future use */
__u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN]; /* AFU subcommand,
* (pass through)
*/
__u64 data_ea; /* Data buffer effective address */
__u32 data_len; /* Data buffer length */
__u32 reserved32; /* Reserved for future use */
__u64 reserved[8]; /* Reserved for future use */
};
union cxlflash_ht_ioctls {
struct ht_cxlflash_lun_provision lun_provision;
struct ht_cxlflash_afu_debug afu_debug;
};
#define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls))
/*
* CXL Flash host ioctls start at the top of the reserved CXL_MAGIC
* region (0xBF) and grow downwards.
*/
#define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision)
#define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug)
#endif /* ifndef _CXLFLASH_IOCTL_H */

1253
scsi/fc/fc_els.h Normal file

File diff suppressed because it is too large Load Diff

338
scsi/fc/fc_fs.h Normal file
View File

@@ -0,0 +1,338 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FC_FS_H_
#define _FC_FS_H_
#include <linux/types.h>
/*
* Fibre Channel Framing and Signalling definitions.
* From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
*/
/*
* Frame header
*/
struct fc_frame_header {
__u8 fh_r_ctl; /* routing control */
__u8 fh_d_id[3]; /* Destination ID */
__u8 fh_cs_ctl; /* class of service control / pri */
__u8 fh_s_id[3]; /* Source ID */
__u8 fh_type; /* see enum fc_fh_type below */
__u8 fh_f_ctl[3]; /* frame control */
__u8 fh_seq_id; /* sequence ID */
__u8 fh_df_ctl; /* data field control */
__be16 fh_seq_cnt; /* sequence count */
__be16 fh_ox_id; /* originator exchange ID */
__be16 fh_rx_id; /* responder exchange ID */
__be32 fh_parm_offset; /* parameter or relative offset */
};
#define FC_FRAME_HEADER_LEN 24 /* expected length of structure */
#define FC_MAX_PAYLOAD 2112U /* max payload length in bytes */
#define FC_MIN_MAX_PAYLOAD 256U /* lower limit on max payload */
#define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
#define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
/*
* fh_r_ctl - Routing control definitions.
*/
/*
* FC-4 device_data.
*/
enum fc_rctl {
FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */
FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */
FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */
FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */
FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */
FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */
FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */
FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */
#define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL /* ILS request */
#define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL /* ILS reply */
/*
* Extended Link_Data
*/
FC_RCTL_ELS_REQ = 0x22, /* extended link services request */
FC_RCTL_ELS_REP = 0x23, /* extended link services reply */
FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */
FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */
/*
* Optional Extended Headers
*/
FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */
FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */
FC_RCTL_ENCH = 0x52, /* encapsulation header */
/*
* Basic Link Services fh_r_ctl values.
*/
FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */
FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */
FC_RCTL_BA_RMC = 0x82, /* remove connection */
FC_RCTL_BA_ACC = 0x84, /* basic accept */
FC_RCTL_BA_RJT = 0x85, /* basic reject */
FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */
/*
* Link Control Information.
*/
FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */
FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */
FC_RCTL_P_RJT = 0xc2, /* port reject */
FC_RCTL_F_RJT = 0xc3, /* fabric reject */
FC_RCTL_P_BSY = 0xc4, /* port busy */
FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */
FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */
FC_RCTL_LCR = 0xc7, /* link credit reset */
FC_RCTL_END = 0xc9, /* end */
};
/* incomplete list of definitions */
/*
* R_CTL names initializer.
* Please keep this matching the above definitions.
*/
#define FC_RCTL_NAMES_INIT { \
[FC_RCTL_DD_UNCAT] = "uncat", \
[FC_RCTL_DD_SOL_DATA] = "sol data", \
[FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \
[FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \
[FC_RCTL_DD_UNSOL_DATA] = "unsol data", \
[FC_RCTL_DD_DATA_DESC] = "data desc", \
[FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \
[FC_RCTL_DD_CMD_STATUS] = "cmd status", \
[FC_RCTL_ELS_REQ] = "ELS req", \
[FC_RCTL_ELS_REP] = "ELS rep", \
[FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \
[FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \
[FC_RCTL_BA_NOP] = "BLS NOP", \
[FC_RCTL_BA_ABTS] = "BLS abort", \
[FC_RCTL_BA_RMC] = "BLS remove connection", \
[FC_RCTL_BA_ACC] = "BLS accept", \
[FC_RCTL_BA_RJT] = "BLS reject", \
[FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \
[FC_RCTL_ACK_1] = "LC ACK_1", \
[FC_RCTL_ACK_0] = "LC ACK_0", \
[FC_RCTL_P_RJT] = "LC port reject", \
[FC_RCTL_F_RJT] = "LC fabric reject", \
[FC_RCTL_P_BSY] = "LC port busy", \
[FC_RCTL_F_BSY] = "LC fabric busy to data frame", \
[FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\
[FC_RCTL_LCR] = "LC link credit reset", \
[FC_RCTL_END] = "LC end", \
}
/*
* Well-known fabric addresses.
*/
enum fc_well_known_fid {
FC_FID_NONE = 0x000000, /* No destination */
FC_FID_BCAST = 0xffffff, /* broadcast */
FC_FID_FLOGI = 0xfffffe, /* fabric login */
FC_FID_FCTRL = 0xfffffd, /* fabric controller */
FC_FID_DIR_SERV = 0xfffffc, /* directory server */
FC_FID_TIME_SERV = 0xfffffb, /* time server */
FC_FID_MGMT_SERV = 0xfffffa, /* management server */
FC_FID_QOS = 0xfffff9, /* QoS Facilitator */
FC_FID_ALIASES = 0xfffff8, /* alias server (FC-PH2) */
FC_FID_SEC_KEY = 0xfffff7, /* Security key dist. server */
FC_FID_CLOCK = 0xfffff6, /* clock synch server */
FC_FID_MCAST_SERV = 0xfffff5, /* multicast server */
};
#define FC_FID_WELL_KNOWN_MAX 0xffffff /* highest well-known fabric ID */
#define FC_FID_WELL_KNOWN_BASE 0xfffff5 /* start of well-known fabric ID */
/*
* Other well-known addresses, outside the above contiguous range.
*/
#define FC_FID_DOM_MGR 0xfffc00 /* domain manager base */
/*
* Fabric ID bytes.
*/
#define FC_FID_DOMAIN 0
#define FC_FID_PORT 1
#define FC_FID_LINK 2
/*
* fh_type codes
*/
enum fc_fh_type {
FC_TYPE_BLS = 0x00, /* basic link service */
FC_TYPE_ELS = 0x01, /* extended link service */
FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */
FC_TYPE_FCP = 0x08, /* SCSI FCP */
FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */
FC_TYPE_ILS = 0x22, /* internal link service */
FC_TYPE_NVME = 0x28, /* FC-NVME */
};
/*
* FC_TYPE names initializer.
* Please keep this matching the above definitions.
*/
#define FC_TYPE_NAMES_INIT { \
[FC_TYPE_BLS] = "BLS", \
[FC_TYPE_ELS] = "ELS", \
[FC_TYPE_IP] = "IP", \
[FC_TYPE_FCP] = "FCP", \
[FC_TYPE_CT] = "CT", \
[FC_TYPE_ILS] = "ILS", \
[FC_TYPE_NVME] = "NVME", \
}
/*
* Exchange IDs.
*/
#define FC_XID_UNKNOWN 0xffff /* unknown exchange ID */
#define FC_XID_MIN 0x0 /* supported min exchange ID */
#define FC_XID_MAX 0xfffe /* supported max exchange ID */
/*
* fh_f_ctl - Frame control flags.
*/
#define FC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */
#define FC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */
#define FC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */
#define FC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */
#define FC_FC_END_SEQ (1 << 19) /* last frame of sequence */
#define FC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */
#define FC_FC_RES_B17 (1 << 17) /* reserved */
#define FC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */
#define FC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */
#define FC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */
#define FC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */
#define FC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */
#define FC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */
#define FC_FC_RES_B11 (1 << 11) /* reserved */
#define FC_FC_RES_B10 (1 << 10) /* reserved */
#define FC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */
#define FC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */
#define FC_FC_CONT_SEQ(i) ((i) << 6)
#define FC_FC_ABT_SEQ(i) ((i) << 4)
#define FC_FC_REL_OFF (1 << 3) /* parameter is relative offset */
#define FC_FC_RES2 (1 << 2) /* reserved */
#define FC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */
/*
* BA_ACC payload.
*/
struct fc_ba_acc {
__u8 ba_seq_id_val; /* SEQ_ID validity */
#define FC_BA_SEQ_ID_VAL 0x80
__u8 ba_seq_id; /* SEQ_ID of seq last deliverable */
__u8 ba_resvd[2]; /* reserved */
__be16 ba_ox_id; /* OX_ID for aborted seq or exch */
__be16 ba_rx_id; /* RX_ID for aborted seq or exch */
__be16 ba_low_seq_cnt; /* low SEQ_CNT of aborted seq */
__be16 ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */
};
/*
* BA_RJT: Basic Reject payload.
*/
struct fc_ba_rjt {
__u8 br_resvd; /* reserved */
__u8 br_reason; /* reason code */
__u8 br_explan; /* reason explanation */
__u8 br_vendor; /* vendor unique code */
};
/*
* BA_RJT reason codes.
* From FS-2.
*/
enum fc_ba_rjt_reason {
FC_BA_RJT_NONE = 0, /* in software this means no reject */
FC_BA_RJT_INVL_CMD = 0x01, /* invalid command code */
FC_BA_RJT_LOG_ERR = 0x03, /* logical error */
FC_BA_RJT_LOG_BUSY = 0x05, /* logical busy */
FC_BA_RJT_PROTO_ERR = 0x07, /* protocol error */
FC_BA_RJT_UNABLE = 0x09, /* unable to perform request */
FC_BA_RJT_VENDOR = 0xff, /* vendor-specific (see br_vendor) */
};
/*
* BA_RJT reason code explanations.
*/
enum fc_ba_rjt_explan {
FC_BA_RJT_EXP_NONE = 0x00, /* no additional expanation */
FC_BA_RJT_INV_XID = 0x03, /* invalid OX_ID-RX_ID combination */
FC_BA_RJT_ABT = 0x05, /* sequence aborted, no seq info */
};
/*
* P_RJT or F_RJT: Port Reject or Fabric Reject parameter field.
*/
struct fc_pf_rjt {
__u8 rj_action; /* reserved */
__u8 rj_reason; /* reason code */
__u8 rj_resvd; /* reserved */
__u8 rj_vendor; /* vendor unique code */
};
/*
* P_RJT and F_RJT reject reason codes.
*/
enum fc_pf_rjt_reason {
FC_RJT_NONE = 0, /* non-reject (reserved by standard) */
FC_RJT_INVL_DID = 0x01, /* invalid destination ID */
FC_RJT_INVL_SID = 0x02, /* invalid source ID */
FC_RJT_P_UNAV_T = 0x03, /* port unavailable, temporary */
FC_RJT_P_UNAV = 0x04, /* port unavailable, permanent */
FC_RJT_CLS_UNSUP = 0x05, /* class not supported */
FC_RJT_DEL_USAGE = 0x06, /* delimiter usage error */
FC_RJT_TYPE_UNSUP = 0x07, /* type not supported */
FC_RJT_LINK_CTL = 0x08, /* invalid link control */
FC_RJT_R_CTL = 0x09, /* invalid R_CTL field */
FC_RJT_F_CTL = 0x0a, /* invalid F_CTL field */
FC_RJT_OX_ID = 0x0b, /* invalid originator exchange ID */
FC_RJT_RX_ID = 0x0c, /* invalid responder exchange ID */
FC_RJT_SEQ_ID = 0x0d, /* invalid sequence ID */
FC_RJT_DF_CTL = 0x0e, /* invalid DF_CTL field */
FC_RJT_SEQ_CNT = 0x0f, /* invalid SEQ_CNT field */
FC_RJT_PARAM = 0x10, /* invalid parameter field */
FC_RJT_EXCH_ERR = 0x11, /* exchange error */
FC_RJT_PROTO = 0x12, /* protocol error */
FC_RJT_LEN = 0x13, /* incorrect length */
FC_RJT_UNEXP_ACK = 0x14, /* unexpected ACK */
FC_RJT_FAB_CLASS = 0x15, /* class unsupported by fabric entity */
FC_RJT_LOGI_REQ = 0x16, /* login required */
FC_RJT_SEQ_XS = 0x17, /* excessive sequences attempted */
FC_RJT_EXCH_EST = 0x18, /* unable to establish exchange */
FC_RJT_FAB_UNAV = 0x1a, /* fabric unavailable */
FC_RJT_VC_ID = 0x1b, /* invalid VC_ID (class 4) */
FC_RJT_CS_CTL = 0x1c, /* invalid CS_CTL field */
FC_RJT_INSUF_RES = 0x1d, /* insuff. resources for VC (Class 4) */
FC_RJT_INVL_CLS = 0x1f, /* invalid class of service */
FC_RJT_PREEMT_RJT = 0x20, /* preemption request rejected */
FC_RJT_PREEMT_DIS = 0x21, /* preemption not enabled */
FC_RJT_MCAST_ERR = 0x22, /* multicast error */
FC_RJT_MCAST_ET = 0x23, /* multicast error terminate */
FC_RJT_PRLI_REQ = 0x24, /* process login required */
FC_RJT_INVL_ATT = 0x25, /* invalid attachment */
FC_RJT_VENDOR = 0xff, /* vendor specific reject */
};
/* default timeout values */
#define FC_DEF_E_D_TOV 2000UL
#define FC_DEF_R_A_TOV 10000UL
#endif /* _FC_FS_H_ */

84
scsi/fc/fc_gs.h Normal file
View File

@@ -0,0 +1,84 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FC_GS_H_
#define _FC_GS_H_
#include <linux/types.h>
/*
* Fibre Channel Services - Common Transport.
* From T11.org FC-GS-2 Rev 5.3 November 1998.
*/
struct fc_ct_hdr {
__u8 ct_rev; /* revision */
__u8 ct_in_id[3]; /* N_Port ID of original requestor */
__u8 ct_fs_type; /* type of fibre channel service */
__u8 ct_fs_subtype; /* subtype */
__u8 ct_options;
__u8 _ct_resvd1;
__be16 ct_cmd; /* command / response code */
__be16 ct_mr_size; /* maximum / residual size */
__u8 _ct_resvd2;
__u8 ct_reason; /* reject reason */
__u8 ct_explan; /* reason code explanation */
__u8 ct_vendor; /* vendor unique data */
};
#define FC_CT_HDR_LEN 16 /* expected sizeof (struct fc_ct_hdr) */
enum fc_ct_rev {
FC_CT_REV = 1 /* common transport revision */
};
/*
* ct_fs_type values.
*/
enum fc_ct_fs_type {
FC_FST_ALIAS = 0xf8, /* alias service */
FC_FST_MGMT = 0xfa, /* management service */
FC_FST_TIME = 0xfb, /* time service */
FC_FST_DIR = 0xfc, /* directory service */
};
/*
* ct_cmd: Command / response codes
*/
enum fc_ct_cmd {
FC_FS_RJT = 0x8001, /* reject */
FC_FS_ACC = 0x8002, /* accept */
};
/*
* FS_RJT reason codes.
*/
enum fc_ct_reason {
FC_FS_RJT_CMD = 0x01, /* invalid command code */
FC_FS_RJT_VER = 0x02, /* invalid version level */
FC_FS_RJT_LOG = 0x03, /* logical error */
FC_FS_RJT_IUSIZ = 0x04, /* invalid IU size */
FC_FS_RJT_BSY = 0x05, /* logical busy */
FC_FS_RJT_PROTO = 0x07, /* protocol error */
FC_FS_RJT_UNABL = 0x09, /* unable to perform command request */
FC_FS_RJT_UNSUP = 0x0b, /* command not supported */
};
/*
* FS_RJT reason code explanations.
*/
enum fc_ct_explan {
FC_FS_EXP_NONE = 0x00, /* no additional explanation */
FC_FS_EXP_PID = 0x01, /* port ID not registered */
FC_FS_EXP_PNAM = 0x02, /* port name not registered */
FC_FS_EXP_NNAM = 0x03, /* node name not registered */
FC_FS_EXP_COS = 0x04, /* class of service not registered */
FC_FS_EXP_FTNR = 0x07, /* FC-4 types not registered */
/* definitions not complete */
};
#endif /* _FC_GS_H_ */

196
scsi/fc/fc_ns.h Normal file
View File

@@ -0,0 +1,196 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _FC_NS_H_
#define _FC_NS_H_
#include <linux/types.h>
/*
* Fibre Channel Services - Name Service (dNS)
* From T11.org FC-GS-2 Rev 5.3 November 1998.
*/
/*
* Common-transport sub-type for Name Server.
*/
#define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */
/*
* Name server Requests.
* Note: this is an incomplete list, some unused requests are omitted.
*/
enum fc_ns_req {
FC_NS_GA_NXT = 0x0100, /* get all next */
FC_NS_GI_A = 0x0101, /* get identifiers - scope */
FC_NS_GPN_ID = 0x0112, /* get port name by ID */
FC_NS_GNN_ID = 0x0113, /* get node name by ID */
FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */
FC_NS_GID_PN = 0x0121, /* get ID for port name */
FC_NS_GID_NN = 0x0131, /* get IDs for node name */
FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
};
/*
* Port type values.
*/
enum fc_ns_pt {
FC_NS_UNID_PORT = 0x00, /* unidentified */
FC_NS_N_PORT = 0x01, /* N port */
FC_NS_NL_PORT = 0x02, /* NL port */
FC_NS_FNL_PORT = 0x03, /* F/NL port */
FC_NS_NX_PORT = 0x7f, /* Nx port */
FC_NS_F_PORT = 0x81, /* F port */
FC_NS_FL_PORT = 0x82, /* FL port */
FC_NS_E_PORT = 0x84, /* E port */
FC_NS_B_PORT = 0x85, /* B port */
};
/*
* Port type object.
*/
struct fc_ns_pt_obj {
__u8 pt_type;
};
/*
* Port ID object
*/
struct fc_ns_fid {
__u8 fp_flags; /* flags for responses only */
__u8 fp_fid[3];
};
/*
* fp_flags in port ID object, for responses only.
*/
#define FC_NS_FID_LAST 0x80 /* last object */
/*
* FC4-types object.
*/
#define FC_NS_TYPES 256 /* number of possible FC-4 types */
#define FC_NS_BPW 32 /* bits per word in bitmap */
struct fc_ns_fts {
__be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
};
/*
* FC4-features object.
*/
struct fc_ns_ff {
__be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
};
/*
* GID_PT request.
*/
struct fc_ns_gid_pt {
__u8 fn_pt_type;
__u8 fn_domain_id_scope;
__u8 fn_area_id_scope;
__u8 fn_resvd;
};
/*
* GID_FT or GPN_FT request.
*/
struct fc_ns_gid_ft {
__u8 fn_resvd;
__u8 fn_domain_id_scope;
__u8 fn_area_id_scope;
__u8 fn_fc4_type;
};
/*
* GPN_FT response.
*/
struct fc_gpn_ft_resp {
__u8 fp_flags; /* see fp_flags definitions above */
__u8 fp_fid[3]; /* port ID */
__be32 fp_resvd;
__be64 fp_wwpn; /* port name */
};
/*
* GID_PN request
*/
struct fc_ns_gid_pn {
__be64 fn_wwpn; /* port name */
};
/*
* GID_PN response or GSPN_ID request
*/
struct fc_gid_pn_resp {
__u8 fp_resvd;
__u8 fp_fid[3]; /* port ID */
};
/*
* GSPN_ID response
*/
struct fc_gspn_resp {
__u8 fp_name_len;
char fp_name[];
};
/*
* RFT_ID request - register FC-4 types for ID.
*/
struct fc_ns_rft_id {
struct fc_ns_fid fr_fid; /* port ID object */
struct fc_ns_fts fr_fts; /* FC-4 types object */
};
/*
* RPN_ID request - register port name for ID.
* RNN_ID request - register node name for ID.
*/
struct fc_ns_rn_id {
struct fc_ns_fid fr_fid; /* port ID object */
__be64 fr_wwn; /* node name or port name */
} __attribute__((__packed__));
/*
* RSNN_NN request - register symbolic node name
*/
struct fc_ns_rsnn {
__be64 fr_wwn; /* node name */
__u8 fr_name_len;
char fr_name[];
} __attribute__((__packed__));
/*
* RSPN_ID request - register symbolic port name
*/
struct fc_ns_rspn {
struct fc_ns_fid fr_fid; /* port ID object */
__u8 fr_name_len;
char fr_name[];
} __attribute__((__packed__));
/*
* RFF_ID request - register FC-4 Features for ID.
*/
struct fc_ns_rff_id {
struct fc_ns_fid fr_fid; /* port ID object */
__u8 fr_resvd[2];
__u8 fr_feat; /* FC-4 Feature bits */
__u8 fr_type; /* FC-4 type */
} __attribute__((__packed__));
#endif /* _FC_NS_H_ */

308
scsi/scsi_bsg_fc.h Normal file
View File

@@ -0,0 +1,308 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* FC Transport BSG Interface
*
* Copyright (C) 2008 James Smart, Emulex Corporation
*/
#ifndef SCSI_BSG_FC_H
#define SCSI_BSG_FC_H
#include <linux/types.h>
/*
* This file intended to be included by both kernel and user space
*/
/*
* FC Transport SGIO v4 BSG Message Support
*/
/* Default BSG request timeout (in seconds) */
#define FC_DEFAULT_BSG_TIMEOUT (10 * HZ)
/*
* Request Message Codes supported by the FC Transport
*/
/* define the class masks for the message codes */
#define FC_BSG_CLS_MASK 0xF0000000 /* find object class */
#define FC_BSG_HST_MASK 0x80000000 /* fc host class */
#define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */
/* fc_host Message Codes */
#define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001)
#define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002)
#define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003)
#define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004)
#define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF)
/* fc_rport Message Codes */
#define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001)
#define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002)
/*
* FC Address Identifiers in Message Structures :
*
* Whenever a command payload contains a FC Address Identifier
* (aka port_id), the value is effectively in big-endian
* order, thus the array elements are decoded as follows:
* element [0] is bits 23:16 of the FC Address Identifier
* element [1] is bits 15:8 of the FC Address Identifier
* element [2] is bits 7:0 of the FC Address Identifier
*/
/*
* FC Host Messages
*/
/* FC_BSG_HST_ADDR_PORT : */
/* Request:
* This message requests the FC host to login to the remote port
* at the specified N_Port_Id. The remote port is to be enumerated
* with the transport upon completion of the login.
*/
struct fc_bsg_host_add_rport {
__u8 reserved;
/* FC Address Identier of the remote port to login to */
__u8 port_id[3];
};
/* Response:
* There is no additional response data - fc_bsg_reply->result is sufficient
*/
/* FC_BSG_HST_DEL_RPORT : */
/* Request:
* This message requests the FC host to remove an enumerated
* remote port and to terminate the login to it.
*
* Note: The driver is free to reject this request if it desires to
* remain logged in with the remote port.
*/
struct fc_bsg_host_del_rport {
__u8 reserved;
/* FC Address Identier of the remote port to logout of */
__u8 port_id[3];
};
/* Response:
* There is no additional response data - fc_bsg_reply->result is sufficient
*/
/* FC_BSG_HST_ELS_NOLOGIN : */
/* Request:
* This message requests the FC_Host to send an ELS to a specific
* N_Port_ID. The host does not need to log into the remote port,
* nor does it need to enumerate the rport for further traffic
* (although, the FC host is free to do so if it desires).
*/
struct fc_bsg_host_els {
/*
* ELS Command Code being sent (must be the same as byte 0
* of the payload)
*/
__u8 command_code;
/* FC Address Identier of the remote port to send the ELS to */
__u8 port_id[3];
};
/* Response:
*/
/* fc_bsg_ctels_reply->status values */
#define FC_CTELS_STATUS_OK 0x00000000
#define FC_CTELS_STATUS_REJECT 0x00000001
#define FC_CTELS_STATUS_P_RJT 0x00000002
#define FC_CTELS_STATUS_F_RJT 0x00000003
#define FC_CTELS_STATUS_P_BSY 0x00000004
#define FC_CTELS_STATUS_F_BSY 0x00000006
struct fc_bsg_ctels_reply {
/*
* Note: An ELS LS_RJT may be reported in 2 ways:
* a) A status of FC_CTELS_STATUS_OK is returned. The caller
* is to look into the ELS receive payload to determine
* LS_ACC or LS_RJT (by contents of word 0). The reject
* data will be in word 1.
* b) A status of FC_CTELS_STATUS_REJECT is returned, The
* rjt_data field will contain valid data.
*
* Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and
* the receive payload word 0 indicates LS_ACC
* (e.g. value is 0x02xxxxxx).
*
* Note: Similarly, a CT Reject may be reported in 2 ways:
* a) A status of FC_CTELS_STATUS_OK is returned. The caller
* is to look into the CT receive payload to determine
* Accept or Reject (by contents of word 2). The reject
* data will be in word 3.
* b) A status of FC_CTELS_STATUS_REJECT is returned, The
* rjt_data field will contain valid data.
*
* Note: x_RJT/BSY status will indicae that the rjt_data field
* is valid and contains the reason/explanation values.
*/
__u32 status; /* See FC_CTELS_STATUS_xxx */
/* valid if status is not FC_CTELS_STATUS_OK */
struct {
__u8 action; /* fragment_id for CT REJECT */
__u8 reason_code;
__u8 reason_explanation;
__u8 vendor_unique;
} rjt_data;
};
/* FC_BSG_HST_CT : */
/* Request:
* This message requests that a CT Request be performed with the
* indicated N_Port_ID. The driver is responsible for logging in with
* the fabric and/or N_Port_ID, etc as per FC rules. This request does
* not mandate that the driver must enumerate the destination in the
* transport. The driver is allowed to decide whether to enumerate it,
* and whether to tear it down after the request.
*/
struct fc_bsg_host_ct {
__u8 reserved;
/* FC Address Identier of the remote port to send the ELS to */
__u8 port_id[3];
/*
* We need words 0-2 of the generic preamble for the LLD's
*/
__u32 preamble_word0; /* revision & IN_ID */
__u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
__u32 preamble_word2; /* Cmd Code, Max Size */
};
/* Response:
*
* The reply structure is an fc_bsg_ctels_reply structure
*/
/* FC_BSG_HST_VENDOR : */
/* Request:
* Note: When specifying vendor_id, be sure to read the Vendor Type and ID
* formatting requirements specified in scsi_netlink.h
*/
struct fc_bsg_host_vendor {
/*
* Identifies the vendor that the message is formatted for. This
* should be the recipient of the message.
*/
__u64 vendor_id;
/* start of vendor command area */
__u32 vendor_cmd[];
};
/* Response:
*/
struct fc_bsg_host_vendor_reply {
/* start of vendor response area */
__u32 vendor_rsp[0];
};
/*
* FC Remote Port Messages
*/
/* FC_BSG_RPT_ELS : */
/* Request:
* This message requests that an ELS be performed with the rport.
*/
struct fc_bsg_rport_els {
/*
* ELS Command Code being sent (must be the same as
* byte 0 of the payload)
*/
__u8 els_code;
};
/* Response:
*
* The reply structure is an fc_bsg_ctels_reply structure
*/
/* FC_BSG_RPT_CT : */
/* Request:
* This message requests that a CT Request be performed with the rport.
*/
struct fc_bsg_rport_ct {
/*
* We need words 0-2 of the generic preamble for the LLD's
*/
__u32 preamble_word0; /* revision & IN_ID */
__u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
__u32 preamble_word2; /* Cmd Code, Max Size */
};
/* Response:
*
* The reply structure is an fc_bsg_ctels_reply structure
*/
/* request (CDB) structure of the sg_io_v4 */
struct fc_bsg_request {
__u32 msgcode;
union {
struct fc_bsg_host_add_rport h_addrport;
struct fc_bsg_host_del_rport h_delrport;
struct fc_bsg_host_els h_els;
struct fc_bsg_host_ct h_ct;
struct fc_bsg_host_vendor h_vendor;
struct fc_bsg_rport_els r_els;
struct fc_bsg_rport_ct r_ct;
} rqst_data;
} __attribute__((packed));
/* response (request sense data) structure of the sg_io_v4 */
struct fc_bsg_reply {
/*
* The completion result. Result exists in two forms:
* if negative, it is an -Exxx system errno value. There will
* be no further reply information supplied.
* else, it's the 4-byte scsi error result, with driver, host,
* msg and status fields. The per-msgcode reply structure
* will contain valid data.
*/
__u32 result;
/* If there was reply_payload, how much was recevied ? */
__u32 reply_payload_rcv_len;
union {
struct fc_bsg_host_vendor_reply vendor_reply;
struct fc_bsg_ctels_reply ctels_reply;
} reply_data;
};
#endif /* SCSI_BSG_FC_H */

582
scsi/scsi_bsg_mpi3mr.h Normal file
View File

@@ -0,0 +1,582 @@
/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
/*
* Driver for Broadcom MPI3 Storage Controllers
*
* Copyright (C) 2017-2022 Broadcom Inc.
* (mailto: mpi3mr-linuxdrv.pdl@broadcom.com)
*
*/
#ifndef SCSI_BSG_MPI3MR_H_INCLUDED
#define SCSI_BSG_MPI3MR_H_INCLUDED
#include <linux/types.h>
/* Definitions for BSG commands */
#define MPI3MR_IOCTL_VERSION 0x06
#define MPI3MR_APP_DEFAULT_TIMEOUT (60) /*seconds*/
#define MPI3MR_BSG_ADPTYPE_UNKNOWN 0
#define MPI3MR_BSG_ADPTYPE_AVGFAMILY 1
#define MPI3MR_BSG_ADPSTATE_UNKNOWN 0
#define MPI3MR_BSG_ADPSTATE_OPERATIONAL 1
#define MPI3MR_BSG_ADPSTATE_FAULT 2
#define MPI3MR_BSG_ADPSTATE_IN_RESET 3
#define MPI3MR_BSG_ADPSTATE_UNRECOVERABLE 4
#define MPI3MR_BSG_ADPRESET_UNKNOWN 0
#define MPI3MR_BSG_ADPRESET_SOFT 1
#define MPI3MR_BSG_ADPRESET_DIAG_FAULT 2
#define MPI3MR_BSG_LOGDATA_MAX_ENTRIES 400
#define MPI3MR_BSG_LOGDATA_ENTRY_HEADER_SZ 4
#define MPI3MR_DRVBSG_OPCODE_UNKNOWN 0
#define MPI3MR_DRVBSG_OPCODE_ADPINFO 1
#define MPI3MR_DRVBSG_OPCODE_ADPRESET 2
#define MPI3MR_DRVBSG_OPCODE_ALLTGTDEVINFO 4
#define MPI3MR_DRVBSG_OPCODE_GETCHGCNT 5
#define MPI3MR_DRVBSG_OPCODE_LOGDATAENABLE 6
#define MPI3MR_DRVBSG_OPCODE_PELENABLE 7
#define MPI3MR_DRVBSG_OPCODE_GETLOGDATA 8
#define MPI3MR_DRVBSG_OPCODE_QUERY_HDB 9
#define MPI3MR_DRVBSG_OPCODE_REPOST_HDB 10
#define MPI3MR_DRVBSG_OPCODE_UPLOAD_HDB 11
#define MPI3MR_DRVBSG_OPCODE_REFRESH_HDB_TRIGGERS 12
#define MPI3MR_BSG_BUFTYPE_UNKNOWN 0
#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_CMD 1
#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_RESP 2
#define MPI3MR_BSG_BUFTYPE_DATA_IN 3
#define MPI3MR_BSG_BUFTYPE_DATA_OUT 4
#define MPI3MR_BSG_BUFTYPE_MPI_REPLY 5
#define MPI3MR_BSG_BUFTYPE_ERR_RESPONSE 6
#define MPI3MR_BSG_BUFTYPE_MPI_REQUEST 0xFE
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_UNKNOWN 0
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_STATUS 1
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_ADDRESS 2
#define MPI3MR_HDB_BUFTYPE_UNKNOWN 0
#define MPI3MR_HDB_BUFTYPE_TRACE 1
#define MPI3MR_HDB_BUFTYPE_FIRMWARE 2
#define MPI3MR_HDB_BUFTYPE_RESERVED 3
#define MPI3MR_HDB_BUFSTATUS_UNKNOWN 0
#define MPI3MR_HDB_BUFSTATUS_NOT_ALLOCATED 1
#define MPI3MR_HDB_BUFSTATUS_POSTED_UNPAUSED 2
#define MPI3MR_HDB_BUFSTATUS_POSTED_PAUSED 3
#define MPI3MR_HDB_BUFSTATUS_RELEASED 4
#define MPI3MR_HDB_TRIGGER_TYPE_UNKNOWN 0
#define MPI3MR_HDB_TRIGGER_TYPE_DIAGFAULT 1
#define MPI3MR_HDB_TRIGGER_TYPE_ELEMENT 2
#define MPI3MR_HDB_TRIGGER_TYPE_MASTER 3
/* Supported BSG commands */
enum command {
MPI3MR_DRV_CMD = 1,
MPI3MR_MPT_CMD = 2,
};
/**
* struct mpi3_driver_info_layout - Information about driver
*
* @information_length: Length of this structure in bytes
* @driver_signature: Driver Vendor name
* @os_name: Operating System Name
* @driver_name: Driver name
* @driver_version: Driver version
* @driver_release_date: Driver release date
* @driver_capabilities: Driver capabilities
*/
struct mpi3_driver_info_layout {
__le32 information_length;
__u8 driver_signature[12];
__u8 os_name[16];
__u8 os_version[12];
__u8 driver_name[20];
__u8 driver_version[32];
__u8 driver_release_date[20];
__le32 driver_capabilities;
};
/**
* struct mpi3mr_bsg_in_adpinfo - Adapter information request
* data returned by the driver.
*
* @adp_type: Adapter type
* @rsvd1: Reserved
* @pci_dev_id: PCI device ID of the adapter
* @pci_dev_hw_rev: PCI revision of the adapter
* @pci_subsys_dev_id: PCI subsystem device ID of the adapter
* @pci_subsys_ven_id: PCI subsystem vendor ID of the adapter
* @pci_dev: PCI device
* @pci_func: PCI function
* @pci_bus: PCI bus
* @rsvd2: Reserved
* @pci_seg_id: PCI segment ID
* @app_intfc_ver: version of the application interface definition
* @rsvd3: Reserved
* @rsvd4: Reserved
* @rsvd5: Reserved
* @driver_info: Driver Information (Version/Name)
*/
struct mpi3mr_bsg_in_adpinfo {
__u32 adp_type;
__u32 rsvd1;
__u32 pci_dev_id;
__u32 pci_dev_hw_rev;
__u32 pci_subsys_dev_id;
__u32 pci_subsys_ven_id;
__u32 pci_dev:5;
__u32 pci_func:3;
__u32 pci_bus:8;
__u16 rsvd2;
__u32 pci_seg_id;
__u32 app_intfc_ver;
__u8 adp_state;
__u8 rsvd3;
__u16 rsvd4;
__u32 rsvd5[2];
struct mpi3_driver_info_layout driver_info;
};
/**
* struct mpi3mr_bsg_adp_reset - Adapter reset request
* payload data to the driver.
*
* @reset_type: Reset type
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_adp_reset {
__u8 reset_type;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_change_count - Topology change count
* returned by the driver.
*
* @change_count: Topology change count
* @rsvd: Reserved
*/
struct mpi3mr_change_count {
__u16 change_count;
__u16 rsvd;
};
/**
* struct mpi3mr_device_map_info - Target device mapping
* information
*
* @handle: Firmware device handle
* @perst_id: Persistent ID assigned by the firmware
* @target_id: Target ID assigned by the driver
* @bus_id: Bus ID assigned by the driver
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_device_map_info {
__u16 handle;
__u16 perst_id;
__u32 target_id;
__u8 bus_id;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_all_tgt_info - Target device mapping
* information returned by the driver
*
* @num_devices: The number of devices in driver's inventory
* @rsvd1: Reserved
* @rsvd2: Reserved
* @dmi: Variable length array of mapping information of targets
*/
struct mpi3mr_all_tgt_info {
__u16 num_devices;
__u16 rsvd1;
__u32 rsvd2;
struct mpi3mr_device_map_info dmi[1];
};
/**
* struct mpi3mr_logdata_enable - Number of log data
* entries saved by the driver returned as payload data for
* enable logdata BSG request by the driver.
*
* @max_entries: Number of log data entries cached by the driver
* @rsvd: Reserved
*/
struct mpi3mr_logdata_enable {
__u16 max_entries;
__u16 rsvd;
};
/**
* struct mpi3mr_bsg_out_pel_enable - PEL enable request payload
* data to the driver.
*
* @pel_locale: PEL locale to the firmware
* @pel_class: PEL class to the firmware
* @rsvd: Reserved
*/
struct mpi3mr_bsg_out_pel_enable {
__u16 pel_locale;
__u8 pel_class;
__u8 rsvd;
};
/**
* struct mpi3mr_logdata_entry - Log data entry cached by the
* driver.
*
* @valid_entry: Is the entry valid
* @rsvd1: Reserved
* @rsvd2: Reserved
* @data: Variable length Log entry data
*/
struct mpi3mr_logdata_entry {
__u8 valid_entry;
__u8 rsvd1;
__u16 rsvd2;
__u8 data[1]; /* Variable length Array */
};
/**
* struct mpi3mr_bsg_in_log_data - Log data entries saved by
* the driver returned as payload data for Get logdata request
* by the driver.
*
* @entry: Variable length Log data entry array
*/
struct mpi3mr_bsg_in_log_data {
struct mpi3mr_logdata_entry entry[1];
};
/**
* struct mpi3mr_hdb_entry - host diag buffer entry.
*
* @buf_type: Buffer type
* @status: Buffer status
* @trigger_type: Trigger type
* @rsvd1: Reserved
* @size: Buffer size
* @rsvd2: Reserved
* @trigger_data: Trigger specific data
* @rsvd3: Reserved
* @rsvd4: Reserved
*/
struct mpi3mr_hdb_entry {
__u8 buf_type;
__u8 status;
__u8 trigger_type;
__u8 rsvd1;
__u16 size;
__u16 rsvd2;
__u64 trigger_data;
__u32 rsvd3;
__u32 rsvd4;
};
/**
* struct mpi3mr_bsg_in_hdb_status - This structure contains
* return data for the BSG request to retrieve the number of host
* diagnostic buffers supported by the driver and their current
* status and additional status specific data if any in forms of
* multiple hdb entries.
*
* @num_hdb_types: Number of host diag buffer types supported
* @rsvd1: Reserved
* @rsvd2: Reserved
* @rsvd3: Reserved
* @entry: Variable length Diag buffer status entry array
*/
struct mpi3mr_bsg_in_hdb_status {
__u8 num_hdb_types;
__u8 rsvd1;
__u16 rsvd2;
__u32 rsvd3;
struct mpi3mr_hdb_entry entry[1];
};
/**
* struct mpi3mr_bsg_out_repost_hdb - Repost host diagnostic
* buffer request payload data to the driver.
*
* @buf_type: Buffer type
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_out_repost_hdb {
__u8 buf_type;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_bsg_out_upload_hdb - Upload host diagnostic
* buffer request payload data to the driver.
*
* @buf_type: Buffer type
* @rsvd1: Reserved
* @rsvd2: Reserved
* @start_offset: Start offset of the buffer from where to copy
* @length: Length of the buffer to copy
*/
struct mpi3mr_bsg_out_upload_hdb {
__u8 buf_type;
__u8 rsvd1;
__u16 rsvd2;
__u32 start_offset;
__u32 length;
};
/**
* struct mpi3mr_bsg_out_refresh_hdb_triggers - Refresh host
* diagnostic buffer triggers request payload data to the driver.
*
* @page_type: Page type
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_out_refresh_hdb_triggers {
__u8 page_type;
__u8 rsvd1;
__u16 rsvd2;
};
/**
* struct mpi3mr_bsg_drv_cmd - Generic bsg data
* structure for all driver specific requests.
*
* @mrioc_id: Controller ID
* @opcode: Driver specific opcode
* @rsvd1: Reserved
* @rsvd2: Reserved
*/
struct mpi3mr_bsg_drv_cmd {
__u8 mrioc_id;
__u8 opcode;
__u16 rsvd1;
__u32 rsvd2[4];
};
/**
* struct mpi3mr_bsg_in_reply_buf - MPI reply buffer returned
* for MPI Passthrough request .
*
* @mpi_reply_type: Type of MPI reply
* @rsvd1: Reserved
* @rsvd2: Reserved
* @reply_buf: Variable Length buffer based on mpirep type
*/
struct mpi3mr_bsg_in_reply_buf {
__u8 mpi_reply_type;
__u8 rsvd1;
__u16 rsvd2;
__u8 reply_buf[1];
};
/**
* struct mpi3mr_buf_entry - User buffer descriptor for MPI
* Passthrough requests.
*
* @buf_type: Buffer type
* @rsvd1: Reserved
* @rsvd2: Reserved
* @buf_len: Buffer length
*/
struct mpi3mr_buf_entry {
__u8 buf_type;
__u8 rsvd1;
__u16 rsvd2;
__u32 buf_len;
};
/**
* struct mpi3mr_bsg_buf_entry_list - list of user buffer
* descriptor for MPI Passthrough requests.
*
* @num_of_entries: Number of buffer descriptors
* @rsvd1: Reserved
* @rsvd2: Reserved
* @rsvd3: Reserved
* @buf_entry: Variable length array of buffer descriptors
*/
struct mpi3mr_buf_entry_list {
__u8 num_of_entries;
__u8 rsvd1;
__u16 rsvd2;
__u32 rsvd3;
struct mpi3mr_buf_entry buf_entry[1];
};
/**
* struct mpi3mr_bsg_mptcmd - Generic bsg data
* structure for all MPI Passthrough requests .
*
* @mrioc_id: Controller ID
* @rsvd1: Reserved
* @timeout: MPI request timeout
* @buf_entry_list: Buffer descriptor list
*/
struct mpi3mr_bsg_mptcmd {
__u8 mrioc_id;
__u8 rsvd1;
__u16 timeout;
__u32 rsvd2;
struct mpi3mr_buf_entry_list buf_entry_list;
};
/**
* struct mpi3mr_bsg_packet - Generic bsg data
* structure for all supported requests .
*
* @cmd_type: represents drvrcmd or mptcmd
* @rsvd1: Reserved
* @rsvd2: Reserved
* @drvrcmd: driver request structure
* @mptcmd: mpt request structure
*/
struct mpi3mr_bsg_packet {
__u8 cmd_type;
__u8 rsvd1;
__u16 rsvd2;
__u32 rsvd3;
union {
struct mpi3mr_bsg_drv_cmd drvrcmd;
struct mpi3mr_bsg_mptcmd mptcmd;
} cmd;
};
/* MPI3: NVMe Encasulation related definitions */
#ifndef MPI3_NVME_ENCAP_CMD_MAX
#define MPI3_NVME_ENCAP_CMD_MAX (1)
#endif
struct mpi3_nvme_encapsulated_request {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 change_count;
__le16 dev_handle;
__le16 encapsulated_command_length;
__le16 flags;
__le32 data_length;
__le32 reserved14[3];
__le32 command[MPI3_NVME_ENCAP_CMD_MAX];
};
struct mpi3_nvme_encapsulated_error_reply {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 ioc_use_only08;
__le16 ioc_status;
__le32 ioc_log_info;
__le32 nvme_completion_entry[4];
};
#define MPI3MR_NVME_PRP_SIZE 8 /* PRP size */
#define MPI3MR_NVME_CMD_PRP1_OFFSET 24 /* PRP1 offset in NVMe cmd */
#define MPI3MR_NVME_CMD_PRP2_OFFSET 32 /* PRP2 offset in NVMe cmd */
#define MPI3MR_NVME_CMD_SGL_OFFSET 24 /* SGL offset in NVMe cmd */
#define MPI3MR_NVME_DATA_FORMAT_PRP 0
#define MPI3MR_NVME_DATA_FORMAT_SGL1 1
#define MPI3MR_NVME_DATA_FORMAT_SGL2 2
/* MPI3: task management related definitions */
struct mpi3_scsi_task_mgmt_request {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 change_count;
__le16 dev_handle;
__le16 task_host_tag;
__u8 task_type;
__u8 reserved0f;
__le16 task_request_queue_id;
__le16 reserved12;
__le32 reserved14;
__u8 lun[8];
};
#define MPI3_SCSITASKMGMT_MSGFLAGS_DO_NOT_SEND_TASK_IU (0x08)
#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01)
#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK_SET (0x02)
#define MPI3_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03)
#define MPI3_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05)
#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06)
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07)
#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_ACA (0x08)
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK_SET (0x09)
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_ASYNC_EVENT (0x0a)
#define MPI3_SCSITASKMGMT_TASKTYPE_I_T_NEXUS_RESET (0x0b)
struct mpi3_scsi_task_mgmt_reply {
__le16 host_tag;
__u8 ioc_use_only02;
__u8 function;
__le16 ioc_use_only04;
__u8 ioc_use_only06;
__u8 msg_flags;
__le16 ioc_use_only08;
__le16 ioc_status;
__le32 ioc_log_info;
__le32 termination_count;
__le32 response_data;
__le32 reserved18;
};
#define MPI3_SCSITASKMGMT_RSPCODE_TM_COMPLETE (0x00)
#define MPI3_SCSITASKMGMT_RSPCODE_INVALID_FRAME (0x02)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_FUNCTION_NOT_SUPPORTED (0x04)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_FAILED (0x05)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_SUCCEEDED (0x08)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_INVALID_LUN (0x09)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_OVERLAPPED_TAG (0x0a)
#define MPI3_SCSITASKMGMT_RSPCODE_IO_QUEUED_ON_IOC (0x80)
#define MPI3_SCSITASKMGMT_RSPCODE_TM_NVME_DENIED (0x81)
/* MPI3: PEL related definitions */
#define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT (0x0200)
#define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT (0x0100)
#define MPI3_PEL_LOCALE_FLAGS_PCIE (0x0080)
#define MPI3_PEL_LOCALE_FLAGS_CONFIGURATION (0x0040)
#define MPI3_PEL_LOCALE_FLAGS_CONTROLER (0x0020)
#define MPI3_PEL_LOCALE_FLAGS_SAS (0x0010)
#define MPI3_PEL_LOCALE_FLAGS_EPACK (0x0008)
#define MPI3_PEL_LOCALE_FLAGS_ENCLOSURE (0x0004)
#define MPI3_PEL_LOCALE_FLAGS_PD (0x0002)
#define MPI3_PEL_LOCALE_FLAGS_VD (0x0001)
#define MPI3_PEL_CLASS_DEBUG (0x00)
#define MPI3_PEL_CLASS_PROGRESS (0x01)
#define MPI3_PEL_CLASS_INFORMATIONAL (0x02)
#define MPI3_PEL_CLASS_WARNING (0x03)
#define MPI3_PEL_CLASS_CRITICAL (0x04)
#define MPI3_PEL_CLASS_FATAL (0x05)
#define MPI3_PEL_CLASS_FAULT (0x06)
/* MPI3: Function definitions */
#define MPI3_BSG_FUNCTION_MGMT_PASSTHROUGH (0x0a)
#define MPI3_BSG_FUNCTION_SCSI_IO (0x20)
#define MPI3_BSG_FUNCTION_SCSI_TASK_MGMT (0x21)
#define MPI3_BSG_FUNCTION_SMP_PASSTHROUGH (0x22)
#define MPI3_BSG_FUNCTION_NVME_ENCAPSULATED (0x24)
#endif

105
scsi/scsi_bsg_ufs.h Normal file
View File

@@ -0,0 +1,105 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* UFS Transport SGIO v4 BSG Message Support
*
* Copyright (C) 2011-2013 Samsung India Software Operations
* Copyright (C) 2018 Western Digital Corporation
*/
#ifndef SCSI_BSG_UFS_H
#define SCSI_BSG_UFS_H
#include <linux/types.h>
/*
* This file intended to be included by both kernel and user space
*/
#define UFS_CDB_SIZE 16
#define UPIU_TRANSACTION_UIC_CMD 0x1F
/* uic commands are 4DW long, per UFSHCI V2.1 paragraph 5.6.1 */
#define UIC_CMD_SIZE (sizeof(__u32) * 4)
/**
* struct utp_upiu_header - UPIU header structure
* @dword_0: UPIU header DW-0
* @dword_1: UPIU header DW-1
* @dword_2: UPIU header DW-2
*/
struct utp_upiu_header {
__be32 dword_0;
__be32 dword_1;
__be32 dword_2;
};
/**
* struct utp_upiu_query - upiu request buffer structure for
* query request.
* @opcode: command to perform B-0
* @idn: a value that indicates the particular type of data B-1
* @index: Index to further identify data B-2
* @selector: Index to further identify data B-3
* @reserved_osf: spec reserved field B-4,5
* @length: number of descriptor bytes to read/write B-6,7
* @value: Attribute value to be written DW-5
* @reserved: spec reserved DW-6,7
*/
struct utp_upiu_query {
__u8 opcode;
__u8 idn;
__u8 index;
__u8 selector;
__be16 reserved_osf;
__be16 length;
__be32 value;
__be32 reserved[2];
};
/**
* struct utp_upiu_cmd - Command UPIU structure
* @data_transfer_len: Data Transfer Length DW-3
* @cdb: Command Descriptor Block CDB DW-4 to DW-7
*/
struct utp_upiu_cmd {
__be32 exp_data_transfer_len;
__u8 cdb[UFS_CDB_SIZE];
};
/**
* struct utp_upiu_req - general upiu request structure
* @header:UPIU header structure DW-0 to DW-2
* @sc: fields structure for scsi command DW-3 to DW-7
* @qr: fields structure for query request DW-3 to DW-7
* @uc: use utp_upiu_query to host the 4 dwords of uic command
*/
struct utp_upiu_req {
struct utp_upiu_header header;
union {
struct utp_upiu_cmd sc;
struct utp_upiu_query qr;
struct utp_upiu_query uc;
};
};
/* request (CDB) structure of the sg_io_v4 */
struct ufs_bsg_request {
__u32 msgcode;
struct utp_upiu_req upiu_req;
};
/* response (request sense data) structure of the sg_io_v4 */
struct ufs_bsg_reply {
/*
* The completion result. Result exists in two forms:
* if negative, it is an -Exxx system errno value. There will
* be no further reply information supplied.
* else, it's the 4-byte scsi error result, with driver, host,
* msg and status fields. The per-msgcode reply structure
* will contain valid data.
*/
__u32 result;
/* If there was reply_payload, how much was received? */
__u32 reply_payload_rcv_len;
struct utp_upiu_req upiu_rsp;
};
#endif /* UFS_BSG_H */

109
scsi/scsi_netlink.h Normal file
View File

@@ -0,0 +1,109 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* SCSI Transport Netlink Interface
* Used for the posting of outbound SCSI transport events
*
* Copyright (C) 2006 James Smart, Emulex Corporation
*/
#ifndef SCSI_NETLINK_H
#define SCSI_NETLINK_H
#include <linux/netlink.h>
#include <linux/types.h>
/*
* This file intended to be included by both kernel and user space
*/
/* Single Netlink Message type to send all SCSI Transport messages */
#define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1
/* SCSI Transport Broadcast Groups */
/* leaving groups 0 and 1 unassigned */
#define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */
#define SCSI_NL_GRP_CNT 3
/* SCSI_TRANSPORT_MSG event message header */
struct scsi_nl_hdr {
__u8 version;
__u8 transport;
__u16 magic;
__u16 msgtype;
__u16 msglen;
} __attribute__((aligned(sizeof(__u64))));
/* scsi_nl_hdr->version value */
#define SCSI_NL_VERSION 1
/* scsi_nl_hdr->magic value */
#define SCSI_NL_MAGIC 0xA1B2
/* scsi_nl_hdr->transport value */
#define SCSI_NL_TRANSPORT 0
#define SCSI_NL_TRANSPORT_FC 1
#define SCSI_NL_MAX_TRANSPORTS 2
/* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */
/*
* GENERIC SCSI scsi_nl_hdr->msgtype Values
*/
/* kernel -> user */
#define SCSI_NL_SHOST_VENDOR 0x0001
/* user -> kernel */
/* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */
/*
* Message Structures :
*/
/* macro to round up message lengths to 8byte boundary */
#define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7)
/*
* SCSI HOST Vendor Unique messages :
* SCSI_NL_SHOST_VENDOR
*
* Note: The Vendor Unique message payload will begin directly after
* this structure, with the length of the payload per vmsg_datalen.
*
* Note: When specifying vendor_id, be sure to read the Vendor Type and ID
* formatting requirements specified below
*/
struct scsi_nl_host_vendor_msg {
struct scsi_nl_hdr snlh; /* must be 1st element ! */
__u64 vendor_id;
__u16 host_no;
__u16 vmsg_datalen;
} __attribute__((aligned(sizeof(__u64))));
/*
* Vendor ID:
* If transports post vendor-unique events, they must pass a well-known
* 32-bit vendor identifier. This identifier consists of 8 bits indicating
* the "type" of identifier contained, and 24 bits of id data.
*
* Identifiers for each type:
* PCI : ID data is the 16 bit PCI Registered Vendor ID
*/
#define SCSI_NL_VID_TYPE_SHIFT 56
#define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
#define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
#define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \
{ \
(hdr)->version = SCSI_NL_VERSION; \
(hdr)->transport = t; \
(hdr)->magic = SCSI_NL_MAGIC; \
(hdr)->msgtype = mtype; \
(hdr)->msglen = mlen; \
}
#endif /* SCSI_NETLINK_H */

61
scsi/scsi_netlink_fc.h Normal file
View File

@@ -0,0 +1,61 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* FC Transport Netlink Interface
*
* Copyright (C) 2006 James Smart, Emulex Corporation
*/
#ifndef SCSI_NETLINK_FC_H
#define SCSI_NETLINK_FC_H
#include <linux/types.h>
#include <scsi/scsi_netlink.h>
/*
* This file intended to be included by both kernel and user space
*/
/*
* FC Transport Message Types
*/
/* kernel -> user */
#define FC_NL_ASYNC_EVENT 0x0100
/* user -> kernel */
/* none */
/*
* Message Structures :
*/
/* macro to round up message lengths to 8byte boundary */
#define FC_NL_MSGALIGN(len) (((len) + 7) & ~7)
/*
* FC Transport Broadcast Event Message :
* FC_NL_ASYNC_EVENT
*
* Note: if Vendor Unique message, event_data_flex will be start of
* vendor unique payload, and the length of the payload is
* per event_datalen
*
* Note: When specifying vendor_id, be sure to read the Vendor Type and ID
* formatting requirements specified in scsi_netlink.h
*/
struct fc_nl_event {
struct scsi_nl_hdr snlh; /* must be 1st element ! */
__u64 seconds;
__u64 vendor_id;
__u16 host_no;
__u16 event_datalen;
__u32 event_num;
__u32 event_code;
union {
__u32 event_data;
__DECLARE_FLEX_ARRAY(__u8, event_data_flex);
};
} __attribute__((aligned(sizeof(__u64))));
#endif /* SCSI_NETLINK_FC_H */