summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_ccb.h
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2009-07-10 08:18:08 +0000
committerscottl <scottl@FreeBSD.org>2009-07-10 08:18:08 +0000
commite33e5dce327927280ca13509bde4fac5f9d39fe1 (patch)
tree65347229e3752769c4a701bd5f5308b2c8b4bf03 /sys/cam/cam_ccb.h
parentee1bfac31aec467d00137d267df6bbe2744c596a (diff)
downloadFreeBSD-src-e33e5dce327927280ca13509bde4fac5f9d39fe1.zip
FreeBSD-src-e33e5dce327927280ca13509bde4fac5f9d39fe1.tar.gz
Separate the parallel scsi knowledge out of the core of the XPT, and
modularize it so that new transports can be created. Add a transport for SATA Add a periph+protocol layer for ATA Add a driver for AHCI-compliant hardware. Add a maxio field to CAM so that drivers can advertise their max I/O capability. Modify various drivers so that they are insulated from the value of MAXPHYS. The new ATA/SATA code supports AHCI-compliant hardware, and will override the classic ATA driver if it is loaded as a module at boot time or compiled into the kernel. The stack now support NCQ (tagged queueing) for increased performance on modern SATA drives. It also supports port multipliers. ATA drives are accessed via 'ada' device nodes. ATAPI drives are accessed via 'cd' device nodes. They can all be enumerated and manipulated via camcontrol, just like SCSI drives. SCSI commands are not translated to their ATA equivalents; ATA native commands are used throughout the entire stack, including camcontrol. See the camcontrol manpage for further details. Testing this code may require that you update your fstab, and possibly modify your BIOS to enable AHCI functionality, if available. This code is very experimental at the moment. The userland ABI/API has changed, so applications will need to be recompiled. It may change further in the near future. The 'ada' device name may also change as more infrastructure is completed in this project. The goal is to eventually put all CAM busses and devices until newbus, allowing for interesting topology and management options. Few functional changes will be seen with existing SCSI/SAS/FC drivers, though the userland ABI has still changed. In the future, transports specific modules for SAS and FC may appear in order to better support the topologies and capabilities of these technologies. The modularization of CAM and the addition of the ATA/SATA modules is meant to break CAM out of the mold of being specific to SCSI, letting it grow to be a framework for arbitrary transports and protocols. It also allows drivers to be written to support discrete hardware without jeopardizing the stability of non-related hardware. While only an AHCI driver is provided now, a Silicon Image driver is also in the works. Drivers for ICH1-4, ICH5-6, PIIX, classic IDE, and any other hardware is possible and encouraged. Help with new transports is also encouraged. Submitted by: scottl, mav Approved by: re
Diffstat (limited to 'sys/cam/cam_ccb.h')
-rw-r--r--sys/cam/cam_ccb.h68
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
OpenPOWER on IntegriCloud