SCSI_ADDRESS(9S) Data Structures for Drivers SCSI_ADDRESS(9S)

scsi_addressSCSI address structure

#include <sys/scsi/scsi.h>

illumos architecture specific (illumos DDI)

A scsi_address structure defines the addressing components for a SCSI target device. The address of the target device is separated into two components: target number and logical unit number. The two addressing components are used to uniquely identify any type of SCSI device; however, most devices can be addressed with the target component of the address.

In the case where only the target component is used to address the device, the logical unit should be set to . If the SCSI target device supports logical units, then the HBA must interpret the logical units field of the data structure.

The pkt_address member of a scsi_pkt(9S) is initialized by scsi_init_pkt(9F).

HBA drivers may set the flag SCSI_HBA_ADDR_COMPLEX in the hba_flags argument to scsi_hba_attach_setup(9F). When the flag is set, the way this structure is used changes. While the a_hba_tran member is still accessible for accessing the scsi_hba_tran(9S) structure, the nature of addressing changes.

When using complex addressing, a particular device is addressed through a unit address which takes the shape of a string. When using complex addressing, the target and lun fields are inaccessible and instead a device driver can obtain the scsi_device(9S) structure that this address corresponds to. In the complex addressing world, this is generally a direct mapping. To obtain this structure, a driver would call the scsi_address_device(9F) function.

With the scsi_device(9S) structure, the device driver can then get to the device-specific private data through the scsi_device_hba_private_get(9F) function.

scsi_hba_tran_t   *a_hba_tran;  /* Transport vectors for the SCSI bus */
ushort_t          a_target;     /* SCSI target id */
uchar_t           a_lun;        /* SCSI logical unit */

a_hba_tran is a pointer to the controlling HBA's transport vector structure. The SCSA interface uses this field to pass any transport requests from the SCSI target device drivers to the HBA driver. This member is accessible regardless of whether the device driver uses complex addressing or not.

a_target is the target component of the SCSI address. This member is not accessible when the device driver uses complex addressing.

a_lun is the logical unit component of the SCSI address. The logical unit is used to further distinguish a SCSI target device that supports multiple logical units from one that does not. This member is not accessible when the device driver uses complex addressing.

scsi_address_device(9F), scsi_device_hba_private_get(9F), scsi_hba_attach_setup(9F), scsi_init_pkt(9F), scsi_device(9S), scsi_hba_tran(9S), scsi_pkt(9S)

Writing Device Drivers.

January 29, 2022 OmniOS