/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*/
#include <sys/smbios_impl.h>
#include <mcamd.h>
#include <mcamd_off.h>
extern int x86gentopo_legacy;
struct mc_offmap {
int mcom_code;
};
static uint_t
{
}
static void *
{
return (mch);
}
/*
* Iterate over all memory controllers.
*/
/*ARGSUSED*/
{
return ((mcamd_node_t *)mc_list);
}
/*
* Iterate over all chip-selects of a MC or all chip-selects of a DIMM
* depending on the node type of 'node'. In the DIMM case we do not
* have a linked list of associated chip-selects but an array of pointer
* to them.
*/
/*ARGSUSED*/
{
int i;
void *retval;
switch (nt) {
case MC_NT_MC:
break;
case MC_NT_DIMM:
break;
}
} else {
switch (nt) {
case MC_NT_MC:
break;
case MC_NT_DIMM:
for (i = 0; i < MC_CHIP_DIMMRANKMAX; i++) {
break;
}
if (i == MC_CHIP_DIMMRANKMAX)
"mcamd_cs_next");
if (i == MC_CHIP_DIMMRANKMAX - 1)
else
break;
}
}
return ((mcamd_node_t *)retval);
}
/*
* Iterate over all DIMMs of an MC or all DIMMs of a chip-select depending
* on the node type of 'node'. In the chip-select case we do not have
* a linked list of associated DIMMs but an array of pointers to them.
*/
/*ARGSUSED*/
{
int i;
void *retval;
switch (nt) {
case MC_NT_MC:
break;
case MC_NT_CS:
break;
}
} else {
switch (nt) {
case MC_NT_MC:
break;
case MC_NT_CS:
for (i = 0; i < MC_CHIP_DIMMPERCS; i++) {
break;
}
if (i == MC_CHIP_DIMMPERCS)
"mcamd_dimm_next");
if (i == MC_CHIP_DIMMPERCS - 1)
else
break;
}
}
return ((mcamd_node_t *)retval);
}
/*ARGSUSED*/
{
}
/*ARGSUSED*/
{
}
/*
* Node properties. A property is accessed through a property number code;
* we search these tables for a match (choosing table from node type) and
* return the uint64_t property at the indicated offset into the node
* structure. All properties must be of type uint64_t. It is assumed that
* property lookup does not have to be super-fast - we search linearly
* down the (small) lists.
*/
};
};
};
struct nt_offmap {
int mapents;
};
/*ARGSUSED*/
static int
{
int i;
return (0);
return (1);
}
}
return (0);
}
/*ARGSUSED*/
int
{
int found;
{ mcamd_mc_offmap, /* MC_NT_MC */
sizeof (mcamd_mc_offmap) / sizeof (struct mc_offmap) },
{ mcamd_cs_offmap, /* MC_NT_CS */
sizeof (mcamd_cs_offmap) / sizeof (struct mc_offmap) },
{ mcamd_dimm_offmap, /* MC_NT_DIMM */
sizeof (mcamd_dimm_offmap) / sizeof (struct mc_offmap) }
};
if (found)
return (found == 1);
}
int
{
return (0);
}
return (1);
}
};
};
/*ARGSUSED*/
int
{
int found;
{ mcreg_offmap, /* MC_NT_MC */
sizeof (mcreg_offmap) / sizeof (struct mc_offmap) },
{ csreg_offmap, /* MC_NT_CS */
sizeof (csreg_offmap) / sizeof (struct mc_offmap) },
{ NULL, 0 } /* MC_NT_DIMM */
};
if (found)
return (found == 1);
}
int
{
return (0);
}
return (1);
}
int
{
return (mcamd->mcamd_errno);
}
int
{
return (-1);
}
void
{
return;
}
void
{
hdl->mcamd_errno = 0;
}
{
if (err == 0)
return (CMI_SUCCESS);
switch (mcamd_errno(hdl)) {
case EMCAMD_SYNDINVALID:
return (CMIERR_MC_SYNDROME);
case EMCAMD_TREEINVALID:
return (CMIERR_MC_BADSTATE);
case EMCAMD_NOADDR:
return (CMIERR_MC_NOADDR);
case EMCAMD_INSUFF_RES:
return (CMIERR_MC_ADDRBITS);
default:
return (CMIERR_UNKNOWN);
}
}
/*ARGSUSED*/
{
int rc;
mcamd_mkhdl(&mcamd);
#ifdef DEBUG
/*
* Apply the reverse operation to verify the result. If there is
* a problem complain but continue.
*/
"mcamd_patounum_wrap: offset calculation "
"verification for PA 0x%llx failed\n", pa);
}
}
#endif
}
static int
{
int i;
FM_FMRI_HC_SPECIFIC_OFFSET, &offset) != 0) ||
return (0);
for (i = 0; i < MC_UNUM_NDIMM; i++)
for (i = 0; i < npr; i++) {
long v;
return (0);
unump->unum_board = (int)v;
unump->unum_dimms[0] = (int)v;
}
return (1);
}
/*ARGSUSED*/
{
int rc;
return (CMIERR_MC_INVALUNUM);
}
mcamd_mkhdl(&mcamd);
}
static void
{
int i;
for (i = 0; i < MC_UNUM_NDIMM; i++) {
break;
} else {
}
}
}
static void
{
} else {
}
*nump = 1;
}
/*
* Create the 'resource' payload member from the unum info. If valid
* dimm numbers are present in the unum info then create members
* identifying the dimm and rank; otherwise if a valid chip-select
* number is indicated then create a member identifying the chip-select
* topology node.
*/
static void
{
int nelems = 0;
int i;
if (nelems > 0) {
for (i = 0; i < nelems; i++)
}
}
static void
{
if (members & FM_EREPORT_PAYLOAD_FLAG_RESOURCE &&
}
static nvlist_t *
{
"memory-controller", 0);
} else {
"motherboard", 0,
"memory-controller", 0);
}
return (nvl);
}
/*
* Simple ereport generator for errors detected by the memory controller.
* Posts an ereport of class ereport.cpu.amd.<class_sfx> with a resource nvlist
* derived from the given mc_unum_t. There are no other payload members.
* The mc argument is used to formulate a detector and this mc should
* correspond with that identified in the mc_unum_t.
*
* There is no control of which members to include the the resulting ereport -
* it will be an ereport formed using the given class suffix, detector
* indicated as the memory-controller and with a resource generated by
* expanding the given mc_unum_t.
*
* We do not use any special nv allocator here and so this is not suitable
* for use during panic. It is intended for use during MC topology
* discovery and other controlled circumstances.
*/
void
{
"amd", class_sfx);
}
mcamd_patounum_wrap, /* cmi_mc_patounum */
mcamd_unumtopa_wrap, /* cmi_mc_unumtopa */
NULL /* cmi_mc_logout */
};
void
{
}