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
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.
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]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
36 #include <fm/fmd_api.h>
37 #include <sys/fm/protocol.h>
38 #include <sys/processor.h>
41 cda_cpu_offline(fmd_hdl_t
*hdl
, uint_t cpuid
, int cpustate
)
45 for (i
= 0; i
< cda
.cda_cpu_tries
;
46 i
++, (void) nanosleep(&cda
.cda_cpu_delay
, NULL
)) {
47 if (p_online(cpuid
, cpustate
) != -1) {
48 fmd_hdl_debug(hdl
, "offlined cpu %u\n", cpuid
);
49 cda_stats
.dp_offs
.fmds_value
.ui64
++;
54 fmd_hdl_debug(hdl
, "failed to offline %u: %s\n", cpuid
,
56 cda_stats
.dp_fails
.fmds_value
.ui64
++;
61 cda_dp_retire(fmd_hdl_t
*hdl
, nvlist_t
*nvl
, nvlist_t
*asru
, const char *uuid
)
69 /* Get the hc-list of elements in FMRI, and the size of the list */
70 if (nvlist_lookup_nvlist_array(asru
, FM_FMRI_HC_LIST
, &hc_prs
,
72 fmd_hdl_debug(hdl
, "failed to get '%s' from dp fault\n",
77 /* walk hc-list and offline each CPU present */
78 for (ii
= 0; ii
< hc_nprs
; ii
++) {
79 int cpustate
= P_FAULTED
;
81 if (nvlist_lookup_string(hc_prs
[ii
], FM_FMRI_HC_ID
, &id
) != 0) {
82 fmd_hdl_debug(hdl
, "dp fault missing '%s'\n",
84 cda_stats
.bad_flts
.fmds_value
.ui64
++;
89 if (!cda
.cda_cpu_dooffline
) {
90 fmd_hdl_debug(hdl
, "dp suppressed offline of "
92 cda_stats
.dp_supp
.fmds_value
.ui64
++;
96 if (cda
.cda_cpu_forcedoffline
)
99 cda_cpu_offline(hdl
, cpuid
, cpustate
);