xref: /illumos-gate/usr/src/uts/common/sys/scsi/scsi_address.h (revision 4fce32e15d9c284a06aea2e40852f6674f03b63e)
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_ADDRESS_H
28 #define	_SYS_SCSI_SCSI_ADDRESS_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 address definition.
40  *
41  * A scsi_address structure stores the host routing and device unit-address
42  * information necessary to reference a specific SCSI target device logical
43  * unit function.
44  *
45  * The host routing information is stored in the scsi_hba_tran(9S) structure
46  * pointed to by the a_hba_tran field.
47  *
48  * The device unit-address information is SCSA's representation of the
49  * "@unit-address" portion of a SCSI target driver device node in the
50  * /devices tree.  Separate components of the device unit-address information
51  * define the target address and the logical unit address of a target.
52  * In general, device unit-address information is used exclusively by the
53  * host adapter driver (the exception being target drivers communicating
54  * with SCSI Parallel Interconnect (SPI) SCSI-1 devices that embed SCSI
55  * logical unit addressing in the CDB).
56  *
57  * Thus the a_target and a_lun fields are for compatibility purposes only.
58  * They are not defined in SCSI-3.  SCSI-3 target drivers which need to
59  * communicate with SPI SCSI-1 devices that embed logical unit addresses in
60  * the CDB should obtain target and logical unit addresses from the device's
61  * properties (SCSI_ADDR_PROP_TARGET and SCSI_ADDR_PROP_LUN).
62  *
63  * a_sublun is reserved for internal use only and is never part of DDI
64  * (scsi_address(9S)).
65  */
66 struct scsi_address {
67 	struct scsi_hba_tran	*a_hba_tran;	/* Transport vectors */
68 	ushort_t		a_target;	/* Target identifier */
69 	uchar_t			a_lun;		/* Lun on that Target */
70 	uchar_t			a_sublun;	/* Sublun on that Lun */
71 						/* Not used */
72 };
73 
74 /* Address property names */
75 #define	SCSI_ADDR_PROP_TARGET		"target"
76 #define	SCSI_ADDR_PROP_LUN		"lun"
77 
78 #ifdef	__cplusplus
79 }
80 #endif
81 
82 #endif	/* _SYS_SCSI_SCSI_ADDRESS_H */
83