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();
83 proxy.
writeBlob(addr + 1, (uint8_t *)(&length), 1);
86 proxy.
writeBlob(addr + 2, (uint8_t *)(&handleGuest), 2);
88 return length + getStringLength();
102 const uint8_t nullTerminator = 0;
106 if (strings.size() == 0 && stringFields) {
107 proxy.
writeBlob(addr + offset, (uint8_t *)(&nullTerminator), 1);
110 for (it = strings.begin(); it != strings.end(); it++) {
112 (uint8_t *)it->c_str(), it->length() + 1);
113 offset += it->length() + 1;
116 proxy.
writeBlob(addr + offset, (uint8_t *)(&nullTerminator), 1);
125 for (it = strings.begin(); it != strings.end(); it++) {
126 size += it->length() + 1;
138 if (newString.length() == 0)
140 strings.push_back(newString);
141 return strings.size();
147 assert(n > 0 && n <= strings.size());
148 return strings[n - 1];
154 assert(n > 0 && n <= strings.size());
155 strings[n - 1] = newString;
160 startingAddrSegment(p->starting_addr_segment),
161 romSize(p->rom_size),
162 majorVer(p->major), minorVer(p->minor),
163 embContFirmwareMajor(p->emb_cont_firmware_major),
164 embContFirmwareMinor(p->emb_cont_firmware_minor)
180 proxy.
writeBlob(addr + 0x4, (uint8_t *)(&vendor), 1);
181 proxy.
writeBlob(addr + 0x5, (uint8_t *)(&version), 1);
183 uint16_t startingAddrSegmentGuest =
X86ISA::htog(startingAddrSegment);
184 proxy.
writeBlob(addr + 0x6, (uint8_t *)(&startingAddrSegmentGuest), 2);
186 proxy.
writeBlob(addr + 0x8, (uint8_t *)(&releaseDate), 1);
187 proxy.
writeBlob(addr + 0x9, (uint8_t *)(&romSize), 1);
189 uint64_t characteristicsGuest =
X86ISA::htog(characteristics);
190 proxy.
writeBlob(addr + 0xA, (uint8_t *)(&characteristicsGuest), 8);
192 uint16_t characteristicExtBytesGuest =
194 proxy.
writeBlob(addr + 0x12, (uint8_t *)(&characteristicExtBytesGuest), 2);
196 proxy.
writeBlob(addr + 0x14, (uint8_t *)(&majorVer), 1);
197 proxy.
writeBlob(addr + 0x15, (uint8_t *)(&minorVer), 1);
198 proxy.
writeBlob(addr + 0x16, (uint8_t *)(&embContFirmwareMajor), 1);
199 proxy.
writeBlob(addr + 0x17, (uint8_t *)(&embContFirmwareMinor), 1);
201 writeOutStrings(proxy, addr + getLength());
211 assert(p->major_version <= 9);
212 assert(p->minor_version <= 9);
214 (p->major_version << 4) | p->minor_version;
226 uint8_t mainChecksum = 0;
228 proxy.
writeBlob(addr, (uint8_t *)smbiosHeader.anchorString, 4);
229 for (
int i = 0;
i < 4;
i++)
230 mainChecksum += smbiosHeader.anchorString[
i];
235 (uint8_t *)(&smbiosHeader.entryPointLength), 1);
236 mainChecksum += smbiosHeader.entryPointLength;
238 (uint8_t *)(&smbiosHeader.majorVersion), 1);
239 mainChecksum += smbiosHeader.majorVersion;
241 (uint8_t *)(&smbiosHeader.minorVersion), 1);
242 mainChecksum += smbiosHeader.minorVersion;
245 (uint8_t *)(&smbiosHeader.entryPointRevision), 1);
246 mainChecksum += smbiosHeader.entryPointRevision;
248 (uint8_t *)(&smbiosHeader.formattedArea), 5);
249 for (
int i = 0;
i < 5;
i++)
250 mainChecksum += smbiosHeader.formattedArea[
i];
255 uint8_t intChecksum = 0;
258 (uint8_t *)smbiosHeader.intermediateHeader.anchorString, 5);
259 for (
int i = 0;
i < 5;
i++)
260 intChecksum += smbiosHeader.intermediateHeader.anchorString[
i];
265 uint32_t tableAddrGuest =
266 X86ISA::htog(smbiosHeader.intermediateHeader.tableAddr);
267 proxy.
writeBlob(addr + 0x18, (uint8_t *)(&tableAddrGuest), 4);
268 for (
int i = 0;
i < 4;
i++) {
269 intChecksum += tableAddrGuest;
270 tableAddrGuest >>= 8;
274 proxy.
writeBlob(addr + 0x1C, (uint8_t *)(&numStructs), 2);
275 for (
int i = 0;
i < 2;
i++) {
276 intChecksum += numStructs;
281 (uint8_t *)(&smbiosHeader.intermediateHeader.smbiosBCDRevision),
283 intChecksum += smbiosHeader.intermediateHeader.smbiosBCDRevision;
289 Addr base = smbiosHeader.intermediateHeader.tableAddr;
291 uint16_t maxSize = 0;
293 for (it = structures.begin(); it != structures.end(); it++) {
294 uint16_t
size = (*it)->writeOut(proxy, base + offset);
307 proxy.
writeBlob(addr + 0x8, (uint8_t *)(&maxSize), 2);
308 for (
int i = 0;
i < 2;
i++) {
309 mainChecksum += maxSize;
314 mainChecksum = -mainChecksum;
315 proxy.
writeBlob(addr + 0x4, (uint8_t *)(&mainChecksum), 1);
321 uint16_t tableSize =
offset;
323 proxy.
writeBlob(addr + 0x16, (uint8_t *)(&tableSize), 2);
324 for (
int i = 0;
i < 2;
i++) {
325 intChecksum += tableSize;
329 intChecksum = -intChecksum;
330 proxy.
writeBlob(addr + 0x15, (uint8_t *)(&intChecksum), 1);
334 X86SMBiosBiosInformationParams::create()
340 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)
virtual uint16_t writeOut(PortProxy &proxy, Addr addr)
X86SMBiosSMBiosStructureParams Params
PortProxy Object Declaration.
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 structural port, to be used for debug accesses.
uint64_t composeBitVector(T vec)
virtual void writeBlob(Addr addr, const uint8_t *p, int size) const
Write size bytes from p to address.
X86SMBiosSMBiosTableParams Params
Abstract superclass for simulation objects.