summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_all.c
diff options
context:
space:
mode:
authorsmh <smh@FreeBSD.org>2013-04-02 00:11:35 +0000
committersmh <smh@FreeBSD.org>2013-04-02 00:11:35 +0000
commitcfd25a7a3319f0796127efebde56367031211bdd (patch)
tree5b3b108b29ce4a2cab63d41413284c2745266523 /sys/cam/scsi/scsi_all.c
parented915076293cab2b0ece9d485877ec9edb7f564e (diff)
downloadFreeBSD-src-cfd25a7a3319f0796127efebde56367031211bdd.zip
FreeBSD-src-cfd25a7a3319f0796127efebde56367031211bdd.tar.gz
Added ATA Pass-Through support to CAM
sys/cam/scsi/scsi_all.c: - Added scsi_ata_pass_16 method Which use ATA Pass-Through to send commands to the attached disk. sys/cam/scsi/scsi_all.h: - Added defines for all missing ATA Pass-Through commands values. - Added scsi_ata_pass_16 method. - Fixed a comment typo while I'm here Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
Diffstat (limited to 'sys/cam/scsi/scsi_all.c')
-rw-r--r--sys/cam/scsi/scsi_all.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index 332732f..205cf22 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <cam/cam_queue.h>
#include <cam/cam_xpt.h>
#include <cam/scsi/scsi_all.h>
+#include <sys/ata.h>
#include <sys/sbuf.h>
#ifndef _KERNEL
#include <camlib.h>
@@ -5855,6 +5856,50 @@ scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries,
}
void
+scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries,
+ void (*cbfcnp)(struct cam_periph *, union ccb *),
+ u_int32_t flags, u_int8_t tag_action,
+ u_int8_t protocol, u_int8_t ata_flags, u_int16_t features,
+ u_int16_t sector_count, uint64_t lba, u_int8_t command,
+ u_int8_t control, u_int8_t *data_ptr, u_int16_t dxfer_len,
+ u_int8_t sense_len, u_int32_t timeout)
+{
+ struct ata_pass_16 *ata_cmd;
+
+ ata_cmd = (struct ata_pass_16 *)&csio->cdb_io.cdb_bytes;
+ ata_cmd->opcode = ATA_PASS_16;
+ ata_cmd->protocol = protocol;
+ ata_cmd->flags = ata_flags;
+ ata_cmd->features_ext = features >> 8;
+ ata_cmd->features = features;
+ ata_cmd->sector_count_ext = sector_count >> 8;
+ ata_cmd->sector_count = sector_count;
+ ata_cmd->lba_low = lba;
+ ata_cmd->lba_mid = lba >> 8;
+ ata_cmd->lba_high = lba >> 16;
+ ata_cmd->device = ATA_DEV_LBA;
+ if (protocol & AP_EXTEND) {
+ ata_cmd->lba_low_ext = lba >> 24;
+ ata_cmd->lba_mid_ext = lba >> 32;
+ ata_cmd->lba_high_ext = lba >> 40;
+ } else
+ ata_cmd->device |= (lba >> 24) & 0x0f;
+ ata_cmd->command = command;
+ ata_cmd->control = control;
+
+ cam_fill_csio(csio,
+ retries,
+ cbfcnp,
+ flags,
+ tag_action,
+ data_ptr,
+ dxfer_len,
+ sense_len,
+ sizeof(*ata_cmd),
+ timeout);
+}
+
+void
scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries,
void (*cbfcnp)(struct cam_periph *, union ccb *),
u_int8_t tag_action, u_int8_t byte2,
OpenPOWER on IntegriCloud