2 * Copyright (c) 2008 The Hewlett-Packard Development Company
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #ifndef __ARCH_X86_BIOS_INTELMP_HH__
41 #define __ARCH_X86_BIOS_INTELMP_HH__
46 #include "base/bitfield.hh"
47 #include "enums/X86IntelMPAddressType.hh"
48 #include "enums/X86IntelMPInterruptType.hh"
49 #include "enums/X86IntelMPPolarity.hh"
50 #include "enums/X86IntelMPRangeList.hh"
51 #include "enums/X86IntelMPTriggerMode.hh"
52 #include "sim/sim_object.hh"
57 struct X86IntelMPBaseConfigEntryParams;
58 struct X86IntelMPExtConfigEntryParams;
60 // General table structures
61 struct X86IntelMPConfigTableParams;
62 struct X86IntelMPFloatingPointerParams;
65 struct X86IntelMPBusParams;
66 struct X86IntelMPIOAPICParams;
67 struct X86IntelMPIOIntAssignmentParams;
68 struct X86IntelMPLocalIntAssignmentParams;
69 struct X86IntelMPProcessorParams;
71 // Extended entry types
72 struct X86IntelMPAddrSpaceMappingParams;
73 struct X86IntelMPBusHierarchyParams;
74 struct X86IntelMPCompatAddrSpaceModParams;
77 uint8_t writeOutField(PortProxy& proxy, Addr addr, T val);
79 uint8_t writeOutString(PortProxy& proxy, Addr addr, std::string str,
88 class FloatingPointer : public SimObject
91 typedef X86IntelMPFloatingPointerParams Params;
95 uint8_t defaultConfig;
98 static const char signature[];
102 Addr writeOut(PortProxy& proxy, Addr addr);
109 void setTableAddr(Addr addr)
114 FloatingPointer(Params * p);
117 class BaseConfigEntry : public SimObject
120 typedef X86IntelMPBaseConfigEntryParams Params;
126 virtual Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
128 BaseConfigEntry(Params * p, uint8_t _type);
131 class ExtConfigEntry : public SimObject
134 typedef X86IntelMPExtConfigEntryParams Params;
141 virtual Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
143 ExtConfigEntry(Params * p, uint8_t _type, uint8_t _length);
146 class ConfigTable : public SimObject
149 typedef X86IntelMPConfigTableParams Params;
151 static const char signature[];
155 std::string productID;
156 uint32_t oemTableAddr;
157 uint16_t oemTableSize;
160 std::vector<BaseConfigEntry *> baseEntries;
161 std::vector<ExtConfigEntry *> extEntries;
164 Addr writeOut(PortProxy& proxy, Addr addr);
166 ConfigTable(Params * p);
169 class Processor : public BaseConfigEntry
172 typedef X86IntelMPProcessorParams Params;
175 uint8_t localApicVersion;
177 uint32_t cpuSignature;
178 uint32_t featureFlags;
181 Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
183 Processor(Params * p);
186 class Bus : public BaseConfigEntry
189 typedef X86IntelMPBusParams Params;
195 Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
200 class IOAPIC : public BaseConfigEntry
203 typedef X86IntelMPIOAPICParams Params;
211 Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
216 class IntAssignment : public BaseConfigEntry
219 uint8_t interruptType;
224 uint8_t sourceBusIRQ;
227 uint8_t destApicIntIn;
230 Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
232 IntAssignment(X86IntelMPBaseConfigEntryParams * p,
233 Enums::X86IntelMPInterruptType _interruptType,
234 Enums::X86IntelMPPolarity polarity,
235 Enums::X86IntelMPTriggerMode trigger,
237 uint8_t _sourceBusID, uint8_t _sourceBusIRQ,
238 uint8_t _destApicID, uint8_t _destApicIntIn) :
239 BaseConfigEntry(p, _type),
240 interruptType(_interruptType), flags(0),
241 sourceBusID(_sourceBusID), sourceBusIRQ(_sourceBusIRQ),
242 destApicID(_destApicID), destApicIntIn(_destApicIntIn)
244 replaceBits(flags, 0, 1, polarity);
245 replaceBits(flags, 2, 3, trigger);
249 class IOIntAssignment : public IntAssignment
252 typedef X86IntelMPIOIntAssignmentParams Params;
255 IOIntAssignment(Params * p);
258 class LocalIntAssignment : public IntAssignment
261 typedef X86IntelMPLocalIntAssignmentParams Params;
264 LocalIntAssignment(Params * p);
267 class AddrSpaceMapping : public ExtConfigEntry
270 typedef X86IntelMPAddrSpaceMappingParams Params;
278 Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
280 AddrSpaceMapping(Params * p);
283 class BusHierarchy : public ExtConfigEntry
286 typedef X86IntelMPBusHierarchyParams Params;
293 Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
295 BusHierarchy(Params * p);
298 class CompatAddrSpaceMod : public ExtConfigEntry
301 typedef X86IntelMPCompatAddrSpaceModParams Params;
308 Addr writeOut(PortProxy& proxy, Addr addr, uint8_t &checkSum);
310 CompatAddrSpaceMod(Params * p);