usr/src/lib/fm/topo/libtopo/common/libtopo.h
author cindi
Fri, 22 Dec 2006 11:30:38 -0800
changeset 3323 3cff27a475a5
parent 3062 46d280f5351d
child 3666 4c0bd30907d2
permissions -rw-r--r--
PSARC 2006/679 Fault Event Extension 6279682 fmadm -q rotate errlog hangs while fmd report an error into the log 6326650 fma needs more dcmds for getting errors from crash dumps 6372709 fltlog can grow without bound; needs to be managed by logadm 6400607 fmd dumped core in zfs-diagnosis 6464740 fmdump -v output should display FRU location (label) information separate from the FRU 6485057 mc-amd driver should provide access to HT routing tables 6493219 libtopo needs to allow re-enumeration according static .xml props 6495169 PCI topo enumerator should maintain a 'module' property 6496757 Incorrect initializer for topo_builtin.c:_topo_builtins[] 6496850 Need mdb support for libtopo 6498181 .po files inconsistencies wrt the event registry content 6498187 SCA1000 and SCA500 .po dictionary files are out of date 6498195 SMF dictionary .po files are inconsistent 6498201 ZFS dictionary .po files are out of date 6502660 eft fills in ASRU and FRU from libtopo when none are defined in a fault event specification 6502949 eft memory leak in platform_fault2ipath() 6506108 topo_fmri_nvl2str on mem scheme fails to lookup offset and physaddr 6506622 missing entry in PCIEX dict/po files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     1
/*
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     2
 * CDDL HEADER START
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     3
 *
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     7
 *
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    11
 * and limitations under the License.
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    12
 *
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    18
 *
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    19
 * CDDL HEADER END
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    20
 */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    21
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    22
/*
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    23
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    24
 * Use is subject to license terms.
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    25
 */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    26
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    27
#ifndef _LIBTOPO_H
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    28
#define	_LIBTOPO_H
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    29
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    30
#pragma ident	"%Z%%M%	%I%	%E% SMI"
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    31
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    32
#include <sys/nvpair.h>
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    33
#include <stdio.h>
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    34
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    35
#ifdef __cplusplus
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    36
extern "C" {
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    37
#endif
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    38
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    39
#define	TOPO_VERSION	1	/* Library ABI Interface Version */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    40
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    41
typedef struct topo_hdl topo_hdl_t;
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    42
typedef struct topo_node tnode_t;
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    43
typedef struct topo_walk topo_walk_t;
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    44
typedef int32_t topo_instance_t;
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    45
typedef uint32_t topo_version_t;
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    46
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    47
/*
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    48
 * Topo stability attributes
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    49
 *
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    50
 * Each topology node advertises the name and data stability of each of its
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    51
 * modules and properties. (see attributes(5))
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    52
 */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    53
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    54
typedef enum topo_stability {
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    55
	TOPO_STABILITY_UNKNOWN = 0,	/* private to libtopo */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    56
	TOPO_STABILITY_INTERNAL,	/* private to libtopo */
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    57
	TOPO_STABILITY_PRIVATE,		/* private to Sun */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    58
	TOPO_STABILITY_OBSOLETE,	/* scheduled for removal */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    59
	TOPO_STABILITY_EXTERNAL,	/* not controlled by Sun */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    60
	TOPO_STABILITY_UNSTABLE,	/* new or rapidly changing */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    61
	TOPO_STABILITY_EVOLVING,	/* less rapidly changing */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    62
	TOPO_STABILITY_STABLE,		/* mature interface from Sun */
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    63
	TOPO_STABILITY_STANDARD		/* industry standard */
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    64
} topo_stability_t;
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    65
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    66
#define	TOPO_STABILITY_MAX	TOPO_STABILITY_STANDARD	/* max valid stab */
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    67
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    68
typedef enum {
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    69
	TOPO_TYPE_INVALID = 0,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    70
	TOPO_TYPE_BOOLEAN,	/* boolean */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    71
	TOPO_TYPE_INT32,	/* int32_t */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    72
	TOPO_TYPE_UINT32,	/* uint32_t */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    73
	TOPO_TYPE_INT64,	/* int64_t */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    74
	TOPO_TYPE_UINT64,	/* uint64_t */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    75
	TOPO_TYPE_STRING,	/* const char* */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    76
	TOPO_TYPE_TIME,		/* uint64_t */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    77
	TOPO_TYPE_SIZE,		/* uint64_t */
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    78
	TOPO_TYPE_FMRI,		/* nvlist_t */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    79
	TOPO_TYPE_INT32_ARRAY,	/* array of int32_t */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    80
	TOPO_TYPE_UINT32_ARRAY,	/* array of uint32_t */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    81
	TOPO_TYPE_INT64_ARRAY,	/* array of int64_t */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    82
	TOPO_TYPE_UINT64_ARRAY,	/* array of uint64_t */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    83
	TOPO_TYPE_STRING_ARRAY,	/* array of const char* */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    84
	TOPO_TYPE_FMRI_ARRAY	/* array of nvlist_t */
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    85
} topo_type_t;
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    86
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    87
typedef struct topo_pgroup_info {
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    88
	const char *tpi_name;		/* property group name */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    89
	topo_stability_t tpi_namestab;	/* stability of group name */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    90
	topo_stability_t tpi_datastab;	/* stability of all property values */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    91
	topo_version_t tpi_version;	/* version of pgroup definition */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    92
} topo_pgroup_info_t;
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    93
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    94
extern topo_stability_t topo_name2stability(const char *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
    95
extern const char *topo_stability2name(topo_stability_t);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    96
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    97
extern topo_hdl_t *topo_open(int, const char *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    98
extern void topo_close(topo_hdl_t *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
    99
extern char *topo_snap_hold(topo_hdl_t *, const char *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   100
extern void topo_snap_release(topo_hdl_t *);
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   101
extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   102
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   103
/*
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   104
 * Snapshot walker support
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   105
 */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   106
typedef int (*topo_walk_cb_t)(topo_hdl_t *, tnode_t *, void *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   107
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   108
extern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   109
    void *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   110
extern int topo_walk_step(topo_walk_t *, int);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   111
extern void topo_walk_fini(topo_walk_t *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   112
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   113
#define	TOPO_WALK_ERR		-1
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   114
#define	TOPO_WALK_NEXT		0
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   115
#define	TOPO_WALK_TERMINATE	1
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   116
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   117
#define	TOPO_WALK_CHILD		0x0001
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   118
#define	TOPO_WALK_SIBLING	0x0002
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   119
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   120
/*
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   121
 * FMRI helper routines
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   122
 */
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   123
extern int topo_fmri_present(topo_hdl_t *, nvlist_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   124
extern int topo_fmri_contains(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   125
extern int topo_fmri_unusable(topo_hdl_t *, nvlist_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   126
extern int topo_fmri_nvl2str(topo_hdl_t *, nvlist_t *, char **, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   127
extern int topo_fmri_str2nvl(topo_hdl_t *, const char *, nvlist_t **, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   128
extern int topo_fmri_asru(topo_hdl_t *, nvlist_t *, nvlist_t **, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   129
extern int topo_fmri_fru(topo_hdl_t *, nvlist_t *, nvlist_t **,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   130
    int *);
3323
3cff27a475a5 PSARC 2006/679 Fault Event Extension
cindi
parents: 3062
diff changeset
   131
extern int topo_fmri_label(topo_hdl_t *, nvlist_t *, char **, int *);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   132
extern int topo_fmri_compare(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   133
extern int topo_fmri_invoke(topo_hdl_t *, nvlist_t *, topo_walk_cb_t, void *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   134
    int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   135
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   136
/*
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   137
 * Topo node utilities: callable from topo_walk_step() callback or module
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   138
 * enumeration, topo_mod_enumerate()
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   139
 */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   140
extern char *topo_node_name(tnode_t *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   141
extern topo_instance_t topo_node_instance(tnode_t *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   142
extern void *topo_node_private(tnode_t *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   143
extern int topo_node_asru(tnode_t *, nvlist_t **, nvlist_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   144
extern int topo_node_fru(tnode_t *, nvlist_t **, nvlist_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   145
extern int topo_node_resource(tnode_t *, nvlist_t **, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   146
extern int topo_node_label(tnode_t *, char **, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   147
extern int topo_method_invoke(tnode_t *node, const char *, topo_version_t,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   148
    nvlist_t *, nvlist_t **, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   149
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   150
extern int topo_pgroup_create(tnode_t *, const topo_pgroup_info_t *, int *);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   151
extern void topo_pgroup_destroy(tnode_t *, const char *);
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   152
extern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   153
extern int topo_prop_get_int32(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   154
    int32_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   155
extern int topo_prop_get_uint32(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   156
    uint32_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   157
extern int topo_prop_get_int64(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   158
    int64_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   159
extern int topo_prop_get_uint64(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   160
    uint64_t *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   161
extern int topo_prop_get_string(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   162
    char **, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   163
extern int topo_prop_get_fmri(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   164
    nvlist_t **, int *);
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   165
extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   166
    int32_t **, uint_t *, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   167
extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   168
    uint32_t **, uint_t *, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   169
extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   170
    int64_t **, uint_t *, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   171
extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   172
    uint64_t **, uint_t *, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   173
extern int topo_prop_get_string_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   174
    char ***, uint_t *, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   175
extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   176
    nvlist_t ***, uint_t *, int *);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   177
extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   178
    int32_t, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   179
extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   180
    uint32_t, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   181
extern int topo_prop_set_int64(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   182
    int, int64_t, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   183
extern int topo_prop_set_uint64(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   184
    int, uint64_t, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   185
extern int topo_prop_set_string(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   186
    int, const char *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   187
extern int topo_prop_set_fmri(tnode_t *, const char *, const char *,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   188
    int, const nvlist_t *, int *);
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   189
extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   190
    int32_t *, uint_t, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   191
extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   192
    int, uint32_t *, uint_t, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   193
extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   194
    int, int64_t *, uint_t, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   195
extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   196
    int, uint64_t *, uint_t, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   197
extern int topo_prop_set_string_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   198
    int, const char **, uint_t, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   199
extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *,
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   200
    int, const nvlist_t **, uint_t, int *);
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   201
extern nvlist_t *topo_prop_getprops(tnode_t *, int *err);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   202
extern int topo_prop_inherit(tnode_t *, const char *, const char *, int *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   203
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   204
#define	TOPO_PROP_IMMUTABLE	0
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   205
#define	TOPO_PROP_MUTABLE	1
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   206
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   207
/* Protocol property group and property names */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   208
#define	TOPO_PGROUP_PROTOCOL	"protocol"	/* Required property group */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   209
#define	TOPO_PROP_RESOURCE	"resource"	/* resource FMRI */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   210
#define	TOPO_PROP_ASRU		"ASRU"		/* ASRU FMRI */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   211
#define	TOPO_PROP_FRU		"FRU"		/* FRU FMRI */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   212
#define	TOPO_PROP_MOD		"module"	/* software module FMRI */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   213
#define	TOPO_PROP_PKG		"package"	/* software package FMRI */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   214
#define	TOPO_PROP_LABEL		"label"		/*  property LABEL */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   215
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   216
/*
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   217
 * System property group
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   218
 */
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   219
#define	TOPO_PGROUP_SYSTEM	"system"
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   220
#define	TOPO_PROP_ISA		"isa"
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   221
#define	TOPO_PROP_MACHINE	"machine"
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   222
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   223
/* Property node NVL names used in topo_prop_getprops */
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   224
#define	TOPO_PROP_GROUP		"property-group"
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   225
#define	TOPO_PROP_GROUP_NAME	"property-group-name"
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   226
#define	TOPO_PROP_GROUP_DSTAB	"property-group-data-stability"
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   227
#define	TOPO_PROP_GROUP_NSTAB	"property-group-name-stability"
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   228
#define	TOPO_PROP_GROUP_VERSION	"property-group-version"
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   229
#define	TOPO_PROP_VAL		"property"
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   230
#define	TOPO_PROP_VAL_NAME	"property-name"
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   231
#define	TOPO_PROP_VAL_VAL	"property-value"
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   232
#define	TOPO_PROP_VAL_TYPE	"property-type"
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   233
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   234
/*
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   235
 * This enum definition is used to define a set of error tags associated with
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   236
 * the libtopo various error conditions occuring during the adminstration of
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   237
 * properties.  The shell script mkerror.sh is
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   238
 * used to parse this file and create a corresponding topo_error.c source file.
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   239
 * If you do something other than add a new error tag here, you may need to
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   240
 * update the mkerror shell script as it is based upon simple regexps.
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   241
 */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   242
typedef enum topo_prop_errno {
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   243
    ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   244
    ETOPO_PROP_NOENT,   /* undefined property or property group */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   245
    ETOPO_PROP_DEFD,    /* static property already defined */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   246
    ETOPO_PROP_NOMEM,   /* memory limit exceeded during property allocation */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   247
    ETOPO_PROP_TYPE,    /* invalid property type */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   248
    ETOPO_PROP_NOINHERIT, /* can not inherit property */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   249
    ETOPO_PROP_NVL,	/* malformed property nvlist */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   250
    ETOPO_PROP_END	/* end of prop errno list (to ease auto-merge) */
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   251
} topo_prop_errno_t;
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   252
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   253
extern const char *topo_strerror(int);
3062
46d280f5351d 6396916 verification of dtd file name is wrong
cindi
parents: 1414
diff changeset
   254
extern void topo_debug_set(topo_hdl_t *, const char *, const char *);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   255
extern void *topo_hdl_alloc(topo_hdl_t *, size_t);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   256
extern void *topo_hdl_zalloc(topo_hdl_t *, size_t);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   257
extern void topo_hdl_free(topo_hdl_t *, void *, size_t);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   258
extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   259
extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   260
extern char *topo_hdl_strdup(topo_hdl_t *, const char *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   261
extern void topo_hdl_strfree(topo_hdl_t *, char *);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   262
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   263
#ifdef __cplusplus
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   264
}
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   265
#endif
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   266
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
diff changeset
   267
#endif /* _LIBTOPO_H */