tsunami.cc revision 1730
1/* 2 * Copyright (c) 2004 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 29/** @file Implementation of Tsunami platform. 30 */ 31 32#include <deque> 33#include <string> 34#include <vector> 35 36#include "cpu/intr_control.hh" 37#include "dev/simconsole.hh" 38#include "dev/etherdev.hh" 39#include "dev/ide_ctrl.hh" 40#include "dev/tlaser_clock.hh" 41#include "dev/tsunami_cchip.hh" 42#include "dev/tsunami_pchip.hh" 43#include "dev/tsunami_io.hh" 44#include "dev/tsunami.hh" 45#include "dev/pciconfigall.hh" 46#include "sim/builder.hh" 47#include "sim/system.hh" 48 49using namespace std; 50 51Tsunami::Tsunami(const string &name, System *s, IntrControl *ic, 52 PciConfigAll *pci) 53 : Platform(name, ic, pci), system(s) 54{ 55 // set the back pointer from the system to myself 56 system->platform = this; 57 58 for (int i = 0; i < Tsunami::Max_CPUs; i++) 59 intr_sum_type[i] = 0; 60} 61 62Tick 63Tsunami::intrFrequency() 64{ 65 return io->frequency(); 66} 67 68void 69Tsunami::postConsoleInt() 70{ 71 io->postPIC(0x10); 72} 73 74void 75Tsunami::clearConsoleInt() 76{ 77 io->clearPIC(0x10); 78} 79 80void 81Tsunami::postPciInt(int line) 82{ 83 cchip->postDRIR(line); 84} 85 86void 87Tsunami::clearPciInt(int line) 88{ 89 cchip->clearDRIR(line); 90} 91 92Addr 93Tsunami::pciToDma(Addr pciAddr) const 94{ 95 return pchip->translatePciToDma(pciAddr); 96} 97 98void 99Tsunami::serialize(std::ostream &os) 100{ 101 SERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); 102} 103 104void 105Tsunami::unserialize(Checkpoint *cp, const std::string §ion) 106{ 107 UNSERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); 108} 109 110BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tsunami) 111 112 SimObjectParam<System *> system; 113 SimObjectParam<IntrControl *> intrctrl; 114 SimObjectParam<PciConfigAll *> pciconfig; 115 116END_DECLARE_SIM_OBJECT_PARAMS(Tsunami) 117 118BEGIN_INIT_SIM_OBJECT_PARAMS(Tsunami) 119 120 INIT_PARAM(system, "system"), 121 INIT_PARAM(intrctrl, "interrupt controller"), 122 INIT_PARAM(pciconfig, "PCI configuration") 123 124END_INIT_SIM_OBJECT_PARAMS(Tsunami) 125 126CREATE_SIM_OBJECT(Tsunami) 127{ 128 return new Tsunami(getInstanceName(), system, intrctrl, pciconfig); 129} 130 131REGISTER_SIM_OBJECT("Tsunami", Tsunami) 132