FSConfig.py revision 7586
17586SAli.Saidi@arm.com# Copyright (c) 2010 ARM Limited
27586SAli.Saidi@arm.com# All rights reserved.
37586SAli.Saidi@arm.com#
47586SAli.Saidi@arm.com# The license below extends only to copyright in the software and shall
57586SAli.Saidi@arm.com# not be construed as granting a license to any other intellectual
67586SAli.Saidi@arm.com# property including but not limited to intellectual property relating
77586SAli.Saidi@arm.com# to a hardware implementation of the functionality of the software
87586SAli.Saidi@arm.com# licensed hereunder.  You may use the software subject to the license
97586SAli.Saidi@arm.com# terms below provided that you ensure that this notice is replicated
107586SAli.Saidi@arm.com# unmodified and in its entirety in all distributions of the software,
117586SAli.Saidi@arm.com# modified or unmodified, in source code or in binary form.
127586SAli.Saidi@arm.com#
135323Sgblack@eecs.umich.edu# Copyright (c) 2006-2008 The Regents of The University of Michigan
142934Sktlim@umich.edu# All rights reserved.
152934Sktlim@umich.edu#
162934Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without
172934Sktlim@umich.edu# modification, are permitted provided that the following conditions are
182934Sktlim@umich.edu# met: redistributions of source code must retain the above copyright
192934Sktlim@umich.edu# notice, this list of conditions and the following disclaimer;
202934Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright
212934Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the
222934Sktlim@umich.edu# documentation and/or other materials provided with the distribution;
232934Sktlim@umich.edu# neither the name of the copyright holders nor the names of its
242934Sktlim@umich.edu# contributors may be used to endorse or promote products derived from
252934Sktlim@umich.edu# this software without specific prior written permission.
262934Sktlim@umich.edu#
272934Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
282934Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
292934Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
302934Sktlim@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
312934Sktlim@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
322934Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
332934Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
342934Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
352934Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
362934Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
372934Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
382934Sktlim@umich.edu#
392934Sktlim@umich.edu# Authors: Kevin Lim
402934Sktlim@umich.edu
412934Sktlim@umich.edufrom m5.objects import *
422995Ssaidi@eecs.umich.edufrom Benchmarks import *
432934Sktlim@umich.edu
442934Sktlim@umich.educlass CowIdeDisk(IdeDisk):
452934Sktlim@umich.edu    image = CowDiskImage(child=RawDiskImage(read_only=True),
462934Sktlim@umich.edu                         read_only=False)
472934Sktlim@umich.edu
482934Sktlim@umich.edu    def childImage(self, ci):
492934Sktlim@umich.edu        self.image.child.image_file = ci
502934Sktlim@umich.edu
516122SSteve.Reinhardt@amd.comclass MemBus(Bus):
526122SSteve.Reinhardt@amd.com    badaddr_responder = BadAddr()
536122SSteve.Reinhardt@amd.com    default = Self.badaddr_responder.pio
546122SSteve.Reinhardt@amd.com
556122SSteve.Reinhardt@amd.com
564520Ssaidi@eecs.umich.edudef makeLinuxAlphaSystem(mem_mode, mdesc = None):
574520Ssaidi@eecs.umich.edu    class BaseTsunami(Tsunami):
584982Ssaidi@eecs.umich.edu        ethernet = NSGigE(pci_bus=0, pci_dev=1, pci_func=0)
594520Ssaidi@eecs.umich.edu        ide = IdeController(disks=[Parent.disk0, Parent.disk2],
604520Ssaidi@eecs.umich.edu                            pci_func=0, pci_dev=0, pci_bus=0)
612934Sktlim@umich.edu
622934Sktlim@umich.edu    self = LinuxAlphaSystem()
633005Sstever@eecs.umich.edu    if not mdesc:
643005Sstever@eecs.umich.edu        # generic system
653304Sstever@eecs.umich.edu        mdesc = SysConfig()
662995Ssaidi@eecs.umich.edu    self.readfile = mdesc.script()
672934Sktlim@umich.edu    self.iobus = Bus(bus_id=0)
686122SSteve.Reinhardt@amd.com    self.membus = MemBus(bus_id=1)
694965Ssaidi@eecs.umich.edu    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
705266Sksewell@umich.edu    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
712934Sktlim@umich.edu    self.bridge.side_a = self.iobus.port
722934Sktlim@umich.edu    self.bridge.side_b = self.membus.port
732934Sktlim@umich.edu    self.physmem.port = self.membus.port
742934Sktlim@umich.edu    self.disk0 = CowIdeDisk(driveID='master')
752934Sktlim@umich.edu    self.disk2 = CowIdeDisk(driveID='master')
762995Ssaidi@eecs.umich.edu    self.disk0.childImage(mdesc.disk())
772934Sktlim@umich.edu    self.disk2.childImage(disk('linux-bigswap2.img'))
782934Sktlim@umich.edu    self.tsunami = BaseTsunami()
792934Sktlim@umich.edu    self.tsunami.attachIO(self.iobus)
802934Sktlim@umich.edu    self.tsunami.ide.pio = self.iobus.port
812934Sktlim@umich.edu    self.tsunami.ethernet.pio = self.iobus.port
822995Ssaidi@eecs.umich.edu    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
832934Sktlim@umich.edu                                               read_only = True))
842934Sktlim@umich.edu    self.intrctrl = IntrControl()
852953Sktlim@umich.edu    self.mem_mode = mem_mode
865478Snate@binkert.org    self.terminal = Terminal()
872934Sktlim@umich.edu    self.kernel = binary('vmlinux')
883449Shsul@eecs.umich.edu    self.pal = binary('ts_osfpal')
892934Sktlim@umich.edu    self.console = binary('console')
902934Sktlim@umich.edu    self.boot_osflags = 'root=/dev/hda1 console=ttyS0'
912934Sktlim@umich.edu
922934Sktlim@umich.edu    return self
932934Sktlim@umich.edu
947014SBrad.Beckmann@amd.comdef makeLinuxAlphaRubySystem(mem_mode, mdesc = None):
956765SBrad.Beckmann@amd.com    class BaseTsunami(Tsunami):
966765SBrad.Beckmann@amd.com        ethernet = NSGigE(pci_bus=0, pci_dev=1, pci_func=0)
976765SBrad.Beckmann@amd.com        ide = IdeController(disks=[Parent.disk0, Parent.disk2],
986765SBrad.Beckmann@amd.com                            pci_func=0, pci_dev=0, pci_bus=0)
996765SBrad.Beckmann@amd.com
1007014SBrad.Beckmann@amd.com    physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
1017014SBrad.Beckmann@amd.com    self = LinuxAlphaSystem(physmem = physmem)
1026765SBrad.Beckmann@amd.com    if not mdesc:
1036765SBrad.Beckmann@amd.com        # generic system
1046765SBrad.Beckmann@amd.com        mdesc = SysConfig()
1056765SBrad.Beckmann@amd.com    self.readfile = mdesc.script()
1066765SBrad.Beckmann@amd.com
1076765SBrad.Beckmann@amd.com    # Create pio bus to connect all device pio ports to rubymem's pio port
1086765SBrad.Beckmann@amd.com    self.piobus = Bus(bus_id=0)
1096893SBrad.Beckmann@amd.com
1106893SBrad.Beckmann@amd.com    #
1116893SBrad.Beckmann@amd.com    # Pio functional accesses from devices need direct access to memory
1126893SBrad.Beckmann@amd.com    # RubyPort currently does support functional accesses.  Therefore provide
1136893SBrad.Beckmann@amd.com    # the piobus a direct connection to physical memory
1146893SBrad.Beckmann@amd.com    #
1157014SBrad.Beckmann@amd.com    self.piobus.port = physmem.port
1166893SBrad.Beckmann@amd.com
1176765SBrad.Beckmann@amd.com    self.disk0 = CowIdeDisk(driveID='master')
1186765SBrad.Beckmann@amd.com    self.disk2 = CowIdeDisk(driveID='master')
1196765SBrad.Beckmann@amd.com    self.disk0.childImage(mdesc.disk())
1206765SBrad.Beckmann@amd.com    self.disk2.childImage(disk('linux-bigswap2.img'))
1216765SBrad.Beckmann@amd.com    self.tsunami = BaseTsunami()
1226765SBrad.Beckmann@amd.com    self.tsunami.attachIO(self.piobus)
1236765SBrad.Beckmann@amd.com    self.tsunami.ide.pio = self.piobus.port
1246765SBrad.Beckmann@amd.com    self.tsunami.ethernet.pio = self.piobus.port
1256765SBrad.Beckmann@amd.com
1266893SBrad.Beckmann@amd.com    #
1276893SBrad.Beckmann@amd.com    # store the dma devices for later connection to dma ruby ports
1286893SBrad.Beckmann@amd.com    #
1296893SBrad.Beckmann@amd.com    self.dma_devices = [self.tsunami.ide, self.tsunami.ethernet]
1306765SBrad.Beckmann@amd.com
1316765SBrad.Beckmann@amd.com    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
1326765SBrad.Beckmann@amd.com                                               read_only = True))
1336765SBrad.Beckmann@amd.com    self.intrctrl = IntrControl()
1346765SBrad.Beckmann@amd.com    self.mem_mode = mem_mode
1356765SBrad.Beckmann@amd.com    self.terminal = Terminal()
1366765SBrad.Beckmann@amd.com    self.kernel = binary('vmlinux')
1376765SBrad.Beckmann@amd.com    self.pal = binary('ts_osfpal')
1386765SBrad.Beckmann@amd.com    self.console = binary('console')
1396765SBrad.Beckmann@amd.com    self.boot_osflags = 'root=/dev/hda1 console=ttyS0'
1406765SBrad.Beckmann@amd.com
1416765SBrad.Beckmann@amd.com    return self
1426765SBrad.Beckmann@amd.com
1433584Ssaidi@eecs.umich.edudef makeSparcSystem(mem_mode, mdesc = None):
1444486Sbinkertn@umich.edu    class CowMmDisk(MmDisk):
1454486Sbinkertn@umich.edu        image = CowDiskImage(child=RawDiskImage(read_only=True),
1464486Sbinkertn@umich.edu                             read_only=False)
1474486Sbinkertn@umich.edu
1484486Sbinkertn@umich.edu        def childImage(self, ci):
1494486Sbinkertn@umich.edu            self.image.child.image_file = ci
1504486Sbinkertn@umich.edu
1513584Ssaidi@eecs.umich.edu    self = SparcSystem()
1523584Ssaidi@eecs.umich.edu    if not mdesc:
1533584Ssaidi@eecs.umich.edu        # generic system
1543584Ssaidi@eecs.umich.edu        mdesc = SysConfig()
1553584Ssaidi@eecs.umich.edu    self.readfile = mdesc.script()
1563743Sgblack@eecs.umich.edu    self.iobus = Bus(bus_id=0)
1576122SSteve.Reinhardt@amd.com    self.membus = MemBus(bus_id=1)
1584972Ssaidi@eecs.umich.edu    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
1593743Sgblack@eecs.umich.edu    self.t1000 = T1000()
1604104Ssaidi@eecs.umich.edu    self.t1000.attachOnChipIO(self.membus)
1613743Sgblack@eecs.umich.edu    self.t1000.attachIO(self.iobus)
1623823Ssaidi@eecs.umich.edu    self.physmem = PhysicalMemory(range = AddrRange(Addr('1MB'), size = '64MB'), zero = True)
1633814Ssaidi@eecs.umich.edu    self.physmem2 = PhysicalMemory(range = AddrRange(Addr('2GB'), size ='256MB'), zero = True)
1643743Sgblack@eecs.umich.edu    self.bridge.side_a = self.iobus.port
1653743Sgblack@eecs.umich.edu    self.bridge.side_b = self.membus.port
1663584Ssaidi@eecs.umich.edu    self.physmem.port = self.membus.port
1673814Ssaidi@eecs.umich.edu    self.physmem2.port = self.membus.port
1683584Ssaidi@eecs.umich.edu    self.rom.port = self.membus.port
1693745Sgblack@eecs.umich.edu    self.nvram.port = self.membus.port
1703745Sgblack@eecs.umich.edu    self.hypervisor_desc.port = self.membus.port
1713745Sgblack@eecs.umich.edu    self.partition_desc.port = self.membus.port
1723584Ssaidi@eecs.umich.edu    self.intrctrl = IntrControl()
1733898Ssaidi@eecs.umich.edu    self.disk0 = CowMmDisk()
1743898Ssaidi@eecs.umich.edu    self.disk0.childImage(disk('disk.s10hw2'))
1753898Ssaidi@eecs.umich.edu    self.disk0.pio = self.iobus.port
1764103Ssaidi@eecs.umich.edu    self.reset_bin = binary('reset_new.bin')
1774103Ssaidi@eecs.umich.edu    self.hypervisor_bin = binary('q_new.bin')
1784103Ssaidi@eecs.umich.edu    self.openboot_bin = binary('openboot_new.bin')
1793745Sgblack@eecs.umich.edu    self.nvram_bin = binary('nvram1')
1803745Sgblack@eecs.umich.edu    self.hypervisor_desc_bin = binary('1up-hv.bin')
1813745Sgblack@eecs.umich.edu    self.partition_desc_bin = binary('1up-md.bin')
1823584Ssaidi@eecs.umich.edu
1833584Ssaidi@eecs.umich.edu    return self
1843584Ssaidi@eecs.umich.edu
1857586SAli.Saidi@arm.comdef makeLinuxArmSystem(mem_mode, mdesc = None, bare_metal=False,
1867586SAli.Saidi@arm.com        machine_type = None):
1877586SAli.Saidi@arm.com    if bare_metal:
1887586SAli.Saidi@arm.com        self = ArmSystem()
1897586SAli.Saidi@arm.com    else:
1907586SAli.Saidi@arm.com        self = LinuxArmSystem()
1917586SAli.Saidi@arm.com
1927586SAli.Saidi@arm.com    if not mdesc:
1937586SAli.Saidi@arm.com        # generic system
1947586SAli.Saidi@arm.com        mdesc = SysConfig()
1957586SAli.Saidi@arm.com
1967586SAli.Saidi@arm.com    self.readfile = mdesc.script()
1977586SAli.Saidi@arm.com    self.iobus = Bus(bus_id=0)
1987586SAli.Saidi@arm.com    self.membus = MemBus(bus_id=1)
1997586SAli.Saidi@arm.com    self.membus.badaddr_responder.warn_access = "warn"
2007586SAli.Saidi@arm.com    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
2017586SAli.Saidi@arm.com    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()), zero = True)
2027586SAli.Saidi@arm.com    self.bridge.side_a = self.iobus.port
2037586SAli.Saidi@arm.com    self.bridge.side_b = self.membus.port
2047586SAli.Saidi@arm.com    self.physmem.port = self.membus.port
2057586SAli.Saidi@arm.com
2067586SAli.Saidi@arm.com    self.mem_mode = mem_mode
2077586SAli.Saidi@arm.com
2087586SAli.Saidi@arm.com    if machine_type == "RealView_PBX":
2097586SAli.Saidi@arm.com        self.realview = RealViewPBX()
2107586SAli.Saidi@arm.com    elif machine_type == "RealView_EB":
2117586SAli.Saidi@arm.com        self.realview = RealViewEB()
2127586SAli.Saidi@arm.com    else:
2137586SAli.Saidi@arm.com        print "Unknown Machine Type"
2147586SAli.Saidi@arm.com        sys.exit(1)
2157586SAli.Saidi@arm.com
2167586SAli.Saidi@arm.com    if not bare_metal and machine_type:
2177586SAli.Saidi@arm.com        self.machine_type = machine_type
2187586SAli.Saidi@arm.com    elif bare_metal:
2197586SAli.Saidi@arm.com        self.realview.uart.end_on_eot = True
2207586SAli.Saidi@arm.com
2217586SAli.Saidi@arm.com    self.realview.attachOnChipIO(self.membus)
2227586SAli.Saidi@arm.com    self.realview.attachIO(self.iobus)
2237586SAli.Saidi@arm.com
2247586SAli.Saidi@arm.com    self.intrctrl = IntrControl()
2257586SAli.Saidi@arm.com    self.terminal = Terminal()
2267586SAli.Saidi@arm.com    self.boot_osflags = 'earlyprintk mem=128MB console=ttyAMA0 lpj=19988480 norandmaps'
2277586SAli.Saidi@arm.com
2287586SAli.Saidi@arm.com    return self
2297586SAli.Saidi@arm.com
2307586SAli.Saidi@arm.com
2315222Sksewell@umich.edudef makeLinuxMipsSystem(mem_mode, mdesc = None):
2325222Sksewell@umich.edu    class BaseMalta(Malta):
2335222Sksewell@umich.edu        ethernet = NSGigE(pci_bus=0, pci_dev=1, pci_func=0)
2345222Sksewell@umich.edu        ide = IdeController(disks=[Parent.disk0, Parent.disk2],
2355222Sksewell@umich.edu                            pci_func=0, pci_dev=0, pci_bus=0)
2365222Sksewell@umich.edu
2375222Sksewell@umich.edu    self = LinuxMipsSystem()
2385222Sksewell@umich.edu    if not mdesc:
2395222Sksewell@umich.edu        # generic system
2405222Sksewell@umich.edu        mdesc = SysConfig()
2415222Sksewell@umich.edu    self.readfile = mdesc.script()
2425222Sksewell@umich.edu    self.iobus = Bus(bus_id=0)
2436122SSteve.Reinhardt@amd.com    self.membus = MemBus(bus_id=1)
2445222Sksewell@umich.edu    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
2455222Sksewell@umich.edu    self.physmem = PhysicalMemory(range = AddrRange('1GB'))
2465222Sksewell@umich.edu    self.bridge.side_a = self.iobus.port
2475222Sksewell@umich.edu    self.bridge.side_b = self.membus.port
2485222Sksewell@umich.edu    self.physmem.port = self.membus.port
2495222Sksewell@umich.edu    self.disk0 = CowIdeDisk(driveID='master')
2505222Sksewell@umich.edu    self.disk2 = CowIdeDisk(driveID='master')
2515222Sksewell@umich.edu    self.disk0.childImage(mdesc.disk())
2525222Sksewell@umich.edu    self.disk2.childImage(disk('linux-bigswap2.img'))
2535222Sksewell@umich.edu    self.malta = BaseMalta()
2545222Sksewell@umich.edu    self.malta.attachIO(self.iobus)
2555222Sksewell@umich.edu    self.malta.ide.pio = self.iobus.port
2565222Sksewell@umich.edu    self.malta.ethernet.pio = self.iobus.port
2575222Sksewell@umich.edu    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
2585222Sksewell@umich.edu                                               read_only = True))
2595222Sksewell@umich.edu    self.intrctrl = IntrControl()
2605222Sksewell@umich.edu    self.mem_mode = mem_mode
2615478Snate@binkert.org    self.terminal = Terminal()
2625222Sksewell@umich.edu    self.kernel = binary('mips/vmlinux')
2635222Sksewell@umich.edu    self.console = binary('mips/console')
2645222Sksewell@umich.edu    self.boot_osflags = 'root=/dev/hda1 console=ttyS0'
2655222Sksewell@umich.edu
2665222Sksewell@umich.edu    return self
2675222Sksewell@umich.edu
2685323Sgblack@eecs.umich.edudef x86IOAddress(port):
2695357Sgblack@eecs.umich.edu    IO_address_space_base = 0x8000000000000000
2705323Sgblack@eecs.umich.edu    return IO_address_space_base + port;
2715323Sgblack@eecs.umich.edu
2726135Sgblack@eecs.umich.edudef makeX86System(mem_mode, numCPUs = 1, mdesc = None, self = None):
2735613Sgblack@eecs.umich.edu    if self == None:
2745613Sgblack@eecs.umich.edu        self = X86System()
2755613Sgblack@eecs.umich.edu
2765133Sgblack@eecs.umich.edu    if not mdesc:
2775133Sgblack@eecs.umich.edu        # generic system
2785133Sgblack@eecs.umich.edu        mdesc = SysConfig()
2795841Sgblack@eecs.umich.edu    mdesc.diskname = 'x86root.img'
2805133Sgblack@eecs.umich.edu    self.readfile = mdesc.script()
2815133Sgblack@eecs.umich.edu
2826802Sgblack@eecs.umich.edu    self.mem_mode = mem_mode
2836802Sgblack@eecs.umich.edu
2845133Sgblack@eecs.umich.edu    # Physical memory
2856122SSteve.Reinhardt@amd.com    self.membus = MemBus(bus_id=1)
2865450Sgblack@eecs.umich.edu    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
2875133Sgblack@eecs.umich.edu    self.physmem.port = self.membus.port
2885133Sgblack@eecs.umich.edu
2895613Sgblack@eecs.umich.edu    # North Bridge
2905613Sgblack@eecs.umich.edu    self.iobus = Bus(bus_id=0)
2915613Sgblack@eecs.umich.edu    self.bridge = Bridge(delay='50ns', nack_delay='4ns')
2925613Sgblack@eecs.umich.edu    self.bridge.side_a = self.iobus.port
2935613Sgblack@eecs.umich.edu    self.bridge.side_b = self.membus.port
2945613Sgblack@eecs.umich.edu
2955613Sgblack@eecs.umich.edu    # Platform
2965638Sgblack@eecs.umich.edu    self.pc = Pc()
2975613Sgblack@eecs.umich.edu    self.pc.attachIO(self.iobus)
2985613Sgblack@eecs.umich.edu
2995613Sgblack@eecs.umich.edu    self.intrctrl = IntrControl()
3005613Sgblack@eecs.umich.edu
3015841Sgblack@eecs.umich.edu    # Disks
3025841Sgblack@eecs.umich.edu    disk0 = CowIdeDisk(driveID='master')
3035841Sgblack@eecs.umich.edu    disk2 = CowIdeDisk(driveID='master')
3045841Sgblack@eecs.umich.edu    disk0.childImage(mdesc.disk())
3055841Sgblack@eecs.umich.edu    disk2.childImage(disk('linux-bigswap2.img'))
3065841Sgblack@eecs.umich.edu    self.pc.south_bridge.ide.disks = [disk0, disk2]
3075841Sgblack@eecs.umich.edu
3085615Sgblack@eecs.umich.edu    # Add in a Bios information structure.
3095615Sgblack@eecs.umich.edu    structures = [X86SMBiosBiosInformation()]
3105615Sgblack@eecs.umich.edu    self.smbios_table.structures = structures
3115615Sgblack@eecs.umich.edu
3125641Sgblack@eecs.umich.edu    # Set up the Intel MP table
3136135Sgblack@eecs.umich.edu    for i in xrange(numCPUs):
3146135Sgblack@eecs.umich.edu        bp = X86IntelMPProcessor(
3156135Sgblack@eecs.umich.edu                local_apic_id = i,
3166135Sgblack@eecs.umich.edu                local_apic_version = 0x14,
3176135Sgblack@eecs.umich.edu                enable = True,
3186135Sgblack@eecs.umich.edu                bootstrap = (i == 0))
3196135Sgblack@eecs.umich.edu        self.intel_mp_table.add_entry(bp)
3205644Sgblack@eecs.umich.edu    io_apic = X86IntelMPIOAPIC(
3216135Sgblack@eecs.umich.edu            id = numCPUs,
3225644Sgblack@eecs.umich.edu            version = 0x11,
3235644Sgblack@eecs.umich.edu            enable = True,
3245644Sgblack@eecs.umich.edu            address = 0xfec00000)
3256135Sgblack@eecs.umich.edu    self.pc.south_bridge.io_apic.apic_id = io_apic.id
3265644Sgblack@eecs.umich.edu    self.intel_mp_table.add_entry(io_apic)
3275644Sgblack@eecs.umich.edu    isa_bus = X86IntelMPBus(bus_id = 0, bus_type='ISA')
3285644Sgblack@eecs.umich.edu    self.intel_mp_table.add_entry(isa_bus)
3295843Sgblack@eecs.umich.edu    pci_bus = X86IntelMPBus(bus_id = 1, bus_type='PCI')
3305843Sgblack@eecs.umich.edu    self.intel_mp_table.add_entry(pci_bus)
3315843Sgblack@eecs.umich.edu    connect_busses = X86IntelMPBusHierarchy(bus_id=0,
3325843Sgblack@eecs.umich.edu            subtractive_decode=True, parent_bus=1)
3335843Sgblack@eecs.umich.edu    self.intel_mp_table.add_entry(connect_busses)
3345843Sgblack@eecs.umich.edu    pci_dev4_inta = X86IntelMPIOIntAssignment(
3355843Sgblack@eecs.umich.edu            interrupt_type = 'INT',
3365843Sgblack@eecs.umich.edu            polarity = 'ConformPolarity',
3375843Sgblack@eecs.umich.edu            trigger = 'ConformTrigger',
3385843Sgblack@eecs.umich.edu            source_bus_id = 1,
3395843Sgblack@eecs.umich.edu            source_bus_irq = 0 + (4 << 2),
3406044Sgblack@eecs.umich.edu            dest_io_apic_id = io_apic.id,
3415843Sgblack@eecs.umich.edu            dest_io_apic_intin = 16)
3426074Sgblack@eecs.umich.edu    self.intel_mp_table.add_entry(pci_dev4_inta);
3436135Sgblack@eecs.umich.edu    def assignISAInt(irq, apicPin):
3446135Sgblack@eecs.umich.edu        assign_8259_to_apic = X86IntelMPIOIntAssignment(
3456135Sgblack@eecs.umich.edu                interrupt_type = 'ExtInt',
3466135Sgblack@eecs.umich.edu                polarity = 'ConformPolarity',
3476135Sgblack@eecs.umich.edu                trigger = 'ConformTrigger',
3486135Sgblack@eecs.umich.edu                source_bus_id = 0,
3496135Sgblack@eecs.umich.edu                source_bus_irq = irq,
3506135Sgblack@eecs.umich.edu                dest_io_apic_id = io_apic.id,
3516135Sgblack@eecs.umich.edu                dest_io_apic_intin = 0)
3526135Sgblack@eecs.umich.edu        self.intel_mp_table.add_entry(assign_8259_to_apic)
3536135Sgblack@eecs.umich.edu        assign_to_apic = X86IntelMPIOIntAssignment(
3546135Sgblack@eecs.umich.edu                interrupt_type = 'INT',
3556135Sgblack@eecs.umich.edu                polarity = 'ConformPolarity',
3566135Sgblack@eecs.umich.edu                trigger = 'ConformTrigger',
3576135Sgblack@eecs.umich.edu                source_bus_id = 0,
3586135Sgblack@eecs.umich.edu                source_bus_irq = irq,
3596135Sgblack@eecs.umich.edu                dest_io_apic_id = io_apic.id,
3606135Sgblack@eecs.umich.edu                dest_io_apic_intin = apicPin)
3616135Sgblack@eecs.umich.edu        self.intel_mp_table.add_entry(assign_to_apic)
3626135Sgblack@eecs.umich.edu    assignISAInt(0, 2)
3636135Sgblack@eecs.umich.edu    assignISAInt(1, 1)
3646135Sgblack@eecs.umich.edu    for i in range(3, 15):
3656135Sgblack@eecs.umich.edu        assignISAInt(i, i)
3665641Sgblack@eecs.umich.edu
3675613Sgblack@eecs.umich.edu
3686135Sgblack@eecs.umich.edudef makeLinuxX86System(mem_mode, numCPUs = 1, mdesc = None):
3695613Sgblack@eecs.umich.edu    self = LinuxX86System()
3705613Sgblack@eecs.umich.edu
3715613Sgblack@eecs.umich.edu    # Build up a generic x86 system and then specialize it for Linux
3726135Sgblack@eecs.umich.edu    makeX86System(mem_mode, numCPUs, mdesc, self)
3735613Sgblack@eecs.umich.edu
3745450Sgblack@eecs.umich.edu    # We assume below that there's at least 1MB of memory. We'll require 2
3755450Sgblack@eecs.umich.edu    # just to avoid corner cases.
3767069Snate@binkert.org    assert(self.physmem.range.second.getValue() >= 0x200000)
3775450Sgblack@eecs.umich.edu
3785450Sgblack@eecs.umich.edu    # Mark the first megabyte of memory as reserved
3795450Sgblack@eecs.umich.edu    self.e820_table.entries.append(X86E820Entry(
3805450Sgblack@eecs.umich.edu                addr = 0,
3815450Sgblack@eecs.umich.edu                size = '1MB',
3825450Sgblack@eecs.umich.edu                range_type = 2))
3835450Sgblack@eecs.umich.edu
3845450Sgblack@eecs.umich.edu    # Mark the rest as available
3855450Sgblack@eecs.umich.edu    self.e820_table.entries.append(X86E820Entry(
3865450Sgblack@eecs.umich.edu                addr = 0x100000,
3876072Sgblack@eecs.umich.edu                size = '%dB' % (self.physmem.range.second - 0x100000 + 1),
3885450Sgblack@eecs.umich.edu                range_type = 1))
3895450Sgblack@eecs.umich.edu
3905330Sgblack@eecs.umich.edu    # Command line
3915847Sgblack@eecs.umich.edu    self.boot_osflags = 'earlyprintk=ttyS0 console=ttyS0 lpj=7999923 ' + \
3925845Sgblack@eecs.umich.edu                        'root=/dev/hda1'
3935133Sgblack@eecs.umich.edu    return self
3945133Sgblack@eecs.umich.edu
3953584Ssaidi@eecs.umich.edu
3963025Ssaidi@eecs.umich.edudef makeDualRoot(testSystem, driveSystem, dumpfile):
3972934Sktlim@umich.edu    self = Root()
3982995Ssaidi@eecs.umich.edu    self.testsys = testSystem
3992995Ssaidi@eecs.umich.edu    self.drivesys = driveSystem
4004981Ssaidi@eecs.umich.edu    self.etherlink = EtherLink()
4014981Ssaidi@eecs.umich.edu    self.etherlink.int0 = Parent.testsys.tsunami.ethernet.interface
4024981Ssaidi@eecs.umich.edu    self.etherlink.int1 = Parent.drivesys.tsunami.ethernet.interface
4034981Ssaidi@eecs.umich.edu
4043025Ssaidi@eecs.umich.edu    if dumpfile:
4053025Ssaidi@eecs.umich.edu        self.etherdump = EtherDump(file=dumpfile)
4063025Ssaidi@eecs.umich.edu        self.etherlink.dump = Parent.etherdump
4072934Sktlim@umich.edu
4082934Sktlim@umich.edu    return self
4095253Sksewell@umich.edu
4105263Sksewell@umich.edudef setMipsOptions(TestCPUClass):
4115253Sksewell@umich.edu        #CP0 Configuration
4125253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_PRId_CompanyOptions = 0
4135253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_PRId_CompanyID = 1
4145253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_PRId_ProcessorID = 147
4155253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_PRId_Revision = 0
4165253Sksewell@umich.edu
4175253Sksewell@umich.edu        #CP0 Interrupt Control
4185253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_IntCtl_IPTI = 7
4195253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_IntCtl_IPPCI = 7
4205253Sksewell@umich.edu
4215253Sksewell@umich.edu        # Config Register
4225253Sksewell@umich.edu        #TestCPUClass.CoreParams.CP0_Config_K23 = 0 # Since TLB
4235253Sksewell@umich.edu        #TestCPUClass.CoreParams.CP0_Config_KU = 0 # Since TLB
4245253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config_BE = 0 # Little Endian
4255253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config_AR = 1 # Architecture Revision 2
4265253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config_AT = 0 # MIPS32
4275253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config_MT = 1 # TLB MMU
4285253Sksewell@umich.edu        #TestCPUClass.CoreParams.CP0_Config_K0 = 2 # Uncached
4295253Sksewell@umich.edu
4305253Sksewell@umich.edu        #Config 1 Register
4315253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_M = 1 # Config2 Implemented
4325253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_MMU = 63 # TLB Size
4335253Sksewell@umich.edu        # ***VERY IMPORTANT***
4345253Sksewell@umich.edu        # Remember to modify CP0_Config1 according to cache specs
4355253Sksewell@umich.edu        # Examine file ../common/Cache.py
4365253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_IS = 1 # I-Cache Sets Per Way, 16KB cache, i.e., 1 (128)
4375253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_IL = 5 # I-Cache Line Size, default in Cache.py is 64, i.e 5
4385253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_IA = 1 # I-Cache Associativity, default in Cache.py is 2, i.e, a value of 1
4395253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_DS = 2 # D-Cache Sets Per Way (see below), 32KB cache, i.e., 2
4405253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_DL = 5 # D-Cache Line Size, default is 64, i.e., 5
4415253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_DA = 1 # D-Cache Associativity, default is 2, i.e. 1
4425253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_C2 = 0 # Coprocessor 2 not implemented(?)
4435253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_MD = 0 # MDMX ASE not implemented in Mips32
4445253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_PC = 1 # Performance Counters Implemented
4455253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_WR = 0 # Watch Registers Implemented
4465253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_CA = 0 # Mips16e NOT implemented
4475253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_EP = 0 # EJTag Not Implemented
4485253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config1_FP = 0 # FPU Implemented
4495253Sksewell@umich.edu
4505253Sksewell@umich.edu        #Config 2 Register
4515253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_M = 1 # Config3 Implemented
4525253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_TU = 0 # Tertiary Cache Control
4535253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_TS = 0 # Tertiary Cache Sets Per Way
4545253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_TL = 0 # Tertiary Cache Line Size
4555253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_TA = 0 # Tertiary Cache Associativity
4565253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_SU = 0 # Secondary Cache Control
4575253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_SS = 0 # Secondary Cache Sets Per Way
4585253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_SL = 0 # Secondary Cache Line Size
4595253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config2_SA = 0 # Secondary Cache Associativity
4605253Sksewell@umich.edu
4615253Sksewell@umich.edu
4625253Sksewell@umich.edu        #Config 3 Register
4635253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_M = 0 # Config4 Not Implemented
4645253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_DSPP = 1 # DSP ASE Present
4655253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_LPA = 0 # Large Physical Addresses Not supported in Mips32
4665253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_VEIC = 0 # EIC Supported
4675253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_VInt = 0 # Vectored Interrupts Implemented
4685253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_SP = 0 # Small Pages Supported (PageGrain reg. exists)
4695253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_MT = 0 # MT Not present
4705253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_SM = 0 # SmartMIPS ASE Not implemented
4715253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_Config3_TL = 0 # TraceLogic Not implemented
4725253Sksewell@umich.edu
4735253Sksewell@umich.edu        #SRS Ctl - HSS
4745253Sksewell@umich.edu        TestCPUClass.CoreParams.CP0_SrsCtl_HSS = 3 # Four shadow register sets implemented
4755253Sksewell@umich.edu
4765253Sksewell@umich.edu
4775253Sksewell@umich.edu        #TestCPUClass.CoreParams.tlb = TLB()
4785253Sksewell@umich.edu        #TestCPUClass.CoreParams.UnifiedTLB = 1
479