#ifndef _CAM_CAM_COMPAT_H
#define _CAM_CAM_COMPAT_H
#ifdef _KERNEL
int cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
struct thread *td, int(*cbfnp)(struct cdev *, u_long, caddr_t, int,
struct thread *));
#define CAM_VERSION_0x16 0x16
#define CAMIOCOMMAND_0x16 _IOC(IOC_INOUT, CAM_VERSION_0x16, 2, CAM_0X17_LEN)
#define CAMGETPASSTHRU_0x16 _IOC(IOC_INOUT, CAM_VERSION_0x16, 3, CAM_0X17_LEN)
#define CAM_SCATTER_VALID_0x16 0x00000010
#define CAM_SG_LIST_PHYS_0x16 0x00040000
#define CAM_DATA_PHYS_0x16 0x00200000
#define CAM_VERSION_0x17 0x17
struct ccb_hdr_0x17 {
cam_pinfo pinfo;
camq_entry xpt_links;
camq_entry sim_links;
camq_entry periph_links;
uint32_t retry_count;
void (*cbfcnp)(struct cam_periph *, union ccb *);
xpt_opcode func_code;
uint32_t status;
struct cam_path *path;
path_id_t path_id;
target_id_t target_id;
u_int target_lun;
uint32_t flags;
ccb_ppriv_area periph_priv;
ccb_spriv_area sim_priv;
uint32_t timeout;
struct callout *timeout_ch;
};
struct ccb_pathinq_0x17 {
struct ccb_hdr_0x17 ccb_h;
uint8_t version_num;
uint8_t hba_inquiry;
uint8_t target_sprt;
uint8_t hba_misc;
uint16_t hba_eng_cnt;
uint8_t vuhba_flags[VUHBALEN];
uint32_t max_target;
uint32_t max_lun;
uint32_t async_flags;
path_id_t hpath_id;
target_id_t initiator_id;
char sim_vid[SIM_IDLEN];
char hba_vid[HBA_IDLEN];
char dev_name[DEV_IDLEN];
uint32_t unit_number;
uint32_t bus_id;
uint32_t base_transfer_speed;
cam_proto protocol;
u_int protocol_version;
cam_xport transport;
u_int transport_version;
union {
struct ccb_pathinq_settings_spi spi;
struct ccb_pathinq_settings_fc fc;
struct ccb_pathinq_settings_sas sas;
char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE];
} xport_specific;
u_int maxio;
uint16_t hba_vendor;
uint16_t hba_device;
uint16_t hba_subvendor;
uint16_t hba_subdevice;
};
struct ccb_trans_settings_0x17 {
struct ccb_hdr_0x17 ccb_h;
cts_type type;
cam_proto protocol;
u_int protocol_version;
cam_xport transport;
u_int transport_version;
union {
u_int valid;
struct ccb_trans_settings_ata ata;
struct ccb_trans_settings_scsi scsi;
} proto_specific;
union {
u_int valid;
struct ccb_trans_settings_spi spi;
struct ccb_trans_settings_fc fc;
struct ccb_trans_settings_sas sas;
struct ccb_trans_settings_pata ata;
struct ccb_trans_settings_sata sata;
} xport_specific;
};
#define CAM_0X17_DATA_LEN CAM_0X18_DATA_LEN
#define CAM_0X17_LEN (sizeof(struct ccb_hdr_0x17) + CAM_0X17_DATA_LEN)
#define CAMIOCOMMAND_0x17 _IOC(IOC_INOUT, CAM_VERSION_0x17, 2, CAM_0X17_LEN)
#define CAMGETPASSTHRU_0x17 _IOC(IOC_INOUT, CAM_VERSION_0x17, 3, CAM_0X17_LEN)
#define CAM_VERSION_0x18 0x18
struct ccb_hdr_0x18 {
cam_pinfo pinfo;
camq_entry xpt_links;
camq_entry sim_links;
camq_entry periph_links;
uint32_t retry_count;
void (*cbfcnp)(struct cam_periph *, union ccb *);
xpt_opcode func_code;
uint32_t status;
struct cam_path *path;
path_id_t path_id;
target_id_t target_id;
u_int target_lun;
uint64_t ext_lun;
uint32_t flags;
uint32_t xflags;
ccb_ppriv_area periph_priv;
ccb_spriv_area sim_priv;
ccb_qos_area qos;
uint32_t timeout;
struct timeval softtimeout;
};
typedef enum {
CAM_EXTLUN_VALID_0x18 = 0x00000001,
} ccb_xflags_0x18;
struct ccb_trans_settings_0x18 {
struct ccb_hdr_0x18 ccb_h;
cts_type type;
cam_proto protocol;
u_int protocol_version;
cam_xport transport;
u_int transport_version;
union {
u_int valid;
struct ccb_trans_settings_ata ata;
struct ccb_trans_settings_scsi scsi;
} proto_specific;
union {
u_int valid;
struct ccb_trans_settings_spi spi;
struct ccb_trans_settings_fc fc;
struct ccb_trans_settings_sas sas;
struct ccb_trans_settings_pata ata;
struct ccb_trans_settings_sata sata;
} xport_specific;
};
struct dev_match_result_0x18 {
dev_match_type type;
union {
struct {
char periph_name[DEV_IDLEN];
uint32_t unit_number;
path_id_t path_id;
target_id_t target_id;
u_int target_lun;
} periph_result;
struct {
path_id_t path_id;
target_id_t target_id;
u_int target_lun;
cam_proto protocol;
struct scsi_inquiry_data inq_data;
struct ata_params ident_data;
dev_result_flags flags;
} device_result;
struct bus_match_result bus_result;
} result;
};
#define CAM_0X18_DATA_LEN (sizeof(union ccb) - 2*sizeof(void *) - sizeof(struct ccb_hdr))
#define CAM_0X18_LEN (sizeof(struct ccb_hdr_0x18) + CAM_0X18_DATA_LEN)
#define CAMIOCOMMAND_0x18 _IOC(IOC_INOUT, CAM_VERSION_0x18, 2, CAM_0X18_LEN)
#define CAMGETPASSTHRU_0x18 _IOC(IOC_INOUT, CAM_VERSION_0x18, 3, CAM_0X18_LEN)
#define CAM_VERSION_0x19 0x19
#define CAMIOCOMMAND_0x19 _IOWR(CAM_VERSION_0x19, 2, union ccb)
#define CAMGETPASSTHRU_0x19 _IOWR(CAM_VERSION_0x19, 3, union ccb)
#define CAMIOQUEUE_0x19 _IO(CAM_VERSION_0x19, 4)
#define CAMIOGET_0x19 _IO(CAM_VERSION_0x19, 5)
#endif
#endif