tsunami.cc revision 8739:925f15f96322
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/the_isa.hh" 40#include "cpu/intr_control.hh" 41#include "dev/alpha/tsunami.hh" 42#include "dev/alpha/tsunami_cchip.hh" 43#include "dev/alpha/tsunami_io.hh" 44#include "dev/alpha/tsunami_pchip.hh" 45#include "dev/terminal.hh" 46#include "sim/system.hh" 47 48using namespace std; 49//Should this be AlphaISA? 50using namespace TheISA; 51 52Tsunami::Tsunami(const Params *p) 53 : Platform(p), system(p->system) 54{ 55#if FULL_SYSTEM //XXX No platform pointer in SE mode. 56 // set the back pointer from the system to myself 57 system->platform = this; 58#endif 59 60 for (int i = 0; i < Tsunami::Max_CPUs; i++) 61 intr_sum_type[i] = 0; 62} 63 64Tick 65Tsunami::intrFrequency() 66{ 67 return io->frequency(); 68} 69 70void 71Tsunami::postConsoleInt() 72{ 73 io->postPIC(0x10); 74} 75 76void 77Tsunami::clearConsoleInt() 78{ 79 io->clearPIC(0x10); 80} 81 82void 83Tsunami::postPciInt(int line) 84{ 85 cchip->postDRIR(line); 86} 87 88void 89Tsunami::clearPciInt(int line) 90{ 91 cchip->clearDRIR(line); 92} 93 94Addr 95Tsunami::pciToDma(Addr pciAddr) const 96{ 97 return pchip->translatePciToDma(pciAddr); 98} 99 100 101Addr 102Tsunami::calcPciConfigAddr(int bus, int dev, int func) 103{ 104 return pchip->calcConfigAddr(bus, dev, func); 105} 106 107Addr 108Tsunami::calcPciIOAddr(Addr addr) 109{ 110 return pchip->calcIOAddr(addr); 111} 112 113Addr 114Tsunami::calcPciMemAddr(Addr addr) 115{ 116 return pchip->calcMemAddr(addr); 117} 118 119void 120Tsunami::serialize(std::ostream &os) 121{ 122 SERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); 123} 124 125void 126Tsunami::unserialize(Checkpoint *cp, const std::string §ion) 127{ 128 UNSERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); 129} 130 131Tsunami * 132TsunamiParams::create() 133{ 134 return new Tsunami(this); 135} 136