Browse Source

Added DMI reader (Windows only).

feature-dmi
XMRig 3 years ago
parent
commit
11e0d3de3a
No known key found for this signature in database GPG Key ID: 446A53638BE94409
  1. 3
      CMakeLists.txt
  2. 30
      src/Summary.cpp
  3. 35
      src/hw/dmi/DmiBoard.cpp
  4. 54
      src/hw/dmi/DmiBoard.h
  5. 192
      src/hw/dmi/DmiMemory.cpp
  6. 74
      src/hw/dmi/DmiMemory.h
  7. 87
      src/hw/dmi/DmiReader.cpp
  8. 59
      src/hw/dmi/DmiReader.h
  9. 26
      src/hw/dmi/DmiReader_unix.cpp
  10. 112
      src/hw/dmi/DmiReader_win.cpp
  11. 75
      src/hw/dmi/DmiTools.cpp
  12. 53
      src/hw/dmi/DmiTools.h
  13. 25
      src/hw/dmi/dmi.cmake

3
CMakeLists.txt

@ -26,6 +26,7 @@ option(WITH_PROFILING "Enable profiling for developers" OFF)
option(WITH_SSE4_1 "Enable SSE 4.1 for Blake2" ON)
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
option(WITH_DMI "Enable DMI reader" OFF)
option(BUILD_STATIC "Build static binary" OFF)
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
@ -197,6 +198,8 @@ if (WITH_EMBEDDED_CONFIG)
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
endif()
include (src/hw/dmi/dmi.cmake)
include_directories(src)
include_directories(src/3rdparty)
include_directories(${UV_INCLUDE_DIR})

30
src/Summary.cpp

@ -39,6 +39,11 @@
#include "version.h"
#ifdef XMRIG_FEATURE_DMI
# include "hw/dmi/DmiReader.h"
#endif
#ifdef XMRIG_ALGO_RANDOMX
# include "crypto/rx/RxConfig.h"
#endif
@ -130,6 +135,31 @@ static void print_memory()
totalMem / oneGiB,
percent
);
# ifdef XMRIG_FEATURE_DMI
DmiReader reader;
if (!reader.read()) {
return;
}
for (const auto &memory : reader.memory()) {
if (!memory.isValid()) {
continue;
}
if (!memory.size()) {
Log::print(WHITE_BOLD(" %-13s") WHITE_BOLD("%s: ") BLACK_BOLD("<empty>"), "", memory.slot().data());
continue;
}
Log::print(WHITE_BOLD(" %-13s") WHITE_BOLD("%s: ") CYAN_BOLD("%" PRIu64 " GB ") WHITE_BOLD("%s @ %" PRIu64 " MHz ") BLACK_BOLD("%s"),
"", memory.slot().data(), memory.size() / oneGiB, memory.type(), memory.speed() / 1000000ULL, memory.product().data());
}
if (reader.board().isValid()) {
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s") " - " WHITE_BOLD("%s"), "MOTHERBOARD", reader.board().vendor().data(), reader.board().product().data());
}
# endif
}

35
src/hw/dmi/DmiBoard.cpp

@ -0,0 +1,35 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hw/dmi/DmiBoard.h"
#include "hw/dmi/DmiTools.h"
void xmrig::DmiBoard::decode(dmi_header *h)
{
if (h->length < 0x08) {
return;
}
m_vendor = dmi_string(h, 0x04);
m_product = dmi_string(h, 0x05);
}

54
src/hw/dmi/DmiBoard.h

@ -0,0 +1,54 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_DMIBOARD_H
#define XMRIG_DMIBOARD_H
#include "base/tools/String.h"
namespace xmrig {
struct dmi_header;
class DmiBoard
{
public:
DmiBoard() = default;
inline const String &product() const { return m_product; }
inline const String &vendor() const { return m_vendor; }
inline bool isValid() const { return !m_product.isEmpty() && !m_vendor.isEmpty(); }
void decode(dmi_header *h);
private:
String m_product;
String m_vendor;
};
} /* namespace xmrig */
#endif /* XMRIG_DMIBOARD_H */

192
src/hw/dmi/DmiMemory.cpp

@ -0,0 +1,192 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hw/dmi/DmiMemory.h"
#include "hw/dmi/DmiTools.h"
#include <algorithm>
#include <array>
namespace xmrig {
static inline uint16_t dmi_memory_device_width(uint16_t code)
{
return (code == 0xFFFF || code == 0) ? 0 : code;
}
static const char *dmi_memory_device_form_factor(uint8_t code)
{
static const std::array<const char *, 0x10> form_factor
{
"Other",
"Unknown",
"SIMM",
"SIP",
"Chip",
"DIP",
"ZIP",
"Proprietary Card",
"DIMM",
"TSOP",
"Row Of Chips",
"RIMM",
"SODIMM",
"SRIMM",
"FB-DIMM",
"Die"
};
if (code >= 0x01 && code <= form_factor.size()) {
return form_factor[code - 0x01];
}
return form_factor[1];
}
static const char *dmi_memory_device_type(uint8_t code)
{
static const std::array<const char *, 0x23> type
{
"Other", /* 0x01 */
"Unknown",
"DRAM",
"EDRAM",
"VRAM",
"SRAM",
"RAM",
"ROM",
"Flash",
"EEPROM",
"FEPROM",
"EPROM",
"CDRAM",
"3DRAM",
"SDRAM",
"SGRAM",
"RDRAM",
"DDR",
"DDR2",
"DDR2 FB-DIMM",
"Reserved",
"Reserved",
"Reserved",
"DDR3",
"FBD2",
"DDR4",
"LPDDR",
"LPDDR2",
"LPDDR3",
"LPDDR4",
"Logical non-volatile device",
"HBM",
"HBM2",
"DDR5",
"LPDDR5"
};
if (code >= 0x01 && code <= type.size()) {
return type[code - 0x01];
}
return type[1];
}
static uint64_t dmi_memory_device_speed(uint16_t code1, uint32_t code2)
{
return (code1 == 0xFFFF) ? code2 : code1;
}
} // namespace xmrig
xmrig::DmiMemory::DmiMemory(dmi_header *h)
{
if (h->length < 0x15) {
return;
}
m_totalWidth = dmi_memory_device_width(dmi_get<uint16_t>(h, 0x08));
m_width = dmi_memory_device_width(dmi_get<uint16_t>(h, 0x0A));
auto size = dmi_get<uint16_t>(h, 0x0C);
if (h->length >= 0x20 && size == 0x7FFF) {
m_size = (dmi_get<uint32_t>(h, 0x1C) & 0x7FFFFFFFUL) * 1024ULL * 1024ULL;
}
else if (size) {
m_size = (1024ULL * (size & 0x7FFF) * ((size & 0x8000) ? 1 : 1024ULL));
}
m_formFactor = h->data[0x0E];
m_slot = dmi_string(h, 0x10);
m_bank = dmi_string(h, 0x11);
m_type = h->data[0x12];
if (!m_size || h->length < 0x17) {
return;
}
m_speed = dmi_memory_device_speed(dmi_get<uint16_t>(h, 0x15), h->length >= 0x5C ? dmi_get<uint32_t>(h, 0x54) : 0) * 1000000ULL;
if (h->length < 0x1B) {
return;
}
m_vendor = dmi_string(h, 0x17);
m_product = dmi_string(h, 0x1A);
if (h->length < 0x1C) {
return;
}
m_rank = h->data[0x1B] & 0x0F;
if (h->length < 0x22) {
return;
}
m_speed = std::max(m_speed, dmi_memory_device_speed(dmi_get<uint16_t>(h, 0x20), h->length >= 0x5C ? dmi_get<uint32_t>(h, 0x58) : 0) * 1000000ULL);
if (h->length < 0x28) {
return;
}
m_voltage = dmi_get<uint16_t>(h, 0x26);
}
const char *xmrig::DmiMemory::formFactor() const
{
return dmi_memory_device_form_factor(m_formFactor);
}
const char *xmrig::DmiMemory::type() const
{
return dmi_memory_device_type(m_type);
}

74
src/hw/dmi/DmiMemory.h

@ -0,0 +1,74 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_DMIMEMORY_H
#define XMRIG_DMIMEMORY_H
#include "base/tools/String.h"
namespace xmrig {
struct dmi_header;
class DmiMemory
{
public:
DmiMemory() = default;
DmiMemory(dmi_header *h);
inline bool isValid() const { return !m_slot.isEmpty(); }
inline const String &bank() const { return m_bank; }
inline const String &product() const { return m_product; }
inline const String &slot() const { return m_slot; }
inline const String &vendor() const { return m_vendor; }
inline uint16_t totalWidth() const { return m_totalWidth; }
inline uint16_t voltage() const { return m_voltage; }
inline uint16_t width() const { return m_width; }
inline uint64_t size() const { return m_size; }
inline uint64_t speed() const { return m_speed; }
inline uint8_t rank() const { return m_rank; }
const char *formFactor() const;
const char *type() const;
private:
String m_bank;
String m_product;
String m_slot;
String m_vendor;
uint16_t m_totalWidth = 0;
uint16_t m_voltage = 0;
uint16_t m_width = 0;
uint64_t m_size = 0;
uint64_t m_speed = 0;
uint8_t m_formFactor = 0;
uint8_t m_rank = 0;
uint8_t m_type = 0;
};
} /* namespace xmrig */
#endif /* XMRIG_DMIMEMORY_H */

87
src/hw/dmi/DmiReader.cpp

@ -0,0 +1,87 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hw/dmi/DmiReader.h"
#include "hw/dmi/DmiTools.h"
namespace xmrig {
static void dmi_get_header(dmi_header *h, uint8_t *data)
{
h->type = data[0];
h->length = data[1];
h->handle = dmi_get<uint16_t>(data + 2);
h->data = data;
}
} // namespace xmrig
bool xmrig::DmiReader::decode(uint8_t *buf)
{
if (!buf || !m_count) {
return false;
}
uint8_t *data = buf;
int i = 0;
while ((i < m_count || !m_count) && data + 4 <= buf + m_size) {
dmi_header h{};
dmi_get_header(&h, data);
if (h.length < 4 || h.type == 127) {
break;
}
i++;
uint8_t *next = data + h.length;
while (static_cast<uint32_t>(next - buf + 1) < m_size && (next[0] != 0 || next[1] != 0)) {
next++;
}
next += 2;
if (static_cast<uint32_t>(next - buf) > m_size) {
data = next;
break;
}
switch (h.type) {
case 2:
m_board.decode(&h);
break;
case 17:
m_memory.emplace_back(&h);
break;
default:
break;
}
data = next;
}
return true;
}

59
src/hw/dmi/DmiReader.h

@ -0,0 +1,59 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_DMIREADER_H
#define XMRIG_DMIREADER_H
#include "hw/dmi/DmiBoard.h"
#include "hw/dmi/DmiMemory.h"
namespace xmrig {
class DmiReader
{
public:
DmiReader() = default;
inline const DmiBoard &board() const { return m_board; }
inline const std::vector<DmiMemory> &memory() const { return m_memory; }
inline uint16_t count() const { return m_count; }
inline uint32_t size() const { return m_size; }
inline uint32_t version() const { return m_version; }
bool read();
private:
bool decode(uint8_t *buf);
DmiBoard m_board;
uint16_t m_count = 0;
uint32_t m_size = 0;
uint32_t m_version = 0;
std::vector<DmiMemory> m_memory;
};
} /* namespace xmrig */
#endif /* XMRIG_DMIREADER_H */

26
src/hw/dmi/DmiReader_unix.cpp

@ -0,0 +1,26 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hw/dmi/DmiReader.h"
bool xmrig::DmiReader::read()
{
return false;
}

112
src/hw/dmi/DmiReader_win.cpp

@ -0,0 +1,112 @@
/* XMRig
* Copyright (c) 2002-2006 Hugo Weber <address@hidden>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hw/dmi/DmiReader.h"
#include "hw/dmi/DmiTools.h"
#include <windows.h>
namespace xmrig {
/*
* Struct needed to get the SMBIOS table using GetSystemFirmwareTable API.
*/
struct RawSMBIOSData {
uint8_t Used20CallingMethod;
uint8_t SMBIOSMajorVersion;
uint8_t SMBIOSMinorVersion;
uint8_t DmiRevision;
uint32_t Length;
uint8_t SMBIOSTableData[];
};
/*
* Counts the number of SMBIOS structures present in
* the SMBIOS table.
*
* buf - Pointer that receives the SMBIOS Table address.
* This will be the address of the BYTE array from
* the RawSMBIOSData struct.
*
* len - The length of the SMBIOS Table pointed by buff.
*
* return - The number of SMBIOS strutctures.
*
* Remarks:
* The SMBIOS Table Entry Point has this information,
* however the GetSystemFirmwareTable API doesn't
* return all fields from the Entry Point, and
* DMIDECODE uses this value as a parameter for
* dmi_table function. This is the reason why
* this function was make.
*
* Hugo Weber address@hidden
*/
uint16_t count_smbios_structures(const uint8_t *buf, uint32_t len)
{
uint16_t count = 0;
uint32_t offset = 0;
while (offset < len) {
offset += reinterpret_cast<const dmi_header *>(buf + offset)->length;
count++;
while ((*reinterpret_cast<const uint16_t *>(buf + offset) != 0) && (offset < len)) {
offset++;
}
offset += 2;
}
return count;
}
} // namespace xmrig
bool xmrig::DmiReader::read()
{
const uint32_t size = GetSystemFirmwareTable('RSMB', 0, nullptr, 0);
auto smb = reinterpret_cast<RawSMBIOSData *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size));
if (!smb) {
return false;
}
if (GetSystemFirmwareTable('RSMB', 0, smb, size) != size) {
HeapFree(GetProcessHeap(), 0, smb);
return false;
}
m_version = (smb->SMBIOSMajorVersion << 16) + (smb->SMBIOSMinorVersion << 8) + smb->DmiRevision;
m_size = smb->Length;
m_count = count_smbios_structures(smb->SMBIOSTableData, m_size);
const bool rc = decode(smb->SMBIOSTableData);
HeapFree(GetProcessHeap(), 0, smb);
return rc;
}

75
src/hw/dmi/DmiTools.cpp

@ -0,0 +1,75 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hw/dmi/DmiTools.h"
#include <cstring>
namespace xmrig {
/* Replace non-ASCII characters with dots */
static void ascii_filter(char *bp, size_t len)
{
for (size_t i = 0; i < len; i++) {
if (bp[i] < 32 || bp[i] >= 127) {
bp[i] = '.';
}
}
}
static char *_dmi_string(dmi_header *dm, uint8_t s, bool filter)
{
char *bp = reinterpret_cast<char *>(dm->data);
bp += dm->length;
while (s > 1 && *bp) {
bp += strlen(bp);
bp++;
s--;
}
if (!*bp) {
return nullptr;
}
if (filter) {
ascii_filter(bp, strlen(bp));
}
return bp;
}
const char *dmi_string(dmi_header *dm, size_t offset)
{
if (offset < 4) {
return nullptr;
}
return _dmi_string(dm, dm->data[offset], true);
}
} // namespace xmrig

53
src/hw/dmi/DmiTools.h

@ -0,0 +1,53 @@
/* XMRig
* Copyright (c) 2000-2002 Alan Cox <alan@redhat.com>
* Copyright (c) 2005-2020 Jean Delvare <jdelvare@suse.de>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_DMITOOLS_H
#define XMRIG_DMITOOLS_H
#include <cstdint>
namespace xmrig {
struct dmi_header
{
uint8_t type;
uint8_t length;
uint16_t handle;
uint8_t *data;
};
template<typename T>
inline T dmi_get(const uint8_t *data) { return *reinterpret_cast<const T *>(data); }
template<typename T>
inline T dmi_get(const dmi_header *h, size_t offset) { return *reinterpret_cast<const T *>(h->data + offset); }
const char *dmi_string(dmi_header *dm, size_t offset);
} /* namespace xmrig */
#endif /* XMRIG_DMITOOLS_H */

25
src/hw/dmi/dmi.cmake

@ -0,0 +1,25 @@
if (WITH_DMI)
add_definitions(/DXMRIG_FEATURE_DMI)
list(APPEND HEADERS
src/hw/dmi/DmiBoard.h
src/hw/dmi/DmiMemory.h
src/hw/dmi/DmiReader.h
src/hw/dmi/DmiTools.h
)
list(APPEND SOURCES
src/hw/dmi/DmiBoard.cpp
src/hw/dmi/DmiMemory.cpp
src/hw/dmi/DmiReader.cpp
src/hw/dmi/DmiTools.cpp
)
if (XMRIG_OS_WIN)
list(APPEND SOURCES src/hw/dmi/DmiReader_win.cpp)
elseif(XMRIG_OS_LINUX)
list(APPEND SOURCES src/hw/dmi/DmiReader_unix.cpp)
endif()
else()
remove_definitions(/DXMRIG_FEATURE_DMI)
endif()
Loading…
Cancel
Save