48 #include "params/X86SMBiosBiosInformation.hh" 49 #include "params/X86SMBiosSMBiosStructure.hh" 50 #include "params/X86SMBiosSMBiosTable.hh" 70 typename T::iterator vecIt;
71 for (vecIt = vec.begin(); vecIt != vec.end(); vecIt++) {
72 val |= (1 << (*vecIt));
82 uint8_t
length = getLength();
85 uint16_t handleGuest =
htole(handle);
86 proxy.
writeBlob(addr + 2, &handleGuest, 2);
88 return length + getStringLength();
102 const uint8_t nullTerminator = 0;
107 proxy.
writeBlob(addr + offset, &nullTerminator, 1);
111 proxy.
writeBlob(addr + offset, it->c_str(), it->length() + 1);
112 offset += it->length() + 1;
115 proxy.
writeBlob(addr + offset, &nullTerminator, 1);
125 size += it->length() + 1;
137 if (newString.length() == 0)
146 assert(n > 0 && n <=
strings.size());
153 assert(n > 0 && n <=
strings.size());
159 startingAddrSegment(p->starting_addr_segment),
160 romSize(p->rom_size),
161 majorVer(p->major), minorVer(p->minor),
162 embContFirmwareMajor(p->emb_cont_firmware_major),
163 embContFirmwareMinor(p->emb_cont_firmware_minor)
183 proxy.
writeBlob(addr + 0x6, &startingAddrSegmentGuest, 2);
189 proxy.
writeBlob(addr + 0xA, &characteristicsGuest, 8);
191 uint16_t characteristicExtBytesGuest =
193 proxy.
writeBlob(addr + 0x12, &characteristicExtBytesGuest, 2);
210 assert(p->major_version <= 9);
211 assert(p->minor_version <= 9);
213 (p->major_version << 4) | p->minor_version;
225 uint8_t mainChecksum = 0;
227 proxy.
writeBlob(addr, (uint8_t *)smbiosHeader.anchorString, 4);
228 for (
int i = 0;
i < 4;
i++)
229 mainChecksum += smbiosHeader.anchorString[
i];
233 proxy.
writeBlob(addr + 0x5, &smbiosHeader.entryPointLength, 1);
234 mainChecksum += smbiosHeader.entryPointLength;
235 proxy.
writeBlob(addr + 0x6, &smbiosHeader.majorVersion, 1);
236 mainChecksum += smbiosHeader.majorVersion;
237 proxy.
writeBlob(addr + 0x7, &smbiosHeader.minorVersion, 1);
238 mainChecksum += smbiosHeader.minorVersion;
240 proxy.
writeBlob(addr + 0xA, &smbiosHeader.entryPointRevision, 1);
241 mainChecksum += smbiosHeader.entryPointRevision;
242 proxy.
writeBlob(addr + 0xB, &smbiosHeader.formattedArea, 5);
243 for (
int i = 0;
i < 5;
i++)
244 mainChecksum += smbiosHeader.formattedArea[
i];
249 uint8_t intChecksum = 0;
252 smbiosHeader.intermediateHeader.anchorString, 5);
253 for (
int i = 0;
i < 5;
i++)
254 intChecksum += smbiosHeader.intermediateHeader.anchorString[
i];
259 uint32_t tableAddrGuest =
260 htole(smbiosHeader.intermediateHeader.tableAddr);
261 proxy.
writeBlob(addr + 0x18, &tableAddrGuest, 4);
262 for (
int i = 0;
i < 4;
i++) {
263 intChecksum += tableAddrGuest;
264 tableAddrGuest >>= 8;
267 uint16_t numStructs =
letoh(structures.size());
268 proxy.
writeBlob(addr + 0x1C, &numStructs, 2);
269 for (
int i = 0;
i < 2;
i++) {
270 intChecksum += numStructs;
275 &smbiosHeader.intermediateHeader.smbiosBCDRevision, 1);
276 intChecksum += smbiosHeader.intermediateHeader.smbiosBCDRevision;
282 Addr base = smbiosHeader.intermediateHeader.tableAddr;
284 uint16_t maxSize = 0;
286 for (it = structures.begin(); it != structures.end(); it++) {
287 uint16_t size = (*it)->writeOut(proxy, base + offset);
299 maxSize =
htole(maxSize);
300 proxy.
writeBlob(addr + 0x8, &maxSize, 2);
301 for (
int i = 0;
i < 2;
i++) {
302 mainChecksum += maxSize;
307 mainChecksum = -mainChecksum;
308 proxy.
writeBlob(addr + 0x4, &mainChecksum, 1);
314 uint16_t tableSize =
offset;
315 tableSize =
htole(tableSize);
316 proxy.
writeBlob(addr + 0x16, &tableSize, 2);
317 for (
int i = 0;
i < 2;
i++) {
318 intChecksum += tableSize;
322 intChecksum = -intChecksum;
323 proxy.
writeBlob(addr + 0x15, &intChecksum, 1);
327 X86SMBiosBiosInformationParams::create()
333 X86SMBiosSMBiosTableParams::create()
void writeOutStrings(PortProxy &proxy, Addr addr)
void writeOut(PortProxy &proxy, Addr addr, Addr &headerSize, Addr &structSize)
std::string readString(int n)
SMBiosStructure(Params *p, uint8_t _type)
Overload hash function for BasicBlockRange type.
virtual uint16_t writeOut(PortProxy &proxy, Addr addr)
X86SMBiosSMBiosStructureParams Params
PortProxy Object Declaration.
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
int addString(std::string &newString)
struct X86ISA::SMBios::SMBiosTable::SMBiosHeader smbiosHeader
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void setString(int n, std::string &newString)
This object is a proxy for a port or other object which implements the functional response protocol...
uint64_t composeBitVector(T vec)
X86SMBiosSMBiosTableParams Params
Abstract superclass for simulation objects.
std::vector< std::string > strings