Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / hypervisor / src / support / mdgen / dagtypes.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* Hypervisor Software File: dagtypes.h
5*
6* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
7*
8* - Do no alter or remove copyright notices
9*
10* - Redistribution and use of this software in source and binary forms, with
11* or without modification, are permitted provided that the following
12* conditions are met:
13*
14* - Redistribution of source code must retain the above copyright notice,
15* this list of conditions and the following disclaimer.
16*
17* - Redistribution in binary form must reproduce the above copyright notice,
18* this list of conditions and the following disclaimer in the
19* documentation and/or other materials provided with the distribution.
20*
21* Neither the name of Sun Microsystems, Inc. or the names of contributors
22* may be used to endorse or promote products derived from this software
23* without specific prior written permission.
24*
25* This software is provided "AS IS," without a warranty of any kind.
26* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
27* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
28* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
29* MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
30* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
31* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
32* OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
33* FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
34* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
35* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
36* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
37*
38* You acknowledge that this software is not designed, licensed or
39* intended for use in the design, construction, operation or maintenance of
40* any nuclear facility.
41*
42* ========== Copyright Header End ============================================
43*/
44/*
45 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
46 * Use is subject to license terms.
47 *
48 */
49
50#ifndef _DAGTYPES_H
51#define _DAGTYPES_H
52
53#pragma ident "@(#)dagtypes.h 1.3 07/05/03 SMI"
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59typedef struct DAG_NODE dag_node_t;
60#define MAX_DATALEN 256
61
62typedef struct {
63 char *namep;
64 enum { PE_none, PE_string, PE_int, PE_arc, PE_noderef, PE_data } utype;
65
66 void *name_tmp; /* used for output */
67
68 union {
69 char *strp; /* string & noderef */
70 uint64_t val;
71 dag_node_t *dnp;
72 struct {
73 int len;
74 uint8_t buffer[MAX_DATALEN];
75 } data;
76 } u;
77
78 void *data_tmp; /* used for output */
79} pair_entry_t;
80
81
82typedef struct {
83 int num;
84 int space;
85 pair_entry_t *listp;
86} pair_list_t;
87
88
89struct DAG_NODE {
90 char *typep;
91 char *namep;
92 int idx;
93 int offset; /* used when computing node links for output */
94 bool_t is_proto;
95
96 void *name_tmp; /* used for output */
97
98 pair_list_t properties;
99
100 dag_node_t *prevp;
101 dag_node_t *nextp;
102};
103
104
105 /*
106 * DAG globals
107 */
108
109extern dag_node_t *dag_listp;
110extern dag_node_t *dag_list_endp;
111
112 /*
113 * Support functions
114 */
115
116extern void validate_dag(void);
117extern dag_node_t *new_dag_node(void);
118extern pair_entry_t *add_pair_entry(pair_list_t *plp);
119extern pair_entry_t *find_pair_by_name(pair_list_t *plp, char *namep);
120extern dag_node_t *find_dag_node_by_type(char *namep);
121extern dag_node_t *find_dag_node_by_name(char *namep);
122extern dag_node_t *grab_node(char *message);
123extern pair_entry_t *grab_prop(char *message, dag_node_t *node);
124extern void dump_dag_nodes(FILE *fp);
125
126
127#ifdef __cplusplus
128}
129#endif
130
131#endif /* _DAGTYPES_H */