1 # Copyright (c) 2010-2012, 2015-2019 ARM Limited
2 # Copyright (c) 2020 Barkhausen Institut
5 # The license below extends only to copyright in the software and shall
6 # not be construed as granting a license to any other intellectual
7 # property including but not limited to intellectual property relating
8 # to a hardware implementation of the functionality of the software
9 # licensed hereunder. You may use the software subject to the license
10 # terms below provided that you ensure that this notice is replicated
11 # unmodified and in its entirety in all distributions of the software,
12 # modified or unmodified, in source code or in binary form.
14 # Copyright (c) 2010-2011 Advanced Micro Devices, Inc.
15 # Copyright (c) 2006-2008 The Regents of The University of Michigan
16 # All rights reserved.
18 # Redistribution and use in source and binary forms, with or without
19 # modification, are permitted provided that the following conditions are
20 # met: redistributions of source code must retain the above copyright
21 # notice, this list of conditions and the following disclaimer;
22 # redistributions in binary form must reproduce the above copyright
23 # notice, this list of conditions and the following disclaimer in the
24 # documentation and/or other materials provided with the distribution;
25 # neither the name of the copyright holders nor the names of its
26 # contributors may be used to endorse or promote products derived from
27 # this software without specific prior written permission.
29 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 from __future__
import print_function
42 from __future__
import absolute_import
47 from m5
.objects
import *
49 from common
.Benchmarks
import *
50 from common
import ObjectList
55 # Populate to reflect supported os types per target ISA
56 os_types
= { 'mips' : [ 'linux' ],
57 'riscv' : [ 'linux' ], # TODO that's a lie
58 'sparc' : [ 'linux' ],
61 'android-gingerbread',
68 class CowIdeDisk(IdeDisk
):
69 image
= CowDiskImage(child
=RawDiskImage(read_only
=True),
72 def childImage(self
, ci
):
73 self
.image
.child
.image_file
= ci
75 class MemBus(SystemXBar
):
76 badaddr_responder
= BadAddr()
77 default
= Self
.badaddr_responder
.pio
79 def attach_9p(parent
, bus
):
81 viopci
.vio
= VirtIO9PDiod()
82 viodir
= os
.path
.join(m5
.options
.outdir
, '9p')
83 viopci
.vio
.root
= os
.path
.join(viodir
, 'share')
84 viopci
.vio
.socketPath
= os
.path
.join(viodir
, 'socket')
85 if not os
.path
.exists(viopci
.vio
.root
):
86 os
.makedirs(viopci
.vio
.root
)
87 if os
.path
.exists(viopci
.vio
.socketPath
):
88 os
.remove(viopci
.vio
.socketPath
)
89 parent
.viopci
= viopci
90 parent
.attachPciDevice(viopci
, bus
)
92 def fillInCmdline(mdesc
, template
, **kwargs
):
93 kwargs
.setdefault('rootdev', mdesc
.rootdev())
94 kwargs
.setdefault('mem', mdesc
.mem())
95 kwargs
.setdefault('script', mdesc
.script())
96 return template
% kwargs
98 def makeCowDisks(disk_paths
):
100 for disk_path
in disk_paths
:
101 disk
= CowIdeDisk(driveID
='master')
102 disk
.childImage(disk_path
);
106 def makeSparcSystem(mem_mode
, mdesc
=None, cmdline
=None):
107 # Constants from iob.cc and uart8250.cc
108 iob_man_addr
= 0x9800000000
111 class CowMmDisk(MmDisk
):
112 image
= CowDiskImage(child
=RawDiskImage(read_only
=True),
115 def childImage(self
, ci
):
116 self
.image
.child
.image_file
= ci
122 self
.readfile
= mdesc
.script()
123 self
.iobus
= IOXBar()
124 self
.membus
= MemBus()
125 self
.bridge
= Bridge(delay
='50ns')
127 self
.t1000
.attachOnChipIO(self
.membus
)
128 self
.t1000
.attachIO(self
.iobus
)
129 self
.mem_ranges
= [AddrRange(Addr('1MB'), size
= '64MB'),
130 AddrRange(Addr('2GB'), size
='256MB')]
131 self
.bridge
.master
= self
.iobus
.slave
132 self
.bridge
.slave
= self
.membus
.master
133 self
.intrctrl
= IntrControl()
134 self
.disk0
= CowMmDisk()
135 self
.disk0
.childImage(mdesc
.disks()[0])
136 self
.disk0
.pio
= self
.iobus
.master
138 # The puart0 and hvuart are placed on the IO bus, so create ranges
139 # for them. The remaining IO range is rather fragmented, so poke
140 # holes for the iob and partition descriptors etc.
141 self
.bridge
.ranges
= \
143 AddrRange(self
.t1000
.puart0
.pio_addr
,
144 self
.t1000
.puart0
.pio_addr
+ uart_pio_size
- 1),
145 AddrRange(self
.disk0
.pio_addr
,
146 self
.t1000
.fake_jbi
.pio_addr
+
147 self
.t1000
.fake_jbi
.pio_size
- 1),
148 AddrRange(self
.t1000
.fake_clk
.pio_addr
,
150 AddrRange(self
.t1000
.fake_l2_1
.pio_addr
,
151 self
.t1000
.fake_ssi
.pio_addr
+
152 self
.t1000
.fake_ssi
.pio_size
- 1),
153 AddrRange(self
.t1000
.hvuart
.pio_addr
,
154 self
.t1000
.hvuart
.pio_addr
+ uart_pio_size
- 1)
157 workload
= SparcFsWorkload()
159 # ROM for OBP/Reset/Hypervisor
160 self
.rom
= SimpleMemory(image_file
=binary('t1000_rom.bin'),
161 range=AddrRange(0xfff0000000, size
='8MB'))
163 self
.nvram
= SimpleMemory(image_file
=binary('nvram1'),
164 range=AddrRange(0x1f11000000, size
='8kB'))
165 # hypervisor description
166 self
.hypervisor_desc
= SimpleMemory(image_file
=binary('1up-hv.bin'),
167 range=AddrRange(0x1f12080000, size
='8kB'))
168 # partition description
169 self
.partition_desc
= SimpleMemory(image_file
=binary('1up-md.bin'),
170 range=AddrRange(0x1f12000000, size
='8kB'))
172 self
.rom
.port
= self
.membus
.master
173 self
.nvram
.port
= self
.membus
.master
174 self
.hypervisor_desc
.port
= self
.membus
.master
175 self
.partition_desc
.port
= self
.membus
.master
177 self
.system_port
= self
.membus
.slave
179 self
.workload
= workload
183 def makeArmSystem(mem_mode
, machine_type
, num_cpus
=1, mdesc
=None,
184 dtb_filename
=None, bare_metal
=False, cmdline
=None,
185 external_memory
="", ruby
=False, security
=False,
186 vio_9p
=None, bootloader
=None):
197 self
.readfile
= mdesc
.script()
198 self
.iobus
= IOXBar()
200 self
.bridge
= Bridge(delay
='50ns')
201 self
.bridge
.master
= self
.iobus
.slave
202 self
.membus
= MemBus()
203 self
.membus
.badaddr_responder
.warn_access
= "warn"
204 self
.bridge
.slave
= self
.membus
.master
206 self
.mem_mode
= mem_mode
208 platform_class
= ObjectList
.platform_list
.get(machine_type
)
209 # Resolve the real platform name, the original machine_type
210 # variable might have been an alias.
211 machine_type
= platform_class
.__name
__
212 self
.realview
= platform_class()
213 self
._bootmem
= self
.realview
.bootmem
215 # Attach any PCI devices this platform supports
216 self
.realview
.attachPciDevices()
218 disks
= makeCowDisks(mdesc
.disks())
219 # Old platforms have a built-in IDE or CF controller. Default to
220 # the IDE controller if both exist. New platforms expect the
221 # storage controller to be added from the config script.
222 if hasattr(self
.realview
, "ide"):
223 self
.realview
.ide
.disks
= disks
224 elif hasattr(self
.realview
, "cf_ctrl"):
225 self
.realview
.cf_ctrl
.disks
= disks
227 self
.pci_ide
= IdeController(disks
=disks
)
228 pci_devices
.append(self
.pci_ide
)
231 size_remain
= long(Addr(mdesc
.mem()))
232 for region
in self
.realview
._mem
_regions
:
233 if size_remain
> long(region
.size()):
234 self
.mem_ranges
.append(region
)
235 size_remain
= size_remain
- long(region
.size())
237 self
.mem_ranges
.append(AddrRange(region
.start
, size
=size_remain
))
240 warn("Memory size specified spans more than one region. Creating" \
241 " another memory controller for that range.")
244 fatal("The currently selected ARM platforms doesn't support" \
245 " the amount of DRAM you've selected. Please try" \
248 self
.have_security
= security
251 # EOT character on UART will end the simulation
252 self
.realview
.uart
[0].end_on_eot
= True
253 self
.workload
= ArmFsWorkload(atags_addr
=0)
255 workload
= ArmFsLinux()
258 workload
.dtb_filename
= binary(dtb_filename
)
260 workload
.machine_type
= \
261 machine_type
if machine_type
in ArmMachineType
.map else "DTOnly"
263 # Ensure that writes to the UART actually go out early in the boot
265 cmdline
= 'earlyprintk=pl011,0x1c090000 console=ttyAMA0 ' + \
266 'lpj=19988480 norandmaps rw loglevel=8 ' + \
267 'mem=%(mem)s root=%(rootdev)s'
269 if hasattr(self
.realview
.gic
, 'cpu_addr'):
270 self
.gic_cpu_addr
= self
.realview
.gic
.cpu_addr
272 self
.flags_addr
= self
.realview
.realview_io
.pio_addr
+ 0x30
274 # This check is for users who have previously put 'android' in
275 # the disk image filename to tell the config scripts to
276 # prepare the kernel with android-specific boot options. That
277 # behavior has been replaced with a more explicit option per
278 # the error message below. The disk can have any name now and
279 # doesn't need to include 'android' substring.
280 if (mdesc
.disks() and
281 os
.path
.split(mdesc
.disks()[0])[-1].lower().count('android')):
282 if 'android' not in mdesc
.os_type():
283 fatal("It looks like you are trying to boot an Android " \
284 "platform. To boot Android, you must specify " \
285 "--os-type with an appropriate Android release on " \
288 # android-specific tweaks
289 if 'android' in mdesc
.os_type():
291 cmdline
+= " init=/init"
293 # release-specific tweaks
294 if 'kitkat' in mdesc
.os_type():
295 cmdline
+= " androidboot.hardware=gem5 qemu=1 qemu.gles=0 " + \
296 "android.bootanim=0 "
297 elif 'nougat' in mdesc
.os_type():
298 cmdline
+= " androidboot.hardware=gem5 qemu=1 qemu.gles=0 " + \
299 "android.bootanim=0 " + \
301 "android.early.fstab=/fstab.gem5 " + \
302 "androidboot.selinux=permissive " + \
303 "video=Virtual-1:1920x1080-16"
305 workload
.command_line
= fillInCmdline(mdesc
, cmdline
)
307 self
.workload
= workload
309 self
.realview
.setupBootLoader(self
, binary
, bootloader
)
312 # I/O traffic enters iobus
313 self
.external_io
= ExternalMaster(port_data
="external_io",
314 port_type
=external_memory
)
315 self
.external_io
.port
= self
.iobus
.slave
317 # Ensure iocache only receives traffic destined for (actual) memory.
318 self
.iocache
= ExternalSlave(port_data
="iocache",
319 port_type
=external_memory
,
320 addr_ranges
=self
.mem_ranges
)
321 self
.iocache
.port
= self
.iobus
.master
323 # Let system_port get to nvmem and nothing else.
324 self
.bridge
.ranges
= [self
.realview
.nvmem
.range]
326 self
.realview
.attachOnChipIO(self
.iobus
)
327 # Attach off-chip devices
328 self
.realview
.attachIO(self
.iobus
)
330 self
._dma
_ports
= [ ]
331 self
._mem
_ports
= [ ]
332 self
.realview
.attachOnChipIO(self
.iobus
,
333 dma_ports
=self
._dma
_ports
, mem_ports
=self
._mem
_ports
)
334 self
.realview
.attachIO(self
.iobus
, dma_ports
=self
._dma
_ports
)
336 self
.realview
.attachOnChipIO(self
.membus
, self
.bridge
)
337 # Attach off-chip devices
338 self
.realview
.attachIO(self
.iobus
)
340 for dev
in pci_devices
:
341 self
.realview
.attachPciDevice(
343 dma_ports
=self
._dma
_ports
if ruby
else None)
345 self
.intrctrl
= IntrControl()
346 self
.terminal
= Terminal()
347 self
.vncserver
= VncServer()
350 attach_9p(self
.realview
, self
.iobus
)
353 self
.system_port
= self
.membus
.slave
356 if buildEnv
['PROTOCOL'] == 'MI_example' and num_cpus
> 1:
357 fatal("The MI_example protocol cannot implement Load/Store "
358 "Exclusive operations. Multicore ARM systems configured "
359 "with the MI_example protocol will not work properly.")
360 warn("You are trying to use Ruby on ARM, which is not working "
366 def makeLinuxMipsSystem(mem_mode
, mdesc
=None, cmdline
=None):
367 class BaseMalta(Malta
):
368 ethernet
= NSGigE(pci_bus
=0, pci_dev
=1, pci_func
=0)
369 ide
= IdeController(disks
=Parent
.disks
,
370 pci_func
=0, pci_dev
=0, pci_bus
=0)
376 self
.readfile
= mdesc
.script()
377 self
.iobus
= IOXBar()
378 self
.membus
= MemBus()
379 self
.bridge
= Bridge(delay
='50ns')
380 self
.mem_ranges
= [AddrRange('1GB')]
381 self
.bridge
.master
= self
.iobus
.slave
382 self
.bridge
.slave
= self
.membus
.master
383 self
.disks
= makeCowDisks(mdesc
.disks())
384 self
.malta
= BaseMalta()
385 self
.malta
.attachIO(self
.iobus
)
386 self
.malta
.ide
.pio
= self
.iobus
.master
387 self
.malta
.ide
.dma
= self
.iobus
.slave
388 self
.malta
.ethernet
.pio
= self
.iobus
.master
389 self
.malta
.ethernet
.dma
= self
.iobus
.slave
390 self
.simple_disk
= SimpleDisk(disk
=RawDiskImage(
391 image_file
= mdesc
.disks()[0], read_only
= True))
392 self
.intrctrl
= IntrControl()
393 self
.mem_mode
= mem_mode
394 self
.terminal
= Terminal()
395 self
.console
= binary('mips/console')
397 cmdline
= 'root=/dev/hda1 console=ttyS0'
398 self
.workload
= KernelWorkload(command_line
=fillInCmdline(mdesc
, cmdline
))
400 self
.system_port
= self
.membus
.slave
404 def x86IOAddress(port
):
405 IO_address_space_base
= 0x8000000000000000
406 return IO_address_space_base
+ port
408 def connectX86ClassicSystem(x86_sys
, numCPUs
):
409 # Constants similar to x86_traits.hh
410 IO_address_space_base
= 0x8000000000000000
411 pci_config_address_space_base
= 0xc000000000000000
412 interrupts_address_space_base
= 0xa000000000000000
413 APIC_range_size
= 1 << 12;
415 x86_sys
.membus
= MemBus()
418 x86_sys
.iobus
= IOXBar()
419 x86_sys
.bridge
= Bridge(delay
='50ns')
420 x86_sys
.bridge
.master
= x86_sys
.iobus
.slave
421 x86_sys
.bridge
.slave
= x86_sys
.membus
.master
422 # Allow the bridge to pass through:
423 # 1) kernel configured PCI device memory map address: address range
424 # [0xC0000000, 0xFFFF0000). (The upper 64kB are reserved for m5ops.)
425 # 2) the bridge to pass through the IO APIC (two pages, already contained in 1),
426 # 3) everything in the IO address range up to the local APIC, and
427 # 4) then the entire PCI address space and beyond.
428 x86_sys
.bridge
.ranges
= \
430 AddrRange(0xC0000000, 0xFFFF0000),
431 AddrRange(IO_address_space_base
,
432 interrupts_address_space_base
- 1),
433 AddrRange(pci_config_address_space_base
,
437 # Create a bridge from the IO bus to the memory bus to allow access to
438 # the local APIC (two pages)
439 x86_sys
.apicbridge
= Bridge(delay
='50ns')
440 x86_sys
.apicbridge
.slave
= x86_sys
.iobus
.master
441 x86_sys
.apicbridge
.master
= x86_sys
.membus
.slave
442 x86_sys
.apicbridge
.ranges
= [AddrRange(interrupts_address_space_base
,
443 interrupts_address_space_base
+
444 numCPUs
* APIC_range_size
448 x86_sys
.pc
.attachIO(x86_sys
.iobus
)
450 x86_sys
.system_port
= x86_sys
.membus
.slave
452 def connectX86RubySystem(x86_sys
):
454 x86_sys
.iobus
= IOXBar()
456 # add the ide to the list of dma devices that later need to attach to
458 x86_sys
._dma
_ports
= [x86_sys
.pc
.south_bridge
.ide
.dma
]
459 x86_sys
.pc
.attachIO(x86_sys
.iobus
, x86_sys
._dma
_ports
)
462 def makeX86System(mem_mode
, numCPUs
=1, mdesc
=None, workload
=None, Ruby
=False):
466 workload
= X86FsWorkload()
467 self
.workload
= workload
472 self
.readfile
= mdesc
.script()
474 self
.mem_mode
= mem_mode
477 # On the PC platform, the memory region 0xC0000000-0xFFFFFFFF is reserved
478 # for various devices. Hence, if the physical memory size is greater than
479 # 3GB, we need to split it into two parts.
481 convert
.toMemorySize(mdesc
.mem()) - convert
.toMemorySize('3GB')
482 if excess_mem_size
<= 0:
483 self
.mem_ranges
= [AddrRange(mdesc
.mem())]
485 warn("Physical memory size specified is %s which is greater than " \
486 "3GB. Twice the number of memory controllers would be " \
487 "created." % (mdesc
.mem()))
489 self
.mem_ranges
= [AddrRange('3GB'),
490 AddrRange(Addr('4GB'), size
= excess_mem_size
)]
495 # Create and connect the busses required by each memory system
497 connectX86RubySystem(self
)
499 connectX86ClassicSystem(self
, numCPUs
)
501 self
.intrctrl
= IntrControl()
504 disks
= makeCowDisks(mdesc
.disks())
505 self
.pc
.south_bridge
.ide
.disks
= disks
507 # Add in a Bios information structure.
508 structures
= [X86SMBiosBiosInformation()]
509 workload
.smbios_table
.structures
= structures
511 # Set up the Intel MP table
514 for i
in range(numCPUs
):
515 bp
= X86IntelMPProcessor(
517 local_apic_version
= 0x14,
519 bootstrap
= (i
== 0))
520 base_entries
.append(bp
)
521 io_apic
= X86IntelMPIOAPIC(
525 address
= 0xfec00000)
526 self
.pc
.south_bridge
.io_apic
.apic_id
= io_apic
.id
527 base_entries
.append(io_apic
)
528 # In gem5 Pc::calcPciConfigAddr(), it required "assert(bus==0)",
529 # but linux kernel cannot config PCI device if it was not connected to
530 # PCI bus, so we fix PCI bus id to 0, and ISA bus id to 1.
531 pci_bus
= X86IntelMPBus(bus_id
= 0, bus_type
='PCI ')
532 base_entries
.append(pci_bus
)
533 isa_bus
= X86IntelMPBus(bus_id
= 1, bus_type
='ISA ')
534 base_entries
.append(isa_bus
)
535 connect_busses
= X86IntelMPBusHierarchy(bus_id
=1,
536 subtractive_decode
=True, parent_bus
=0)
537 ext_entries
.append(connect_busses
)
538 pci_dev4_inta
= X86IntelMPIOIntAssignment(
539 interrupt_type
= 'INT',
540 polarity
= 'ConformPolarity',
541 trigger
= 'ConformTrigger',
543 source_bus_irq
= 0 + (4 << 2),
544 dest_io_apic_id
= io_apic
.id,
545 dest_io_apic_intin
= 16)
546 base_entries
.append(pci_dev4_inta
)
547 def assignISAInt(irq
, apicPin
):
548 assign_8259_to_apic
= X86IntelMPIOIntAssignment(
549 interrupt_type
= 'ExtInt',
550 polarity
= 'ConformPolarity',
551 trigger
= 'ConformTrigger',
553 source_bus_irq
= irq
,
554 dest_io_apic_id
= io_apic
.id,
555 dest_io_apic_intin
= 0)
556 base_entries
.append(assign_8259_to_apic
)
557 assign_to_apic
= X86IntelMPIOIntAssignment(
558 interrupt_type
= 'INT',
559 polarity
= 'ConformPolarity',
560 trigger
= 'ConformTrigger',
562 source_bus_irq
= irq
,
563 dest_io_apic_id
= io_apic
.id,
564 dest_io_apic_intin
= apicPin
)
565 base_entries
.append(assign_to_apic
)
568 for i
in range(3, 15):
570 workload
.intel_mp_table
.base_entries
= base_entries
571 workload
.intel_mp_table
.ext_entries
= ext_entries
575 def makeLinuxX86System(mem_mode
, numCPUs
=1, mdesc
=None, Ruby
=False,
577 # Build up the x86 system and then specialize it for Linux
578 self
= makeX86System(mem_mode
, numCPUs
, mdesc
, X86FsLinux(), Ruby
)
580 # We assume below that there's at least 1MB of memory. We'll require 2
581 # just to avoid corner cases.
582 phys_mem_size
= sum([r
.size() for r
in self
.mem_ranges
])
583 assert(phys_mem_size
>= 0x200000)
584 assert(len(self
.mem_ranges
) <= 2)
588 # Mark the first megabyte of memory as reserved
589 X86E820Entry(addr
= 0, size
= '639kB', range_type
= 1),
590 X86E820Entry(addr
= 0x9fc00, size
= '385kB', range_type
= 2),
591 # Mark the rest of physical memory as available
592 X86E820Entry(addr
= 0x100000,
593 size
= '%dB' % (self
.mem_ranges
[0].size() - 0x100000),
597 # Mark [mem_size, 3GB) as reserved if memory less than 3GB, which force
598 # IO devices to be mapped to [0xC0000000, 0xFFFF0000). Requests to this
599 # specific range can pass though bridge to iobus.
600 if len(self
.mem_ranges
) == 1:
601 entries
.append(X86E820Entry(addr
= self
.mem_ranges
[0].size(),
602 size
='%dB' % (0xC0000000 - self
.mem_ranges
[0].size()),
605 # Reserve the last 16kB of the 32-bit address space for the m5op interface
606 entries
.append(X86E820Entry(addr
=0xFFFF0000, size
='64kB', range_type
=2))
608 # In case the physical memory is greater than 3GB, we split it into two
609 # parts and add a separate e820 entry for the second part. This entry
610 # starts at 0x100000000, which is the first address after the space
611 # reserved for devices.
612 if len(self
.mem_ranges
) == 2:
613 entries
.append(X86E820Entry(addr
= 0x100000000,
614 size
= '%dB' % (self
.mem_ranges
[1].size()), range_type
= 1))
616 self
.workload
.e820_table
.entries
= entries
620 cmdline
= 'earlyprintk=ttyS0 console=ttyS0 lpj=7999923 root=/dev/hda1'
621 self
.workload
.command_line
= fillInCmdline(mdesc
, cmdline
)
624 def makeBareMetalRiscvSystem(mem_mode
, mdesc
=None, cmdline
=None):
629 self
.mem_mode
= mem_mode
630 self
.mem_ranges
= [AddrRange(mdesc
.mem())]
632 self
.workload
= RiscvBareMetal()
634 self
.iobus
= IOXBar()
635 self
.membus
= MemBus()
637 self
.bridge
= Bridge(delay
='50ns')
638 self
.bridge
.master
= self
.iobus
.slave
639 self
.bridge
.slave
= self
.membus
.master
640 # Sv39 has 56 bit physical addresses; use the upper 8 bit for the IO space
641 IO_address_space_base
= 0x00FF000000000000
642 self
.bridge
.ranges
= [AddrRange(IO_address_space_base
, Addr
.max)]
644 self
.system_port
= self
.membus
.slave
647 def makeDualRoot(full_system
, testSystem
, driveSystem
, dumpfile
):
648 self
= Root(full_system
= full_system
)
649 self
.testsys
= testSystem
650 self
.drivesys
= driveSystem
651 self
.etherlink
= EtherLink()
653 if hasattr(testSystem
, 'realview'):
654 self
.etherlink
.int0
= Parent
.testsys
.realview
.ethernet
.interface
655 self
.etherlink
.int1
= Parent
.drivesys
.realview
.ethernet
.interface
656 elif hasattr(testSystem
, 'tsunami'):
657 self
.etherlink
.int0
= Parent
.testsys
.tsunami
.ethernet
.interface
658 self
.etherlink
.int1
= Parent
.drivesys
.tsunami
.ethernet
.interface
660 fatal("Don't know how to connect these system together")
663 self
.etherdump
= EtherDump(file=dumpfile
)
664 self
.etherlink
.dump
= Parent
.etherdump
669 def makeDistRoot(testSystem
,
679 self
= Root(full_system
= True)
680 self
.testsys
= testSystem
682 self
.etherlink
= DistEtherLink(speed
= linkspeed
,
686 server_name
= server_name
,
687 server_port
= server_port
,
688 sync_start
= sync_start
,
689 sync_repeat
= sync_repeat
)
691 if hasattr(testSystem
, 'realview'):
692 self
.etherlink
.int0
= Parent
.testsys
.realview
.ethernet
.interface
693 elif hasattr(testSystem
, 'tsunami'):
694 self
.etherlink
.int0
= Parent
.testsys
.tsunami
.ethernet
.interface
696 fatal("Don't know how to connect DistEtherLink to this system")
699 self
.etherdump
= EtherDump(file=dumpfile
)
700 self
.etherlink
.dump
= Parent
.etherdump