malta_cchip.cc revision 12623:e6117729ae33
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Ali Saidi
29 *          Rick Strong
30 */
31
32/** @file
33 * Emulation of the Malta CChip CSRs
34 */
35
36#include "dev/mips/malta_cchip.hh"
37
38#include <deque>
39#include <string>
40#include <vector>
41
42#include "base/trace.hh"
43#include "cpu/intr_control.hh"
44#include "cpu/thread_context.hh"
45#include "debug/Malta.hh"
46#include "dev/mips/malta.hh"
47#include "dev/mips/maltareg.h"
48#include "mem/packet.hh"
49#include "mem/packet_access.hh"
50#include "mem/port.hh"
51#include "params/MaltaCChip.hh"
52#include "sim/system.hh"
53
54using namespace std;
55
56MaltaCChip::MaltaCChip(Params *p)
57    : BasicPioDevice(p, 0xfffffff), malta(p->malta)
58{
59    warn("MaltaCCHIP::MaltaCChip() not implemented.");
60
61    //Put back pointer in malta
62    malta->cchip = this;
63
64}
65
66Tick
67MaltaCChip::read(PacketPtr pkt)
68{
69    panic("MaltaCCHIP::read() not implemented.");
70    return pioDelay;
71}
72
73Tick
74MaltaCChip::write(PacketPtr pkt)
75{
76    panic("MaltaCCHIP::write() not implemented.");
77    return pioDelay;
78}
79
80void
81MaltaCChip::clearIPI(uint64_t ipintr)
82{
83    panic("MaltaCCHIP::clear() not implemented.");
84}
85
86void
87MaltaCChip::clearITI(uint64_t itintr)
88{
89    panic("MaltaCCHIP::clearITI() not implemented.");
90}
91
92void
93MaltaCChip::reqIPI(uint64_t ipreq)
94{
95    panic("MaltaCCHIP::reqIPI() not implemented.");
96}
97
98
99void
100MaltaCChip::postRTC()
101{
102    panic("MaltaCCHIP::postRTC() not implemented.");
103}
104
105void
106MaltaCChip::postIntr(uint32_t interrupt)
107{
108    uint64_t size = sys->threadContexts.size();
109    assert(size <= Malta::Max_CPUs);
110
111    for (int i=0; i < size; i++) {
112        //Note: Malta does not use index, but this was added to use the
113        //pre-existing implementation
114        malta->intrctrl->post(i, interrupt, 0);
115        DPRINTF(Malta, "posting  interrupt to cpu %d, interrupt %d\n",
116                i, interrupt);
117   }
118}
119
120void
121MaltaCChip::clearIntr(uint32_t interrupt)
122{
123    uint64_t size = sys->threadContexts.size();
124    assert(size <= Malta::Max_CPUs);
125
126    for (int i=0; i < size; i++) {
127        //Note: Malta does not use index, but this was added to use the
128        //pre-existing implementation
129        malta->intrctrl->clear(i, interrupt, 0);
130        DPRINTF(Malta, "clearing interrupt to cpu %d, interrupt %d\n",
131                i, interrupt);
132   }
133}
134
135
136void
137MaltaCChip::serialize(CheckpointOut &cp) const
138{
139}
140
141void
142MaltaCChip::unserialize(CheckpointIn &cp)
143{
144}
145
146MaltaCChip *
147MaltaCChipParams::create()
148{
149    return new MaltaCChip(this);
150}
151
152