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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #pragma ident "%Z%%M% %I% %E% SMI"
27
28 #include <assert.h>
29 #include <errno.h>
30 #include <libdiskstatus.h>
31 #include <limits.h>
32 #include <stdlib.h>
33 #include <strings.h>
34 #include <sys/fm/io/scsi.h>
35
36 #include "ds_scsi.h"
37 #include "ds_scsi_sim.h"
38 #include "ds_scsi_uscsi.h"
39
40 typedef struct ds_scsi_info {
41 disk_status_t *si_dsp;
42 void *si_sim;
43 int si_cdblen;
44 int si_supp_mode;
45 int si_supp_log;
46 int si_extensions;
47 int si_reftemp;
1060 return (scsi_set_errno(sip, EDS_NOMEM));
1061 curtemp = temp->t_temp;
1062 break;
1063
1064 case LOGPARAM_TEMP_REFTEMP:
1065 if (lphp->lph_length != LOGPARAM_TEMP_LEN)
1066 break;
1067
1068 if (nvlist_add_uint8(nvl,
1069 FM_EREPORT_PAYLOAD_SCSI_THRESHTEMP,
1070 temp->t_temp) != 0)
1071 return (scsi_set_errno(sip, EDS_NOMEM));
1072 reftemp = temp->t_temp;
1073 break;
1074 }
1075
1076 plen = lphp->lph_length +
1077 sizeof (scsi_log_parameter_header_t);
1078 }
1079
1080 if (reftemp != INVALID_TEMPERATURE && curtemp != INVALID_TEMPERATURE &&
1081 curtemp > reftemp)
1082 sip->si_dsp->ds_faults |= DS_FAULT_OVERTEMP;
1083
1084 return (0);
1085 }
1086
1087 static int
1088 logpage_selftest_analyze(ds_scsi_info_t *sip, scsi_log_parameter_header_t *lphp,
1089 int log_length)
1090 {
1091 int i, plen = 0;
1092 int entries = 0;
1093 ushort_t param_code;
1094 scsi_selftest_log_param_t *stp;
1095 nvlist_t *nvl;
1096
1097 assert(sip->si_dsp->ds_testfail == NULL);
1098 if (nvlist_alloc(&sip->si_dsp->ds_testfail, NV_UNIQUE_NAME, 0) != 0)
1099 return (scsi_set_errno(sip, EDS_NOMEM));
1100 nvl = sip->si_dsp->ds_testfail;
1101
|
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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2017 RackTop Systems.
26 */
27
28 #include <assert.h>
29 #include <errno.h>
30 #include <libdiskstatus.h>
31 #include <limits.h>
32 #include <stdlib.h>
33 #include <strings.h>
34 #include <sys/fm/io/scsi.h>
35
36 #include "ds_scsi.h"
37 #include "ds_scsi_sim.h"
38 #include "ds_scsi_uscsi.h"
39
40 typedef struct ds_scsi_info {
41 disk_status_t *si_dsp;
42 void *si_sim;
43 int si_cdblen;
44 int si_supp_mode;
45 int si_supp_log;
46 int si_extensions;
47 int si_reftemp;
1060 return (scsi_set_errno(sip, EDS_NOMEM));
1061 curtemp = temp->t_temp;
1062 break;
1063
1064 case LOGPARAM_TEMP_REFTEMP:
1065 if (lphp->lph_length != LOGPARAM_TEMP_LEN)
1066 break;
1067
1068 if (nvlist_add_uint8(nvl,
1069 FM_EREPORT_PAYLOAD_SCSI_THRESHTEMP,
1070 temp->t_temp) != 0)
1071 return (scsi_set_errno(sip, EDS_NOMEM));
1072 reftemp = temp->t_temp;
1073 break;
1074 }
1075
1076 plen = lphp->lph_length +
1077 sizeof (scsi_log_parameter_header_t);
1078 }
1079
1080 /*
1081 * Take the reference temperature under advisory since it is often
1082 * reported incorrectly. If it's 40C or less we ignore it and only
1083 * register a fault once the current temperature reaches above 60C.
1084 */
1085 if (reftemp != INVALID_TEMPERATURE && curtemp != INVALID_TEMPERATURE &&
1086 curtemp > reftemp && (reftemp > 40 || curtemp > 60))
1087 sip->si_dsp->ds_faults |= DS_FAULT_OVERTEMP;
1088
1089 return (0);
1090 }
1091
1092 static int
1093 logpage_selftest_analyze(ds_scsi_info_t *sip, scsi_log_parameter_header_t *lphp,
1094 int log_length)
1095 {
1096 int i, plen = 0;
1097 int entries = 0;
1098 ushort_t param_code;
1099 scsi_selftest_log_param_t *stp;
1100 nvlist_t *nvl;
1101
1102 assert(sip->si_dsp->ds_testfail == NULL);
1103 if (nvlist_alloc(&sip->si_dsp->ds_testfail, NV_UNIQUE_NAME, 0) != 0)
1104 return (scsi_set_errno(sip, EDS_NOMEM));
1105 nvl = sip->si_dsp->ds_testfail;
1106
|