xref: /illumos-gate/usr/src/uts/common/sys/scsi/impl/transport.h (revision 4f364e7c95ee7fd9d5bbeddc1940e92405bb0e72)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_SYS_SCSI_IMPL_TRANSPORT_H
26 #define	_SYS_SCSI_IMPL_TRANSPORT_H
27 
28 /*
29  * Include the loadable module wrapper.
30  */
31 #include <sys/modctl.h>
32 #include <sys/note.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #ifdef	_KERNEL
39 
40 /*
41  * Opaque  handles to address maps
42  */
43 typedef struct __scsi_iportmap	scsi_hba_iportmap_t;
44 typedef struct __scsi_tgtmap	scsi_hba_tgtmap_t;
45 
46 /*
47  * SCSI transport structures
48  *
49  *	As each Host Adapter makes itself known to the system,
50  *	it will create and register with the library the structure
51  *	described below. This is so that the library knows how to route
52  *	packets, resource control requests, and capability requests
53  *	for any particular host adapter. The 'a_hba_tran' field of a
54  *	scsi_address structure made known to a Target driver will
55  *	point to one of these transport structures.
56  */
57 
58 typedef struct scsi_hba_tran	scsi_hba_tran_t;
59 
60 struct scsi_hba_tran {
61 	/*
62 	 * Ptr to the device info structure for this particular HBA. If a SCSA
63 	 * HBA driver separates initiator port function from HBA function,
64 	 * this field still refers to the HBA and is used to manage DMA.
65 	 */
66 	dev_info_t	*tran_hba_dip;
67 
68 	/*
69 	 * Private fields for use by the HBA itself.
70 	 */
71 	void		*tran_hba_private;	/* HBA softstate */
72 
73 	/*
74 	 * The following two fields are only used in the deprecated
75 	 * SCSI_HBA_TRAN_CLONE case. Use SCSI_HBA_ADDR_COMPLEX instead.
76 	 */
77 	void			*tran_tgt_private;
78 	struct scsi_device	*tran_sd;
79 
80 	/*
81 	 * Vectors to point to specific HBA entry points
82 	 */
83 	int		(*tran_tgt_init)(
84 				dev_info_t		*hba_dip,
85 				dev_info_t		*tgt_dip,
86 				scsi_hba_tran_t		*tran,
87 				struct scsi_device	*sd);
88 
89 	int		(*tran_tgt_probe)(
90 				struct scsi_device	*sd,
91 				int			(*callback)(
92 								void));
93 	void		(*tran_tgt_free)(
94 				dev_info_t		*hba_dip,
95 				dev_info_t		*tgt_dip,
96 				scsi_hba_tran_t		*tran,
97 				struct scsi_device	*sd);
98 
99 	int		(*tran_start)(
100 				struct scsi_address	*ap,
101 				struct scsi_pkt		*pkt);
102 
103 	int		(*tran_reset)(
104 				struct scsi_address	*ap,
105 				int			level);
106 
107 	int		(*tran_abort)(
108 				struct scsi_address	*ap,
109 				struct scsi_pkt		*pkt);
110 
111 	int		(*tran_getcap)(
112 				struct scsi_address	*ap,
113 				char			*cap,
114 				int			whom);
115 
116 	int		(*tran_setcap)(
117 				struct scsi_address	*ap,
118 				char			*cap,
119 				int			value,
120 				int			whom);
121 
122 	struct scsi_pkt	*(*tran_init_pkt)(
123 				struct scsi_address	*ap,
124 				struct scsi_pkt		*pkt,
125 				struct buf		*bp,
126 				int			cmdlen,
127 				int			statuslen,
128 				int			tgtlen,
129 				int			flags,
130 				int			(*callback)(
131 								caddr_t	arg),
132 				caddr_t			callback_arg);
133 
134 	void		(*tran_destroy_pkt)(
135 				struct scsi_address	*ap,
136 				struct scsi_pkt		*pkt);
137 
138 	void		(*tran_dmafree)(
139 				struct scsi_address	*ap,
140 				struct scsi_pkt		*pkt);
141 
142 	void		(*tran_sync_pkt)(
143 				struct scsi_address	*ap,
144 				struct scsi_pkt		*pkt);
145 
146 	int		(*tran_reset_notify)(
147 				struct scsi_address	*ap,
148 				int			flag,
149 				void			(*callback)(caddr_t),
150 				caddr_t			arg);
151 
152 	int		(*tran_get_bus_addr)(
153 				struct scsi_device	*sd,
154 				char			*name,
155 				int			len);
156 
157 	int		(*tran_get_name)(
158 				struct scsi_device	*sd,
159 				char			*name,
160 				int			len);
161 
162 	int		(*tran_clear_aca)(
163 				struct scsi_address	*ap);
164 
165 	int		(*tran_clear_task_set)(
166 				struct scsi_address	*ap);
167 
168 	int		(*tran_terminate_task)(
169 				struct scsi_address	*ap,
170 				struct scsi_pkt		*pkt);
171 
172 	int		(*tran_get_eventcookie)(
173 				dev_info_t		*hba_dip,
174 				dev_info_t		*tgt_dip,
175 				char			*name,
176 				ddi_eventcookie_t	*eventp);
177 
178 	int		(*tran_add_eventcall)(
179 				dev_info_t		*hba_dip,
180 				dev_info_t		*tgt_dip,
181 				ddi_eventcookie_t	event,
182 				void			(*callback)(
183 						dev_info_t *tgt_dip,
184 						ddi_eventcookie_t event,
185 						void *arg,
186 						void *bus_impldata),
187 				void			*arg,
188 				ddi_callback_id_t *cb_id);
189 
190 	int		(*tran_remove_eventcall)(dev_info_t *devi,
191 			ddi_callback_id_t cb_id);
192 
193 	int		(*tran_post_event)(
194 				dev_info_t		*hba_dip,
195 				dev_info_t		*tgt_dip,
196 				ddi_eventcookie_t	event,
197 				void			*bus_impldata);
198 
199 	int		(*tran_quiesce)(
200 				dev_info_t		*hba_dip);
201 
202 	int		(*tran_unquiesce)(
203 				dev_info_t		*hba_dip);
204 
205 	int		(*tran_bus_reset)(
206 				dev_info_t		*hba_dip,
207 				int			level);
208 
209 	/*
210 	 * Implementation-private specifics.
211 	 * No HBA should refer to any of the fields below.
212 	 * This information can and will change.
213 	 */
214 	int			tran_hba_flags;		/* flag options */
215 
216 	uint_t			tran_obs1;
217 	uchar_t			tran_obs2;
218 	uchar_t			tran_obs3;
219 
220 	/*
221 	 * open_lock: protect tran_minor_isopen
222 	 * open_flag: bit field indicating which minor nodes are open.
223 	 *	0 = closed, 1 = shared open, all bits 1 = excl open.
224 	 *
225 	 * NOTE: Unused if HBA driver implements its own open(9e) entry point.
226 	 */
227 	kmutex_t		tran_open_lock;
228 	uint64_t		tran_open_flag;
229 
230 	/*
231 	 * bus_config vectors - ON Consolidation Private
232 	 * These interfaces are subject to change.
233 	 */
234 	int		(*tran_bus_config)(
235 				dev_info_t		*hba_dip,
236 				uint_t			flag,
237 				ddi_bus_config_op_t	op,
238 				void			*arg,
239 				dev_info_t		**tgt_dipp);
240 
241 	int		(*tran_bus_unconfig)(
242 				dev_info_t		*hba_dip,
243 				uint_t			flag,
244 				ddi_bus_config_op_t	op,
245 				void			*arg);
246 
247 	int		(*tran_bus_power)(
248 				dev_info_t		*dip,
249 				void			*impl_arg,
250 				pm_bus_power_op_t	op,
251 				void			*arg,
252 				void			*result);
253 
254 	/*
255 	 * Inter-Connect type of transport as defined in
256 	 * usr/src/uts/common/sys/scsi/impl/services.h
257 	 */
258 	int		tran_interconnect_type;
259 
260 	/* tran_setup_pkt(9E) related scsi_pkt fields */
261 	int		(*tran_pkt_constructor)(
262 				struct scsi_pkt		*pkt,
263 				scsi_hba_tran_t		*tran,
264 				int			kmflag);
265 	void		(*tran_pkt_destructor)(
266 				struct scsi_pkt		*pkt,
267 				scsi_hba_tran_t		*tran);
268 	kmem_cache_t	*tran_pkt_cache_ptr;
269 	uint_t		tran_hba_len;
270 	int		(*tran_setup_pkt)(
271 				struct scsi_pkt		*pkt,
272 				int			(*callback)(
273 								caddr_t	arg),
274 				caddr_t			callback_arg);
275 	void		(*tran_teardown_pkt)(
276 				struct scsi_pkt		*pkt);
277 	ddi_dma_attr_t	tran_dma_attr;
278 
279 	void		*tran_extension;
280 
281 	/*
282 	 * An fm_capable HBA driver can set tran_fm_capable prior to
283 	 * scsi_hba_attach_setup(). If not set, SCSA provides a default
284 	 * implementation.
285 	 */
286 	int		tran_fm_capable;
287 
288 	/*
289 	 * Ptr to the device info structure for initiator port. If a SCSA HBA
290 	 * driver separates initiator port function from HBA function, this
291 	 * field still refers to the initiator port.
292 	 */
293 	dev_info_t	*tran_iport_dip;
294 
295 	/*
296 	 * map of initiator ports below HBA
297 	 */
298 	scsi_hba_iportmap_t	*tran_iportmap;
299 
300 	/*
301 	 * map of targets below initiator
302 	 */
303 	scsi_hba_tgtmap_t	*tran_tgtmap;
304 
305 #ifdef	SCSI_SIZE_CLEAN_VERIFY
306 	/*
307 	 * Must be last: Building a driver with-and-without
308 	 * -DSCSI_SIZE_CLEAN_VERIFY, and checking driver modules for
309 	 * differences with a tools like 'wsdiff' allows a developer to verify
310 	 * that their driver has no dependencies on scsi*(9S) size.
311 	 */
312 	int		_pad[8];
313 #endif	/* SCSI_SIZE_CLEAN_VERIFY */
314 };
315 size_t	scsi_hba_tran_size();			/* private */
316 
317 #ifdef __lock_lint
318 _NOTE(SCHEME_PROTECTS_DATA("stable data",
319 	scsi_hba_tran::tran_sd
320 	scsi_hba_tran::tran_hba_dip
321 	scsi_hba_tran::tran_hba_flags
322 	scsi_hba_tran::tran_open_flag
323 	scsi_hba_tran::tran_pkt_cache_ptr))
324 /*
325  * we only modify the dma attributes (like dma_attr_granular) upon
326  * attach and in response to a setcap. It is also up to the target
327  * driver to not have any outstanding I/Os when it is changing the
328  * capabilities of the transport.
329  */
330 _NOTE(SCHEME_PROTECTS_DATA("serialized by target driver", \
331 	scsi_hba_tran::tran_dma_attr.dma_attr_granular))
332 #endif
333 
334 /*
335  * Prototypes for SCSI HBA interface functions
336  *
337  * All these functions are public interfaces, with the
338  * exception of:
339  *	interface				called by
340  *	scsi_initialize_hba_interface()		_init() of scsi module
341  *	scsi_uninitialize_hba_interface()	_fini() of scsi module
342  */
343 
344 void		scsi_initialize_hba_interface(void);
345 
346 #ifdef	NO_SCSI_FINI_YET
347 void		scsi_uninitialize_hba_interface(void);
348 #endif	/* NO_SCSI_FINI_YET */
349 
350 int		scsi_hba_init(
351 				struct modlinkage	*modlp);
352 
353 void		scsi_hba_fini(
354 				struct modlinkage	*modlp);
355 
356 int		scsi_hba_attach(
357 				dev_info_t		*hba_dip,
358 				ddi_dma_lim_t		*hba_lim,
359 				scsi_hba_tran_t		*tran,
360 				int			flags,
361 				void			*hba_options);
362 
363 int		scsi_hba_attach_setup(
364 				dev_info_t		*hba_dip,
365 				ddi_dma_attr_t		*hba_dma_attr,
366 				scsi_hba_tran_t		*tran,
367 				int			flags);
368 
369 int		scsi_hba_detach(
370 				dev_info_t		*hba_dip);
371 
372 scsi_hba_tran_t	*scsi_hba_tran_alloc(
373 				dev_info_t		*hba_dip,
374 				int			flags);
375 
376 int		scsi_tran_ext_alloc(
377 				scsi_hba_tran_t		*tran,
378 				size_t			length,
379 				int			flags);
380 
381 void		scsi_tran_ext_free(
382 				scsi_hba_tran_t		*tran,
383 				size_t			length);
384 
385 void		scsi_hba_tran_free(
386 				scsi_hba_tran_t		*tran);
387 
388 int		scsi_hba_probe(
389 				struct scsi_device	*sd,
390 				int			(*callback)(void));
391 
392 int		scsi_hba_probe_pi(
393 				struct scsi_device	*sd,
394 				int			(*callback)(void),
395 				int			pi);
396 
397 int		scsi_hba_ua_get_reportdev(
398 				struct scsi_device	*sd,
399 				char			*ba,
400 				int			len);
401 
402 int		scsi_hba_ua_get(
403 				struct scsi_device	*sd,
404 				char			*ua,
405 				int			len);
406 
407 char		*scsi_get_device_type_string(
408 				char			*prop_name,
409 				dev_info_t		*hba_dip,
410 				struct scsi_device	*sd);
411 
412 int		scsi_get_scsi_maxluns(
413 				struct scsi_device	*sd);
414 
415 int		scsi_get_scsi_options(
416 				struct scsi_device	*sd,
417 				int			default_scsi_options);
418 
419 int		scsi_get_device_type_scsi_options(
420 				dev_info_t		*hba_dip,
421 				struct scsi_device	*sd,
422 				int			default_scsi_options);
423 
424 struct scsi_pkt	*scsi_hba_pkt_alloc(
425 				dev_info_t		*hba_dip,
426 				struct scsi_address	*ap,
427 				int			cmdlen,
428 				int			statuslen,
429 				int			tgtlen,
430 				int			hbalen,
431 				int			(*callback)(caddr_t),
432 				caddr_t			arg);
433 
434 void		scsi_hba_pkt_free(
435 				struct scsi_address	*ap,
436 				struct scsi_pkt		*pkt);
437 
438 
439 int		scsi_hba_lookup_capstr(
440 				char			*capstr);
441 
442 int		scsi_hba_in_panic(void);
443 
444 int		scsi_hba_open(
445 				dev_t			*devp,
446 				int			flags,
447 				int			otyp,
448 				cred_t			*credp);
449 
450 int		scsi_hba_close(
451 				dev_t			dev,
452 				int			flag,
453 				int			otyp,
454 				cred_t			*credp);
455 
456 int		scsi_hba_ioctl(
457 				dev_t			dev,
458 				int			cmd,
459 				intptr_t		arg,
460 				int			mode,
461 				cred_t			*credp,
462 				int			*rvalp);
463 
464 void		scsi_hba_nodename_compatible_get(
465 				struct scsi_inquiry	*inq,
466 				char			*binding_set,
467 				int			dtype_node,
468 				char			*compat0,
469 				char			**nodenamep,
470 				char			***compatiblep,
471 				int			*ncompatiblep);
472 
473 void		scsi_hba_nodename_compatible_free(
474 				char			*nodename,
475 				char			**compatible);
476 
477 int		scsi_device_prop_update_inqstring(
478 				struct scsi_device	*sd,
479 				char			*name,
480 				char			*data,
481 				size_t			len);
482 
483 void		scsi_hba_pkt_comp(
484 				struct scsi_pkt		*pkt);
485 
486 int		scsi_device_identity(
487 				struct scsi_device	*sd,
488 				int			(*callback)(void));
489 
490 char		*scsi_hba_iport_unit_address(
491 				dev_info_t		*dip);
492 
493 int		scsi_hba_iport_register(
494 				dev_info_t		*dip,
495 				char			*port);
496 
497 int		scsi_hba_iport_exist(
498 				dev_info_t		*dip);
499 
500 dev_info_t	*scsi_hba_iport_find(
501 				dev_info_t		*pdip,
502 				char			*portnm);
503 
504 
505 /*
506  * Flags for scsi_hba_attach
507  *
508  * SCSI_HBA_ADDR_SPI		The host adapter driver wants the
509  *				scsi_address(9S) structure to be maintained
510  *				in legacy SPI 'a_target'/'a_lun' form (default).
511  *
512  * SCSI_HBA_ADDR_COMPLEX	The host adapter has a complex unit-address
513  *				space, and the HBA driver wants to maintain
514  *				per-scsi_device(9S) HBA private data using
515  *				scsi_address_device(9F) and
516  *				scsi_device_hba_private_[gs]et(9F).  The HBA
517  *				driver must maintain a private representation
518  *				of the scsi_device(9S) unit-address - typically
519  *				established during tran_tgt_init(9F) based on
520  *				property values.
521  *
522  * SCSI_HBA_TRAN_PHCI		The host adapter is an mpxio/scsi_vhci pHCI.
523  *				The framework should take care of
524  *				mdi_phci_register() stuff.
525  *
526  * SCSI_HBA_HBA			The host adapter node (associated with a PCI
527  *				function) is just an HBA, all SCSI initiator
528  *				port function is provided by separate 'iport'
529  *				children of the host adapter node.  These iport
530  *				children bind to the same driver as the host
531  *				adapter node. Both nodes are managed by the
532  *				same driver. The driver can distinguish context
533  *				by calling scsi_hba_iport_unit_address().
534  *
535  * ::SCSI_HBA_TRAN_CLONE	Deprecated: use SCSI_HBA_ADDR_COMPLEX instead.
536  *				SCSI_HBA_TRAN_CLONE was a KLUDGE to address
537  *				limitations of the scsi_address(9S) structure
538  *				via duplication of scsi_hba_tran(9S) and
539  *				use of tran_tgt_private.
540  *
541  */
542 #define	SCSI_HBA_TRAN_CLONE	0x01	/* Deprecated */
543 #define	SCSI_HBA_TRAN_PHCI	0x02	/* treat HBA as mpxio 'pHCI' */
544 #define	SCSI_HBA_TRAN_CDB	0x04	/* allocate cdb */
545 #define	SCSI_HBA_TRAN_SCB	0x08	/* allocate sense */
546 #define	SCSI_HBA_HBA		0x10	/* all HBA children are iports */
547 
548 #define	SCSI_HBA_ADDR_SPI	0x20	/* scsi_address in SPI form */
549 #define	SCSI_HBA_ADDR_COMPLEX	0x40	/* scsi_address is COMPLEX */
550 
551 /* upper bits used to record SCSA configuration state */
552 #define	SCSI_HBA_SCSA_PHCI	0x10000	/* need mdi_phci_unregister */
553 #define	SCSI_HBA_SCSA_TA	0x20000	/* scsi_hba_tran_alloc used */
554 #define	SCSI_HBA_SCSA_FM	0x40000	/* using common ddi_fm_* */
555 
556 /*
557  * Flags for scsi_hba allocation functions
558  */
559 #define	SCSI_HBA_CANSLEEP	0x01		/* can sleep */
560 
561 /*
562  * Support extra flavors for SCSA children
563  */
564 #define	SCSA_FLAVOR_SCSI_DEVICE	NDI_FLAVOR_VANILLA
565 #define	SCSA_FLAVOR_SMP		1
566 #define	SCSA_FLAVOR_IPORT	2
567 #define	SCSA_NFLAVORS		3
568 
569 /*
570  * Maximum number of iport nodes under PCI function
571  */
572 #define	SCSI_HBA_MAX_IPORTS	32
573 
574 /*
575  * SCSI iport map interfaces
576  */
577 int	scsi_hba_iportmap_create(
578 				dev_info_t		*hba_dip,
579 				int			csync_usec,
580 				int			stable_usec,
581 				scsi_hba_iportmap_t	**iportmapp);
582 
583 int	scsi_hba_iportmap_iport_add(
584 				scsi_hba_iportmap_t	*iportmap,
585 				char			*iport_addr,
586 				void			*iport_priv);
587 
588 int	scsi_hba_iportmap_iport_remove(
589 				scsi_hba_iportmap_t	*iportmap,
590 				char			*iport_addr);
591 
592 void	scsi_hba_iportmap_destroy(scsi_hba_iportmap_t	*iportmap);
593 
594 /*
595  * SCSI target map interfaces
596  */
597 typedef enum {
598 	SCSI_TM_FULLSET = 0,
599 	SCSI_TM_PERADDR
600 } scsi_tgtmap_mode_t;
601 
602 typedef enum {
603 	SCSI_TGT_SCSI_DEVICE = 0,
604 	SCSI_TGT_SMP_DEVICE,
605 	SCSI_TGT_NTYPES
606 } scsi_tgtmap_tgt_type_t;
607 
608 typedef enum {
609 	SCSI_TGT_DEACT_RSN_GONE = 0,
610 	SCSI_TGT_DEACT_RSN_CFG_FAIL,
611 	SCSI_TGT_DEACT_RSN_UNSTBL
612 } scsi_tgtmap_deact_rsn_t;
613 
614 typedef void	(*scsi_tgt_activate_cb_t)(
615 				void			*tgtmap_priv,
616 				char			*tgt_addr,
617 				scsi_tgtmap_tgt_type_t	tgt_type,
618 				void			**tgt_privp);
619 typedef boolean_t	(*scsi_tgt_deactivate_cb_t)(
620 				void			*tgtmap_priv,
621 				char			*tgt_addr,
622 				scsi_tgtmap_tgt_type_t	tgt_type,
623 				void			*tgt_priv,
624 				scsi_tgtmap_deact_rsn_t tgt_deact_rsn);
625 int	scsi_hba_tgtmap_create(
626 				dev_info_t		*iport_dip,
627 				scsi_tgtmap_mode_t	rpt_mode,
628 				int			csync_usec,
629 				int			stable_usec,
630 				void			*tgtmap_priv,
631 				scsi_tgt_activate_cb_t	activate_cb,
632 				scsi_tgt_deactivate_cb_t deactivate_cb,
633 				scsi_hba_tgtmap_t	**tgtmapp);
634 
635 int	scsi_hba_tgtmap_set_begin(scsi_hba_tgtmap_t	*tgtmap);
636 
637 int	scsi_hba_tgtmap_set_add(
638 				scsi_hba_tgtmap_t	*tgtmap,
639 				scsi_tgtmap_tgt_type_t	tgt_type,
640 				char			*tgt_addr,
641 				void			*tgt_priv);
642 
643 int	scsi_hba_tgtmap_set_end(
644 				scsi_hba_tgtmap_t	*tgtmap,
645 				uint_t			flags);
646 
647 int	scsi_hba_tgtmap_set_flush(scsi_hba_tgtmap_t	*tgtmap);
648 
649 int	scsi_hba_tgtmap_tgt_add(
650 				scsi_hba_tgtmap_t	*tgtmap,
651 				scsi_tgtmap_tgt_type_t	tgt_type,
652 				char			*tgt_addr,
653 				void			*tgt_priv);
654 
655 int	scsi_hba_tgtmap_tgt_remove(
656 				scsi_hba_tgtmap_t	*tgtmap,
657 				scsi_tgtmap_tgt_type_t	tgt_type,
658 				char			*tgt_addr);
659 
660 void	scsi_hba_tgtmap_destroy(scsi_hba_tgtmap_t	*tgt_map);
661 
662 
663 /*
664  * For minor nodes created by the SCSA framework, minor numbers are
665  * formed by left-shifting instance by INST_MINOR_SHIFT and OR in a
666  * number less than 64.
667  *
668  * - Numbers 0 - 31 are reserved by the framework, part of the range are
669  *	in use, as defined below.
670  *
671  * - Numbers 32 - 63 are available for HBA driver use.
672  */
673 #define	INST_MINOR_SHIFT	6
674 #define	TRAN_MINOR_MASK		((1 << INST_MINOR_SHIFT) - 1)
675 #define	TRAN_OPEN_EXCL		(uint64_t)-1
676 
677 #define	DEVCTL_MINOR		0
678 #define	SCSI_MINOR		1
679 
680 #define	INST2DEVCTL(x)		(((x) << INST_MINOR_SHIFT) | DEVCTL_MINOR)
681 #define	INST2SCSI(x)		(((x) << INST_MINOR_SHIFT) | SCSI_MINOR)
682 #define	MINOR2INST(x)		((x) >> INST_MINOR_SHIFT)
683 
684 #define	SCSI_HBA_PROP_RECEPTACLE_LABEL	"receptacle-label"
685 
686 #endif	/* _KERNEL */
687 
688 #ifdef	__cplusplus
689 }
690 #endif
691 
692 #endif	/* _SYS_SCSI_IMPL_TRANSPORT_H */
693