summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun/sys/dada/impl/transport.h
blob: 581cf0acc29a1410e872ff96a0ba7e1c932ef031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/*
 * 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
 * or http://www.opensolaris.org/os/licensing.
 * 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, by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_SYS_DADA_IMPL_TRANSPORT_H
#define	_SYS_DADA_IMPL_TRANSPORT_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 * Include loadable module wrapper.
 */
#include <sys/modctl.h>

#ifdef	__cplusplus
extern "C" {
#endif

#ifdef _KERNEL
/*
 * DCD transport structure
 *	As each host adapter makes itself known to the system,
 * 	It will create and register with the library the structure
 * 	describe below. This is so that the library knows how to route
 *	packets, resource control requests, and capability requests
 * 	for any  particular host adapter. The 'a_hba_tran' field of a
 *	dcd_address structure made known to a target driver will point to
 *	one of these transport structures.
 */

typedef	struct dcd_hba_tran	dcd_hba_tran_t;

struct dcd_hba_tran {
	uint_t		version;
	/*
	 * Ptr to the device info structure for thsi particular HBA
	 */
	dev_info_t	*tran_hba_dip;

	/*
	 * Private fields for use by the HBA itself
	 */
	void		*tran_hba_private; /* HBA Softstate */
	void		*tran_tgt_private; /* Target specific info */

	/*
	 * Only used to refer to a particular dcd device
	 * if the entire dcd_hba_tran_structure is cloned
	 * per target device, otherwise NULL.
	 */

	struct	dcd_device	*tran_sd;

	/*
	 * vectors to point to specific HBA entry points.
	 */
	int 		(*tran_tgt_init)(
				dev_info_t	*hba_dip,
				dev_info_t	*tgt_dip,
				dcd_hba_tran_t	*hba_tran,
				struct	dcd_device	*dcd);

	int		(*tran_tgt_probe)(
				struct dcd_device	*dcd,
				int		(*callback)(void));
	int		(*tran_tgt_free)(
				dev_info_t	*hba_dip,
				dev_info_t	*tgt_dip,
				dcd_hba_tran_t	*hba_tran,
				struct	dcd_device	*dcd);

	int		(*tran_start)(
				struct	dcd_address *ap,
				struct	dcd_pkt	*pkt);

	int		(*tran_reset)(
				struct dcd_address *ap,
				int		level);

	int		(*tran_abort)(
				struct	dcd_address *ap,
				struct  dcd_pkt	 *pkt);

	struct dcd_pkt *(*tran_init_pkt)(
				struct dcd_address	*ap,
				struct	dcd_pkt		*pkt,
				struct	buf		*bp,
				int			cmdlen,
				int			statuslen,
				int			tgtlen,
				int			flags,
				int			(*callback)(
							caddr_t arg),
				caddr_t			callback_arg);

	void		(*tran_destroy_pkt)(
				struct dcd_address *ap,
				struct	dcd_pkt		*pkt);

	void		(*tran_dmafree)(
				struct dcd_address	*ap,
				struct	dcd_pkt		*pkt);
	void		(*tran_sync_pkt)(
				struct dcd_address	*ap,
				struct dcd_pkt		*pkt);


	/*
	 * Implementation private specifics.
	 */
	int		tran_hba_flags;		/* flag option */

	/*
	 * min xfer and min/max burst sizes for DDI_CTLOPS_IOMIN
	 */
	uint_t		tran_min_xfer;
	uchar_t		tran_min_burst_size;
	uchar_t		tran_max_burst_size;
};


/*
 * Prototypes for DCD HBA interface function.
 */

extern void	dcd_initialize_hba_interface(void);

#ifdef	NO_DADA_FINI_YET
extern	void	dcd_uninitialize_hba_interface(void);
#endif

extern	int	dcd_hba_init(struct modlinkage	*modlp);

extern	void	dcd_hab_fini(struct modlinkage	*modlp);

#ifdef NOTNEEDED
extern	int	dcd_hba_attach(
			dev_info_t	*dip,
			ddi_dma_lim_t	*hba_lim,
			dcd_hba_tran_t	*hba_tran,
			int		flags,
			void		*hba_options);
#endif

extern int	dcd_hba_attach(
			dev_info_t	*dip,
			ddi_dma_attr_t	*hba_dma_attr,
			dcd_hba_tran_t	*hba_tran,
			int		flags);

extern int	dcd_hba_detach(
			dev_info_t	*dip);

extern	dcd_hba_tran_t	*dcd_hba_tran_alloc(
			dev_info_t	*dip,
			int		flags);

extern	void	dcd_hba_tran_free(
			dcd_hba_tran_t	*hba_tran);

extern int	dcd_hba_probe(
			struct	dcd_device  *dcd,
			int	(*callback)(void));

extern	struct	dcd_pkt	*dcd_hba_pkt_alloc(
			struct	dcd_address	*ap,
			int		cmdlen,
			int		statuslen,
			int		tgtlen,
			int		hbalen,
			int 		(*callback)(caddr_t),
			caddr_t		arg);

extern	void 	dcd_hba_pkt_free(
		struct dcd_address 	*ap,
		struct dcd_pkt		*pkt);

extern	int	dcd_hba_lookup_capstr(
			char	*capstr);
extern	int	dcd_hba_in_panic(void);

/*
 * Flags for dcd_hba_attach
 */
#define	 DCD_HBA_TRAN_CLONE	0x01

/*
 * Flags for scsi_hab alloaction functions
 */
#define	DCD_HBA_CANSLEEP 0x01

#endif	/* _KERNEL */

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_DADA_IMPL_TRANSPORT_H */