10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*176Scth * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*176Scth * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* 280Sstevel@tonic-gate * SCSI device structure. 290Sstevel@tonic-gate * 30*176Scth * All SCSI target drivers will have one of these per target/lun/sfunc. 31*176Scth * It will be allocated and initialized by the SCSA HBA nexus code 32*176Scth * for each SCSI target dev_info_t node and stored as driver private data 33*176Scth * in that target device's dev_info_t (and thus can be retrieved by 340Sstevel@tonic-gate * the function ddi_get_driver_private). 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate #ifndef _SYS_SCSI_CONF_DEVICE_H 370Sstevel@tonic-gate #define _SYS_SCSI_CONF_DEVICE_H 380Sstevel@tonic-gate 390Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 400Sstevel@tonic-gate 410Sstevel@tonic-gate #include <sys/scsi/scsi_types.h> 420Sstevel@tonic-gate 430Sstevel@tonic-gate #ifdef __cplusplus 440Sstevel@tonic-gate extern "C" { 450Sstevel@tonic-gate #endif 460Sstevel@tonic-gate 470Sstevel@tonic-gate struct scsi_device { 480Sstevel@tonic-gate /* 49*176Scth * Routing info for this device. Contains a_hba_tran pointer to 50*176Scth * the transport and decoded addressing for SPI devices. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate struct scsi_address sd_address; 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* 55*176Scth * Cross-reference to target device's dev_info_t. 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate dev_info_t *sd_dev; 580Sstevel@tonic-gate 590Sstevel@tonic-gate /* 600Sstevel@tonic-gate * Mutex for this device, initialized by 610Sstevel@tonic-gate * parent prior to calling probe or attach 620Sstevel@tonic-gate * routine. 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate kmutex_t sd_mutex; 650Sstevel@tonic-gate 660Sstevel@tonic-gate /* 670Sstevel@tonic-gate * Reserved, do not use. 680Sstevel@tonic-gate */ 690Sstevel@tonic-gate void *sd_reserved; 700Sstevel@tonic-gate 710Sstevel@tonic-gate 720Sstevel@tonic-gate /* 730Sstevel@tonic-gate * If scsi_slave is used to probe out this device, 740Sstevel@tonic-gate * a scsi_inquiry data structure will be allocated 750Sstevel@tonic-gate * and an INQUIRY command will be run to fill it in. 760Sstevel@tonic-gate * 770Sstevel@tonic-gate * The allocation will be done via ddi_iopb_alloc, 780Sstevel@tonic-gate * so any manual freeing may be done by ddi_iopb_free. 79*176Scth * 80*176Scth * The inquiry data is allocated/refreshed by 81*176Scth * scsi_probe/scsi_slave and freed by uninitchild (inquiry 82*176Scth * data is no longer freed by scsi_unprobe/scsi_unslave). 83*176Scth * 84*176Scth * Additional device identity information may be available 85*176Scth * as properties of sd_dev. 860Sstevel@tonic-gate */ 870Sstevel@tonic-gate struct scsi_inquiry *sd_inq; 880Sstevel@tonic-gate 890Sstevel@tonic-gate /* 900Sstevel@tonic-gate * Place to point to an extended request sense buffer. 910Sstevel@tonic-gate * The target driver is responsible for managing this. 920Sstevel@tonic-gate */ 930Sstevel@tonic-gate struct scsi_extended_sense *sd_sense; 940Sstevel@tonic-gate 950Sstevel@tonic-gate /* 96*176Scth * More detailed information is 'private' information. Typically a 97*176Scth * pointer to target driver private soft_state information for the 98*176Scth * device. This soft_state is typically established in target driver 99*176Scth * attach(9E), and freed in the target driver detach(9E). 1000Sstevel@tonic-gate */ 1010Sstevel@tonic-gate caddr_t sd_private; 1020Sstevel@tonic-gate }; 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate #ifdef _KERNEL 105*176Scth int scsi_slave(struct scsi_device *devp, int (*callback)(void)); 106*176Scth int scsi_probe(struct scsi_device *devp, int (*callback)(void)); 107*176Scth void scsi_unslave(struct scsi_device *devp); 108*176Scth void scsi_unprobe(struct scsi_device *devp); 1090Sstevel@tonic-gate #endif /* _KERNEL */ 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate #ifdef __cplusplus 1120Sstevel@tonic-gate } 1130Sstevel@tonic-gate #endif 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate #endif /* _SYS_SCSI_CONF_DEVICE_H */ 116