RealView.py revision 10358:644b615fbe6a
12SN/A# Copyright (c) 2009-2014 ARM Limited 22188SN/A# All rights reserved. 32SN/A# 42SN/A# The license below extends only to copyright in the software and shall 52SN/A# not be construed as granting a license to any other intellectual 62SN/A# property including but not limited to intellectual property relating 72SN/A# to a hardware implementation of the functionality of the software 82SN/A# licensed hereunder. You may use the software subject to the license 92SN/A# terms below provided that you ensure that this notice is replicated 102SN/A# unmodified and in its entirety in all distributions of the software, 112SN/A# modified or unmodified, in source code or in binary form. 122SN/A# 132SN/A# Copyright (c) 2006-2007 The Regents of The University of Michigan 142SN/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# 272665SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 282665SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 292665SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 302665SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 312665SN/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 362465SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 377680Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 386658Snate@binkert.org# 391717SN/A# Authors: Ali Saidi 402683Sktlim@umich.edu# Gabe Black 412680SN/A# William Wang 428761Sgblack@eecs.umich.edu 435529Snate@binkert.orgfrom m5.params import * 442SN/Afrom m5.proxy import * 451858SN/Afrom Device import BasicPioDevice, PioDevice, IsaFake, BadAddr, DmaDevice 463565Sgblack@eecs.umich.edufrom Pci import PciConfigAll 475529Snate@binkert.orgfrom Ethernet import NSGigE, IGbE_igb, IGbE_e1000 481917SN/Afrom Ide import * 491070SN/Afrom Platform import Platform 501917SN/Afrom Terminal import Terminal 512188SN/Afrom Uart import Uart 521917SN/Afrom SimpleMemory import SimpleMemory 532290SN/Afrom Gic import * 541070SN/A 551917SN/Aclass AmbaPioDevice(BasicPioDevice): 562SN/A type = 'AmbaPioDevice' 575529Snate@binkert.org abstract = True 58360SN/A cxx_header = "dev/arm/amba_device.hh" 592519SN/A amba_id = Param.UInt32("ID of AMBA device for kernel detection") 602SN/A 612SN/Aclass AmbaIntDevice(AmbaPioDevice): 622SN/A type = 'AmbaIntDevice' 632SN/A abstract = True 642SN/A cxx_header = "dev/arm/amba_device.hh" 658766Sgblack@eecs.umich.edu gic = Param.BaseGic(Parent.any, "Gic to use for interrupting") 668766Sgblack@eecs.umich.edu int_num = Param.UInt32("Interrupt number that connects to GIC") 678766Sgblack@eecs.umich.edu int_delay = Param.Latency("100ns", 688766Sgblack@eecs.umich.edu "Time between action and interrupt generation by device") 698766Sgblack@eecs.umich.edu 708766Sgblack@eecs.umich.educlass AmbaDmaDevice(DmaDevice): 718766Sgblack@eecs.umich.edu type = 'AmbaDmaDevice' 728766Sgblack@eecs.umich.edu abstract = True 738766Sgblack@eecs.umich.edu cxx_header = "dev/arm/amba_device.hh" 748766Sgblack@eecs.umich.edu pio_addr = Param.Addr("Address for AMBA slave interface") 752683Sktlim@umich.edu pio_latency = Param.Latency("10ns", "Time between action and write/read result by AMBA DMA Device") 766022Sgblack@eecs.umich.edu gic = Param.BaseGic(Parent.any, "Gic to use for interrupting") 772683Sktlim@umich.edu int_num = Param.UInt32("Interrupt number that connects to GIC") 788766Sgblack@eecs.umich.edu amba_id = Param.UInt32("ID of AMBA device for kernel detection") 796324Sgblack@eecs.umich.edu 802521SN/Aclass A9SCU(BasicPioDevice): 812SN/A type = 'A9SCU' 822683Sktlim@umich.edu cxx_header = "dev/arm/a9scu.hh" 832190SN/A 842680SN/Aclass RealViewCtrl(BasicPioDevice): 852290SN/A type = 'RealViewCtrl' 866316Sgblack@eecs.umich.edu cxx_header = "dev/arm/rv_ctrl.hh" 871917SN/A proc_id0 = Param.UInt32(0x0C000000, "Processor ID, SYS_PROCID") 885529Snate@binkert.org proc_id1 = Param.UInt32(0x0C000222, "Processor ID, SYS_PROCID1") 891982SN/A idreg = Param.UInt32(0x00000000, "ID Register, SYS_ID") 901917SN/A 912683Sktlim@umich.educlass VGic(PioDevice): 922683Sktlim@umich.edu type = 'VGic' 931917SN/A cxx_header = "dev/arm/vgic.hh" 941917SN/A gic = Param.BaseGic(Parent.any, "Gic to use for interrupting") 951917SN/A platform = Param.Platform(Parent.any, "Platform this device is part of.") 961917SN/A vcpu_addr = Param.Addr(0, "Address for vcpu interfaces") 971917SN/A hv_addr = Param.Addr(0, "Address for hv control") 981917SN/A pio_delay = Param.Latency('10ns', "Delay for PIO r/w") 991917SN/A # The number of list registers is not currently configurable at runtime. 1001917SN/A ppint = Param.UInt32("HV maintenance interrupt number") 1012521SN/A 1025482Snate@binkert.orgclass AmbaFake(AmbaPioDevice): 1033548Sgblack@eecs.umich.edu type = 'AmbaFake' 1042SN/A cxx_header = "dev/arm/amba_fake.hh" 1052862Sktlim@umich.edu ignore_access = Param.Bool(False, "Ignore reads/writes to this device, (e.g. IsaFake + AMBA)") 1062862Sktlim@umich.edu amba_id = 0; 1072864Sktlim@umich.edu 1086331Sgblack@eecs.umich.educlass Pl011(Uart): 1092190SN/A type = 'Pl011' 1102683Sktlim@umich.edu cxx_header = "dev/arm/pl011.hh" 1112190SN/A gic = Param.BaseGic(Parent.any, "Gic to use for interrupting") 1122190SN/A int_num = Param.UInt32("Interrupt number that connects to GIC") 1132683Sktlim@umich.edu end_on_eot = Param.Bool(False, "End the simulation when a EOT is received on the UART") 1141070SN/A int_delay = Param.Latency("100ns", "Time between action and interrupt generation by UART") 1158754Sgblack@eecs.umich.edu 1163486Sktlim@umich.educlass Sp804(AmbaPioDevice): 1172680SN/A type = 'Sp804' 1181070SN/A cxx_header = "dev/arm/timer_sp804.hh" 1191070SN/A gic = Param.BaseGic(Parent.any, "Gic to use for interrupting") 1201917SN/A int_num0 = Param.UInt32("Interrupt number that connects to GIC") 1212683Sktlim@umich.edu clock0 = Param.Clock('1MHz', "Clock speed of the input") 122180SN/A int_num1 = Param.UInt32("Interrupt number that connects to GIC") 123180SN/A clock1 = Param.Clock('1MHz', "Clock speed of the input") 1241858SN/A amba_id = 0x00141804 1252235SN/A 126180SN/Aclass CpuLocalTimer(BasicPioDevice): 1272235SN/A type = 'CpuLocalTimer' 128180SN/A cxx_header = "dev/arm/timer_cpulocal.hh" 129180SN/A gic = Param.BaseGic(Parent.any, "Gic to use for interrupting") 1302862Sktlim@umich.edu int_num_timer = Param.UInt32("Interrrupt number used per-cpu to GIC") 1312862Sktlim@umich.edu int_num_watchdog = Param.UInt32("Interrupt number for per-cpu watchdog to GIC") 1322313SN/A 1332313SN/Aclass GenericTimer(SimObject): 1342680SN/A type = 'GenericTimer' 1352313SN/A cxx_header = "dev/arm/generic_timer.hh" 1362680SN/A system = Param.System(Parent.any, "system") 1372313SN/A gic = Param.BaseGic(Parent.any, "GIC to use for interrupting") 1382313SN/A int_num = Param.UInt32("Interrupt number used per-cpu to GIC") 1392680SN/A # @todo: for now only one timer per CPU is supported, which is the 1402313SN/A # normal behaviour when Security and Virt. extensions are disabled. 1412361SN/A 1423548Sgblack@eecs.umich.educlass PL031(AmbaIntDevice): 1432361SN/A type = 'PL031' 1442361SN/A cxx_header = "dev/arm/rtc_pl031.hh" 1452361SN/A time = Param.Time('01/01/2009', "System time to use ('Now' for actual time)") 1462235SN/A amba_id = 0x00341031 147180SN/A 148180SN/Aclass Pl050(AmbaIntDevice): 149180SN/A type = 'Pl050' 1506029Ssteve.reinhardt@amd.com cxx_header = "dev/arm/kmi.hh" 151180SN/A vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer display") 152180SN/A is_mouse = Param.Bool(False, "Is this interface a mouse, if not a keyboard") 1532SN/A int_delay = '1us' 1542864Sktlim@umich.edu amba_id = 0x00141050 1552864Sktlim@umich.edu 1562864Sktlim@umich.educlass Pl111(AmbaDmaDevice): 1572864Sktlim@umich.edu type = 'Pl111' 1582864Sktlim@umich.edu cxx_header = "dev/arm/pl111.hh" 1592864Sktlim@umich.edu pixel_clock = Param.Clock('24MHz', "Pixel clock") 1602864Sktlim@umich.edu vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer display") 1612864Sktlim@umich.edu amba_id = 0x00141111 1622864Sktlim@umich.edu enable_capture = Param.Bool(True, "capture frame to system.framebuffer.bmp") 1633548Sgblack@eecs.umich.edu 1642864Sktlim@umich.edu 1652864Sktlim@umich.educlass HDLcd(AmbaDmaDevice): 1662864Sktlim@umich.edu type = 'HDLcd' 1672864Sktlim@umich.edu cxx_header = "dev/arm/hdlcd.hh" 1682864Sktlim@umich.edu # For reference, 1024x768MR-16@60 ~= 56 MHz 1692864Sktlim@umich.edu # 1920x1080MR-16@60 ~= 137 MHz 1702864Sktlim@umich.edu # 3840x2160MR-16@60 ~= 533 MHz 1712862Sktlim@umich.edu # Match against the resolution selected in the Linux DTS/DTB file. 1722862Sktlim@umich.edu pixel_clock = Param.Clock('137MHz', "Clock frequency of the pixel clock " 1732862Sktlim@umich.edu "(i.e. PXLREFCLK / OSCCLK 5") 1742862Sktlim@umich.edu vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer " 1752862Sktlim@umich.edu "display") 1762862Sktlim@umich.edu amba_id = 0x00141000 1772862Sktlim@umich.edu enable_capture = Param.Bool(True, "capture frame to system.framebuffer.bmp") 1782862Sktlim@umich.edu 1795714Shsul@eecs.umich.educlass RealView(Platform): 1805715Shsul@eecs.umich.edu type = 'RealView' 1815714Shsul@eecs.umich.edu cxx_header = "dev/arm/realview.hh" 1822862Sktlim@umich.edu system = Param.System(Parent.any, "system") 1832862Sktlim@umich.edu pci_io_base = Param.Addr(0, "Base address of PCI IO Space") 1842862Sktlim@umich.edu pci_cfg_base = Param.Addr(0, "Base address of PCI Configuraiton Space") 1852683Sktlim@umich.edu pci_cfg_gen_offsets = Param.Bool(False, "Should the offsets used for PCI cfg access" 186217SN/A " be compatible with the pci-generic-host or the legacy host bridge?") 1872862Sktlim@umich.edu _mem_regions = [(Addr(0), Addr('256MB'))] 1886315Sgblack@eecs.umich.edu 1896316Sgblack@eecs.umich.edu def attachPciDevices(self): 1907720Sgblack@eecs.umich.edu pass 191223SN/A 1926677SBrad.Beckmann@amd.com def enableMSIX(self): 1936677SBrad.Beckmann@amd.com pass 1946677SBrad.Beckmann@amd.com 1956677SBrad.Beckmann@amd.com def onChipIOClkDomain(self, clkdomain): 1966678Sgblack@eecs.umich.edu pass 197217SN/A 198217SN/A def offChipIOClkDomain(self, clkdomain): 199217SN/A pass 200217SN/A 2012683Sktlim@umich.edu def setupBootLoader(self, mem_bus, cur_sys, loc): 202217SN/A self.nvmem = SimpleMemory(range = AddrRange('2GB', size = '64MB'), 2032862Sktlim@umich.edu conf_table_reported = False) 2046315Sgblack@eecs.umich.edu self.nvmem.port = mem_bus.master 2056316Sgblack@eecs.umich.edu cur_sys.boot_loader = loc('boot.arm') 2067720Sgblack@eecs.umich.edu cur_sys.atags_addr = 0x100 207223SN/A cur_sys.load_addr_mask = 0xfffffff 2086677SBrad.Beckmann@amd.com cur_sys.load_offset = 0 2096677SBrad.Beckmann@amd.com 2106677SBrad.Beckmann@amd.com 2116677SBrad.Beckmann@amd.com# Reference for memory map and interrupt number 2126678Sgblack@eecs.umich.edu# RealView Platform Baseboard Explore for Cortex-A9 User Guide(ARM DUI 0440A) 213217SN/A# Chapter 4: Programmer's Reference 214217SN/Aclass RealViewPBX(RealView): 2152683Sktlim@umich.edu uart = Pl011(pio_addr=0x10009000, int_num=44) 2162683Sktlim@umich.edu realview_io = RealViewCtrl(pio_addr=0x10000000) 2172683Sktlim@umich.edu gic = Pl390() 2182683Sktlim@umich.edu timer0 = Sp804(int_num0=36, int_num1=36, pio_addr=0x10011000) 2192683Sktlim@umich.edu timer1 = Sp804(int_num0=37, int_num1=37, pio_addr=0x10012000) 2202683Sktlim@umich.edu local_cpu_timer = CpuLocalTimer(int_num_timer=29, int_num_watchdog=30, pio_addr=0x1f000600) 2212683Sktlim@umich.edu clcd = Pl111(pio_addr=0x10020000, int_num=55) 2222683Sktlim@umich.edu kmi0 = Pl050(pio_addr=0x10006000, int_num=52) 223217SN/A kmi1 = Pl050(pio_addr=0x10007000, int_num=53, is_mouse=True) 224217SN/A a9scu = A9SCU(pio_addr=0x1f000000) 2252683Sktlim@umich.edu cf_ctrl = IdeController(disks=[], pci_func=0, pci_dev=7, pci_bus=2, 2262SN/A io_shift = 1, ctrl_offset = 2, Command = 0x1, 2272680SN/A BAR0 = 0x18000000, BAR0Size = '16B', 2282SN/A BAR1 = 0x18000100, BAR1Size = '1B', 2292SN/A BAR0LegacyIO = True, BAR1LegacyIO = True) 2307823Ssteve.reinhardt@amd.com 2312188SN/A 2324400Srdreslin@umich.edu l2x0_fake = IsaFake(pio_addr=0x1f002000, pio_size=0xfff) 2335715Shsul@eecs.umich.edu flash_fake = IsaFake(pio_addr=0x40000000, pio_size=0x20000000, 2345543Ssaidi@eecs.umich.edu fake_mem=True) 2354400Srdreslin@umich.edu dmac_fake = AmbaFake(pio_addr=0x10030000) 2362290SN/A uart1_fake = AmbaFake(pio_addr=0x1000a000) 2372680SN/A uart2_fake = AmbaFake(pio_addr=0x1000b000) 2382290SN/A uart3_fake = AmbaFake(pio_addr=0x1000c000) 2392290SN/A smc_fake = AmbaFake(pio_addr=0x100e1000) 2405715Shsul@eecs.umich.edu sp810_fake = AmbaFake(pio_addr=0x10001000, ignore_access=True) 241393SN/A watchdog_fake = AmbaFake(pio_addr=0x10010000) 242393SN/A gpio0_fake = AmbaFake(pio_addr=0x10013000) 243393SN/A gpio1_fake = AmbaFake(pio_addr=0x10014000) 2442683Sktlim@umich.edu gpio2_fake = AmbaFake(pio_addr=0x10015000) 245393SN/A ssp_fake = AmbaFake(pio_addr=0x1000d000) 2462680SN/A sci_fake = AmbaFake(pio_addr=0x1000e000) 247393SN/A aaci_fake = AmbaFake(pio_addr=0x10004000) 248393SN/A mmc_fake = AmbaFake(pio_addr=0x10005000) 2497823Ssteve.reinhardt@amd.com rtc = PL031(pio_addr=0x10017000, int_num=42) 2507823Ssteve.reinhardt@amd.com 2512188SN/A 2521858SN/A # Attach I/O devices that are on chip and also set the appropriate 2532SN/A # ranges for the bridge 2545704Snate@binkert.org def attachOnChipIO(self, bus, bridge): 2552680SN/A self.gic.pio = bus.master 2562SN/A self.l2x0_fake.pio = bus.master 2572SN/A self.a9scu.pio = bus.master 2582SN/A self.local_cpu_timer.pio = bus.master 2592188SN/A # Bridge ranges based on excluding what is part of on-chip I/O 2602680SN/A # (gic, l2x0, a9scu, local_cpu_timer) 2615715Shsul@eecs.umich.edu bridge.ranges = [AddrRange(self.realview_io.pio_addr, 2622SN/A self.a9scu.pio_addr - 1), 2632SN/A AddrRange(self.flash_fake.pio_addr, 264393SN/A self.flash_fake.pio_addr + \ 265393SN/A self.flash_fake.pio_size - 1)] 2662683Sktlim@umich.edu 267393SN/A # Set the clock domain for IO objects that are considered 2682680SN/A # to be "close" to the cores. 269393SN/A def onChipIOClkDomain(self, clkdomain): 270393SN/A self.gic.clk_domain = clkdomain 2712680SN/A self.l2x0_fake.clk_domain = clkdomain 2725715Shsul@eecs.umich.edu self.a9scu.clkdomain = clkdomain 273393SN/A self.local_cpu_timer.clk_domain = clkdomain 274393SN/A 275393SN/A # Attach I/O devices to specified bus object. Can't do this 276393SN/A # earlier, since the bus object itself is typically defined at the 2772683Sktlim@umich.edu # System level. 2782SN/A def attachIO(self, bus): 2792330SN/A self.uart.pio = bus.master 2802341SN/A self.realview_io.pio = bus.master 2812341SN/A self.timer0.pio = bus.master 2822330SN/A self.timer1.pio = bus.master 2832SN/A self.clcd.pio = bus.master 284716SN/A self.clcd.dma = bus.slave 285716SN/A self.kmi0.pio = bus.master 2862683Sktlim@umich.edu self.kmi1.pio = bus.master 2872190SN/A self.cf_ctrl.pio = bus.master 2882680SN/A self.cf_ctrl.config = bus.master 2892190SN/A self.cf_ctrl.dma = bus.slave 2902190SN/A self.dmac_fake.pio = bus.master 291 self.uart1_fake.pio = bus.master 292 self.uart2_fake.pio = bus.master 293 self.uart3_fake.pio = bus.master 294 self.smc_fake.pio = bus.master 295 self.sp810_fake.pio = bus.master 296 self.watchdog_fake.pio = bus.master 297 self.gpio0_fake.pio = bus.master 298 self.gpio1_fake.pio = bus.master 299 self.gpio2_fake.pio = bus.master 300 self.ssp_fake.pio = bus.master 301 self.sci_fake.pio = bus.master 302 self.aaci_fake.pio = bus.master 303 self.mmc_fake.pio = bus.master 304 self.rtc.pio = bus.master 305 self.flash_fake.pio = bus.master 306 307 # Set the clock domain for IO objects that are considered 308 # to be "far" away from the cores. 309 def offChipIOClkDomain(self, clkdomain): 310 self.uart.clk_domain = clkdomain 311 self.realview_io.clk_domain = clkdomain 312 self.timer0.clk_domain = clkdomain 313 self.timer1.clk_domain = clkdomain 314 self.clcd.clk_domain = clkdomain 315 self.kmi0.clk_domain = clkdomain 316 self.kmi1.clk_domain = clkdomain 317 self.cf_ctrl.clk_domain = clkdomain 318 self.dmac_fake.clk_domain = clkdomain 319 self.uart1_fake.clk_domain = clkdomain 320 self.uart2_fake.clk_domain = clkdomain 321 self.uart3_fake.clk_domain = clkdomain 322 self.smc_fake.clk_domain = clkdomain 323 self.sp810_fake.clk_domain = clkdomain 324 self.watchdog_fake.clk_domain = clkdomain 325 self.gpio0_fake.clk_domain = clkdomain 326 self.gpio1_fake.clk_domain = clkdomain 327 self.gpio2_fake.clk_domain = clkdomain 328 self.ssp_fake.clk_domain = clkdomain 329 self.sci_fake.clk_domain = clkdomain 330 self.aaci_fake.clk_domain = clkdomain 331 self.mmc_fake.clk_domain = clkdomain 332 self.rtc.clk_domain = clkdomain 333 self.flash_fake.clk_domain = clkdomain 334 335# Reference for memory map and interrupt number 336# RealView Emulation Baseboard User Guide (ARM DUI 0143B) 337# Chapter 4: Programmer's Reference 338class RealViewEB(RealView): 339 uart = Pl011(pio_addr=0x10009000, int_num=44) 340 realview_io = RealViewCtrl(pio_addr=0x10000000, idreg=0x01400500) 341 gic = Pl390(dist_addr=0x10041000, cpu_addr=0x10040000) 342 timer0 = Sp804(int_num0=36, int_num1=36, pio_addr=0x10011000) 343 timer1 = Sp804(int_num0=37, int_num1=37, pio_addr=0x10012000) 344 clcd = Pl111(pio_addr=0x10020000, int_num=23) 345 kmi0 = Pl050(pio_addr=0x10006000, int_num=20) 346 kmi1 = Pl050(pio_addr=0x10007000, int_num=21, is_mouse=True) 347 348 l2x0_fake = IsaFake(pio_addr=0x1f002000, pio_size=0xfff, warn_access="1") 349 flash_fake = IsaFake(pio_addr=0x40000000, pio_size=0x20000000-1, 350 fake_mem=True) 351 dmac_fake = AmbaFake(pio_addr=0x10030000) 352 uart1_fake = AmbaFake(pio_addr=0x1000a000) 353 uart2_fake = AmbaFake(pio_addr=0x1000b000) 354 uart3_fake = AmbaFake(pio_addr=0x1000c000) 355 smcreg_fake = IsaFake(pio_addr=0x10080000, pio_size=0x10000-1) 356 smc_fake = AmbaFake(pio_addr=0x100e1000) 357 sp810_fake = AmbaFake(pio_addr=0x10001000, ignore_access=True) 358 watchdog_fake = AmbaFake(pio_addr=0x10010000) 359 gpio0_fake = AmbaFake(pio_addr=0x10013000) 360 gpio1_fake = AmbaFake(pio_addr=0x10014000) 361 gpio2_fake = AmbaFake(pio_addr=0x10015000) 362 ssp_fake = AmbaFake(pio_addr=0x1000d000) 363 sci_fake = AmbaFake(pio_addr=0x1000e000) 364 aaci_fake = AmbaFake(pio_addr=0x10004000) 365 mmc_fake = AmbaFake(pio_addr=0x10005000) 366 rtc_fake = AmbaFake(pio_addr=0x10017000, amba_id=0x41031) 367 368 369 370 # Attach I/O devices that are on chip and also set the appropriate 371 # ranges for the bridge 372 def attachOnChipIO(self, bus, bridge): 373 self.gic.pio = bus.master 374 self.l2x0_fake.pio = bus.master 375 # Bridge ranges based on excluding what is part of on-chip I/O 376 # (gic, l2x0) 377 bridge.ranges = [AddrRange(self.realview_io.pio_addr, 378 self.gic.cpu_addr - 1), 379 AddrRange(self.flash_fake.pio_addr, Addr.max)] 380 381 # Set the clock domain for IO objects that are considered 382 # to be "close" to the cores. 383 def onChipIOClkDomain(self, clkdomain): 384 self.gic.clk_domain = clkdomain 385 self.l2x0_fake.clk_domain = clkdomain 386 387 # Attach I/O devices to specified bus object. Can't do this 388 # earlier, since the bus object itself is typically defined at the 389 # System level. 390 def attachIO(self, bus): 391 self.uart.pio = bus.master 392 self.realview_io.pio = bus.master 393 self.timer0.pio = bus.master 394 self.timer1.pio = bus.master 395 self.clcd.pio = bus.master 396 self.clcd.dma = bus.slave 397 self.kmi0.pio = bus.master 398 self.kmi1.pio = bus.master 399 self.dmac_fake.pio = bus.master 400 self.uart1_fake.pio = bus.master 401 self.uart2_fake.pio = bus.master 402 self.uart3_fake.pio = bus.master 403 self.smc_fake.pio = bus.master 404 self.sp810_fake.pio = bus.master 405 self.watchdog_fake.pio = bus.master 406 self.gpio0_fake.pio = bus.master 407 self.gpio1_fake.pio = bus.master 408 self.gpio2_fake.pio = bus.master 409 self.ssp_fake.pio = bus.master 410 self.sci_fake.pio = bus.master 411 self.aaci_fake.pio = bus.master 412 self.mmc_fake.pio = bus.master 413 self.rtc_fake.pio = bus.master 414 self.flash_fake.pio = bus.master 415 self.smcreg_fake.pio = bus.master 416 417 # Set the clock domain for IO objects that are considered 418 # to be "far" away from the cores. 419 def offChipIOClkDomain(self, clkdomain): 420 self.uart.clk_domain = clkdomain 421 self.realview_io.clk_domain = clkdomain 422 self.timer0.clk_domain = clkdomain 423 self.timer1.clk_domain = clkdomain 424 self.clcd.clk_domain = clkdomain 425 self.kmi0.clk_domain = clkdomain 426 self.kmi1.clk_domain = clkdomain 427 self.dmac_fake.clk_domain = clkdomain 428 self.uart1_fake.clk_domain = clkdomain 429 self.uart2_fake.clk_domain = clkdomain 430 self.uart3_fake.clk_domain = clkdomain 431 self.smc_fake.clk_domain = clkdomain 432 self.sp810_fake.clk_domain = clkdomain 433 self.watchdog_fake.clk_domain = clkdomain 434 self.gpio0_fake.clk_domain = clkdomain 435 self.gpio1_fake.clk_domain = clkdomain 436 self.gpio2_fake.clk_domain = clkdomain 437 self.ssp_fake.clk_domain = clkdomain 438 self.sci_fake.clk_domain = clkdomain 439 self.aaci_fake.clk_domain = clkdomain 440 self.mmc_fake.clk_domain = clkdomain 441 self.rtc.clk_domain = clkdomain 442 self.flash_fake.clk_domain = clkdomain 443 self.smcreg_fake.clk_domain = clkdomain 444 445class VExpress_EMM(RealView): 446 _mem_regions = [(Addr('2GB'), Addr('2GB'))] 447 pci_cfg_base = 0x30000000 448 uart = Pl011(pio_addr=0x1c090000, int_num=37) 449 realview_io = RealViewCtrl(proc_id0=0x14000000, proc_id1=0x14000000, \ 450 idreg=0x02250000, pio_addr=0x1C010000) 451 gic = Pl390(dist_addr=0x2C001000, cpu_addr=0x2C002000) 452 local_cpu_timer = CpuLocalTimer(int_num_timer=29, int_num_watchdog=30, pio_addr=0x2C080000) 453 generic_timer = GenericTimer(int_num=29) 454 timer0 = Sp804(int_num0=34, int_num1=34, pio_addr=0x1C110000, clock0='1MHz', clock1='1MHz') 455 timer1 = Sp804(int_num0=35, int_num1=35, pio_addr=0x1C120000, clock0='1MHz', clock1='1MHz') 456 clcd = Pl111(pio_addr=0x1c1f0000, int_num=46) 457 hdlcd = HDLcd(pio_addr=0x2b000000, int_num=117) 458 kmi0 = Pl050(pio_addr=0x1c060000, int_num=44) 459 kmi1 = Pl050(pio_addr=0x1c070000, int_num=45, is_mouse=True) 460 vgic = VGic(vcpu_addr=0x2c006000, hv_addr=0x2c004000, ppint=25) 461 cf_ctrl = IdeController(disks=[], pci_func=0, pci_dev=0, pci_bus=2, 462 io_shift = 2, ctrl_offset = 2, Command = 0x1, 463 BAR0 = 0x1C1A0000, BAR0Size = '256B', 464 BAR1 = 0x1C1A0100, BAR1Size = '4096B', 465 BAR0LegacyIO = True, BAR1LegacyIO = True) 466 467 pciconfig = PciConfigAll(size='256MB') 468 vram = SimpleMemory(range = AddrRange(0x18000000, size='32MB'), 469 conf_table_reported = False) 470 rtc = PL031(pio_addr=0x1C170000, int_num=36) 471 472 l2x0_fake = IsaFake(pio_addr=0x2C100000, pio_size=0xfff) 473 uart1_fake = AmbaFake(pio_addr=0x1C0A0000) 474 uart2_fake = AmbaFake(pio_addr=0x1C0B0000) 475 uart3_fake = AmbaFake(pio_addr=0x1C0C0000) 476 sp810_fake = AmbaFake(pio_addr=0x1C020000, ignore_access=True) 477 watchdog_fake = AmbaFake(pio_addr=0x1C0F0000) 478 aaci_fake = AmbaFake(pio_addr=0x1C040000) 479 lan_fake = IsaFake(pio_addr=0x1A000000, pio_size=0xffff) 480 usb_fake = IsaFake(pio_addr=0x1B000000, pio_size=0x1ffff) 481 mmc_fake = AmbaFake(pio_addr=0x1c050000) 482 483 # Attach any PCI devices that are supported 484 def attachPciDevices(self): 485 self.ethernet = IGbE_e1000(pci_bus=0, pci_dev=0, pci_func=0, 486 InterruptLine=1, InterruptPin=1) 487 self.ide = IdeController(disks = [], pci_bus=0, pci_dev=1, pci_func=0, 488 InterruptLine=2, InterruptPin=2) 489 490 def enableMSIX(self): 491 self.gic = Pl390(dist_addr=0x2C001000, cpu_addr=0x2C002000, it_lines=512) 492 self.gicv2m = Gicv2m() 493 self.gicv2m.frames = [Gicv2mFrame(spi_base=256, spi_len=64, addr=0x2C1C0000)] 494 495 def setupBootLoader(self, mem_bus, cur_sys, loc): 496 self.nvmem = SimpleMemory(range = AddrRange('64MB'), 497 conf_table_reported = False) 498 self.nvmem.port = mem_bus.master 499 cur_sys.boot_loader = loc('boot_emm.arm') 500 cur_sys.atags_addr = 0x8000000 501 cur_sys.load_addr_mask = 0xfffffff 502 cur_sys.load_offset = 0x80000000 503 504 # Attach I/O devices that are on chip and also set the appropriate 505 # ranges for the bridge 506 def attachOnChipIO(self, bus, bridge): 507 self.gic.pio = bus.master 508 self.local_cpu_timer.pio = bus.master 509 if hasattr(self, "gicv2m"): 510 self.gicv2m.pio = bus.master 511 self.hdlcd.dma = bus.slave 512 # Bridge ranges based on excluding what is part of on-chip I/O 513 # (gic, a9scu) 514 bridge.ranges = [AddrRange(0x2F000000, size='16MB'), 515 AddrRange(0x2B000000, size='4MB'), 516 AddrRange(0x30000000, size='256MB'), 517 AddrRange(0x40000000, size='512MB'), 518 AddrRange(0x18000000, size='64MB'), 519 AddrRange(0x1C000000, size='64MB')] 520 self.vgic.pio = bus.master 521 522 523 # Set the clock domain for IO objects that are considered 524 # to be "close" to the cores. 525 def onChipIOClkDomain(self, clkdomain): 526 self.gic.clk_domain = clkdomain 527 if hasattr(self, "gicv2m"): 528 self.gicv2m.clk_domain = clkdomain 529 self.hdlcd.clk_domain = clkdomain 530 self.vgic.clk_domain = clkdomain 531 532 # Attach I/O devices to specified bus object. Done here 533 # as the specified bus to connect to may not always be fixed. 534 def attachIO(self, bus): 535 self.uart.pio = bus.master 536 self.realview_io.pio = bus.master 537 self.timer0.pio = bus.master 538 self.timer1.pio = bus.master 539 self.clcd.pio = bus.master 540 self.clcd.dma = bus.slave 541 self.hdlcd.pio = bus.master 542 self.kmi0.pio = bus.master 543 self.kmi1.pio = bus.master 544 self.cf_ctrl.pio = bus.master 545 self.cf_ctrl.dma = bus.slave 546 self.cf_ctrl.config = bus.master 547 self.rtc.pio = bus.master 548 bus.use_default_range = True 549 self.vram.port = bus.master 550 self.pciconfig.pio = bus.default 551 552 self.l2x0_fake.pio = bus.master 553 self.uart1_fake.pio = bus.master 554 self.uart2_fake.pio = bus.master 555 self.uart3_fake.pio = bus.master 556 self.sp810_fake.pio = bus.master 557 self.watchdog_fake.pio = bus.master 558 self.aaci_fake.pio = bus.master 559 self.lan_fake.pio = bus.master 560 self.usb_fake.pio = bus.master 561 self.mmc_fake.pio = bus.master 562 563 # Try to attach the I/O if it exists 564 try: 565 self.ide.pio = bus.master 566 self.ide.config = bus.master 567 self.ide.dma = bus.slave 568 self.ethernet.pio = bus.master 569 self.ethernet.config = bus.master 570 self.ethernet.dma = bus.slave 571 except: 572 pass 573 574 # Set the clock domain for IO objects that are considered 575 # to be "far" away from the cores. 576 def offChipIOClkDomain(self, clkdomain): 577 self.uart.clk_domain = clkdomain 578 self.realview_io.clk_domain = clkdomain 579 self.timer0.clk_domain = clkdomain 580 self.timer1.clk_domain = clkdomain 581 self.clcd.clk_domain = clkdomain 582 self.kmi0.clk_domain = clkdomain 583 self.kmi1.clk_domain = clkdomain 584 self.cf_ctrl.clk_domain = clkdomain 585 self.rtc.clk_domain = clkdomain 586 self.vram.clk_domain = clkdomain 587 self.pciconfig.clk_domain = clkdomain 588 589 self.l2x0_fake.clk_domain = clkdomain 590 self.uart1_fake.clk_domain = clkdomain 591 self.uart2_fake.clk_domain = clkdomain 592 self.uart3_fake.clk_domain = clkdomain 593 self.sp810_fake.clk_domain = clkdomain 594 self.watchdog_fake.clk_domain = clkdomain 595 self.aaci_fake.clk_domain = clkdomain 596 self.lan_fake.clk_domain = clkdomain 597 self.usb_fake.clk_domain = clkdomain 598 self.mmc_fake.clk_domain = clkdomain 599 600class VExpress_EMM64(VExpress_EMM): 601 pci_io_base = 0x2f000000 602 pci_cfg_gen_offsets = True 603 # Three memory regions are specified totalling 512GB 604 _mem_regions = [(Addr('2GB'), Addr('2GB')), (Addr('34GB'), Addr('30GB')), 605 (Addr('512GB'), Addr('480GB'))] 606 def setupBootLoader(self, mem_bus, cur_sys, loc): 607 self.nvmem = SimpleMemory(range = AddrRange(0, size = '64MB')) 608 self.nvmem.port = mem_bus.master 609 cur_sys.boot_loader = loc('boot_emm.arm64') 610 cur_sys.atags_addr = 0x8000000 611 cur_sys.load_addr_mask = 0xfffffff 612 cur_sys.load_offset = 0x80000000 613 614 615