RealView.py revision 7731
12SN/A# Copyright (c) 2009 ARM Limited 28733Sgeoffrey.blake@arm.com# All rights reserved. 38733Sgeoffrey.blake@arm.com# 48733Sgeoffrey.blake@arm.com# The license below extends only to copyright in the software and shall 58733Sgeoffrey.blake@arm.com# not be construed as granting a license to any other intellectual 68733Sgeoffrey.blake@arm.com# property including but not limited to intellectual property relating 78733Sgeoffrey.blake@arm.com# to a hardware implementation of the functionality of the software 88733Sgeoffrey.blake@arm.com# licensed hereunder. You may use the software subject to the license 98733Sgeoffrey.blake@arm.com# terms below provided that you ensure that this notice is replicated 108733Sgeoffrey.blake@arm.com# unmodified and in its entirety in all distributions of the software, 118733Sgeoffrey.blake@arm.com# modified or unmodified, in source code or in binary form. 128733Sgeoffrey.blake@arm.com# 138733Sgeoffrey.blake@arm.com# Copyright (c) 2006-2007 The Regents of The University of Michigan 142188SN/A# All rights reserved. 152SN/A# 162SN/A# Redistribution and use in source and binary forms, with or without 172SN/A# modification, are permitted provided that the following conditions are 182SN/A# met: redistributions of source code must retain the above copyright 192SN/A# notice, this list of conditions and the following disclaimer; 202SN/A# redistributions in binary form must reproduce the above copyright 212SN/A# notice, this list of conditions and the following disclaimer in the 222SN/A# documentation and/or other materials provided with the distribution; 232SN/A# neither the name of the copyright holders nor the names of its 242SN/A# contributors may be used to endorse or promote products derived from 252SN/A# this software without specific prior written permission. 262SN/A# 272SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 282SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 292SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 302SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 312SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 322SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 332SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 342SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 352SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 362SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 372SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 382SN/A# 392665SN/A# Authors: Ali Saidi 402665SN/A# Gabe Black 412665SN/A 422SN/Afrom m5.params import * 432SN/Afrom m5.proxy import * 442683Sktlim@umich.edufrom Device import BasicPioDevice, PioDevice, IsaFake, BadAddr, DmaDevice 452683Sktlim@umich.edufrom Platform import Platform 462SN/Afrom Terminal import Terminal 479020Sgblack@eecs.umich.edufrom Uart import Uart 486313Sgblack@eecs.umich.edu 492190SN/Aclass AmbaDevice(BasicPioDevice): 506329Sgblack@eecs.umich.edu type = 'AmbaDevice' 514997Sgblack@eecs.umich.edu abstract = True 526316Sgblack@eecs.umich.edu amba_id = Param.UInt32("ID of AMBA device for kernel detection") 536216Snate@binkert.org 546658Snate@binkert.orgclass AmbaDmaDevice(DmaDevice): 552680SN/A type = 'AmbaDmaDevice' 562683Sktlim@umich.edu abstract = True 578232Snate@binkert.org amba_id = Param.UInt32("ID of AMBA device for kernel detection") 588232Snate@binkert.org 598777Sgblack@eecs.umich.educlass RealViewCtrl(BasicPioDevice): 602395SN/A type = 'RealViewCtrl' 612190SN/A proc_id = Param.UInt32(0x0C000000, "Platform ID") 622188SN/A 638777Sgblack@eecs.umich.educlass Gic(PioDevice): 64217SN/A type = 'Gic' 658777Sgblack@eecs.umich.edu dist_addr = Param.Addr(0x1f001000, "Address for distributor") 662SN/A cpu_addr = Param.Addr(0x1f000100, "Address for cpu") 672SN/A dist_pio_delay = Param.Latency('10ns', "Delay for PIO r/w to distributor") 688887Sgeoffrey.blake@arm.com cpu_pio_delay = Param.Latency('10ns', "Delay for PIO r/w to cpu") 691070SN/A it_lines = Param.UInt32(128, "Number of interrupt lines supported (max = 1020)") 701917SN/A 711917SN/Aclass AmbaFake(AmbaDevice): 722521SN/A type = 'AmbaFake' 733548Sgblack@eecs.umich.edu ignore_access = Param.Bool(False, "Ignore reads/writes to this device, (e.g. IsaFake + AMBA)") 743548Sgblack@eecs.umich.edu amba_id = 0; 753548Sgblack@eecs.umich.edu 768902Sandreas.hansson@arm.comclass Pl011(Uart): 778902Sandreas.hansson@arm.com type = 'Pl011' 782330SN/A gic = Param.Gic(Parent.any, "Gic to use for interrupting") 792683Sktlim@umich.edu int_num = Param.UInt32("Interrupt number that connects to GIC") 802683Sktlim@umich.edu end_on_eot = Param.Bool(False, "End the simulation when a EOT is received on the UART") 812683Sktlim@umich.edu int_delay = Param.Latency("100ns", "Time between action and interrupt generation by UART") 822683Sktlim@umich.edu 832683Sktlim@umich.educlass Sp804(AmbaDevice): 842683Sktlim@umich.edu type = 'Sp804' 852683Sktlim@umich.edu gic = Param.Gic(Parent.any, "Gic to use for interrupting") 862683Sktlim@umich.edu int_num0 = Param.UInt32("Interrupt number that connects to GIC") 872683Sktlim@umich.edu clock0 = Param.Clock('1MHz', "Clock speed of the input") 882683Sktlim@umich.edu int_num1 = Param.UInt32("Interrupt number that connects to GIC") 892683Sktlim@umich.edu clock1 = Param.Clock('1MHz', "Clock speed of the input") 902683Sktlim@umich.edu amba_id = 0x00141804 912683Sktlim@umich.edu 922683Sktlim@umich.educlass RealView(Platform): 932683Sktlim@umich.edu type = 'RealView' 942SN/A system = Param.System(Parent.any, "system") 952683Sktlim@umich.edu 962SN/Aclass RealViewPBX(RealView): 972107SN/A uart = Pl011(pio_addr=0x10009000, int_num=44) 982107SN/A realview_io = RealViewCtrl(pio_addr=0x10000000) 992159SN/A gic = Gic() 1002455SN/A timer0 = Sp804(int_num0=36, int_num1=36, pio_addr=0x10011000) 1012455SN/A timer1 = Sp804(int_num0=37, int_num1=37, pio_addr=0x10012000) 1022SN/A 1032680SN/A l2x0_fake = IsaFake(pio_addr=0x1f002000, pio_size=0xfff) 1042SN/A flash_fake = IsaFake(pio_addr=0x40000000, pio_size=0x4000000) 1052190SN/A dmac_fake = AmbaFake(pio_addr=0x10030000) 1066315Sgblack@eecs.umich.edu uart1_fake = AmbaFake(pio_addr=0x1000a000) 1076315Sgblack@eecs.umich.edu uart2_fake = AmbaFake(pio_addr=0x1000b000) 1086315Sgblack@eecs.umich.edu uart3_fake = AmbaFake(pio_addr=0x1000c000) 1096315Sgblack@eecs.umich.edu smc_fake = AmbaFake(pio_addr=0x100e1000) 1106316Sgblack@eecs.umich.edu clcd_fake = AmbaFake(pio_addr=0x10020000) 1119384SAndreas.Sandberg@arm.com sp810_fake = AmbaFake(pio_addr=0x10001000, ignore_access=True) 1122SN/A watchdog_fake = AmbaFake(pio_addr=0x10010000) 1137720Sgblack@eecs.umich.edu gpio0_fake = AmbaFake(pio_addr=0x10013000) 1146324Sgblack@eecs.umich.edu gpio1_fake = AmbaFake(pio_addr=0x10014000) 1157597Sminkyu.jeong@arm.com gpio2_fake = AmbaFake(pio_addr=0x10015000) 1167597Sminkyu.jeong@arm.com ssp_fake = AmbaFake(pio_addr=0x1000d000) 1177597Sminkyu.jeong@arm.com sci_fake = AmbaFake(pio_addr=0x1000e000) 1182190SN/A aaci_fake = AmbaFake(pio_addr=0x10004000) 1198357Sksewell@umich.edu mmc_fake = AmbaFake(pio_addr=0x10005000) 1208357Sksewell@umich.edu kmi0_fake = AmbaFake(pio_addr=0x10006000) 1218735Sandreas.hanson@arm.com kmi1_fake = AmbaFake(pio_addr=0x10007000) 1228357Sksewell@umich.edu rtc_fake = AmbaFake(pio_addr=0x10017000, amba_id=0x41031) 1238357Sksewell@umich.edu 1242683Sktlim@umich.edu 1252188SN/A 1262378SN/A # Attach I/O devices that are on chip 1272400SN/A def attachOnChipIO(self, bus): 1286022Sgblack@eecs.umich.edu self.gic.pio = bus.port 1296022Sgblack@eecs.umich.edu self.l2x0_fake.pio = bus.port 1302SN/A 1319020Sgblack@eecs.umich.edu # Attach I/O devices to specified bus object. Can't do this 1328541Sgblack@eecs.umich.edu # earlier, since the bus object itself is typically defined at the 1332683Sktlim@umich.edu # System level. 1348793Sgblack@eecs.umich.edu def attachIO(self, bus): 1352683Sktlim@umich.edu self.uart.pio = bus.port 1369384SAndreas.Sandberg@arm.com self.realview_io.pio = bus.port 1372683Sktlim@umich.edu self.timer0.pio = bus.port 1388793Sgblack@eecs.umich.edu self.timer1.pio = bus.port 1398820Sgblack@eecs.umich.edu self.dmac_fake.pio = bus.port 1409384SAndreas.Sandberg@arm.com self.uart1_fake.pio = bus.port 1419384SAndreas.Sandberg@arm.com self.uart2_fake.pio = bus.port 1422862Sktlim@umich.edu self.uart3_fake.pio = bus.port 1432864Sktlim@umich.edu self.smc_fake.pio = bus.port 1442862Sktlim@umich.edu self.clcd_fake.pio = bus.port 1452683Sktlim@umich.edu self.sp810_fake.pio = bus.port 1462SN/A self.watchdog_fake.pio = bus.port 1472680SN/A self.gpio0_fake.pio = bus.port 148180SN/A self.gpio1_fake.pio = bus.port 1492SN/A self.gpio2_fake.pio = bus.port 1502SN/A self.ssp_fake.pio = bus.port 1512864Sktlim@umich.edu self.sci_fake.pio = bus.port 1522864Sktlim@umich.edu self.aaci_fake.pio = bus.port 1532862Sktlim@umich.edu self.mmc_fake.pio = bus.port 1542862Sktlim@umich.edu self.kmi0_fake.pio = bus.port 155217SN/A self.kmi1_fake.pio = bus.port 156237SN/A self.rtc_fake.pio = bus.port 157217SN/A self.flash_fake.pio = bus.port 1582683Sktlim@umich.edu 1592683Sktlim@umich.educlass RealViewEB(RealView): 1605891Sgblack@eecs.umich.edu uart = Pl011(pio_addr=0x10009000, int_num=44) 1612683Sktlim@umich.edu realview_io = RealViewCtrl(pio_addr=0x10000000) 1622190SN/A gic = Gic(dist_addr=0x10041000, cpu_addr=0x10040000) 1632683Sktlim@umich.edu timer0 = Sp804(int_num0=36, int_num1=36, pio_addr=0x10011000) 1642683Sktlim@umich.edu timer1 = Sp804(int_num0=37, int_num1=37, pio_addr=0x10012000) 1652683Sktlim@umich.edu 1662683Sktlim@umich.edu l2x0_fake = IsaFake(pio_addr=0x1f002000, pio_size=0xfff, warn_access="1") 1672680SN/A dmac_fake = AmbaFake(pio_addr=0x10030000) 1682190SN/A uart1_fake = AmbaFake(pio_addr=0x1000a000) 1695358Sgblack@eecs.umich.edu uart2_fake = AmbaFake(pio_addr=0x1000b000) 1705358Sgblack@eecs.umich.edu uart3_fake = AmbaFake(pio_addr=0x1000c000) 1715358Sgblack@eecs.umich.edu smc_fake = AmbaFake(pio_addr=0x100e1000) 1725358Sgblack@eecs.umich.edu clcd_fake = AmbaFake(pio_addr=0x10020000) 1735358Sgblack@eecs.umich.edu sp810_fake = AmbaFake(pio_addr=0x10001000, ignore_access=True) 1745358Sgblack@eecs.umich.edu watchdog_fake = AmbaFake(pio_addr=0x10010000) 1755358Sgblack@eecs.umich.edu gpio0_fake = AmbaFake(pio_addr=0x10013000) 1765358Sgblack@eecs.umich.edu gpio1_fake = AmbaFake(pio_addr=0x10014000) 1775358Sgblack@eecs.umich.edu gpio2_fake = AmbaFake(pio_addr=0x10015000) 1785358Sgblack@eecs.umich.edu ssp_fake = AmbaFake(pio_addr=0x1000d000) 1795358Sgblack@eecs.umich.edu sci_fake = AmbaFake(pio_addr=0x1000e000) 1805358Sgblack@eecs.umich.edu aaci_fake = AmbaFake(pio_addr=0x10004000) 1815358Sgblack@eecs.umich.edu mmc_fake = AmbaFake(pio_addr=0x10005000) 1825358Sgblack@eecs.umich.edu kmi0_fake = AmbaFake(pio_addr=0x10006000) 1835358Sgblack@eecs.umich.edu kmi1_fake = AmbaFake(pio_addr=0x10007000) 1845358Sgblack@eecs.umich.edu rtc_fake = AmbaFake(pio_addr=0x10017000, amba_id=0x41031) 1852683Sktlim@umich.edu 1862521SN/A 1875702Ssaidi@eecs.umich.edu 1885702Ssaidi@eecs.umich.edu # Attach I/O devices that are on chip 1895702Ssaidi@eecs.umich.edu def attachOnChipIO(self, bus): 1905702Ssaidi@eecs.umich.edu self.gic.pio = bus.port 1912683Sktlim@umich.edu self.l2x0_fake.pio = bus.port 1922683Sktlim@umich.edu 1932683Sktlim@umich.edu # Attach I/O devices to specified bus object. Can't do this 1942683Sktlim@umich.edu # earlier, since the bus object itself is typically defined at the 1958735Sandreas.hanson@arm.com # System level. 1962683Sktlim@umich.edu def attachIO(self, bus): 1976022Sgblack@eecs.umich.edu self.uart.pio = bus.port 1982683Sktlim@umich.edu self.realview_io.pio = bus.port 1996022Sgblack@eecs.umich.edu self.timer0.pio = bus.port 2002683Sktlim@umich.edu self.timer1.pio = bus.port 2018887Sgeoffrey.blake@arm.com self.dmac_fake.pio = bus.port 2028733Sgeoffrey.blake@arm.com self.uart1_fake.pio = bus.port 2039020Sgblack@eecs.umich.edu self.uart2_fake.pio = bus.port 2048541Sgblack@eecs.umich.edu self.uart3_fake.pio = bus.port 2054997Sgblack@eecs.umich.edu self.smc_fake.pio = bus.port 2064997Sgblack@eecs.umich.edu self.clcd_fake.pio = bus.port 2072683Sktlim@umich.edu self.sp810_fake.pio = bus.port 2082683Sktlim@umich.edu self.watchdog_fake.pio = bus.port 2092683Sktlim@umich.edu self.gpio0_fake.pio = bus.port 2102683Sktlim@umich.edu self.gpio1_fake.pio = bus.port 2112683Sktlim@umich.edu self.gpio2_fake.pio = bus.port 2122683Sktlim@umich.edu self.ssp_fake.pio = bus.port 2139180Sandreas.hansson@arm.com self.sci_fake.pio = bus.port 2142683Sktlim@umich.edu self.aaci_fake.pio = bus.port 2152683Sktlim@umich.edu self.mmc_fake.pio = bus.port 2162683Sktlim@umich.edu self.kmi0_fake.pio = bus.port 2172683Sktlim@umich.edu self.kmi1_fake.pio = bus.port 2182683Sktlim@umich.edu self.rtc_fake.pio = bus.port 2192683Sktlim@umich.edu 2202683Sktlim@umich.edu