Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: SS_Cpu.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 | #ifndef __SS_Cpu_h__ | |
25 | #define __SS_Cpu_h__ | |
26 | ||
27 | #include "SS_Types.h" | |
28 | #include "SS_Node.h" | |
29 | #include "SS_SnapShot.h" | |
30 | #include "SS_MemErrDetector.h" | |
31 | ||
32 | class SS_Strand; | |
33 | class SS_Model; | |
34 | ||
35 | class SS_Cpu : public SS_Node | |
36 | { | |
37 | public: | |
38 | SS_Cpu( SS_Model& _model, const char* _name ); | |
39 | ||
40 | SS_Model& model; | |
41 | ||
42 | virtual void hard_reset() = 0; | |
43 | virtual void warm_reset(bool intp=true) = 0; | |
44 | virtual void xtrn_reset() = 0; | |
45 | ||
46 | // The current maximum number of strands per cpu is 64. | |
47 | // This limit comes from the CMP spec, and from the choise | |
48 | // we made to use uin64_t types as bitmaps to record which | |
49 | // strands are active, enabled, runnning, and stepping. | |
50 | ||
51 | // the upper limit has increased, so the change. | |
52 | enum { MAX_STRAND_COUNT = 128 }; | |
53 | ||
54 | // strand_cnt() returns the number of stands in the cpu object | |
55 | ||
56 | uint_t strand_cnt() { return strand_count; } | |
57 | ||
58 | SS_Strand* strand[MAX_STRAND_COUNT]; | |
59 | ||
60 | // snapshot() is called to take a snapshot of the cpu and sibbling objects | |
61 | ||
62 | virtual void snapshot( SS_SnapShot& ); | |
63 | ||
64 | // flush() propagates the flush from model to all strands in the cpu | |
65 | ||
66 | void flush( SS_Paddr pa ); | |
67 | ||
68 | // flush() broadcasts the flush to all the strands in the cpu | |
69 | // that are actively stepping. It's processor specific still. | |
70 | // SS_Strand is the strand that issues the flush. | |
71 | ||
72 | void flush( SS_Strand* s, SS_Paddr pa, uint_t size ); | |
73 | ||
74 | // ras_flush() propagates a call to flush RAS cache state from | |
75 | // model to all strands in the cpu | |
76 | ||
77 | void ras_flush( SS_Strand* requesting_strand, SS_Paddr pa, uint64_t size, SS_MemErrDetector::CacheType type ); | |
78 | ||
79 | // clr_stepping() is called when a cpu is created by the sam virtual | |
80 | // cpu interface. After this set_stepping() is called to enable | |
81 | // individual strands. Initially all strands are stepping. | |
82 | ||
83 | void clr_stepping() | |
84 | { | |
85 | strand_stepping[0] = 0ull; | |
86 | strand_stepping[1] = 0ull; | |
87 | } | |
88 | ||
89 | bool is_stepping( uint_t strand_id ) | |
90 | { | |
91 | assert(strand_id < 128); | |
92 | return strand_stepping[strand_id >> 6] & (1ull << (strand_id & 63)); | |
93 | } | |
94 | ||
95 | // set_stepping() marks strand with id strand_id as stepping, which | |
96 | // means that flush will consider it in the flush broadcast. | |
97 | ||
98 | virtual void set_stepping( uint_t strand_id ) | |
99 | { | |
100 | assert(strand_id < 128); | |
101 | strand_stepping[strand_id >> 6] |= 1ull << (strand_id & 63); | |
102 | } | |
103 | ||
104 | // ras_enable() is called to enable ras features | |
105 | ||
106 | virtual void ras_enable(char* cmd); | |
107 | ||
108 | ||
109 | protected: | |
110 | // The stepping variable holds a bit per strands that tells if the strand | |
111 | // is stepping or not. Note that stepping does not mean that the strand is | |
112 | // running, nor does it mean the strand is halted. It just means that the | |
113 | // strand is actively part of the system setup. | |
114 | ||
115 | uint_t strand_count; // Number of strand objects available in strand | |
116 | uint64_t strand_stepping[2]; // Which strands are setup for stepping (bit vector) | |
117 | ||
118 | // change_running() is called whenever the cmp strand running status | |
119 | // changes value, to update the strandst hat receive flush oprations | |
120 | ||
121 | void change_running( uint64_t _strand_running_status ) | |
122 | { | |
123 | // @@ha144505 remove me when done | |
124 | } | |
125 | }; | |
126 | ||
127 | #endif | |
128 |