system.cc (5615:1c4b9b1aa500) system.cc (5625:ea7d3676ac8d)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 42 unchanged lines hidden (view full) ---

51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 *
55 * Authors: Gabe Black
56 */
57
58#include "arch/x86/bios/smbios.hh"
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 42 unchanged lines hidden (view full) ---

51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 *
55 * Authors: Gabe Black
56 */
57
58#include "arch/x86/bios/smbios.hh"
59#include "arch/x86/bios/intelmp.hh"
59#include "arch/x86/miscregs.hh"
60#include "arch/x86/system.hh"
61#include "arch/vtophys.hh"
60#include "arch/x86/miscregs.hh"
61#include "arch/x86/system.hh"
62#include "arch/vtophys.hh"
62#include "base/remote_gdb.hh"
63#include "base/intmath.hh"
63#include "base/loader/object_file.hh"
64#include "base/loader/symtab.hh"
64#include "base/loader/object_file.hh"
65#include "base/loader/symtab.hh"
66#include "base/remote_gdb.hh"
65#include "base/trace.hh"
66#include "cpu/thread_context.hh"
67#include "mem/physical.hh"
68#include "params/X86System.hh"
69#include "sim/byteswap.hh"
70
71
72using namespace LittleEndianGuest;
73using namespace X86ISA;
74
67#include "base/trace.hh"
68#include "cpu/thread_context.hh"
69#include "mem/physical.hh"
70#include "params/X86System.hh"
71#include "sim/byteswap.hh"
72
73
74using namespace LittleEndianGuest;
75using namespace X86ISA;
76
75X86System::X86System(Params *p)
76 : System(p), smbiosTable(p->smbios_table)
77X86System::X86System(Params *p) :
78 System(p), smbiosTable(p->smbios_table),
79 mpFloatingPointer(p->intel_mp_pointer),
80 mpConfigTable(p->intel_mp_table)
77{}
78
79void
80X86System::startup()
81{
82 System::startup();
83 // This is the boot strap processor (BSP). Initialize it to look like
84 // the boot loader has just turned control over to the 64 bit OS. We

--- 142 unchanged lines hidden (view full) ---

227 threadContexts[0]->setMiscReg(MISCREG_CS_ATTR, csAttr);
228
229 threadContexts[0]->setPC(threadContexts[0]->getSystemPtr()->kernelEntry);
230 threadContexts[0]->setNextPC(threadContexts[0]->readPC());
231
232 // We should now be in long mode. Yay!
233
234 Addr ebdaPos = 0xF0000;
81{}
82
83void
84X86System::startup()
85{
86 System::startup();
87 // This is the boot strap processor (BSP). Initialize it to look like
88 // the boot loader has just turned control over to the 64 bit OS. We

--- 142 unchanged lines hidden (view full) ---

231 threadContexts[0]->setMiscReg(MISCREG_CS_ATTR, csAttr);
232
233 threadContexts[0]->setPC(threadContexts[0]->getSystemPtr()->kernelEntry);
234 threadContexts[0]->setNextPC(threadContexts[0]->readPC());
235
236 // We should now be in long mode. Yay!
237
238 Addr ebdaPos = 0xF0000;
239 Addr fixed, table;
235
240
236 Addr headerSize, structSize;
237 //Write out the SMBios/DMI table
241 //Write out the SMBios/DMI table
238 writeOutSMBiosTable(ebdaPos, headerSize, structSize);
239 ebdaPos += (headerSize + structSize);
242 writeOutSMBiosTable(ebdaPos, fixed, table);
243 ebdaPos += (fixed + table);
244 ebdaPos = roundUp(ebdaPos, 16);
245
246 //Write out the Intel MP Specification configuration table
247 writeOutMPTable(ebdaPos, fixed, table);
248 ebdaPos += (fixed + table);
240}
241
242void
243X86System::writeOutSMBiosTable(Addr header,
244 Addr &headerSize, Addr &structSize, Addr table)
245{
246 // Get a port to write the table and header to memory.
247 FunctionalPort * physPort = threadContexts[0]->getPhysPort();

--- 7 unchanged lines hidden (view full) ---

255 smbiosTable->writeOut(physPort, header, headerSize, structSize);
256
257 // Do some bounds checking to make sure we at least didn't step on
258 // ourselves.
259 assert(header > table || header + headerSize <= table);
260 assert(table > header || table + structSize <= header);
261}
262
249}
250
251void
252X86System::writeOutSMBiosTable(Addr header,
253 Addr &headerSize, Addr &structSize, Addr table)
254{
255 // Get a port to write the table and header to memory.
256 FunctionalPort * physPort = threadContexts[0]->getPhysPort();

--- 7 unchanged lines hidden (view full) ---

264 smbiosTable->writeOut(physPort, header, headerSize, structSize);
265
266 // Do some bounds checking to make sure we at least didn't step on
267 // ourselves.
268 assert(header > table || header + headerSize <= table);
269 assert(table > header || table + structSize <= header);
270}
271
272void
273X86System::writeOutMPTable(Addr fp,
274 Addr &fpSize, Addr &tableSize, Addr table)
275{
276 // Get a port to write the table and header to memory.
277 FunctionalPort * physPort = threadContexts[0]->getPhysPort();
263
278
279 // If the table location isn't specified and it exists, just put
280 // it after the floating pointer. The fp size as of the 1.4 Intel MP
281 // specification is 0x10 bytes.
282 if (mpConfigTable) {
283 if (!table)
284 table = fp + 0x10;
285 mpFloatingPointer->setTableAddr(table);
286 }
287
288 fpSize = mpFloatingPointer->writeOut(physPort, fp);
289 if (mpConfigTable)
290 tableSize = mpConfigTable->writeOut(physPort, table);
291 else
292 tableSize = 0;
293
294 // Do some bounds checking to make sure we at least didn't step on
295 // ourselves and the fp structure was the size we thought it was.
296 assert(fp > table || fp + fpSize <= table);
297 assert(table > fp || table + tableSize <= fp);
298 assert(fpSize == 0x10);
299}
300
301
264X86System::~X86System()
265{
266 delete smbiosTable;
267}
268
269void
270X86System::serialize(std::ostream &os)
271{

--- 15 unchanged lines hidden ---
302X86System::~X86System()
303{
304 delete smbiosTable;
305}
306
307void
308X86System::serialize(std::ostream &os)
309{

--- 15 unchanged lines hidden ---