diff options
author | Robert Mustacchi <rm@joyent.com> | 2017-05-10 15:23:30 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2019-01-16 00:48:38 +0000 |
commit | 0b4d657578b8f707371421ebae5b3837023b4144 (patch) | |
tree | 39d44caaef75a63ab52540b8b8a8382974e5c551 /usr/src/uts/common/io/scsi/targets/sd.c | |
parent | f482e26cbeb654aaa01a12e3faae3878d6a59822 (diff) | |
download | illumos-gate-0b4d657578b8f707371421ebae5b3837023b4144.tar.gz |
8235 fwflash for sd needs to handle partial writes
8236 fwflash sd plugin shouldn't hardcode maximum image size
8237 libscsi improperly translates request sense and isolate options to uscsi
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts/common/io/scsi/targets/sd.c')
-rw-r--r-- | usr/src/uts/common/io/scsi/targets/sd.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c index 769592a3e2..d29362d125 100644 --- a/usr/src/uts/common/io/scsi/targets/sd.c +++ b/usr/src/uts/common/io/scsi/targets/sd.c @@ -26,6 +26,7 @@ * Copyright (c) 2011 Bayard G. Bell. All rights reserved. * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright 2012 DEY Storage Systems, Inc. All rights reserved. + * Copyright 2016 Joyent, Inc. * Copyright 2017 Nexenta Systems, Inc. */ /* @@ -14213,15 +14214,21 @@ sd_initpkt_for_uscsi(struct buf *bp, struct scsi_pkt **pktpp) /* * Allocate the scsi_pkt for the command. + * * Note: If PKT_DMA_PARTIAL flag is set, scsi_vhci binds a path * during scsi_init_pkt time and will continue to use the * same path as long as the same scsi_pkt is used without - * intervening scsi_dma_free(). Since uscsi command does + * intervening scsi_dmafree(). Since uscsi command does * not call scsi_dmafree() before retry failed command, it * is necessary to make sure PKT_DMA_PARTIAL flag is NOT * set such that scsi_vhci can use other available path for * retry. Besides, ucsci command does not allow DMA breakup, * so there is no need to set PKT_DMA_PARTIAL flag. + * + * More fundamentally, we can't support breaking up this DMA into + * multiple windows on x86. There is, in general, no guarantee + * that arbitrary SCSI commands are idempotent, which is required + * if we want to use multiple windows for a given command. */ if (uscmd->uscsi_rqlen > SENSE_LENGTH) { pktp = scsi_init_pkt(SD_ADDRESS(un), NULL, @@ -22680,6 +22687,7 @@ sdioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cred_p, int *rval_p) case MHIOCGRP_REGISTERANDIGNOREKEY: case CDROMCLOSETRAY: case USCSICMD: + case USCSIMAXXFER: goto skip_ready_valid; default: break; @@ -23116,6 +23124,23 @@ skip_ready_valid: } break; + case USCSIMAXXFER: + SD_TRACE(SD_LOG_IOCTL, un, "USCSIMAXXFER\n"); + cr = ddi_get_cred(); + if ((drv_priv(cred_p) != 0) && (drv_priv(cr) != 0)) { + err = EPERM; + } else { + const uscsi_xfer_t xfer = un->un_max_xfer_size; + + if (ddi_copyout(&xfer, (void *)arg, sizeof (xfer), + flag) != 0) { + err = EFAULT; + } else { + err = 0; + } + } + break; + case CDROMPAUSE: case CDROMRESUME: SD_TRACE(SD_LOG_IOCTL, un, "PAUSE-RESUME\n"); |