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 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_SCSI_IMPL_SERVICES_H 28 #define _SYS_SCSI_IMPL_SERVICES_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* 37 * Implementation services not classified by type 38 */ 39 40 #ifdef _KERNEL 41 42 #ifdef __STDC__ 43 44 struct scsi_key_strings { 45 int key; 46 char *message; 47 }; 48 49 struct scsi_asq_key_strings { 50 ushort_t asc; 51 ushort_t ascq; 52 char *message; 53 }; 54 55 extern int scsi_poll(struct scsi_pkt *); 56 extern struct scsi_pkt *get_pktiopb(struct scsi_address *, 57 caddr_t *datap, int cdblen, int statuslen, 58 int datalen, int readflag, int (*func)()); 59 extern void free_pktiopb(struct scsi_pkt *, caddr_t datap, int datalen); 60 extern char *scsi_dname(int dtyp); 61 extern char *scsi_rname(uchar_t reason); 62 extern char *scsi_mname(uchar_t msg); 63 extern char *scsi_cname(uchar_t cmd, char **cmdvec); 64 extern char *scsi_cmd_name(uchar_t cmd, struct scsi_key_strings *cmdlist, 65 char *tmpstr); 66 extern char *scsi_sname(uchar_t sense_key); 67 extern char *scsi_esname(uint_t sense_key, char *tmpstr); 68 extern char *scsi_asc_name(uint_t asc, uint_t ascq, char *tmpstr); 69 extern void scsi_vu_errmsg(struct scsi_device *devp, struct scsi_pkt *pktp, 70 char *drv_name, int severity, daddr_t blkno, daddr_t err_blkno, 71 struct scsi_key_strings *cmdlist, struct scsi_extended_sense *sensep, 72 struct scsi_asq_key_strings *asc_list, 73 char *(*decode_fru)(struct scsi_device *, char *, int, uchar_t)); 74 extern void scsi_errmsg(struct scsi_device *devp, struct scsi_pkt *pkt, 75 char *label, int severity, daddr_t blkno, daddr_t err_blkno, 76 struct scsi_key_strings *cmdlist, struct scsi_extended_sense *sensep); 77 /*PRINTFLIKE4*/ 78 extern void scsi_log(dev_info_t *dev, char *label, 79 uint_t level, const char *fmt, ...) __KPRINTFLIKE(4); 80 81 #else /* __STDC__ */ 82 83 extern int scsi_poll(); 84 extern struct scsi_pkt *get_pktiopb(); 85 extern void free_pktiopb(); 86 extern char *scsi_dname(), *scsi_rname(), *scsi_cname(), *scsi_mname(); 87 extern char *scsi_sname(), *scsi_esname(), *scsi_asc_name(); 88 extern void scsi_vu_errmsg(), scsi_errmsg(), scsi_log(); 89 90 #endif /* __STDC__ */ 91 92 extern char *scsi_state_bits; 93 extern char *sense_keys[NUM_SENSE_KEYS + NUM_IMPL_SENSE_KEYS]; 94 95 96 #define SCSI_DEBUG 0xDEB00000 97 98 #define SCSI_ERR_ALL 0 99 #define SCSI_ERR_UNKNOWN 1 100 #define SCSI_ERR_INFO 2 101 #define SCSI_ERR_RECOVERED 3 102 #define SCSI_ERR_RETRYABLE 4 103 #define SCSI_ERR_FATAL 5 104 #define SCSI_ERR_NONE 6 105 106 107 /* 108 * Common Capability Strings Array 109 */ 110 #define SCSI_CAP_DMA_MAX 0 111 #define SCSI_CAP_MSG_OUT 1 112 #define SCSI_CAP_DISCONNECT 2 113 #define SCSI_CAP_SYNCHRONOUS 3 114 #define SCSI_CAP_WIDE_XFER 4 115 #define SCSI_CAP_PARITY 5 116 #define SCSI_CAP_INITIATOR_ID 6 117 #define SCSI_CAP_UNTAGGED_QING 7 118 #define SCSI_CAP_TAGGED_QING 8 119 #define SCSI_CAP_ARQ 9 120 #define SCSI_CAP_LINKED_CMDS 10 121 #define SCSI_CAP_SECTOR_SIZE 11 122 #define SCSI_CAP_TOTAL_SECTORS 12 123 #define SCSI_CAP_GEOMETRY 13 124 #define SCSI_CAP_RESET_NOTIFICATION 14 125 #define SCSI_CAP_QFULL_RETRIES 15 126 #define SCSI_CAP_QFULL_RETRY_INTERVAL 16 127 #define SCSI_CAP_SCSI_VERSION 17 128 #define SCSI_CAP_INTERCONNECT_TYPE 18 129 #define SCSI_CAP_LUN_RESET 19 130 131 /* 132 * Definitions used by some capabilities 133 */ 134 /* SCSI_CAP_SCSI_VERSION */ 135 #define SCSI_VERSION_1 1 136 #define SCSI_VERSION_2 2 137 #define SCSI_VERSION_3 3 138 139 /* SCSI_CAP_INTERCONNECT_TYPE */ 140 #define INTERCONNECT_PARALLEL 1 141 #define INTERCONNECT_FIBRE 2 /* PLDA or hard ALPA */ 142 #define INTERCONNECT_1394 3 143 #define INTERCONNECT_SSA 4 /* -EOLed */ 144 #define INTERCONNECT_FABRIC 5 /* soft ALPA or Switch */ 145 #define INTERCONNECT_USB 6 146 147 /* 148 * Compatibility... 149 */ 150 151 #define scsi_cmd_decode scsi_cname 152 153 #endif /* _KERNEL */ 154 155 #ifdef __cplusplus 156 } 157 #endif 158 159 #endif /* _SYS_SCSI_IMPL_SERVICES_H */ 160