📄 cam.h
字号:
typedef struct ccb_enable_lun{ CCB_HEADER cam_ch; /* Header information fields */ uint16 cam_grp6_length; /* Group 6 Vendor Unique CDB Lengths */ uint16 cam_grp7_length; /* Group 7 Vendor Unique CDB Lengths */ uchar *cam_immed_notify_list; /* Ptr to Immediate Notify CCB list */ uint32 cam_immed_notify_cnt; /* Number of Immediate Notify CCBs */ uchar *cam_accept_targ_list; /* Ptr to Accept Target I/O CCB list */ uint32 cam_accept_targ_cnt; /* Number of Accept Target I/O CCBs */ uchar cam_sim_priv[ SIM_PRIV ]; /* SIM private data area */} CCB_ENABLE_LUN;/* Immediate Notify CCB */typedef struct ccb_immed_notify{ CCB_HEADER cam_ch; /* Header information fields */ uchar *cam_pdrv_ptr; /* Ptr used by the Peripheral driver */ void (*cam_cbfnot)(); /* Callback on notification function */ uchar *cam_sense_ptr; /* Pointer to the sense data buffer */ uchar cam_sense_len; /* Num of bytes in the Autosense buf */ uchar cam_init_id; /* ID of Initiator that selected */ uint16 cam_seq_id; /* Sequence Identifier */ uchar cam_msg_code; /* Message Code */ uchar cam_msg_args[7]; /* Message Arguments */} CCB_IMMED_NOTIFY;/* Notify Acknowledge CCB */typedef struct ccb_notify_ack{ CCB_HEADER cam_ch; /* Header information fields */ uint16 cam_seq_id; /* Sequence Identifier */ uchar cam_event; /* Event */ uchar cam_rsvd;} CCB_NOTIFY_ACK;/* Accept Target I/O CCB */typedef struct ccb_accept_targ{ CCB_HEADER cam_ch; /* Header information fields */ uchar *cam_pdrv_ptr; /* Ptr used by the Peripheral driver */ CCB_HEADER *cam_next_ccb; /* Ptr to the next CCB for action */ uchar *cam_req_map; /* Ptr for mapping info on the Req. */ void (*cam_cbfcnot)(); /* Callback on completion function */ uchar *cam_data_ptr; /* Pointer to the data buf/SG list */ uint32 cam_dxfer_len; /* Data xfer length */ uchar *cam_sense_ptr; /* Pointer to the sense data buffer */ uchar cam_sense_len; /* Num of bytes in the Autosense buf */ uchar cam_cdb_len; /* Number of bytes for the CDB */ uint16 cam_sglist_cnt; /* Num of scatter gather list entries */ uint32 cam_sort; /* Value used by SIM to sort on */ uchar cam_scsi_status; /* Returned scsi device status */ uchar cam_sense_resid; /* Autosense resid length: 2's comp */ uchar cam_osd_rsvd1[2]; /* OSD Reserved field, for alignment */ int32 cam_resid; /* Transfer residual length: 2's comp */ CDB_UN cam_cdb_io; /* Union for CDB bytes/pointer */ uint32 cam_timeout; /* Timeout value */ uchar *cam_msg_ptr; /* Pointer to the message buffer */ uint16 cam_msgb_len; /* Num of bytes in the message buf */ uint16 cam_vu_flags; /* Vendor unique flags */ uchar cam_tag_action; /* What to do for tag queuing */ uchar cam_tag_id; /* Tag ID */ uchar cam_initiator_id; /* Initiator ID */ uchar cam_iorsvd0[1]; /* Reserved field, for alignment */ uchar cam_sim_priv[ SIM_PRIV ]; /* SIM private data area */} CCB_ACCEPT_TARG;/* Continue Target I/O CCB */typedef CCB_ACCEPT_TARG CCB_CONT_TARG;/* HBA engine structures. */typedef struct ccb_eng_inq{ CCB_HEADER cam_ch; /* Header information fields */ uint16 cam_eng_num; /* The number for this inquiry */ uchar cam_eng_type; /* Returned engine type */ uchar cam_eng_algo; /* Returned algorithm type */ uint32 cam_eng_memory; /* Returned engine memory size */} CCB_ENG_INQ;typedef struct ccb_eng_exec /* NOTE: must match SCSIIO size */{ CCB_HEADER cam_ch; /* Header information fields */ uchar *cam_pdrv_ptr; /* Ptr used by the Peripheral driver */ uint32 cam_engrsvd0; /* Reserved field, for alignment */ uchar *cam_req_map; /* Ptr for mapping info on the Req. */ void (*cam_cbfcnp)(); /* Callback on completion function */ uchar *cam_data_ptr; /* Pointer to the data buf/SG list */ uint32 cam_dxfer_len; /* Data xfer length */ uchar *cam_engdata_ptr; /* Pointer to the engine buffer data */ uchar cam_engrsvd1; /* Reserved field, for alignment */ uchar cam_engrsvd2; /* Reserved field, for alignment */ uint16 cam_sglist_cnt; /* Num of scatter gather list entries */ uint32 cam_dmax_len; /* Destination data maximum length */ uint32 cam_dest_len; /* Destination data length */ int32 cam_src_resid; /* Source residual length: 2's comp */ uchar cam_engrsvd3[12]; /* Reserved field, for alignment */ uint32 cam_timeout; /* Timeout value */ uint32 cam_engrsvd4; /* Reserved field, for alignment */ uint16 cam_eng_num; /* Engine number for this request */ uint16 cam_vu_flags; /* Vendor unique flags */ uchar cam_engrsvd5; /* Reserved field, for alignment */ uchar cam_engrsvd6[3]; /* Reserved field, for alignment */ uchar cam_sim_priv[ SIM_PRIV ]; /* SIM private data area */} CCB_ENG_EXEC;/* The sim_module_info definition is used to define the entry points forthe SIMs contained in the SCSI CAM subsystem. Each SIM file willcontain a declaration for it's entry. The address for this entry willbe stored in the cam_conftbl[] array along will all the other SIMentries. */typedef struct cam_sim_cookie *cam_sim_cookie;typedef struct cam_sim_interface { //int (*init)(); // TK: no return value any more void (*action)( cam_sim_cookie cookie, CCB_HEADER *ccb ); // called when all connections to SIM are closed void (*unregistered)( cam_sim_cookie cookie );} cam_sim_interface;/* ---------------------------------------------------------------------- *//* Defines for the CAM status field in the CCB header. */#define CAM_REQ_INPROG 0x00 /* CCB request is in progress */#define CAM_REQ_CMP 0x01 /* CCB request completed w/out error */#define CAM_REQ_ABORTED 0x02 /* CCB request aborted by the host */#define CAM_UA_ABORT 0x03 /* Unable to Abort CCB request */#define CAM_REQ_CMP_ERR 0x04 /* CCB request completed with an err */#define CAM_BUSY 0x05 /* CAM subsystem is busy */#define CAM_REQ_INVALID 0x06 /* CCB request is invalid */#define CAM_PATH_INVALID 0x07 /* Path ID supplied is invalid */#define CAM_DEV_NOT_THERE 0x08 /* SCSI device not installed/there */#define CAM_UA_TERMIO 0x09 /* Unable to Terminate I/O CCB req */#define CAM_SEL_TIMEOUT 0x0A /* Target selection timeout */#define CAM_CMD_TIMEOUT 0x0B /* Command timeout */#define CAM_MSG_REJECT_REC 0x0D /* Message reject received */#define CAM_SCSI_BUS_RESET 0x0E /* SCSI bus reset sent/received */#define CAM_UNCOR_PARITY 0x0F /* Uncorrectable parity err occurred */#define CAM_AUTOSENSE_FAIL 0x10 /* Autosense: Request sense cmd fail */#define CAM_NO_HBA 0x11 /* No HBA detected Error */#define CAM_DATA_RUN_ERR 0x12 /* Data overrun/underrun error */#define CAM_UNEXP_BUSFREE 0x13 /* Unexpected BUS free */#define CAM_SEQUENCE_FAIL 0x14 /* Target bus phase sequence failure */#define CAM_CCB_LEN_ERR 0x15 /* CCB length supplied is inadequate */#define CAM_PROVIDE_FAIL 0x16 /* Unable to provide requ. capability */#define CAM_BDR_SENT 0x17 /* A SCSI BDR msg was sent to target */#define CAM_REQ_TERMIO 0x18 /* CCB request terminated by the host */#define CAM_HBA_ERR 0x19 /* Unrecoverable host bus adaptor err*/#define CAM_BUS_RESET_DENIED 0x1A /* SCSI bus reset denied */// TK: internal only! (XXX any better number for this?)#define CAM_DEV_QUEUE_FULL 0x20 /* SIM device queue full */#define CAM_BUS_QUEUE_FULL 0x21 /* SIM bus queue full */#define CAM_RESUBMIT 0x22 /* resubmit request */#define CAM_IDE 0x33 /* Initiator Detected Error Received */#define CAM_RESRC_UNAVAIL 0x34 /* Resource unavailable */#define CAM_UNACKED_EVENT 0x35 /* Unacknowledged event by host */#define CAM_MESSAGE_RECV 0x36 /* Msg received in Host Target Mode */#define CAM_INVALID_CDB 0x37 /* Invalid CDB recvd in HT Mode */#define CAM_LUN_INVALID 0x38 /* LUN supplied is invalid */#define CAM_TID_INVALID 0x39 /* Target ID supplied is invalid */#define CAM_FUNC_NOTAVAIL 0x3A /* The requ. func is not available */#define CAM_NO_NEXUS 0x3B /* Nexus is not established */#define CAM_IID_INVALID 0x3C /* The initiator ID is invalid */#define CAM_CDB_RECVD 0x3D /* The SCSI CDB has been received */#define CAM_LUN_ALLREADY_ENAB 0x3E /* LUN already enabled */#define CAM_SCSI_BUSY 0x3F /* SCSI bus busy */// TK: not supported#define CAM_SIM_QFRZN 0x40 /* The SIM queue is frozen w/this err */#define CAM_AUTOSNS_VALID 0x80 /* Autosense data valid for target */#define CAM_STATUS_MASK 0x3F /* Mask bits for just the status # *//* ---------------------------------------------------------------------- *//* Defines for the CAM flags field in the CCB header. */#define CAM_DIR_RESV 0x00000000 /* Data direction (00: reserved) */#define CAM_DIR_IN 0x00000040 /* Data direction (01: DATA IN) */#define CAM_DIR_OUT 0x00000080 /* Data direction (10: DATA OUT) */#define CAM_DIR_NONE 0x000000C0 /* Data direction (11: no data) */// TK: added helper mask#define CAM_DIR_MASK 0x000000C0// TK: probably not supported in future#define CAM_DIS_AUTOSENSE 0x00000020 /* Disable autosense feature */// TK: n/a, if sg_list != NULL, it is valid//#define CAM_SCATTER_VALID 0x00000010 /* Scatter/gather list is valid */// TK: n/a, no callback//#define CAM_DIS_CALLBACK 0x00000008 /* Disable callback feature */// TK: not supported//#define CAM_CDB_LINKED 0x00000004 /* The CCB contains a linked CDB */// TK: use cam_tag_action instead//#define CAM_QUEUE_ENABLE 0x00000002 /* SIM queue actions are enabled */// TK we always use the fixed sized array//#define CAM_CDB_POINTER 0x00000001 /* The CDB field contains a pointer */// TK: new flag - currently ignored#define CAM_SYNC_EXEC 0x00000100 /* execute synchronously */#define CAM_DIS_DISCONNECT 0x00008000 /* Disable disconnect */#define CAM_INITIATE_SYNC 0x00004000 /* Attempt Sync data xfer, and SDTR */#define CAM_DIS_SYNC 0x00002000 /* Disable sync, go to async */// TK: usually pointless, as XPT's own queueing doesn't support this feature#define CAM_SIM_QHEAD 0x00001000 /* Place CCB at the head of SIM Q */// TK: not supported//#define CAM_SIM_QFREEZE 0x00000800 /* Return the SIM Q to frozen state */// TK: not supported//#define CAM_SIM_QFRZDIS 0x00000400 /* Disable the SIM Q frozen state */#define CAM_ENG_SYNC 0x00000200 /* Flush resid bytes before cmplt */#define CAM_ENG_SGLIST 0x00800000 /* The SG list is for the HBA engine */// TK: always stored in array as part of ccb//#define CAM_CDB_PHYS 0x00400000 /* CDB pointer is physical */// TK: cam_data must be virtual//#define CAM_DATA_PHYS 0x00200000 /* SG/Buffer data ptrs are physical */// TK: n/a, as sense data is stored as part of ccb//#define CAM_SNS_BUF_PHYS 0x00100000 /* Autosense data ptr is physical */#define CAM_MSG_BUF_PHYS 0x00080000 /* Message buffer ptr is physical */// TK: linked requests not supported//#define CAM_NXT_CCB_PHYS 0x00040000 /* Next CCB pointer is physical */// TK: call backs not supported//#define CAM_CALLBCK_PHYS 0x00020000 /* Callback func ptr is physical */// TK: sg_list entries must be physical//#define CAM_SG_LIST_PHYS 0x00010000 /* SG list pointers physical *//* Phase cognizant mode flags */#define CAM_DATAB_VALID 0x80000000 /* Data buffer valid */#define CAM_STATUS_VALID 0x40000000 /* Status buffer valid */#define CAM_MSGB_VALID 0x20000000 /* Message buffer valid */#define CAM_TGT_PHASE_MODE 0x08000000 /* The SIM will run in phase mode */#define CAM_TGT_CCB_AVAIL 0x04000000 /* Target CCB available */#define CAM_DIS_AUTODISC 0x02000000 /* Disable autodisconnect */#define CAM_DIS_AUTOSRP 0x01000000 /* Disable autosave/restore ptrs *//* Host target mode flags */#define CAM_SEND_STATUS 0x80000000 /* Send status after date phase */#define CAM_DISCONNECT 0x40000000 /* Disc. mandatory after cdb recv */#define CAM_TERM_IO 0x20000000 /* Terminate I/O Message supported */#define CAM_TGT_PHASE_MODE 0x08000000 /* The SIM runs in phase mode *//* ---------------------------------------------------------------------- *//* Defines for the SIM/HBA queue actions. These value are used in theSCSI I/O CCB, for the queue action field. [These values should match thedefines from some other include file for the SCSI message phases. We maynot need these definitions here. ] */// TK: new value to make queuing flag unnecessary#define CAM_NO_QTAG 0x00 /* Queuing unimportant */#define CAM_SIMPLE_QTAG 0x20 /* Tag for a simple queue */#define CAM_HEAD_QTAG 0x21 /* Tag for head of queue */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -