Changeset View
Standalone View
sys/cam/cam_ccb.h
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#define HBA_IDLEN 16 /* ASCII string len for HBA ID */ | #define HBA_IDLEN 16 /* ASCII string len for HBA ID */ | ||||
#define DEV_IDLEN 16 /* ASCII string len for device names */ | #define DEV_IDLEN 16 /* ASCII string len for device names */ | ||||
#define CCB_PERIPH_PRIV_SIZE 2 /* size of peripheral private area */ | #define CCB_PERIPH_PRIV_SIZE 2 /* size of peripheral private area */ | ||||
#define CCB_SIM_PRIV_SIZE 2 /* size of sim private area */ | #define CCB_SIM_PRIV_SIZE 2 /* size of sim private area */ | ||||
/* Struct definitions for CAM control blocks */ | /* Struct definitions for CAM control blocks */ | ||||
/* Common CCB header */ | /* Common CCB header */ | ||||
/* CCB memory allocation flags */ | |||||
typedef enum { | |||||
CAM_CCB_FROM_UMA = 0x00000001,/* CCB from a periph UMA zone */ | |||||
} ccb_alloc_flags; | |||||
/* CAM CCB flags */ | /* CAM CCB flags */ | ||||
typedef enum { | typedef enum { | ||||
CAM_CDB_POINTER = 0x00000001,/* The CDB field is a pointer */ | CAM_CDB_POINTER = 0x00000001,/* The CDB field is a pointer */ | ||||
CAM_unused1 = 0x00000002, | CAM_unused1 = 0x00000002, | ||||
CAM_unused2 = 0x00000004, | CAM_unused2 = 0x00000004, | ||||
CAM_NEGOTIATE = 0x00000008,/* | CAM_NEGOTIATE = 0x00000008,/* | ||||
* Perform transport negotiation | * Perform transport negotiation | ||||
* with this command. | * with this command. | ||||
▲ Show 20 Lines • Show All 267 Lines • ▼ Show 20 Lines | typedef struct { | ||||
uintptr_t periph_data; | uintptr_t periph_data; | ||||
} ccb_qos_area; | } ccb_qos_area; | ||||
struct ccb_hdr { | struct ccb_hdr { | ||||
cam_pinfo pinfo; /* Info for priority scheduling */ | cam_pinfo pinfo; /* Info for priority scheduling */ | ||||
camq_entry xpt_links; /* For chaining in the XPT layer */ | camq_entry xpt_links; /* For chaining in the XPT layer */ | ||||
camq_entry sim_links; /* For chaining in the SIM layer */ | camq_entry sim_links; /* For chaining in the SIM layer */ | ||||
camq_entry periph_links; /* For chaining in the type driver */ | camq_entry periph_links; /* For chaining in the type driver */ | ||||
u_int32_t retry_count; | #if BYTE_ORDER == LITTLE_ENDIAN | ||||
u_int16_t retry_count; | |||||
u_int16_t alloc_flags; /* ccb_alloc_flags */ | |||||
#else | |||||
u_int16_t alloc_flags; /* ccb_alloc_flags */ | |||||
u_int16_t retry_count; | |||||
#endif | |||||
imp: This is only backwards compatible on little endian machines.
| |||||
Done Inline Actionsbut a ifdef to order the fields this way for LE and the opposite way for BE wouldn't be bad. imp: but a ifdef to order the fields this way for LE and the opposite way for BE wouldn't be bad.
| |||||
void (*cbfcnp)(struct cam_periph *, union ccb *); | void (*cbfcnp)(struct cam_periph *, union ccb *); | ||||
/* Callback on completion function */ | /* Callback on completion function */ | ||||
xpt_opcode func_code; /* XPT function code */ | xpt_opcode func_code; /* XPT function code */ | ||||
u_int32_t status; /* Status returned by CAM subsystem */ | u_int32_t status; /* Status returned by CAM subsystem */ | ||||
struct cam_path *path; /* Compiled path for this ccb */ | struct cam_path *path; /* Compiled path for this ccb */ | ||||
path_id_t path_id; /* Path ID for the request */ | path_id_t path_id; /* Path ID for the request */ | ||||
target_id_t target_id; /* Target device ID */ | target_id_t target_id; /* Target device ID */ | ||||
lun_id_t target_lun; /* Target LUN number */ | lun_id_t target_lun; /* Target LUN number */ | ||||
▲ Show 20 Lines • Show All 376 Lines • ▼ Show 20 Lines | u_int8_t *cdb_ptr; /* Pointer to the CDB bytes to send */ | ||||
/* Area for the CDB send */ | /* Area for the CDB send */ | ||||
u_int8_t cdb_bytes[IOCDBLEN]; | u_int8_t cdb_bytes[IOCDBLEN]; | ||||
} cdb_t; | } cdb_t; | ||||
/* | /* | ||||
* SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO | * SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO | ||||
* function codes. | * function codes. | ||||
*/ | */ | ||||
struct ccb_scsiio { | struct ccb_scsiio { | ||||
Not Done Inline Actionschanging this structure requires, iirc, compatibility code since this is one of the ABI interfaces cam is trying to maintain. imp: changing this structure requires, iirc, compatibility code since this is one of the ABI… | |||||
Done Inline ActionsThanks. Those changes are to get its size down to 512 bytes; I think the layout change, and compat shims, could go in later. I'm most interested in the general approach; if it's good, I could then proceed with doing the same for ada(4) and nda(4). trasz: Thanks. Those changes are to get its size down to 512 bytes; I think the layout change, and… | |||||
Done Inline ActionsOn further consideration, perhaps the periph drivers should simply provide a callback to allocate a CCB, instead of indicating its size? This way we wouldn't need to touch ccb_scsiio layout, and would also avoid even more overhead for other transports (ccb_nvmeio is ~300 bytes). trasz: On further consideration, perhaps the periph drivers should simply provide a callback to… | |||||
Not Done Inline ActionsThe main need for compat is with camcontrol and other userland programs doing passthru until they can be recompiled. As for callbacks, how do you see that working? imp: The main need for compat is with camcontrol and other userland programs doing passthru until… | |||||
struct ccb_hdr ccb_h; | struct ccb_hdr ccb_h; | ||||
union ccb *next_ccb; /* Ptr for next CCB for action */ | union ccb *next_ccb; /* Ptr for next CCB for action */ | ||||
u_int8_t *req_map; /* Ptr to mapping info */ | u_int8_t *req_map; /* Ptr to mapping info */ | ||||
u_int8_t *data_ptr; /* Ptr to the data buf/SG list */ | u_int8_t *data_ptr; /* Ptr to the data buf/SG list */ | ||||
u_int32_t dxfer_len; /* Data transfer length */ | u_int32_t dxfer_len; /* Data transfer length */ | ||||
/* Autosense storage */ | /* Autosense storage */ | ||||
struct scsi_sense_data sense_data; | struct scsi_sense_data sense_data; | ||||
u_int8_t sense_len; /* Number of bytes to autosense */ | u_int8_t sense_len; /* Number of bytes to autosense */ | ||||
▲ Show 20 Lines • Show All 799 Lines • Show Last 20 Lines |
This is only backwards compatible on little endian machines.