cmd_cpu_arch.c revision 14ea4bb737263733ad80a36b4f73f681c30a6b45
/*
* 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
* 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"
/*
* Support routines for managing per-CPU state.
*/
#include <cmd_cpu.h>
#include <cmd_mem.h>
#include <cmd.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <kstat.h>
#include <sys/niagararegs.h>
int
{
uint64_t niagara_l2_afsr = 0;
&niagara_l2_afsr) != 0 &&
&niagara_l2_afsr) != 0)
return (-1);
return (-1);
/* Niagara-2 doesn't provide separate (redundant) l2-synd */
}
&xr->xr_synd_status) != 0)
return (-1);
return (0);
}
int
{
int i;
/*
* Niagara L2 fetches from a memory location containing a UE
* are given a poison syndrome in one or more 7 bit subsyndromes
* each covering one of 4 4 byte checkwords.
*
* 0 is an invalid syndrome because it denotes no error, but
* is associated with an ereport -- meaning there WAS an error.
*/
if (synd == 0)
return (-1);
for (i = 0; i < 4; i++) {
if (((synd >> i*NI_L2_POISON_SYND_SIZE) &
return (-1);
}
return (0);
}
int
{
/*
* Set Niagara afar and synd validity.
* For a given set of error registers, the payload value is valid iff
* no higher priority error status bit is set. See niagararegs.h
* for error status bit values and priority settings.
*/
switch (clcode) {
case CMD_ERRCL_LDAU:
case CMD_ERRCL_LDSU:
*stat_val =
((afsr & NI_L2AFSR_P02) == 0) ?
break;
case CMD_ERRCL_LDWU:
*stat_val =
((afsr & NI_L2AFSR_P03) == 0) ?
break;
case CMD_ERRCL_LDRU:
*stat_val =
((afsr & NI_L2AFSR_P04) == 0) ?
break;
case CMD_ERRCL_LDAC:
case CMD_ERRCL_LDSC:
*stat_val =
((afsr & NI_L2AFSR_P08) == 0) ?
break;
case CMD_ERRCL_LDWC:
*stat_val =
((afsr & NI_L2AFSR_P09) == 0) ?
break;
case CMD_ERRCL_LDRC:
*stat_val =
((afsr & NI_L2AFSR_P10) == 0) ?
break;
default:
return (-1);
}
return (0);
}
int
{
uint64_t niagara_l2_afsr = 0;
/*
* In Niagara-1, we carried forward the register names afsr and afar
* in ereports from sun4u, even though the hardware registers were
* named esr and ear respectively. In Niagara-2 we decided to conform
* to the hardware names.
*/
&niagara_l2_afsr) != 0 &&
&niagara_l2_afsr) != 0)
return (-1);
return (-1);
if (stat_val == AFLT_STAT_VALID) {
if (nvlist_lookup_uint64(nvl,
FM_EREPORT_PAYLOAD_NAME_L2_AFAR, afar) == 0 ||
FM_EREPORT_PAYLOAD_NAME_L2_EAR, afar) == 0)
return (0);
}
return (-1);
}
/*
* sun4v cmd_cpu_get_frustr expects a 'cpufru' element in 'detector' FMRI
* of ereport (which is stored as 'asru' of cmd_cpu_t). For early sun4v,
* this was mistakenly spec'ed as "hc://MB" instead of "hc:///component=MB",
* so this situation must be remediated when found.
*/
char *
{
char *frustr;
sizeof (CPU_FRU_FMRI) -1) == 0)
else {
s2 = "MB";
return (s1);
}
}
(void) cmd_set_errno(ENOENT);
return (NULL);
}
char *
char *partstr;
else
return (NULL);
}
char *
char *serialstr;
else
return (NULL);
}