realview.cc revision 8741
13630SN/A/*
27090SN/A * Copyright (c) 2009 ARM Limited
37090SN/A * All rights reserved
47090SN/A *
57090SN/A * The license below extends only to copyright in the software and shall
67090SN/A * not be construed as granting a license to any other intellectual
77090SN/A * property including but not limited to intellectual property relating
87090SN/A * to a hardware implementation of the functionality of the software
97090SN/A * licensed hereunder.  You may use the software subject to the license
107090SN/A * terms below provided that you ensure that this notice is replicated
117090SN/A * unmodified and in its entirety in all distributions of the software,
127090SN/A * modified or unmodified, in source code or in binary form.
137090SN/A *
143630SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
153630SN/A * All rights reserved.
163630SN/A *
173630SN/A * Redistribution and use in source and binary forms, with or without
183630SN/A * modification, are permitted provided that the following conditions are
193630SN/A * met: redistributions of source code must retain the above copyright
203630SN/A * notice, this list of conditions and the following disclaimer;
213630SN/A * redistributions in binary form must reproduce the above copyright
223630SN/A * notice, this list of conditions and the following disclaimer in the
233630SN/A * documentation and/or other materials provided with the distribution;
243630SN/A * neither the name of the copyright holders nor the names of its
253630SN/A * contributors may be used to endorse or promote products derived from
263630SN/A * this software without specific prior written permission.
273630SN/A *
283630SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
293630SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
303630SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
313630SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
323630SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
333630SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
343630SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
353630SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
363630SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
373630SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
383630SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
393630SN/A *
403630SN/A * Authors: Ali Saidi
413630SN/A */
423630SN/A
433630SN/A/** @file
447584SAli.Saidi@arm.com * Implementation of RealView platform.
453630SN/A */
463630SN/A
473630SN/A#include <deque>
483630SN/A#include <string>
493630SN/A#include <vector>
503630SN/A
516658SN/A#include "config/the_isa.hh"
523630SN/A#include "cpu/intr_control.hh"
538525SAli.Saidi@ARM.com#include "dev/arm/gic.hh"
547584SAli.Saidi@arm.com#include "dev/arm/realview.hh"
555478SN/A#include "dev/terminal.hh"
563630SN/A#include "sim/system.hh"
573630SN/A
583630SN/Ausing namespace std;
593630SN/Ausing namespace TheISA;
603630SN/A
617584SAli.Saidi@arm.comRealView::RealView(const Params *p)
625034SN/A    : Platform(p), system(p->system)
638741Sgblack@eecs.umich.edu{}
643630SN/A
653630SN/Avoid
667584SAli.Saidi@arm.comRealView::postConsoleInt()
673630SN/A{
683832SN/A    warn_once("Don't know what interrupt to post for console.\n");
693832SN/A    //panic("Need implementation\n");
703630SN/A}
713630SN/A
723630SN/Avoid
737584SAli.Saidi@arm.comRealView::clearConsoleInt()
743630SN/A{
753832SN/A    warn_once("Don't know what interrupt to clear for console.\n");
763832SN/A    //panic("Need implementation\n");
773630SN/A}
783630SN/A
793630SN/Avoid
807584SAli.Saidi@arm.comRealView::postPciInt(int line)
813630SN/A{
828525SAli.Saidi@ARM.com    gic->sendInt(line);
833630SN/A}
843630SN/A
853630SN/Avoid
867584SAli.Saidi@arm.comRealView::clearPciInt(int line)
873630SN/A{
888525SAli.Saidi@ARM.com    gic->clearInt(line);
893630SN/A}
903630SN/A
913630SN/AAddr
927584SAli.Saidi@arm.comRealView::pciToDma(Addr pciAddr) const
933630SN/A{
948525SAli.Saidi@ARM.com    return pciAddr;
953630SN/A}
963630SN/A
973630SN/A
983630SN/AAddr
997584SAli.Saidi@arm.comRealView::calcPciConfigAddr(int bus, int dev, int func)
1005834SN/A{
1018525SAli.Saidi@ARM.com    if (bus != 0)
1028525SAli.Saidi@ARM.com        return ULL(-1);
1038525SAli.Saidi@ARM.com    return params()->pci_cfg_base | ((func & 7) << 16) | ((dev & 0x1f) << 19);
1045834SN/A}
1055834SN/A
1065834SN/AAddr
1077584SAli.Saidi@arm.comRealView::calcPciIOAddr(Addr addr)
1085834SN/A{
1097750SAli.Saidi@ARM.com    return addr;
1105834SN/A}
1115834SN/A
1125834SN/AAddr
1137584SAli.Saidi@arm.comRealView::calcPciMemAddr(Addr addr)
1143630SN/A{
1158525SAli.Saidi@ARM.com    return addr;
1163630SN/A}
1173630SN/A
1187584SAli.Saidi@arm.comRealView *
1197584SAli.Saidi@arm.comRealViewParams::create()
1203630SN/A{
1217584SAli.Saidi@arm.com    return new RealView(this);
1223630SN/A}
123