realview.cc revision 8739:925f15f96322
110779SCurtis.Dunham@arm.com/*
210779SCurtis.Dunham@arm.com * Copyright (c) 2009 ARM Limited
310779SCurtis.Dunham@arm.com * All rights reserved
410779SCurtis.Dunham@arm.com *
510779SCurtis.Dunham@arm.com * The license below extends only to copyright in the software and shall
610779SCurtis.Dunham@arm.com * not be construed as granting a license to any other intellectual
710779SCurtis.Dunham@arm.com * property including but not limited to intellectual property relating
810779SCurtis.Dunham@arm.com * to a hardware implementation of the functionality of the software
910779SCurtis.Dunham@arm.com * licensed hereunder.  You may use the software subject to the license
1010779SCurtis.Dunham@arm.com * terms below provided that you ensure that this notice is replicated
1110779SCurtis.Dunham@arm.com * unmodified and in its entirety in all distributions of the software,
1210779SCurtis.Dunham@arm.com * modified or unmodified, in source code or in binary form.
1310779SCurtis.Dunham@arm.com *
1410779SCurtis.Dunham@arm.com * Copyright (c) 2004-2005 The Regents of The University of Michigan
1510779SCurtis.Dunham@arm.com * All rights reserved.
1610779SCurtis.Dunham@arm.com *
1710779SCurtis.Dunham@arm.com * Redistribution and use in source and binary forms, with or without
1810779SCurtis.Dunham@arm.com * modification, are permitted provided that the following conditions are
1910779SCurtis.Dunham@arm.com * met: redistributions of source code must retain the above copyright
2010779SCurtis.Dunham@arm.com * notice, this list of conditions and the following disclaimer;
2110779SCurtis.Dunham@arm.com * redistributions in binary form must reproduce the above copyright
2210779SCurtis.Dunham@arm.com * notice, this list of conditions and the following disclaimer in the
2310779SCurtis.Dunham@arm.com * documentation and/or other materials provided with the distribution;
2410779SCurtis.Dunham@arm.com * neither the name of the copyright holders nor the names of its
2510779SCurtis.Dunham@arm.com * contributors may be used to endorse or promote products derived from
2610779SCurtis.Dunham@arm.com * this software without specific prior written permission.
2710779SCurtis.Dunham@arm.com *
2810779SCurtis.Dunham@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2910779SCurtis.Dunham@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3010779SCurtis.Dunham@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3110779SCurtis.Dunham@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3210779SCurtis.Dunham@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3310779SCurtis.Dunham@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3410779SCurtis.Dunham@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3510779SCurtis.Dunham@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3610779SCurtis.Dunham@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3710779SCurtis.Dunham@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3810779SCurtis.Dunham@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3910779SCurtis.Dunham@arm.com *
4010779SCurtis.Dunham@arm.com * Authors: Ali Saidi
4110779SCurtis.Dunham@arm.com */
4210779SCurtis.Dunham@arm.com
4310779SCurtis.Dunham@arm.com/** @file
4410779SCurtis.Dunham@arm.com * Implementation of RealView platform.
4510779SCurtis.Dunham@arm.com */
4610779SCurtis.Dunham@arm.com
4710779SCurtis.Dunham@arm.com#include <deque>
4810779SCurtis.Dunham@arm.com#include <string>
4910779SCurtis.Dunham@arm.com#include <vector>
5010779SCurtis.Dunham@arm.com
5111618SCurtis.Dunham@arm.com#include "config/the_isa.hh"
5211618SCurtis.Dunham@arm.com#include "cpu/intr_control.hh"
5310779SCurtis.Dunham@arm.com#include "dev/arm/gic.hh"
5410779SCurtis.Dunham@arm.com#include "dev/arm/realview.hh"
5510779SCurtis.Dunham@arm.com#include "dev/terminal.hh"
5610779SCurtis.Dunham@arm.com#include "sim/system.hh"
5710779SCurtis.Dunham@arm.com
5810779SCurtis.Dunham@arm.comusing namespace std;
5910779SCurtis.Dunham@arm.comusing namespace TheISA;
6010779SCurtis.Dunham@arm.com
6110779SCurtis.Dunham@arm.comRealView::RealView(const Params *p)
6210779SCurtis.Dunham@arm.com    : Platform(p), system(p->system)
6310779SCurtis.Dunham@arm.com{
6410779SCurtis.Dunham@arm.com#if FULL_SYSTEM //XXX No platform pointer on the system object in SE mode.
6510779SCurtis.Dunham@arm.com    // set the back pointer from the system to myself
6610779SCurtis.Dunham@arm.com    system->platform = this;
6710779SCurtis.Dunham@arm.com#endif
6810779SCurtis.Dunham@arm.com}
6910779SCurtis.Dunham@arm.com
7010779SCurtis.Dunham@arm.comTick
7110779SCurtis.Dunham@arm.comRealView::intrFrequency()
7210779SCurtis.Dunham@arm.com{
7310779SCurtis.Dunham@arm.com    panic("Need implementation\n");
7410779SCurtis.Dunham@arm.com    M5_DUMMY_RETURN
7510779SCurtis.Dunham@arm.com}
7610779SCurtis.Dunham@arm.com
7710779SCurtis.Dunham@arm.comvoid
7810779SCurtis.Dunham@arm.comRealView::postConsoleInt()
7910779SCurtis.Dunham@arm.com{
8010779SCurtis.Dunham@arm.com    warn_once("Don't know what interrupt to post for console.\n");
8110779SCurtis.Dunham@arm.com    //panic("Need implementation\n");
8210779SCurtis.Dunham@arm.com}
8310779SCurtis.Dunham@arm.com
8410779SCurtis.Dunham@arm.comvoid
8510779SCurtis.Dunham@arm.comRealView::clearConsoleInt()
8610779SCurtis.Dunham@arm.com{
8710779SCurtis.Dunham@arm.com    warn_once("Don't know what interrupt to clear for console.\n");
8810779SCurtis.Dunham@arm.com    //panic("Need implementation\n");
8910779SCurtis.Dunham@arm.com}
9010779SCurtis.Dunham@arm.com
9110779SCurtis.Dunham@arm.comvoid
9210779SCurtis.Dunham@arm.comRealView::postPciInt(int line)
9310779SCurtis.Dunham@arm.com{
9410779SCurtis.Dunham@arm.com    gic->sendInt(line);
9510779SCurtis.Dunham@arm.com}
9610779SCurtis.Dunham@arm.com
9710779SCurtis.Dunham@arm.comvoid
9810779SCurtis.Dunham@arm.comRealView::clearPciInt(int line)
99{
100    gic->clearInt(line);
101}
102
103Addr
104RealView::pciToDma(Addr pciAddr) const
105{
106    return pciAddr;
107}
108
109
110Addr
111RealView::calcPciConfigAddr(int bus, int dev, int func)
112{
113    if (bus != 0)
114        return ULL(-1);
115    return params()->pci_cfg_base | ((func & 7) << 16) | ((dev & 0x1f) << 19);
116}
117
118Addr
119RealView::calcPciIOAddr(Addr addr)
120{
121    return addr;
122}
123
124Addr
125RealView::calcPciMemAddr(Addr addr)
126{
127    return addr;
128}
129
130RealView *
131RealViewParams::create()
132{
133    return new RealView(this);
134}
135