IntelMP.py revision 5838:47ada83a8958
19243SN/A# Copyright (c) 2008 The Hewlett-Packard Development Company 210206Sandreas.hansson@arm.com# All rights reserved. 39243SN/A# 49243SN/A# Redistribution and use of this software in source and binary forms, 59243SN/A# with or without modification, are permitted provided that the 69243SN/A# following conditions are met: 79243SN/A# 89243SN/A# The software must be used only for Non-Commercial Use which means any 99243SN/A# use which is NOT directed to receiving any direct monetary 109243SN/A# compensation for, or commercial advantage from such use. Illustrative 119243SN/A# examples of non-commercial use are academic research, personal study, 129243SN/A# teaching, education and corporate research & development. 139243SN/A# Illustrative examples of commercial use are distributing products for 149831SN/A# commercial advantage and providing services using the software for 159831SN/A# commercial advantage. 169831SN/A# 179243SN/A# If you wish to use this software or functionality therein that may be 189243SN/A# covered by patents for commercial use, please contact: 199243SN/A# Director of Intellectual Property Licensing 209243SN/A# Office of Strategy and Technology 219243SN/A# Hewlett-Packard Company 229243SN/A# 1501 Page Mill Road 239243SN/A# Palo Alto, California 94304 249243SN/A# 259243SN/A# Redistributions of source code must retain the above copyright notice, 269243SN/A# this list of conditions and the following disclaimer. Redistributions 279243SN/A# in binary form must reproduce the above copyright notice, this list of 289243SN/A# conditions and the following disclaimer in the documentation and/or 299243SN/A# other materials provided with the distribution. Neither the name of 309243SN/A# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 319243SN/A# contributors may be used to endorse or promote products derived from 329243SN/A# this software without specific prior written permission. No right of 339243SN/A# sublicense is granted herewith. Derivatives of the software and 349243SN/A# output created using the software may be prepared, but only for 359243SN/A# Non-Commercial Uses. Derivatives of the software may be shared with 369243SN/A# others provided: (i) the others agree to abide by the list of 379243SN/A# conditions herein which includes the Non-Commercial Use restrictions; 389243SN/A# and (ii) such Derivatives of the software include the above copyright 399243SN/A# notice to acknowledge the contribution from this software where 409243SN/A# applicable, this list of conditions and the disclaimer below. 419243SN/A# 429967SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 439243SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 449243SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 4510146Sandreas.hansson@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 469356SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4710146Sandreas.hansson@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 4810208Sandreas.hansson@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 499352SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5010146Sandreas.hansson@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 519814SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 529243SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 539243SN/A# 549243SN/A# Authors: Gabe Black 5510146Sandreas.hansson@arm.com 569243SN/Afrom m5.params import * 579243SN/Afrom m5.SimObject import SimObject 589243SN/A 5910206Sandreas.hansson@arm.comclass X86IntelMPFloatingPointer(SimObject): 6010208Sandreas.hansson@arm.com type = 'X86IntelMPFloatingPointer' 6110208Sandreas.hansson@arm.com cxx_class = 'X86ISA::IntelMP::FloatingPointer' 6210208Sandreas.hansson@arm.com 639831SN/A # The minor revision of the spec to support. The major version is assumed 649831SN/A # to be 1 in accordance with the spec. 659831SN/A spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported') 669831SN/A # If no default configuration is used, set this to 0. 679831SN/A default_config = Param.UInt8(0, 'which default configuration to use') 6810140SN/A imcr_present = Param.Bool(True, 699243SN/A 'whether the IMCR register is present in the APIC') 709566SN/A 719243SN/Aclass X86IntelMPConfigTable(SimObject): 729243SN/A type = 'X86IntelMPConfigTable' 7310140SN/A cxx_class = 'X86ISA::IntelMP::ConfigTable' 7410140SN/A 7510147Sandreas.hansson@arm.com spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported') 7610147Sandreas.hansson@arm.com oem_id = Param.String("", 'system manufacturer') 7710206Sandreas.hansson@arm.com product_id = Param.String("", 'product family') 789963SN/A oem_table_addr = Param.UInt32(0, 799971SN/A 'pointer to the optional oem configuration table') 809488SN/A oem_table_size = Param.UInt16(0, 'size of the oem configuration table') 819243SN/A local_apic = Param.UInt32(0xFEE00000, 'address of the local APIC') 829243SN/A 8310141SN/A base_entries = VectorParam.X86IntelMPBaseConfigEntry([], 849726SN/A 'base configuration table entries') 859726SN/A 8610208Sandreas.hansson@arm.com ext_entries = VectorParam.X86IntelMPExtConfigEntry([], 8710208Sandreas.hansson@arm.com 'extended configuration table entries') 8810208Sandreas.hansson@arm.com 899243SN/A def add_entry(self, entry): 909243SN/A if isinstance(entry, X86IntelMPBaseConfigEntry): 919243SN/A self.base_entries.append(entry) 929243SN/A elif isinstance(entry, X86IntelMPExtConfigEntry): 939969SN/A self.ext_entries.append(entry) 949243SN/A else: 959243SN/A panic("Don't know what type of Intel MP entry %s is." \ 969969SN/A % entry.__class__.__name__) 979243SN/A 989243SN/Aclass X86IntelMPBaseConfigEntry(SimObject): 9910140SN/A type = 'X86IntelMPBaseConfigEntry' 10010140SN/A cxx_class = 'X86ISA::IntelMP::BaseConfigEntry' 10110140SN/A abstract = True 10210140SN/A 10310140SN/Aclass X86IntelMPExtConfigEntry(SimObject): 1049243SN/A type = 'X86IntelMPExtConfigEntry' 1059243SN/A cxx_class = 'X86ISA::IntelMP::ExtConfigEntry' 1069567SN/A abstract = True 1079243SN/A 1089243SN/Aclass X86IntelMPProcessor(X86IntelMPBaseConfigEntry): 1099243SN/A type = 'X86IntelMPProcessor' 1109831SN/A cxx_class = 'X86ISA::IntelMP::Processor' 1119831SN/A 1129831SN/A local_apic_id = Param.UInt8(0, 'local APIC id') 1139831SN/A local_apic_version = Param.UInt8(0, 1149831SN/A 'bits 0-7 of the local APIC version register') 1159243SN/A enable = Param.Bool(True, 'if this processor is usable') 1169566SN/A bootstrap = Param.Bool(False, 'if this is the bootstrap processor') 1179566SN/A 11810143SN/A stepping = Param.UInt8(0, 'Processor stepping') 1199566SN/A model = Param.UInt8(0, 'Processor model') 1209566SN/A family = Param.UInt8(0, 'Processor family') 12110136SN/A 1229831SN/A feature_flags = Param.UInt32(0, 'flags returned by the CPUID instruction') 12310143SN/A 12410136SN/Aclass X86IntelMPBus(X86IntelMPBaseConfigEntry): 1259566SN/A type = 'X86IntelMPBus' 12610136SN/A cxx_class = 'X86ISA::IntelMP::Bus' 12710136SN/A 12810143SN/A bus_id = Param.UInt8(0, 'bus id assigned by the bios') 12910136SN/A bus_type = Param.String("", 'string that identify the bus type') 1309669SN/A # Legal values for bus_type are: 13110136SN/A # 13210136SN/A # "CBUS", "CBUSII", "EISA", "FUTURE", "INTERN", "ISA", "MBI", "MBII", 13310143SN/A # "MCA", "MPI", "MPSA", "NUBUS", "PCI", "PCMCIA", "TC", "VL", "VME", 13410136SN/A # "XPRESS" 1359566SN/A 1369566SN/Aclass X86IntelMPIOAPIC(X86IntelMPBaseConfigEntry): 13710207Sandreas.hansson@arm.com type = 'X86IntelMPIOAPIC' 13810207Sandreas.hansson@arm.com cxx_class = 'X86ISA::IntelMP::IOAPIC' 13910207Sandreas.hansson@arm.com 14010207Sandreas.hansson@arm.com id = Param.UInt8(0, 'id of this APIC') 14110207Sandreas.hansson@arm.com version = Param.UInt8(0, 'bits 0-7 of the version register') 14210207Sandreas.hansson@arm.com 1439243SN/A enable = Param.Bool(True, 'if this APIC is usable') 1449243SN/A 1459243SN/A address = Param.UInt32(0xfec00000, 'address of this APIC') 14610146Sandreas.hansson@arm.com 14710140SN/Aclass X86IntelMPInterruptType(Enum): 14810140SN/A map = {'INT' : 0, 14910146Sandreas.hansson@arm.com 'NMI' : 1, 15010140SN/A 'SMI' : 2, 15110140SN/A 'ExtInt' : 3 15210140SN/A } 15310140SN/A 15410140SN/Aclass X86IntelMPPolarity(Enum): 15510140SN/A map = {'ConformPolarity' : 0, 15610146Sandreas.hansson@arm.com 'ActiveHigh' : 1, 1579243SN/A 'ActiveLow' : 3 15810143SN/A } 15910143SN/A 16010208Sandreas.hansson@arm.comclass X86IntelMPTriggerMode(Enum): 16110143SN/A map = {'ConformTrigger' : 0, 16210206Sandreas.hansson@arm.com 'EdgeTrigger' : 1, 16310206Sandreas.hansson@arm.com 'LevelTrigger' : 3 16410206Sandreas.hansson@arm.com } 16510206Sandreas.hansson@arm.com 16610206Sandreas.hansson@arm.comclass X86IntelMPIOIntAssignment(X86IntelMPBaseConfigEntry): 16710206Sandreas.hansson@arm.com type = 'X86IntelMPIOIntAssignment' 1689243SN/A cxx_class = 'X86ISA::IntelMP::IOIntAssignment' 1699243SN/A 1709243SN/A interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt') 17110207Sandreas.hansson@arm.com 17210207Sandreas.hansson@arm.com polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity') 17310207Sandreas.hansson@arm.com trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode') 1749243SN/A 1759243SN/A source_bus_id = Param.UInt8(0, 1769243SN/A 'id of the bus from which the interrupt signal comes') 17710146Sandreas.hansson@arm.com source_bus_irq = Param.UInt8(0, 1789243SN/A 'which interrupt signal from the source bus') 1799243SN/A 1809243SN/A dest_io_apic_id = Param.UInt8(0, 1819243SN/A 'id of the IO APIC the interrupt is going to') 1829243SN/A dest_io_apic_intin = Param.UInt8(0, 1839243SN/A 'the INTIN pin on the IO APIC the interrupt is connected to') 1849243SN/A 1859243SN/Aclass X86IntelMPLocalIntAssignment(X86IntelMPBaseConfigEntry): 1869243SN/A type = 'X86IntelMPLocalIntAssignment' 1879243SN/A cxx_class = 'X86ISA::IntelMP::LocalIntAssignment' 1889243SN/A 1899243SN/A interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt') 1909243SN/A 1919243SN/A polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity') 1929243SN/A trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode') 1939243SN/A 19410146Sandreas.hansson@arm.com source_bus_id = Param.UInt8(0, 1959243SN/A 'id of the bus from which the interrupt signal comes') 1969831SN/A source_bus_irq = Param.UInt8(0, 1979831SN/A 'which interrupt signal from the source bus') 1989831SN/A 1999243SN/A dest_local_apic_id = Param.UInt8(0, 2009831SN/A 'id of the local APIC the interrupt is going to') 2019831SN/A dest_local_apic_intin = Param.UInt8(0, 2029243SN/A 'the INTIN pin on the local APIC the interrupt is connected to') 2039243SN/A 2049243SN/Aclass X86IntelMPAddressType(Enum): 20510146Sandreas.hansson@arm.com map = {"IOAddress" : 0, 2069243SN/A "MemoryAddress" : 1, 2079831SN/A "PrefetchAddress" : 2 2089831SN/A } 2099831SN/A 2109243SN/Aclass X86IntelMPAddrSpaceMapping(X86IntelMPExtConfigEntry): 2119243SN/A type = 'X86IntelMPAddrSpaceMapping' 21210146Sandreas.hansson@arm.com cxx_class = 'X86ISA::IntelMP::AddrSpaceMapping' 21310146Sandreas.hansson@arm.com 21410143SN/A bus_id = Param.UInt8(0, 'id of the bus the address space is mapped to') 2159243SN/A address_type = Param.X86IntelMPAddressType('IOAddress', 2169669SN/A 'address type used to access bus') 21710136SN/A address = Param.Addr(0, 'starting address of the mapping') 21810136SN/A length = Param.UInt64(0, 'length of mapping in bytes') 2199243SN/A 2209967SN/Aclass X86IntelMPBusHierarchy(X86IntelMPExtConfigEntry): 2219243SN/A type = 'X86IntelMPBusHierarchy' 2229243SN/A cxx_class = 'X86ISA::IntelMP::BusHierarchy' 2239243SN/A 2249831SN/A bus_id = Param.UInt8(0, 'id of the bus being described') 2259243SN/A subtractive_decode = Param.Bool(False, 2269491SN/A 'whether this bus contains all addresses not used by its children') 2279831SN/A parent_bus = Param.UInt8(0, 'bus id of this busses parent') 22810136SN/A 2299491SN/Aclass X86IntelMPRangeList(Enum): 2309491SN/A map = {"ISACompatible" : 0, 2319831SN/A "VGACompatible" : 1 2329243SN/A } 2339669SN/A 2349566SN/Aclass X86IntelMPCompatAddrSpaceMod(X86IntelMPExtConfigEntry): 2359566SN/A type = 'X86IntelMPCompatAddrSpaceMod' 2369669SN/A cxx_class = 'X86ISA::IntelMP::CompatAddrSpaceMod' 2379669SN/A 2389669SN/A bus_id = Param.UInt8(0, 'id of the bus being described') 2399669SN/A add = Param.Bool(False, 2409669SN/A 'if the range should be added to the original mapping') 2419669SN/A range_list = Param.X86IntelMPRangeList('ISACompatible', 2429669SN/A 'which predefined range of addresses to use') 2439669SN/A