2020-04-16 09:15:26 +02:00
|
|
|
/*
|
|
|
|
* smbios.h
|
|
|
|
*
|
|
|
|
* Created on: 16 Apr 2020
|
|
|
|
* Author: jief
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLATFORM_SMBIOS_H_
|
|
|
|
#define PLATFORM_SMBIOS_H_
|
|
|
|
|
2021-02-06 18:16:46 +01:00
|
|
|
extern "C" {
|
|
|
|
#include <IndustryStandard/AppleSmBios.h>
|
|
|
|
}
|
|
|
|
|
2020-04-16 09:48:13 +02:00
|
|
|
// The maximum number of RAM slots to detect
|
|
|
|
// even for 3-channels chipset X58 there are no more then 8 slots
|
|
|
|
#define MAX_RAM_SLOTS 24
|
|
|
|
// The maximum sane frequency for a RAM module
|
|
|
|
#define MAX_RAM_FREQUENCY 5000
|
|
|
|
|
2021-04-05 10:57:55 +02:00
|
|
|
class RAM_SLOT_INFO {
|
|
|
|
public:
|
|
|
|
UINT32 ModuleSize = UINT32();
|
|
|
|
UINT32 Frequency = UINT32();
|
|
|
|
XString8 Vendor = XString8();
|
|
|
|
XString8 PartNo = XString8();
|
|
|
|
XString8 SerialNo = XString8();
|
|
|
|
UINT8 Type = UINT8();
|
|
|
|
bool InUse = bool();
|
2021-04-11 07:18:52 +02:00
|
|
|
|
|
|
|
#if __cplusplus > 201703L
|
|
|
|
bool operator == (const RAM_SLOT_INFO&) const = default;
|
|
|
|
#endif
|
|
|
|
bool isEqual(const RAM_SLOT_INFO& other) const
|
|
|
|
{
|
|
|
|
if ( !(ModuleSize == other.ModuleSize ) ) return false;
|
|
|
|
if ( !(Frequency == other.Frequency ) ) return false;
|
|
|
|
if ( !(Vendor == other.Vendor ) ) return false;
|
|
|
|
if ( !(PartNo == other.PartNo ) ) return false;
|
|
|
|
if ( !(SerialNo == other.SerialNo ) ) return false;
|
|
|
|
if ( !(Type == other.Type ) ) return false;
|
|
|
|
if ( !(InUse == other.InUse ) ) return false;
|
|
|
|
return true;
|
|
|
|
}
|
2021-04-05 10:57:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class MEM_STRUCTURE
|
2020-04-16 09:48:13 +02:00
|
|
|
{
|
2021-04-05 10:57:55 +02:00
|
|
|
public:
|
|
|
|
UINT32 Frequency = UINT32();
|
|
|
|
UINT32 Divider = UINT32();
|
|
|
|
UINT8 TRC = UINT8();
|
|
|
|
UINT8 TRP = UINT8();
|
|
|
|
UINT8 RAS = UINT8();
|
|
|
|
UINT8 Channels = UINT8();
|
|
|
|
UINT8 Slots = UINT8();
|
|
|
|
UINT8 Type = UINT8();
|
|
|
|
UINT8 SPDInUse = UINT8();
|
|
|
|
UINT8 SMBIOSInUse = UINT8();
|
2020-04-16 09:48:13 +02:00
|
|
|
|
|
|
|
RAM_SLOT_INFO SPD[MAX_RAM_SLOTS * 4];
|
|
|
|
RAM_SLOT_INFO SMBIOS[MAX_RAM_SLOTS * 4];
|
|
|
|
|
2021-04-05 10:57:55 +02:00
|
|
|
};
|
2020-04-16 09:48:13 +02:00
|
|
|
|
|
|
|
|
2020-04-16 09:15:26 +02:00
|
|
|
extern APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable;
|
2021-02-06 18:16:46 +01:00
|
|
|
|
2020-04-16 09:48:13 +02:00
|
|
|
extern MEM_STRUCTURE gRAM;
|
2020-04-16 09:15:26 +02:00
|
|
|
extern BOOLEAN gMobile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UINTN
|
|
|
|
iStrLen(
|
|
|
|
CONST CHAR8* String,
|
|
|
|
UINTN MaxLen
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2020-10-03 19:02:31 +02:00
|
|
|
PrepatchSmbios (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
2020-10-03 19:02:31 +02:00
|
|
|
void
|
|
|
|
PatchSmbios (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
2020-10-03 19:02:31 +02:00
|
|
|
void
|
|
|
|
FinalizeSmbios (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* PLATFORM_SMBIOS_H_ */
|