Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / include / mmi-blaze.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: mmi-blaze.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 ============================================
*/
#ifndef _mmi_blaze_h_
#define _mmi_blaze_h_
/* mmi-blaze.h
* blaze implementation-dependent parts of the MMI API
*/
#include <sys/types.h>
#include "types.h"
#include "cpu_interface.h" // #include "cpu.h"
#include "mem.h"
#include "system.h"
#include "tracemod.h"
typedef cpuT cpu_t;
typedef memT mem_t;
typedef uint32_t resettype_t;
typedef uint32_t cpuctlreg_t;
typedef uint32_t trapreg_t;
typedef uint32_t objtype_t;
typedef tracemod_t module_t;
/* for non-peripheral "devices" that implement ASIs */
/*typedef int (*fn_asi_action) (void *cbd, uint32_t asi, uint64_t vaddr, uint64_t *buf, int size, cpu_t *cpu);
typedef int (*fn_asi_action_2) (void *cbd, uint32_t asi, uint64_t vaddr, uint64_t *buf, int size, uint32_t cpuid);*/
#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif
/*void mmi_register_asi_action(module_t *module, fn_asi_action ld_handler, fn_asi_action st_handler);
void mmi_register_asi_action_2 (module_t *module, uint32_t asi, fn_asi_action_2 ld_handler, fn_asi_action_2 st_handler); */
int mmi_register_cb_data (module_t *module, void *cb_data);
void * mmi_get_cb_data (module_t *module);
void * mmi_get_asi_cb_data (module_t *module);
typedef void (*fn_event_cpu)(void *cb_data, cpu_t *cpu, void *info);
int mmi_register_cb_instr (module_t *module, fn_event_cpu handler);
int mmi_register_cb_memop (module_t *module, fn_event_cpu handler);
int mmi_register_cb_trap (module_t *module, fn_event_cpu handler);
int mmi_register_cb_trapexit (module_t *module, fn_event_cpu handler);
int mmi_register_cb_tlb (module_t *module, fn_event_cpu handler);
int mmi_register_cb_cpustate (module_t *module, fn_event_cpu handler);
typedef void (*fn_event_dma)(void *cb_data, void *info);
int mmi_register_cb_dma (module_t *module, fn_event_dma handler);
/* set this mask using definitions from tracemod.h */
int mmi_set_cb_mask (module_t *module, uint32_t mask);
mem_t* mmi_get_memobj (cpu_t *cpu);
// FIXME: actually for SCHIZO we have TWO TLBs (PCI A, B)
int mmi_iommu_va2pa (module_t *module, int is_read, uint64_t va, uint64_t *pa);
int mmi_mmu_va2pa (module_t *module, int is_read, uint64_t va, uint64_t *pa);
int mmi_mmu_va2pa_by_id (uint32_t cpuid, int is_read, uint64_t va, uint64_t *pa);
#define mmi_memread8s memread8s
#define mmi_memread8u memread8u
#define mmi_memread16s memread16s
#define mmi_memread16u memread16u
#define mmi_memread32s memread32s
#define mmi_memread32u memread32u
#define mmi_memread64s memread64s
#define mmi_memread64u memread64u
#define mmi_memread_blk memread8u_blk_nl
#define mmi_memwrite8 memwrite8u_nl
#define mmi_memwrite16 memwrite16u_nl
#define mmi_memwrite32 memwrite32u_nl
#define mmi_memwrite64 memwrite64u_nl
#define mmi_memwrite_blk memwrite8u_blk_nl
#define mmi_mem_casx mem_casx
//
int mmi_get_ncpu ();
// get the sid of the Vcpu, given the Vcpu pointer
int mmi_get_cpu_sid (cpu_t *cpu);
// given the sid, get the Vcpu pointer
cpu_t *mmi_get_cpuptr_by_sid (int id) ;
// ?? int
char *mmi_get_comment_string (void *obj, objtype_t type);
//?????????
int mmi_complete_delayed_load (cpu_t *cpu, uint64_t value);
int mmi_delay_execution (cpu_t *cpu, blaze_cycle_t delay);
int mmi_stop();
int mmi_run();
int mmi_is_stopped();
int mmi_run_single_threaded();
typedef uint32_t vartype_t;
enum {
VAR_INT = 555, // 32 bit
VAR_LONG_INT,
VAR_STRING,
VAR_BOOL
};
typedef void (*fn_setvar)(void *cb_data, void *value);
int mmi_register_ui_variable (module_t *module, const char *varname,
vartype_t vartype, void *varptr, int writable, fn_setvar writer);
int mmi_set_ui_variable (module_t *module, const char *varname, void *varptr);
#if 0
{
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _mmi_blaze_h_