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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* 28 * Implementation of "scsi_vhci_f_sym" symmetric failover_ops. 29 * 30 * This file was historically meant for only symmetric implementation. It has 31 * been extended to manage SUN "supported" symmetric controllers. The supported 32 * VID/PID shall be listed in the symmetric_dev_table. 33 */ 34 35 #include <sys/conf.h> 36 #include <sys/file.h> 37 #include <sys/ddi.h> 38 #include <sys/sunddi.h> 39 #include <sys/scsi/scsi.h> 40 #include <sys/scsi/adapters/scsi_vhci.h> 41 42 /* Supported device table entries. */ 43 char *symmetric_dev_table[] = { 44 /* " 111111" */ 45 /* "012345670123456789012345" */ 46 /* "|-VID--||-----PID------|" */ 47 /* disks */ 48 "IBM DDYFT", 49 "IBM IC", 50 "SEAGATE ST", 51 /* enclosures */ 52 "SUN SENA", /* SES device */ 53 "SUN SESS01", /* VICOM SVE box */ 54 "SUNW SUNWGS", /* Daktari enclosure */ 55 /* arrays */ 56 "HITACHI OPEN", /* Hitachi storage */ 57 "SUN PSX1000", /* Pirus Matterhorn */ 58 "SUN SE6920", /* Pirus */ 59 "SUN SE6940", /* DSP - Nauset */ 60 "SUN StorEdge 3510", /* Minnow FC */ 61 "SUN StorEdge 3511", /* Minnow SATA RAID */ 62 "SUN StorageTek 6920", /* DSP */ 63 "SUN StorageTek 6940", /* DSP - Nauset */ 64 "SUN StorageTek NAS", /* StorageTek NAS */ 65 "SUN MRA300_R", /* Shamrock - Controller */ 66 "SUN MRA300_E", /* Shamrock - Expansion */ 67 68 NULL 69 }; 70 71 /* Failover module plumbing. */ 72 SCSI_FAILOVER_OP(SFO_NAME_SYM, symmetric); 73 74 /* ARGSUSED */ 75 static int 76 symmetric_device_probe(struct scsi_device *sd, struct scsi_inquiry *stdinq, 77 void **ctpriv) 78 { 79 char **dt; 80 81 VHCI_DEBUG(6, (CE_NOTE, NULL, "!inq str: %s\n", stdinq->inq_vid)); 82 for (dt = symmetric_dev_table; *dt; dt++) 83 if (strncmp(stdinq->inq_vid, *dt, strlen(*dt)) == 0) 84 return (SFO_DEVICE_PROBE_VHCI); 85 86 /* 87 * No match, check for generic Sun supported disks: 88 * 89 * "|-VID--||-----PID------|" 90 * "012345670123456789012345" 91 * ".................SUN..G." 92 * ".................SUN..T." 93 * ".................SUN...G" 94 * ".................SUN...T" 95 */ 96 if (bcmp(&stdinq->inq_pid[9], "SUN", 3) == 0) { 97 if ((stdinq->inq_pid[14] == 'G' || stdinq->inq_pid[15] == 'G' || 98 stdinq->inq_pid[14] == 'T' || stdinq->inq_pid[15] == 'T') && 99 (stdinq->inq_dtype == DTYPE_DIRECT)) { 100 return (SFO_DEVICE_PROBE_VHCI); 101 } 102 } 103 return (SFO_DEVICE_PROBE_PHCI); 104 } 105 106 /* ARGSUSED */ 107 static void 108 symmetric_device_unprobe(struct scsi_device *sd, void *ctpriv) 109 { 110 /* 111 * NOP for symmetric 112 */ 113 } 114 115 /* ARGSUSED */ 116 static int 117 symmetric_path_activate(struct scsi_device *sd, char *pathclass, void *ctpriv) 118 { 119 return (0); 120 } 121 122 /* ARGSUSED */ 123 static int 124 symmetric_path_deactivate(struct scsi_device *sd, char *pathclass, 125 void *ctpriv) 126 { 127 return (0); 128 } 129 130 /* ARGSUSED */ 131 static int 132 symmetric_path_get_opinfo(struct scsi_device *sd, 133 struct scsi_path_opinfo *opinfo, void *ctpriv) 134 { 135 opinfo->opinfo_rev = OPINFO_REV; 136 (void) strcpy(opinfo->opinfo_path_attr, "primary"); 137 opinfo->opinfo_path_state = SCSI_PATH_ACTIVE; 138 opinfo->opinfo_pswtch_best = 0; /* N/A */ 139 opinfo->opinfo_pswtch_worst = 0; /* N/A */ 140 opinfo->opinfo_xlf_capable = 0; 141 opinfo->opinfo_mode = SCSI_NO_FAILOVER; 142 opinfo->opinfo_preferred = 1; 143 144 return (0); 145 } 146 147 /* ARGSUSED */ 148 static int 149 symmetric_path_ping(struct scsi_device *sd, void *ctpriv) 150 { 151 return (1); 152 } 153 154 /* ARGSUSED */ 155 static int 156 symmetric_analyze_sense(struct scsi_device *sd, 157 struct scsi_extended_sense *sense, void *ctpriv) 158 { 159 return (SCSI_SENSE_NOFAILOVER); 160 } 161 162 /* ARGSUSED */ 163 static int 164 symmetric_pathclass_next(char *cur, char **nxt, void *ctpriv) 165 { 166 if (cur == NULL) { 167 *nxt = PCLASS_PRIMARY; 168 return (0); 169 } else if (strcmp(cur, PCLASS_PRIMARY) == 0) { 170 return (ENOENT); 171 } else { 172 return (EINVAL); 173 } 174 } 175