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 5*6640Scth * Common Development and Distribution License (the "License"). 6*6640Scth * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*6640Scth * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23176Scth * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* 270Sstevel@tonic-gate * SCSI device structure. 280Sstevel@tonic-gate * 29176Scth * All SCSI target drivers will have one of these per target/lun/sfunc. 30176Scth * It will be allocated and initialized by the SCSA HBA nexus code 31176Scth * for each SCSI target dev_info_t node and stored as driver private data 32176Scth * in that target device's dev_info_t (and thus can be retrieved by 330Sstevel@tonic-gate * the function ddi_get_driver_private). 340Sstevel@tonic-gate */ 350Sstevel@tonic-gate #ifndef _SYS_SCSI_CONF_DEVICE_H 360Sstevel@tonic-gate #define _SYS_SCSI_CONF_DEVICE_H 370Sstevel@tonic-gate 380Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 390Sstevel@tonic-gate 400Sstevel@tonic-gate #include <sys/scsi/scsi_types.h> 410Sstevel@tonic-gate 420Sstevel@tonic-gate #ifdef __cplusplus 430Sstevel@tonic-gate extern "C" { 440Sstevel@tonic-gate #endif 450Sstevel@tonic-gate 460Sstevel@tonic-gate struct scsi_device { 470Sstevel@tonic-gate /* 48176Scth * Routing info for this device. Contains a_hba_tran pointer to 49176Scth * the transport and decoded addressing for SPI devices. 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate struct scsi_address sd_address; 520Sstevel@tonic-gate 530Sstevel@tonic-gate /* 54176Scth * Cross-reference to target device's dev_info_t. 550Sstevel@tonic-gate */ 560Sstevel@tonic-gate dev_info_t *sd_dev; 570Sstevel@tonic-gate 580Sstevel@tonic-gate /* 590Sstevel@tonic-gate * Mutex for this device, initialized by 600Sstevel@tonic-gate * parent prior to calling probe or attach 610Sstevel@tonic-gate * routine. 620Sstevel@tonic-gate */ 630Sstevel@tonic-gate kmutex_t sd_mutex; 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * Reserved, do not use. 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate void *sd_reserved; 690Sstevel@tonic-gate 700Sstevel@tonic-gate 710Sstevel@tonic-gate /* 720Sstevel@tonic-gate * If scsi_slave is used to probe out this device, 730Sstevel@tonic-gate * a scsi_inquiry data structure will be allocated 740Sstevel@tonic-gate * and an INQUIRY command will be run to fill it in. 750Sstevel@tonic-gate * 760Sstevel@tonic-gate * The allocation will be done via ddi_iopb_alloc, 770Sstevel@tonic-gate * so any manual freeing may be done by ddi_iopb_free. 78176Scth * 79176Scth * The inquiry data is allocated/refreshed by 80176Scth * scsi_probe/scsi_slave and freed by uninitchild (inquiry 81176Scth * data is no longer freed by scsi_unprobe/scsi_unslave). 82176Scth * 83176Scth * Additional device identity information may be available 84176Scth * as properties of sd_dev. 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate struct scsi_inquiry *sd_inq; 870Sstevel@tonic-gate 880Sstevel@tonic-gate /* 890Sstevel@tonic-gate * Place to point to an extended request sense buffer. 900Sstevel@tonic-gate * The target driver is responsible for managing this. 910Sstevel@tonic-gate */ 920Sstevel@tonic-gate struct scsi_extended_sense *sd_sense; 930Sstevel@tonic-gate 940Sstevel@tonic-gate /* 95176Scth * More detailed information is 'private' information. Typically a 96176Scth * pointer to target driver private soft_state information for the 97176Scth * device. This soft_state is typically established in target driver 98176Scth * attach(9E), and freed in the target driver detach(9E). 990Sstevel@tonic-gate */ 1000Sstevel@tonic-gate caddr_t sd_private; 101*6640Scth 102*6640Scth 103*6640Scth /* 104*6640Scth * FMA capabilities of scsi_device. 105*6640Scth */ 106*6640Scth int sd_fm_capable; 107*6640Scth 108*6640Scth #ifdef SCSI_SIZE_CLEAN_VERIFY 109*6640Scth /* 110*6640Scth * Must be last: Building a driver with-and-without 111*6640Scth * -DSCSI_SIZE_CLEAN_VERIFY, and checking driver modules for 112*6640Scth * differences with a tools like 'wsdiff' allows a developer to verify 113*6640Scth * that their driver has no dependencies on scsi*(9S) size. 114*6640Scth */ 115*6640Scth int _pad[8]; 116*6640Scth #endif /* SCSI_SIZE_CLEAN_VERIFY */ 1170Sstevel@tonic-gate }; 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate #ifdef _KERNEL 120176Scth int scsi_slave(struct scsi_device *devp, int (*callback)(void)); 121176Scth int scsi_probe(struct scsi_device *devp, int (*callback)(void)); 122176Scth void scsi_unslave(struct scsi_device *devp); 123176Scth void scsi_unprobe(struct scsi_device *devp); 124*6640Scth size_t scsi_device_size(); /* private */ 1250Sstevel@tonic-gate #endif /* _KERNEL */ 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate #ifdef __cplusplus 1280Sstevel@tonic-gate } 1290Sstevel@tonic-gate #endif 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate #endif /* _SYS_SCSI_CONF_DEVICE_H */ 132