summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-03-17 09:21:31 +0000
committermav <mav@FreeBSD.org>2015-03-17 09:21:31 +0000
commit8985f800149158742cdabdf5a38237e29c5d09d4 (patch)
tree2ee5b4b8650ed7e91bfc8e2e6cbc239e6f4a4051 /sbin
parent074a0ffc9b1ee983f7d8e7f0e48891dde25c7d3f (diff)
downloadFreeBSD-src-8985f800149158742cdabdf5a38237e29c5d09d4.zip
FreeBSD-src-8985f800149158742cdabdf5a38237e29c5d09d4.tar.gz
Make ATA power management commands to work on SCSI HBAs via PASS THROUGH.
MFC after: 2 weeks Sponsored by: iXsystems, Inc.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/camcontrol/camcontrol.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 45b8285..b7b402c 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -7964,39 +7964,21 @@ atapm(struct cam_device *device, int argc, char **argv,
else
sc = 253;
- cam_fill_ataio(&ccb->ataio,
- retry_count,
- NULL,
- /*flags*/CAM_DIR_NONE,
- MSG_SIMPLE_Q_TAG,
- /*data_ptr*/NULL,
- /*dxfer_len*/0,
- timeout ? timeout : 30 * 1000);
- ata_28bit_cmd(&ccb->ataio, cmd, 0, 0, sc);
-
- /* Disable freezing the device queue */
- ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
-
- if (arglist & CAM_ARG_ERR_RECOVER)
- ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
-
- if (cam_send_ccb(device, ccb) < 0) {
- warn("error sending command");
+ retval = ata_do_28bit_cmd(device,
+ ccb,
+ /*retries*/retry_count,
+ /*flags*/CAM_DIR_NONE,
+ /*protocol*/AP_PROTO_NON_DATA,
+ /*tag_action*/MSG_SIMPLE_Q_TAG,
+ /*command*/cmd,
+ /*features*/0,
+ /*lba*/0,
+ /*sector_count*/sc,
+ /*data_ptr*/NULL,
+ /*dxfer_len*/0,
+ /*timeout*/timeout ? timeout : 30 * 1000,
+ /*quiet*/1);
- if (arglist & CAM_ARG_VERBOSE)
- cam_error_print(device, ccb, CAM_ESF_ALL,
- CAM_EPF_ALL, stderr);
-
- retval = 1;
- goto bailout;
- }
-
- if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
- cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
- retval = 1;
- goto bailout;
- }
-bailout:
cam_freeccb(ccb);
return (retval);
}
OpenPOWER on IntegriCloud