CloverBootloader/rEFIt_UEFI/Platform/smbios.h
jief666 7babc6fe9b Do not use OC quirks struct anymore in settings.
Fix Disabled property in Smbios/Block config.
Move flagstate in GlobalConfig.
Remove gSettings.Smbios.REV, ECPI, RBr and RPlt.
Create getRBr() and getRPlt().
Operator == and isEqual in XArray, XObjArray, SETTINGS_DATA.
Rename equal to isEqual in XString and XStringArray.
Operator == in INPUT_ITEM, undefinable, ABSTRACT_PATCH (and derived) and
RAM_SLOT_INFO class.
Clean b64cdecode.h.
2021-04-11 08:18:52 +03:00

92 lines
1.9 KiB
C++

/*
* smbios.h
*
* Created on: 16 Apr 2020
* Author: jief
*/
#ifndef PLATFORM_SMBIOS_H_
#define PLATFORM_SMBIOS_H_
extern "C" {
#include <IndustryStandard/AppleSmBios.h>
}
// 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
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();
#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;
}
};
class MEM_STRUCTURE
{
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();
RAM_SLOT_INFO SPD[MAX_RAM_SLOTS * 4];
RAM_SLOT_INFO SMBIOS[MAX_RAM_SLOTS * 4];
};
extern APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable;
extern MEM_STRUCTURE gRAM;
extern BOOLEAN gMobile;
UINTN
iStrLen(
CONST CHAR8* String,
UINTN MaxLen
);
EFI_STATUS
PrepatchSmbios (void);
void
PatchSmbios (void);
void
FinalizeSmbios (void);
#endif /* PLATFORM_SMBIOS_H_ */