chip.c revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe
/*
* 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"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <limits.h>
#include <alloca.h>
#include <kstat.h>
#include <fcntl.h>
#include <errno.h>
#include <libnvpair.h>
#include <sys/processor.h>
#include <sys/systeminfo.h>
#include <fm/topo_mod.h>
#include "chip.h"
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
/*
* Enumerates the processing chips, or sockets, (as distinct from cores) in a
* system. For each chip found, the necessary nodes (one or more cores, and
* possibly a memory controller) are constructed underneath.
*/
topo_instance_t, void *);
const topo_modinfo_t chip_info =
int
{
}
}
return (-1); /* mod errno set */
}
return (0);
}
void
{
}
static int
{
int err;
kstat_named_t *k;
return (0);
return (-1);
}
static int
{
int err;
kstat_named_t *k;
return (0);
return (-1);
}
static nvlist_t *
{
int err;
return (NULL);
if (s != NULL)
if (err != 0) {
return (NULL);
}
return (asru);
}
static int
{
kstat_named_t *k;
chip->chip_ncpustats) < 0)
return (-1);
for (i = 0; i <= chip->chip_ncpustats; i++) {
continue;
++nerr;
continue;
}
== NULL) {
++nerr;
continue;
}
TOPO_METH_FMRI_ARG_PARENT, pfmri) != 0) {
++nerr;
continue;
}
++nerr;
continue;
}
++nerr;
continue;
}
} else {
++nerr;
}
}
if (nerr != 0)
return (-1);
else
return (0);
}
static int
{
int err;
switch (nvpair_type(nvp)) {
case DATA_TYPE_BOOLEAN_VALUE: {
}
return (0);
}
case DATA_TYPE_UINT64: {
}
return (0);
}
case DATA_TYPE_STRING: {
char *str;
return (0);
}
default:
return (-1);
}
}
nvlist_t *
{
return (NULL);
return (NULL);
}
return (asru);
}
static int
{
return (-1);
return (-1);
for (i = 0; i < ncs; i++) {
++nerr;
continue;
}
TOPO_METH_FMRI_ARG_PARENT, pfmri) != 0) {
++nerr;
continue;
}
++nerr;
continue;
}
++nerr;
continue;
}
}
}
if (nerr != 0)
return (-1);
else
return (0);
}
static int
{
return (-1);
return (-1);
for (i = 0; i < ndimm; i++) {
++nerr;
continue;
}
TOPO_METH_FMRI_ARG_PARENT, pfmri) != 0) {
++nerr;
continue;
}
++nerr;
continue;
}
++nerr;
continue;
}
TOPO_ASRU_COMPUTE, &err);
}
continue;
int i;
&ncs) != 0)
continue;
for (i = 0; i < ncs; i++) {
char name[7];
"csnum%d", i);
(void) topo_prop_set_uint64(dimmnode,
}
}
}
}
if (nerr != 0)
return (-1);
else
return (0);
}
static nvlist_t *
{
char path[64];
if (fd == -1) {
return (NULL);
}
return (NULL);
}
}
static int
{
return (-1);
}
return (-1);
return (-1);
}
/*
* Gather and create memory controller topology
*/
return (-1);
}
/*
* Add memory controller properties
*/
continue;
break;
}
rc = -1;
return (rc);
}
static int
{
int i, nerr = 0;
break;
continue;
}
for (i = 0; i <= chip->chip_ncpustats; i++) {
kstat_named_t *k;
continue;
++nerr;
continue;
}
continue;
continue;
TOPO_METH_FMRI_ARG_PARENT, pfmri) != 0) {
++nerr;
continue;
}
++nerr;
continue;
}
++nerr;
continue;
}
++nerr;
}
sizeof (ulong_t));
if (nerr != 0)
return (0);
}
static int
{
return (0);
}