diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/io/fibre-channel/ulp/fcp.c | 4 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/adapters/blk2scsa/blk2scsa.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/impl/scsi_hba.c | 24 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/impl/scsi_transport.c | 34 | ||||
-rw-r--r-- | usr/src/uts/common/sys/scsi/impl/transport.h | 4 | ||||
-rw-r--r-- | usr/src/uts/common/sys/scsi/scsi_resource.h | 4 |
6 files changed, 33 insertions, 43 deletions
diff --git a/usr/src/uts/common/io/fibre-channel/ulp/fcp.c b/usr/src/uts/common/io/fibre-channel/ulp/fcp.c index ce5a90b990..0448bc7260 100644 --- a/usr/src/uts/common/io/fibre-channel/ulp/fcp.c +++ b/usr/src/uts/common/io/fibre-channel/ulp/fcp.c @@ -14021,9 +14021,7 @@ fcp_prepare_pkt(struct fcp_port *pptr, struct fcp_pkt *cmd, static void fcp_post_callback(struct fcp_pkt *cmd) { - if (cmd->cmd_pkt->pkt_comp) { - (*cmd->cmd_pkt->pkt_comp) (cmd->cmd_pkt); - } + scsi_hba_pkt_comp(cmd->cmd_pkt); } diff --git a/usr/src/uts/common/io/scsi/adapters/blk2scsa/blk2scsa.c b/usr/src/uts/common/io/scsi/adapters/blk2scsa/blk2scsa.c index 19eb56b808..5700fbf10d 100644 --- a/usr/src/uts/common/io/scsi/adapters/blk2scsa/blk2scsa.c +++ b/usr/src/uts/common/io/scsi/adapters/blk2scsa/blk2scsa.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -584,8 +584,8 @@ b2s_request_done_pkt(b2s_request_impl_t *ri) /* * Finally, execute the callback (unless running POLLED) */ - if (((pkt->pkt_flags & FLAG_NOINTR) == 0) && (pkt->pkt_comp != NULL)) { - pkt->pkt_comp(pkt); + if ((pkt->pkt_flags & FLAG_NOINTR) == 0) { + scsi_hba_pkt_comp(pkt); } } diff --git a/usr/src/uts/common/io/scsi/impl/scsi_hba.c b/usr/src/uts/common/io/scsi/impl/scsi_hba.c index 23dfc457b8..f55a04e1e6 100644 --- a/usr/src/uts/common/io/scsi/impl/scsi_hba.c +++ b/usr/src/uts/common/io/scsi/impl/scsi_hba.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -3174,3 +3174,25 @@ scsi_hba_bus_unconfig(dev_info_t *self, uint_t flag, ddi_bus_config_op_t op, } return (ndi_busop_bus_unconfig(self, flag, op, arg)); } + +void +scsi_hba_pkt_comp(struct scsi_pkt *pkt) +{ + ASSERT(pkt); + if (pkt->pkt_comp == NULL) + return; + + /* + * For HBA drivers that implement tran_setup_pkt(9E), if we are + * completing a 'consistent' mode DMA operation then we must + * perform dma_sync prior to calling pkt_comp to ensure that + * the target driver sees the correct data in memory. + */ + ASSERT((pkt->pkt_flags & FLAG_NOINTR) == 0); + if (((pkt->pkt_dma_flags & DDI_DMA_CONSISTENT) && + (pkt->pkt_dma_flags & DDI_DMA_READ)) && + ((P_TO_TRAN(pkt)->tran_setup_pkt) != NULL)) { + scsi_sync_pkt(pkt); + } + (*pkt->pkt_comp)(pkt); +} diff --git a/usr/src/uts/common/io/scsi/impl/scsi_transport.c b/usr/src/uts/common/io/scsi/impl/scsi_transport.c index 0ba3f94fb9..29436c4cf8 100644 --- a/usr/src/uts/common/io/scsi/impl/scsi_transport.c +++ b/usr/src/uts/common/io/scsi/impl/scsi_transport.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Main Transport Routine for SCSA */ @@ -76,17 +74,6 @@ scsi_flag_nointr_comp(struct scsi_pkt *pkt) mutex_exit(&scsi_flag_nointr_mutex); } -static void -scsi_consistent_comp(struct scsi_pkt *pkt) -{ - struct scsi_pkt_cache_wrapper *pcw = - (struct scsi_pkt_cache_wrapper *)pkt; - - pkt->pkt_comp = pcw->pcw_orig_comp; - scsi_sync_pkt(pkt); - (*pkt->pkt_comp)(pkt); -} - /* * A packet can have FLAG_NOINTR set because of target driver or * scsi_poll(). If FLAG_NOINTR is set and we are in user context, @@ -140,19 +127,6 @@ scsi_transport(struct scsi_pkt *pkt) #endif /* DEBUG */ } - /* determine if we need to sync the data on the HBA's behalf */ - if ((pkt->pkt_dma_flags & DDI_DMA_CONSISTENT) && - ((pkt->pkt_comp) != NULL) && - ((P_TO_TRAN(pkt)->tran_setup_pkt) != NULL)) { - struct scsi_pkt_cache_wrapper *pcw = - (struct scsi_pkt_cache_wrapper *)pkt; - - _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", \ - scsi_pkt_cache_wrapper::pcw_orig_comp)); - - pcw->pcw_orig_comp = pkt->pkt_comp; - pkt->pkt_comp = scsi_consistent_comp; - } /* * Check if we are required to do polled I/O. We can * get scsi_pkts that don't have the FLAG_NOINTR bit @@ -201,11 +175,7 @@ scsi_transport(struct scsi_pkt *pkt) */ pkt->pkt_comp = savec; pkt->pkt_flags = savef; - - if (pkt->pkt_comp != NULL) { - (*pkt->pkt_comp)(pkt); - } - + scsi_hba_pkt_comp(pkt); return (rval); } diff --git a/usr/src/uts/common/sys/scsi/impl/transport.h b/usr/src/uts/common/sys/scsi/impl/transport.h index d2fcfc136d..c5e9edeb3d 100644 --- a/usr/src/uts/common/sys/scsi/impl/transport.h +++ b/usr/src/uts/common/sys/scsi/impl/transport.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -443,6 +443,8 @@ int scsi_hba_prop_update_inqstring( char *data, size_t len); +void scsi_hba_pkt_comp( + struct scsi_pkt *pkt); /* * Flags for scsi_hba_attach * diff --git a/usr/src/uts/common/sys/scsi/scsi_resource.h b/usr/src/uts/common/sys/scsi/scsi_resource.h index b1f801cc99..65fe05bce3 100644 --- a/usr/src/uts/common/sys/scsi/scsi_resource.h +++ b/usr/src/uts/common/sys/scsi/scsi_resource.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -87,13 +87,11 @@ struct scsi_pkt_cache_wrapper { uint_t pcw_granular; struct buf *pcw_bp; ddi_dma_cookie_t pcw_cookie; - void (*pcw_orig_comp)(struct scsi_pkt *); uint_t pcw_flags; }; #ifdef __lock_lint _NOTE(SCHEME_PROTECTS_DATA("unique per packet", - scsi_pkt_cache_wrapper::pcw_orig_comp scsi_pkt_cache_wrapper::pcw_bp scsi_pkt_cache_wrapper::pcw_curwin scsi_pkt_cache_wrapper::pcw_flags |