xref: /titanic_51/usr/src/uts/common/sys/scsi/scsi_resource.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 (c) 1996, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_SCSI_SCSI_RESOURCE_H
28 #define	_SYS_SCSI_SCSI_RESOURCE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/scsi/scsi_types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * SCSI Resource Function Declaratoins
40  */
41 
42 /*
43  * Defines for stating preferences in resource allocation
44  */
45 
46 #define	NULL_FUNC	((int (*)())0)
47 #define	SLEEP_FUNC	((int (*)())1)
48 
49 #ifdef	_KERNEL
50 /*
51  * Defines for the flags to scsi_init_pkt()
52  */
53 #define	PKT_CONSISTENT	0x0001		/* this is an 'iopb' packet */
54 #define	PKT_DMA_PARTIAL	0x040000	/* partial xfer ok */
55 
56 /*
57  * Old PKT_CONSISTENT value for binary compatibility with x86 2.1
58  */
59 #define	PKT_CONSISTENT_OLD	0x001000
60 
61 /*
62  * Kernel function declarations
63  */
64 
65 #ifdef	__STDC__
66 
67 extern struct buf *scsi_alloc_consistent_buf(struct scsi_address *,
68     struct buf *, size_t, uint_t, int (*)(caddr_t), caddr_t);
69 
70 extern struct scsi_pkt *scsi_init_pkt(struct scsi_address *,
71     struct scsi_pkt *, struct buf *, int, int, int, int,
72     int (*)(caddr_t), caddr_t);
73 
74 extern void scsi_destroy_pkt(struct scsi_pkt *);
75 
76 extern void scsi_free_consistent_buf(struct buf *);
77 
78 extern struct scsi_pkt *scsi_resalloc(struct scsi_address *, int,
79     int, opaque_t, int (*)());
80 
81 extern struct scsi_pkt *scsi_pktalloc(struct scsi_address *, int, int,
82     int (*)());
83 
84 extern struct scsi_pkt *scsi_dmaget(struct scsi_pkt *,
85     opaque_t, int (*)());
86 
87 extern void scsi_dmafree(struct scsi_pkt *);
88 
89 extern void scsi_sync_pkt(struct scsi_pkt *);
90 
91 extern void scsi_resfree(struct scsi_pkt *);
92 
93 #else	/* __STDC__ */
94 extern struct scsi_pkt	*scsi_init_pkt();
95 extern void 		scsi_destroy_pkt();
96 extern struct buf 	*scsi_alloc_consistent_buf();
97 extern void		scsi_free_consistent_buf();
98 extern struct scsi_pkt *scsi_resalloc();
99 extern struct scsi_pkt *scsi_pktalloc();
100 extern struct scsi_pkt *scsi_dmaget();
101 extern void		scsi_resfree();
102 extern void		scsi_dmafree();
103 extern void		scsi_sync_pkt();
104 #endif	/* __STDC__ */
105 
106 /*
107  * Preliminary version of the SCSA specification
108  * mentioned a routine called scsi_pktfree, which
109  * turned out to be semantically equivialent to
110  * scsi_resfree.
111  */
112 
113 #define	scsi_pktfree	scsi_resfree
114 
115 #endif	/* _KERNEL */
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _SYS_SCSI_SCSI_RESOURCE_H */
122