xref: /titanic_44/usr/src/uts/common/sys/scsi/conf/device.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
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 /*
28  * SCSI device structure.
29  *
30  *	All SCSI target drivers will have one of these per target/lun/sfunc.
31  *	It will be allocated and initialized by the SCSA HBA nexus code
32  *	for each SCSI target dev_info_t node and stored as driver private data
33  *	in that target device's dev_info_t (and thus can be retrieved by
34  *	the function ddi_get_driver_private).
35  */
36 #ifndef	_SYS_SCSI_CONF_DEVICE_H
37 #define	_SYS_SCSI_CONF_DEVICE_H
38 
39 #pragma ident	"%Z%%M%	%I%	%E% SMI"
40 
41 #include <sys/scsi/scsi_types.h>
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 struct scsi_device {
48 	/*
49 	 * Routing info for this device.  Contains a_hba_tran pointer to
50 	 * the transport and decoded addressing for SPI devices.
51 	 */
52 	struct scsi_address	sd_address;
53 
54 	/*
55 	 * Cross-reference to target device's dev_info_t.
56 	 */
57 	dev_info_t		*sd_dev;
58 
59 	/*
60 	 * Mutex for this device, initialized by
61 	 * parent prior to calling probe or attach
62 	 * routine.
63 	 */
64 	kmutex_t		sd_mutex;
65 
66 	/*
67 	 * Reserved, do not use.
68 	 */
69 	void			*sd_reserved;
70 
71 
72 	/*
73 	 * If scsi_slave is used to probe out this device,
74 	 * a scsi_inquiry data structure will be allocated
75 	 * and an INQUIRY command will be run to fill it in.
76 	 *
77 	 * The allocation will be done via ddi_iopb_alloc,
78 	 * so any manual freeing may be done by ddi_iopb_free.
79 	 *
80 	 * The inquiry data is allocated/refreshed by
81 	 * scsi_probe/scsi_slave and freed by uninitchild (inquiry
82 	 * data is no longer freed by scsi_unprobe/scsi_unslave).
83 	 *
84 	 * Additional device identity information may be available
85 	 * as properties of sd_dev.
86 	 */
87 	struct scsi_inquiry	*sd_inq;
88 
89 	/*
90 	 * Place to point to an extended request sense buffer.
91 	 * The target driver is responsible for managing this.
92 	 */
93 	struct scsi_extended_sense	*sd_sense;
94 
95 	/*
96 	 * More detailed information is 'private' information. Typically a
97 	 * pointer to target driver private soft_state information for the
98 	 * device.  This soft_state is typically established in target driver
99 	 * attach(9E), and freed in the target driver detach(9E).
100 	 */
101 	caddr_t			sd_private;
102 };
103 
104 #ifdef	_KERNEL
105 int	scsi_slave(struct scsi_device *devp, int (*callback)(void));
106 int	scsi_probe(struct scsi_device *devp, int (*callback)(void));
107 void	scsi_unslave(struct scsi_device *devp);
108 void	scsi_unprobe(struct scsi_device *devp);
109 #endif	/* _KERNEL */
110 
111 #ifdef	__cplusplus
112 }
113 #endif
114 
115 #endif	/* _SYS_SCSI_CONF_DEVICE_H */
116