| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: tsparcv9.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 2007 Sun Microsystems, Inc. All rights reserved. |
| 25 | * Use is subject to license terms. |
| 26 | */ |
| 27 | |
| 28 | #ifndef _TSPARCV9_H_ |
| 29 | #define _TSPARCV9_H_ |
| 30 | |
| 31 | #pragma ident "@(#)tsparcv9.h 1.22 07/05/30 SMI" |
| 32 | |
| 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | /* Target SPARC v9 definitions */ |
| 38 | /* interface functions and data structs */ |
| 39 | |
| 40 | typedef enum { |
| 41 | /* MANDATORY SPARC V9 ASIs */ |
| 42 | |
| 43 | /* RW Implicit Address Space, nucleus context, TL>0 */ |
| 44 | V9_ASI_NUCLEUS = 0x4, |
| 45 | /* RW Implicit Address Space, nucleus context, TL>0 (LE) */ |
| 46 | V9_ASI_NUCLEUS_LITTLE = 0xc, |
| 47 | /* RW Primary Address Space, user privilege */ |
| 48 | V9_ASI_AS_IF_USER_PRIMARY = 0x10, |
| 49 | /* RW Secondary Address Space, user privilege */ |
| 50 | V9_ASI_AS_IF_USER_SECONDARY = 0x11, |
| 51 | /* RW Primary Address Space, user privilege (LE) */ |
| 52 | V9_ASI_AS_IF_USER_PRIMARY_LITTLE = 0x18, |
| 53 | /* RW Secondary Address Space, user privilege (LE) */ |
| 54 | V9_ASI_AS_IF_USER_SECONDARY_LITTLE = 0x19, |
| 55 | /* RW Implicit Primary Address space */ |
| 56 | V9_ASI_PRIMARY = 0x80, |
| 57 | /* RW Implicit Secondary Address space */ |
| 58 | V9_ASI_SECONDARY = 0x81, |
| 59 | /* R Primary Address space, no fault */ |
| 60 | V9_ASI_PRIMARY_NO_FAULT = 0x82, |
| 61 | /* R Secondary Address space, no fault */ |
| 62 | V9_ASI_SECONDARY_NO_FAULT = 0x83, |
| 63 | /* RW Implicit Primary Address space (LE) */ |
| 64 | V9_ASI_PRIMARY_LITTLE = 0x88, |
| 65 | /* RW Implicit Secondary Address space (LE) */ |
| 66 | V9_ASI_SECONDARY_LITTLE = 0x89, |
| 67 | /* R Primary Address space, no fault (LE) */ |
| 68 | V9_ASI_PRIMARY_NO_FAULT_LITTLE = 0x8A, |
| 69 | /* R Secondary Address space, no fault (LE) */ |
| 70 | V9_ASI_SECONDARY_NO_FAULT_LITTLE = 0x8B |
| 71 | } v9_asi_t; |
| 72 | |
| 73 | #define V9_ASI_IMPLICIT ((uint_t)-1) |
| 74 | |
| 75 | typedef struct SPARCV9_CPU sparcv9_cpu_t; |
| 76 | |
| 77 | extern sparcv9_cpu_t *sparcv9_cpu_alloc( |
| 78 | domain_t *domainp, |
| 79 | config_proc_t *config_procp, |
| 80 | uint_t nwins, |
| 81 | uint_t nglobals, |
| 82 | uint_t maxtl, |
| 83 | uint64_t ver, |
| 84 | bool_t has_fpu, |
| 85 | void *magicptr); |
| 86 | |
| 87 | bool_t sparcv9_regread(sparcv9_cpu_t *v9p, uint_t regnum, uint64_t *valp); |
| 88 | bool_t sparcv9_regwrite(sparcv9_cpu_t *v9p, uint_t regnum, uint64_t val); |
| 89 | void sparcv9_set_break(sparcv9_cpu_t *v9p, tvaddr_t addr); |
| 90 | void sparcv9_set_break_next(sparcv9_cpu_t *v9p); |
| 91 | void sparcv9_clear_break_next(sparcv9_cpu_t *v9p); |
| 92 | bool_t sparcv9_hit_break(sparcv9_cpu_t *v9p, tvaddr_t addr); |
| 93 | void sparcv9_clear_break(sparcv9_cpu_t *v9p, tvaddr_t addr); |
| 94 | void sparcv9_print_break(sparcv9_cpu_t *v9p); |
| 95 | void sparcv9_dump_break(sparcv9_cpu_t *v9p, FILE *fp); |
| 96 | void sparcv9_restore_break(FILE *fp); |
| 97 | |
| 98 | void sparcv9_active_window(simcpu_t *sp, uint_t new_window); |
| 99 | void sparcv9_active_globals(simcpu_t *sp, uint_t new_global); |
| 100 | |
| 101 | void sparcv9_perf_dump(void *v9p); |
| 102 | |
| 103 | void sparcv9_decode_me(simcpu_t *sp, xicache_instn_t *xcip); |
| 104 | |
| 105 | extern reg_map_t sparcv9_reg_map[]; |
| 106 | |
| 107 | extern void sparcv9_idis(char *bufp, uint_t size, uint32_t instn, |
| 108 | tvaddr_t address); |
| 109 | extern void sparcv9_trace_output(simcpu_t *sp, uint32_t instn); |
| 110 | extern void sparcv9_dump_stack(simcpu_t *sp); |
| 111 | |
| 112 | extern void v9_set_fsr_fp_op(simcpu_t *, uint64_t); |
| 113 | extern uint64_t v9_get_fsr(simcpu_t *); |
| 114 | extern void v9_set_fsr(simcpu_t *, uint64_t); |
| 115 | |
| 116 | #ifdef __cplusplus |
| 117 | } |
| 118 | #endif |
| 119 | |
| 120 | #endif /* _TSPARCV9_H_ */ |