FSConfig.py revision 10735:071996521ce6
1# Copyright (c) 2010-2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder.  You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated
10# unmodified and in its entirety in all distributions of the software,
11# modified or unmodified, in source code or in binary form.
12#
13# Copyright (c) 2010-2011 Advanced Micro Devices, Inc.
14# Copyright (c) 2006-2008 The Regents of The University of Michigan
15# All rights reserved.
16#
17# Redistribution and use in source and binary forms, with or without
18# modification, are permitted provided that the following conditions are
19# met: redistributions of source code must retain the above copyright
20# notice, this list of conditions and the following disclaimer;
21# redistributions in binary form must reproduce the above copyright
22# notice, this list of conditions and the following disclaimer in the
23# documentation and/or other materials provided with the distribution;
24# neither the name of the copyright holders nor the names of its
25# contributors may be used to endorse or promote products derived from
26# this software without specific prior written permission.
27#
28# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39#
40# Authors: Kevin Lim
41
42from m5.objects import *
43from Benchmarks import *
44from m5.util import *
45
46class CowIdeDisk(IdeDisk):
47    image = CowDiskImage(child=RawDiskImage(read_only=True),
48                         read_only=False)
49
50    def childImage(self, ci):
51        self.image.child.image_file = ci
52
53class MemBus(SystemXBar):
54    badaddr_responder = BadAddr()
55    default = Self.badaddr_responder.pio
56
57
58def fillInCmdline(mdesc, template, **kwargs):
59    kwargs.setdefault('disk', mdesc.disk())
60    kwargs.setdefault('rootdev', mdesc.rootdev())
61    kwargs.setdefault('mem', mdesc.mem())
62    kwargs.setdefault('script', mdesc.script())
63    return template % kwargs
64
65def makeLinuxAlphaSystem(mem_mode, mdesc=None, ruby=False, cmdline=None):
66
67    class BaseTsunami(Tsunami):
68        ethernet = NSGigE(pci_bus=0, pci_dev=1, pci_func=0)
69        ide = IdeController(disks=[Parent.disk0, Parent.disk2],
70                            pci_func=0, pci_dev=0, pci_bus=0)
71
72    self = LinuxAlphaSystem()
73    if not mdesc:
74        # generic system
75        mdesc = SysConfig()
76    self.readfile = mdesc.script()
77
78    self.tsunami = BaseTsunami()
79
80    # Create the io bus to connect all device ports
81    self.iobus = IOXBar()
82    self.tsunami.attachIO(self.iobus)
83
84    self.tsunami.ide.pio = self.iobus.master
85    self.tsunami.ide.config = self.iobus.master
86
87    self.tsunami.ethernet.pio = self.iobus.master
88    self.tsunami.ethernet.config = self.iobus.master
89
90    if ruby:
91        # Store the dma devices for later connection to dma ruby ports.
92        # Append an underscore to dma_ports to avoid the SimObjectVector check.
93        self._dma_ports = [self.tsunami.ide.dma, self.tsunami.ethernet.dma]
94    else:
95        self.membus = MemBus()
96
97        # By default the bridge responds to all addresses above the I/O
98        # base address (including the PCI config space)
99        IO_address_space_base = 0x80000000000
100        self.bridge = Bridge(delay='50ns',
101                         ranges = [AddrRange(IO_address_space_base, Addr.max)])
102        self.bridge.master = self.iobus.slave
103        self.bridge.slave = self.membus.master
104
105        self.tsunami.ide.dma = self.iobus.slave
106        self.tsunami.ethernet.dma = self.iobus.slave
107
108        self.system_port = self.membus.slave
109
110    self.mem_ranges = [AddrRange(mdesc.mem())]
111    self.disk0 = CowIdeDisk(driveID='master')
112    self.disk2 = CowIdeDisk(driveID='master')
113    self.disk0.childImage(mdesc.disk())
114    self.disk2.childImage(disk('linux-bigswap2.img'))
115    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
116                                               read_only = True))
117    self.intrctrl = IntrControl()
118    self.mem_mode = mem_mode
119    self.terminal = Terminal()
120    self.kernel = binary('vmlinux')
121    self.pal = binary('ts_osfpal')
122    self.console = binary('console')
123    if not cmdline:
124        cmdline = 'root=/dev/hda1 console=ttyS0'
125    self.boot_osflags = fillInCmdline(mdesc, cmdline)
126
127    return self
128
129def makeSparcSystem(mem_mode, mdesc=None):
130    # Constants from iob.cc and uart8250.cc
131    iob_man_addr = 0x9800000000
132    uart_pio_size = 8
133
134    class CowMmDisk(MmDisk):
135        image = CowDiskImage(child=RawDiskImage(read_only=True),
136                             read_only=False)
137
138        def childImage(self, ci):
139            self.image.child.image_file = ci
140
141    self = SparcSystem()
142    if not mdesc:
143        # generic system
144        mdesc = SysConfig()
145    self.readfile = mdesc.script()
146    self.iobus = IOXBar()
147    self.membus = MemBus()
148    self.bridge = Bridge(delay='50ns')
149    self.t1000 = T1000()
150    self.t1000.attachOnChipIO(self.membus)
151    self.t1000.attachIO(self.iobus)
152    self.mem_ranges = [AddrRange(Addr('1MB'), size = '64MB'),
153                       AddrRange(Addr('2GB'), size ='256MB')]
154    self.bridge.master = self.iobus.slave
155    self.bridge.slave = self.membus.master
156    self.rom.port = self.membus.master
157    self.nvram.port = self.membus.master
158    self.hypervisor_desc.port = self.membus.master
159    self.partition_desc.port = self.membus.master
160    self.intrctrl = IntrControl()
161    self.disk0 = CowMmDisk()
162    self.disk0.childImage(disk('disk.s10hw2'))
163    self.disk0.pio = self.iobus.master
164
165    # The puart0 and hvuart are placed on the IO bus, so create ranges
166    # for them. The remaining IO range is rather fragmented, so poke
167    # holes for the iob and partition descriptors etc.
168    self.bridge.ranges = \
169        [
170        AddrRange(self.t1000.puart0.pio_addr,
171                  self.t1000.puart0.pio_addr + uart_pio_size - 1),
172        AddrRange(self.disk0.pio_addr,
173                  self.t1000.fake_jbi.pio_addr +
174                  self.t1000.fake_jbi.pio_size - 1),
175        AddrRange(self.t1000.fake_clk.pio_addr,
176                  iob_man_addr - 1),
177        AddrRange(self.t1000.fake_l2_1.pio_addr,
178                  self.t1000.fake_ssi.pio_addr +
179                  self.t1000.fake_ssi.pio_size - 1),
180        AddrRange(self.t1000.hvuart.pio_addr,
181                  self.t1000.hvuart.pio_addr + uart_pio_size - 1)
182        ]
183    self.reset_bin = binary('reset_new.bin')
184    self.hypervisor_bin = binary('q_new.bin')
185    self.openboot_bin = binary('openboot_new.bin')
186    self.nvram_bin = binary('nvram1')
187    self.hypervisor_desc_bin = binary('1up-hv.bin')
188    self.partition_desc_bin = binary('1up-md.bin')
189
190    self.system_port = self.membus.slave
191
192    return self
193
194def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
195                  dtb_filename=None, bare_metal=False, cmdline=None):
196    assert machine_type
197
198    if bare_metal:
199        self = ArmSystem()
200    else:
201        self = LinuxArmSystem()
202
203    if not mdesc:
204        # generic system
205        mdesc = SysConfig()
206
207    self.readfile = mdesc.script()
208    self.iobus = IOXBar()
209    self.membus = MemBus()
210    self.membus.badaddr_responder.warn_access = "warn"
211    self.bridge = Bridge(delay='50ns')
212    self.bridge.master = self.iobus.slave
213    self.bridge.slave = self.membus.master
214
215    self.mem_mode = mem_mode
216
217    if machine_type == "RealView_PBX":
218        self.realview = RealViewPBX()
219    elif machine_type == "RealView_EB":
220        self.realview = RealViewEB()
221    elif machine_type == "VExpress_EMM":
222        self.realview = VExpress_EMM()
223        if not dtb_filename:
224            dtb_filename = 'vexpress.aarch32.ll_20131205.0-gem5.%dcpu.dtb' % num_cpus
225    elif machine_type == "VExpress_EMM64":
226        self.realview = VExpress_EMM64()
227        if os.path.split(mdesc.disk())[-1] == 'linux-aarch32-ael.img':
228            print "Selected 64-bit ARM architecture, updating default disk image..."
229            mdesc.diskname = 'linaro-minimal-aarch64.img'
230        if not dtb_filename:
231            dtb_filename = 'vexpress.aarch64.20140821.dtb'
232    else:
233        print "Unknown Machine Type"
234        sys.exit(1)
235
236    self.cf0 = CowIdeDisk(driveID='master')
237    self.cf0.childImage(mdesc.disk())
238
239    # Attach any PCI devices this platform supports
240    self.realview.attachPciDevices()
241    # default to an IDE controller rather than a CF one
242    try:
243        self.realview.ide.disks = [self.cf0]
244    except:
245        self.realview.cf_ctrl.disks = [self.cf0]
246
247    self.mem_ranges = []
248    size_remain = long(Addr(mdesc.mem()))
249    for region in self.realview._mem_regions:
250        if size_remain > long(region[1]):
251            self.mem_ranges.append(AddrRange(region[0], size=region[1]))
252            size_remain = size_remain - long(region[1])
253        else:
254            self.mem_ranges.append(AddrRange(region[0], size=size_remain))
255            size_remain = 0
256            break
257        warn("Memory size specified spans more than one region. Creating" \
258             " another memory controller for that range.")
259
260    if size_remain > 0:
261        fatal("The currently selected ARM platforms doesn't support" \
262              " the amount of DRAM you've selected. Please try" \
263              " another platform")
264
265    if bare_metal:
266        # EOT character on UART will end the simulation
267        self.realview.uart.end_on_eot = True
268    else:
269        if machine_type == "VExpress_EMM64":
270            self.kernel = binary('vmlinux.aarch64.20140821')
271        elif machine_type == "VExpress_EMM":
272            self.kernel = binary('vmlinux.aarch32.ll_20131205.0-gem5')
273        else:
274            self.kernel = binary('vmlinux.arm.smp.fb.2.6.38.8')
275
276        if dtb_filename:
277            self.dtb_filename = binary(dtb_filename)
278        self.machine_type = machine_type
279        # Ensure that writes to the UART actually go out early in the boot
280        if not cmdline:
281            cmdline = 'earlyprintk=pl011,0x1c090000 console=ttyAMA0 ' + \
282                      'lpj=19988480 norandmaps rw loglevel=8 ' + \
283                      'mem=%(mem)s root=%(rootdev)s'
284
285        self.realview.setupBootLoader(self.membus, self, binary)
286        self.gic_cpu_addr = self.realview.gic.cpu_addr
287        self.flags_addr = self.realview.realview_io.pio_addr + 0x30
288
289        # Android disk images must have 'android' keyword in the disk name
290        # Look for 'android' in disk name and append /init to boot_osflags
291        if (os.path.split(mdesc.disk())[-1]).lower().count('android'):
292            cmdline += " init=/init "
293        self.boot_osflags = fillInCmdline(mdesc, cmdline)
294    self.realview.attachOnChipIO(self.membus, self.bridge)
295    self.realview.attachIO(self.iobus)
296    self.intrctrl = IntrControl()
297    self.terminal = Terminal()
298    self.vncserver = VncServer()
299
300    self.system_port = self.membus.slave
301
302    return self
303
304
305def makeLinuxMipsSystem(mem_mode, mdesc=None, cmdline=None):
306    class BaseMalta(Malta):
307        ethernet = NSGigE(pci_bus=0, pci_dev=1, pci_func=0)
308        ide = IdeController(disks=[Parent.disk0, Parent.disk2],
309                            pci_func=0, pci_dev=0, pci_bus=0)
310
311    self = LinuxMipsSystem()
312    if not mdesc:
313        # generic system
314        mdesc = SysConfig()
315    self.readfile = mdesc.script()
316    self.iobus = IOXBar()
317    self.membus = MemBus()
318    self.bridge = Bridge(delay='50ns')
319    self.mem_ranges = [AddrRange('1GB')]
320    self.bridge.master = self.iobus.slave
321    self.bridge.slave = self.membus.master
322    self.disk0 = CowIdeDisk(driveID='master')
323    self.disk2 = CowIdeDisk(driveID='master')
324    self.disk0.childImage(mdesc.disk())
325    self.disk2.childImage(disk('linux-bigswap2.img'))
326    self.malta = BaseMalta()
327    self.malta.attachIO(self.iobus)
328    self.malta.ide.pio = self.iobus.master
329    self.malta.ide.config = self.iobus.master
330    self.malta.ide.dma = self.iobus.slave
331    self.malta.ethernet.pio = self.iobus.master
332    self.malta.ethernet.config = self.iobus.master
333    self.malta.ethernet.dma = self.iobus.slave
334    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
335                                               read_only = True))
336    self.intrctrl = IntrControl()
337    self.mem_mode = mem_mode
338    self.terminal = Terminal()
339    self.kernel = binary('mips/vmlinux')
340    self.console = binary('mips/console')
341    if not cmdline:
342        cmdline = 'root=/dev/hda1 console=ttyS0'
343    self.boot_osflags = fillInCmdline(mdesc, cmdline)
344
345    self.system_port = self.membus.slave
346
347    return self
348
349def x86IOAddress(port):
350    IO_address_space_base = 0x8000000000000000
351    return IO_address_space_base + port
352
353def connectX86ClassicSystem(x86_sys, numCPUs):
354    # Constants similar to x86_traits.hh
355    IO_address_space_base = 0x8000000000000000
356    pci_config_address_space_base = 0xc000000000000000
357    interrupts_address_space_base = 0xa000000000000000
358    APIC_range_size = 1 << 12;
359
360    x86_sys.membus = MemBus()
361
362    # North Bridge
363    x86_sys.iobus = IOXBar()
364    x86_sys.bridge = Bridge(delay='50ns')
365    x86_sys.bridge.master = x86_sys.iobus.slave
366    x86_sys.bridge.slave = x86_sys.membus.master
367    # Allow the bridge to pass through:
368    #  1) kernel configured PCI device memory map address: address range
369    #     [0xC0000000, 0xFFFF0000). (The upper 64kB are reserved for m5ops.)
370    #  2) the bridge to pass through the IO APIC (two pages, already contained in 1),
371    #  3) everything in the IO address range up to the local APIC, and
372    #  4) then the entire PCI address space and beyond.
373    x86_sys.bridge.ranges = \
374        [
375        AddrRange(0xC0000000, 0xFFFF0000),
376        AddrRange(IO_address_space_base,
377                  interrupts_address_space_base - 1),
378        AddrRange(pci_config_address_space_base,
379                  Addr.max)
380        ]
381
382    # Create a bridge from the IO bus to the memory bus to allow access to
383    # the local APIC (two pages)
384    x86_sys.apicbridge = Bridge(delay='50ns')
385    x86_sys.apicbridge.slave = x86_sys.iobus.master
386    x86_sys.apicbridge.master = x86_sys.membus.slave
387    x86_sys.apicbridge.ranges = [AddrRange(interrupts_address_space_base,
388                                           interrupts_address_space_base +
389                                           numCPUs * APIC_range_size
390                                           - 1)]
391
392    # connect the io bus
393    x86_sys.pc.attachIO(x86_sys.iobus)
394
395    x86_sys.system_port = x86_sys.membus.slave
396
397def connectX86RubySystem(x86_sys):
398    # North Bridge
399    x86_sys.iobus = IOXBar()
400
401    # add the ide to the list of dma devices that later need to attach to
402    # dma controllers
403    x86_sys._dma_ports = [x86_sys.pc.south_bridge.ide.dma]
404    x86_sys.pc.attachIO(x86_sys.iobus, x86_sys._dma_ports)
405
406
407def makeX86System(mem_mode, numCPUs=1, mdesc=None, self=None, Ruby=False):
408    if self == None:
409        self = X86System()
410
411    if not mdesc:
412        # generic system
413        mdesc = SysConfig()
414    self.readfile = mdesc.script()
415
416    self.mem_mode = mem_mode
417
418    # Physical memory
419    # On the PC platform, the memory region 0xC0000000-0xFFFFFFFF is reserved
420    # for various devices.  Hence, if the physical memory size is greater than
421    # 3GB, we need to split it into two parts.
422    excess_mem_size = \
423        convert.toMemorySize(mdesc.mem()) - convert.toMemorySize('3GB')
424    if excess_mem_size <= 0:
425        self.mem_ranges = [AddrRange(mdesc.mem())]
426    else:
427        warn("Physical memory size specified is %s which is greater than " \
428             "3GB.  Twice the number of memory controllers would be " \
429             "created."  % (mdesc.mem()))
430
431        self.mem_ranges = [AddrRange('3GB'),
432            AddrRange(Addr('4GB'), size = excess_mem_size)]
433
434    # Platform
435    self.pc = Pc()
436
437    # Create and connect the busses required by each memory system
438    if Ruby:
439        connectX86RubySystem(self)
440    else:
441        connectX86ClassicSystem(self, numCPUs)
442
443    self.intrctrl = IntrControl()
444
445    # Disks
446    disk0 = CowIdeDisk(driveID='master')
447    disk2 = CowIdeDisk(driveID='master')
448    disk0.childImage(mdesc.disk())
449    disk2.childImage(disk('linux-bigswap2.img'))
450    self.pc.south_bridge.ide.disks = [disk0, disk2]
451
452    # Add in a Bios information structure.
453    structures = [X86SMBiosBiosInformation()]
454    self.smbios_table.structures = structures
455
456    # Set up the Intel MP table
457    base_entries = []
458    ext_entries = []
459    for i in xrange(numCPUs):
460        bp = X86IntelMPProcessor(
461                local_apic_id = i,
462                local_apic_version = 0x14,
463                enable = True,
464                bootstrap = (i == 0))
465        base_entries.append(bp)
466    io_apic = X86IntelMPIOAPIC(
467            id = numCPUs,
468            version = 0x11,
469            enable = True,
470            address = 0xfec00000)
471    self.pc.south_bridge.io_apic.apic_id = io_apic.id
472    base_entries.append(io_apic)
473    # In gem5 Pc::calcPciConfigAddr(), it required "assert(bus==0)",
474    # but linux kernel cannot config PCI device if it was not connected to PCI bus,
475    # so we fix PCI bus id to 0, and ISA bus id to 1.
476    pci_bus = X86IntelMPBus(bus_id = 0, bus_type='PCI')
477    base_entries.append(pci_bus)
478    isa_bus = X86IntelMPBus(bus_id = 1, bus_type='ISA')
479    base_entries.append(isa_bus)
480    connect_busses = X86IntelMPBusHierarchy(bus_id=1,
481            subtractive_decode=True, parent_bus=0)
482    ext_entries.append(connect_busses)
483    pci_dev4_inta = X86IntelMPIOIntAssignment(
484            interrupt_type = 'INT',
485            polarity = 'ConformPolarity',
486            trigger = 'ConformTrigger',
487            source_bus_id = 0,
488            source_bus_irq = 0 + (4 << 2),
489            dest_io_apic_id = io_apic.id,
490            dest_io_apic_intin = 16)
491    base_entries.append(pci_dev4_inta)
492    def assignISAInt(irq, apicPin):
493        assign_8259_to_apic = X86IntelMPIOIntAssignment(
494                interrupt_type = 'ExtInt',
495                polarity = 'ConformPolarity',
496                trigger = 'ConformTrigger',
497                source_bus_id = 1,
498                source_bus_irq = irq,
499                dest_io_apic_id = io_apic.id,
500                dest_io_apic_intin = 0)
501        base_entries.append(assign_8259_to_apic)
502        assign_to_apic = X86IntelMPIOIntAssignment(
503                interrupt_type = 'INT',
504                polarity = 'ConformPolarity',
505                trigger = 'ConformTrigger',
506                source_bus_id = 1,
507                source_bus_irq = irq,
508                dest_io_apic_id = io_apic.id,
509                dest_io_apic_intin = apicPin)
510        base_entries.append(assign_to_apic)
511    assignISAInt(0, 2)
512    assignISAInt(1, 1)
513    for i in range(3, 15):
514        assignISAInt(i, i)
515    self.intel_mp_table.base_entries = base_entries
516    self.intel_mp_table.ext_entries = ext_entries
517
518def makeLinuxX86System(mem_mode, numCPUs=1, mdesc=None, Ruby=False,
519                       cmdline=None):
520    self = LinuxX86System()
521
522    # Build up the x86 system and then specialize it for Linux
523    makeX86System(mem_mode, numCPUs, mdesc, self, Ruby)
524
525    # We assume below that there's at least 1MB of memory. We'll require 2
526    # just to avoid corner cases.
527    phys_mem_size = sum(map(lambda r: r.size(), self.mem_ranges))
528    assert(phys_mem_size >= 0x200000)
529    assert(len(self.mem_ranges) <= 2)
530
531    entries = \
532       [
533        # Mark the first megabyte of memory as reserved
534        X86E820Entry(addr = 0, size = '639kB', range_type = 1),
535        X86E820Entry(addr = 0x9fc00, size = '385kB', range_type = 2),
536        # Mark the rest of physical memory as available
537        X86E820Entry(addr = 0x100000,
538                size = '%dB' % (self.mem_ranges[0].size() - 0x100000),
539                range_type = 1),
540        ]
541
542    # Mark [mem_size, 3GB) as reserved if memory less than 3GB, which force
543    # IO devices to be mapped to [0xC0000000, 0xFFFF0000). Requests to this
544    # specific range can pass though bridge to iobus.
545    if len(self.mem_ranges) == 1:
546        entries.append(X86E820Entry(addr = self.mem_ranges[0].size(),
547            size='%dB' % (0xC0000000 - self.mem_ranges[0].size()),
548            range_type=2))
549
550    # Reserve the last 16kB of the 32-bit address space for the m5op interface
551    entries.append(X86E820Entry(addr=0xFFFF0000, size='64kB', range_type=2))
552
553    # In case the physical memory is greater than 3GB, we split it into two
554    # parts and add a separate e820 entry for the second part.  This entry
555    # starts at 0x100000000,  which is the first address after the space
556    # reserved for devices.
557    if len(self.mem_ranges) == 2:
558        entries.append(X86E820Entry(addr = 0x100000000,
559            size = '%dB' % (self.mem_ranges[1].size()), range_type = 1))
560
561    self.e820_table.entries = entries
562
563    # Command line
564    if not cmdline:
565        cmdline = 'earlyprintk=ttyS0 console=ttyS0 lpj=7999923 root=/dev/hda1'
566    self.boot_osflags = fillInCmdline(mdesc, cmdline)
567    self.kernel = binary('x86_64-vmlinux-2.6.22.9')
568    return self
569
570
571def makeDualRoot(full_system, testSystem, driveSystem, dumpfile):
572    self = Root(full_system = full_system)
573    self.testsys = testSystem
574    self.drivesys = driveSystem
575    self.etherlink = EtherLink()
576
577    if hasattr(testSystem, 'realview'):
578        self.etherlink.int0 = Parent.testsys.realview.ethernet.interface
579        self.etherlink.int1 = Parent.drivesys.realview.ethernet.interface
580    elif hasattr(testSystem, 'tsunami'):
581        self.etherlink.int0 = Parent.testsys.tsunami.ethernet.interface
582        self.etherlink.int1 = Parent.drivesys.tsunami.ethernet.interface
583    else:
584        fatal("Don't know how to connect these system together")
585
586    if dumpfile:
587        self.etherdump = EtherDump(file=dumpfile)
588        self.etherlink.dump = Parent.etherdump
589
590    return self
591