cmd_hc_sun4v.c revision 9f69d791af115871f09fc0bc61acef99da23150b
e97130129ddee9f8432c6fff2dac3c6765280066tsien * CDDL HEADER START
e97130129ddee9f8432c6fff2dac3c6765280066tsien * The contents of this file are subject to the terms of the
e97130129ddee9f8432c6fff2dac3c6765280066tsien * Common Development and Distribution License (the "License").
e97130129ddee9f8432c6fff2dac3c6765280066tsien * You may not use this file except in compliance with the License.
e97130129ddee9f8432c6fff2dac3c6765280066tsien * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
e97130129ddee9f8432c6fff2dac3c6765280066tsien * See the License for the specific language governing permissions
e97130129ddee9f8432c6fff2dac3c6765280066tsien * and limitations under the License.
e97130129ddee9f8432c6fff2dac3c6765280066tsien * When distributing Covered Code, include this CDDL HEADER in each
e97130129ddee9f8432c6fff2dac3c6765280066tsien * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e97130129ddee9f8432c6fff2dac3c6765280066tsien * If applicable, add the following below this CDDL HEADER, with the
e97130129ddee9f8432c6fff2dac3c6765280066tsien * fields enclosed by brackets "[]" replaced with your own identifying
e97130129ddee9f8432c6fff2dac3c6765280066tsien * information: Portions Copyright [yyyy] [name of copyright owner]
e97130129ddee9f8432c6fff2dac3c6765280066tsien * CDDL HEADER END
9f69d791af115871f09fc0bc61acef99da23150btd * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
e97130129ddee9f8432c6fff2dac3c6765280066tsien * Use is subject to license terms.
e97130129ddee9f8432c6fff2dac3c6765280066tsien#pragma ident "%Z%%M% %I% %E% SMI"
e97130129ddee9f8432c6fff2dac3c6765280066tsiencmd_fault_add_location(fmd_hdl_t *hdl, nvlist_t *flt, const char *locstr) {
9f69d791af115871f09fc0bc61acef99da23150btd char *t, *s;
e97130129ddee9f8432c6fff2dac3c6765280066tsien if (nvlist_lookup_string(flt, FM_FAULT_LOCATION, &t) == 0)
9f69d791af115871f09fc0bc61acef99da23150btd /* Replace occurrence of ": " with "/" to avoid confusing ILOM. */
9f69d791af115871f09fc0bc61acef99da23150btd if (s != NULL) {
9f69d791af115871f09fc0bc61acef99da23150btd /* Also, remove any J number from end of this string. */
9f69d791af115871f09fc0bc61acef99da23150btd *s = '\0';
e97130129ddee9f8432c6fff2dac3c6765280066tsien fmd_hdl_error(hdl, "unable to alloc location for fault\n");
13faa91230bde46da937bf33010b9accc5bdeb59sdtypedef struct tr_ent {
13faa91230bde46da937bf33010b9accc5bdeb59sd const char *nac_component;
13faa91230bde46da937bf33010b9accc5bdeb59sd const char *hc_component;
13faa91230bde46da937bf33010b9accc5bdeb59sdmap_name(const char *p) {
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < tr_tbl_n; i++) {
13faa91230bde46da937bf33010b9accc5bdeb59sd return (i);
13faa91230bde46da937bf33010b9accc5bdeb59sd return (-1);
13faa91230bde46da937bf33010b9accc5bdeb59sd * This version of breakup_components assumes that all component names which
13faa91230bde46da937bf33010b9accc5bdeb59sd * it sees are of the form: <nonnumeric piece><numeric piece>
13faa91230bde46da937bf33010b9accc5bdeb59sd * i.e. no embedded numerals in component name which have to be spelled out.
13faa91230bde46da937bf33010b9accc5bdeb59sdcmd_breakup_components(char *str, char *sep, nvlist_t **hc_nvl)
13faa91230bde46da937bf33010b9accc5bdeb59sd continue; /* skip names that don't map */
13faa91230bde46da937bf33010b9accc5bdeb59sd if (instlen == 0) {
13faa91230bde46da937bf33010b9accc5bdeb59sd nvlist_add_string(hc_nvl[i], FM_FMRI_HC_ID, instbuf) != 0)
13faa91230bde46da937bf33010b9accc5bdeb59sd return (-1);
13faa91230bde46da937bf33010b9accc5bdeb59sd return (1);
13faa91230bde46da937bf33010b9accc5bdeb59sd if (nvlist_lookup_string(asru, FM_FMRI_CPU_CPUFRU, &cpufru) == 0) {
13faa91230bde46da937bf33010b9accc5bdeb59sd fmd_hdl_debug(hdl, "cmd_getfru_loc: Default fruloc=empty string\n");
13faa91230bde46da937bf33010b9accc5bdeb59sdcmd_mkboard_fru(fmd_hdl_t *hdl, char *frustr, char *serialstr, char *partstr) {
13faa91230bde46da937bf33010b9accc5bdeb59sd int n, i, len;
13faa91230bde46da937bf33010b9accc5bdeb59sd fmd_hdl_debug(hdl, "cmd_mkboard_fru: nac=%s components=%d\n", nac, n);
13faa91230bde46da937bf33010b9accc5bdeb59sd hc_list = fmd_hdl_zalloc(hdl, sizeof (nvlist_t *)*n, FMD_SLEEP);
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < n; i++) {
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < n; i++) {
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < n; i++) {
fbd1c0dae6f4a2ccc2ce0527c7f19d3dd5ea90b8sd if (nvlist_add_uint8(fru, FM_VERSION, FM_HC_SCHEME_VERSION) != 0 ||
fbd1c0dae6f4a2ccc2ce0527c7f19d3dd5ea90b8sd nvlist_add_string(fru, FM_FMRI_SCHEME, FM_FMRI_SCHEME_HC) != 0 ||
13faa91230bde46da937bf33010b9accc5bdeb59sd nvlist_add_nvlist_array(fru, FM_FMRI_HC_LIST, hc_list, n) != 0) {
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < n; i++) {
13faa91230bde46da937bf33010b9accc5bdeb59sd for (i = 0; i < n; i++) {
fbd1c0dae6f4a2ccc2ce0527c7f19d3dd5ea90b8sd nvlist_add_string(fru, FM_FMRI_HC_SERIAL_ID, serialstr) != 0) ||
fbd1c0dae6f4a2ccc2ce0527c7f19d3dd5ea90b8sd nvlist_add_string(fru, FM_FMRI_HC_PART, partstr) != 0)) {
13faa91230bde46da937bf33010b9accc5bdeb59sdcmd_boardfru_create_fault(fmd_hdl_t *hdl, nvlist_t *asru, const char *fltnm,
13faa91230bde46da937bf33010b9accc5bdeb59sd if (nvlist_lookup_string(asru, FM_FMRI_HC_SERIAL_ID, &serialstr) != 0)
13faa91230bde46da937bf33010b9accc5bdeb59sd if (nvlist_lookup_string(asru, FM_FMRI_HC_PART, &partstr) != 0)
13faa91230bde46da937bf33010b9accc5bdeb59sd flt = cmd_nvl_create_fault(hdl, fltnm, cert, nvlfru, nvlfru, NULL);
13faa91230bde46da937bf33010b9accc5bdeb59sd/* find_mb -- find hardware platform motherboard within libtopo */
13faa91230bde46da937bf33010b9accc5bdeb59sd/* ARGSUSED */
13faa91230bde46da937bf33010b9accc5bdeb59sd if (nvlist_lookup_nvlist_array(rsrc, FM_FMRI_HC_LIST, &hcl, &n) < 0) {
13faa91230bde46da937bf33010b9accc5bdeb59sd if (nvlist_lookup_string(hcl[0], FM_FMRI_HC_NAME, &name) != 0) {
13faa91230bde46da937bf33010b9accc5bdeb59sd/* init_mb -- read hardware platform motherboard from libtopo */