xref: /titanic_50/usr/src/man/man9f/scsi_hba_attach_setup.9f (revision 538aa54d819fa7751ca82bcc30d4ed8c57ec2ef2)
te
Copyright (c) 2006 Sun Microsystems, Inc., All Rights Reserved
Copyright 2014 Garrett D'Amore <garrett@damore.org>
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.
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]
SCSI_HBA_ATTACH_SETUP 9F "May 24, 2014"
NAME
scsi_hba_attach_setup, scsi_hba_detach - SCSI HBA attach and detach routines
SYNOPSIS

#include <sys/scsi/scsi.h>



int scsi_hba_attach_setup(dev_info_t *dip, ddi_dma_attr_t *hba_dma_attr,
 scsi_hba_tran_t *hba_tran, int hba_flags);

int scsi_hba_detach(dev_info_t *dip);
INTERFACE LEVEL

Solaris architecture specific (Solaris DDI).

PARAMETERS
dip

Pointer to the dev_info_t structure that refers to the instance of the HBA device.

hba_tran

Pointer to a scsi_hba_tran(9S) structure.

hba_flags

Flag modifiers. The defined flag values are SCSI_HBA_TRAN_CLONE, SCSI_HBA_TRAN_SCB, and SCSI_HBA_TRAN_CDB.

hba_options

Optional features provided by the HBA driver for future extensions; must be NULL.

hba_dma_attr

Pointer to a ddi_dma_attr(9S) structure.

DESCRIPTION
"scsi_hba_attach_setup(\|)"

The scsi_hba_attach_setup() function registers the hba_dma_attr DMA attributes and the hba_tran transport vectors of each instance of the HBA device defined by dip. The HBA driver can pass different DMA attributes and the transport vectors for each instance of the device to support any constraints imposed by the HBA itself.

The scsi_hba_attach_setup() function uses the dev_bus_ops field in the dev_ops(9S) structure. The HBA driver should initialize this field to NULL before calling scsi_hba_attach_setup().

If SCSI_HBA_TRAN_CLONE is requested in hba_flags, the hba_tran structure is cloned once for each target that is attached to the HBA. The structure is cloned before the tran_tgt_init(9E) entry point is called to initialize a target. At all subsequent HBA entry points, including tran_tgt_init(9E), the scsi_hba_tran_t structure passed as an argument or found in a scsi_address structure is the cloned scsi_hba_tran_t structure,which allows the HBA to use the tran_tgt_private field in the scsi_hba_tran_t structure to point to per-target data. The HBA should free only the same scsi_hba_tran_t structure allocated when the HBA detaches. All cloned scsi_hba_tran_t structures that are allocated by the system are freed by the system.

The flags SCSI_HBA_TRAN_CDB and SCSI_HBA_TRAN_SCB are only valid when tran_setup_pkt() is used. See tran_setup_pkt(9E) for information on using these flags.

The scsi_hba_attach_setup() function attaches a number of integer-valued properties to dip, unless properties of the same name are already attached to the node. An HBA driver should retrieve these configuration parameters via ddi_prop_get_int(9F), and respect any settings for features provided the HBA. scsi-options

Optional SCSI configuration bits

SCSI_OPTIONS_DR

If not set, the HBA should not grant Disconnect privileges to target devices.

SCSI_OPTIONS_TAG

If not set, the HBA should not operate in Command Tagged Queueing mode.

SCSI_OPTIONS_PARITY

If not set, the HBA should not operate in parity mode.

SCSI_OPTIONS_QAS

If not set, the HBA should not make use of the Quick Arbitration Select feature. Consult your Sun hardware documentation to determine whether your machine supports QAS.

SCSI_OPTIONS_FAST

If not set, the HBA should not operate the bus in FAST SCSI mode.

SCSI_OPTIONS_FAST20

If not set, the HBA should not operate the bus in FAST20 SCSI mode.

SCSI_OPTIONS_FAST40

If not set, the HBA should not operate the bus in FAST40 SCSI mode.

SCSI_OPTIONS_FAST80

If not set, the HBA should not operate the bus in FAST80 SCSI mode.

SCSI_OPTIONS_FAST160

If not set, the HBA should not operate the bus in FAST160 SCSI mode.

SCSI_OPTIONS_FAST320

If not set, the HBA should not operate the bus in FAST320 SCSI mode.

SCSI_OPTIONS_WIDE

If not set, the HBA should not operate the bus in WIDE SCSI mode.

SCSI_OPTIONS_SYNC

If not set, the HBA should not operate the bus in synchronous transfer mode.

scsi-reset-delay

SCSI bus or device reset recovery time, in milliseconds.

scsi-selection-timeout

Default SCSI selection phase timeout value, in milliseconds. Please refer to individual HBA man pages for any HBA-specific information

"scsi_hba_detach(\|)"

The scsi_hba_detach() function removes the reference to the DMA attributes structure and the transport vector for the given instance of an HBA driver.

RETURN VALUES

The scsi_hba_attach_setup() and scsi_hba_detach() functions return DDI_SUCCESS if the function call succeeds, and return DDI_FAILURE on failure.

CONTEXT

The scsi_hba_attach_setup() function should be called from attach(9E). The scsi_hba_detach() function should be called from detach(9E).

SEE ALSO

attach(9E), detach(9E), tran_setup_pkt(9E), tran_tgt_init(9E), ddi_prop_get_int(9F), ddi_dma_attr(9S), dev_ops(9S), scsi_address(9S), scsi_hba_tran(9S)

Writing Device Drivers

NOTES

It is the HBA driver's responsibility to ensure that no more transport requests will be taken on behalf of any SCSI target device driver after scsi_hba_detach() is called.