tsunami.cc revision 8789:a8b63a0ee14c
18999Suri.wiener@arm.com/*
28999Suri.wiener@arm.com * Copyright (c) 2004-2005 The Regents of The University of Michigan
38999Suri.wiener@arm.com * All rights reserved.
48999Suri.wiener@arm.com *
58999Suri.wiener@arm.com * Redistribution and use in source and binary forms, with or without
68999Suri.wiener@arm.com * modification, are permitted provided that the following conditions are
78999Suri.wiener@arm.com * met: redistributions of source code must retain the above copyright
88999Suri.wiener@arm.com * notice, this list of conditions and the following disclaimer;
98999Suri.wiener@arm.com * redistributions in binary form must reproduce the above copyright
108999Suri.wiener@arm.com * notice, this list of conditions and the following disclaimer in the
118999Suri.wiener@arm.com * documentation and/or other materials provided with the distribution;
128999Suri.wiener@arm.com * neither the name of the copyright holders nor the names of its
134762Snate@binkert.org * contributors may be used to endorse or promote products derived from
147534Ssteve.reinhardt@amd.com * this software without specific prior written permission.
154762Snate@binkert.org *
164762Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
174762Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
184762Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
194762Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
204762Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
214762Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
224762Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
234762Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
244762Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
254762Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
264762Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
274762Snate@binkert.org *
284762Snate@binkert.org * Authors: Ali Saidi
294762Snate@binkert.org */
304762Snate@binkert.org
314762Snate@binkert.org/** @file
324762Snate@binkert.org * Implementation of Tsunami platform.
334762Snate@binkert.org */
344762Snate@binkert.org
354762Snate@binkert.org#include <deque>
364762Snate@binkert.org#include <string>
374762Snate@binkert.org#include <vector>
384762Snate@binkert.org
394762Snate@binkert.org#include "arch/alpha/system.hh"
404762Snate@binkert.org#include "config/the_isa.hh"
414762Snate@binkert.org#include "cpu/intr_control.hh"
424762Snate@binkert.org#include "dev/alpha/tsunami.hh"
434762Snate@binkert.org#include "dev/alpha/tsunami_cchip.hh"
444762Snate@binkert.org#include "dev/alpha/tsunami_io.hh"
454762Snate@binkert.org#include "dev/alpha/tsunami_pchip.hh"
464762Snate@binkert.org#include "dev/terminal.hh"
474762Snate@binkert.org
484762Snate@binkert.orgusing namespace std;
496001Snate@binkert.org//Should this be AlphaISA?
506001Snate@binkert.orgusing namespace TheISA;
514762Snate@binkert.org
524762Snate@binkert.orgTsunami::Tsunami(const Params *p)
534851Snate@binkert.org    : Platform(p), system(p->system)
548999Suri.wiener@arm.com{
559262Ssascha.bischoff@arm.com    for (int i = 0; i < Tsunami::Max_CPUs; i++)
568999Suri.wiener@arm.com        intr_sum_type[i] = 0;
577525Ssteve.reinhardt@amd.com}
588664SAli.Saidi@ARM.com
594762Snate@binkert.orgvoid
609811Sandreas.hansson@arm.comTsunami::init()
619811Sandreas.hansson@arm.com{
626654Snate@binkert.org    AlphaSystem *alphaSystem = dynamic_cast<AlphaSystem *>(system);
639521SAndreas.Sandberg@ARM.com    assert(alphaSystem);
649521SAndreas.Sandberg@ARM.com    alphaSystem->setIntrFreq(io->frequency());
659521SAndreas.Sandberg@ARM.com}
669524SAndreas.Sandberg@ARM.com
679521SAndreas.Sandberg@ARM.comvoid
689521SAndreas.Sandberg@ARM.comTsunami::postConsoleInt()
694762Snate@binkert.org{
704762Snate@binkert.org    io->postPIC(0x10);
717531Ssteve.reinhardt@amd.com}
728245Snate@binkert.org
738234Snate@binkert.orgvoid
747525Ssteve.reinhardt@amd.comTsunami::clearConsoleInt()
757525Ssteve.reinhardt@amd.com{
767525Ssteve.reinhardt@amd.com    io->clearPIC(0x10);
777525Ssteve.reinhardt@amd.com}
787525Ssteve.reinhardt@amd.com
794762Snate@binkert.orgvoid
804762Snate@binkert.orgTsunami::postPciInt(int line)
814762Snate@binkert.org{
827528Ssteve.reinhardt@amd.com    cchip->postDRIR(line);
837528Ssteve.reinhardt@amd.com}
847528Ssteve.reinhardt@amd.com
857528Ssteve.reinhardt@amd.comvoid
867527Ssteve.reinhardt@amd.comTsunami::clearPciInt(int line)
877527Ssteve.reinhardt@amd.com{
885037Smilesck@eecs.umich.edu    cchip->clearDRIR(line);
895773Snate@binkert.org}
905773Snate@binkert.org
917527Ssteve.reinhardt@amd.comAddr
927527Ssteve.reinhardt@amd.comTsunami::pciToDma(Addr pciAddr) const
937527Ssteve.reinhardt@amd.com{
945773Snate@binkert.org    return pchip->translatePciToDma(pciAddr);
954762Snate@binkert.org}
968664SAli.Saidi@ARM.com
978675SAli.Saidi@ARM.com
988675SAli.Saidi@ARM.comAddr
998675SAli.Saidi@ARM.comTsunami::calcPciConfigAddr(int bus, int dev, int func)
1008675SAli.Saidi@ARM.com{
1018675SAli.Saidi@ARM.com   return pchip->calcConfigAddr(bus, dev, func);
1028675SAli.Saidi@ARM.com}
1038675SAli.Saidi@ARM.com
1048675SAli.Saidi@ARM.comAddr
1058664SAli.Saidi@ARM.comTsunami::calcPciIOAddr(Addr addr)
1068999Suri.wiener@arm.com{
1078664SAli.Saidi@ARM.com   return pchip->calcIOAddr(addr);
1084762Snate@binkert.org}
1096001Snate@binkert.org
1104762Snate@binkert.orgAddr
1114762Snate@binkert.orgTsunami::calcPciMemAddr(Addr addr)
1127527Ssteve.reinhardt@amd.com{
1137527Ssteve.reinhardt@amd.com   return pchip->calcMemAddr(addr);
1144762Snate@binkert.org}
1154762Snate@binkert.org
1167527Ssteve.reinhardt@amd.comvoid
1174762Snate@binkert.orgTsunami::serialize(std::ostream &os)
1184762Snate@binkert.org{
1197527Ssteve.reinhardt@amd.com    SERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs);
1204762Snate@binkert.org}
1216001Snate@binkert.org
1226001Snate@binkert.orgvoid
1234762Snate@binkert.orgTsunami::unserialize(Checkpoint *cp, const std::string &section)
1247531Ssteve.reinhardt@amd.com{
1257531Ssteve.reinhardt@amd.com    UNSERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs);
1267532Ssteve.reinhardt@amd.com}
1277532Ssteve.reinhardt@amd.com
1287532Ssteve.reinhardt@amd.comTsunami *
1297531Ssteve.reinhardt@amd.comTsunamiParams::create()
1307532Ssteve.reinhardt@amd.com{
1317532Ssteve.reinhardt@amd.com    return new Tsunami(this);
1327531Ssteve.reinhardt@amd.com}
1339262Ssascha.bischoff@arm.com