tsunami.cc revision 2665
11689SN/A/*
27854SAli.Saidi@ARM.com * Copyright (c) 2004-2005 The Regents of The University of Michigan
37854SAli.Saidi@ARM.com * All rights reserved.
47854SAli.Saidi@ARM.com *
57854SAli.Saidi@ARM.com * Redistribution and use in source and binary forms, with or without
67854SAli.Saidi@ARM.com * modification, are permitted provided that the following conditions are
77854SAli.Saidi@ARM.com * met: redistributions of source code must retain the above copyright
87854SAli.Saidi@ARM.com * notice, this list of conditions and the following disclaimer;
97854SAli.Saidi@ARM.com * redistributions in binary form must reproduce the above copyright
107854SAli.Saidi@ARM.com * notice, this list of conditions and the following disclaimer in the
117854SAli.Saidi@ARM.com * documentation and/or other materials provided with the distribution;
127854SAli.Saidi@ARM.com * neither the name of the copyright holders nor the names of its
137854SAli.Saidi@ARM.com * contributors may be used to endorse or promote products derived from
142329SN/A * this software without specific prior written permission.
151689SN/A *
161689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271689SN/A *
281689SN/A * Authors: Ali Saidi
291689SN/A */
301689SN/A
311689SN/A/** @file
321689SN/A * Implementation of Tsunami platform.
331689SN/A */
341689SN/A
351689SN/A#include <deque>
361689SN/A#include <string>
371689SN/A#include <vector>
381689SN/A
392665Ssaidi@eecs.umich.edu#include "cpu/intr_control.hh"
402665Ssaidi@eecs.umich.edu#include "dev/simconsole.hh"
412935Sksewell@umich.edu#include "dev/tsunami_cchip.hh"
421689SN/A#include "dev/tsunami_pchip.hh"
431689SN/A#include "dev/tsunami_io.hh"
441060SN/A#include "dev/tsunami.hh"
451060SN/A#include "sim/builder.hh"
463773Sgblack@eecs.umich.edu#include "sim/system.hh"
476329Sgblack@eecs.umich.edu
481858SN/Ausing namespace std;
496658Snate@binkert.org//Should this be AlphaISA?
501717SN/Ausing namespace TheISA;
515529Snate@binkert.org
521060SN/ATsunami::Tsunami(const string &name, System *s, IntrControl *ic)
536221Snate@binkert.org    : Platform(name, ic), system(s)
546221Snate@binkert.org{
551061SN/A    // set the back pointer from the system to myself
565529Snate@binkert.org    system->platform = this;
574329Sktlim@umich.edu
584329Sktlim@umich.edu    for (int i = 0; i < Tsunami::Max_CPUs; i++)
592292SN/A        intr_sum_type[i] = 0;
602292SN/A}
612292SN/A
622292SN/ATick
633788Sgblack@eecs.umich.eduTsunami::intrFrequency()
643798Sgblack@eecs.umich.edu{
655529Snate@binkert.org    return io->frequency();
662361SN/A}
671060SN/A
682292SN/Avoid
692292SN/ATsunami::postConsoleInt()
706221Snate@binkert.org{
716221Snate@binkert.org    io->postPIC(0x10);
722292SN/A}
736221Snate@binkert.org
746221Snate@binkert.orgvoid
756221Snate@binkert.orgTsunami::clearConsoleInt()
762292SN/A{
776221Snate@binkert.org    io->clearPIC(0x10);
786221Snate@binkert.org}
796221Snate@binkert.org
802292SN/Avoid
816221Snate@binkert.orgTsunami::postPciInt(int line)
822292SN/A{
836221Snate@binkert.org    cchip->postDRIR(line);
842292SN/A}
856221Snate@binkert.org
862292SN/Avoid
872292SN/ATsunami::clearPciInt(int line)
882292SN/A{
892292SN/A    cchip->clearDRIR(line);
902292SN/A}
912292SN/A
922292SN/AAddr
932292SN/ATsunami::pciToDma(Addr pciAddr) const
942292SN/A{
952292SN/A    return pchip->translatePciToDma(pciAddr);
962292SN/A}
971060SN/A
981060SN/Avoid
991061SN/ATsunami::serialize(std::ostream &os)
1001060SN/A{
1012292SN/A    SERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs);
1021062SN/A}
1031062SN/A
1042301SN/Avoid
1051062SN/ATsunami::unserialize(Checkpoint *cp, const std::string &section)
1061062SN/A{
1071062SN/A    UNSERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs);
1082301SN/A}
1091062SN/A
1101062SN/ABEGIN_DECLARE_SIM_OBJECT_PARAMS(Tsunami)
1111062SN/A
1122301SN/A    SimObjectParam<System *> system;
1131062SN/A    SimObjectParam<IntrControl *> intrctrl;
1141062SN/A
1152301SN/AEND_DECLARE_SIM_OBJECT_PARAMS(Tsunami)
1162301SN/A
1172301SN/ABEGIN_INIT_SIM_OBJECT_PARAMS(Tsunami)
1182301SN/A
1192292SN/A    INIT_PARAM(system, "system"),
1202301SN/A    INIT_PARAM(intrctrl, "interrupt controller")
1212292SN/A
1222292SN/AEND_INIT_SIM_OBJECT_PARAMS(Tsunami)
1231062SN/A
1242301SN/ACREATE_SIM_OBJECT(Tsunami)
1251062SN/A{
1261062SN/A    return new Tsunami(getInstanceName(), system, intrctrl);
1271062SN/A}
1282301SN/A
1291062SN/AREGISTER_SIM_OBJECT("Tsunami", Tsunami)
1301062SN/A