sfvar.h revision 3d19cdae966d9ac4218dd9859640463bd7da19d8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SCSI_ADAPTERS_SFVAR_H
#define _SYS_SCSI_ADAPTERS_SFVAR_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* FC-AL FCP driver definitions
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* this is to generate unique minor numbers for each minor
* node type being created. because of the limitations by SCSA,
* we have to use minor number values from 32 to 63 for the HBA
* drivers use
*/
#define SF_BASE_MINOR 32
#define SF_INST_SHIFT4MINOR 6
#define SF_MINOR2INST(x) ((x) >> SF_INST_SHIFT4MINOR)
#define SF_INIT_ITEMS 5
#define SF_MAX_TARGETS 126
#define SF_MAX_LILP_ENTRIES 126
#define SF_NUM_HASH_QUEUES 32
(SF_NUM_HASH_QUEUES-1))
/*
* sf driver needs to be sanitized for exporting some of its
*/
#ifdef _KERNEL
/*
* sf instance structure
*/
struct sf {
struct scsi_hba_tran *sf_tran;
struct sf *sf_sibling;
void *sf_socp; /* pointer to socal state */
struct fcal_transport *sf_sochandle;
int sf_throttle;
int sf_ncmds;
int sf_ncmds_exp_avg;
int sf_device_count;
int sf_take_core;
struct kmem_cache *sf_pkt_cache;
struct sf_pkt *sf_pkt_tail;
struct sf_els_hdr *sf_els_list;
struct sf_reset_list *sf_reset_list;
struct fcal_lilp_map *sf_lilp_map;
struct sf_hp_elem *sf_hp_elem_head;
struct sf_hp_elem *sf_hp_elem_tail;
/*
* Event handling
*/
/* check if unopened sf is being closed */
};
#define SF_STATE_INIT 0x01
#define SF_STATE_OFFLINE 0x02
#define SF_STATE_ONLINE 0x04
#define SF_STATE_ONLINING 0x08
#define SF_EVENT_TAG_INSERT 0
#define SF_EVENT_TAG_REMOVE 1
/*
* pool of sf command response blocks
*/
struct sf_cr_pool {
struct sf_cr_pool *next;
struct sf_cr_free_elem *free;
};
#define SF_ELEMS_IN_POOL 128
/*
*/
struct sf_cr_free_elem {
struct sf_cr_free_elem *next;
};
/*
* list of targets for reset delay handling
*/
struct sf_reset_list {
struct sf_reset_list *next;
};
/*
* structure used to store hotplug event callback info
*/
struct sf_hp_event {
int (*callback)();
void *arg;
};
/*
* sf per target structure
*/
struct sf_target {
struct sf_pkt *sft_pkt_tail;
union {
/* It's easier to shove around an int64 than a byte array */
uchar_t b[FCP_LUN_SIZE];
int64_t l;
} sft_lun;
/* XXXX The RAID LUN field is used to implement FCP Annex C */
#ifdef RAID_LUNS
#else
#endif
struct scsi_hba_tran *sft_tran;
struct sf_target *sft_next_lun;
struct sf_hp_event sft_insert_ev;
struct sf_hp_event sft_remove_ev;
struct scsi_inquiry sft_inq;
};
#define SF_TARGET_INIT_DONE 0x1
#define SF_TARGET_BUSY 0x2
#define SF_TARGET_OFFLINE 0x4
#define SF_TARGET_MARK 0x8
/*
* sf packet
*/
#ifdef _LP64
#define PKT_PRIV_SIZE 2
#define PKT_PRIV_LEN 16
#else /* _ILP32 */
#define PKT_PRIV_SIZE 1
#define PKT_PRIV_LEN 8
#endif
struct sf_pkt {
char cmd_scsi_scb[sizeof (struct scsi_arq_status)];
/* needs ZEROING */
/* needs to be INITialized */
/* needs to be INITialized */
/* needs to be INITialized */
struct fcp_rsp *cmd_rsp_block;
/* default target private area */
};
#define SF_STATE_IDLE 0x1
#define SF_STATE_ISSUED 0x2
#define SF_STATE_ABORTING 0x4
/*
* Define size of extended scsi cmd pkt (ie. includes ARQ)
*/
#define EXTCMDS_STATUS_SIZE (sizeof (struct scsi_arq_status))
/*
* These are the defined flags for this structure.
*/
/* kmem_alloc'd */
struct sf_els_hdr {
struct sf_els_hdr *next;
struct sf_els_hdr *prev;
struct fcal_packet *fpkt;
};
union sf_els_cmd {
struct la_els_logi logi;
struct la_els_logo logo;
struct la_els_prli prli;
struct la_els_adisc adisc;
};
union sf_els_rsp {
struct la_els_logi logi;
struct la_els_logo logo;
struct la_els_prli prli;
struct la_els_adisc adisc;
};
struct sf_hp_elem {
struct sf_hp_elem *next;
int what;
};
#define SF_ONLINE 0
#define SF_OFFLINE 1
#define SF_ONLINE_TIMEOUT 180
#define SF_OFFLINE_TIMEOUT 45
#define SF_RESET_TIMEOUT 10
#define SF_ELS_TIMEOUT 5
#define SF_INVALID_TIMEOUT 0x7fffffff
#define SF_FCP_TIMEOUT 30
#define SF_BSY_TIMEOUT 10
#define SF_POLL_TIMEOUT 60
#define SF_DECR_DELTA 5
#define SF_INCR_DELTA 5
#define SF_LO_CMD_DELTA 512
#define SF_HI_CMD_DELTA 256
#define SF_ELS_RETRIES 4
#define SF_BSY_RETRIES 7
#define SF_INIT_WAIT_TIMEOUT 60000000
#define SF_CORE_CMD_TIMEOUT 0x01
#define SF_CORE_BAD_ABORT 0x02
#define SF_CORE_ABORT_TIMEOUT 0x04
#define SF_CORE_ELS_TIMEOUT 0x08
#define SF_CORE_ELS_FAILED 0x10
#define SF_CORE_LILP_FAILED 0x20
#define SF_CORE_OFFLINE_TIMEOUT 0x40
#define SF_CORE_LIP_FAILED 0x80
#define SF_CORE_OFFLINE_TARGET 0x100
#define SF_CORE_INCOMPLETE_DMA 0x200
#define SF_CORE_REPORTLUN_TIMEOUT 0x400
#define SF_CORE_INQUIRY_TIMEOUT 0x800
#define SF_CORE_BAD_DMA 0x1000
#define SF_BAD_DMA_MAGIC 0xdeafbead
#define TRUE 1
#define FALSE 0
#define UNDEFINED -1
/*
* The initiator must allocate a minimum of 16 bytes for the response
* to the REPORT_LUNS command. Since there is 8 bytes of overhead and
* each LUN is 4 bytes, this means that the minimum size is 2 LUNs. We
* will define the structure that way to prevent any spurious check
* conditions.
*
* There is no maximum size for the response.
*
* By default we support 256 LUNs for the moment, which means 256*8+16
* or 2064 bytes total size.
*/
#define REPORT_LUNS_MIN_LUNS 2
#define REPORT_LUNS_DEFAULT 256
+2*sizeof (uint32_t))
/*
* SCSI Report_Luns Data
*
* Format of data returned as a result of an REPORT_LUNS command.
*
*/
struct scsi_report_luns {
/* Number of bytes of data the target has available to send. */
};
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SCSI_ADAPTERS_SFVAR_H */