tsunami.cc revision 5834:b9e30a60dee4
14997Sgblack@eecs.umich.edu/* 25268Sksewell@umich.edu * Copyright (c) 2004-2005 The Regents of The University of Michigan 35222Sksewell@umich.edu * All rights reserved. 44997Sgblack@eecs.umich.edu * 54997Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 64997Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 74997Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 84997Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 94997Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 104997Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 114997Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 124997Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 134997Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 144997Sgblack@eecs.umich.edu * this software without specific prior written permission. 154997Sgblack@eecs.umich.edu * 164997Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174997Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184997Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194997Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204997Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214997Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224997Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234997Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244997Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254997Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264997Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274997Sgblack@eecs.umich.edu * 284997Sgblack@eecs.umich.edu * Authors: Ali Saidi 295268Sksewell@umich.edu */ 305268Sksewell@umich.edu 315268Sksewell@umich.edu/** @file 325268Sksewell@umich.edu * Implementation of Tsunami platform. 334997Sgblack@eecs.umich.edu */ 344997Sgblack@eecs.umich.edu 354997Sgblack@eecs.umich.edu#include <deque> 364997Sgblack@eecs.umich.edu#include <string> 374997Sgblack@eecs.umich.edu#include <vector> 385222Sksewell@umich.edu 395222Sksewell@umich.edu#include "cpu/intr_control.hh" 405222Sksewell@umich.edu#include "dev/alpha/tsunami_cchip.hh" 415222Sksewell@umich.edu#include "dev/alpha/tsunami_pchip.hh" 425222Sksewell@umich.edu#include "dev/alpha/tsunami_io.hh" 435222Sksewell@umich.edu#include "dev/alpha/tsunami.hh" 445222Sksewell@umich.edu#include "dev/terminal.hh" 455222Sksewell@umich.edu#include "sim/system.hh" 465034Smilesck@eecs.umich.edu 475034Smilesck@eecs.umich.eduusing namespace std; 485222Sksewell@umich.edu//Should this be AlphaISA? 494997Sgblack@eecs.umich.eduusing namespace TheISA; 505222Sksewell@umich.edu 514997Sgblack@eecs.umich.eduTsunami::Tsunami(const Params *p) 525222Sksewell@umich.edu : Platform(p), system(p->system) 535222Sksewell@umich.edu{ 545222Sksewell@umich.edu // set the back pointer from the system to myself 555222Sksewell@umich.edu system->platform = this; 565222Sksewell@umich.edu 575222Sksewell@umich.edu for (int i = 0; i < Tsunami::Max_CPUs; i++) 585222Sksewell@umich.edu intr_sum_type[i] = 0; 595222Sksewell@umich.edu} 605222Sksewell@umich.edu 614997Sgblack@eecs.umich.eduTick 625222Sksewell@umich.eduTsunami::intrFrequency() 635222Sksewell@umich.edu{ 645222Sksewell@umich.edu return io->frequency(); 655222Sksewell@umich.edu} 665222Sksewell@umich.edu 675014Sgblack@eecs.umich.eduvoid 685222Sksewell@umich.eduTsunami::postConsoleInt() 695222Sksewell@umich.edu{ 705184Sgblack@eecs.umich.edu io->postPIC(0x10); 715222Sksewell@umich.edu} 725222Sksewell@umich.edu 735222Sksewell@umich.eduvoid 745222Sksewell@umich.eduTsunami::clearConsoleInt() 755014Sgblack@eecs.umich.edu{ 765222Sksewell@umich.edu io->clearPIC(0x10); 775222Sksewell@umich.edu} 785222Sksewell@umich.edu 795222Sksewell@umich.eduvoid 805014Sgblack@eecs.umich.eduTsunami::postPciInt(int line) 814997Sgblack@eecs.umich.edu{ 824997Sgblack@eecs.umich.edu cchip->postDRIR(line); 835358Sgblack@eecs.umich.edu} 845222Sksewell@umich.edu 855222Sksewell@umich.eduvoid 865222Sksewell@umich.eduTsunami::clearPciInt(int line) 875222Sksewell@umich.edu{ 885222Sksewell@umich.edu cchip->clearDRIR(line); 895222Sksewell@umich.edu} 905222Sksewell@umich.edu 915222Sksewell@umich.eduAddr 925222Sksewell@umich.eduTsunami::pciToDma(Addr pciAddr) const 935222Sksewell@umich.edu{ 945222Sksewell@umich.edu return pchip->translatePciToDma(pciAddr); 955222Sksewell@umich.edu} 965222Sksewell@umich.edu 975222Sksewell@umich.edu 985222Sksewell@umich.eduAddr 995222Sksewell@umich.eduTsunami::calcPciConfigAddr(int bus, int dev, int func) 1005222Sksewell@umich.edu{ 1015222Sksewell@umich.edu return pchip->calcConfigAddr(bus, dev, func); 1025222Sksewell@umich.edu} 1035222Sksewell@umich.edu 1045222Sksewell@umich.eduAddr 1055222Sksewell@umich.eduTsunami::calcPciIOAddr(Addr addr) 1065222Sksewell@umich.edu{ 1075222Sksewell@umich.edu return pchip->calcIOAddr(addr); 1085222Sksewell@umich.edu} 1095222Sksewell@umich.edu 1105222Sksewell@umich.eduAddr 1115222Sksewell@umich.eduTsunami::calcPciMemAddr(Addr addr) 1125222Sksewell@umich.edu{ 1135222Sksewell@umich.edu return pchip->calcMemAddr(addr); 1145222Sksewell@umich.edu} 1155222Sksewell@umich.edu 1165222Sksewell@umich.eduvoid 1175222Sksewell@umich.eduTsunami::serialize(std::ostream &os) 1185222Sksewell@umich.edu{ 1195222Sksewell@umich.edu SERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); 1205222Sksewell@umich.edu} 1215222Sksewell@umich.edu 1225222Sksewell@umich.eduvoid 1235358Sgblack@eecs.umich.eduTsunami::unserialize(Checkpoint *cp, const std::string §ion) 1245358Sgblack@eecs.umich.edu{ 1255358Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); 1265358Sgblack@eecs.umich.edu} 1275222Sksewell@umich.edu 1285222Sksewell@umich.eduTsunami * 1295222Sksewell@umich.eduTsunamiParams::create() 1305222Sksewell@umich.edu{ 1315222Sksewell@umich.edu return new Tsunami(this); 1325222Sksewell@umich.edu} 1335222Sksewell@umich.edu