From c2bb195d18092ef6612eca1bca1e3f51d8c56f1d Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 15 Nov 2018 16:02:34 +0000 Subject: [PATCH] Introduce scsi_ata_setfeatures() as a convenient way to make a passthru ATA SETFEATURES command. Sponsored by: Netflix, Inc --- sys/cam/scsi/scsi_all.c | 32 ++++++++++++++++++++++++++++++++ sys/cam/scsi/scsi_all.h | 6 ++++++ 2 files changed, 38 insertions(+) diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 91df394f22e0..3b38559b36b1 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -8401,6 +8401,38 @@ scsi_ata_read_log(struct ccb_scsiio *csio, uint32_t retries, return (retval); } +int scsi_ata_setfeatures(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t feature, + uint64_t lba, uint32_t count, + uint8_t sense_len, uint32_t timeout) +{ + return (scsi_ata_pass(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_NONE, + tag_action, + /*protocol*/AP_PROTO_PIO_IN, + /*ata_flags*/AP_FLAG_TDIR_FROM_DEV | + AP_FLAG_BYT_BLOK_BYTES | + AP_FLAG_TLEN_SECT_CNT, + /*features*/feature, + /*sector_count*/count, + /*lba*/lba, + /*command*/ATA_SETFEATURES, + /*device*/ 0, + /*icc*/ 0, + /*auxiliary*/0, + /*control*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*cdb_storage*/NULL, + /*cdb_storage_len*/0, + /*minimum_cmd_size*/0, + sense_len, + timeout)); +} + /* * Note! This is an unusual CDB building function because it can return * an error in the event that the command in question requires a variable diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index 80f8a221cc3e..b5c45bc02a42 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -4176,6 +4176,12 @@ int scsi_ata_read_log(struct ccb_scsiio *csio, uint32_t retries, uint8_t protocol, uint8_t *data_ptr, uint32_t dxfer_len, uint8_t sense_len, uint32_t timeout); +int scsi_ata_setfeatures(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t feature, + uint64_t lba, uint32_t count, + uint8_t sense_len, uint32_t timeout); + int scsi_ata_pass(struct ccb_scsiio *csio, uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, uint8_t tag_action,