IntelMP.py revision 7087
15625Sgblack@eecs.umich.edu# Copyright (c) 2008 The Hewlett-Packard Development Company
25625Sgblack@eecs.umich.edu# All rights reserved.
35625Sgblack@eecs.umich.edu#
47087Snate@binkert.org# The license below extends only to copyright in the software and shall
57087Snate@binkert.org# not be construed as granting a license to any other intellectual
67087Snate@binkert.org# property including but not limited to intellectual property relating
77087Snate@binkert.org# to a hardware implementation of the functionality of the software
87087Snate@binkert.org# licensed hereunder.  You may use the software subject to the license
97087Snate@binkert.org# terms below provided that you ensure that this notice is replicated
107087Snate@binkert.org# unmodified and in its entirety in all distributions of the software,
117087Snate@binkert.org# modified or unmodified, in source code or in binary form.
125625Sgblack@eecs.umich.edu#
137087Snate@binkert.org# Redistribution and use in source and binary forms, with or without
147087Snate@binkert.org# modification, are permitted provided that the following conditions are
157087Snate@binkert.org# met: redistributions of source code must retain the above copyright
167087Snate@binkert.org# notice, this list of conditions and the following disclaimer;
177087Snate@binkert.org# redistributions in binary form must reproduce the above copyright
187087Snate@binkert.org# notice, this list of conditions and the following disclaimer in the
197087Snate@binkert.org# documentation and/or other materials provided with the distribution;
207087Snate@binkert.org# neither the name of the copyright holders nor the names of its
215625Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
227087Snate@binkert.org# this software without specific prior written permission.
235625Sgblack@eecs.umich.edu#
245625Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
255625Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
265625Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
275625Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
285625Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
295625Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
305625Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
315625Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
325625Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
335625Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
345625Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
355625Sgblack@eecs.umich.edu#
365625Sgblack@eecs.umich.edu# Authors: Gabe Black
375625Sgblack@eecs.umich.edu
385625Sgblack@eecs.umich.edufrom m5.params import *
395625Sgblack@eecs.umich.edufrom m5.SimObject import SimObject
405625Sgblack@eecs.umich.edu
415625Sgblack@eecs.umich.educlass X86IntelMPFloatingPointer(SimObject):
425625Sgblack@eecs.umich.edu    type = 'X86IntelMPFloatingPointer'
435625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::FloatingPointer'
445625Sgblack@eecs.umich.edu
455625Sgblack@eecs.umich.edu    # The minor revision of the spec to support. The major version is assumed
465625Sgblack@eecs.umich.edu    # to be 1 in accordance with the spec.
475625Sgblack@eecs.umich.edu    spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
485625Sgblack@eecs.umich.edu    # If no default configuration is used, set this to 0.
495625Sgblack@eecs.umich.edu    default_config = Param.UInt8(0, 'which default configuration to use')
505625Sgblack@eecs.umich.edu    imcr_present = Param.Bool(True,
515625Sgblack@eecs.umich.edu            'whether the IMCR register is present in the APIC')
525625Sgblack@eecs.umich.edu
535625Sgblack@eecs.umich.educlass X86IntelMPConfigTable(SimObject):
545625Sgblack@eecs.umich.edu    type = 'X86IntelMPConfigTable'
555625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::ConfigTable'
565625Sgblack@eecs.umich.edu
575625Sgblack@eecs.umich.edu    spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
585625Sgblack@eecs.umich.edu    oem_id = Param.String("", 'system manufacturer')
595625Sgblack@eecs.umich.edu    product_id = Param.String("", 'product family')
605625Sgblack@eecs.umich.edu    oem_table_addr = Param.UInt32(0,
615625Sgblack@eecs.umich.edu            'pointer to the optional oem configuration table')
625625Sgblack@eecs.umich.edu    oem_table_size = Param.UInt16(0, 'size of the oem configuration table')
635625Sgblack@eecs.umich.edu    local_apic = Param.UInt32(0xFEE00000, 'address of the local APIC')
645625Sgblack@eecs.umich.edu
655625Sgblack@eecs.umich.edu    base_entries = VectorParam.X86IntelMPBaseConfigEntry([],
665625Sgblack@eecs.umich.edu            'base configuration table entries')
675625Sgblack@eecs.umich.edu
685625Sgblack@eecs.umich.edu    ext_entries = VectorParam.X86IntelMPExtConfigEntry([],
695625Sgblack@eecs.umich.edu            'extended configuration table entries')
705625Sgblack@eecs.umich.edu
715770Sgblack@eecs.umich.edu    def add_entry(self, entry):
725770Sgblack@eecs.umich.edu        if isinstance(entry, X86IntelMPBaseConfigEntry):
735770Sgblack@eecs.umich.edu            self.base_entries.append(entry)
745770Sgblack@eecs.umich.edu        elif isinstance(entry, X86IntelMPExtConfigEntry):
755838Sgblack@eecs.umich.edu            self.ext_entries.append(entry)
765770Sgblack@eecs.umich.edu        else:
775770Sgblack@eecs.umich.edu            panic("Don't know what type of Intel MP entry %s is." \
785770Sgblack@eecs.umich.edu                    % entry.__class__.__name__)
795770Sgblack@eecs.umich.edu
805625Sgblack@eecs.umich.educlass X86IntelMPBaseConfigEntry(SimObject):
815625Sgblack@eecs.umich.edu    type = 'X86IntelMPBaseConfigEntry'
825625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BaseConfigEntry'
835625Sgblack@eecs.umich.edu    abstract = True
845625Sgblack@eecs.umich.edu
855625Sgblack@eecs.umich.educlass X86IntelMPExtConfigEntry(SimObject):
865625Sgblack@eecs.umich.edu    type = 'X86IntelMPExtConfigEntry'
875625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::ExtConfigEntry'
885625Sgblack@eecs.umich.edu    abstract = True
895625Sgblack@eecs.umich.edu
905625Sgblack@eecs.umich.educlass X86IntelMPProcessor(X86IntelMPBaseConfigEntry):
915625Sgblack@eecs.umich.edu    type = 'X86IntelMPProcessor'
925625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Processor'
935625Sgblack@eecs.umich.edu
945625Sgblack@eecs.umich.edu    local_apic_id = Param.UInt8(0, 'local APIC id')
955625Sgblack@eecs.umich.edu    local_apic_version = Param.UInt8(0,
965625Sgblack@eecs.umich.edu            'bits 0-7 of the local APIC version register')
975625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this processor is usable')
985625Sgblack@eecs.umich.edu    bootstrap = Param.Bool(False, 'if this is the bootstrap processor')
995625Sgblack@eecs.umich.edu
1005825Sgblack@eecs.umich.edu    stepping = Param.UInt8(0, 'Processor stepping')
1015825Sgblack@eecs.umich.edu    model = Param.UInt8(0, 'Processor model')
1025825Sgblack@eecs.umich.edu    family = Param.UInt8(0, 'Processor family')
1035625Sgblack@eecs.umich.edu
1045625Sgblack@eecs.umich.edu    feature_flags = Param.UInt32(0, 'flags returned by the CPUID instruction')
1055625Sgblack@eecs.umich.edu
1065625Sgblack@eecs.umich.educlass X86IntelMPBus(X86IntelMPBaseConfigEntry):
1075625Sgblack@eecs.umich.edu    type = 'X86IntelMPBus'
1085625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Bus'
1095625Sgblack@eecs.umich.edu
1105625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'bus id assigned by the bios')
1115625Sgblack@eecs.umich.edu    bus_type = Param.String("", 'string that identify the bus type')
1125625Sgblack@eecs.umich.edu    # Legal values for bus_type are:
1135625Sgblack@eecs.umich.edu    #
1145625Sgblack@eecs.umich.edu    # "CBUS", "CBUSII", "EISA", "FUTURE", "INTERN", "ISA", "MBI", "MBII",
1155625Sgblack@eecs.umich.edu    # "MCA", "MPI", "MPSA", "NUBUS", "PCI", "PCMCIA", "TC", "VL", "VME",
1165625Sgblack@eecs.umich.edu    # "XPRESS"
1175625Sgblack@eecs.umich.edu
1185625Sgblack@eecs.umich.educlass X86IntelMPIOAPIC(X86IntelMPBaseConfigEntry):
1195625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOAPIC'
1205625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOAPIC'
1215625Sgblack@eecs.umich.edu
1225625Sgblack@eecs.umich.edu    id = Param.UInt8(0, 'id of this APIC')
1235625Sgblack@eecs.umich.edu    version = Param.UInt8(0, 'bits 0-7 of the version register')
1245625Sgblack@eecs.umich.edu
1255625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this APIC is usable')
1265625Sgblack@eecs.umich.edu
1275625Sgblack@eecs.umich.edu    address = Param.UInt32(0xfec00000, 'address of this APIC')
1285625Sgblack@eecs.umich.edu
1295625Sgblack@eecs.umich.educlass X86IntelMPInterruptType(Enum):
1305625Sgblack@eecs.umich.edu    map = {'INT' : 0,
1315625Sgblack@eecs.umich.edu           'NMI' : 1,
1325625Sgblack@eecs.umich.edu           'SMI' : 2,
1335625Sgblack@eecs.umich.edu           'ExtInt' : 3
1345625Sgblack@eecs.umich.edu    }
1355625Sgblack@eecs.umich.edu
1365625Sgblack@eecs.umich.educlass X86IntelMPPolarity(Enum):
1375625Sgblack@eecs.umich.edu    map = {'ConformPolarity' : 0,
1385625Sgblack@eecs.umich.edu           'ActiveHigh' : 1,
1395625Sgblack@eecs.umich.edu           'ActiveLow' : 3
1405625Sgblack@eecs.umich.edu    }
1415625Sgblack@eecs.umich.edu
1425625Sgblack@eecs.umich.educlass X86IntelMPTriggerMode(Enum):
1435625Sgblack@eecs.umich.edu    map = {'ConformTrigger' : 0,
1445625Sgblack@eecs.umich.edu           'EdgeTrigger' : 1,
1455625Sgblack@eecs.umich.edu           'LevelTrigger' : 3
1465625Sgblack@eecs.umich.edu    }
1475625Sgblack@eecs.umich.edu
1485625Sgblack@eecs.umich.educlass X86IntelMPIOIntAssignment(X86IntelMPBaseConfigEntry):
1495625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOIntAssignment'
1505625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOIntAssignment'
1515625Sgblack@eecs.umich.edu
1525625Sgblack@eecs.umich.edu    interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
1535625Sgblack@eecs.umich.edu
1545625Sgblack@eecs.umich.edu    polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
1555625Sgblack@eecs.umich.edu    trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
1565625Sgblack@eecs.umich.edu
1575625Sgblack@eecs.umich.edu    source_bus_id = Param.UInt8(0,
1585625Sgblack@eecs.umich.edu            'id of the bus from which the interrupt signal comes')
1595625Sgblack@eecs.umich.edu    source_bus_irq = Param.UInt8(0,
1605625Sgblack@eecs.umich.edu            'which interrupt signal from the source bus')
1615625Sgblack@eecs.umich.edu
1625625Sgblack@eecs.umich.edu    dest_io_apic_id = Param.UInt8(0,
1635625Sgblack@eecs.umich.edu            'id of the IO APIC the interrupt is going to')
1645625Sgblack@eecs.umich.edu    dest_io_apic_intin = Param.UInt8(0,
1655625Sgblack@eecs.umich.edu            'the INTIN pin on the IO APIC the interrupt is connected to')
1665625Sgblack@eecs.umich.edu
1675625Sgblack@eecs.umich.educlass X86IntelMPLocalIntAssignment(X86IntelMPBaseConfigEntry):
1685625Sgblack@eecs.umich.edu    type = 'X86IntelMPLocalIntAssignment'
1695625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::LocalIntAssignment'
1705625Sgblack@eecs.umich.edu
1715625Sgblack@eecs.umich.edu    interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
1725625Sgblack@eecs.umich.edu
1735625Sgblack@eecs.umich.edu    polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
1745625Sgblack@eecs.umich.edu    trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
1755625Sgblack@eecs.umich.edu
1765625Sgblack@eecs.umich.edu    source_bus_id = Param.UInt8(0,
1775625Sgblack@eecs.umich.edu            'id of the bus from which the interrupt signal comes')
1785625Sgblack@eecs.umich.edu    source_bus_irq = Param.UInt8(0,
1795625Sgblack@eecs.umich.edu            'which interrupt signal from the source bus')
1805625Sgblack@eecs.umich.edu
1815625Sgblack@eecs.umich.edu    dest_local_apic_id = Param.UInt8(0,
1825625Sgblack@eecs.umich.edu            'id of the local APIC the interrupt is going to')
1835625Sgblack@eecs.umich.edu    dest_local_apic_intin = Param.UInt8(0,
1845625Sgblack@eecs.umich.edu            'the INTIN pin on the local APIC the interrupt is connected to')
1855625Sgblack@eecs.umich.edu
1865625Sgblack@eecs.umich.educlass X86IntelMPAddressType(Enum):
1875625Sgblack@eecs.umich.edu    map = {"IOAddress" : 0,
1885625Sgblack@eecs.umich.edu           "MemoryAddress" : 1,
1895625Sgblack@eecs.umich.edu           "PrefetchAddress" : 2
1905625Sgblack@eecs.umich.edu    }
1915625Sgblack@eecs.umich.edu
1925625Sgblack@eecs.umich.educlass X86IntelMPAddrSpaceMapping(X86IntelMPExtConfigEntry):
1935625Sgblack@eecs.umich.edu    type = 'X86IntelMPAddrSpaceMapping'
1945625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::AddrSpaceMapping'
1955625Sgblack@eecs.umich.edu
1965625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus the address space is mapped to')
1975625Sgblack@eecs.umich.edu    address_type = Param.X86IntelMPAddressType('IOAddress',
1985625Sgblack@eecs.umich.edu            'address type used to access bus')
1995625Sgblack@eecs.umich.edu    address = Param.Addr(0, 'starting address of the mapping')
2005625Sgblack@eecs.umich.edu    length = Param.UInt64(0, 'length of mapping in bytes')
2015625Sgblack@eecs.umich.edu
2025625Sgblack@eecs.umich.educlass X86IntelMPBusHierarchy(X86IntelMPExtConfigEntry):
2035625Sgblack@eecs.umich.edu    type = 'X86IntelMPBusHierarchy'
2045625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BusHierarchy'
2055625Sgblack@eecs.umich.edu
2065625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2075625Sgblack@eecs.umich.edu    subtractive_decode = Param.Bool(False,
2085625Sgblack@eecs.umich.edu            'whether this bus contains all addresses not used by its children')
2095625Sgblack@eecs.umich.edu    parent_bus = Param.UInt8(0, 'bus id of this busses parent')
2105625Sgblack@eecs.umich.edu
2115625Sgblack@eecs.umich.educlass X86IntelMPRangeList(Enum):
2125625Sgblack@eecs.umich.edu    map = {"ISACompatible" : 0,
2135625Sgblack@eecs.umich.edu           "VGACompatible" : 1
2145625Sgblack@eecs.umich.edu    }
2155625Sgblack@eecs.umich.edu
2165625Sgblack@eecs.umich.educlass X86IntelMPCompatAddrSpaceMod(X86IntelMPExtConfigEntry):
2175625Sgblack@eecs.umich.edu    type = 'X86IntelMPCompatAddrSpaceMod'
2185625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::CompatAddrSpaceMod'
2195625Sgblack@eecs.umich.edu
2205625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2215625Sgblack@eecs.umich.edu    add = Param.Bool(False,
2225625Sgblack@eecs.umich.edu            'if the range should be added to the original mapping')
2235625Sgblack@eecs.umich.edu    range_list = Param.X86IntelMPRangeList('ISACompatible',
2245625Sgblack@eecs.umich.edu            'which predefined range of addresses to use')
225