Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: SS_Model.cc | |
4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
6 | // | |
7 | // The above named program is free software; you can redistribute it and/or | |
8 | // modify it under the terms of the GNU General Public | |
9 | // License version 2 as published by the Free Software Foundation. | |
10 | // | |
11 | // The above named program is distributed in the hope that it will be | |
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | // General Public License for more details. | |
15 | // | |
16 | // You should have received a copy of the GNU General Public | |
17 | // License along with this work; if not, write to the Free Software | |
18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | // | |
20 | // ========== Copyright Header End ============================================ | |
21 | /************************************************************************ | |
22 | ** | |
23 | ** Copyright (C) 2006, Sun Microsystems, Inc. | |
24 | ** | |
25 | ** Sun considers its source code as an unpublished, proprietary | |
26 | ** trade secret and it is available only under strict license provisions. | |
27 | ** This copyright notice is placed here only to protect Sun in the event | |
28 | ** the source is deemed a published work. Disassembly, decompilation, | |
29 | ** or other means of reducing the object code to human readable form | |
30 | ** is prohibited by the license agreement under which this code is | |
31 | ** provided to the user or company in possession of this copy. | |
32 | ** | |
33 | *************************************************************************/ | |
34 | ||
35 | #include "SS_Model.h" | |
36 | #include "SS_Strand.h" | |
37 | ||
38 | ||
39 | SS_Model::SS_Model()/*{{{*/ | |
40 | : | |
41 | SS_Node("sim"), | |
42 | cpu_count(0) | |
43 | {} | |
44 | /*}}}*/ | |
45 | ||
46 | void SS_Model::hard_reset()/*{{{*/ | |
47 | { | |
48 | for (uint_t i=0; i < cpu_cnt(); i++) | |
49 | cpu[i]->hard_reset(); | |
50 | } | |
51 | /*}}}*/ | |
52 | void SS_Model::warm_reset(bool intp)/*{{{*/ | |
53 | { | |
54 | for (uint_t i=0; i < cpu_cnt(); i++) | |
55 | cpu[i]->warm_reset(intp); | |
56 | } | |
57 | /*}}}*/ | |
58 | void SS_Model::xtrn_reset()/*{{{*/ | |
59 | { | |
60 | for (uint_t i=0; i < cpu_cnt(); i++) | |
61 | cpu[i]->xtrn_reset(); | |
62 | } | |
63 | /*}}}*/ | |
64 | ||
65 | void SS_Model::flush( SS_Paddr pa )/*{{{*/ | |
66 | { | |
67 | for (uint_t i=0; i < cpu_count; i++) | |
68 | cpu[i]->flush(pa); | |
69 | } | |
70 | /*}}}*/ | |
71 | bool SS_Model::flush( SS_Strand* s, SS_Paddr pa, uint_t size )/*{{{*/ | |
72 | { | |
73 | // Figure out how many strands need to receive the flush broadcast. | |
74 | // ToDo: this number n is rather static == number of vcpu instances. | |
75 | ||
76 | for (uint_t i=0; i < cpu_count; i++) | |
77 | cpu[i]->flush(s,pa,size); | |
78 | ||
79 | return true; | |
80 | } | |
81 | /*}}}*/ | |
82 | ||
83 | void SS_Model::ras_flush( SS_Strand* requesting_strand, SS_Paddr pa, uint64_t size, SS_MemErrDetector::CacheType type )/*{{{*/ | |
84 | { | |
85 | for (uint_t i=0; i < cpu_count; i++) | |
86 | cpu[i]->ras_flush(requesting_strand, pa, size, type); | |
87 | } | |
88 | /*}}}*/ | |
89 | ||
90 | void SS_Model::snapshot( SS_SnapShot& ss )/*{{{*/ | |
91 | { | |
92 | char prefix[32]; | |
93 | get_name(prefix); | |
94 | ||
95 | // First save of the version of the snapshot and safe it in the | |
96 | // snapshot object so that all snaphot routine know the version | |
97 | // by doing ss.get_version() when needed. | |
98 | ||
99 | uint_t version = ss.VERSION; | |
100 | sprintf(ss.tag,"%s.version",prefix); ss.val(&version); | |
101 | ss.set_version(version); | |
102 | ||
103 | // Get the number of cpu's and sanity check that we load the | |
104 | // same number of cpu objects. | |
105 | ||
106 | uint_t _cpu_count = cpu_count; | |
107 | sprintf(ss.tag,"%s.nr_cpus",prefix); ss.val(&cpu_count); | |
108 | if (_cpu_count != cpu_count) | |
109 | { | |
110 | fprintf(stderr,"ERROR: Snapshot %s.nr_cpus mismatch, was %d is now %d," | |
111 | " snapshot ignored\n",prefix,_cpu_count,cpu_count); | |
112 | return; | |
113 | } | |
114 | ||
115 | // Now do the rest of the snapshot routine | |
116 | ||
117 | for (uint_t i=0; i < cpu_count; i++) | |
118 | cpu[i]->snapshot(ss); | |
119 | } | |
120 | /*}}}*/ | |
121 | ||
122 | void SS_Model::ras_enable(char* cmd)/*{{{*/ | |
123 | { | |
124 | uint_t n = 0; | |
125 | for (uint_t i=0; i < cpu_count; i++) | |
126 | cpu[i]->ras_enable(cmd); | |
127 | } | |
128 | /*}}}*/ | |
129 | ||
130 |