/*
* 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
*/
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <libnvpair.h>
#include <kstat.h>
#include <unistd.h>
#include <fm/topo_mod.h>
#include <fm/fmd_agent.h>
char *
{
char *fmtstr;
int ret;
return (NULL);
}
return (NULL);
}
return (fmtstr);
}
int
{
}
nvlist_free(*out);
}
!= 0) {
nvlist_free(*out);
}
nvlist_free(*out);
}
return (0);
}
/*
* This is a somewhat generic property method for labelling the dimm slots on
* correlation between the dimm topo node instance number and the dimm slot
* label number. It takes the following two arguments:
*
* format: a string containing a printf-like format with a single %d token
* which this method computes
*
* i.e.: DIMM %d
*
* offset: a numeric offset that we'll number the dimms from. This is to
* allow for the fact that some systems number the dimm slots
* from zero and others start from one (like the Ultra 20)
*/
/* ARGSUSED */
int
{
int ret;
}
}
/* topo errno already set */
return (-1);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* This is a somewhat generic property method for labelling the dimm slots on
*
* format: a string containing a printf-like format with a two %d tokens
* for the cpu and dimm slot label numbers, which this method
* computes
*
* i.e.: CPU %d DIMM %d
*
* offset: a numeric offset that we'll number the dimms from. This is to
* allow for the fact that some systems number the dimm slots
* from zero while others may start from one
*
* order: "reverse" or "forward" - sets the direction of the correlation
* between dimm topo node instance number and DIMM slot number
*
* dimms_per_chip: the number of DIMM slots per chip
*/
/* ARGSUSED */
int
{
int ret;
}
}
&dimms_per_chip)) != 0) {
}
}
/* topo errno already set */
return (-1);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
/* LINTED: E_SEC_PRINTF_VAR_FMT */
else {
}
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* This method assumes a correspondence between the dimm topo node instance
* number and the dimm slot label number, but unlike simple_chip_label_mp, the
* slot numbers aren't reused between CPU's. This method assumes there
* are 4 DIMM slots per chip. It takes the following two arguments:
*
* format: a string containing a printf-like format with a single %d token
* which this method computes
*
* i.e.: DIMM %d
*
* offset: a numeric offset that we'll number the dimms from. This is to
* allow for the fact that some systems number the dimm slots
* from zero and others may start from one
*
* order: "reverse" or "forward" - sets the direction of the correlation
* between dimm topo node instance number and DIMM slot number
*/
/* ARGSUSED */
int
{
int ret;
}
}
}
/* topo errno already set */
return (-1);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
/* LINTED: E_SEC_PRINTF_VAR_FMT */
else {
}
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* This is a somewhat generic property method for labelling the CPU sockets on
* the chip topo node instance number and the CPU socket label number. It takes
* the following two arguments:
*
* format: a string containing a printf-like format with a single %d token
* which this method computes
*
* i.e.: CPU %d
*
* offset: a numeric offset that we'll number the CPU's from. This is to
* allow for the fact that some systems number the CPU sockets
* from zero and others start from one (like the X4X00-M2 systems)
*/
/* ARGSUSED */
int
{
int ret;
}
}
/* topo errno already set */
return (-1);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* This is a somewhat generic property method for labelling the CPU sockets on
* the chip topo node instance number and the CPU socket label number. It takes
* the following argument:
*
* format: a string containing a printf-like format with a single %d token
* which this method computes
*
* i.e.: CPU %d
*
* offset: a numeric offset that we'll number the CPU's from. This is to
* allow for the fact that some systems number the CPU sockets
* from zero and others start from one (like the X8450 systems)
*/
/* ARGSUSED */
int
{
int ret;
}
}
/* topo errno already set */
return (-1);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* This is a custom property method for generating the CPU slot label for the
* Galaxy 4E/4F platforms.
*
* format: a string containing a printf-like format with a single %c token
* which this method computes
*
* i.e.: CPU %c
*/
/* ARGSUSED */
int
{
/*
* G4 HT node ID to FRU label translation. The g4map array
* is indexed by (number of coherent nodes) / 2 - 1.
* The value for a given number of nodes is a char array
* indexed by node ID.
*/
const char *g4map[] = {
"AB", /* 2 nodes */
"ADEH", /* 4 nodes */
"ABDEFH", /* 6 nodes */
"ACBDEFGH" /* 8 nodes */
};
/* topo errno already set */
return (-1);
}
/*
* The chip-properties property will not exist if this platform has
* AMD family 0x10 modules. In that case we don't want to treat it as a
* fatal error as that will cause calls like topo_prop_getprops to fail
* to return any properties on this node. Therefore, if the topo errno
* is set to ETOPO_PROP_NOENT, then we'll just set an empty label
* and return 0. If the topo errno is set to anything else we'll
* return -1.
*/
if (err == ETOPO_PROP_NOENT) {
/* topo errno already set */
return (-1);
}
return (0);
} else {
"property\n");
}
}
/* HT nodes must number 0 .. num_nodes - 1 */
}
switch (num_nodes) {
case (2):
case (4):
case (6):
case (8):
/* htid is already range-checked */
break;
default:
" %d\n", num_nodes);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* Utility function used by a4fplus_chip_label to determine the number of chips
* (as opposed to processors) that are installed in the system by counting
* the unique chipids.
*/
static int
{
int i, nchip = 0;
return (-1);
return (-1);
}
for (i = 0; i < ncpu; i++) {
nchip = -1;
break;
}
nchip++;
}
}
for (i = 0; i < ncpu; i++)
nvlist_free(cpus[i]);
return (nchip);
}
/*
* This is a custom property method for generating the CPU slot label for the
* Andromeda Fplus platforms.
*
* format: a string containing a printf-like format with a single %d token
* which this method computes
*
* i.e.: CPU %d
*/
/* ARGSUSED */
int
{
int num_nodes;
/* topo errno already set */
return (-1);
}
/*
* Normally we'd figure out the total number of chip nodes by looking
* at the CoherentNodes property. However, due to the lack of a memory
* controller driver for family 0x10, this property wont exist on the
* chip nodes on A4Fplus.
*/
"nodes\n");
}
switch (num_nodes) {
case (2):
/* LINTED: E_SEC_PRINTF_VAR_FMT */
break;
case (4):
/* LINTED: E_SEC_PRINTF_VAR_FMT */
break;
default:
" %d\n", num_nodes);
}
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* This is a somewhat generic property method for labelling the chip-select
* nodes on multi-socket AMD family 0x10 platforms. This is necessary because
* these platforms are not supported by the current AMD memory controller driver
* and therefore we're not able to discover the memory topology on AMD family
* 0x10 systems. As a result, instead of enumerating the installed dimms and
* their ranks, the chip enumerator generically enumerates all of the possible
* chip-selects beneath each dram channel.
*
* When we diagnose a dimm fault, the FRU fmri will be for the chip-select node,
* so we need to attach FRU labels to the chip-select nodes.
*
* format: a string containing a printf-like format with a two %d tokens
* for the cpu and dimm slot label numbers, which this method
* computes
*
* i.e.: CPU %d DIMM %d
*
* offset: a numeric offset that we'll number the dimms from. This is to
* allow for the fact that some systems may number the dimm slots
* from zero while others may start from one
*
* This function computes the DIMM slot number using the following formula:
*
* slot = cs - (cs % 2) + channel + offset
*/
/* ARGSUSED */
int
{
}
}
/* topo errno already set */
return (-1);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
dimm_num);
/* topo errno already set */
return (-1);
}
return (0);
}
/* ARGSUSED */
int
{
}
}
/* topo errno already set */
return (-1);
}
/*
* The 4600/4600M2 have a weird way of labeling the chip nodes, so
* instead of trying to recompute it, we'll simply look it up and
* prepend it to our dimm label.
*/
&err) != 0) {
topo_strerror(err));
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
/* topo errno already set */
return (-1);
}
return (0);
}
/*
* This method is used to compute the labels for DIMM slots on the Galaxy 1F and
* 2F platforms. It results in following dimm node label assignments:
*
* ------------------- -----
* chip=0/dimm=0 CPU 1 DIMM A0
* chip=0/dimm=1 CPU 1 DIMM B0
* chip=0/dimm=2 CPU 1 DIMM A1
* chip=0/dimm=3 CPU 1 DIMM B1
*
* chip=1/dimm=0 CPU 2 DIMM A0
* chip=1/dimm=1 CPU 2 DIMM B0
* chip=1/dimm=2 CPU 2 DIMM A1
* chip=1/dimm=3 CPU 2 DIMM B1
*/
/* ARGSUSED */
int
{
}
/* topo errno already set */
return (-1);
}
/* LINTED: E_SEC_PRINTF_VAR_FMT */
slot_num);
/* topo errno already set */
return (-1);
}
return (0);
}