tsunami_pchip.hh revision 4762
1768SN/A/* 21762SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 3768SN/A * All rights reserved. 4768SN/A * 5768SN/A * Redistribution and use in source and binary forms, with or without 6768SN/A * modification, are permitted provided that the following conditions are 7768SN/A * met: redistributions of source code must retain the above copyright 8768SN/A * notice, this list of conditions and the following disclaimer; 9768SN/A * redistributions in binary form must reproduce the above copyright 10768SN/A * notice, this list of conditions and the following disclaimer in the 11768SN/A * documentation and/or other materials provided with the distribution; 12768SN/A * neither the name of the copyright holders nor the names of its 13768SN/A * contributors may be used to endorse or promote products derived from 14768SN/A * this software without specific prior written permission. 15768SN/A * 16768SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17768SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18768SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19768SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20768SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21768SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22768SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23768SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24768SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25768SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26768SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665SN/A * 282665SN/A * Authors: Ali Saidi 29768SN/A */ 30768SN/A 311722SN/A/** @file 321722SN/A * Tsunami PCI interface CSRs 33768SN/A */ 34768SN/A 35768SN/A#ifndef __TSUNAMI_PCHIP_HH__ 36768SN/A#define __TSUNAMI_PCHIP_HH__ 37768SN/A 384762Snate@binkert.org#include "base/range.hh" 393540Sgblack@eecs.umich.edu#include "dev/alpha/tsunami.hh" 40909SN/A#include "dev/io_device.hh" 414762Snate@binkert.org#include "params/TsunamiPChip.hh" 42768SN/A 431722SN/A/** 441722SN/A * A very simple implementation of the Tsunami PCI interface chips. 45768SN/A */ 462539SN/Aclass TsunamiPChip : public BasicPioDevice 47768SN/A{ 48768SN/A protected: 492846SN/A 502861SN/A static const Addr TsunamiPciBus0Config = ULL(0x801fe000000); 512846SN/A 52896SN/A /** Pchip control register */ 53896SN/A uint64_t pctl; 54896SN/A 55885SN/A /** Window Base addresses */ 56835SN/A uint64_t wsba[4]; 57885SN/A 58885SN/A /** Window masks */ 59835SN/A uint64_t wsm[4]; 60885SN/A 61885SN/A /** Translated Base Addresses */ 62835SN/A uint64_t tba[4]; 63768SN/A 64768SN/A public: 654762Snate@binkert.org typedef TsunamiPChipParams Params; 66885SN/A /** 67885SN/A * Register the PChip with the mmu and init all wsba, wsm, and tba to 0 682539SN/A * @param p pointer to the parameters struct 69885SN/A */ 704762Snate@binkert.org TsunamiPChip(const Params *p); 714762Snate@binkert.org 724762Snate@binkert.org const Params * 734762Snate@binkert.org params() const 744762Snate@binkert.org { 754762Snate@binkert.org return dynamic_cast<const Params *>(_params); 764762Snate@binkert.org } 77768SN/A 78885SN/A /** 79885SN/A * Translate a PCI bus address to a memory address for DMA. 80885SN/A * @todo Andrew says this needs to be fixed. What's wrong with it? 81885SN/A * @param busAddr PCI address to translate. 82885SN/A * @return memory system address 83885SN/A */ 84835SN/A Addr translatePciToDma(Addr busAddr); 85835SN/A 862846SN/A Addr calcConfigAddr(int bus, int dev, int func); 872846SN/A 883349SN/A virtual Tick read(PacketPtr pkt); 893349SN/A virtual Tick write(PacketPtr pkt); 90768SN/A 91885SN/A /** 92885SN/A * Serialize this object to the given output stream. 93885SN/A * @param os The stream to serialize to. 94885SN/A */ 95768SN/A virtual void serialize(std::ostream &os); 96885SN/A 97885SN/A /** 98885SN/A * Reconstruct the state of this object from a checkpoint. 99885SN/A * @param cp The checkpoint use. 100885SN/A * @param section The section name of this object 101885SN/A */ 102768SN/A virtual void unserialize(Checkpoint *cp, const std::string §ion); 103768SN/A}; 104768SN/A 105768SN/A#endif // __TSUNAMI_PCHIP_HH__ 106