diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2008-10-10 03:50:51 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2008-10-10 03:50:51 -0700 |
commit | ec0fb05d643323ae036156be76acd42c8275a2f4 (patch) | |
tree | 3ef01f529f108643ee9f94fe106741dace81d77a /src/arch/x86/system.cc | |
parent | 9be6e082270aad53f8ba40bf66a91fcf176a45ab (diff) | |
download | gem5-ec0fb05d643323ae036156be76acd42c8275a2f4.tar.xz |
X86: Turn SMBios structures into simobjects.
Diffstat (limited to 'src/arch/x86/system.cc')
-rw-r--r-- | src/arch/x86/system.cc | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/arch/x86/system.cc b/src/arch/x86/system.cc index 48f34918d..9006ce227 100644 --- a/src/arch/x86/system.cc +++ b/src/arch/x86/system.cc @@ -73,13 +73,8 @@ using namespace LittleEndianGuest; using namespace X86ISA; X86System::X86System(Params *p) - : System(p) -{ - smbiosTable = new X86ISA::SMBios::SMBiosTable; - smbiosTable->smbiosHeader.majorVersion = 2; - smbiosTable->smbiosHeader.minorVersion = 5; - smbiosTable->smbiosHeader.intermediateHeader.smbiosBCDRevision = 0x25; -} + : System(p), smbiosTable(p->smbios_table) +{} void X86System::startup() @@ -236,27 +231,33 @@ X86System::startup() // We should now be in long mode. Yay! + Addr ebdaPos = 0xF0000; + + Addr headerSize, structSize; //Write out the SMBios/DMI table - writeOutSMBiosTable(0xF0000); + writeOutSMBiosTable(ebdaPos, headerSize, structSize); + ebdaPos += (headerSize + structSize); } void -X86System::writeOutSMBiosTable(Addr header, Addr table) +X86System::writeOutSMBiosTable(Addr header, + Addr &headerSize, Addr &structSize, Addr table) { // Get a port to write the table and header to memory. FunctionalPort * physPort = threadContexts[0]->getPhysPort(); // If the table location isn't specified, just put it after the header. // The header size as of the 2.5 SMBios specification is 0x1F bytes - if (!table) { - if (!smbiosTable->smbiosHeader.intermediateHeader.tableAddr) - smbiosTable->smbiosHeader. - intermediateHeader.tableAddr = header + 0x1F; - } else { - smbiosTable->smbiosHeader.intermediateHeader.tableAddr = table; - } + if (!table) + table = header + 0x1F; + smbiosTable->setTableAddr(table); + + smbiosTable->writeOut(physPort, header, headerSize, structSize); - smbiosTable->writeOut(physPort, header); + // Do some bounds checking to make sure we at least didn't step on + // ourselves. + assert(header > table || header + headerSize <= table); + assert(table > header || table + structSize <= header); } |