cmd_opl.c revision 25cf1a301a396c38e8adf52c15f537b80d2483f7
/*
* 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"
/*
* OPL platform specific functions for
*/
#include <cmd.h>
#include <cmd_page.h>
#include <cmd_opl.h>
#include <string.h>
#include <errno.h>
#include <kstat.h>
#include <sys/opl_olympus_regs.h>
#include <sys/int_const.h>
/*
* derived from cpu scheme function "cpu_get_serialid_kstat".
*/
static int
{
int i;
return (-1); /* errno is set for us */
(void) kstat_close(kc);
return (cmd_set_errno(ENOENT));
}
(void) kstat_close(kc);
return (cmd_set_errno(oserr));
}
(void) kstat_close(kc);
return (0);
}
}
(void) kstat_close(kc);
return (cmd_set_errno(ENOENT));
}
/*
* This function builds the ASRU page
* of the given cpuid based on the CPU scheme.
*/
nvlist_t *
{
return (NULL);
return (NULL);
}
/*
* Version 1 calls for a string-based serial number
*/
FM_FMRI_SCHEME, FM_FMRI_SCHEME_CPU) != 0 ||
return (NULL);
}
return (fmri);
}
{
switch (flt_type) {
case IS_STRAND:
if (p != NULL) {
first_p = p;
} else
break;
case IS_CORE:
/*
* Based on the Olympus-C CPUID definition in multi-strands
* mode to flip the bits to get the sibling strands
*/
for (s = 0; s <= STRAND_UPPER_BOUND; s++) {
if (p == NULL) {
if (s > 0)
sizeof (opl_cpu_list_t));
return (p);
}
if (s == 0) {
pp = p;
first_p = p;
} else {
}
}
break;
case IS_CHIP:
/*
* Based on the Olympus-C CPUID definition in multi-strand
* mode to flip the bits in CPUID for getting the sibling
* strand IDs
*/
for (c = 0; c <= CORE_UPPER_BOUND; c++) {
for (s = 0; s <= 1; s++) {
p = fmd_hdl_alloc(hdl,
sizeof (opl_cpu_list_t), FMD_SLEEP);
if (p == NULL) {
if (c > 0)
return (p);
} else {
if (c == 0 && s == 0) {
first_p = p;
} else {
}
}
pp = p;
}
}
break;
default:
break;
}
return (first_p);
}
void
{
opl_cpu_list_t *p, *pp;
pp = p;
if (p != NULL)
p = p->next_cpu;
}
}
/*
* Based on "avg" function of eversholt
*/
{
unsigned long long s = sum * 10;
}
void
{
if (!npairs) {
}
}
/*
* This function builds the resource fmri page based on
* the kstat "cpu_fru" of the faulted cpu and cpuid
* using the "hc" scheme.
*/
nvlist_t *
{
char chip_str[STR_BUFLEN];
char core_str[STR_BUFLEN];
char strand_str[STR_BUFLEN];
NV_UNIQUE_NAME, 0)) != 0) {
return (NULL);
}
}
return (NULL);
}
return (NULL);
}
/*
* get the CMU # from cpu_fru
*/
sizeof (OPL_CPU_FRU_FMRI) - 1) == 0) {
/*
* incorrect format; default to zero
*/
} else
comp = "0";
(cpuid & STRAND_MASK));
return (NULL);
}
return (NULL);
}
return (NULL);
}
return (fmri);
}
/*
* The following is the main function to handle generating
* the sibling cpu suspect list for the CPU detected UE
* error cases. This is to handle the
*/
{
const char *uuid;
"Enter OPL_CPUUE_HANDLER for class %x\n", class);
IS_CORE);
IS_CHIP);
else
} else {
"missing asru, cpuid %u excluded\n",
continue;
}
"cpu not present, cpuid %u excluded\n",
continue;
}
nsusp++;
}
return (CMD_EVD_REDUND);
}
"destroying existing %s state for class %x\n",
}
}
}
"missing rsrc, cpuid %u excluded\n",
continue;
}
}
}
return (CMD_EVD_OK);
}
/*
* The following is the common function for handling
* memory UE with EID=MEM.
*/
int hdlr_type)
{
if (nvlist_lookup_nvlist(nvl,
FM_EREPORT_PAYLOAD_NAME_RESOURCE, &rsrc) != 0)
return (CMD_EVD_BAD);
switch (hdlr_type) {
case CMD_OPL_HDLR_CPU:
if (nvlist_lookup_uint64(nvl,
FM_EREPORT_PAYLOAD_NAME_SFAR, &pa) != 0)
return (CMD_EVD_BAD);
(u_longlong_t)pa);
break;
case CMD_OPL_HDLR_IO:
&ubc_ue_log_reg) != 0)
return (CMD_EVD_BAD);
(u_longlong_t)pa);
break;
default:
return (CMD_EVD_BAD);
}
FM_FMRI_MEM_PHYSADDR, pa)) != 0)
return (CMD_EVD_OK);
}
/*
* This is the common entry for processing MAC detected errors.
* It is responsible for generating the memory page fault event.
* The permanent CE in normal mode is handled here also in the
* same way as in the UE case.
*/
/*ARGSUSED*/
{
return (CMD_EVD_BAD);
!= 0)
return (CMD_EVD_BAD);
/*
* Check for invalid pa.
* The most sig. bit should not be on.
* It would be out of the range of possible pa
* in MAC's view.
*/
return (CMD_EVD_BAD);
return (CMD_EVD_OK);
}
/*
* respect to EID=MEM.
*/
/*ARGSUSED*/
{
}
/*ARGSUSED*/
{
}