1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1996, by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_DADA_IMPL_TRANSPORT_H 28*0Sstevel@tonic-gate #define _SYS_DADA_IMPL_TRANSPORT_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * Include loadable module wrapper. 34*0Sstevel@tonic-gate */ 35*0Sstevel@tonic-gate #include <sys/modctl.h> 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #ifdef __cplusplus 38*0Sstevel@tonic-gate extern "C" { 39*0Sstevel@tonic-gate #endif 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #ifdef _KERNEL 42*0Sstevel@tonic-gate /* 43*0Sstevel@tonic-gate * DCD transport structure 44*0Sstevel@tonic-gate * As each host adapter makes itself known to the system, 45*0Sstevel@tonic-gate * It will create and register with the library the structure 46*0Sstevel@tonic-gate * describe below. This is so that the library knows how to route 47*0Sstevel@tonic-gate * packets, resource control requests, and capability requests 48*0Sstevel@tonic-gate * for any particular host adapter. The 'a_hba_tran' field of a 49*0Sstevel@tonic-gate * dcd_address structure made known to a target driver will point to 50*0Sstevel@tonic-gate * one of these transport structures. 51*0Sstevel@tonic-gate */ 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate typedef struct dcd_hba_tran dcd_hba_tran_t; 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate struct dcd_hba_tran { 56*0Sstevel@tonic-gate uint_t version; 57*0Sstevel@tonic-gate /* 58*0Sstevel@tonic-gate * Ptr to the device info structure for thsi particular HBA 59*0Sstevel@tonic-gate */ 60*0Sstevel@tonic-gate dev_info_t *tran_hba_dip; 61*0Sstevel@tonic-gate 62*0Sstevel@tonic-gate /* 63*0Sstevel@tonic-gate * Private fields for use by the HBA itself 64*0Sstevel@tonic-gate */ 65*0Sstevel@tonic-gate void *tran_hba_private; /* HBA Softstate */ 66*0Sstevel@tonic-gate void *tran_tgt_private; /* Target specific info */ 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate /* 69*0Sstevel@tonic-gate * Only used to refer to a particular dcd device 70*0Sstevel@tonic-gate * if the entire dcd_hba_tran_structure is cloned 71*0Sstevel@tonic-gate * per target device, otherwise NULL. 72*0Sstevel@tonic-gate */ 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate struct dcd_device *tran_sd; 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* 77*0Sstevel@tonic-gate * vectors to point to specific HBA entry points. 78*0Sstevel@tonic-gate */ 79*0Sstevel@tonic-gate int (*tran_tgt_init)( 80*0Sstevel@tonic-gate dev_info_t *hba_dip, 81*0Sstevel@tonic-gate dev_info_t *tgt_dip, 82*0Sstevel@tonic-gate dcd_hba_tran_t *hba_tran, 83*0Sstevel@tonic-gate struct dcd_device *dcd); 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate int (*tran_tgt_probe)( 86*0Sstevel@tonic-gate struct dcd_device *dcd, 87*0Sstevel@tonic-gate int (*callback)(void)); 88*0Sstevel@tonic-gate int (*tran_tgt_free)( 89*0Sstevel@tonic-gate dev_info_t *hba_dip, 90*0Sstevel@tonic-gate dev_info_t *tgt_dip, 91*0Sstevel@tonic-gate dcd_hba_tran_t *hba_tran, 92*0Sstevel@tonic-gate struct dcd_device *dcd); 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate int (*tran_start)( 95*0Sstevel@tonic-gate struct dcd_address *ap, 96*0Sstevel@tonic-gate struct dcd_pkt *pkt); 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate int (*tran_reset)( 99*0Sstevel@tonic-gate struct dcd_address *ap, 100*0Sstevel@tonic-gate int level); 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate int (*tran_abort)( 103*0Sstevel@tonic-gate struct dcd_address *ap, 104*0Sstevel@tonic-gate struct dcd_pkt *pkt); 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate struct dcd_pkt *(*tran_init_pkt)( 107*0Sstevel@tonic-gate struct dcd_address *ap, 108*0Sstevel@tonic-gate struct dcd_pkt *pkt, 109*0Sstevel@tonic-gate struct buf *bp, 110*0Sstevel@tonic-gate int cmdlen, 111*0Sstevel@tonic-gate int statuslen, 112*0Sstevel@tonic-gate int tgtlen, 113*0Sstevel@tonic-gate int flags, 114*0Sstevel@tonic-gate int (*callback)( 115*0Sstevel@tonic-gate caddr_t arg), 116*0Sstevel@tonic-gate caddr_t callback_arg); 117*0Sstevel@tonic-gate 118*0Sstevel@tonic-gate void (*tran_destroy_pkt)( 119*0Sstevel@tonic-gate struct dcd_address *ap, 120*0Sstevel@tonic-gate struct dcd_pkt *pkt); 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate void (*tran_dmafree)( 123*0Sstevel@tonic-gate struct dcd_address *ap, 124*0Sstevel@tonic-gate struct dcd_pkt *pkt); 125*0Sstevel@tonic-gate void (*tran_sync_pkt)( 126*0Sstevel@tonic-gate struct dcd_address *ap, 127*0Sstevel@tonic-gate struct dcd_pkt *pkt); 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate /* 131*0Sstevel@tonic-gate * Implementation private specifics. 132*0Sstevel@tonic-gate */ 133*0Sstevel@tonic-gate int tran_hba_flags; /* flag option */ 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate /* 136*0Sstevel@tonic-gate * min xfer and min/max burst sizes for DDI_CTLOPS_IOMIN 137*0Sstevel@tonic-gate */ 138*0Sstevel@tonic-gate uint_t tran_min_xfer; 139*0Sstevel@tonic-gate uchar_t tran_min_burst_size; 140*0Sstevel@tonic-gate uchar_t tran_max_burst_size; 141*0Sstevel@tonic-gate }; 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gate /* 145*0Sstevel@tonic-gate * Prototypes for DCD HBA interface function. 146*0Sstevel@tonic-gate */ 147*0Sstevel@tonic-gate 148*0Sstevel@tonic-gate extern void dcd_initialize_hba_interface(void); 149*0Sstevel@tonic-gate 150*0Sstevel@tonic-gate #ifdef NO_DADA_FINI_YET 151*0Sstevel@tonic-gate extern void dcd_uninitialize_hba_interface(void); 152*0Sstevel@tonic-gate #endif 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate extern int dcd_hba_init(struct modlinkage *modlp); 155*0Sstevel@tonic-gate 156*0Sstevel@tonic-gate extern void dcd_hab_fini(struct modlinkage *modlp); 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate #ifdef NOTNEEDED 159*0Sstevel@tonic-gate extern int dcd_hba_attach( 160*0Sstevel@tonic-gate dev_info_t *dip, 161*0Sstevel@tonic-gate ddi_dma_lim_t *hba_lim, 162*0Sstevel@tonic-gate dcd_hba_tran_t *hba_tran, 163*0Sstevel@tonic-gate int flags, 164*0Sstevel@tonic-gate void *hba_options); 165*0Sstevel@tonic-gate #endif 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate extern int dcd_hba_attach( 168*0Sstevel@tonic-gate dev_info_t *dip, 169*0Sstevel@tonic-gate ddi_dma_attr_t *hba_dma_attr, 170*0Sstevel@tonic-gate dcd_hba_tran_t *hba_tran, 171*0Sstevel@tonic-gate int flags); 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gate extern int dcd_hba_detach( 174*0Sstevel@tonic-gate dev_info_t *dip); 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate extern dcd_hba_tran_t *dcd_hba_tran_alloc( 177*0Sstevel@tonic-gate dev_info_t *dip, 178*0Sstevel@tonic-gate int flags); 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gate extern void dcd_hba_tran_free( 181*0Sstevel@tonic-gate dcd_hba_tran_t *hba_tran); 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate extern int dcd_hba_probe( 184*0Sstevel@tonic-gate struct dcd_device *dcd, 185*0Sstevel@tonic-gate int (*callback)(void)); 186*0Sstevel@tonic-gate 187*0Sstevel@tonic-gate extern struct dcd_pkt *dcd_hba_pkt_alloc( 188*0Sstevel@tonic-gate struct dcd_address *ap, 189*0Sstevel@tonic-gate int cmdlen, 190*0Sstevel@tonic-gate int statuslen, 191*0Sstevel@tonic-gate int tgtlen, 192*0Sstevel@tonic-gate int hbalen, 193*0Sstevel@tonic-gate int (*callback)(caddr_t), 194*0Sstevel@tonic-gate caddr_t arg); 195*0Sstevel@tonic-gate 196*0Sstevel@tonic-gate extern void dcd_hba_pkt_free( 197*0Sstevel@tonic-gate struct dcd_address *ap, 198*0Sstevel@tonic-gate struct dcd_pkt *pkt); 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate extern int dcd_hba_lookup_capstr( 201*0Sstevel@tonic-gate char *capstr); 202*0Sstevel@tonic-gate extern int dcd_hba_in_panic(void); 203*0Sstevel@tonic-gate 204*0Sstevel@tonic-gate /* 205*0Sstevel@tonic-gate * Flags for dcd_hba_attach 206*0Sstevel@tonic-gate */ 207*0Sstevel@tonic-gate #define DCD_HBA_TRAN_CLONE 0x01 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate /* 210*0Sstevel@tonic-gate * Flags for scsi_hab alloaction functions 211*0Sstevel@tonic-gate */ 212*0Sstevel@tonic-gate #define DCD_HBA_CANSLEEP 0x01 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate #endif /* _KERNEL */ 215*0Sstevel@tonic-gate 216*0Sstevel@tonic-gate #ifdef __cplusplus 217*0Sstevel@tonic-gate } 218*0Sstevel@tonic-gate #endif 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate #endif /* _SYS_DADA_IMPL_TRANSPORT_H */ 221