IntelMP.py revision 5838
15625Sgblack@eecs.umich.edu# Copyright (c) 2008 The Hewlett-Packard Development Company
25625Sgblack@eecs.umich.edu# All rights reserved.
35625Sgblack@eecs.umich.edu#
45625Sgblack@eecs.umich.edu# Redistribution and use of this software in source and binary forms,
55625Sgblack@eecs.umich.edu# with or without modification, are permitted provided that the
65625Sgblack@eecs.umich.edu# following conditions are met:
75625Sgblack@eecs.umich.edu#
85625Sgblack@eecs.umich.edu# The software must be used only for Non-Commercial Use which means any
95625Sgblack@eecs.umich.edu# use which is NOT directed to receiving any direct monetary
105625Sgblack@eecs.umich.edu# compensation for, or commercial advantage from such use.  Illustrative
115625Sgblack@eecs.umich.edu# examples of non-commercial use are academic research, personal study,
125625Sgblack@eecs.umich.edu# teaching, education and corporate research & development.
135625Sgblack@eecs.umich.edu# Illustrative examples of commercial use are distributing products for
145625Sgblack@eecs.umich.edu# commercial advantage and providing services using the software for
155625Sgblack@eecs.umich.edu# commercial advantage.
165625Sgblack@eecs.umich.edu#
175625Sgblack@eecs.umich.edu# If you wish to use this software or functionality therein that may be
185625Sgblack@eecs.umich.edu# covered by patents for commercial use, please contact:
195625Sgblack@eecs.umich.edu#     Director of Intellectual Property Licensing
205625Sgblack@eecs.umich.edu#     Office of Strategy and Technology
215625Sgblack@eecs.umich.edu#     Hewlett-Packard Company
225625Sgblack@eecs.umich.edu#     1501 Page Mill Road
235625Sgblack@eecs.umich.edu#     Palo Alto, California  94304
245625Sgblack@eecs.umich.edu#
255625Sgblack@eecs.umich.edu# Redistributions of source code must retain the above copyright notice,
265625Sgblack@eecs.umich.edu# this list of conditions and the following disclaimer.  Redistributions
275625Sgblack@eecs.umich.edu# in binary form must reproduce the above copyright notice, this list of
285625Sgblack@eecs.umich.edu# conditions and the following disclaimer in the documentation and/or
295625Sgblack@eecs.umich.edu# other materials provided with the distribution.  Neither the name of
305625Sgblack@eecs.umich.edu# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
315625Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
325625Sgblack@eecs.umich.edu# this software without specific prior written permission.  No right of
335625Sgblack@eecs.umich.edu# sublicense is granted herewith.  Derivatives of the software and
345625Sgblack@eecs.umich.edu# output created using the software may be prepared, but only for
355625Sgblack@eecs.umich.edu# Non-Commercial Uses.  Derivatives of the software may be shared with
365625Sgblack@eecs.umich.edu# others provided: (i) the others agree to abide by the list of
375625Sgblack@eecs.umich.edu# conditions herein which includes the Non-Commercial Use restrictions;
385625Sgblack@eecs.umich.edu# and (ii) such Derivatives of the software include the above copyright
395625Sgblack@eecs.umich.edu# notice to acknowledge the contribution from this software where
405625Sgblack@eecs.umich.edu# applicable, this list of conditions and the disclaimer below.
415625Sgblack@eecs.umich.edu#
425625Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
435625Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
445625Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
455625Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
465625Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
475625Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
485625Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
495625Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
505625Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
515625Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
525625Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
535625Sgblack@eecs.umich.edu#
545625Sgblack@eecs.umich.edu# Authors: Gabe Black
555625Sgblack@eecs.umich.edu
565625Sgblack@eecs.umich.edufrom m5.params import *
575625Sgblack@eecs.umich.edufrom m5.SimObject import SimObject
585625Sgblack@eecs.umich.edu
595625Sgblack@eecs.umich.educlass X86IntelMPFloatingPointer(SimObject):
605625Sgblack@eecs.umich.edu    type = 'X86IntelMPFloatingPointer'
615625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::FloatingPointer'
625625Sgblack@eecs.umich.edu
635625Sgblack@eecs.umich.edu    # The minor revision of the spec to support. The major version is assumed
645625Sgblack@eecs.umich.edu    # to be 1 in accordance with the spec.
655625Sgblack@eecs.umich.edu    spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
665625Sgblack@eecs.umich.edu    # If no default configuration is used, set this to 0.
675625Sgblack@eecs.umich.edu    default_config = Param.UInt8(0, 'which default configuration to use')
685625Sgblack@eecs.umich.edu    imcr_present = Param.Bool(True,
695625Sgblack@eecs.umich.edu            'whether the IMCR register is present in the APIC')
705625Sgblack@eecs.umich.edu
715625Sgblack@eecs.umich.educlass X86IntelMPConfigTable(SimObject):
725625Sgblack@eecs.umich.edu    type = 'X86IntelMPConfigTable'
735625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::ConfigTable'
745625Sgblack@eecs.umich.edu
755625Sgblack@eecs.umich.edu    spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
765625Sgblack@eecs.umich.edu    oem_id = Param.String("", 'system manufacturer')
775625Sgblack@eecs.umich.edu    product_id = Param.String("", 'product family')
785625Sgblack@eecs.umich.edu    oem_table_addr = Param.UInt32(0,
795625Sgblack@eecs.umich.edu            'pointer to the optional oem configuration table')
805625Sgblack@eecs.umich.edu    oem_table_size = Param.UInt16(0, 'size of the oem configuration table')
815625Sgblack@eecs.umich.edu    local_apic = Param.UInt32(0xFEE00000, 'address of the local APIC')
825625Sgblack@eecs.umich.edu
835625Sgblack@eecs.umich.edu    base_entries = VectorParam.X86IntelMPBaseConfigEntry([],
845625Sgblack@eecs.umich.edu            'base configuration table entries')
855625Sgblack@eecs.umich.edu
865625Sgblack@eecs.umich.edu    ext_entries = VectorParam.X86IntelMPExtConfigEntry([],
875625Sgblack@eecs.umich.edu            'extended configuration table entries')
885625Sgblack@eecs.umich.edu
895770Sgblack@eecs.umich.edu    def add_entry(self, entry):
905770Sgblack@eecs.umich.edu        if isinstance(entry, X86IntelMPBaseConfigEntry):
915770Sgblack@eecs.umich.edu            self.base_entries.append(entry)
925770Sgblack@eecs.umich.edu        elif isinstance(entry, X86IntelMPExtConfigEntry):
935838Sgblack@eecs.umich.edu            self.ext_entries.append(entry)
945770Sgblack@eecs.umich.edu        else:
955770Sgblack@eecs.umich.edu            panic("Don't know what type of Intel MP entry %s is." \
965770Sgblack@eecs.umich.edu                    % entry.__class__.__name__)
975770Sgblack@eecs.umich.edu
985625Sgblack@eecs.umich.educlass X86IntelMPBaseConfigEntry(SimObject):
995625Sgblack@eecs.umich.edu    type = 'X86IntelMPBaseConfigEntry'
1005625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BaseConfigEntry'
1015625Sgblack@eecs.umich.edu    abstract = True
1025625Sgblack@eecs.umich.edu
1035625Sgblack@eecs.umich.educlass X86IntelMPExtConfigEntry(SimObject):
1045625Sgblack@eecs.umich.edu    type = 'X86IntelMPExtConfigEntry'
1055625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::ExtConfigEntry'
1065625Sgblack@eecs.umich.edu    abstract = True
1075625Sgblack@eecs.umich.edu
1085625Sgblack@eecs.umich.educlass X86IntelMPProcessor(X86IntelMPBaseConfigEntry):
1095625Sgblack@eecs.umich.edu    type = 'X86IntelMPProcessor'
1105625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Processor'
1115625Sgblack@eecs.umich.edu
1125625Sgblack@eecs.umich.edu    local_apic_id = Param.UInt8(0, 'local APIC id')
1135625Sgblack@eecs.umich.edu    local_apic_version = Param.UInt8(0,
1145625Sgblack@eecs.umich.edu            'bits 0-7 of the local APIC version register')
1155625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this processor is usable')
1165625Sgblack@eecs.umich.edu    bootstrap = Param.Bool(False, 'if this is the bootstrap processor')
1175625Sgblack@eecs.umich.edu
1185825Sgblack@eecs.umich.edu    stepping = Param.UInt8(0, 'Processor stepping')
1195825Sgblack@eecs.umich.edu    model = Param.UInt8(0, 'Processor model')
1205825Sgblack@eecs.umich.edu    family = Param.UInt8(0, 'Processor family')
1215625Sgblack@eecs.umich.edu
1225625Sgblack@eecs.umich.edu    feature_flags = Param.UInt32(0, 'flags returned by the CPUID instruction')
1235625Sgblack@eecs.umich.edu
1245625Sgblack@eecs.umich.educlass X86IntelMPBus(X86IntelMPBaseConfigEntry):
1255625Sgblack@eecs.umich.edu    type = 'X86IntelMPBus'
1265625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Bus'
1275625Sgblack@eecs.umich.edu
1285625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'bus id assigned by the bios')
1295625Sgblack@eecs.umich.edu    bus_type = Param.String("", 'string that identify the bus type')
1305625Sgblack@eecs.umich.edu    # Legal values for bus_type are:
1315625Sgblack@eecs.umich.edu    #
1325625Sgblack@eecs.umich.edu    # "CBUS", "CBUSII", "EISA", "FUTURE", "INTERN", "ISA", "MBI", "MBII",
1335625Sgblack@eecs.umich.edu    # "MCA", "MPI", "MPSA", "NUBUS", "PCI", "PCMCIA", "TC", "VL", "VME",
1345625Sgblack@eecs.umich.edu    # "XPRESS"
1355625Sgblack@eecs.umich.edu
1365625Sgblack@eecs.umich.educlass X86IntelMPIOAPIC(X86IntelMPBaseConfigEntry):
1375625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOAPIC'
1385625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOAPIC'
1395625Sgblack@eecs.umich.edu
1405625Sgblack@eecs.umich.edu    id = Param.UInt8(0, 'id of this APIC')
1415625Sgblack@eecs.umich.edu    version = Param.UInt8(0, 'bits 0-7 of the version register')
1425625Sgblack@eecs.umich.edu
1435625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this APIC is usable')
1445625Sgblack@eecs.umich.edu
1455625Sgblack@eecs.umich.edu    address = Param.UInt32(0xfec00000, 'address of this APIC')
1465625Sgblack@eecs.umich.edu
1475625Sgblack@eecs.umich.educlass X86IntelMPInterruptType(Enum):
1485625Sgblack@eecs.umich.edu    map = {'INT' : 0,
1495625Sgblack@eecs.umich.edu           'NMI' : 1,
1505625Sgblack@eecs.umich.edu           'SMI' : 2,
1515625Sgblack@eecs.umich.edu           'ExtInt' : 3
1525625Sgblack@eecs.umich.edu    }
1535625Sgblack@eecs.umich.edu
1545625Sgblack@eecs.umich.educlass X86IntelMPPolarity(Enum):
1555625Sgblack@eecs.umich.edu    map = {'ConformPolarity' : 0,
1565625Sgblack@eecs.umich.edu           'ActiveHigh' : 1,
1575625Sgblack@eecs.umich.edu           'ActiveLow' : 3
1585625Sgblack@eecs.umich.edu    }
1595625Sgblack@eecs.umich.edu
1605625Sgblack@eecs.umich.educlass X86IntelMPTriggerMode(Enum):
1615625Sgblack@eecs.umich.edu    map = {'ConformTrigger' : 0,
1625625Sgblack@eecs.umich.edu           'EdgeTrigger' : 1,
1635625Sgblack@eecs.umich.edu           'LevelTrigger' : 3
1645625Sgblack@eecs.umich.edu    }
1655625Sgblack@eecs.umich.edu
1665625Sgblack@eecs.umich.educlass X86IntelMPIOIntAssignment(X86IntelMPBaseConfigEntry):
1675625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOIntAssignment'
1685625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOIntAssignment'
1695625Sgblack@eecs.umich.edu
1705625Sgblack@eecs.umich.edu    interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
1715625Sgblack@eecs.umich.edu
1725625Sgblack@eecs.umich.edu    polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
1735625Sgblack@eecs.umich.edu    trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
1745625Sgblack@eecs.umich.edu
1755625Sgblack@eecs.umich.edu    source_bus_id = Param.UInt8(0,
1765625Sgblack@eecs.umich.edu            'id of the bus from which the interrupt signal comes')
1775625Sgblack@eecs.umich.edu    source_bus_irq = Param.UInt8(0,
1785625Sgblack@eecs.umich.edu            'which interrupt signal from the source bus')
1795625Sgblack@eecs.umich.edu
1805625Sgblack@eecs.umich.edu    dest_io_apic_id = Param.UInt8(0,
1815625Sgblack@eecs.umich.edu            'id of the IO APIC the interrupt is going to')
1825625Sgblack@eecs.umich.edu    dest_io_apic_intin = Param.UInt8(0,
1835625Sgblack@eecs.umich.edu            'the INTIN pin on the IO APIC the interrupt is connected to')
1845625Sgblack@eecs.umich.edu
1855625Sgblack@eecs.umich.educlass X86IntelMPLocalIntAssignment(X86IntelMPBaseConfigEntry):
1865625Sgblack@eecs.umich.edu    type = 'X86IntelMPLocalIntAssignment'
1875625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::LocalIntAssignment'
1885625Sgblack@eecs.umich.edu
1895625Sgblack@eecs.umich.edu    interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
1905625Sgblack@eecs.umich.edu
1915625Sgblack@eecs.umich.edu    polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
1925625Sgblack@eecs.umich.edu    trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
1935625Sgblack@eecs.umich.edu
1945625Sgblack@eecs.umich.edu    source_bus_id = Param.UInt8(0,
1955625Sgblack@eecs.umich.edu            'id of the bus from which the interrupt signal comes')
1965625Sgblack@eecs.umich.edu    source_bus_irq = Param.UInt8(0,
1975625Sgblack@eecs.umich.edu            'which interrupt signal from the source bus')
1985625Sgblack@eecs.umich.edu
1995625Sgblack@eecs.umich.edu    dest_local_apic_id = Param.UInt8(0,
2005625Sgblack@eecs.umich.edu            'id of the local APIC the interrupt is going to')
2015625Sgblack@eecs.umich.edu    dest_local_apic_intin = Param.UInt8(0,
2025625Sgblack@eecs.umich.edu            'the INTIN pin on the local APIC the interrupt is connected to')
2035625Sgblack@eecs.umich.edu
2045625Sgblack@eecs.umich.educlass X86IntelMPAddressType(Enum):
2055625Sgblack@eecs.umich.edu    map = {"IOAddress" : 0,
2065625Sgblack@eecs.umich.edu           "MemoryAddress" : 1,
2075625Sgblack@eecs.umich.edu           "PrefetchAddress" : 2
2085625Sgblack@eecs.umich.edu    }
2095625Sgblack@eecs.umich.edu
2105625Sgblack@eecs.umich.educlass X86IntelMPAddrSpaceMapping(X86IntelMPExtConfigEntry):
2115625Sgblack@eecs.umich.edu    type = 'X86IntelMPAddrSpaceMapping'
2125625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::AddrSpaceMapping'
2135625Sgblack@eecs.umich.edu
2145625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus the address space is mapped to')
2155625Sgblack@eecs.umich.edu    address_type = Param.X86IntelMPAddressType('IOAddress',
2165625Sgblack@eecs.umich.edu            'address type used to access bus')
2175625Sgblack@eecs.umich.edu    address = Param.Addr(0, 'starting address of the mapping')
2185625Sgblack@eecs.umich.edu    length = Param.UInt64(0, 'length of mapping in bytes')
2195625Sgblack@eecs.umich.edu
2205625Sgblack@eecs.umich.educlass X86IntelMPBusHierarchy(X86IntelMPExtConfigEntry):
2215625Sgblack@eecs.umich.edu    type = 'X86IntelMPBusHierarchy'
2225625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BusHierarchy'
2235625Sgblack@eecs.umich.edu
2245625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2255625Sgblack@eecs.umich.edu    subtractive_decode = Param.Bool(False,
2265625Sgblack@eecs.umich.edu            'whether this bus contains all addresses not used by its children')
2275625Sgblack@eecs.umich.edu    parent_bus = Param.UInt8(0, 'bus id of this busses parent')
2285625Sgblack@eecs.umich.edu
2295625Sgblack@eecs.umich.educlass X86IntelMPRangeList(Enum):
2305625Sgblack@eecs.umich.edu    map = {"ISACompatible" : 0,
2315625Sgblack@eecs.umich.edu           "VGACompatible" : 1
2325625Sgblack@eecs.umich.edu    }
2335625Sgblack@eecs.umich.edu
2345625Sgblack@eecs.umich.educlass X86IntelMPCompatAddrSpaceMod(X86IntelMPExtConfigEntry):
2355625Sgblack@eecs.umich.edu    type = 'X86IntelMPCompatAddrSpaceMod'
2365625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::CompatAddrSpaceMod'
2375625Sgblack@eecs.umich.edu
2385625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2395625Sgblack@eecs.umich.edu    add = Param.Bool(False,
2405625Sgblack@eecs.umich.edu            'if the range should be added to the original mapping')
2415625Sgblack@eecs.umich.edu    range_list = Param.X86IntelMPRangeList('ISACompatible',
2425625Sgblack@eecs.umich.edu            'which predefined range of addresses to use')
243