15625Sgblack@eecs.umich.edu/*
25625Sgblack@eecs.umich.edu * Copyright (c) 2008 The Hewlett-Packard Development Company
35625Sgblack@eecs.umich.edu * All rights reserved.
45625Sgblack@eecs.umich.edu *
57087Snate@binkert.org * The license below extends only to copyright in the software and shall
67087Snate@binkert.org * not be construed as granting a license to any other intellectual
77087Snate@binkert.org * property including but not limited to intellectual property relating
87087Snate@binkert.org * to a hardware implementation of the functionality of the software
97087Snate@binkert.org * licensed hereunder.  You may use the software subject to the license
107087Snate@binkert.org * terms below provided that you ensure that this notice is replicated
117087Snate@binkert.org * unmodified and in its entirety in all distributions of the software,
127087Snate@binkert.org * modified or unmodified, in source code or in binary form.
135625Sgblack@eecs.umich.edu *
147087Snate@binkert.org * Redistribution and use in source and binary forms, with or without
157087Snate@binkert.org * modification, are permitted provided that the following conditions are
167087Snate@binkert.org * met: redistributions of source code must retain the above copyright
177087Snate@binkert.org * notice, this list of conditions and the following disclaimer;
187087Snate@binkert.org * redistributions in binary form must reproduce the above copyright
197087Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
207087Snate@binkert.org * documentation and/or other materials provided with the distribution;
217087Snate@binkert.org * neither the name of the copyright holders nor the names of its
225625Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
237087Snate@binkert.org * this software without specific prior written permission.
245625Sgblack@eecs.umich.edu *
255625Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
265625Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
275625Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
285625Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
295625Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
305625Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
315625Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
325625Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
335625Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
345625Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
355625Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
365625Sgblack@eecs.umich.edu *
375625Sgblack@eecs.umich.edu * Authors: Gabe Black
385625Sgblack@eecs.umich.edu */
395625Sgblack@eecs.umich.edu
405625Sgblack@eecs.umich.edu#include "arch/x86/bios/intelmp.hh"
4111793Sbrandon.potter@amd.com
425625Sgblack@eecs.umich.edu#include "arch/x86/isa_traits.hh"
4312334Sgabeblack@google.com#include "base/logging.hh"
446216Snate@binkert.org#include "base/types.hh"
458706Sandreas.hansson@arm.com#include "mem/port_proxy.hh"
465625Sgblack@eecs.umich.edu#include "sim/byteswap.hh"
475625Sgblack@eecs.umich.edu
485625Sgblack@eecs.umich.edu// Config entry types
495625Sgblack@eecs.umich.edu#include "params/X86IntelMPBaseConfigEntry.hh"
505625Sgblack@eecs.umich.edu#include "params/X86IntelMPExtConfigEntry.hh"
515625Sgblack@eecs.umich.edu
525625Sgblack@eecs.umich.edu// General table structures
535625Sgblack@eecs.umich.edu#include "params/X86IntelMPConfigTable.hh"
545625Sgblack@eecs.umich.edu#include "params/X86IntelMPFloatingPointer.hh"
555625Sgblack@eecs.umich.edu
565625Sgblack@eecs.umich.edu// Base entry types
575625Sgblack@eecs.umich.edu#include "params/X86IntelMPBus.hh"
585625Sgblack@eecs.umich.edu#include "params/X86IntelMPIOAPIC.hh"
595625Sgblack@eecs.umich.edu#include "params/X86IntelMPIOIntAssignment.hh"
605625Sgblack@eecs.umich.edu#include "params/X86IntelMPLocalIntAssignment.hh"
615625Sgblack@eecs.umich.edu#include "params/X86IntelMPProcessor.hh"
625625Sgblack@eecs.umich.edu
635625Sgblack@eecs.umich.edu// Extended entry types
645625Sgblack@eecs.umich.edu#include "params/X86IntelMPAddrSpaceMapping.hh"
655625Sgblack@eecs.umich.edu#include "params/X86IntelMPBusHierarchy.hh"
665625Sgblack@eecs.umich.edu#include "params/X86IntelMPCompatAddrSpaceMod.hh"
675625Sgblack@eecs.umich.edu
685625Sgblack@eecs.umich.eduusing namespace std;
695625Sgblack@eecs.umich.edu
705625Sgblack@eecs.umich.educonst char X86ISA::IntelMP::FloatingPointer::signature[] = "_MP_";
715625Sgblack@eecs.umich.edu
725625Sgblack@eecs.umich.edutemplate<class T>
735625Sgblack@eecs.umich.eduuint8_t
748852Sandreas.hansson@arm.comwriteOutField(PortProxy& proxy, Addr addr, T val)
755625Sgblack@eecs.umich.edu{
768737Skoansin.tan@gmail.com    uint64_t guestVal = X86ISA::htog(val);
7714010Sgabeblack@google.com    proxy.writeBlob(addr, &guestVal, sizeof(T));
785625Sgblack@eecs.umich.edu
795625Sgblack@eecs.umich.edu    uint8_t checkSum = 0;
8011321Ssteve.reinhardt@amd.com    while (guestVal) {
815625Sgblack@eecs.umich.edu        checkSum += guestVal;
825625Sgblack@eecs.umich.edu        guestVal >>= 8;
835625Sgblack@eecs.umich.edu    }
845625Sgblack@eecs.umich.edu    return checkSum;
855625Sgblack@eecs.umich.edu}
865625Sgblack@eecs.umich.edu
875625Sgblack@eecs.umich.eduuint8_t
888852Sandreas.hansson@arm.comwriteOutString(PortProxy& proxy, Addr addr, string str, int length)
895625Sgblack@eecs.umich.edu{
905625Sgblack@eecs.umich.edu    char cleanedString[length + 1];
915625Sgblack@eecs.umich.edu    cleanedString[length] = 0;
925625Sgblack@eecs.umich.edu
935625Sgblack@eecs.umich.edu    if (str.length() > length) {
945625Sgblack@eecs.umich.edu        memcpy(cleanedString, str.c_str(), length);
955625Sgblack@eecs.umich.edu        warn("Intel MP configuration table string \"%s\" "
9610292SAndreas.Sandberg@ARM.com             "will be truncated to \"%s\".\n", str, (char *)&cleanedString);
975625Sgblack@eecs.umich.edu    } else {
985625Sgblack@eecs.umich.edu        memcpy(cleanedString, str.c_str(), str.length());
995625Sgblack@eecs.umich.edu        memset(cleanedString + str.length(), 0, length - str.length());
1005625Sgblack@eecs.umich.edu    }
10114010Sgabeblack@google.com    proxy.writeBlob(addr, &cleanedString, length);
1025625Sgblack@eecs.umich.edu
1035625Sgblack@eecs.umich.edu    uint8_t checkSum = 0;
1045625Sgblack@eecs.umich.edu    for (int i = 0; i < length; i++)
1055625Sgblack@eecs.umich.edu        checkSum += cleanedString[i];
1065625Sgblack@eecs.umich.edu
1075625Sgblack@eecs.umich.edu    return checkSum;
1085625Sgblack@eecs.umich.edu}
1095625Sgblack@eecs.umich.edu
1105625Sgblack@eecs.umich.eduAddr
1118852Sandreas.hansson@arm.comX86ISA::IntelMP::FloatingPointer::writeOut(PortProxy& proxy, Addr addr)
1125625Sgblack@eecs.umich.edu{
1135625Sgblack@eecs.umich.edu    // Make sure that either a config table is present or a default
1145625Sgblack@eecs.umich.edu    // configuration was found but not both.
1155625Sgblack@eecs.umich.edu    if (!tableAddr && !defaultConfig)
1165625Sgblack@eecs.umich.edu        fatal("Either an MP configuration table or a default configuration "
1175625Sgblack@eecs.umich.edu                "must be used.");
1185625Sgblack@eecs.umich.edu    if (tableAddr && defaultConfig)
1195625Sgblack@eecs.umich.edu        fatal("Both an MP configuration table and a default configuration "
1205625Sgblack@eecs.umich.edu                "were set.");
1215625Sgblack@eecs.umich.edu
1225625Sgblack@eecs.umich.edu    uint8_t checkSum = 0;
1235625Sgblack@eecs.umich.edu
12414010Sgabeblack@google.com    proxy.writeBlob(addr, signature, 4);
1255625Sgblack@eecs.umich.edu    for (int i = 0; i < 4; i++)
1265625Sgblack@eecs.umich.edu        checkSum += signature[i];
1275625Sgblack@eecs.umich.edu
1288706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, tableAddr);
1295625Sgblack@eecs.umich.edu
1305625Sgblack@eecs.umich.edu    // The length of the structure in paragraphs, aka 16 byte chunks.
1315625Sgblack@eecs.umich.edu    uint8_t length = 1;
1328852Sandreas.hansson@arm.com    proxy.writeBlob(addr + 8, &length, 1);
1335625Sgblack@eecs.umich.edu    checkSum += length;
1345625Sgblack@eecs.umich.edu
1358852Sandreas.hansson@arm.com    proxy.writeBlob(addr + 9, &specRev, 1);
1365625Sgblack@eecs.umich.edu    checkSum += specRev;
1375625Sgblack@eecs.umich.edu
1388852Sandreas.hansson@arm.com    proxy.writeBlob(addr + 11, &defaultConfig, 1);
1395625Sgblack@eecs.umich.edu    checkSum += defaultConfig;
1405625Sgblack@eecs.umich.edu
1415625Sgblack@eecs.umich.edu    uint32_t features2_5 = imcrPresent ? (1 << 7) : 0;
1428706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 12, features2_5);
1435625Sgblack@eecs.umich.edu
1445625Sgblack@eecs.umich.edu    checkSum = -checkSum;
1458852Sandreas.hansson@arm.com    proxy.writeBlob(addr + 10, &checkSum, 1);
1465625Sgblack@eecs.umich.edu
1475625Sgblack@eecs.umich.edu    return 16;
1485625Sgblack@eecs.umich.edu}
1495625Sgblack@eecs.umich.edu
1505625Sgblack@eecs.umich.eduX86ISA::IntelMP::FloatingPointer::FloatingPointer(Params * p) :
1515625Sgblack@eecs.umich.edu    SimObject(p), tableAddr(0), specRev(p->spec_rev),
1525625Sgblack@eecs.umich.edu    defaultConfig(p->default_config), imcrPresent(p->imcr_present)
1535625Sgblack@eecs.umich.edu{}
1545625Sgblack@eecs.umich.edu
1555625Sgblack@eecs.umich.eduX86ISA::IntelMP::FloatingPointer *
1565625Sgblack@eecs.umich.eduX86IntelMPFloatingPointerParams::create()
1575625Sgblack@eecs.umich.edu{
1585625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::FloatingPointer(this);
1595625Sgblack@eecs.umich.edu}
1605625Sgblack@eecs.umich.edu
1615625Sgblack@eecs.umich.eduAddr
1628852Sandreas.hansson@arm.comX86ISA::IntelMP::BaseConfigEntry::writeOut(PortProxy& proxy,
1635625Sgblack@eecs.umich.edu        Addr addr, uint8_t &checkSum)
1645625Sgblack@eecs.umich.edu{
1658852Sandreas.hansson@arm.com    proxy.writeBlob(addr, &type, 1);
1665625Sgblack@eecs.umich.edu    checkSum += type;
1675625Sgblack@eecs.umich.edu    return 1;
1685625Sgblack@eecs.umich.edu}
1695625Sgblack@eecs.umich.edu
1705625Sgblack@eecs.umich.eduX86ISA::IntelMP::BaseConfigEntry::BaseConfigEntry(Params * p, uint8_t _type) :
1715625Sgblack@eecs.umich.edu    SimObject(p), type(_type)
1725625Sgblack@eecs.umich.edu{}
1735625Sgblack@eecs.umich.edu
1745625Sgblack@eecs.umich.eduAddr
1758852Sandreas.hansson@arm.comX86ISA::IntelMP::ExtConfigEntry::writeOut(PortProxy& proxy,
1765625Sgblack@eecs.umich.edu        Addr addr, uint8_t &checkSum)
1775625Sgblack@eecs.umich.edu{
1788852Sandreas.hansson@arm.com    proxy.writeBlob(addr, &type, 1);
1795625Sgblack@eecs.umich.edu    checkSum += type;
1808852Sandreas.hansson@arm.com    proxy.writeBlob(addr + 1, &length, 1);
1815625Sgblack@eecs.umich.edu    checkSum += length;
1825625Sgblack@eecs.umich.edu    return 1;
1835625Sgblack@eecs.umich.edu}
1845625Sgblack@eecs.umich.edu
1855625Sgblack@eecs.umich.eduX86ISA::IntelMP::ExtConfigEntry::ExtConfigEntry(Params * p,
1865625Sgblack@eecs.umich.edu        uint8_t _type, uint8_t _length) :
1875625Sgblack@eecs.umich.edu    SimObject(p), type(_type), length(_length)
1885625Sgblack@eecs.umich.edu{}
1895625Sgblack@eecs.umich.edu
1905625Sgblack@eecs.umich.educonst char X86ISA::IntelMP::ConfigTable::signature[] = "PCMP";
1915625Sgblack@eecs.umich.edu
1925625Sgblack@eecs.umich.eduAddr
1938852Sandreas.hansson@arm.comX86ISA::IntelMP::ConfigTable::writeOut(PortProxy& proxy, Addr addr)
1945625Sgblack@eecs.umich.edu{
1955625Sgblack@eecs.umich.edu    uint8_t checkSum = 0;
1965625Sgblack@eecs.umich.edu
19714010Sgabeblack@google.com    proxy.writeBlob(addr, signature, 4);
1985625Sgblack@eecs.umich.edu    for (int i = 0; i < 4; i++)
1995625Sgblack@eecs.umich.edu        checkSum += signature[i];
2005625Sgblack@eecs.umich.edu
2015625Sgblack@eecs.umich.edu    // Base table length goes here but will be calculated later.
2025625Sgblack@eecs.umich.edu
20314010Sgabeblack@google.com    proxy.writeBlob(addr + 6, &specRev, 1);
2045625Sgblack@eecs.umich.edu    checkSum += specRev;
2055625Sgblack@eecs.umich.edu
2065625Sgblack@eecs.umich.edu    // The checksum goes here but is still being calculated.
2075625Sgblack@eecs.umich.edu
2088706Sandreas.hansson@arm.com    checkSum += writeOutString(proxy, addr + 8, oemID, 8);
2098706Sandreas.hansson@arm.com    checkSum += writeOutString(proxy, addr + 16, productID, 12);
2105625Sgblack@eecs.umich.edu
2118706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 28, oemTableAddr);
2128706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 32, oemTableSize);
2138706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 34, (uint16_t)baseEntries.size());
2148706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 36, localApic);
2155625Sgblack@eecs.umich.edu
2165625Sgblack@eecs.umich.edu    uint8_t reserved = 0;
2178852Sandreas.hansson@arm.com    proxy.writeBlob(addr + 43, &reserved, 1);
2185625Sgblack@eecs.umich.edu    checkSum += reserved;
2195625Sgblack@eecs.umich.edu
2205625Sgblack@eecs.umich.edu    vector<BaseConfigEntry *>::iterator baseEnt;
2215625Sgblack@eecs.umich.edu    uint16_t offset = 44;
2225625Sgblack@eecs.umich.edu    for (baseEnt = baseEntries.begin();
2235625Sgblack@eecs.umich.edu            baseEnt != baseEntries.end(); baseEnt++) {
2248706Sandreas.hansson@arm.com        offset += (*baseEnt)->writeOut(proxy, addr + offset, checkSum);
2255625Sgblack@eecs.umich.edu    }
2265625Sgblack@eecs.umich.edu
2275625Sgblack@eecs.umich.edu    // We've found the end of the base table this point.
2288706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, offset);
2295625Sgblack@eecs.umich.edu
2305625Sgblack@eecs.umich.edu    vector<ExtConfigEntry *>::iterator extEnt;
2315625Sgblack@eecs.umich.edu    uint16_t extOffset = 0;
2325625Sgblack@eecs.umich.edu    uint8_t extCheckSum = 0;
2335625Sgblack@eecs.umich.edu    for (extEnt = extEntries.begin();
2345625Sgblack@eecs.umich.edu            extEnt != extEntries.end(); extEnt++) {
2358706Sandreas.hansson@arm.com        extOffset += (*extEnt)->writeOut(proxy,
2365625Sgblack@eecs.umich.edu                addr + offset + extOffset, extCheckSum);
2375625Sgblack@eecs.umich.edu    }
2385625Sgblack@eecs.umich.edu
2398706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 40, extOffset);
2405625Sgblack@eecs.umich.edu    extCheckSum = -extCheckSum;
2418706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 42, extCheckSum);
2425625Sgblack@eecs.umich.edu
2435625Sgblack@eecs.umich.edu    // And now, we finally have the whole check sum completed.
2445625Sgblack@eecs.umich.edu    checkSum = -checkSum;
2458706Sandreas.hansson@arm.com    writeOutField(proxy, addr + 7, checkSum);
2465625Sgblack@eecs.umich.edu
2475625Sgblack@eecs.umich.edu    return offset + extOffset;
2485625Sgblack@eecs.umich.edu};
2495625Sgblack@eecs.umich.edu
2505625Sgblack@eecs.umich.eduX86ISA::IntelMP::ConfigTable::ConfigTable(Params * p) : SimObject(p),
2515625Sgblack@eecs.umich.edu    specRev(p->spec_rev), oemID(p->oem_id), productID(p->product_id),
2525625Sgblack@eecs.umich.edu    oemTableAddr(p->oem_table_addr), oemTableSize(p->oem_table_size),
2535625Sgblack@eecs.umich.edu    localApic(p->local_apic),
2545625Sgblack@eecs.umich.edu    baseEntries(p->base_entries), extEntries(p->ext_entries)
2555625Sgblack@eecs.umich.edu{}
2565625Sgblack@eecs.umich.edu
2575625Sgblack@eecs.umich.eduX86ISA::IntelMP::ConfigTable *
2585625Sgblack@eecs.umich.eduX86IntelMPConfigTableParams::create()
2595625Sgblack@eecs.umich.edu{
2605625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::ConfigTable(this);
2615625Sgblack@eecs.umich.edu}
2625625Sgblack@eecs.umich.edu
2635625Sgblack@eecs.umich.eduAddr
2645625Sgblack@eecs.umich.eduX86ISA::IntelMP::Processor::writeOut(
2658852Sandreas.hansson@arm.com        PortProxy& proxy, Addr addr, uint8_t &checkSum)
2665625Sgblack@eecs.umich.edu{
2678706Sandreas.hansson@arm.com    BaseConfigEntry::writeOut(proxy, addr, checkSum);
2688706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 1, localApicID);
2698706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 2, localApicVersion);
2708706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 3, cpuFlags);
2718706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, cpuSignature);
2728706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 8, featureFlags);
2735625Sgblack@eecs.umich.edu
2745625Sgblack@eecs.umich.edu    uint32_t reserved = 0;
27514010Sgabeblack@google.com    proxy.writeBlob(addr + 12, &reserved, 4);
27614010Sgabeblack@google.com    proxy.writeBlob(addr + 16, &reserved, 4);
2775625Sgblack@eecs.umich.edu    return 20;
2785625Sgblack@eecs.umich.edu}
2795625Sgblack@eecs.umich.edu
2805625Sgblack@eecs.umich.eduX86ISA::IntelMP::Processor::Processor(Params * p) : BaseConfigEntry(p, 0),
2815625Sgblack@eecs.umich.edu    localApicID(p->local_apic_id), localApicVersion(p->local_apic_version),
2825625Sgblack@eecs.umich.edu    cpuFlags(0), cpuSignature(0), featureFlags(p->feature_flags)
2835625Sgblack@eecs.umich.edu{
2845625Sgblack@eecs.umich.edu    if (p->enable)
2855625Sgblack@eecs.umich.edu        cpuFlags |= (1 << 0);
2865625Sgblack@eecs.umich.edu    if (p->bootstrap)
2875625Sgblack@eecs.umich.edu        cpuFlags |= (1 << 1);
2885625Sgblack@eecs.umich.edu
2895625Sgblack@eecs.umich.edu    replaceBits(cpuSignature, 0, 3, p->stepping);
2905625Sgblack@eecs.umich.edu    replaceBits(cpuSignature, 4, 7, p->model);
2915625Sgblack@eecs.umich.edu    replaceBits(cpuSignature, 8, 11, p->family);
2925625Sgblack@eecs.umich.edu}
2935625Sgblack@eecs.umich.edu
2945625Sgblack@eecs.umich.eduX86ISA::IntelMP::Processor *
2955625Sgblack@eecs.umich.eduX86IntelMPProcessorParams::create()
2965625Sgblack@eecs.umich.edu{
2975625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::Processor(this);
2985625Sgblack@eecs.umich.edu}
2995625Sgblack@eecs.umich.edu
3005625Sgblack@eecs.umich.eduAddr
3015625Sgblack@eecs.umich.eduX86ISA::IntelMP::Bus::writeOut(
3028852Sandreas.hansson@arm.com        PortProxy& proxy, Addr addr, uint8_t &checkSum)
3035625Sgblack@eecs.umich.edu{
3048706Sandreas.hansson@arm.com    BaseConfigEntry::writeOut(proxy, addr, checkSum);
3058706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 1, busID);
3068706Sandreas.hansson@arm.com    checkSum += writeOutString(proxy, addr + 2, busType, 6);
3075625Sgblack@eecs.umich.edu    return 8;
3085625Sgblack@eecs.umich.edu}
3095625Sgblack@eecs.umich.edu
3105625Sgblack@eecs.umich.eduX86ISA::IntelMP::Bus::Bus(Params * p) : BaseConfigEntry(p, 1),
3115625Sgblack@eecs.umich.edu    busID(p->bus_id), busType(p->bus_type)
3125625Sgblack@eecs.umich.edu{}
3135625Sgblack@eecs.umich.edu
3145625Sgblack@eecs.umich.eduX86ISA::IntelMP::Bus *
3155625Sgblack@eecs.umich.eduX86IntelMPBusParams::create()
3165625Sgblack@eecs.umich.edu{
3175625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::Bus(this);
3185625Sgblack@eecs.umich.edu}
3195625Sgblack@eecs.umich.edu
3205625Sgblack@eecs.umich.eduAddr
3215625Sgblack@eecs.umich.eduX86ISA::IntelMP::IOAPIC::writeOut(
3228852Sandreas.hansson@arm.com        PortProxy& proxy, Addr addr, uint8_t &checkSum)
3235625Sgblack@eecs.umich.edu{
3248706Sandreas.hansson@arm.com    BaseConfigEntry::writeOut(proxy, addr, checkSum);
3258706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 1, id);
3268706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 2, version);
3278706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 3, flags);
3288706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, address);
3295625Sgblack@eecs.umich.edu    return 8;
3305625Sgblack@eecs.umich.edu}
3315625Sgblack@eecs.umich.edu
3325625Sgblack@eecs.umich.eduX86ISA::IntelMP::IOAPIC::IOAPIC(Params * p) : BaseConfigEntry(p, 2),
3335625Sgblack@eecs.umich.edu    id(p->id), version(p->version), flags(0), address(p->address)
3345625Sgblack@eecs.umich.edu{
3355625Sgblack@eecs.umich.edu    if (p->enable)
3365625Sgblack@eecs.umich.edu        flags |= 1;
3375625Sgblack@eecs.umich.edu}
3385625Sgblack@eecs.umich.edu
3395625Sgblack@eecs.umich.eduX86ISA::IntelMP::IOAPIC *
3405625Sgblack@eecs.umich.eduX86IntelMPIOAPICParams::create()
3415625Sgblack@eecs.umich.edu{
3425625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::IOAPIC(this);
3435625Sgblack@eecs.umich.edu}
3445625Sgblack@eecs.umich.edu
3455625Sgblack@eecs.umich.eduAddr
3465625Sgblack@eecs.umich.eduX86ISA::IntelMP::IntAssignment::writeOut(
3478852Sandreas.hansson@arm.com        PortProxy& proxy, Addr addr, uint8_t &checkSum)
3485625Sgblack@eecs.umich.edu{
3498706Sandreas.hansson@arm.com    BaseConfigEntry::writeOut(proxy, addr, checkSum);
3508706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 1, interruptType);
3518706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 2, flags);
3528706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, sourceBusID);
3538706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 5, sourceBusIRQ);
3548706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 6, destApicID);
3558706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 7, destApicIntIn);
3565625Sgblack@eecs.umich.edu    return 8;
3575625Sgblack@eecs.umich.edu}
3585625Sgblack@eecs.umich.edu
3595625Sgblack@eecs.umich.eduX86ISA::IntelMP::IOIntAssignment::IOIntAssignment(Params * p) :
3605625Sgblack@eecs.umich.edu    IntAssignment(p, p->interrupt_type, p->polarity, p->trigger, 3,
3615625Sgblack@eecs.umich.edu            p->source_bus_id, p->source_bus_irq,
3625625Sgblack@eecs.umich.edu            p->dest_io_apic_id, p->dest_io_apic_intin)
3635625Sgblack@eecs.umich.edu{}
3645625Sgblack@eecs.umich.edu
3655625Sgblack@eecs.umich.eduX86ISA::IntelMP::IOIntAssignment *
3665625Sgblack@eecs.umich.eduX86IntelMPIOIntAssignmentParams::create()
3675625Sgblack@eecs.umich.edu{
3685625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::IOIntAssignment(this);
3695625Sgblack@eecs.umich.edu}
3705625Sgblack@eecs.umich.edu
3715625Sgblack@eecs.umich.eduX86ISA::IntelMP::LocalIntAssignment::LocalIntAssignment(Params * p) :
3725625Sgblack@eecs.umich.edu    IntAssignment(p, p->interrupt_type, p->polarity, p->trigger, 4,
3735625Sgblack@eecs.umich.edu            p->source_bus_id, p->source_bus_irq,
3745625Sgblack@eecs.umich.edu            p->dest_local_apic_id, p->dest_local_apic_intin)
3755625Sgblack@eecs.umich.edu{}
3765625Sgblack@eecs.umich.edu
3775625Sgblack@eecs.umich.eduX86ISA::IntelMP::LocalIntAssignment *
3785625Sgblack@eecs.umich.eduX86IntelMPLocalIntAssignmentParams::create()
3795625Sgblack@eecs.umich.edu{
3805625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::LocalIntAssignment(this);
3815625Sgblack@eecs.umich.edu}
3825625Sgblack@eecs.umich.edu
3835625Sgblack@eecs.umich.eduAddr
3845625Sgblack@eecs.umich.eduX86ISA::IntelMP::AddrSpaceMapping::writeOut(
3858852Sandreas.hansson@arm.com        PortProxy& proxy, Addr addr, uint8_t &checkSum)
3865625Sgblack@eecs.umich.edu{
3878706Sandreas.hansson@arm.com    ExtConfigEntry::writeOut(proxy, addr, checkSum);
3888706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 2, busID);
3898706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 3, addrType);
3908706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, addr);
3918706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 12, addrLength);
3925625Sgblack@eecs.umich.edu    return length;
3935625Sgblack@eecs.umich.edu}
3945625Sgblack@eecs.umich.edu
3955625Sgblack@eecs.umich.eduX86ISA::IntelMP::AddrSpaceMapping::AddrSpaceMapping(Params * p) :
3965625Sgblack@eecs.umich.edu    ExtConfigEntry(p, 128, 20),
3975625Sgblack@eecs.umich.edu    busID(p->bus_id), addrType(p->address_type),
3985625Sgblack@eecs.umich.edu    addr(p->address), addrLength(p->length)
3995625Sgblack@eecs.umich.edu{}
4005625Sgblack@eecs.umich.edu
4015625Sgblack@eecs.umich.eduX86ISA::IntelMP::AddrSpaceMapping *
4025625Sgblack@eecs.umich.eduX86IntelMPAddrSpaceMappingParams::create()
4035625Sgblack@eecs.umich.edu{
4045625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::AddrSpaceMapping(this);
4055625Sgblack@eecs.umich.edu}
4065625Sgblack@eecs.umich.edu
4075625Sgblack@eecs.umich.eduAddr
4085625Sgblack@eecs.umich.eduX86ISA::IntelMP::BusHierarchy::writeOut(
4098852Sandreas.hansson@arm.com        PortProxy& proxy, Addr addr, uint8_t &checkSum)
4105625Sgblack@eecs.umich.edu{
4118706Sandreas.hansson@arm.com    ExtConfigEntry::writeOut(proxy, addr, checkSum);
4128706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 2, busID);
4138706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 3, info);
4148706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, parentBus);
4155625Sgblack@eecs.umich.edu
4165625Sgblack@eecs.umich.edu    uint32_t reserved = 0;
41714010Sgabeblack@google.com    proxy.writeBlob(addr + 5, &reserved, 3);
4185625Sgblack@eecs.umich.edu
4195625Sgblack@eecs.umich.edu    return length;
4205625Sgblack@eecs.umich.edu}
4215625Sgblack@eecs.umich.edu
4225625Sgblack@eecs.umich.eduX86ISA::IntelMP::BusHierarchy::BusHierarchy(Params * p) :
4235625Sgblack@eecs.umich.edu    ExtConfigEntry(p, 129, 8),
4245625Sgblack@eecs.umich.edu    busID(p->bus_id), info(0), parentBus(p->parent_bus)
4255625Sgblack@eecs.umich.edu{
4265625Sgblack@eecs.umich.edu    if (p->subtractive_decode)
4275625Sgblack@eecs.umich.edu        info |= 1;
4285625Sgblack@eecs.umich.edu}
4295625Sgblack@eecs.umich.edu
4305625Sgblack@eecs.umich.eduX86ISA::IntelMP::BusHierarchy *
4315625Sgblack@eecs.umich.eduX86IntelMPBusHierarchyParams::create()
4325625Sgblack@eecs.umich.edu{
4335625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::BusHierarchy(this);
4345625Sgblack@eecs.umich.edu}
4355625Sgblack@eecs.umich.edu
4365625Sgblack@eecs.umich.eduAddr
4375625Sgblack@eecs.umich.eduX86ISA::IntelMP::CompatAddrSpaceMod::writeOut(
4388852Sandreas.hansson@arm.com        PortProxy& proxy, Addr addr, uint8_t &checkSum)
4395625Sgblack@eecs.umich.edu{
4408706Sandreas.hansson@arm.com    ExtConfigEntry::writeOut(proxy, addr, checkSum);
4418706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 2, busID);
4428706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 3, mod);
4438706Sandreas.hansson@arm.com    checkSum += writeOutField(proxy, addr + 4, rangeList);
4445625Sgblack@eecs.umich.edu    return length;
4455625Sgblack@eecs.umich.edu}
4465625Sgblack@eecs.umich.edu
4475625Sgblack@eecs.umich.eduX86ISA::IntelMP::CompatAddrSpaceMod::CompatAddrSpaceMod(Params * p) :
4485625Sgblack@eecs.umich.edu    ExtConfigEntry(p, 130, 8),
4495625Sgblack@eecs.umich.edu    busID(p->bus_id), mod(0), rangeList(p->range_list)
4505625Sgblack@eecs.umich.edu{
4515625Sgblack@eecs.umich.edu    if (p->add)
4525625Sgblack@eecs.umich.edu        mod |= 1;
4535625Sgblack@eecs.umich.edu}
4545625Sgblack@eecs.umich.edu
4555625Sgblack@eecs.umich.eduX86ISA::IntelMP::CompatAddrSpaceMod *
4565625Sgblack@eecs.umich.eduX86IntelMPCompatAddrSpaceModParams::create()
4575625Sgblack@eecs.umich.edu{
4585625Sgblack@eecs.umich.edu    return new X86ISA::IntelMP::CompatAddrSpaceMod(this);
4595625Sgblack@eecs.umich.edu}
460