platform.hh revision 10684:d1d95f0f4563
110448Snilay@cs.wisc.edu/*
210448Snilay@cs.wisc.edu * Copyright (c) 2004-2005 The Regents of The University of Michigan
310448Snilay@cs.wisc.edu * All rights reserved.
410448Snilay@cs.wisc.edu *
510448Snilay@cs.wisc.edu * Redistribution and use in source and binary forms, with or without
610448Snilay@cs.wisc.edu * modification, are permitted provided that the following conditions are
710448Snilay@cs.wisc.edu * met: redistributions of source code must retain the above copyright
810448Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer;
910448Snilay@cs.wisc.edu * redistributions in binary form must reproduce the above copyright
1010448Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer in the
1110448Snilay@cs.wisc.edu * documentation and/or other materials provided with the distribution;
1210448Snilay@cs.wisc.edu * neither the name of the copyright holders nor the names of its
1310448Snilay@cs.wisc.edu * contributors may be used to endorse or promote products derived from
1410448Snilay@cs.wisc.edu * this software without specific prior written permission.
1510448Snilay@cs.wisc.edu *
1610448Snilay@cs.wisc.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1710448Snilay@cs.wisc.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1810448Snilay@cs.wisc.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1910448Snilay@cs.wisc.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2010448Snilay@cs.wisc.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2110448Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2210447Snilay@cs.wisc.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2310447Snilay@cs.wisc.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2410447Snilay@cs.wisc.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2510447Snilay@cs.wisc.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2610447Snilay@cs.wisc.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2710447Snilay@cs.wisc.edu *
2810447Snilay@cs.wisc.edu * Authors: Andrew Schultz
2910447Snilay@cs.wisc.edu *          Nathan Binkert
3010447Snilay@cs.wisc.edu */
3110447Snilay@cs.wisc.edu
3210447Snilay@cs.wisc.edu/**
3310447Snilay@cs.wisc.edu * @file
3410447Snilay@cs.wisc.edu * Generic interface for platforms
3510447Snilay@cs.wisc.edu */
3610447Snilay@cs.wisc.edu
3710447Snilay@cs.wisc.edu#ifndef __DEV_PLATFORM_HH__
3810447Snilay@cs.wisc.edu#define __DEV_PLATFORM_HH__
3910447Snilay@cs.wisc.edu
4010447Snilay@cs.wisc.edu#include <bitset>
4110447Snilay@cs.wisc.edu#include <set>
4210447Snilay@cs.wisc.edu
4310447Snilay@cs.wisc.edu#include "params/Platform.hh"
4410447Snilay@cs.wisc.edu#include "sim/sim_object.hh"
4510447Snilay@cs.wisc.edu
4610447Snilay@cs.wisc.educlass PciConfigAll;
4710447Snilay@cs.wisc.educlass IntrControl;
4810447Snilay@cs.wisc.educlass Terminal;
4910447Snilay@cs.wisc.educlass Uart;
5010447Snilay@cs.wisc.educlass System;
5110447Snilay@cs.wisc.edu
5210447Snilay@cs.wisc.educlass Platform : public SimObject
5310447Snilay@cs.wisc.edu{
5410447Snilay@cs.wisc.edu  public:
5510447Snilay@cs.wisc.edu    /** Pointer to the interrupt controller */
5610447Snilay@cs.wisc.edu    IntrControl *intrctrl;
5710447Snilay@cs.wisc.edu
5810447Snilay@cs.wisc.edu  public:
5910447Snilay@cs.wisc.edu    typedef PlatformParams Params;
6010447Snilay@cs.wisc.edu    Platform(const Params *p);
6110447Snilay@cs.wisc.edu    virtual ~Platform();
6210447Snilay@cs.wisc.edu    virtual void postConsoleInt() = 0;
6310447Snilay@cs.wisc.edu    virtual void clearConsoleInt() = 0;
6410447Snilay@cs.wisc.edu    virtual void postPciInt(int line);
6510447Snilay@cs.wisc.edu    virtual void clearPciInt(int line);
6610447Snilay@cs.wisc.edu    virtual Addr pciToDma(Addr pciAddr) const;
6710447Snilay@cs.wisc.edu    virtual Addr calcPciConfigAddr(int bus, int dev, int func) = 0;
6810447Snilay@cs.wisc.edu    virtual Addr calcPciIOAddr(Addr addr) = 0;
6910447Snilay@cs.wisc.edu    virtual Addr calcPciMemAddr(Addr addr) = 0;
7010447Snilay@cs.wisc.edu    virtual void registerPciDevice(uint8_t bus, uint8_t dev, uint8_t func,
7110447Snilay@cs.wisc.edu            uint8_t intr);
7210447Snilay@cs.wisc.edu
7310447Snilay@cs.wisc.edu  private:
7410447Snilay@cs.wisc.edu    std::bitset<256> intLines;
7510447Snilay@cs.wisc.edu    std::set<uint32_t> pciDevices;
7610447Snilay@cs.wisc.edu
7710447Snilay@cs.wisc.edu};
7810447Snilay@cs.wisc.edu
7910447Snilay@cs.wisc.edu#endif // __DEV_PLATFORM_HH__
8010447Snilay@cs.wisc.edu