IntelMP.py revision 5625
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
895625Sgblack@eecs.umich.educlass X86IntelMPBaseConfigEntry(SimObject):
905625Sgblack@eecs.umich.edu    type = 'X86IntelMPBaseConfigEntry'
915625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BaseConfigEntry'
925625Sgblack@eecs.umich.edu    abstract = True
935625Sgblack@eecs.umich.edu
945625Sgblack@eecs.umich.educlass X86IntelMPExtConfigEntry(SimObject):
955625Sgblack@eecs.umich.edu    type = 'X86IntelMPExtConfigEntry'
965625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::ExtConfigEntry'
975625Sgblack@eecs.umich.edu    abstract = True
985625Sgblack@eecs.umich.edu
995625Sgblack@eecs.umich.educlass X86IntelMPProcessor(X86IntelMPBaseConfigEntry):
1005625Sgblack@eecs.umich.edu    type = 'X86IntelMPProcessor'
1015625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Processor'
1025625Sgblack@eecs.umich.edu
1035625Sgblack@eecs.umich.edu    local_apic_id = Param.UInt8(0, 'local APIC id')
1045625Sgblack@eecs.umich.edu    local_apic_version = Param.UInt8(0,
1055625Sgblack@eecs.umich.edu            'bits 0-7 of the local APIC version register')
1065625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this processor is usable')
1075625Sgblack@eecs.umich.edu    bootstrap = Param.Bool(False, 'if this is the bootstrap processor')
1085625Sgblack@eecs.umich.edu
1095625Sgblack@eecs.umich.edu    stepping = Param.UInt8(0)
1105625Sgblack@eecs.umich.edu    model = Param.UInt8(0)
1115625Sgblack@eecs.umich.edu    family = Param.UInt8(0)
1125625Sgblack@eecs.umich.edu
1135625Sgblack@eecs.umich.edu    feature_flags = Param.UInt32(0, 'flags returned by the CPUID instruction')
1145625Sgblack@eecs.umich.edu
1155625Sgblack@eecs.umich.educlass X86IntelMPBus(X86IntelMPBaseConfigEntry):
1165625Sgblack@eecs.umich.edu    type = 'X86IntelMPBus'
1175625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Bus'
1185625Sgblack@eecs.umich.edu
1195625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'bus id assigned by the bios')
1205625Sgblack@eecs.umich.edu    bus_type = Param.String("", 'string that identify the bus type')
1215625Sgblack@eecs.umich.edu    # Legal values for bus_type are:
1225625Sgblack@eecs.umich.edu    #
1235625Sgblack@eecs.umich.edu    # "CBUS", "CBUSII", "EISA", "FUTURE", "INTERN", "ISA", "MBI", "MBII",
1245625Sgblack@eecs.umich.edu    # "MCA", "MPI", "MPSA", "NUBUS", "PCI", "PCMCIA", "TC", "VL", "VME",
1255625Sgblack@eecs.umich.edu    # "XPRESS"
1265625Sgblack@eecs.umich.edu
1275625Sgblack@eecs.umich.educlass X86IntelMPIOAPIC(X86IntelMPBaseConfigEntry):
1285625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOAPIC'
1295625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOAPIC'
1305625Sgblack@eecs.umich.edu
1315625Sgblack@eecs.umich.edu    id = Param.UInt8(0, 'id of this APIC')
1325625Sgblack@eecs.umich.edu    version = Param.UInt8(0, 'bits 0-7 of the version register')
1335625Sgblack@eecs.umich.edu
1345625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this APIC is usable')
1355625Sgblack@eecs.umich.edu
1365625Sgblack@eecs.umich.edu    address = Param.UInt32(0xfec00000, 'address of this APIC')
1375625Sgblack@eecs.umich.edu
1385625Sgblack@eecs.umich.educlass X86IntelMPInterruptType(Enum):
1395625Sgblack@eecs.umich.edu    map = {'INT' : 0,
1405625Sgblack@eecs.umich.edu           'NMI' : 1,
1415625Sgblack@eecs.umich.edu           'SMI' : 2,
1425625Sgblack@eecs.umich.edu           'ExtInt' : 3
1435625Sgblack@eecs.umich.edu    }
1445625Sgblack@eecs.umich.edu
1455625Sgblack@eecs.umich.educlass X86IntelMPPolarity(Enum):
1465625Sgblack@eecs.umich.edu    map = {'ConformPolarity' : 0,
1475625Sgblack@eecs.umich.edu           'ActiveHigh' : 1,
1485625Sgblack@eecs.umich.edu           'ActiveLow' : 3
1495625Sgblack@eecs.umich.edu    }
1505625Sgblack@eecs.umich.edu
1515625Sgblack@eecs.umich.educlass X86IntelMPTriggerMode(Enum):
1525625Sgblack@eecs.umich.edu    map = {'ConformTrigger' : 0,
1535625Sgblack@eecs.umich.edu           'EdgeTrigger' : 1,
1545625Sgblack@eecs.umich.edu           'LevelTrigger' : 3
1555625Sgblack@eecs.umich.edu    }
1565625Sgblack@eecs.umich.edu
1575625Sgblack@eecs.umich.educlass X86IntelMPIOIntAssignment(X86IntelMPBaseConfigEntry):
1585625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOIntAssignment'
1595625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOIntAssignment'
1605625Sgblack@eecs.umich.edu
1615625Sgblack@eecs.umich.edu    interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
1625625Sgblack@eecs.umich.edu
1635625Sgblack@eecs.umich.edu    polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
1645625Sgblack@eecs.umich.edu    trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
1655625Sgblack@eecs.umich.edu
1665625Sgblack@eecs.umich.edu    source_bus_id = Param.UInt8(0,
1675625Sgblack@eecs.umich.edu            'id of the bus from which the interrupt signal comes')
1685625Sgblack@eecs.umich.edu    source_bus_irq = Param.UInt8(0,
1695625Sgblack@eecs.umich.edu            'which interrupt signal from the source bus')
1705625Sgblack@eecs.umich.edu
1715625Sgblack@eecs.umich.edu    dest_io_apic_id = Param.UInt8(0,
1725625Sgblack@eecs.umich.edu            'id of the IO APIC the interrupt is going to')
1735625Sgblack@eecs.umich.edu    dest_io_apic_intin = Param.UInt8(0,
1745625Sgblack@eecs.umich.edu            'the INTIN pin on the IO APIC the interrupt is connected to')
1755625Sgblack@eecs.umich.edu
1765625Sgblack@eecs.umich.educlass X86IntelMPLocalIntAssignment(X86IntelMPBaseConfigEntry):
1775625Sgblack@eecs.umich.edu    type = 'X86IntelMPLocalIntAssignment'
1785625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::LocalIntAssignment'
1795625Sgblack@eecs.umich.edu
1805625Sgblack@eecs.umich.edu    interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
1815625Sgblack@eecs.umich.edu
1825625Sgblack@eecs.umich.edu    polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
1835625Sgblack@eecs.umich.edu    trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
1845625Sgblack@eecs.umich.edu
1855625Sgblack@eecs.umich.edu    source_bus_id = Param.UInt8(0,
1865625Sgblack@eecs.umich.edu            'id of the bus from which the interrupt signal comes')
1875625Sgblack@eecs.umich.edu    source_bus_irq = Param.UInt8(0,
1885625Sgblack@eecs.umich.edu            'which interrupt signal from the source bus')
1895625Sgblack@eecs.umich.edu
1905625Sgblack@eecs.umich.edu    dest_local_apic_id = Param.UInt8(0,
1915625Sgblack@eecs.umich.edu            'id of the local APIC the interrupt is going to')
1925625Sgblack@eecs.umich.edu    dest_local_apic_intin = Param.UInt8(0,
1935625Sgblack@eecs.umich.edu            'the INTIN pin on the local APIC the interrupt is connected to')
1945625Sgblack@eecs.umich.edu
1955625Sgblack@eecs.umich.educlass X86IntelMPAddressType(Enum):
1965625Sgblack@eecs.umich.edu    map = {"IOAddress" : 0,
1975625Sgblack@eecs.umich.edu           "MemoryAddress" : 1,
1985625Sgblack@eecs.umich.edu           "PrefetchAddress" : 2
1995625Sgblack@eecs.umich.edu    }
2005625Sgblack@eecs.umich.edu
2015625Sgblack@eecs.umich.educlass X86IntelMPAddrSpaceMapping(X86IntelMPExtConfigEntry):
2025625Sgblack@eecs.umich.edu    type = 'X86IntelMPAddrSpaceMapping'
2035625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::AddrSpaceMapping'
2045625Sgblack@eecs.umich.edu
2055625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus the address space is mapped to')
2065625Sgblack@eecs.umich.edu    address_type = Param.X86IntelMPAddressType('IOAddress',
2075625Sgblack@eecs.umich.edu            'address type used to access bus')
2085625Sgblack@eecs.umich.edu    address = Param.Addr(0, 'starting address of the mapping')
2095625Sgblack@eecs.umich.edu    length = Param.UInt64(0, 'length of mapping in bytes')
2105625Sgblack@eecs.umich.edu
2115625Sgblack@eecs.umich.educlass X86IntelMPBusHierarchy(X86IntelMPExtConfigEntry):
2125625Sgblack@eecs.umich.edu    type = 'X86IntelMPBusHierarchy'
2135625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BusHierarchy'
2145625Sgblack@eecs.umich.edu
2155625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2165625Sgblack@eecs.umich.edu    subtractive_decode = Param.Bool(False,
2175625Sgblack@eecs.umich.edu            'whether this bus contains all addresses not used by its children')
2185625Sgblack@eecs.umich.edu    parent_bus = Param.UInt8(0, 'bus id of this busses parent')
2195625Sgblack@eecs.umich.edu
2205625Sgblack@eecs.umich.educlass X86IntelMPRangeList(Enum):
2215625Sgblack@eecs.umich.edu    map = {"ISACompatible" : 0,
2225625Sgblack@eecs.umich.edu           "VGACompatible" : 1
2235625Sgblack@eecs.umich.edu    }
2245625Sgblack@eecs.umich.edu
2255625Sgblack@eecs.umich.educlass X86IntelMPCompatAddrSpaceMod(X86IntelMPExtConfigEntry):
2265625Sgblack@eecs.umich.edu    type = 'X86IntelMPCompatAddrSpaceMod'
2275625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::CompatAddrSpaceMod'
2285625Sgblack@eecs.umich.edu
2295625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2305625Sgblack@eecs.umich.edu    add = Param.Bool(False,
2315625Sgblack@eecs.umich.edu            'if the range should be added to the original mapping')
2325625Sgblack@eecs.umich.edu    range_list = Param.X86IntelMPRangeList('ISACompatible',
2335625Sgblack@eecs.umich.edu            'which predefined range of addresses to use')
234