In legion build config, updated path to GNU tools and updated deprecated Sun CC flag...
[OpenSPARC-T2-SAM] / sam-t2 / sam / system / blaze / include / blaze_globals.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: blaze_globals.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#ifndef _BLAZE_GLOBALS_H
24#define _BLAZE_GLOBALS_H
25
26#pragma ident "@(#)1.27 04/07/22 blaze_globals.h"
27
28#include "mem.h"
29#include "decl_macros.h"
30#include "dev_registry.h"
31
32extern devRegistry * samDevs;
33
34// For dump/restore
35extern uint32_t BLAZE_restore_from_checkpoint();
36extern char *get_restore_dir();
37
38/* generic signal handlers that ui/device/cpu threads may need */
39
40#include <signal.h>
41
42extern "C" {
43extern void sigignore_handler (int sig);
44extern void sigconfirm_handler (int sig); /* for CTRL-C, BREAK, HANGUP !!! */
45extern void sigcore_handler(int sig, siginfo_t *si, void *arg2);
46}
47
48
49
50
51
52extern const char *network_device_to_snoop[];
53extern int network_device_minor_num[];
54
55
56/* Memory Object */
57extern memT *mm1;
58
59/* CPU, MMU, TLB */
60#define MAX_MP 1024 // Maximum number of CPU's supported
61
62
63extern volatile uint64_t global_tick;
64
65
66extern uint64_t goodtrap_pc;
67extern uint64_t badtrap_pc;
68
69 // define archglobals_t type = specifications (no pointers).
70 // there is only one object of this type, the_arch
71
72typedef struct archglobals_s {
73 FLDDECL(bool_t, cmp_mode,, get / dump,);
74 FLDDECL(int, numcores,, get / dump,); // only valid if cmp_mode
75 FLDDECL(int, numcpus,, get / dump,); // # of CPUS
76 FLDDECL(uint64_t, ramsize,, get / dump,);
77 FLDDECL(int, nwins,, get / dump,); /* number of register window */
78 FLDDECL(char *, cputype,, get / dump,); /* spitfire, cheetah */
79 FLDDECL(char *, mmutype,, get / dump,); /* spitfire, cheetah */
80 FLDDECL(int, tlbsize,, get / dump,); /* number of tlb entries */
81 FLDDECL(int, loopticks,, get,);
82 FLDDECL(int, loopticks_cp,, get,);
83 FLDDECL(int, stickincr,, get,);
84 FLDDECL(int, cpus_per_core,, get,);
85 FLDDECL(int, cpus_per_thread,, get,);
86 FLDDECL(int, numthreads,, get,);
87 FLDDECL(uint64_t, cpu_freq,, get,);
88 FLDDECL(uint64_t, stick_freq,, get,);
89 FLDDECL(uint32_t, arch_flags,, get,);
90 FLDDECL(uint32_t, skip_mp,, get,);
91 FLDDECL(uint32_t, block_mp,, get,);
92 FLDDECL(char *, ramsizeS,, get / dump,);
93 FLDDECL(char *, platform,, get,);
94 FLDDECL(uint32_t, numDCs,, get / dump,);
95 FLDDECL(uint32_t, numNICs,, get / dump,);
96 FLDDECL(bool_t, cpi,, get / dump,);
97 FLDDECL(uint64_t, mips,, get / dump,);
98 FLDDECL(uint64_t, umips,, get / dump,);
99 FLDDECL(uint64_t, kmips,, get / dump,);
100 FLDDECL(int, roundrobin,, get / dump,); /* true => fine-grained interleaving of cpus sharing worker thread */
101
102#define FARCH_0 1
103
104#define FA_NCPU (FARCH_0<<0)
105#define FA_RAMSIZE (FARCH_0<<1)
106#define FA_NWINS (FARCH_0<<2)
107#define FA_MMUTYPE (FARCH_0<<3)
108#define FA_TLBSIZE (FARCH_0<<4)
109#define FA_LOOPTCK (FARCH_0<<5)
110#define FA_STICKINCR (FARCH_0<<6)
111#define FA_CPUTHR (FARCH_0<<7)
112#define FA_FREQ (FARCH_0<<8)
113#define FA_SFREQ (FARCH_0<<9)
114#define FA_CPUMOD (FARCH_0<<10)
115#define FA_PLATFORM (FARCH_0<<11)
116
117#define FA_CPU_READY (FA_NCPU | FA_NWINS | FA_MMUTYPE | FA_FREQ | FA_SFREQ)
118
119#ifdef MODULE
120
121#define FA_READY (FA_NCPU|FA_RAMSIZE|FA_NWINS|FA_MMUTYPE|FA_TLBSIZE| \
122 FA_LOOPTCK|FA_STICKINCR|FA_FREQ|FA_SFREQ| \
123 FA_CPUMOD|FA_CPUTHR|FA_PLATFORM)
124
125#else
126
127#define FA_READY (FA_NCPU|FA_RAMSIZE| \
128 FA_CPUTHR|FA_TLBSIZE|FA_MMUTYPE|FA_NWINS| \
129 FA_LOOPTCK|FA_STICKINCR|FA_FREQ|FA_SFREQ|FA_PLATFORM)
130
131#endif /// MODULE
132
133} archglobals_t;
134
135extern archglobals_t volatile the_arch;
136
137extern volatile int64_t the_arch_cmips; /* sw05b Hack */
138extern volatile int the_arch_ccntx;
139
140
141
142
143
144// ----------------------------------------------------------------------------
145// below are the states of the blaze simulation system,
146// blaze_run_state should be a private variable,
147// the SYSTEM_{run, stop, stepi, stept, etc}_UI functions are the only ones
148// that should touch/modify it (after verifying the requested transition)
149//
150// these are all the legal state transitions:
151//
152// \to
153// from \ "run" "stop" "stepi" CTRL-C "sync on" "sync off" "stept"
154// +------------------------------------------------------------------
155// STOP | RUN STEP GTWAIT
156// STEP | STOP
157// RUN | STOP STOP
158// GTWAIT | STOP GTSTEP
159// GTSTEP | STOP
160// UNINIT |
161//
162// the only way out of UNINIT is by calling SYSTEM_init() which puts the
163// system into STOP state after doing whatever is necessary to ensure that
164// the simulation system is in fact ready.
165//
166
167
168typedef enum {
169 e_BLAZE_INVALID = 0,
170 e_BLAZE_STOP = 1,
171 e_BLAZE_STEP = 2, /* synchronous sim, no ui prompt till done */
172 e_BLAZE_RUN = 3, /* async sim, ui prompt while running cpus */
173 e_BLAZE_GTWAIT = 4, /* waiting for next global-time-sync interval */
174 e_BLAZE_GTSTEP = 5 /* running current global-time-sync interval */
175} e_blaze_runstate_t;
176
177 /* "state" */
178extern volatile e_blaze_runstate_t blaze_run_state;
179extern volatile int blaze_stop_request;
180
181 /* predicates */
182#define IN_STOP_STATE(e) ((e) == e_BLAZE_STOP)
183#define IN_STEP_STATE(e) ((e) == e_BLAZE_STEP)
184#define IN_RUN_STATE(e) ((e) == e_BLAZE_RUN)
185#define IN_GTWAIT_STATE(e) ((e) == e_BLAZE_GTWAIT)
186#define IN_GTSTEP_STATE(e) ((e) == e_BLAZE_GTSTEP)
187
188#define ANY_RUNNING_STATE(e) ((e) > e_BLAZE_STOP) /* NB. below */
189#define ANY_SYNC_STATE(e) ((e) >= e_BLAZE_GTWAIT) /* NB. below */
190#define IN_SYNC_STATE(e) ((e) >= e_BLAZE_GTWAIT) /* NB. below */
191
192
193 /* assignments */
194#define BLAZE_STOP(e) (e = e_BLAZE_STOP)
195#define BLAZE_STEP(e) (e = e_BLAZE_STEP)
196#define BLAZE_RUN(e) (e = e_BLAZE_RUN)
197#define BLAZE_GTWAIT(e) (e = e_BLAZE_GTWAIT)
198#define BLAZE_GTSTEP(e) (e = e_BLAZE_GTSTEP)
199
200#define BLAZE_CLEAR(e) (e = (e_blaze_runstate_t) 0)
201
202//
203// NB. STEP, RUN, GTWAIT and GTSTEP must be the last values of the enum, and
204// in that order, to make race-condition-free testing for ANY_RUNNING_STATE
205// and ANY_SYNC_STATE simple.
206//
207
208#endif /* _BLAZE_GLOBALS_H */