From 0b4d657578b8f707371421ebae5b3837023b4144 Mon Sep 17 00:00:00 2001 From: Robert Mustacchi Date: Wed, 10 May 2017 15:23:30 +0000 Subject: 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 Reviewed by: Andy Stormont Reviewed by: Gergő Mihály Doma Approved by: Richard Lowe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/src/uts/common/io/scsi/targets/sd.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'usr/src/uts/common/io/scsi/targets/sd.c') 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"); -- cgit v1.2.3