zfcp_def.h

来自「优龙2410linux2.6.8内核源代码」· C头文件 代码 · 共 1,193 行 · 第 1/3 页

H
1,193
字号
/*  *  * 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>  *  * 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/* this drivers version (do not edit !!! generated and updated by cvs) */#define ZFCP_DEF_REVISION "$Revision: 1.81 $"/*************************** 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 <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>#ifdef CONFIG_S390_SUPPORT#include <linux/ioctl32.h>#endif/************************ DEBUG FLAGS *****************************************/#define	ZFCP_PRINT_FLAGS/********************* GENERAL DEFINES *********************************//* zfcp version number, it consists of major, minor, and patch-level number */#define ZFCP_VERSION		"4.1.3"static inline void *zfcp_sg_to_address(struct scatterlist *list){	return (void *) (page_address(list->page) + list->offset);}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#define ZFCP_EXCHANGE_CONFIG_DATA_RETRIES	6#define ZFCP_EXCHANGE_CONFIG_DATA_SLEEP		50/*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/typedef unsigned long long wwn_t;typedef unsigned int       fc_id_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#define ZFCP_NS_GA_NXT_TIMEOUT		120/* 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 CLEAR_ACA		0x40#define TARGET_RESET		0x20#define LOGICAL_UNIT_RESET	0x10#define CLEAR_TASK_SET		0x04#define 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));/* * FC-FS stuff */#define R_A_TOV				10 /* seconds */#define ZFCP_ELS_TIMEOUT		(2 * R_A_TOV)#define ZFCP_LS_RJT			0x01#define ZFCP_LS_ACC			0x02#define ZFCP_LS_RTV			0x0E#define ZFCP_LS_RLS			0x0F#define ZFCP_LS_PDISC			0x50#define ZFCP_LS_ADISC			0x52#define ZFCP_LS_RSCN			0x61#define ZFCP_LS_RNID			0x78#define ZFCP_LS_RLIR			0x7A#define ZFCP_LS_RTV_E_D_TOV_FLAG	0x04000000/* LS_ACC Reason Codes */#define ZFCP_LS_RJT_INVALID_COMMAND_CODE	0x01#define ZFCP_LS_RJT_LOGICAL_ERROR		0x03#define ZFCP_LS_RJT_LOGICAL_BUSY		0x05#define ZFCP_LS_RJT_PROTOCOL_ERROR		0x07#define ZFCP_LS_RJT_UNABLE_TO_PERFORM		0x09#define ZFCP_LS_RJT_COMMAND_NOT_SUPPORTED	0x0B#define ZFCP_LS_RJT_VENDOR_UNIQUE_ERROR		0xFFstruct zfcp_ls_rjt {	u8		code;	u8		field[3];	u8		reserved;	u8	reason_code;	u8		reason_expl;	u8	vendor_unique;} __attribute__ ((packed));struct zfcp_ls_rtv {	u8		code;	u8		field[3];} __attribute__ ((packed));struct zfcp_ls_rtv_acc {	u8		code;	u8		field[3];	u32		r_a_tov;	u32		e_d_tov;	u32		qualifier;} __attribute__ ((packed));struct zfcp_ls_rls {	u8		code;	u8		field[3];	fc_id_t		port_id;} __attribute__ ((packed));struct zfcp_ls_rls_acc {	u8		code;	u8		field[3];	u32		link_failure_count;	u32		loss_of_sync_count;	u32		loss_of_signal_count;	u32		prim_seq_prot_error;	u32		invalid_transmition_word;	u32		invalid_crc_count;} __attribute__ ((packed));struct zfcp_ls_pdisc {	u8		code;	u8		field[3];	u8		common_svc_parm[16];		wwn_t	wwpn;	wwn_t		wwnn;	struct {		u8	class1[16];		u8	class2[16];		u8	class3[16];	} svc_parm;	u8		reserved[16];	u8		vendor_version[16];} __attribute__ ((packed));struct zfcp_ls_pdisc_acc {	u8		code;	u8		field[3];	u8		common_svc_parm[16];	wwn_t		wwpn;	wwn_t		wwnn;	struct {		u8	class1[16];		u8	class2[16];		u8	class3[16];	} svc_parm;	u8		reserved[16];	u8		vendor_version[16];} __attribute__ ((packed));struct zfcp_ls_adisc {	u8		code;	u8		field[3];	fc_id_t		hard_nport_id;	wwn_t		wwpn;	wwn_t		wwnn;	fc_id_t		nport_id;} __attribute__ ((packed));struct zfcp_ls_adisc_acc {	u8		code;	u8		field[3];	fc_id_t		hard_nport_id;	wwn_t		wwpn;	wwn_t		wwnn;	fc_id_t		nport_id;} __attribute__ ((packed));struct zfcp_ls_rnid {	u8		code;	u8		field[3];	u8		node_id_format;	u8		reserved[3];} __attribute__((packed));/* common identification data */struct zfcp_ls_rnid_common_id {	u64		n_port_name;	u64		node_name;} __attribute__((packed));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?