1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_SCSI_SCSI_WATCH_H
28 #define	_SYS_SCSI_SCSI_WATCH_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 struct scsi_watch_result {
37 	struct scsi_status		*statusp;
38 	struct scsi_extended_sense	*sensep;
39 	uchar_t				actual_sense_length;
40 	struct scsi_pkt			*pkt;
41 };
42 
43 /*
44  * 120 seconds is a *very* reasonable amount of time for most slow devices
45  */
46 #define	SCSI_WATCH_IO_TIME	120
47 
48 /*
49  * values to pass in "flags" arg for scsi_watch_request_terminate()
50  */
51 #define	SCSI_WATCH_TERMINATE_WAIT	0x0
52 #define	SCSI_WATCH_TERMINATE_NOWAIT	0x1
53 
54 #define	SCSI_WATCH_TERMINATE_SUCCESS	0x0
55 #define	SCSI_WATCH_TERMINATE_FAIL	0x1
56 
57 void	scsi_watch_init();
58 void	scsi_watch_fini();
59 opaque_t scsi_watch_request_submit(struct scsi_device *devp,
60 	    int interval, int sense_length,
61 	    int (*callback)(), caddr_t cb_arg);
62 int	scsi_watch_request_terminate(opaque_t token, int flags);
63 void	scsi_watch_resume(opaque_t token);
64 void	scsi_watch_suspend(opaque_t token);
65 
66 #ifdef	__cplusplus
67 }
68 #endif
69 
70 #endif	/* _SYS_SCSI_SCSI_WATCH_H */
71