platform.cc revision 6658
1865SN/A/* 21762SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 3865SN/A * All rights reserved. 4865SN/A * 5865SN/A * Redistribution and use in source and binary forms, with or without 6865SN/A * modification, are permitted provided that the following conditions are 7865SN/A * met: redistributions of source code must retain the above copyright 8865SN/A * notice, this list of conditions and the following disclaimer; 9865SN/A * redistributions in binary form must reproduce the above copyright 10865SN/A * notice, this list of conditions and the following disclaimer in the 11865SN/A * documentation and/or other materials provided with the distribution; 12865SN/A * neither the name of the copyright holders nor the names of its 13865SN/A * contributors may be used to endorse or promote products derived from 14865SN/A * this software without specific prior written permission. 15865SN/A * 16865SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17865SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18865SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19865SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20865SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21865SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22865SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23865SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24865SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25865SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26865SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Ali Saidi 292665Ssaidi@eecs.umich.edu * Nathan Binkert 30865SN/A */ 31865SN/A 322984Sgblack@eecs.umich.edu#include "base/misc.hh" 336658Snate@binkert.org#include "config/the_isa.hh" 34865SN/A#include "dev/platform.hh" 35865SN/A#include "sim/sim_exit.hh" 36865SN/A 37865SN/Ausing namespace std; 382107SN/Ausing namespace TheISA; 39865SN/A 405034Smilesck@eecs.umich.eduPlatform::Platform(const Params *p) 415034Smilesck@eecs.umich.edu : SimObject(p), intrctrl(p->intrctrl) 421634SN/A{ 431634SN/A} 441634SN/A 451634SN/APlatform::~Platform() 461634SN/A{ 471634SN/A} 481634SN/A 491149SN/Avoid 501149SN/APlatform::postPciInt(int line) 511149SN/A{ 521149SN/A panic("No PCI interrupt support in platform."); 531149SN/A} 541149SN/A 551149SN/Avoid 561149SN/APlatform::clearPciInt(int line) 571149SN/A{ 581149SN/A panic("No PCI interrupt support in platform."); 591149SN/A} 601149SN/A 611149SN/AAddr 621149SN/APlatform::pciToDma(Addr pciAddr) const 631149SN/A{ 641149SN/A panic("No PCI dma support in platform."); 653918Ssaidi@eecs.umich.edu M5_DUMMY_RETURN 661149SN/A} 671149SN/A 682846Ssaidi@eecs.umich.eduvoid 692846Ssaidi@eecs.umich.eduPlatform::registerPciDevice(uint8_t bus, uint8_t dev, uint8_t func, uint8_t intr) 702846Ssaidi@eecs.umich.edu{ 712846Ssaidi@eecs.umich.edu uint32_t bdf = bus << 16 | dev << 8 | func << 0; 722846Ssaidi@eecs.umich.edu if (pciDevices.find(bdf) != pciDevices.end()) 732846Ssaidi@eecs.umich.edu fatal("Two PCI devices have same bus:device:function\n"); 742846Ssaidi@eecs.umich.edu 752846Ssaidi@eecs.umich.edu if (intLines.test(intr)) 762846Ssaidi@eecs.umich.edu fatal("Two PCI devices have same interrupt line: %d\n", intr); 772846Ssaidi@eecs.umich.edu 782846Ssaidi@eecs.umich.edu pciDevices.insert(bdf); 792846Ssaidi@eecs.umich.edu 802846Ssaidi@eecs.umich.edu intLines.set(intr); 812846Ssaidi@eecs.umich.edu} 82