Mercurial > illumos > illumos-gate
changeset 3657:52fa1667b7c1
6496714 cpu/mem de source of ereport.fm.fmd.module
6504751 CPU/Mem DE not issuing correct faults for L2 caches
6505708 Faults for MAU not in hc scheme
6506208 CPU/Mem DE to fill in location field in fault event
6510226 FRU FMRI for sun4v cpu faults should be canonical hc: scheme, not legacy hc:
6510228 sun4v page fault FRU FMRI should be hc: scheme
6511726 L2 Cache Directory Fatal faults display "l2ctl" but should be "l2cachectl"
6516824 fmd leaks in cmd_xxu_hdlr
6519408 SERD engine does not work for ce errors.
6520375 silently drop FBR ereports until policy agreed upon
line wrap: on
line diff
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/Makefile.cpumem Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/Makefile.cpumem Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -43,7 +43,6 @@ cmd_pageerr.c \ cmd_state.c \ cmd_util.c \ - cmd_hc.c \ $($(ARCH)_SRCS) include ../../Makefile.plugin
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.c Thu Feb 15 09:43:19 2007 -0800 @@ -54,6 +54,7 @@ #else /* sun4u */ #include <sys/niagararegs.h> #include <sys/fm/cpu/UltraSPARC-T1.h> +#include <cmd_hc_sun4v.h> #endif /* sun4u */ #define CMD_CPU_UEC_INCR 10 @@ -1437,16 +1438,23 @@ } cpui = cpu_create(hdl, asru, i, CMD_CPU_LEVEL_THREAD, cpu->cpu_type); + nvlist_free(asru); } cpui->cpu_faulting = FMD_B_TRUE; cpu_buf_write(hdl, cpui); flt = fmd_nvl_create_fault(hdl, fltnm, cert, cpui->cpu_asru_nvl, cpu->cpu_fru_nvl, rsrc); +#ifdef sun4v + flt = cmd_fault_add_location(hdl, flt, "MB"); +#endif /* sun4v */ fmd_case_add_suspect(hdl, casep, flt); } } else { flt = fmd_nvl_create_fault(hdl, fltnm, cert, cpu->cpu_asru_nvl, cpu->cpu_fru_nvl, rsrc); +#ifdef sun4v + flt = cmd_fault_add_location(hdl, flt, "MB"); +#endif /* sun4v */ fmd_case_add_suspect(hdl, casep, flt); } } @@ -1507,64 +1515,17 @@ } static nvlist_t * -cpu_mkfru(char *frustr, char *serialstr, char *partstr) -{ - char *comp; - nvlist_t *fru, *hcelem; - - if (strncmp(frustr, CPU_FRU_FMRI, sizeof (CPU_FRU_FMRI) - 1) != 0) - return (NULL); - - comp = frustr + sizeof (CPU_FRU_FMRI) - 1; - - if (nvlist_alloc(&hcelem, NV_UNIQUE_NAME, 0) != 0) - return (NULL); - - if (nvlist_add_string(hcelem, FM_FMRI_HC_NAME, - FM_FMRI_LEGACY_HC) != 0 || - nvlist_add_string(hcelem, FM_FMRI_HC_ID, comp) != 0) { - nvlist_free(hcelem); - return (NULL); - } - - if (nvlist_alloc(&fru, NV_UNIQUE_NAME, 0) != 0) { - nvlist_free(hcelem); - return (NULL); - } - - if (nvlist_add_uint8(fru, FM_VERSION, FM_HC_SCHEME_VERSION) != 0 || - nvlist_add_string(fru, FM_FMRI_SCHEME, FM_FMRI_SCHEME_HC) != 0 || - (partstr != NULL && - nvlist_add_string(fru, FM_FMRI_HC_PART, partstr) != 0) || - (serialstr != NULL && - nvlist_add_string(fru, FM_FMRI_HC_SERIAL_ID, - serialstr) != 0) || - nvlist_add_string(fru, FM_FMRI_HC_ROOT, "") != 0 || - nvlist_add_uint32(fru, FM_FMRI_HC_LIST_SZ, 1) != 0 || - nvlist_add_nvlist_array(fru, FM_FMRI_HC_LIST, &hcelem, 1) != 0) { - nvlist_free(hcelem); - nvlist_free(fru); - return (NULL); - } - - nvlist_free(hcelem); - return (fru); -} - -static nvlist_t * cpu_getfru(fmd_hdl_t *hdl, cmd_cpu_t *cp) { char *frustr, *partstr, *serialstr; nvlist_t *nvlp; if ((frustr = cmd_cpu_getfrustr(hdl, cp)) == NULL) { - fmd_hdl_error(hdl, "failed to retrieve FRU string for CPU %d", - cp->cpu_cpuid); return (NULL); } partstr = cmd_cpu_getpartstr(hdl, cp); serialstr = cmd_cpu_getserialstr(hdl, cp); - nvlp = cpu_mkfru(frustr, serialstr, partstr); + nvlp = cmd_cpu_mkfru(frustr, serialstr, partstr); fmd_hdl_strfree(hdl, frustr); fmd_hdl_strfree(hdl, partstr); fmd_hdl_strfree(hdl, serialstr);
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.h Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.h Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -484,6 +484,16 @@ const char *, cmd_errcl_t); /* + * As of Niagara-2, we ignore writeback (ldwc, ldwu) errors. Since these were + * the only defined follow-on errors for sun4v trains, sun4v L2 cache data + * errors no longer need to use the train mechanism. + */ + +extern cmd_evdisp_t cmd_l2c(fmd_hdl_t *, fmd_event_t *, nvlist_t *, + const char *, cmd_errcl_t); +extern cmd_evdisp_t cmd_l2u(fmd_hdl_t *, fmd_event_t *, nvlist_t *, + const char *, cmd_errcl_t); +/* * L2$ and L3$ Tag errors * * SERD name @@ -655,6 +665,7 @@ extern char *cmd_cpu_getpartstr(fmd_hdl_t *, cmd_cpu_t *); extern char *cmd_cpu_getserialstr(fmd_hdl_t *, cmd_cpu_t *); +extern nvlist_t *cmd_cpu_mkfru(char *, char *, char *); extern cmd_cpu_t *cmd_cpu_lookup(fmd_hdl_t *, nvlist_t *, const char *, uint8_t);
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpuerr.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpuerr.c Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -129,13 +129,15 @@ CMD_CPU_SIMPLEHANDLER(mau, mau, CMD_PTR_CPU_MAU, "mau", "mau") CMD_CPU_SIMPLEHANDLER(miscregs_ce, misc_regs, CMD_PTR_CPU_MISC_REGS, "misc_regs", "misc_regs") +CMD_CPU_SIMPLEHANDLER(l2c, l2data, CMD_PTR_CPU_L2DATA, "l2data", "l2data-c") CMD_CPU_SIMPLEHANDLER(fpu, fpu, CMD_PTR_CPU_FPU, "", "fpu") -CMD_CPU_SIMPLEHANDLER(l2ctl, l2ctl, CMD_PTR_CPU_L2CTL, "", "l2ctl") +CMD_CPU_SIMPLEHANDLER(l2ctl, l2ctl, CMD_PTR_CPU_L2CTL, "", "l2cachectl") CMD_CPU_SIMPLEHANDLER(iru, ireg, CMD_PTR_CPU_IREG, "", "ireg") CMD_CPU_SIMPLEHANDLER(fru, freg, CMD_PTR_CPU_FREG, "", "freg") CMD_CPU_SIMPLEHANDLER(miscregs_ue, misc_regs, CMD_PTR_CPU_MISC_REGS, "", "misc_regs") +CMD_CPU_SIMPLEHANDLER(l2u, l2data, CMD_PTR_CPU_L2DATA, "", "l2data-u") #ifdef sun4u @@ -304,6 +306,7 @@ fmd_case_add_ereport(hdl, cc->cc_cp, ep); cmd_cpu_create_faultlist(hdl, cc->cc_cp, cpu, ed->ed_fltnm, rsrc, 100); + nvlist_free(rsrc); fmd_case_solve(hdl, cc->cc_cp); } @@ -344,6 +347,7 @@ fmd_case_add_serd(hdl, cc->cc_cp, cc->cc_serdnm); cmd_cpu_create_faultlist(hdl, cc->cc_cp, cpu, ed->ed_fltnm, rsrc, 100); + nvlist_free(rsrc); fmd_case_solve(hdl, cc->cc_cp); } @@ -484,10 +488,19 @@ return (cmd_xr_reschedule(hdl, xr, hdlrid)); } +#ifdef sun4v +#define CMD_NIAGARA_1_CLASS "ereport.cpu.ultraSPARC-T1." +#endif /* sun4v */ + cmd_evdisp_t cmd_xxu(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class, cmd_errcl_t clcode) { +#ifdef sun4v + if (strncmp(class, CMD_NIAGARA_1_CLASS, + sizeof (CMD_NIAGARA_1_CLASS)) != 0) + return (cmd_l2u(hdl, ep, nvl, class, clcode)); +#endif /* sun4v */ return (cmd_xxcu_initial(hdl, ep, nvl, class, clcode, CMD_XR_HDLR_XXU)); } @@ -495,6 +508,11 @@ cmd_xxc(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class, cmd_errcl_t clcode) { +#ifdef sun4v + if (strncmp(class, CMD_NIAGARA_1_CLASS, + sizeof (CMD_NIAGARA_1_CLASS)) != 0) + return (cmd_l2c(hdl, ep, nvl, class, clcode)); +#endif /* sun4v */ return (cmd_xxcu_initial(hdl, ep, nvl, class, clcode, CMD_XR_HDLR_XXC)); }
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_dimm.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_dimm.c Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -43,6 +43,9 @@ #include <sys/fm/protocol.h> #include <sys/mem.h> #include <sys/nvpair.h> +#ifdef sun4v +#include <cmd_hc_sun4v.h> +#endif /* sun4v */ /* * Some errors (RxE/FRx pairs) don't have accurate DIMM (resource) FMRIs, @@ -78,8 +81,9 @@ uint_t cert) { #ifdef sun4v - return (fmd_nvl_create_fault(hdl, fltnm, cert, dimm->dimm_asru_nvl, - cmd_mem2hc(hdl, dimm->dimm_asru_nvl), NULL)); + nvlist_t *flt = fmd_nvl_create_fault(hdl, fltnm, cert, + dimm->dimm_asru_nvl, cmd_mem2hc(hdl, dimm->dimm_asru_nvl), NULL); + return (cmd_fault_add_location(hdl, flt, dimm->dimm_unum)); #else return (fmd_nvl_create_fault(hdl, fltnm, cert, dimm->dimm_asru_nvl, dimm->dimm_asru_nvl, NULL));
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_hc.c Thu Feb 15 07:08:19 2007 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/nvpair.h> -#include <cmd.h> -#include <errno.h> -#include <string.h> -#include <sys/fm/util.h> -#include <fm/fmd_api.h> -#include <sys/fm/protocol.h> - - -/* - * Set-up and validate the members of an hc fmri according to; - * - * Member name Type Value - * =================================================== - * version uint8_t 0 - * auth nvlist_t <auth> - * hc-name string <name> - * hc-id string <id> - * - * Note that auth and hc-id are optional members. - */ - -#define HC_MAXPAIRS 20 -#define HC_MAXNAMELEN 50 - -static int -cmd_fmri_hc_set_common(nvlist_t *fmri, int version, const nvlist_t *auth) -{ - if (version != FM_HC_SCHEME_VERSION) { - return (0); - } - - if (nvlist_add_uint8(fmri, FM_VERSION, version) != 0 || - nvlist_add_string(fmri, FM_FMRI_SCHEME, FM_FMRI_SCHEME_HC) != 0) { - return (0); - } - - if (auth != NULL && nvlist_add_nvlist(fmri, FM_FMRI_AUTHORITY, - (nvlist_t *)auth) != 0) { - return (0); - } - - return (1); -} - -int -cmd_fmri_hc_set(fmd_hdl_t *hdl, nvlist_t *fmri, int version, - const nvlist_t *auth, nvlist_t *snvl, int npairs, ...) -{ - nvlist_t *pairs[HC_MAXPAIRS]; - va_list ap; - int err = 0; - int i, j; - - if (!cmd_fmri_hc_set_common(fmri, version, auth)) - return (1); - - npairs = MIN(npairs, HC_MAXPAIRS); - - va_start(ap, npairs); - for (i = 0; i < npairs; i++) { - const char *name = va_arg(ap, const char *); - uint32_t id = va_arg(ap, uint32_t); - char idstr[11]; - - (void) snprintf(idstr, sizeof (idstr), "%u", id); - - if (nvlist_alloc(&pairs[i], NV_UNIQUE_NAME, 0) != 0) { - fmd_hdl_debug(hdl, "nvlist_alloc failed\n"); - goto cleanup; - } - - err |= nvlist_add_string(pairs[i], FM_FMRI_HC_NAME, name); - err |= nvlist_add_string(pairs[i], FM_FMRI_HC_ID, idstr); - } - va_end(ap); - - err |= nvlist_add_string(fmri, FM_FMRI_HC_ROOT, ""); - err |= nvlist_add_uint32(fmri, FM_FMRI_HC_LIST_SZ, npairs); - err |= nvlist_add_nvlist_array(fmri, FM_FMRI_HC_LIST, pairs, npairs); - - if (snvl != NULL) - err |= nvlist_add_nvlist(fmri, FM_FMRI_HC_SPECIFIC, snvl); - -cleanup: - for (j = 0; j < i; j++) - nvlist_free(pairs[j]); - - if (err) - fmd_hdl_debug(hdl, "cmd_fmri_hc_set: failed to set fmri\n"); - - return (err); -}
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_main.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_main.c Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -308,7 +308,7 @@ CMD_CPU_LEVEL_CHIP }, { "ereport.cpu.*.lvu", cmd_l2ctl }, { "ereport.cpu.*.lru", cmd_l2ctl }, - { "ereport.cpu.*.fbr", cmd_ce, CMD_ERRCL_DAC }, + { "ereport.cpu.*.fbr", cmd_nop }, { "ereport.cpu.*.fbu", cmd_ue, CMD_ERRCL_DAU }, { "ereport.cpu.*.dac", cmd_ce, CMD_ERRCL_DAC }, { "ereport.cpu.*.dsc", cmd_ce, CMD_ERRCL_DSC },
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_pageerr.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_pageerr.c Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,6 +37,10 @@ #include <string.h> #include <fm/fmd_api.h> #include <sys/fm/protocol.h> +#ifdef sun4v +#include <cmd_hc_sun4v.h> +#include <cmd_dimm.h> +#endif void cmd_page_fault(fmd_hdl_t *hdl, nvlist_t *modasru, nvlist_t *modfru, @@ -61,8 +65,14 @@ page->page_case.cc_cp = cmd_case_create(hdl, &page->page_header, CMD_PTR_PAGE_CASE, &uuid); +#ifdef sun4v + flt = fmd_nvl_create_fault(hdl, "fault.memory.page", 100, + page->page_asru_nvl, cmd_mem2hc(hdl, modfru), NULL); + flt = cmd_fault_add_location(hdl, flt, cmd_fmri_get_unum(modfru)); +#else /* sun4v */ flt = fmd_nvl_create_fault(hdl, "fault.memory.page", 100, page->page_asru_nvl, modfru, NULL); +#endif /* sun4v */ if (nvlist_add_boolean_value(flt, FM_SUSPECT_MESSAGE, B_FALSE) != 0) fmd_hdl_abort(hdl, "failed to add no-message member to fault");
--- a/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/Makefile Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/Makefile Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #pragma ident "%Z%%M% %I% %E% SMI" @@ -30,6 +30,7 @@ cmd_dp.c \ cmd_dperr.c \ cmd_dp_page.c \ + cmd_hc_opl.c \ cmd_opl.c \ cmd_oplerr.c
--- a/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_cpu_arch.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_cpu_arch.c Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -147,3 +147,48 @@ cmd_cpu_getserialstr(fmd_hdl_t *hdl, cmd_cpu_t *cp) { return (NULL); } + +nvlist_t * +cmd_cpu_mkfru(char *frustr, char *serialstr, char *partstr) +{ + char *comp; + nvlist_t *fru, *hcelem; + + if (strncmp(frustr, CPU_FRU_FMRI, sizeof (CPU_FRU_FMRI) - 1) != 0) + return (NULL); + + comp = frustr + sizeof (CPU_FRU_FMRI) - 1; + + if (nvlist_alloc(&hcelem, NV_UNIQUE_NAME, 0) != 0) + return (NULL); + + if (nvlist_add_string(hcelem, FM_FMRI_HC_NAME, + FM_FMRI_LEGACY_HC) != 0 || + nvlist_add_string(hcelem, FM_FMRI_HC_ID, comp) != 0) { + nvlist_free(hcelem); + return (NULL); + } + + if (nvlist_alloc(&fru, NV_UNIQUE_NAME, 0) != 0) { + nvlist_free(hcelem); + return (NULL); + } + + if (nvlist_add_uint8(fru, FM_VERSION, FM_HC_SCHEME_VERSION) != 0 || + nvlist_add_string(fru, FM_FMRI_SCHEME, FM_FMRI_SCHEME_HC) != 0 || + (partstr != NULL && + nvlist_add_string(fru, FM_FMRI_HC_PART, partstr) != 0) || + (serialstr != NULL && + nvlist_add_string(fru, FM_FMRI_HC_SERIAL_ID, + serialstr) != 0) || + nvlist_add_string(fru, FM_FMRI_HC_ROOT, "") != 0 || + nvlist_add_uint32(fru, FM_FMRI_HC_LIST_SZ, 1) != 0 || + nvlist_add_nvlist_array(fru, FM_FMRI_HC_LIST, &hcelem, 1) != 0) { + nvlist_free(hcelem); + nvlist_free(fru); + return (NULL); + } + + nvlist_free(hcelem); + return (fru); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_hc_opl.c Thu Feb 15 09:43:19 2007 -0800 @@ -0,0 +1,123 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/time.h> +#include <sys/nvpair.h> +#include <cmd.h> +#include <errno.h> +#include <string.h> +#include <sys/fm/util.h> +#include <fm/fmd_api.h> +#include <sys/fm/protocol.h> + + +/* + * Set-up and validate the members of an hc fmri according to; + * + * Member name Type Value + * =================================================== + * version uint8_t 0 + * auth nvlist_t <auth> + * hc-name string <name> + * hc-id string <id> + * + * Note that auth and hc-id are optional members. + */ + +#define HC_MAXPAIRS 20 +#define HC_MAXNAMELEN 50 + +static int +cmd_fmri_hc_set_common(nvlist_t *fmri, int version, const nvlist_t *auth) +{ + if (version != FM_HC_SCHEME_VERSION) { + return (0); + } + + if (nvlist_add_uint8(fmri, FM_VERSION, version) != 0 || + nvlist_add_string(fmri, FM_FMRI_SCHEME, FM_FMRI_SCHEME_HC) != 0) { + return (0); + } + + if (auth != NULL && nvlist_add_nvlist(fmri, FM_FMRI_AUTHORITY, + (nvlist_t *)auth) != 0) { + return (0); + } + + return (1); +} + +int +cmd_fmri_hc_set(fmd_hdl_t *hdl, nvlist_t *fmri, int version, + const nvlist_t *auth, nvlist_t *snvl, int npairs, ...) +{ + nvlist_t *pairs[HC_MAXPAIRS]; + va_list ap; + int err = 0; + int i, j; + + if (!cmd_fmri_hc_set_common(fmri, version, auth)) + return (1); + + npairs = MIN(npairs, HC_MAXPAIRS); + + va_start(ap, npairs); + for (i = 0; i < npairs; i++) { + const char *name = va_arg(ap, const char *); + uint32_t id = va_arg(ap, uint32_t); + char idstr[11]; + + (void) snprintf(idstr, sizeof (idstr), "%u", id); + + if (nvlist_alloc(&pairs[i], NV_UNIQUE_NAME, 0) != 0) { + fmd_hdl_debug(hdl, "nvlist_alloc failed\n"); + goto cleanup; + } + + err |= nvlist_add_string(pairs[i], FM_FMRI_HC_NAME, name); + err |= nvlist_add_string(pairs[i], FM_FMRI_HC_ID, idstr); + } + va_end(ap); + + err |= nvlist_add_string(fmri, FM_FMRI_HC_ROOT, ""); + err |= nvlist_add_uint32(fmri, FM_FMRI_HC_LIST_SZ, npairs); + err |= nvlist_add_nvlist_array(fmri, FM_FMRI_HC_LIST, pairs, npairs); + + if (snvl != NULL) + err |= nvlist_add_nvlist(fmri, FM_FMRI_HC_SPECIFIC, snvl); + +cleanup: + for (j = 0; j < i; j++) + nvlist_free(pairs[j]); + + if (err) + fmd_hdl_debug(hdl, "cmd_fmri_hc_set: failed to set fmri\n"); + + return (err); +}
--- a/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/Makefile Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/Makefile Thu Feb 15 09:43:19 2007 -0800 @@ -19,13 +19,15 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" ARCH = sun4v +sun4v_SRCS = cmd_hc_sun4v.c + INCDIRS = $(SRC)/uts/sun4v \ $(ROOT)/usr/platform/sun4v/include
--- a/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_cpu_arch.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_cpu_arch.c Thu Feb 15 09:43:19 2007 -0800 @@ -239,3 +239,44 @@ else return (NULL); } + +nvlist_t * +cmd_cpu_mkfru(char *frustr, char *serialstr, char *partstr) +{ + nvlist_t *fru, *hcelem; + + if (strncmp(frustr, CPU_FRU_FMRI, sizeof (CPU_FRU_FMRI) - 1) != 0) + return (NULL); + + if (nvlist_alloc(&hcelem, NV_UNIQUE_NAME, 0) != 0) + return (NULL); + + if (nvlist_add_string(hcelem, FM_FMRI_HC_NAME, "motherboard") != 0 || + nvlist_add_string(hcelem, FM_FMRI_HC_ID, "0") != 0) { + nvlist_free(hcelem); + return (NULL); + } + + if (nvlist_alloc(&fru, NV_UNIQUE_NAME, 0) != 0) { + nvlist_free(hcelem); + return (NULL); + } + + if (nvlist_add_uint8(fru, FM_VERSION, FM_HC_SCHEME_VERSION) != 0 || + nvlist_add_string(fru, FM_FMRI_SCHEME, FM_FMRI_SCHEME_HC) != 0 || + (partstr != NULL && + nvlist_add_string(fru, FM_FMRI_HC_PART, partstr) != 0) || + (serialstr != NULL && + nvlist_add_string(fru, FM_FMRI_HC_SERIAL_ID, + serialstr) != 0) || + nvlist_add_string(fru, FM_FMRI_HC_ROOT, "") != 0 || + nvlist_add_uint32(fru, FM_FMRI_HC_LIST_SZ, 1) != 0 || + nvlist_add_nvlist_array(fru, FM_FMRI_HC_LIST, &hcelem, 1) != 0) { + nvlist_free(hcelem); + nvlist_free(fru); + return (NULL); + } + + nvlist_free(hcelem); + return (fru); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_hc_sun4v.c Thu Feb 15 09:43:19 2007 -0800 @@ -0,0 +1,41 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <fm/fmd_api.h> +#include <sys/fm/protocol.h> + +nvlist_t * +cmd_fault_add_location(fmd_hdl_t *hdl, nvlist_t *flt, const char *locstr) { + + char *t; + + if (nvlist_lookup_string(flt, FM_FAULT_LOCATION, &t) == 0) + return (flt); /* already has location value */ + if (nvlist_add_string(flt, FM_FAULT_LOCATION, locstr) != 0) + fmd_hdl_error(hdl, "unable to alloc location for fault\n"); + return (flt); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_hc_sun4v.h Thu Feb 15 09:43:19 2007 -0800 @@ -0,0 +1,44 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _CMD_HC_SUN4V_H +#define _CMD_HC_SUN4V_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <fm/fmd_api.h> +#include <sys/nvpair.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern nvlist_t *cmd_fault_add_location(fmd_hdl_t *, nvlist_t *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _CMD_HC_SUN4V_H */
--- a/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_memerr_arch.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_memerr_arch.c Thu Feb 15 09:43:19 2007 -0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -111,7 +111,7 @@ uint8_t afar_status, synd_status; nvlist_t *rsrc; char *typenm; - uint64_t disp; + uint64_t disp = 0; int minorvers = 1; if (nvlist_lookup_uint64(nvl, @@ -187,10 +187,6 @@ return (CMD_EVD_UNUSED); } - if (nvlist_lookup_uint64(nvl, FM_EREPORT_PAYLOAD_NAME_ERR_DISP, - &disp) != 0) - minorvers = 0; - return (hdlr(hdl, ep, nvl, class, afar, afar_status, synd, synd_status, cmd_mem_name2type(typenm, minorvers), disp, rsrc)); }
--- a/usr/src/cmd/fm/modules/sun4v/cpumem-retire/cma_main.c Thu Feb 15 07:08:19 2007 -0800 +++ b/usr/src/cmd/fm/modules/sun4v/cpumem-retire/cma_main.c Thu Feb 15 09:43:19 2007 -0800 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -90,6 +90,10 @@ FM_CPU_SCHEME_VERSION, NULL }, { "fault.cpu.*.l2cachectl", FM_FMRI_SCHEME_CPU, FM_CPU_SCHEME_VERSION, NULL }, + { "fault.cpu.*.l2data-c", FM_FMRI_SCHEME_CPU, + FM_CPU_SCHEME_VERSION, NULL }, + { "fault.cpu.*.l2data-u", FM_FMRI_SCHEME_CPU, + FM_CPU_SCHEME_VERSION, NULL }, { "fault.cpu.*.mau", FM_FMRI_SCHEME_CPU, FM_CPU_SCHEME_VERSION, NULL }, { "fault.cpu.*", FM_FMRI_SCHEME_CPU, FM_CPU_SCHEME_VERSION,