Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: N2_ResetGen.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 | #include <iostream> | |
23 | #include <unistd.h> | |
24 | #include "N2_ResetGen.h" | |
25 | #include "N2_Model.h" | |
26 | #include "SS_Io.h" | |
27 | #include "N2_Cpu.h" | |
28 | ||
29 | using namespace std; | |
30 | ||
31 | N2_ResetGen::N2_ResetGen( N2_Model* _model, SS_AddressMap* map, SS_Paddr lo, SS_Paddr hi )/*{{{*/ | |
32 | : | |
33 | model(_model) | |
34 | { | |
35 | // N2 RESET_GEN, 0x89_0000_0808, 8-byte | |
36 | if ((lo != 0x8900000808) || (hi != 0x8900000808+7)) | |
37 | { | |
38 | cerr << "ERROR: N2_ResetGen (0x89_0000_0808) being given wrong range, lo=0x" << hex << lo << " hi=0x" << hi << endl; | |
39 | return; | |
40 | } | |
41 | map->add(lo,hi,this,SS_AddressMap::REL,N2_ResetGen::access); | |
42 | } | |
43 | /*}}}*/ | |
44 | N2_ResetGen::~N2_ResetGen()/*{{{*/ | |
45 | { | |
46 | } | |
47 | /*}}}*/ | |
48 | ||
49 | void N2_ResetGen::access( void* obj, uint_t sid, SS_Access::Type type, SS_Paddr pa, uint_t size, uint64_t* data )/*{{{*/ | |
50 | { | |
51 | N2_ResetGen* self = (N2_ResetGen*)obj; | |
52 | ||
53 | switch (type) | |
54 | { | |
55 | case SS_Access::LOAD: | |
56 | // reset_gen is always reset to 0 after the corresponding reset action | |
57 | // is completed | |
58 | *data = 0; | |
59 | break; | |
60 | case SS_Access::STORE: | |
61 | // reset_gen[3] : dbr_gen | |
62 | // reset_gen[1] : xir_gen | |
63 | // reset_gen[0] : wmr_gen | |
64 | // behavior is undefined if more than one bit is written 1 | |
65 | if (*data & 0x1) | |
66 | { | |
67 | // wmr_gen, chipwide wmr | |
68 | self->model->warm_reset(); | |
69 | } | |
70 | else if (*data & 0x2) | |
71 | { | |
72 | // xir_gen, xir strands in ASI_XIR_STEERING | |
73 | self->model->xtrn_reset(); | |
74 | } | |
75 | else if (*data & 0x8) | |
76 | { | |
77 | // dbr_gen, chipwide dbr | |
78 | self->model->warm_reset(); | |
79 | } | |
80 | break; | |
81 | default: | |
82 | assert(0); | |
83 | } | |
84 | } | |
85 | /*}}}*/ | |
86 | ||
87 | ||
88 | ||
89 | ||
90 | ||
91 |