| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: queue.h |
| 5 | * Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved |
| 6 | * 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
| 7 | * |
| 8 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; version 2 of the License. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | * |
| 23 | * For the avoidance of doubt, and except that if any non-GPL license |
| 24 | * choice is available it will apply instead, Sun elects to use only |
| 25 | * the General Public License version 2 (GPLv2) at this time for any |
| 26 | * software where a choice of GPL license versions is made |
| 27 | * available with the language indicating that GPLv2 or any later version |
| 28 | * may be used, or where a choice of which version of the GPL is applied is |
| 29 | * otherwise unspecified. |
| 30 | * |
| 31 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 32 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 33 | * have any questions. |
| 34 | * |
| 35 | * |
| 36 | * ========== Copyright Header End ============================================ |
| 37 | */ |
| 38 | #ifndef _QUEUE_C_H_ |
| 39 | #define _QUEUE_C_H_ |
| 40 | #include <stdlib.h> |
| 41 | #include <stdio.h> |
| 42 | #include <values.h> |
| 43 | #include <limits.h> |
| 44 | #include "vcsuser.h" |
| 45 | #include "acc_user.h" |
| 46 | #define NUMCORE 8 |
| 47 | #define NUMTHREAD 8 |
| 48 | #define GLOBAL_REG 1 |
| 49 | #define WINDOW_REG 2 |
| 50 | #define CONTROL_REG 3 |
| 51 | #define FLOAT_REG 4 |
| 52 | |
| 53 | #define INIT_Q 0 |
| 54 | #define PUSH_Q 1 |
| 55 | #define POP_Q 2 |
| 56 | #define STATUS_Q 3 |
| 57 | #define PR_INSTR_Q 4 |
| 58 | #define FLUSH_TH_Q 5 |
| 59 | |
| 60 | #define LLONG_BIGNUM (MAXLONG|(MAXLONG <<12)) |
| 61 | |
| 62 | // Main Record node for Exp/Act value checking |
| 63 | typedef struct t_check_item{ |
| 64 | unsigned long long time; // Time stamp |
| 65 | char type; // register Type |
| 66 | int reg_num; // register Number |
| 67 | int level; // global level Number |
| 68 | int win; // window Number |
| 69 | unsigned long long value; // 64 bit value |
| 70 | } *t_check_item_ptr; |
| 71 | |
| 72 | typedef struct t_instr_item { |
| 73 | unsigned long long va; // Virtual Address |
| 74 | unsigned long long pa; // Physical Address |
| 75 | int num; // Sequential number |
| 76 | char *instruction; // Instruction String |
| 77 | } *t_instr_item_ptr; |
| 78 | |
| 79 | // Queue pointers defined here .. |
| 80 | // The record is a void pointer to not tie the functions to |
| 81 | // a particular type .. |
| 82 | |
| 83 | // Thread wise list node |
| 84 | typedef struct t_list_node{ |
| 85 | void *record; |
| 86 | struct t_list_node *next; |
| 87 | } *t_list_node_ptr; |
| 88 | |
| 89 | // Head node for thread wise list. |
| 90 | typedef struct t_list_head_node{ |
| 91 | t_list_node_ptr head_ptr, tail_ptr; |
| 92 | }*t_list_head_ptr; |
| 93 | |
| 94 | // Main List Node - contains array of lists |
| 95 | typedef struct mt_list { |
| 96 | t_list_head_ptr t_list [NUMCORE*NUMTHREAD]; |
| 97 | } *mt_list_ptr ; |
| 98 | |
| 99 | // Statics visible in all source files .. |
| 100 | |
| 101 | mt_list_ptr q_instr; |
| 102 | int debug_queue; |
| 103 | int nas_trace; |
| 104 | int quiet; |
| 105 | #ifndef USE_FPRINTF |
| 106 | int nas_fd; |
| 107 | #else |
| 108 | FILE *nas_fd; |
| 109 | #endif |
| 110 | int show_instr_pa; |
| 111 | char indelta [64]; |
| 112 | |
| 113 | #ifndef __QUEUE_C_ |
| 114 | // Prototypes |
| 115 | |
| 116 | |
| 117 | mt_list_ptr init_q (mt_list_ptr q) ; |
| 118 | |
| 119 | int push_q (mt_list_ptr q, int tid, void *item) ; |
| 120 | |
| 121 | void * pop_q (mt_list_ptr q, int tid ) ; |
| 122 | |
| 123 | int print_q (mt_list_ptr q, int tid) ; |
| 124 | |
| 125 | int size_q (mt_list_ptr q, int tid) ; |
| 126 | |
| 127 | unsigned long long status_q (mt_list_ptr q) ; |
| 128 | |
| 129 | int oldest_t(mt_list_ptr q); |
| 130 | |
| 131 | t_instr_item_ptr scan_instr4va (mt_list_ptr q, int tid, unsigned long long va); |
| 132 | |
| 133 | #endif |
| 134 | #endif |
| 135 | |