ArmSystem.py revision 11538
111234Sandreas.sandberg@arm.com# Copyright (c) 2009, 2012-2013, 2015 ARM Limited
26757SAli.Saidi@ARM.com# All rights reserved.
36757SAli.Saidi@ARM.com#
47585SAli.Saidi@arm.com# The license below extends only to copyright in the software and shall
57585SAli.Saidi@arm.com# not be construed as granting a license to any other intellectual
67585SAli.Saidi@arm.com# property including but not limited to intellectual property relating
77585SAli.Saidi@arm.com# to a hardware implementation of the functionality of the software
87585SAli.Saidi@arm.com# licensed hereunder.  You may use the software subject to the license
97585SAli.Saidi@arm.com# terms below provided that you ensure that this notice is replicated
107585SAli.Saidi@arm.com# unmodified and in its entirety in all distributions of the software,
117585SAli.Saidi@arm.com# modified or unmodified, in source code or in binary form.
127585SAli.Saidi@arm.com#
136757SAli.Saidi@ARM.com# Redistribution and use in source and binary forms, with or without
146757SAli.Saidi@ARM.com# modification, are permitted provided that the following conditions are
156757SAli.Saidi@ARM.com# met: redistributions of source code must retain the above copyright
166757SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer;
176757SAli.Saidi@ARM.com# redistributions in binary form must reproduce the above copyright
186757SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer in the
196757SAli.Saidi@ARM.com# documentation and/or other materials provided with the distribution;
206757SAli.Saidi@ARM.com# neither the name of the copyright holders nor the names of its
216757SAli.Saidi@ARM.com# contributors may be used to endorse or promote products derived from
226757SAli.Saidi@ARM.com# this software without specific prior written permission.
236757SAli.Saidi@ARM.com#
246757SAli.Saidi@ARM.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
256757SAli.Saidi@ARM.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
266757SAli.Saidi@ARM.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
276757SAli.Saidi@ARM.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
286757SAli.Saidi@ARM.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
296757SAli.Saidi@ARM.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
306757SAli.Saidi@ARM.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
316757SAli.Saidi@ARM.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
326757SAli.Saidi@ARM.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
336757SAli.Saidi@ARM.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
346757SAli.Saidi@ARM.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
356757SAli.Saidi@ARM.com#
366757SAli.Saidi@ARM.com# Authors: Ali Saidi
376757SAli.Saidi@ARM.com
386757SAli.Saidi@ARM.comfrom m5.params import *
396757SAli.Saidi@ARM.com
406757SAli.Saidi@ARM.comfrom System import System
416757SAli.Saidi@ARM.com
427585SAli.Saidi@arm.comclass ArmMachineType(Enum):
4311238Sandreas.sandberg@arm.com    map = {
4411238Sandreas.sandberg@arm.com        'RealViewEB' : 827,
4511238Sandreas.sandberg@arm.com        'RealViewPBX' : 1901,
4611238Sandreas.sandberg@arm.com        'VExpress_EMM' : 2272,
4711238Sandreas.sandberg@arm.com        'VExpress_EMM64' : 2272,
4811238Sandreas.sandberg@arm.com        'DTOnly' : -1,
4911238Sandreas.sandberg@arm.com    }
507585SAli.Saidi@arm.com
516757SAli.Saidi@ARM.comclass ArmSystem(System):
526757SAli.Saidi@ARM.com    type = 'ArmSystem'
539338SAndreas.Sandberg@arm.com    cxx_header = "arch/arm/system.hh"
547580SAli.Saidi@arm.com    load_addr_mask = 0xffffffff
559050Schander.sudanthi@arm.com    multi_proc = Param.Bool(True, "Multiprocessor system?")
5611234Sandreas.sandberg@arm.com    boot_loader = VectorParam.String([],
5711234Sandreas.sandberg@arm.com        "File that contains the boot loader code. Zero or more files may be "
5811234Sandreas.sandberg@arm.com        "specified. The first boot loader that matches the kernel's "
5911234Sandreas.sandberg@arm.com        "architecture will be used.")
608286SAli.Saidi@ARM.com    gic_cpu_addr = Param.Addr(0, "Addres of the GIC CPU interface")
618286SAli.Saidi@ARM.com    flags_addr = Param.Addr(0, "Address of the flags register for MP booting")
6210037SARM gem5 Developers    have_security = Param.Bool(False,
6310037SARM gem5 Developers        "True if Security Extensions are implemented")
6410037SARM gem5 Developers    have_virtualization = Param.Bool(False,
6510037SARM gem5 Developers        "True if Virtualization Extensions are implemented")
6611506Sandreas.sandberg@arm.com    have_lpae = Param.Bool(True, "True if LPAE is implemented")
6710037SARM gem5 Developers    highest_el_is_64 = Param.Bool(False,
6810037SARM gem5 Developers        "True if the register width of the highest implemented exception level "
6910037SARM gem5 Developers        "is 64 bits (ARMv8)")
7010317Smitch.hayenga@arm.com    reset_addr_64 = Param.Addr(0x0,
7110037SARM gem5 Developers        "Reset address if the highest implemented exception level is 64 bits "
7210037SARM gem5 Developers        "(ARMv8)")
7310037SARM gem5 Developers    phys_addr_range_64 = Param.UInt8(40,
7410037SARM gem5 Developers        "Supported physical address range in bits when using AArch64 (ARMv8)")
7510037SARM gem5 Developers    have_large_asid_64 = Param.Bool(False,
7610037SARM gem5 Developers        "True if ASID is 16 bits in AArch64 (ARMv8)")
776757SAli.Saidi@ARM.com
7810810Sbr@bsdpad.comclass GenericArmSystem(ArmSystem):
7910810Sbr@bsdpad.com    type = 'GenericArmSystem'
8010810Sbr@bsdpad.com    cxx_header = "arch/arm/system.hh"
817585SAli.Saidi@arm.com    load_addr_mask = 0x0fffffff
8210512SAli.Saidi@ARM.com    machine_type = Param.ArmMachineType('VExpress_EMM',
837585SAli.Saidi@arm.com        "Machine id from http://www.arm.linux.org.uk/developer/machines/")
8410037SARM gem5 Developers    atags_addr = Param.Addr("Address where default atags structure should " \
8510037SARM gem5 Developers                                "be written")
869261Sdam.sunwoo@arm.com    dtb_filename = Param.String("",
879261Sdam.sunwoo@arm.com        "File that contains the Device Tree Blob. Don't use DTB if empty.")
889261Sdam.sunwoo@arm.com    early_kernel_symbols = Param.Bool(False,
899261Sdam.sunwoo@arm.com        "enable early kernel symbol tables before MMU")
909332Sdam.sunwoo@arm.com    enable_context_switch_stats_dump = Param.Bool(False, "enable stats/task info dumping at context switch boundaries")
919649SAndreas.Sandberg@ARM.com
929649SAndreas.Sandberg@ARM.com    panic_on_panic = Param.Bool(False, "Trigger a gem5 panic if the " \
939649SAndreas.Sandberg@ARM.com                                    "guest kernel panics")
949649SAndreas.Sandberg@ARM.com    panic_on_oops = Param.Bool(False, "Trigger a gem5 panic if the " \
959649SAndreas.Sandberg@ARM.com                                   "guest kernel oopses")
9610810Sbr@bsdpad.com
9710810Sbr@bsdpad.comclass LinuxArmSystem(GenericArmSystem):
9810810Sbr@bsdpad.com    type = 'LinuxArmSystem'
9910810Sbr@bsdpad.com    cxx_header = "arch/arm/linux/system.hh"
10010810Sbr@bsdpad.com
10111538Sandreas.sandberg@arm.com    @classmethod
10211538Sandreas.sandberg@arm.com    def export_method_cxx_predecls(cls, code):
10311538Sandreas.sandberg@arm.com        code('#include "arch/arm/linux/system.hh"')
10411538Sandreas.sandberg@arm.com
10511538Sandreas.sandberg@arm.com    @classmethod
10611538Sandreas.sandberg@arm.com    def export_methods(cls, code):
10711538Sandreas.sandberg@arm.com        code('''void dumpDmesg();''')
10811538Sandreas.sandberg@arm.com
10910810Sbr@bsdpad.comclass FreebsdArmSystem(GenericArmSystem):
11010810Sbr@bsdpad.com    type = 'FreebsdArmSystem'
11110810Sbr@bsdpad.com    cxx_header = "arch/arm/freebsd/system.hh"
112