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 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * These functions are used to encode SCSI INQUIRY data into
29 * Solaris devid / guid values.
30 */
31
32 #ifndef _KERNEL
33 #include <stdio.h>
34 #endif /* _KERNEL */
35
36 #include <sys/inttypes.h>
37 #include <sys/types.h>
38 #include <sys/stropts.h>
39 #include <sys/debug.h>
40 #include <sys/isa_defs.h>
41 #include <sys/dditypes.h>
42 #include <sys/ddi_impldefs.h>
43 #include <sys/scsi/scsi.h>
44 #ifndef _KERNEL
45 #include <sys/libdevid.h>
46 #endif /* !_KERNEL */
47 #include "devid_impl.h"
215 SCSI_INQUIRY_VID_HITACHI_LEN) != 0) ||
216 (bcmp(inq_std->inq_pid,
217 SCSI_INQUIRY_PID_HITACHI_OPEN,
218 SCSI_INQUIRY_PID_HITACHI_OPEN_LEN) != 0)) {
219 /*
220 * report the page 0x83 standards violation.
221 */
222 msg = kmem_alloc(
223 MSG_NOT_STANDARDS_COMPLIANT_SIZE,
224 KM_SLEEP);
225 (void) strcpy(msg, MSG_NOT_STANDARDS_COMPLIANT);
226 (void) strncat(msg, inq_std->inq_vid,
227 sizeof (inq_std->inq_vid));
228 (void) strcat(msg, " ");
229 (void) strncat(msg, inq_std->inq_pid,
230 sizeof (inq_std->inq_pid));
231 (void) strcat(msg, " ");
232 (void) strncat(msg, inq_std->inq_revision,
233 sizeof (inq_std->inq_revision));
234 (void) strcat(msg, "\n");
235 cmn_err(CE_WARN, msg);
236 kmem_free(msg,
237 MSG_NOT_STANDARDS_COMPLIANT_SIZE);
238 }
239 #endif /* _KERNEL */
240 }
241
242 if (id_type == DEVID_NONE) {
243 encode_scsi3_page83(version, inq83,
244 inq83_len, &id, &id_len, &id_type);
245 }
246 }
247
248 /*
249 * If no vpd page is available at this point then we
250 * attempt to use a SCSI serial number from page 0x80.
251 */
252 if ((id_type == DEVID_NONE) &&
253 (inq != NULL) &&
254 (inq80 != NULL)) {
255 if (is_page80_data_valid(inq80, inq80_len) == DEVID_RET_VALID) {
|
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 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2019 Joyent, Inc.
29 */
30
31 /*
32 * These functions are used to encode SCSI INQUIRY data into
33 * Solaris devid / guid values.
34 */
35
36 #ifndef _KERNEL
37 #include <stdio.h>
38 #endif /* _KERNEL */
39
40 #include <sys/inttypes.h>
41 #include <sys/types.h>
42 #include <sys/stropts.h>
43 #include <sys/debug.h>
44 #include <sys/isa_defs.h>
45 #include <sys/dditypes.h>
46 #include <sys/ddi_impldefs.h>
47 #include <sys/scsi/scsi.h>
48 #ifndef _KERNEL
49 #include <sys/libdevid.h>
50 #endif /* !_KERNEL */
51 #include "devid_impl.h"
219 SCSI_INQUIRY_VID_HITACHI_LEN) != 0) ||
220 (bcmp(inq_std->inq_pid,
221 SCSI_INQUIRY_PID_HITACHI_OPEN,
222 SCSI_INQUIRY_PID_HITACHI_OPEN_LEN) != 0)) {
223 /*
224 * report the page 0x83 standards violation.
225 */
226 msg = kmem_alloc(
227 MSG_NOT_STANDARDS_COMPLIANT_SIZE,
228 KM_SLEEP);
229 (void) strcpy(msg, MSG_NOT_STANDARDS_COMPLIANT);
230 (void) strncat(msg, inq_std->inq_vid,
231 sizeof (inq_std->inq_vid));
232 (void) strcat(msg, " ");
233 (void) strncat(msg, inq_std->inq_pid,
234 sizeof (inq_std->inq_pid));
235 (void) strcat(msg, " ");
236 (void) strncat(msg, inq_std->inq_revision,
237 sizeof (inq_std->inq_revision));
238 (void) strcat(msg, "\n");
239 cmn_err(CE_WARN, "%s", msg);
240 kmem_free(msg,
241 MSG_NOT_STANDARDS_COMPLIANT_SIZE);
242 }
243 #endif /* _KERNEL */
244 }
245
246 if (id_type == DEVID_NONE) {
247 encode_scsi3_page83(version, inq83,
248 inq83_len, &id, &id_len, &id_type);
249 }
250 }
251
252 /*
253 * If no vpd page is available at this point then we
254 * attempt to use a SCSI serial number from page 0x80.
255 */
256 if ((id_type == DEVID_NONE) &&
257 (inq != NULL) &&
258 (inq80 != NULL)) {
259 if (is_page80_data_valid(inq80, inq80_len) == DEVID_RET_VALID) {
|