📄 zfcp_def.h
字号:
/* * * linux/drivers/s390/scsi/zfcp_def.h * * FCP adapter driver for IBM eServer zSeries * * (C) Copyright IBM Corp. 2002, 2004 * * Author(s): Martin Peschke <mpeschke@de.ibm.com> * Raimund Schroeder <raimund.schroeder@de.ibm.com> * Aron Zeh * Wolfgang Taphorn * Stefan Bader <stefan.bader@de.ibm.com> * Heiko Carstens <heiko.carstens@de.ibm.com> * Andreas Herrmann <aherrman@de.ibm.com> * Volker Sameske <sameske@de.ibm.com> * * 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, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef ZFCP_DEF_H#define ZFCP_DEF_H#define ZFCP_DEF_REVISION "$Revision: 1.111 $"/*************************** INCLUDES *****************************************/#include <linux/init.h>#include <linux/moduleparam.h>#include <linux/miscdevice.h>#include <linux/major.h>#include <linux/blkdev.h>#include <linux/delay.h>#include <linux/timer.h>#include <scsi/scsi.h>#include <scsi/scsi_tcq.h>#include <scsi/scsi_cmnd.h>#include <scsi/scsi_device.h>#include <scsi/scsi_host.h>#include <scsi/scsi_transport.h>#include <scsi/scsi_transport_fc.h>#include "../../fc4/fc.h"#include "zfcp_fsf.h"#include <asm/ccwdev.h>#include <asm/qdio.h>#include <asm/debug.h>#include <asm/ebcdic.h>#include <linux/mempool.h>#include <linux/syscalls.h>#include <linux/ioctl.h>/********************* GENERAL DEFINES *********************************//* zfcp version number, it consists of major, minor, and patch-level number */#define ZFCP_VERSION "4.5.0"/** * zfcp_sg_to_address - determine kernel address from struct scatterlist * @list: struct scatterlist * Return: kernel address */static inline void *zfcp_sg_to_address(struct scatterlist *list){ return (void *) (page_address(list->page) + list->offset);}/** * zfcp_address_to_sg - set up struct scatterlist from kernel address * @address: kernel address * @list: struct scatterlist */static inline voidzfcp_address_to_sg(void *address, struct scatterlist *list){ list->page = virt_to_page(address); list->offset = ((unsigned long) address) & (PAGE_SIZE - 1);}/********************* SCSI SPECIFIC DEFINES *********************************//* 32 bit for SCSI ID and LUN as long as the SCSI stack uses this type */typedef u32 scsi_id_t;typedef u32 scsi_lun_t;#define ZFCP_ERP_SCSI_LOW_MEM_TIMEOUT (100*HZ)#define ZFCP_SCSI_ER_TIMEOUT (100*HZ)/********************* CIO/QDIO SPECIFIC DEFINES *****************************//* Adapter Identification Parameters */#define ZFCP_CONTROL_UNIT_TYPE 0x1731#define ZFCP_CONTROL_UNIT_MODEL 0x03#define ZFCP_DEVICE_TYPE 0x1732#define ZFCP_DEVICE_MODEL 0x03#define ZFCP_DEVICE_MODEL_PRIV 0x04 /* allow as many chained SBALs as are supported by hardware */#define ZFCP_MAX_SBALS_PER_REQ FSF_MAX_SBALS_PER_REQ#define ZFCP_MAX_SBALS_PER_CT_REQ FSF_MAX_SBALS_PER_REQ#define ZFCP_MAX_SBALS_PER_ELS_REQ FSF_MAX_SBALS_PER_ELS_REQ/* DMQ bug workaround: don't use last SBALE */#define ZFCP_MAX_SBALES_PER_SBAL (QDIO_MAX_ELEMENTS_PER_BUFFER - 1)/* index of last SBALE (with respect to DMQ bug workaround) */#define ZFCP_LAST_SBALE_PER_SBAL (ZFCP_MAX_SBALES_PER_SBAL - 1)/* max. number of (data buffer) SBALEs in largest SBAL chain */#define ZFCP_MAX_SBALES_PER_REQ \ (ZFCP_MAX_SBALS_PER_REQ * ZFCP_MAX_SBALES_PER_SBAL - 2) /* request ID + QTCB in SBALE 0 + 1 of first SBAL in chain *//* FIXME(tune): free space should be one max. SBAL chain plus what? */#define ZFCP_QDIO_PCI_INTERVAL (QDIO_MAX_BUFFERS_PER_Q \ - (ZFCP_MAX_SBALS_PER_REQ + 4))#define ZFCP_SBAL_TIMEOUT (5*HZ)#define ZFCP_TYPE2_RECOVERY_TIME (8*HZ)/* queue polling (values in microseconds) */#define ZFCP_MAX_INPUT_THRESHOLD 5000 /* FIXME: tune */#define ZFCP_MAX_OUTPUT_THRESHOLD 1000 /* FIXME: tune */#define ZFCP_MIN_INPUT_THRESHOLD 1 /* ignored by QDIO layer */#define ZFCP_MIN_OUTPUT_THRESHOLD 1 /* ignored by QDIO layer */#define QDIO_SCSI_QFMT 1 /* 1 for FSF *//********************* FSF SPECIFIC DEFINES *********************************/#define ZFCP_ULP_INFO_VERSION 26#define ZFCP_QTCB_VERSION FSF_QTCB_CURRENT_VERSION/* ATTENTION: value must not be used by hardware */#define FSF_QTCB_UNSOLICITED_STATUS 0x6305#define ZFCP_STATUS_READ_FAILED_THRESHOLD 3#define ZFCP_STATUS_READS_RECOM FSF_STATUS_READS_RECOM/* Do 1st retry in 1 second, then double the timeout for each following retry */#define ZFCP_EXCHANGE_CONFIG_DATA_FIRST_SLEEP 100#define ZFCP_EXCHANGE_CONFIG_DATA_RETRIES 7/* Retry 5 times every 2 second, then every minute */#define ZFCP_EXCHANGE_PORT_DATA_SHORT_RETRIES 5#define ZFCP_EXCHANGE_PORT_DATA_SHORT_SLEEP 200#define ZFCP_EXCHANGE_PORT_DATA_LONG_SLEEP 6000/* timeout value for "default timer" for fsf requests */#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ);/*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/typedef unsigned long long wwn_t;typedef unsigned long long fcp_lun_t;/* data length field may be at variable position in FCP-2 FCP_CMND IU */typedef unsigned int fcp_dl_t;#define ZFCP_FC_SERVICE_CLASS_DEFAULT FSF_CLASS_3/* timeout for name-server lookup (in seconds) */#define ZFCP_NS_GID_PN_TIMEOUT 10/* largest SCSI command we can process *//* FCP-2 (FCP_CMND IU) allows up to (255-3+16) */#define ZFCP_MAX_SCSI_CMND_LENGTH 255/* maximum number of commands in LUN queue (tagged queueing) */#define ZFCP_CMND_PER_LUN 32/* task attribute values in FCP-2 FCP_CMND IU */#define SIMPLE_Q 0#define HEAD_OF_Q 1#define ORDERED_Q 2#define ACA_Q 4#define UNTAGGED 5/* task management flags in FCP-2 FCP_CMND IU */#define FCP_CLEAR_ACA 0x40#define FCP_TARGET_RESET 0x20#define FCP_LOGICAL_UNIT_RESET 0x10#define FCP_CLEAR_TASK_SET 0x04#define FCP_ABORT_TASK_SET 0x02#define FCP_CDB_LENGTH 16#define ZFCP_DID_MASK 0x00FFFFFF/* FCP(-2) FCP_CMND IU */struct fcp_cmnd_iu { fcp_lun_t fcp_lun; /* FCP logical unit number */ u8 crn; /* command reference number */ u8 reserved0:5; /* reserved */ u8 task_attribute:3; /* task attribute */ u8 task_management_flags; /* task management flags */ u8 add_fcp_cdb_length:6; /* additional FCP_CDB length */ u8 rddata:1; /* read data */ u8 wddata:1; /* write data */ u8 fcp_cdb[FCP_CDB_LENGTH];} __attribute__((packed));/* FCP(-2) FCP_RSP IU */struct fcp_rsp_iu { u8 reserved0[10]; union { struct { u8 reserved1:3; u8 fcp_conf_req:1; u8 fcp_resid_under:1; u8 fcp_resid_over:1; u8 fcp_sns_len_valid:1; u8 fcp_rsp_len_valid:1; } bits; u8 value; } validity; u8 scsi_status; u32 fcp_resid; u32 fcp_sns_len; u32 fcp_rsp_len;} __attribute__((packed));#define RSP_CODE_GOOD 0#define RSP_CODE_LENGTH_MISMATCH 1#define RSP_CODE_FIELD_INVALID 2#define RSP_CODE_RO_MISMATCH 3#define RSP_CODE_TASKMAN_UNSUPP 4#define RSP_CODE_TASKMAN_FAILED 5/* see fc-fs */#define LS_FAN 0x60000000#define LS_RSCN 0x61040000struct fcp_rscn_head { u8 command; u8 page_length; /* always 0x04 */ u16 payload_len;} __attribute__((packed));struct fcp_rscn_element { u8 reserved:2; u8 event_qual:4; u8 addr_format:2; u32 nport_did:24;} __attribute__((packed));#define ZFCP_PORT_ADDRESS 0x0#define ZFCP_AREA_ADDRESS 0x1#define ZFCP_DOMAIN_ADDRESS 0x2#define ZFCP_FABRIC_ADDRESS 0x3#define ZFCP_PORTS_RANGE_PORT 0xFFFFFF#define ZFCP_PORTS_RANGE_AREA 0xFFFF00#define ZFCP_PORTS_RANGE_DOMAIN 0xFF0000#define ZFCP_PORTS_RANGE_FABRIC 0x000000#define ZFCP_NO_PORTS_PER_AREA 0x100#define ZFCP_NO_PORTS_PER_DOMAIN 0x10000#define ZFCP_NO_PORTS_PER_FABRIC 0x1000000struct fcp_fan { u32 command; u32 fport_did; wwn_t fport_wwpn; wwn_t fport_wwname;} __attribute__((packed));/* see fc-ph */struct fcp_logo { u32 command; u32 nport_did; wwn_t nport_wwpn;} __attribute__((packed));/* * DBF stuff */#define ZFCP_DBF_TAG_SIZE 4struct zfcp_dbf_dump { u8 tag[ZFCP_DBF_TAG_SIZE]; u32 total_size; /* size of total dump data */ u32 offset; /* how much data has being already dumped */ u32 size; /* how much data comes with this record */ u8 data[]; /* dump data */} __attribute__ ((packed));/* FIXME: to be inflated when reworking the erp dbf */struct zfcp_erp_dbf_record { u8 dummy[16];} __attribute__ ((packed));struct zfcp_hba_dbf_record_response { u32 fsf_command; u64 fsf_reqid; u32 fsf_seqno; u64 fsf_issued; u32 fsf_prot_status; u32 fsf_status; u8 fsf_prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; u32 fsf_req_status; u8 sbal_first; u8 sbal_curr; u8 sbal_last; u8 pool; u64 erp_action; union { struct { u64 scsi_cmnd; u64 scsi_serial; } send_fcp; struct { u64 wwpn; u32 d_id; u32 port_handle; } port; struct { u64 wwpn; u64 fcp_lun; u32 port_handle; u32 lun_handle; } unit; struct { u32 d_id; u8 ls_code; } send_els; } data;} __attribute__ ((packed));struct zfcp_hba_dbf_record_status { u8 failed; u32 status_type; u32 status_subtype; struct fsf_queue_designator queue_designator; u32 payload_size;#define ZFCP_DBF_UNSOL_PAYLOAD 80#define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32#define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56#define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32) u8 payload[ZFCP_DBF_UNSOL_PAYLOAD];} __attribute__ ((packed));struct zfcp_hba_dbf_record_qdio { u32 status; u32 qdio_error; u32 siga_error; u8 sbal_index; u8 sbal_count;} __attribute__ ((packed));struct zfcp_hba_dbf_record { u8 tag[ZFCP_DBF_TAG_SIZE]; u8 tag2[ZFCP_DBF_TAG_SIZE]; union { struct zfcp_hba_dbf_record_response response; struct zfcp_hba_dbf_record_status status; struct zfcp_hba_dbf_record_qdio qdio; } type;} __attribute__ ((packed));struct zfcp_san_dbf_record_ct { union { struct { u16 cmd_req_code; u8 revision; u8 gs_type; u8 gs_subtype; u8 options; u16 max_res_size; } request; struct { u16 cmd_rsp_code; u8 revision; u8 reason_code; u8 reason_code_expl; u8 vendor_unique; } response; } type; u32 payload_size;#define ZFCP_DBF_CT_PAYLOAD 24 u8 payload[ZFCP_DBF_CT_PAYLOAD];} __attribute__ ((packed));struct zfcp_san_dbf_record_els { u8 ls_code; u32 payload_size;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -