Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / system / tracemod / include / tm_impl.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: tm_impl.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23/*
24 * Copyright (C) 2004 Sun Microsystems, Inc.
25 * All rights reserved.
26 */
27#ifndef _TM_IMPL_H
28#define _TM_IMPL_H
29
30#pragma ident "@(#)1.36 06/05/19 tm_impl.h"
31
32#include "blaze-data.h"
33#include "mmi.h"
34#include "mmi-blaze.h"
35
36/////////////////////////////////////////
37
38typedef struct asi_handler_t
39{
40 uint32_t asi;
41 uint64_t vaddr;
42 mmi_ld_asi_action mmi_ld_action;
43 mmi_st_asi_action mmi_st_action;
44
45} AsiHandlerT;
46
47typedef List1Node<AsiHandlerT> AsiHandlerNode;
48
49/////////////////////////////////////////
50
51typedef struct ldm_cmd_t
52{
53 fn_ui_1 cmd_action_1;
54 fn_ui_2 cmd_action_2;
55 char *name;
56 struct ldm_t *ldm;
57 struct ldm_cmd_t *next;
58
59} LdmCmd;
60
61typedef List1Node<LdmCmd> LdmCmdNode;
62
63/////////////////////////////////////////
64
65typedef struct ldm_time_intf
66{
67 int64_t threshold;
68 int64_t cnt;
69 int64_t abs_cnt;
70 fn_event_cycle event_handler;
71 TM_OPAQUE_DATA client_data;
72 struct ldm_time_intf *next;
73 struct ldm_time_intf *self;
74 tracemod_t *owner;
75
76#define TM_INTF_STATUS_ENABLED 22
77#define TM_INTF_STATUS_DISABLED 33
78
79 uint32_t status;
80
81} ldm_time_intf;
82
83/////////////////////////////////////////
84
85struct ldm_t
86{
87 uint32_t mode ; // TM_BUFMODE || TM_CBMODE
88 Byte type;
89 bool_t valid;
90
91 void *blaze_data;
92
93 uint32_t event_mask;
94 char *name;
95 char *soname; // name of *.so file
96 char *help;
97 void *so_handle; // is returned by DLOPEN
98 void *ldm_arg;
99
100 TM_OPAQUE_DATA client_data;
101 TM_OPAQUE_DATA asi_client_data;
102 fn_time_interval ti_action;
103 mmi_interface_cb interface_cb;
104 mmi_config_cb config_cb;
105 mmi_modinfo_cb modinfo_cb;
106
107 // tracing callbacks
108
109 fn_cpustat cpustat_action;
110 fn_cpustatB cpustat_actionB;
111
112 // misc callback (io, asi)
113
114 fn_misc io_ld_action;
115 fn_misc io_st_action;
116
117 fn_misc io_mmi_ld_action;
118 fn_misc io_mmi_st_action;
119
120 fn_misc asi_ld_action;
121 fn_misc asi_st_action;
122
123 ////////////////////////////////////
124
125 mmi_instance_creator create_instance;
126
127 ////////////////////////////////////
128
129 CpuInfo *pinfo,
130 *pinfo_cur,
131 *pinfo_last;
132 uint32_t pirec_size;
133
134 uint8_t ea_valid[MAX_MP];
135 uint8_t tr_valid[MAX_MP];
136 uint8_t memop[MAX_MP];
137
138 int argc;
139 char **argv;
140
141
142 AsiHandlerNode *headAsi;
143
144 // struct ldm_t *next;
145 struct ldm_t *parent;
146}; // struct ldm_t;
147
148typedef List1Node<Ldm> LdmNode;
149
150extern LdmNode *head_ldm;
151extern LdmNode *head_spec_ldm;
152
153
154/////////////////////////////////////////
155
156
157//void tm_handle_tlb (cpuT* sp, Ldm* pldm, Tlb_t *ptlb, uint32_t idx);
158void ldm_tick_ext_init ();
159Ldm * ldm_add_spec (char * name, const char *soname);
160
161/////////////////////////////////////////
162
163#ifdef __cplusplus
164extern "C" {
165#endif
166
167typedef void (*fn_setvar_local)(void *cb_data, void *value);
168
169#ifdef __cplusplus
170}
171#endif
172
173typedef struct mmi_var_t {
174
175 const char * name;
176 uint32_t vtype;
177 uint32_t writable;
178 void * varptr;
179 fn_setvar_local action;
180 Ldm * module;
181
182} MmiVar;
183
184typedef List1Node<MmiVar> MmiVarNode;
185
186
187// MMI dump-restore functionality
188// this mirrors blaze DR, but hides the DR_opaque interface from mmi modules
189struct mmi_dr_s {
190 void * userdata;
191 char *name;
192 mmi_dump_cb dump_fn;
193 mmi_restore_cb restore_fn;
194}; // struct mmi_dr_s
195
196extern mmi_dr_s * mmi_dr_list;
197extern int mmi_dr_list_sz;
198extern int mmi_dr_list_count;
199
200
201
202#endif /* TM_IMPL_H */
203
204
205
206
207
208