* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: blaze_globals.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
#pragma ident "@(#)1.27 04/07/22 blaze_globals.h"
#include "dev_registry.h"
extern devRegistry
* samDevs
;
extern uint32_t BLAZE_restore_from_checkpoint();
extern char *get_restore_dir();
/* generic signal handlers that ui/device/cpu threads may need */
extern void sigignore_handler (int sig
);
extern void sigconfirm_handler (int sig
); /* for CTRL-C, BREAK, HANGUP !!! */
extern void sigcore_handler(int sig
, siginfo_t
*si
, void *arg2
);
extern const char *network_device_to_snoop
[];
extern int network_device_minor_num
[];
#define MAX_MP 1024 // Maximum number of CPU's supported
extern volatile uint64_t global_tick
;
extern uint64_t goodtrap_pc
;
extern uint64_t badtrap_pc
;
// define archglobals_t type = specifications (no pointers).
// there is only one object of this type, the_arch
typedef struct archglobals_s
{
FLDDECL(bool_t
, cmp_mode
,, get
/ dump
,);
FLDDECL(int, numcores
,, get
/ dump
,); // only valid if cmp_mode
FLDDECL(int, numcpus
,, get
/ dump
,); // # of CPUS
FLDDECL(uint64_t, ramsize
,, get
/ dump
,);
FLDDECL(int, nwins
,, get
/ dump
,); /* number of register window */
FLDDECL(char *, cputype
,, get
/ dump
,); /* spitfire, cheetah */
FLDDECL(char *, mmutype
,, get
/ dump
,); /* spitfire, cheetah */
FLDDECL(int, tlbsize
,, get
/ dump
,); /* number of tlb entries */
FLDDECL(int, loopticks
,, get
,);
FLDDECL(int, loopticks_cp
,, get
,);
FLDDECL(int, stickincr
,, get
,);
FLDDECL(int, cpus_per_core
,, get
,);
FLDDECL(int, cpus_per_thread
,, get
,);
FLDDECL(int, numthreads
,, get
,);
FLDDECL(uint64_t, cpu_freq
,, get
,);
FLDDECL(uint64_t, stick_freq
,, get
,);
FLDDECL(uint32_t, arch_flags
,, get
,);
FLDDECL(uint32_t, skip_mp
,, get
,);
FLDDECL(uint32_t, block_mp
,, get
,);
FLDDECL(char *, ramsizeS
,, get
/ dump
,);
FLDDECL(char *, platform
,, get
,);
FLDDECL(uint32_t, numDCs
,, get
/ dump
,);
FLDDECL(uint32_t, numNICs
,, get
/ dump
,);
FLDDECL(bool_t
, cpi
,, get
/ dump
,);
FLDDECL(uint64_t, mips
,, get
/ dump
,);
FLDDECL(uint64_t, umips
,, get
/ dump
,);
FLDDECL(uint64_t, kmips
,, get
/ dump
,);
FLDDECL(int, roundrobin
,, get
/ dump
,); /* true => fine-grained interleaving of cpus sharing worker thread */
#define FA_NCPU (FARCH_0<<0)
#define FA_RAMSIZE (FARCH_0<<1)
#define FA_NWINS (FARCH_0<<2)
#define FA_MMUTYPE (FARCH_0<<3)
#define FA_TLBSIZE (FARCH_0<<4)
#define FA_LOOPTCK (FARCH_0<<5)
#define FA_STICKINCR (FARCH_0<<6)
#define FA_CPUTHR (FARCH_0<<7)
#define FA_FREQ (FARCH_0<<8)
#define FA_SFREQ (FARCH_0<<9)
#define FA_CPUMOD (FARCH_0<<10)
#define FA_PLATFORM (FARCH_0<<11)
#define FA_CPU_READY (FA_NCPU | FA_NWINS | FA_MMUTYPE | FA_FREQ | FA_SFREQ)
#define FA_READY (FA_NCPU|FA_RAMSIZE|FA_NWINS|FA_MMUTYPE|FA_TLBSIZE| \
FA_LOOPTCK|FA_STICKINCR|FA_FREQ|FA_SFREQ| \
FA_CPUMOD|FA_CPUTHR|FA_PLATFORM)
#define FA_READY (FA_NCPU|FA_RAMSIZE| \
FA_CPUTHR|FA_TLBSIZE|FA_MMUTYPE|FA_NWINS| \
FA_LOOPTCK|FA_STICKINCR|FA_FREQ|FA_SFREQ|FA_PLATFORM)
extern archglobals_t
volatile the_arch
;
extern volatile int64_t the_arch_cmips
; /* sw05b Hack */
extern volatile int the_arch_ccntx
;
// ----------------------------------------------------------------------------
// below are the states of the blaze simulation system,
// blaze_run_state should be a private variable,
// the SYSTEM_{run, stop, stepi, stept, etc}_UI functions are the only ones
// that should touch/modify it (after verifying the requested transition)
// these are all the legal state transitions:
// from \ "run" "stop" "stepi" CTRL-C "sync on" "sync off" "stept"
// +------------------------------------------------------------------
// STOP | RUN STEP GTWAIT
// the only way out of UNINIT is by calling SYSTEM_init() which puts the
// system into STOP state after doing whatever is necessary to ensure that
// the simulation system is in fact ready.
e_BLAZE_STEP
= 2, /* synchronous sim, no ui prompt till done */
e_BLAZE_RUN
= 3, /* async sim, ui prompt while running cpus */
e_BLAZE_GTWAIT
= 4, /* waiting for next global-time-sync interval */
e_BLAZE_GTSTEP
= 5 /* running current global-time-sync interval */
extern volatile e_blaze_runstate_t blaze_run_state
;
extern volatile int blaze_stop_request
;
#define IN_STOP_STATE(e) ((e) == e_BLAZE_STOP)
#define IN_STEP_STATE(e) ((e) == e_BLAZE_STEP)
#define IN_RUN_STATE(e) ((e) == e_BLAZE_RUN)
#define IN_GTWAIT_STATE(e) ((e) == e_BLAZE_GTWAIT)
#define IN_GTSTEP_STATE(e) ((e) == e_BLAZE_GTSTEP)
#define ANY_RUNNING_STATE(e) ((e) > e_BLAZE_STOP) /* NB. below */
#define ANY_SYNC_STATE(e) ((e) >= e_BLAZE_GTWAIT) /* NB. below */
#define IN_SYNC_STATE(e) ((e) >= e_BLAZE_GTWAIT) /* NB. below */
#define BLAZE_STOP(e) (e = e_BLAZE_STOP)
#define BLAZE_STEP(e) (e = e_BLAZE_STEP)
#define BLAZE_RUN(e) (e = e_BLAZE_RUN)
#define BLAZE_GTWAIT(e) (e = e_BLAZE_GTWAIT)
#define BLAZE_GTSTEP(e) (e = e_BLAZE_GTSTEP)
#define BLAZE_CLEAR(e) (e = (e_blaze_runstate_t) 0)
// NB. STEP, RUN, GTWAIT and GTSTEP must be the last values of the enum, and
// in that order, to make race-condition-free testing for ANY_RUNNING_STATE
// and ANY_SYNC_STATE simple.
#endif /* _BLAZE_GLOBALS_H */