xref: /illumos-gate/usr/src/man/man9s/scsi_address.9s (revision ca783257c986cddcc674ae22916a6766b98a2d36)
1.\"  Copyright (c) 2000, Sun Microsystems, Inc.,  All Rights Reserved
2.\" Copyright (c) 2017, Joyent, Inc.
3.\" Copyright 2022 Oxide Computer Company
4.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5.\" 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.
6.\" 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]
7.Dd January 29, 2022
8.Dt SCSI_ADDRESS 9S
9.Os
10.Sh NAME
11.Nm scsi_address
12.Nd SCSI address structure
13.Sh SYNOPSIS
14.In sys/scsi/scsi.h
15.Sh INTERFACE LEVEL
16illumos architecture specific (illumos DDI)
17.Sh DESCRIPTION
18A
19.Vt scsi_address
20structure defines the addressing components for a SCSI target device.
21The address of the target device is separated into two components:
22target number and logical unit number.
23The two addressing components are used to uniquely identify any type of
24SCSI device; however, most devices can be addressed with the target
25component of the address.
26.Pp
27In the case where only the target component is used to address the device, the
28logical unit should be set to
29.Sy 0 .
30If the SCSI target device supports logical units, then the HBA must
31interpret the logical units field of the data structure.
32.Pp
33The
34.Fa pkt_address
35member of a
36.Xr scsi_pkt 9S
37is initialized by
38.Xr scsi_init_pkt 9F .
39.Ss Complex Addressing
40HBA drivers may set the flag
41.Dv SCSI_HBA_ADDR_COMPLEX
42in the
43.Fa hba_flags
44argument to
45.Xr scsi_hba_attach_setup 9F .
46When the flag is set, the way this structure is used changes.
47While the
48.Fa a_hba_tran
49member is still accessible for accessing the
50.Xr scsi_hba_tran 9S
51structure, the nature of addressing changes.
52.Pp
53When using complex addressing, a particular device is addressed through a unit
54address which takes the shape of a string.
55When using complex addressing, the target and lun fields are inaccessible and
56instead a device driver can obtain the
57.Xr scsi_device 9S
58structure that this address corresponds to.
59In the complex addressing world, this is generally a direct mapping.
60To obtain this structure, a driver would call the
61.Xr scsi_address_device 9F
62function.
63.Pp
64With the
65.Xr scsi_device 9S
66structure, the device driver can then get to the device-specific private data
67through the
68.Xr scsi_device_hba_private_get 9F
69function.
70.Sh STRUCTURE MEMBERS
71.Bd -literal
72scsi_hba_tran_t   *a_hba_tran;  /* Transport vectors for the SCSI bus */
73ushort_t          a_target;     /* SCSI target id */
74uchar_t           a_lun;        /* SCSI logical unit */
75.Ed
76.Pp
77.Fa a_hba_tran
78is a pointer to the controlling HBA's transport vector structure.
79The SCSA interface uses this field to pass any transport requests from the SCSI
80target device drivers to the HBA driver.
81This member is accessible regardless of whether the device driver uses complex
82addressing or not.
83.Pp
84.Fa a_target
85is the target component of the SCSI address.
86This member is not accessible when the device driver uses complex addressing.
87.Pp
88.Fa a_lun
89is the logical unit component of the SCSI address.
90The logical unit is used to further distinguish a SCSI target device that
91supports multiple logical units from one that does not.
92This member is not accessible when the device driver uses complex addressing.
93.Sh SEE ALSO
94.Xr scsi_address_device 9F ,
95.Xr scsi_device_hba_private_get 9F ,
96.Xr scsi_hba_attach_setup 9F ,
97.Xr scsi_init_pkt 9F ,
98.Xr scsi_device 9S ,
99.Xr scsi_hba_tran 9S ,
100.Xr scsi_pkt 9S
101.Pp
102.Rs
103.%T Writing Device Drivers
104.Re
105