scsi_transport.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996-1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Main Transport Routine for SCSA
*/
#ifdef DEBUG
#define SCSI_POLL_STAT
#endif
#ifdef SCSI_POLL_STAT
int scsi_poll_user;
int scsi_poll_intr;
#endif
extern kmutex_t scsi_flag_nointr_mutex;
extern kcondvar_t scsi_flag_nointr_cv;
/*
* we used to set the callback_done value to NULL after the callback
* to NULL to prevent callbacks during error recovery
* to prevent confusion, create a truly unique value
*/
static int scsi_callback_done;
static void
{
/*
* We need cv_broadcast, because there can be more
* than one thread sleeping on the cv. We
* will wake all of them. The correct one will
* continue and the rest will again go to sleep.
*/
}
/*
* 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,
* we can avoid busy waiting in HBA by replacing the callback
* function with our own function and resetting FLAG_NOINTR. We
* can't do this in interrupt context because cv_wait will
* sleep with CPU priority raised high and in case of some failure,
* the CPU will be stuck in high priority.
*/
int
{
extern int do_polled_io;
int rval = TRAN_ACCEPT;
/*
* Check if we are required to do polled I/O. We can
* get scsi_pkts that don't have the FLAG_NOINTR bit
* set in the pkt_flags. When do_polled_io is set
* we will probably be at a high IPL and not get any
* for such packets and do a callback of the completion
* routine ourselves.
*/
#ifdef SCSI_POLL_STAT
#endif
/*
* If its an interrupt thread or we already have the
* the FLAG_NOINTR flag set, we go ahead and call the
* the hba's start routine directly. We force polling
* only if we have do_polled_io set and FLAG_NOINTR
* not set.
*/
} else {
void (*savec)();
/*
* save the completion routine and pkt_flags
*/
/* only continue of transport accepted request */
if (rval == TRAN_ACCEPT) {
/*
* Restore the pkt_completion routine
* and pkt flags and call the completion
* routine.
*/
}
return (rval);
}
/*
* rval was not TRAN_ACCEPT -- don't want command
* to be retried
*/
return (TRAN_FATAL_ERROR);
}
} else {
void (*savec)();
int status;
#ifdef SCSI_POLL_STAT
#endif
TRAN_ACCEPT) {
}
}
return (status);
}
}