diff options
Diffstat (limited to 'sys/cam/cam_ccb.h')
-rw-r--r-- | sys/cam/cam_ccb.h | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index 33799fb..5f10cc6 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -40,6 +40,7 @@ #endif #include <cam/cam_debug.h> #include <cam/scsi/scsi_all.h> +#include <cam/ata/ata_all.h> /* General allocation length definitions for CCB structures */ @@ -169,6 +170,8 @@ typedef enum { * a device give the sector size and * volume size. */ + XPT_ATA_IO = 0x18 | XPT_FC_DEV_QUEUED, + /* Execute the requested ATA I/O operation */ /* HBA engine commands 0x20->0x2F */ XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY, @@ -213,6 +216,7 @@ typedef enum { PROTO_SCSI, /* Small Computer System Interface */ PROTO_ATA, /* AT Attachment */ PROTO_ATAPI, /* AT Attachment Packetized Interface */ + PROTO_SATAPM, /* SATA Port Multiplier */ } cam_proto; typedef enum { @@ -225,6 +229,7 @@ typedef enum { XPORT_PPB, /* Parallel Port Bus */ XPORT_ATA, /* AT Attachment */ XPORT_SAS, /* Serial Attached SCSI */ + XPORT_SATA, /* Serial AT Attachment */ } cam_xport; #define PROTO_VERSION_UNKNOWN (UINT_MAX - 1) @@ -284,7 +289,9 @@ struct ccb_hdr { /* Get Device Information CCB */ struct ccb_getdev { struct ccb_hdr ccb_h; + cam_proto protocol; struct scsi_inquiry_data inq_data; + struct ata_params ident_data; u_int8_t serial_num[252]; u_int8_t reserved; u_int8_t serial_num_len; @@ -412,7 +419,9 @@ struct device_match_result { path_id_t path_id; target_id_t target_id; lun_id_t target_lun; + cam_proto protocol; struct scsi_inquiry_data inq_data; + struct ata_params ident_data; dev_result_flags flags; }; @@ -495,6 +504,7 @@ typedef enum { PI_WIDE_16 = 0x20, /* Supports 16 bit wide SCSI */ PI_SDTR_ABLE = 0x10, /* Supports SDTR message */ PI_LINKED_CDB = 0x08, /* Supports linked CDBs */ + PI_SATAPM = 0x04, /* Supports SATA PM */ PI_TAG_ABLE = 0x02, /* Supports tag queue messages */ PI_SOFT_RST = 0x01 /* Supports soft reset alternative */ } pi_inqflag; @@ -562,6 +572,7 @@ struct ccb_pathinq { struct ccb_pathinq_settings_sas sas; char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE]; } xport_specific; + u_int maxio; /* Max supported I/O size, in bytes. */ }; /* Path Statistics CCB */ @@ -617,6 +628,28 @@ struct ccb_scsiio { u_int init_id; /* initiator id of who selected */ }; +/* + * ATA I/O Request CCB used for the XPT_ATA_IO function code. + */ +struct ccb_ataio { + struct ccb_hdr ccb_h; + union ccb *next_ccb; /* Ptr for next CCB for action */ + struct ata_cmd cmd; /* ATA command register set */ + struct ata_res res; /* ATA result register set */ + u_int8_t *data_ptr; /* Ptr to the data buf/SG list */ + u_int32_t dxfer_len; /* Data transfer length */ + u_int32_t resid; /* Transfer residual length: 2's comp */ + u_int8_t tag_action; /* What to do for tag queueing */ + /* + * The tag action should be either the define below (to send a + * non-tagged transaction) or one of the defined scsi tag messages + * from scsi_message.h. + */ +#define CAM_TAG_ACTION_NONE 0x00 + u_int tag_id; /* tag id from initator (target mode) */ + u_int init_id; /* initiator id of who selected */ +}; + struct ccb_accept_tio { struct ccb_hdr ccb_h; cdb_t cdb_io; /* Union for CDB bytes/pointer */ @@ -746,6 +779,13 @@ struct ccb_trans_settings_sas { u_int32_t bitrate; /* Mbps */ }; +struct ccb_trans_settings_sata { + u_int valid; /* Which fields to honor */ +#define CTS_SATA_VALID_SPEED 0x01 +#define CTS_SATA_VALID_PM 0x02 + u_int32_t bitrate; /* Mbps */ + u_int pm_present; /* PM is present (XPT->SIM) */ +}; /* Get/Set transfer rate/width/disconnection/tag queueing settings */ struct ccb_trans_settings { @@ -764,6 +804,7 @@ struct ccb_trans_settings { struct ccb_trans_settings_spi spi; struct ccb_trans_settings_fc fc; struct ccb_trans_settings_sas sas; + struct ccb_trans_settings_sata sata; } xport_specific; }; @@ -907,6 +948,7 @@ union ccb { struct ccb_eng_exec cee; struct ccb_rescan crcn; struct ccb_debug cdbg; + struct ccb_ataio ataio; }; __BEGIN_DECLS @@ -924,7 +966,14 @@ cam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries, u_int32_t flags, u_int tag_action, u_int tag_id, u_int init_id, u_int scsi_status, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int32_t timeout); - + +static __inline void +cam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int tag_action, + u_int8_t *data_ptr, u_int32_t dxfer_len, + u_int32_t timeout); + static __inline void cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), @@ -965,6 +1014,23 @@ cam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries, csio->init_id = init_id; } +static __inline void +cam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int tag_action, + u_int8_t *data_ptr, u_int32_t dxfer_len, + u_int32_t timeout) +{ + ataio->ccb_h.func_code = XPT_ATA_IO; + ataio->ccb_h.flags = flags; + ataio->ccb_h.retry_count = retries; + ataio->ccb_h.cbfcnp = cbfcnp; + ataio->ccb_h.timeout = timeout; + ataio->data_ptr = data_ptr; + ataio->dxfer_len = dxfer_len; + ataio->tag_action = tag_action; +} + void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended); __END_DECLS |