23 #include "pedigree/kernel/Log.h" 24 #include "pedigree/kernel/utilities/utility.h" 26 void SMBios::initialise()
30 if (m_pEntryPoint == 0)
32 NOTICE(
"SMBios: not compliant to the SMBIOS Specification");
37 "SMBIOS Specification " <<
Dec << m_pEntryPoint->majorVersion <<
"." 38 << m_pEntryPoint->minorVersion);
40 " entry-point at " <<
Hex 41 << reinterpret_cast<uintptr_t>(m_pEntryPoint));
43 " tables at " <<
Hex << m_pEntryPoint->tableAddress <<
" - " 44 << (m_pEntryPoint->tableAddress +
45 m_pEntryPoint->tableLength));
49 reinterpret_cast<Header *
>(m_pEntryPoint->tableAddress);
50 for (
size_t i = 0; i < m_pEntryPoint->structureCount; i++)
52 switch (pCurHeader->type)
56 BiosInformation *pBiosInfo =
57 reinterpret_cast<BiosInformation *
>(
58 adjust_pointer(pCurHeader,
sizeof(Header)));
59 NOTICE(
" BIOS Information:");
62 << getString(pCurHeader, pBiosInfo->vendorIndex) <<
"\"");
65 << getString(pCurHeader, pBiosInfo->biosVersionIndex)
69 << getString(pCurHeader, pBiosInfo->biosReleaseDateIndex)
74 << (static_cast<size_t>(pBiosInfo->biosStartSegment) * 16)
76 << (static_cast<size_t>(pBiosInfo->biosStartSegment) * 16 +
78 (static_cast<size_t>(pBiosInfo->biosRomSize) + 1)));
80 " characteristics: " <<
Hex 81 << pBiosInfo->biosCharacteristics);
88 " unknown structure (" <<
Hex << pCurHeader->type <<
")");
92 pCurHeader =
next(pCurHeader);
96 SMBios::Header *SMBios::next(Header *pHeader)
98 uint16_t *stringTable =
99 reinterpret_cast<uint16_t *
>(adjust_pointer(pHeader, pHeader->length));
100 while (*stringTable != 0)
101 stringTable = adjust_pointer(stringTable, 1);
102 return reinterpret_cast<Header *
>(++stringTable);
105 const char *SMBios::getString(
const Header *pHeader,
size_t index)
107 const char *pCur =
reinterpret_cast<const char *
>(
108 adjust_pointer(pHeader, pHeader->length));
109 for (
size_t i = 1; i < index; i++)
110 while (*pCur++ !=
'\0')
117 m_pEntryPoint =
reinterpret_cast<EntryPoint *
>(0xF0000);
118 while (reinterpret_cast<uintptr_t>(m_pEntryPoint) < 0x100000)
120 if (m_pEntryPoint->signature == 0x5F4D535F &&
121 m_pEntryPoint->signature2[0] == 0x5F &&
122 m_pEntryPoint->signature2[1] == 0x44 &&
123 m_pEntryPoint->signature2[2] == 0x4D &&
124 m_pEntryPoint->signature2[3] == 0x49 &&
125 m_pEntryPoint->signature2[4] == 0x5F &&
126 checksum(m_pEntryPoint) ==
true)
128 m_pEntryPoint = adjust_pointer(m_pEntryPoint, 16);
133 bool SMBios::checksum(
const EntryPoint *pEntryPoint)
136 reinterpret_cast<const uint8_t *>(pEntryPoint),
137 pEntryPoint->length) ==
false)
141 reinterpret_cast<const uint8_t *>(&pEntryPoint->signature2[0]), 0x0F);
144 SMBios::SMBios() : m_pEntryPoint(0)