Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / system / tracemod / include / tm_impl.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: tm_impl.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 ============================================
*/
/*
* Copyright (C) 2004 Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _TM_IMPL_H
#define _TM_IMPL_H
#pragma ident "@(#)1.36 06/05/19 tm_impl.h"
#include "blaze-data.h"
#include "mmi.h"
#include "mmi-blaze.h"
/////////////////////////////////////////
typedef struct asi_handler_t
{
uint32_t asi;
uint64_t vaddr;
mmi_ld_asi_action mmi_ld_action;
mmi_st_asi_action mmi_st_action;
} AsiHandlerT;
typedef List1Node<AsiHandlerT> AsiHandlerNode;
/////////////////////////////////////////
typedef struct ldm_cmd_t
{
fn_ui_1 cmd_action_1;
fn_ui_2 cmd_action_2;
char *name;
struct ldm_t *ldm;
struct ldm_cmd_t *next;
} LdmCmd;
typedef List1Node<LdmCmd> LdmCmdNode;
/////////////////////////////////////////
typedef struct ldm_time_intf
{
int64_t threshold;
int64_t cnt;
int64_t abs_cnt;
fn_event_cycle event_handler;
TM_OPAQUE_DATA client_data;
struct ldm_time_intf *next;
struct ldm_time_intf *self;
tracemod_t *owner;
#define TM_INTF_STATUS_ENABLED 22
#define TM_INTF_STATUS_DISABLED 33
uint32_t status;
} ldm_time_intf;
/////////////////////////////////////////
struct ldm_t
{
uint32_t mode ; // TM_BUFMODE || TM_CBMODE
Byte type;
bool_t valid;
void *blaze_data;
uint32_t event_mask;
char *name;
char *soname; // name of *.so file
char *help;
void *so_handle; // is returned by DLOPEN
void *ldm_arg;
TM_OPAQUE_DATA client_data;
TM_OPAQUE_DATA asi_client_data;
fn_time_interval ti_action;
mmi_interface_cb interface_cb;
mmi_config_cb config_cb;
mmi_modinfo_cb modinfo_cb;
// tracing callbacks
fn_cpustat cpustat_action;
fn_cpustatB cpustat_actionB;
// misc callback (io, asi)
fn_misc io_ld_action;
fn_misc io_st_action;
fn_misc io_mmi_ld_action;
fn_misc io_mmi_st_action;
fn_misc asi_ld_action;
fn_misc asi_st_action;
////////////////////////////////////
mmi_instance_creator create_instance;
////////////////////////////////////
CpuInfo *pinfo,
*pinfo_cur,
*pinfo_last;
uint32_t pirec_size;
uint8_t ea_valid[MAX_MP];
uint8_t tr_valid[MAX_MP];
uint8_t memop[MAX_MP];
int argc;
char **argv;
AsiHandlerNode *headAsi;
// struct ldm_t *next;
struct ldm_t *parent;
}; // struct ldm_t;
typedef List1Node<Ldm> LdmNode;
extern LdmNode *head_ldm;
extern LdmNode *head_spec_ldm;
/////////////////////////////////////////
//void tm_handle_tlb (cpuT* sp, Ldm* pldm, Tlb_t *ptlb, uint32_t idx);
void ldm_tick_ext_init ();
Ldm * ldm_add_spec (char * name, const char *soname);
/////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*fn_setvar_local)(void *cb_data, void *value);
#ifdef __cplusplus
}
#endif
typedef struct mmi_var_t {
const char * name;
uint32_t vtype;
uint32_t writable;
void * varptr;
fn_setvar_local action;
Ldm * module;
} MmiVar;
typedef List1Node<MmiVar> MmiVarNode;
// MMI dump-restore functionality
// this mirrors blaze DR, but hides the DR_opaque interface from mmi modules
struct mmi_dr_s {
void * userdata;
char *name;
mmi_dump_cb dump_fn;
mmi_restore_cb restore_fn;
}; // struct mmi_dr_s
extern mmi_dr_s * mmi_dr_list;
extern int mmi_dr_list_sz;
extern int mmi_dr_list_count;
#endif /* TM_IMPL_H */