FSConfig.py revision 3005:ceb86e85d62d
1# Copyright (c) 2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution;
11# neither the name of the copyright holders nor the names of its
12# contributors may be used to endorse or promote products derived from
13# this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Kevin Lim
28
29import m5
30from m5 import makeList
31from m5.objects import *
32from Benchmarks import *
33from FullO3Config import *
34
35class CowIdeDisk(IdeDisk):
36    image = CowDiskImage(child=RawDiskImage(read_only=True),
37                         read_only=False)
38
39    def childImage(self, ci):
40        self.image.child.image_file = ci
41
42class BaseTsunami(Tsunami):
43    ethernet = NSGigE(configdata=NSGigEPciData(),
44                      pci_bus=0, pci_dev=1, pci_func=0)
45    etherint = NSGigEInt(device=Parent.ethernet)
46    ide = IdeController(disks=[Parent.disk0, Parent.disk2],
47                        pci_func=0, pci_dev=0, pci_bus=0)
48
49def makeLinuxAlphaSystem(mem_mode, mdesc = None):
50    self = LinuxAlphaSystem()
51    if not mdesc:
52        # generic system
53        mdesc = Machine()
54    self.readfile = mdesc.script()
55    self.iobus = Bus(bus_id=0)
56    self.membus = Bus(bus_id=1)
57    self.bridge = Bridge()
58    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
59    self.bridge.side_a = self.iobus.port
60    self.bridge.side_b = self.membus.port
61    self.physmem.port = self.membus.port
62    self.disk0 = CowIdeDisk(driveID='master')
63    self.disk2 = CowIdeDisk(driveID='master')
64    self.disk0.childImage(mdesc.disk())
65    self.disk2.childImage(disk('linux-bigswap2.img'))
66    self.tsunami = BaseTsunami()
67    self.tsunami.attachIO(self.iobus)
68    self.tsunami.ide.pio = self.iobus.port
69    self.tsunami.ide.dma = self.iobus.port
70    self.tsunami.ide.config = self.iobus.port
71    self.tsunami.ethernet.pio = self.iobus.port
72    self.tsunami.ethernet.dma = self.iobus.port
73    self.tsunami.ethernet.config = self.iobus.port
74    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
75                                               read_only = True))
76    self.intrctrl = IntrControl()
77    self.mem_mode = mem_mode
78    self.sim_console = SimConsole(listener=ConsoleListener(port=3456))
79    self.kernel = binary('vmlinux')
80    self.pal = binary('ts_osfpal')
81    self.console = binary('console')
82    self.boot_osflags = 'root=/dev/hda1 console=ttyS0'
83
84    return self
85
86def makeDualRoot(testSystem, driveSystem):
87    self = Root()
88    self.testsys = testSystem
89    self.drivesys = driveSystem
90
91    self.etherdump = EtherDump(file='ethertrace')
92    self.etherlink = EtherLink(int1 = Parent.testsys.tsunami.etherint[0],
93                               int2 = Parent.drivesys.tsunami.etherint[0],
94                               dump = Parent.etherdump)
95    self.clock = '1THz'
96    return self
97