cmd_cpu_arch.c revision a255420765b0b2d93935f09709ebad35f6aa7ee3
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien/*
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * CDDL HEADER START
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien *
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * The contents of this file are subject to the terms of the
2f48339a0c14421b8826b39fc3ab783a064cb77bjc * Common Development and Distribution License (the "License").
2f48339a0c14421b8826b39fc3ab783a064cb77bjc * You may not use this file except in compliance with the License.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien *
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * or http://www.opensolaris.org/os/licensing.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * See the License for the specific language governing permissions
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * and limitations under the License.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien *
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * When distributing Covered Code, include this CDDL HEADER in each
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * If applicable, add the following below this CDDL HEADER, with the
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * fields enclosed by brackets "[]" replaced with your own identifying
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * information: Portions Copyright [yyyy] [name of copyright owner]
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien *
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * CDDL HEADER END
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien */
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien/*
2f48339a0c14421b8826b39fc3ab783a064cb77bjc * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * Use is subject to license terms.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien */
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#pragma ident "%Z%%M% %I% %E% SMI"
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien/*
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * Support routines for managing per-CPU state.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien */
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <cmd_cpu.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <cmd_ecache.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <cmd_mem.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <cmd.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <stdio.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <string.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <strings.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <errno.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <kstat.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <fm/fmd_api.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <sys/async.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <sys/fm/protocol.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <sys/fm/cpu/UltraSPARC-III.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien#include <sys/cheetahregs.h>
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien/*
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien * The unused argument 'clcode' is needed for our sun4v sibling.
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien */
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien/*ARGSUSED*/
6dfee4834394825da35b977ca71cdc965bc7b6a4tsienint
6dfee4834394825da35b977ca71cdc965bc7b6a4tsiencmd_xr_fill(fmd_hdl_t *hdl, nvlist_t *nvl, cmd_xr_t *xr, cmd_errcl_t clcode)
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien{
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien if (nvlist_lookup_uint16(nvl, FM_EREPORT_PAYLOAD_NAME_SYND,
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien &xr->xr_synd) != 0)
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien return (-1);
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien if (nvlist_lookup_uint8(nvl, FM_EREPORT_PAYLOAD_NAME_SYND_STATUS,
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien &xr->xr_synd_status) != 0)
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien return (-1);
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien if (nvlist_lookup_uint64(nvl, FM_EREPORT_PAYLOAD_NAME_AFAR,
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien &xr->xr_afar) != 0)
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien return (-1);
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien if (nvlist_lookup_uint8(nvl, FM_EREPORT_PAYLOAD_NAME_AFAR_STATUS,
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien &xr->xr_afar_status) != 0)
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien return (-1);
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien return (0);
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien}
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien
6dfee4834394825da35b977ca71cdc965bc7b6a4tsienint
6dfee4834394825da35b977ca71cdc965bc7b6a4tsiencmd_cpu_synd_check(uint16_t synd)
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien{
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien if (synd == CH_POISON_SYND_FROM_XXU_WRITE ||
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien synd == CH_POISON_SYND_FROM_XXU_WRMERGE ||
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien synd == CH_POISON_SYND_FROM_DSTAT23)
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien return (-1);
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien else
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien return (0);
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien}
a255420765b0b2d93935f09709ebad35f6aa7ee3jc/*ARGSUSED*/
2f48339a0c14421b8826b39fc3ab783a064cb77bjcint
2f48339a0c14421b8826b39fc3ab783a064cb77bjccmd_afar_valid(fmd_hdl_t *hdl, nvlist_t *nvl, cmd_errcl_t clcode,
2f48339a0c14421b8826b39fc3ab783a064cb77bjc uint64_t *afar)
2f48339a0c14421b8826b39fc3ab783a064cb77bjc{
2f48339a0c14421b8826b39fc3ab783a064cb77bjc uint8_t afar_status;
2f48339a0c14421b8826b39fc3ab783a064cb77bjc
2f48339a0c14421b8826b39fc3ab783a064cb77bjc if (nvlist_lookup_uint8(nvl,
2f48339a0c14421b8826b39fc3ab783a064cb77bjc FM_EREPORT_PAYLOAD_NAME_AFAR_STATUS, &afar_status) == 0) {
2f48339a0c14421b8826b39fc3ab783a064cb77bjc if (afar_status == AFLT_STAT_VALID) {
2f48339a0c14421b8826b39fc3ab783a064cb77bjc (void) nvlist_lookup_uint64(nvl,
2f48339a0c14421b8826b39fc3ab783a064cb77bjc FM_EREPORT_PAYLOAD_NAME_AFAR, afar);
2f48339a0c14421b8826b39fc3ab783a064cb77bjc return (0);
2f48339a0c14421b8826b39fc3ab783a064cb77bjc } else
2f48339a0c14421b8826b39fc3ab783a064cb77bjc return (-1);
2f48339a0c14421b8826b39fc3ab783a064cb77bjc }
2f48339a0c14421b8826b39fc3ab783a064cb77bjc return (-1);
2f48339a0c14421b8826b39fc3ab783a064cb77bjc}