platform.hh revision 8229
12086SN/A/*
22086SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
32086SN/A * All rights reserved.
42086SN/A *
52086SN/A * Redistribution and use in source and binary forms, with or without
62086SN/A * modification, are permitted provided that the following conditions are
72086SN/A * met: redistributions of source code must retain the above copyright
82086SN/A * notice, this list of conditions and the following disclaimer;
92086SN/A * redistributions in binary form must reproduce the above copyright
102086SN/A * notice, this list of conditions and the following disclaimer in the
112086SN/A * documentation and/or other materials provided with the distribution;
122086SN/A * neither the name of the copyright holders nor the names of its
132086SN/A * contributors may be used to endorse or promote products derived from
142086SN/A * this software without specific prior written permission.
152086SN/A *
162086SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172086SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182086SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192086SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202086SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212086SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222086SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232086SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242086SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252086SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262086SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272086SN/A *
282665Ssaidi@eecs.umich.edu * Authors: Andrew Schultz
292665Ssaidi@eecs.umich.edu *          Nathan Binkert
302665Ssaidi@eecs.umich.edu */
312086SN/A
324202Sbinkertn@umich.edu/**
332086SN/A * @file
344202Sbinkertn@umich.edu * Generic interface for platforms
354202Sbinkertn@umich.edu */
369022Sgblack@eecs.umich.edu
374202Sbinkertn@umich.edu#ifndef __DEV_PLATFORM_HH__
388745Sgblack@eecs.umich.edu#define __DEV_PLATFORM_HH__
396313Sgblack@eecs.umich.edu
408778Sgblack@eecs.umich.edu#include <bitset>
418778Sgblack@eecs.umich.edu#include <set>
428778Sgblack@eecs.umich.edu
436365Sgblack@eecs.umich.edu#include "params/Platform.hh"
444997Sgblack@eecs.umich.edu#include "sim/sim_object.hh"
458778Sgblack@eecs.umich.edu
464202Sbinkertn@umich.educlass PciConfigAll;
478778Sgblack@eecs.umich.educlass IntrControl;
488778Sgblack@eecs.umich.educlass Terminal;
498778Sgblack@eecs.umich.educlass Uart;
504997Sgblack@eecs.umich.educlass System;
518747Sgblack@eecs.umich.edu
524826Ssaidi@eecs.umich.educlass Platform : public SimObject
538760Sgblack@eecs.umich.edu{
542086SN/A  public:
558745Sgblack@eecs.umich.edu    /** Pointer to the interrupt controller */
569384SAndreas.Sandberg@arm.com    IntrControl *intrctrl;
576365Sgblack@eecs.umich.edu
588778Sgblack@eecs.umich.edu    /** Pointer to the system for info about the memory system. */
598745Sgblack@eecs.umich.edu    System *system;
606365Sgblack@eecs.umich.edu
618335Snate@binkert.org  public:
628335Snate@binkert.org    typedef PlatformParams Params;
634997Sgblack@eecs.umich.edu    Platform(const Params *p);
6410196SCurtis.Dunham@arm.com    virtual ~Platform();
65    virtual void postConsoleInt() = 0;
66    virtual void clearConsoleInt() = 0;
67    virtual Tick intrFrequency() = 0;
68    virtual void postPciInt(int line);
69    virtual void clearPciInt(int line);
70    virtual Addr pciToDma(Addr pciAddr) const;
71    virtual Addr calcPciConfigAddr(int bus, int dev, int func) = 0;
72    virtual Addr calcPciIOAddr(Addr addr) = 0;
73    virtual Addr calcPciMemAddr(Addr addr) = 0;
74    virtual void registerPciDevice(uint8_t bus, uint8_t dev, uint8_t func,
75            uint8_t intr);
76
77  private:
78    std::bitset<256> intLines;
79    std::set<uint32_t> pciDevices;
80
81};
82
83#endif // __DEV_PLATFORM_HH__
84