Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/scsi/adapters/scsi_vhci/fops/tpgs_tape.c
+++ new/usr/src/uts/common/io/scsi/adapters/scsi_vhci/fops/tpgs_tape.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /*
27 27 * Implementation of "scsi_vhci_f_tpgs_tape" T10 standard based failover_ops.
28 28 *
29 29 * NOTE: for sequential devices only.
30 30 */
31 31
32 32 #include <sys/conf.h>
33 33 #include <sys/file.h>
34 34 #include <sys/ddi.h>
35 35 #include <sys/sunddi.h>
36 36 #include <sys/scsi/scsi.h>
37 37 #include <sys/scsi/adapters/scsi_vhci.h>
38 38 #include <sys/scsi/adapters/scsi_vhci_tpgs.h>
39 39
40 40 /* Supported device table entries. */
41 41 char *tpgs_tape_dev_table[] = { NULL };
42 42 static void tpgs_tape_init(void);
43 43 static int tpgs_tape_device_probe(struct scsi_device *sd,
44 44 struct scsi_inquiry *inq, void **ctpriv);
45 45
46 46 /* Failover module plumbing. */
47 47 #ifdef lint
48 48 #define scsi_vhci_failover_ops scsi_vhci_failover_ops_f_tpgs_tape
49 49 #endif /* lint */
50 50 struct scsi_failover_ops scsi_vhci_failover_ops = {
51 51 SFO_REV,
52 52 "f_tpgs_tape",
53 53 tpgs_tape_dev_table,
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
54 54 tpgs_tape_init,
55 55 tpgs_tape_device_probe,
56 56 /* The rest of the implementation comes from SFO_NAME_TPGS import */
57 57 };
58 58
59 59 static struct modlmisc modlmisc = {
60 60 &mod_miscops, "f_tpgs_tape"
61 61 };
62 62
63 63 static struct modlinkage modlinkage = {
64 - MODREV_1, (void *)&modlmisc, NULL
64 + MODREV_1, { (void *)&modlmisc, NULL }
65 65 };
66 66
67 67
68 68
69 69 /*
70 70 * External function definitions
71 71 */
72 72 extern struct scsi_failover_ops *vhci_failover_ops_by_name(char *);
73 73
74 74 int
75 75 _init()
76 76 {
77 77 return (mod_install(&modlinkage));
78 78 }
79 79
80 80 int
81 81 _fini()
82 82 {
83 83 return (mod_remove(&modlinkage));
84 84 }
85 85
86 86 int
87 87 _info(struct modinfo *modinfop)
88 88 {
89 89 return (mod_info(&modlinkage, modinfop));
90 90 }
91 91
92 92
93 93
94 94 /* ARGSUSED */
95 95 static int
96 96 tpgs_tape_device_probe(struct scsi_device *sd, struct scsi_inquiry *inq,
97 97 void **ctpriv)
98 98 {
99 99 int mode;
100 100 int state;
101 101 int xlf;
102 102 int preferred = 0;
103 103 int support;
104 104
105 105 VHCI_DEBUG(6, (CE_NOTE, NULL, "tpgs_tape_device_probe: vidpid %s\n",
106 106 inq->inq_vid));
107 107
108 108 if (inq->inq_tpgs == TPGS_FAILOVER_NONE) {
109 109 VHCI_DEBUG(4, (CE_WARN, NULL,
110 110 "!tpgs_tape_device_probe: not a standard tpgs device"));
111 111 support = SFO_DEVICE_PROBE_PHCI;
112 112 } else if (inq->inq_dtype != DTYPE_SEQUENTIAL) {
113 113 VHCI_DEBUG(4, (CE_NOTE, NULL,
114 114 "!tpgs_tape_device_probe: Detected a "
115 115 "Standard Asymmetric device "
116 116 "not yet supported\n"));
117 117 support = SFO_DEVICE_PROBE_PHCI;
118 118 } else if (vhci_tpgs_get_target_fo_mode(sd, &mode, &state, &xlf,
119 119 &preferred)) {
120 120 VHCI_DEBUG(4, (CE_WARN, NULL, "!unable to fetch fo "
121 121 "mode: sd(%p)", (void *) sd));
122 122 support = SFO_DEVICE_PROBE_PHCI;
123 123 } else if (inq->inq_tpgs == TPGS_FAILOVER_IMPLICIT) {
124 124 VHCI_DEBUG(1, (CE_NOTE, NULL,
125 125 "!tpgs_tape_device_probe: Detected a "
126 126 "Standard Asymmetric device "
127 127 "with implicit failover\n"));
128 128 support = SFO_DEVICE_PROBE_VHCI;
129 129 } else if (inq->inq_tpgs == TPGS_FAILOVER_EXPLICIT) {
130 130 VHCI_DEBUG(1, (CE_NOTE, NULL,
131 131 "!tpgs_tape_device_probe: Detected a "
132 132 "Standard Asymmetric device "
133 133 "with explicit failover\n"));
134 134 support = SFO_DEVICE_PROBE_VHCI;
135 135 } else if (inq->inq_tpgs == TPGS_FAILOVER_BOTH) {
136 136 VHCI_DEBUG(1, (CE_NOTE, NULL,
137 137 "!tpgs_tape_device_probe: Detected a "
138 138 "Standard Asymmetric device "
139 139 "which supports both implicit and explicit failover\n"));
140 140 support = SFO_DEVICE_PROBE_VHCI;
141 141 } else {
142 142 VHCI_DEBUG(1, (CE_WARN, NULL,
143 143 "!tpgs_tape_device_probe: "
144 144 "Unknown tpgs_bits: %x", inq->inq_tpgs));
145 145 support = SFO_DEVICE_PROBE_PHCI;
146 146 }
147 147
148 148 if (support == SFO_DEVICE_PROBE_VHCI) {
149 149 /*
150 150 * Policy only applies to 'client' probe, not
151 151 * vhci_is_dev_supported() pHCI probe. Detect difference
152 152 * based on ctpriv.
153 153 */
154 154 if (ctpriv &&
155 155 (mdi_set_lb_policy(sd->sd_dev, LOAD_BALANCE_NONE) !=
156 156 MDI_SUCCESS)) {
157 157 VHCI_DEBUG(6, (CE_NOTE, NULL, "!fail load balance none"
158 158 ": %s\n", inq->inq_vid));
159 159 support = SFO_DEVICE_PROBE_PHCI;
160 160 }
161 161 }
162 162 return (support);
163 163 }
164 164
165 165 static void
166 166 tpgs_tape_init(void)
167 167 {
168 168 struct scsi_failover_ops *sfo, *ssfo, clone;
169 169
170 170 /* clone SFO_NAME_SYM implementation for most things */
171 171 ssfo = vhci_failover_ops_by_name(SFO_NAME_TPGS);
172 172 if (ssfo == NULL) {
173 173 VHCI_DEBUG(4, (CE_NOTE, NULL, "!tpgs_tape: "
174 174 "can't import " SFO_NAME_SYM "\n"));
175 175 return;
176 176 }
177 177 sfo = &scsi_vhci_failover_ops;
178 178 clone = *ssfo;
179 179 clone.sfo_rev = sfo->sfo_rev;
180 180 clone.sfo_name = sfo->sfo_name;
181 181 clone.sfo_devices = sfo->sfo_devices;
182 182 clone.sfo_init = sfo->sfo_init;
183 183 clone.sfo_device_probe = sfo->sfo_device_probe;
184 184 *sfo = clone;
185 185 }
↓ open down ↓ |
111 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX