/*
* 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 <unistd.h>
#include <ctype.h>
#include <strings.h>
#include <libnvpair.h>
#include <fm/topo_mod.h>
#include <sys/smbios_impl.h>
#include "chip.h"
typedef struct cpu_smbios {
}csmb_t;
typedef struct dimm_smbios {
const char *bankloc;
}dsmb_t;
typedef struct mct_smbios {
}msmb_t;
static int ncpu_ids = 0;
static int bb_count = 0;
static int fill_chip_smbios = 0;
static smbios_struct_t *
{
return (NULL);
return (sp);
}
static int
int csnum)
{
int i, j, k;
int match = 0;
return (-1);
for (i = 0; i < ndimm_ids; i++) {
(void) smbios_info_extmemdevice(shp,
return (emd.smbmdeve_md);
for (k = 0; k < emd.smbmdeve_ncs; k++)
return (emd.smbmdeve_md);
}
}
}
for (j = 0; j < nmct_ids; j++) {
for (i = 0; i < ndimm_ids; i++) {
(void) smbios_info_extmemdevice(shp,
(void) smbios_info_memdevice(shp,
match = 1;
break;
}
}
if (match) {
return (emd.smbmdeve_md);
for (k = 0; k < emd.smbmdeve_ncs; k++)
return (emd.smbmdeve_md);
}
}
}
return (-1);
}
{
return (-1);
/*
* Set the DIMM Slot label to the Chip Select Node
* Set the "data" to carry the DIMM instance
*/
csnum);
else
return (dimmslot);
static int dimmnum = 0;
/*
* On certain Intel Chips, topology does not have
* chip-select nodes, it has the below layout
* so we check if channel instance is passed
* and get the SMBIOS ID based on the channel
*/
int channum;
return (dimmslot);
}
}
return (-1);
}
int
{
int ext_match = 0;
return (-1);
switch (sp->smbstr_type) {
case SMB_TYPE_BASEBOARD:
bb_count++;
break;
case SMB_TYPE_MEMARRAY:
nmct_ids++;
break;
case SUN_OEM_EXT_MEMARRAY:
"smbios_info_extmemarray()"
"failed\n");
return (-1);
}
} else
return (-1);
for (int i = 0; i < nmct_ids; i++) {
ext_match = 1;
break;
}
}
if (!ext_match) {
"EXT_MEMARRAY-MEMARRAY records are mismatched\n");
ext_match = 0;
return (-1);
}
break;
case SMB_TYPE_MEMDEVICE:
if (smbios_info_memdevice(shp,
return (-1);
} else
return (-1);
ndimm_ids++;
break;
/*
* Every SMB_TYPE_MEMDEVICE SHOULD have a
* corresponding SUN_OEM_EXT_MEMDEVICE
*/
case SUN_OEM_EXT_MEMDEVICE:
"smbios_info_extmemdevice()"
"failed\n");
return (-1);
}
for (int i = 0; i < ndimm_ids; i++) {
ext_match = 1;
break;
}
}
if (!ext_match) {
"EXT_MEMDEVICE-MEMDEVICE records are mismatched\n");
ext_match = 0;
return (-1);
}
break;
case SMB_TYPE_PROCESSOR:
if (smbios_info_processor(shp,
"smbios_info_processor()"
"failed\n");
return (-1);
}
}
ncpu_ids++;
break;
/*
* Every SMB_TYPE_PROCESSOR SHOULD have a
* corresponding SUN_OEM_EXT_PROCESSOR
*/
case SUN_OEM_EXT_PROCESSOR:
"smbios_info_extprocessor()"
"failed\n");
return (-1);
}
for (int i = 0; i < ncpu_ids; i++) {
ext_match = 1;
break;
}
}
if (!ext_match) {
"EXT_PROCESSOR-PROCESSOR records are mismatched\n");
ext_match = 0;
return (-1);
}
break;
}
return (0);
}
static int
{
int i, rv = 0;
return (rv);
break;
}
return (rv);
}
int
{
if (!fill_chip_smbios) {
return (-1);
fill_chip_smbios = 1;
}
return (0);
}
int
{
/*
* Type-4 Socket Status bit definitions per SMBIOS Version 2.6
*
* STATUS
* CPU Socket Populated
* CPU Socket Unpopulated
* Populated : Enabled
* Populated : Disabled by BIOS (Setup)
* Populated : Disabled by BIOS (Error)
* Populated : Idle
*/
for (int i = 0; i < ncpu_ids; i++) {
return (1);
}
}
" considering that Type 4 ID : %d is disabled", smb_id);
return (0);
}
int
{
/*
* smbios_processor_ext_t->smbpe_fru : if set to 1
* processor is a FRU
*/
for (int i = 0; i < ncpu_ids; i++) {
return (1);
else
return (0);
}
}
" considering that Type 4 ID : %d is not a FRU", smb_id);
return (0);
}
/*
* This could be defined as topo_mod_strlen()
*/
{
int len = 0;
return (len);
}
/*
* We clean Serials, Revisions, Part No. strings, to
* avoid getting lost when fmd synthesizes these
* strings. :, =, /, ' ' characters are replaced
* with character '-' any non-printable characters
* as seen with !isprint() is also replaced with '-'
* Labels are checked only for non-printable characters.
*/
static const char *
{
char *pp;
char c;
int i;
begin++;
end--;
return (NULL);
for (i = 0; i < MAXNAMELEN - 1; i++) {
break;
c = *cp;
if (!isprint(c))
buf[i] = '-';
else
buf[i] = c;
} else {
if (c == ':' || c == '=' || c == '/' ||
buf[i] = '-';
else
buf[i] = c;
}
cp++;
}
buf[i] = 0;
return (pp);
}
const char *
char *ksmbios_label)
{
int bufsz = 0;
int err;
/*
* Get Parent FRU's label
*/
" Label of Parent Node error : %d\n", err);
/*
* On Intel the driver gets the label from ksmbios
* so we check if we already have it, if not we
* get it from libsmbios
*/
for (int i = 0; i < ndimm_ids; i++) {
break;
}
}
}
}
} else
delim = "/";
if (lsmbios_label != NULL) {
/*
* If we are working on a DIMM
* and we are deriving from libsmbios
* smbi_location has the Device Locator.
* add the Device Locator
* add Bank Locator latter
*/
bufsz);
}
} else if (lsmbios_label != NULL)
bufsz);
}
}
return (clean_label);
}
return (NULL);
}
const char *
{
c.smbi_serial, 0);
return (clean_serial);
}
return (NULL);
}
const char *
{
c.smbi_part, 0);
return (clean_part);
}
return (NULL);
}
const char *
{
c.smbi_version, 0);
return (clean_rev);
}
return (NULL);
}