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'
449338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
455625Sgblack@eecs.umich.edu
465625Sgblack@eecs.umich.edu    # The minor revision of the spec to support. The major version is assumed
475625Sgblack@eecs.umich.edu    # to be 1 in accordance with the spec.
485625Sgblack@eecs.umich.edu    spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
495625Sgblack@eecs.umich.edu    # If no default configuration is used, set this to 0.
505625Sgblack@eecs.umich.edu    default_config = Param.UInt8(0, 'which default configuration to use')
515625Sgblack@eecs.umich.edu    imcr_present = Param.Bool(True,
525625Sgblack@eecs.umich.edu            'whether the IMCR register is present in the APIC')
535625Sgblack@eecs.umich.edu
545625Sgblack@eecs.umich.educlass X86IntelMPConfigTable(SimObject):
555625Sgblack@eecs.umich.edu    type = 'X86IntelMPConfigTable'
565625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::ConfigTable'
579338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
585625Sgblack@eecs.umich.edu
595625Sgblack@eecs.umich.edu    spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
605625Sgblack@eecs.umich.edu    oem_id = Param.String("", 'system manufacturer')
615625Sgblack@eecs.umich.edu    product_id = Param.String("", 'product family')
625625Sgblack@eecs.umich.edu    oem_table_addr = Param.UInt32(0,
635625Sgblack@eecs.umich.edu            'pointer to the optional oem configuration table')
645625Sgblack@eecs.umich.edu    oem_table_size = Param.UInt16(0, 'size of the oem configuration table')
655625Sgblack@eecs.umich.edu    local_apic = Param.UInt32(0xFEE00000, 'address of the local APIC')
665625Sgblack@eecs.umich.edu
675625Sgblack@eecs.umich.edu    base_entries = VectorParam.X86IntelMPBaseConfigEntry([],
685625Sgblack@eecs.umich.edu            'base configuration table entries')
695625Sgblack@eecs.umich.edu
705625Sgblack@eecs.umich.edu    ext_entries = VectorParam.X86IntelMPExtConfigEntry([],
715625Sgblack@eecs.umich.edu            'extended configuration table entries')
725625Sgblack@eecs.umich.edu
735770Sgblack@eecs.umich.edu    def add_entry(self, entry):
745770Sgblack@eecs.umich.edu        if isinstance(entry, X86IntelMPBaseConfigEntry):
755770Sgblack@eecs.umich.edu            self.base_entries.append(entry)
765770Sgblack@eecs.umich.edu        elif isinstance(entry, X86IntelMPExtConfigEntry):
775838Sgblack@eecs.umich.edu            self.ext_entries.append(entry)
785770Sgblack@eecs.umich.edu        else:
795770Sgblack@eecs.umich.edu            panic("Don't know what type of Intel MP entry %s is." \
805770Sgblack@eecs.umich.edu                    % entry.__class__.__name__)
815770Sgblack@eecs.umich.edu
825625Sgblack@eecs.umich.educlass X86IntelMPBaseConfigEntry(SimObject):
835625Sgblack@eecs.umich.edu    type = 'X86IntelMPBaseConfigEntry'
845625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BaseConfigEntry'
859338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
865625Sgblack@eecs.umich.edu    abstract = True
875625Sgblack@eecs.umich.edu
885625Sgblack@eecs.umich.educlass X86IntelMPExtConfigEntry(SimObject):
895625Sgblack@eecs.umich.edu    type = 'X86IntelMPExtConfigEntry'
905625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::ExtConfigEntry'
919338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
925625Sgblack@eecs.umich.edu    abstract = True
935625Sgblack@eecs.umich.edu
945625Sgblack@eecs.umich.educlass X86IntelMPProcessor(X86IntelMPBaseConfigEntry):
955625Sgblack@eecs.umich.edu    type = 'X86IntelMPProcessor'
965625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Processor'
979338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
985625Sgblack@eecs.umich.edu
995625Sgblack@eecs.umich.edu    local_apic_id = Param.UInt8(0, 'local APIC id')
1005625Sgblack@eecs.umich.edu    local_apic_version = Param.UInt8(0,
1015625Sgblack@eecs.umich.edu            'bits 0-7 of the local APIC version register')
1025625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this processor is usable')
1035625Sgblack@eecs.umich.edu    bootstrap = Param.Bool(False, 'if this is the bootstrap processor')
1045625Sgblack@eecs.umich.edu
1055825Sgblack@eecs.umich.edu    stepping = Param.UInt8(0, 'Processor stepping')
1065825Sgblack@eecs.umich.edu    model = Param.UInt8(0, 'Processor model')
1075825Sgblack@eecs.umich.edu    family = Param.UInt8(0, 'Processor family')
1085625Sgblack@eecs.umich.edu
1095625Sgblack@eecs.umich.edu    feature_flags = Param.UInt32(0, 'flags returned by the CPUID instruction')
1105625Sgblack@eecs.umich.edu
1115625Sgblack@eecs.umich.educlass X86IntelMPBus(X86IntelMPBaseConfigEntry):
1125625Sgblack@eecs.umich.edu    type = 'X86IntelMPBus'
1135625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::Bus'
1149338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
1155625Sgblack@eecs.umich.edu
1165625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'bus id assigned by the bios')
1175625Sgblack@eecs.umich.edu    bus_type = Param.String("", 'string that identify the bus type')
11811481Sbaz21@cam.ac.uk    # Legal values for bus_type are [space padded to 6 bytes]:
1195625Sgblack@eecs.umich.edu    #
1205625Sgblack@eecs.umich.edu    # "CBUS", "CBUSII", "EISA", "FUTURE", "INTERN", "ISA", "MBI", "MBII",
1215625Sgblack@eecs.umich.edu    # "MCA", "MPI", "MPSA", "NUBUS", "PCI", "PCMCIA", "TC", "VL", "VME",
1225625Sgblack@eecs.umich.edu    # "XPRESS"
1235625Sgblack@eecs.umich.edu
1245625Sgblack@eecs.umich.educlass X86IntelMPIOAPIC(X86IntelMPBaseConfigEntry):
1255625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOAPIC'
1265625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOAPIC'
1279338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
1285625Sgblack@eecs.umich.edu
1295625Sgblack@eecs.umich.edu    id = Param.UInt8(0, 'id of this APIC')
1305625Sgblack@eecs.umich.edu    version = Param.UInt8(0, 'bits 0-7 of the version register')
1315625Sgblack@eecs.umich.edu
1325625Sgblack@eecs.umich.edu    enable = Param.Bool(True, 'if this APIC is usable')
1335625Sgblack@eecs.umich.edu
1345625Sgblack@eecs.umich.edu    address = Param.UInt32(0xfec00000, 'address of this APIC')
1355625Sgblack@eecs.umich.edu
1365625Sgblack@eecs.umich.educlass X86IntelMPInterruptType(Enum):
1375625Sgblack@eecs.umich.edu    map = {'INT' : 0,
1385625Sgblack@eecs.umich.edu           'NMI' : 1,
1395625Sgblack@eecs.umich.edu           'SMI' : 2,
1405625Sgblack@eecs.umich.edu           'ExtInt' : 3
1415625Sgblack@eecs.umich.edu    }
1425625Sgblack@eecs.umich.edu
1435625Sgblack@eecs.umich.educlass X86IntelMPPolarity(Enum):
1445625Sgblack@eecs.umich.edu    map = {'ConformPolarity' : 0,
1455625Sgblack@eecs.umich.edu           'ActiveHigh' : 1,
1465625Sgblack@eecs.umich.edu           'ActiveLow' : 3
1475625Sgblack@eecs.umich.edu    }
1485625Sgblack@eecs.umich.edu
1495625Sgblack@eecs.umich.educlass X86IntelMPTriggerMode(Enum):
1505625Sgblack@eecs.umich.edu    map = {'ConformTrigger' : 0,
1515625Sgblack@eecs.umich.edu           'EdgeTrigger' : 1,
1525625Sgblack@eecs.umich.edu           'LevelTrigger' : 3
1535625Sgblack@eecs.umich.edu    }
1545625Sgblack@eecs.umich.edu
1555625Sgblack@eecs.umich.educlass X86IntelMPIOIntAssignment(X86IntelMPBaseConfigEntry):
1565625Sgblack@eecs.umich.edu    type = 'X86IntelMPIOIntAssignment'
1575625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::IOIntAssignment'
1589338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
1595625Sgblack@eecs.umich.edu
1605625Sgblack@eecs.umich.edu    interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
1615625Sgblack@eecs.umich.edu
1625625Sgblack@eecs.umich.edu    polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
1635625Sgblack@eecs.umich.edu    trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
1645625Sgblack@eecs.umich.edu
1655625Sgblack@eecs.umich.edu    source_bus_id = Param.UInt8(0,
1665625Sgblack@eecs.umich.edu            'id of the bus from which the interrupt signal comes')
1675625Sgblack@eecs.umich.edu    source_bus_irq = Param.UInt8(0,
1685625Sgblack@eecs.umich.edu            'which interrupt signal from the source bus')
1695625Sgblack@eecs.umich.edu
1705625Sgblack@eecs.umich.edu    dest_io_apic_id = Param.UInt8(0,
1715625Sgblack@eecs.umich.edu            'id of the IO APIC the interrupt is going to')
1725625Sgblack@eecs.umich.edu    dest_io_apic_intin = Param.UInt8(0,
1735625Sgblack@eecs.umich.edu            'the INTIN pin on the IO APIC the interrupt is connected to')
1745625Sgblack@eecs.umich.edu
1755625Sgblack@eecs.umich.educlass X86IntelMPLocalIntAssignment(X86IntelMPBaseConfigEntry):
1765625Sgblack@eecs.umich.edu    type = 'X86IntelMPLocalIntAssignment'
1775625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::LocalIntAssignment'
1789338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
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'
2049338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
2055625Sgblack@eecs.umich.edu
2065625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus the address space is mapped to')
2075625Sgblack@eecs.umich.edu    address_type = Param.X86IntelMPAddressType('IOAddress',
2085625Sgblack@eecs.umich.edu            'address type used to access bus')
2095625Sgblack@eecs.umich.edu    address = Param.Addr(0, 'starting address of the mapping')
2105625Sgblack@eecs.umich.edu    length = Param.UInt64(0, 'length of mapping in bytes')
2115625Sgblack@eecs.umich.edu
2125625Sgblack@eecs.umich.educlass X86IntelMPBusHierarchy(X86IntelMPExtConfigEntry):
2135625Sgblack@eecs.umich.edu    type = 'X86IntelMPBusHierarchy'
2145625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::BusHierarchy'
2159338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
2165625Sgblack@eecs.umich.edu
2175625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2185625Sgblack@eecs.umich.edu    subtractive_decode = Param.Bool(False,
2195625Sgblack@eecs.umich.edu            'whether this bus contains all addresses not used by its children')
2205625Sgblack@eecs.umich.edu    parent_bus = Param.UInt8(0, 'bus id of this busses parent')
2215625Sgblack@eecs.umich.edu
2225625Sgblack@eecs.umich.educlass X86IntelMPRangeList(Enum):
2235625Sgblack@eecs.umich.edu    map = {"ISACompatible" : 0,
2245625Sgblack@eecs.umich.edu           "VGACompatible" : 1
2255625Sgblack@eecs.umich.edu    }
2265625Sgblack@eecs.umich.edu
2275625Sgblack@eecs.umich.educlass X86IntelMPCompatAddrSpaceMod(X86IntelMPExtConfigEntry):
2285625Sgblack@eecs.umich.edu    type = 'X86IntelMPCompatAddrSpaceMod'
2295625Sgblack@eecs.umich.edu    cxx_class = 'X86ISA::IntelMP::CompatAddrSpaceMod'
2309338SAndreas.Sandberg@arm.com    cxx_header = 'arch/x86/bios/intelmp.hh'
2315625Sgblack@eecs.umich.edu
2325625Sgblack@eecs.umich.edu    bus_id = Param.UInt8(0, 'id of the bus being described')
2335625Sgblack@eecs.umich.edu    add = Param.Bool(False,
2345625Sgblack@eecs.umich.edu            'if the range should be added to the original mapping')
2355625Sgblack@eecs.umich.edu    range_list = Param.X86IntelMPRangeList('ISACompatible',
2365625Sgblack@eecs.umich.edu            'which predefined range of addresses to use')
237