📄 cam.h
字号:
#define CAM_ORDERED_QTAG 0x22 /* Tag for ordered queue *//* ---------------------------------------------------------------------- *//* Defines for the timeout field in the SCSI I/O CCB. At this time a valueof 0xF-F indicates a infinite timeout. A value of 0x0-0 indicates that theSIM's default timeout can take effect. */#define CAM_TIME_DEFAULT 0x00000000 /* Use SIM default value */#define CAM_TIME_INFINITY 0xFFFFFFFF /* Infinite timeout for I/O *//* ---------------------------------------------------------------------- *//* Defines for the Path Inquiry CCB fields. */#define CAM_VERSION 0x25 /* Binary value for the current ver */#define PI_MDP_ABLE 0x80 /* Supports MDP message */#define PI_WIDE_32 0x40 /* Supports 32 bit wide SCSI */#define PI_WIDE_16 0x20 /* Supports 16 bit wide SCSI */#define PI_SDTR_ABLE 0x10 /* Supports SDTR message */#define PI_LINKED_CDB 0x08 /* Supports linked CDBs */#define PI_TAG_ABLE 0x02 /* Supports tag queue message */#define PI_SOFT_RST 0x01 /* Supports soft reset */#define PIT_PROCESSOR 0x80 /* Target mode processor mode */#define PIT_PHASE 0x40 /* Target mode phase cog. mode */#define PIT_DISCONNECT 0x20 /* Disconnects supported in target mode */#define PIT_TERM_IO 0x20 /* Terminate I/O message support in target mode */#define PIT_GRP_8 0x20 /* Group 8 commands supported */#define PIT_GRP_7 0x20 /* Group 7 commands supported */#define PIM_SCANHILO 0x80 /* Bus scans from ID 7 to ID 0 */#define PIM_NOREMOVE 0x40 /* Removable dev not included in scan */#define PIM_NOINQUIRY 0x20 /* INQUIRY data not kept by XPT *//* ---------------------------------------------------------------------- *//* Defines for Asynchronous Callback CCB fields. */// TK: called for each new device; thus target and lun are valid// you'll never receive "lost" for a device that didn't exist before and vice versa#define AC_FOUND_DEVICE 0x80 /* During a rescan new device found */// TK: called for each lost device#define AC_LOST_DEVICE 0x04 #define AC_SIM_DEREGISTER 0x40 /* A loaded SIM has de-registered */#define AC_SIM_REGISTER 0x20 /* A loaded SIM has registered */#define AC_SENT_BDR 0x10 /* A BDR message was sent to target */#define AC_SCSI_AEN 0x08 /* A SCSI AEN has been received */#define AC_UNSOL_RESEL 0x02 /* A unsolicited reselection occurred */#define AC_BUS_RESET 0x01 /* A SCSI bus RESET occurred *//* ---------------------------------------------------------------------- *//* Typedef for a scatter/gather list element. */typedef struct sg_elem{ uchar *cam_sg_address; /* Scatter/Gather address */ uint32 cam_sg_count; /* Scatter/Gather count */} SG_ELEM;/* ---------------------------------------------------------------------- *//* Defines for the HBA engine inquiry CCB fields. */#define EIT_BUFFER 0x00 /* Engine type: Buffer memory */#define EIT_LOSSLESS 0x01 /* Engine type: Lossless compression */#define EIT_LOSSLY 0x02 /* Engine type: Lossly compression */#define EIT_ENCRYPT 0x03 /* Engine type: Encryption */#define EAD_VUNIQUE 0x00 /* Eng algorithm ID: vendor unique */#define EAD_LZ1V1 0x00 /* Eng algorithm ID: LZ1 var. 1*/#define EAD_LZ2V1 0x00 /* Eng algorithm ID: LZ2 var. 1*/#define EAD_LZ2V2 0x00 /* Eng algorithm ID: LZ2 var. 2*//* ---------------------------------------------------------------------- *//* ---------------------------------------------------------------------- *//* Unix OSD defines and data structures. */#define INQLEN 36 /* Inquiry string length to store. */#define CAM_SUCCESS 0 /* For signaling general success */#define CAM_FAILURE 1 /* For signaling general failure */#define CAM_FALSE 0 /* General purpose flag value */#define CAM_TRUE 1 /* General purpose flag value */#define XPT_CCB_INVALID -1 /* for signaling a bad CCB to free *//* The typedef for the Async callback information. This structure is used tostore the supplied info from the Set Async Callback CCB, in the EDT tablein a linked list structure. */typedef struct async_info{ struct async_info *cam_async_next; /* pointer to the next structure */ uint32 cam_event_enable; /* Event enables for Callback resp */ void (*cam_async_func)(); /* Async Callback function address */ uint32 cam_async_blen; /* Length of "information" buffer */ uchar *cam_async_ptr; /* Address for the "information */} ASYNC_INFO;/* The CAM EDT table contains the device information for all thedevices, SCSI ID and LUN, for all the SCSI busses in the system. Thetable contains a CAM_EDT_ENTRY structure for each device on the bus.*/typedef struct cam_edt_entry{ int32 cam_tlun_found; /* Flag for the existence of the target/LUN */ ASYNC_INFO *cam_ainfo; /* Async callback list info for this B/T/L */ uint32 cam_owner_tag; /* Tag for the peripheral driver's ownership */ char cam_inq_data[ INQLEN ]; /* storage for the inquiry data */} CAM_EDT_ENTRY;/* ============================================================================== *//* ----------------------------- VENDOR UNIQUE DATA ----------------------------- *//* ============================================================================== */// inquiry host controller restrictions#define XPT_INQUIRY_PARAMS (XPT_VUNIQUE + 1)typedef struct cam_sim_params { int dma_alignment; // block alignment - this must 2^i-1 for some i size_t dma_boundary; // (mask of bits that can change in one SG block) + 1 bool dma_boundary_solid; // true if boundary can be overcome by splitting blocks int max_sg_num; // maximum number of SG blocks int max_blocks; // maximum number of blocks} CAM_SIM_PARAMS;typedef struct cam_inquiry_params { CCB_HEADER cam_ch; CAM_SIM_PARAMS sim_params; } CAM_INQUIRY_PARAMS;/* --- XPT interface used by SCSI drivers--- *///typedef struct cam_for_driver_module_info cam_for_driver_module_info;typedef struct cam_periph_info *cam_periph_cookie;typedef struct cam_periph_interface { void (*async)( cam_periph_cookie periph_cookie, int path_id, int target_id, int lun, int code, const void *data, int data_len );} cam_periph_interface;typedef struct xpt_periph_info *xpt_periph_cookie;typedef struct xpt_bus_info *xpt_bus_cookie;typedef struct xpt_device_info *xpt_device_cookie;typedef struct cam_for_driver_interface { xpt_bus_cookie (*get_bus)( uchar path_id ); int (*put_bus)( xpt_bus_cookie bus ); // pass XPT_BUS_GLOBAL_ID as target and lun to get bus-global handle xpt_device_cookie (*get_device)( xpt_bus_cookie bus, int target_id, int target_lun ); int (*put_device)( xpt_device_cookie device ); CCB_HEADER *(*ccb_alloc)( xpt_device_cookie device ); void (*ccb_free)( CCB_HEADER *ccb ); void (*action)( CCB_HEADER *ccbh ); // during registration, you get an AC_FOUND_DEVICE for each existing device xpt_periph_cookie (*register_driver)( cam_periph_interface *interface, cam_periph_cookie periph_cookie ); int (*unregister_driver)( xpt_periph_cookie cookie );} cam_for_driver_interface;#define CAM_FOR_DRIVER_MODULE_NAME "bus_managers/scsi/driver/v1"/* --- XPT interface used by SCSI SIMs--- *///typedef struct xpt_bus_info *xpt_bus_cookie;#define XPT_DONE_IN_IRQ 1typedef struct xpt_dpc_info *xpt_dpc_cookie;typedef struct cam_for_sim_interface { void (*done)( CCB_HEADER *ccb ); // following functions return error on invalid arguments only int (*alloc_dpc)( xpt_dpc_cookie *dpc ); int (*free_dpc)( xpt_dpc_cookie dpc ); int (*schedule_dpc)( xpt_bus_cookie cookie, xpt_dpc_cookie dpc, /*int flags,*/ void (*func)( void * ), void *arg ); int (*block_bus)( xpt_bus_cookie bus ); int (*unblock_bus)( xpt_bus_cookie bus ); int (*block_device)( xpt_bus_cookie bus, int target, int lun ); int (*unblock_device)( xpt_bus_cookie bus, int target, int lun ); int (*cont_send_bus)( xpt_bus_cookie bus ); int (*cont_send_device)( xpt_bus_cookie bus, int target_id, int lun ); int (*call_async)( xpt_bus_cookie bus, int target_id, int lun, int code, uchar *data, int data_len ); int (*flush_async)( xpt_bus_cookie bus ); // these functions can fail because of internal problems // returns path_id or error code int (*register_SIM)( cam_sim_interface *interface, cam_sim_cookie cookie, xpt_bus_cookie *bus ); // if there are open connection, the SIM must still handle them // by refusing all requests, returning CAM_NO_HBA int (*unregister_SIM)( int path_id );} cam_for_sim_interface;#define CAM_FOR_SIM_MODULE_NAME "bus_managers/scsi/sim/v1"/* General Union for Kernel Space allocation. Contains all the possible CCBstructures. This union should never be used for manipulating CCB's its onlyuse is for the allocation and deallocation of raw CCB space. */typedef union ccb_size_union{ CCB_SCSIIO csio; /* Please keep this first, for debug/print */ CCB_GETDEV cgd; CCB_PATHINQ cpi; CCB_RELSIM crs; CCB_SETASYNC csa; CCB_SETDEV csd; CCB_ABORT cab; CCB_RESETBUS crb; CCB_RESETDEV crd; CCB_TERMIO ctio; CCB_EN_LUN cel; CCB_ENABLE_LUN cel2; CCB_IMMED_NOTIFY cin; CCB_NOTIFY_ACK cna; CCB_ACCEPT_TARG cat; CCB_ENG_INQ cei; CCB_ENG_EXEC cee; //CCB_EXTENDED_PATHINQ cdpi; CAM_INQUIRY_PARAMS cep;} CCB_SIZE_UNION;// TK: extra stuff#define XPT_XPT_PATH_ID 0xFF /* path id of XPT itself (used by XPT_PATH_INQ) */#define XPT_BUS_GLOBAL_ID 0xFF /* target id and lun of entire bus (for get_device) */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -