pvscsi_var.h revision 565657ca18725b8f8dbe5b93704cc1d173be9d65
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2016 Nexenta Systems, Inc.
*/
#ifndef _PVSCSI_VAR_H_
#define _PVSCSI_VAR_H_
typedef struct pvscsi_dma_buf {
#define PVSCSI_TGT_PRIV_SIZE 2
#define PVSCSI_FLAG_CDB_EXT 0x0001
#define PVSCSI_FLAG_SCB_EXT 0x0002
#define PVSCSI_FLAG_PRIV_EXT 0x0004
#define PVSCSI_FLAG_TAG 0x0008
#define PVSCSI_FLAG_IO_READ 0x0010
#define PVSCSI_FLAG_IO_IOPB 0x0040
#define PVSCSI_FLAG_DONE 0x0080
#define PVSCSI_FLAG_DMA_VALID 0x0100
#define PVSCSI_FLAG_XARQ 0x0200
#define PVSCSI_FLAG_HW_STATUS 0x0400
#define PVSCSI_FLAG_TIMED_OUT 0x0800
#define PVSCSI_FLAG_ABORTED 0x1000
#define PVSCSI_FLAG_RESET_BUS 0x2000
#define PVSCSI_FLAG_RESET_DEV 0x4000
#define PVSCSI_FLAG_TRANSPORT 0x8000
/* Flags that must remain during SCSI packet retransmission */
#define PVSCSI_FLAGS_PERSISTENT \
#define PVSCSI_FLAGS_RESET \
#define PVSCSI_FLAGS_NON_HW_COMPLETION \
#define PVSCSI_FLAGS_COMPLETION \
#define PVSCSI_FLAGS_EXT \
typedef struct pvscsi_cmd_ctx {
struct pvscsi_cmd *cmd;
typedef struct pvscsi_cmp_desc_stat {
#define PVSCSI_MAX_IO_PAGES 256
typedef struct pvscsi_cmd {
struct scsi_arq_status cmd_scb;
int flags;
int cmd_target;
struct pvscsi_softc *cmd_pvs;
struct pvscsi_cmd *next_cmd;
struct pvscsi_cmd *tail_cmd;
int cmd_rqslen;
struct scsi_pkt cached_pkt;
} pvscsi_cmd_t;
#define CMD_CTX_SGLIST_VA(cmd_ctx) \
((struct PVSCSISGElement *) \
#define CMD_CTX_SGLIST_PA(cmd_ctx) \
typedef struct pvscsi_msg {
struct pvscsi_softc *msg_pvs;
int type;
int target;
} pvscsi_msg_t;
/* Driver-wide flags */
#define PVSCSI_DRIVER_SHUTDOWN 0x01
#define PVSCSI_HBA_QUIESCED 0x02
#define PVSCSI_HBA_QUIESCE_PENDING 0x04
#define PVSCSI_HBA_AUTO_REQUEST_SENSE 0x08
#define HBA_QUIESCE_PENDING(pvs) \
((pvs)->cmd_queue_len == 0))
typedef struct pvscsi_softc {
int instance;
int intr_type;
int intr_size;
int intr_cnt;
int intr_pri;
int flags;
int cmd_queue_len;
struct kmem_cache *cmd_cache;
int intr_lock_counter;
int num_pollers;
typedef struct pvscsi_device {
int target;
((struct PVSCSIRingReqDesc *) \
((struct PVSCSIRingCmpDesc *) \
((struct PVSCSIRingMsgDesc *) \
#define RINGS_STATE(pvs) \
((struct PVSCSIRingsState *)(((pvscsi_softc_t *)\
#define PVSCSI_INITIAL_SSTATE_ITEMS 16
#define SENSE_BUFFER_SIZE SENSE_LENGTH
#define USECS_TO_WAIT 1000
#define PVSCSI_MAXTGTS 16
#define PAGE_SIZE 4096
#define PAGE_SHIFT 12
#define PVSCSI_DEFAULT_NUM_PAGES_PER_RING 8
#define PVSCSI_DEFAULT_NUM_PAGES_MSG_RING 1
#endif /* _PVSCSI_VAR_H_ */