45 #include "params/X86SMBiosBiosInformation.hh"
46 #include "params/X86SMBiosSMBiosStructure.hh"
47 #include "params/X86SMBiosSMBiosTable.hh"
68 typename T::iterator vecIt;
69 for (vecIt =
vec.begin(); vecIt !=
vec.end(); vecIt++) {
70 val |= (1 << (*vecIt));
90 const Params &
p, uint8_t _type) :
101 const uint8_t nullTerminator = 0;
105 if (strings.size() == 0 && stringFields) {
109 for (it = strings.begin(); it != strings.end(); it++) {
111 offset += it->length() + 1;
123 for (it = strings.begin(); it != strings.end(); it++) {
124 size += it->length() + 1;
136 if (new_string.length() == 0)
138 strings.push_back(new_string);
139 return strings.size();
145 assert(
n > 0 &&
n <= strings.size());
146 return strings[
n - 1];
151 int n,
const std::string &new_string)
153 assert(
n > 0 &&
n <= strings.size());
154 strings[
n - 1] = new_string;
159 startingAddrSegment(
p.starting_addr_segment),
161 majorVer(
p.major), minorVer(
p.
minor),
162 embContFirmwareMajor(
p.emb_cont_firmware_major),
163 embContFirmwareMinor(
p.emb_cont_firmware_minor)
182 uint16_t startingAddrSegmentGuest =
htole(startingAddrSegment);
188 uint64_t characteristicsGuest =
htole(characteristics);
191 uint16_t characteristicExtBytesGuest =
192 htole(characteristicExtBytes);
193 proxy.
writeBlob(
addr + 0x12, &characteristicExtBytesGuest, 2);
200 writeOutStrings(proxy,
addr + getLength());
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;
236 mainChecksum += smbiosHeader.majorVersion;
238 mainChecksum += smbiosHeader.minorVersion;
240 proxy.
writeBlob(
addr + 0xA, &smbiosHeader.entryPointRevision, 1);
241 mainChecksum += smbiosHeader.entryPointRevision;
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);
262 for (
int i = 0;
i < 4;
i++) {
263 intChecksum += tableAddrGuest;
264 tableAddrGuest >>= 8;
267 uint16_t numStructs =
letoh(structures.size());
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);
301 for (
int i = 0;
i < 2;
i++) {
302 mainChecksum += maxSize;
307 mainChecksum = -mainChecksum;
314 uint16_t tableSize =
offset;
315 tableSize =
htole(tableSize);
317 for (
int i = 0;
i < 2;
i++) {
318 intChecksum += tableSize;
322 intChecksum = -intChecksum;