tsunami.cc revision 8741:491297d019f3
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 */
30
31/** @file
32 * Implementation of Tsunami platform.
33 */
34
35#include <deque>
36#include <string>
37#include <vector>
38
39#include "config/full_system.hh"
40
41#if FULL_SYSTEM //XXX AlphaSystem doesn't build in SE mode yet.
42#include "arch/alpha/system.hh"
43#endif
44
45#include "config/the_isa.hh"
46#include "cpu/intr_control.hh"
47#include "dev/alpha/tsunami.hh"
48#include "dev/alpha/tsunami_cchip.hh"
49#include "dev/alpha/tsunami_io.hh"
50#include "dev/alpha/tsunami_pchip.hh"
51#include "dev/terminal.hh"
52
53using namespace std;
54//Should this be AlphaISA?
55using namespace TheISA;
56
57Tsunami::Tsunami(const Params *p)
58    : Platform(p), system(p->system)
59{
60    for (int i = 0; i < Tsunami::Max_CPUs; i++)
61        intr_sum_type[i] = 0;
62}
63
64void
65Tsunami::init()
66{
67#if FULL_SYSTEM //XXX AlphaSystem doesn't build in SE mode yet.
68    AlphaSystem *alphaSystem = dynamic_cast<AlphaSystem *>(system);
69    assert(alphaSystem);
70    alphaSystem->setIntrFreq(io->frequency());
71#endif
72}
73
74void
75Tsunami::postConsoleInt()
76{
77    io->postPIC(0x10);
78}
79
80void
81Tsunami::clearConsoleInt()
82{
83    io->clearPIC(0x10);
84}
85
86void
87Tsunami::postPciInt(int line)
88{
89    cchip->postDRIR(line);
90}
91
92void
93Tsunami::clearPciInt(int line)
94{
95    cchip->clearDRIR(line);
96}
97
98Addr
99Tsunami::pciToDma(Addr pciAddr) const
100{
101    return pchip->translatePciToDma(pciAddr);
102}
103
104
105Addr
106Tsunami::calcPciConfigAddr(int bus, int dev, int func)
107{
108   return pchip->calcConfigAddr(bus, dev, func);
109}
110
111Addr
112Tsunami::calcPciIOAddr(Addr addr)
113{
114   return pchip->calcIOAddr(addr);
115}
116
117Addr
118Tsunami::calcPciMemAddr(Addr addr)
119{
120   return pchip->calcMemAddr(addr);
121}
122
123void
124Tsunami::serialize(std::ostream &os)
125{
126    SERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs);
127}
128
129void
130Tsunami::unserialize(Checkpoint *cp, const std::string &section)
131{
132    UNSERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs);
133}
134
135Tsunami *
136TsunamiParams::create()
137{
138    return new Tsunami(this);
139}
140