#ifndef _APPLESMBIOS_SMBIOS_H
#define _APPLESMBIOS_SMBIOS_H
#include <IOKit/IOLib.h>
typedef UInt8 SMBString;
typedef UInt8 SMBByte;
typedef UInt16 SMBWord;
typedef UInt32 SMBDWord;
typedef UInt64 SMBQWord;
#pragma pack(push, 1) // enable 8-bit struct packing
struct DMIEntryPoint {
SMBByte anchor[5];
SMBByte checksum;
SMBWord tableLength;
SMBDWord tableAddress;
SMBWord structureCount;
SMBByte bcdRevision;
};
struct SMBEntryPoint {
SMBByte anchor[4];
SMBByte checksum;
SMBByte entryPointLength;
SMBByte majorVersion;
SMBByte minorVersion;
SMBWord maxStructureSize;
SMBByte entryPointRevision;
SMBByte formattedArea[5];
struct DMIEntryPoint dmi;
};
struct SMBStructHeader {
SMBByte type;
SMBByte length;
SMBWord handle;
};
#define SMB_STRUCT_HEADER SMBStructHeader header;
enum {
kSMBTypeBIOSInformation = 0,
kSMBTypeSystemInformation = 1,
kSMBTypeSystemEnclosure = 3,
kSMBTypeProcessorInformation = 4,
kSMBTypeMemoryModule = 6,
kSMBTypeCacheInformation = 7,
kSMBTypeSystemSlot = 9,
kSMBTypePhysicalMemoryArray = 16,
kSMBTypeMemoryDevice = 17,
kSMBTypeFirmwareVolume = 128,
kSMBTypeMemorySPD = 130,
kSMBTypeOemProcessorType = 131
};
struct SMBBIOSInformation {
SMB_STRUCT_HEADER SMBString vendor; SMBString version; SMBWord startSegment; SMBString releaseDate; SMBByte romSize; SMBQWord characteristics; };
struct SMBSystemInformation {
SMB_STRUCT_HEADER SMBString manufacturer;
SMBString productName;
SMBString version;
SMBString serialNumber;
SMBByte uuid[16]; SMBByte wakeupReason; };
struct SMBSystemEnclosure {
SMB_STRUCT_HEADER SMBString manufacturer;
SMBByte type;
SMBString version;
SMBString serialNumber;
SMBString assetTagNumber;
SMBByte bootupState;
SMBByte powerSupplyState;
SMBByte thermalState;
SMBByte securityStatus;
SMBDWord oemDefined;
};
struct SMBProcessorInformation {
SMB_STRUCT_HEADER SMBString socketDesignation;
SMBByte processorType; SMBByte processorFamily; SMBString manufacturer;
SMBQWord processorID; SMBString processorVersion;
SMBByte voltage; SMBWord externalClock; SMBWord maximumClock; SMBWord currentClock; SMBByte status;
SMBByte processorUpgrade; SMBWord L1CacheHandle;
SMBWord L2CacheHandle;
SMBWord L3CacheHandle;
SMBString serialNumber;
SMBString assetTag;
SMBString partNumber;
};
struct SMBMemoryModule {
SMB_STRUCT_HEADER SMBString socketDesignation;
SMBByte bankConnections;
SMBByte currentSpeed;
SMBWord currentMemoryType;
SMBByte installedSize;
SMBByte enabledSize;
SMBByte errorStatus;
};
#define kSMBMemoryModuleSizeNotDeterminable 0x7D
#define kSMBMemoryModuleSizeNotEnabled 0x7E
#define kSMBMemoryModuleSizeNotInstalled 0x7F
struct SMBCacheInformation {
SMB_STRUCT_HEADER SMBString socketDesignation;
SMBWord cacheConfiguration;
SMBWord maximumCacheSize;
SMBWord installedSize;
SMBWord supportedSRAMType;
SMBWord currentSRAMType;
SMBByte cacheSpeed;
SMBByte errorCorrectionType;
SMBByte systemCacheType;
SMBByte associativity;
};
struct SMBSystemSlot {
SMB_STRUCT_HEADER SMBString slotDesignation;
SMBByte slotType;
SMBByte slotDataBusWidth;
SMBByte currentUsage;
SMBByte slotLength;
SMBWord slotID;
SMBByte slotCharacteristics1;
SMBByte slotCharacteristics2;
};
struct SMBPhysicalMemoryArray {
SMB_STRUCT_HEADER SMBByte physicalLocation; SMBByte arrayUse; SMBByte errorCorrection; SMBDWord maximumCapacity; SMBWord errorHandle; SMBWord numMemoryDevices; };
struct SMBMemoryDevice {
SMB_STRUCT_HEADER SMBWord arrayHandle; SMBWord errorHandle; SMBWord totalWidth; SMBWord dataWidth; SMBWord memorySize; SMBByte formFactor; SMBByte deviceSet; SMBString deviceLocator; SMBString bankLocator; SMBByte memoryType; SMBWord memoryTypeDetail; SMBWord memorySpeed; SMBString manufacturer;
SMBString serialNumber;
SMBString assetTag;
SMBString partNumber;
};
enum {
FW_REGION_RESERVED = 0,
FW_REGION_RECOVERY = 1,
FW_REGION_MAIN = 2,
FW_REGION_NVRAM = 3,
FW_REGION_CONFIG = 4,
FW_REGION_DIAGVAULT = 5,
NUM_FLASHMAP_ENTRIES = 8
};
struct FW_REGION_INFO
{
SMBDWord StartAddress;
SMBDWord EndAddress;
};
struct SMBFirmwareVolume {
SMB_STRUCT_HEADER SMBByte RegionCount;
SMBByte Reserved[3];
SMBDWord FirmwareFeatures;
SMBDWord FirmwareFeaturesMask;
SMBByte RegionType[ NUM_FLASHMAP_ENTRIES ];
FW_REGION_INFO FlashMap[ NUM_FLASHMAP_ENTRIES ];
};
struct SMBMemorySPD {
SMB_STRUCT_HEADER SMBWord Type17Handle;
SMBWord Offset;
SMBWord Size;
SMBWord Data[];
};
static const char *
SMBMemoryDeviceTypes[] =
{
"RAM",
"RAM",
"RAM",
"DRAM",
"EDRAM",
"VRAM",
"SRAM",
"RAM",
"ROM",
"FLASH",
"EEPROM",
"FEPROM",
"EPROM",
"CDRAM",
"3DRAM",
"SDRAM",
"SGRAM",
"RDRAM",
"DDR SDRAM",
"DDR2 SDRAM",
"DDR2 FB-DIMM",
"RAM",
"RAM",
"RAM",
"DDR3",
};
static const int
kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) /
sizeof(SMBMemoryDeviceTypes[0]);
#ifdef NOT_YET
static const char *
SMBMemoryDeviceDetailTypes[] =
{
NULL, NULL, NULL, "Fast-paged",
"Static column", "Pseudo-static", "RAMBUS", "Synchronous",
"CMOS", "EDO", "Window", "Cache",
"Non-volatile", NULL, NULL, NULL
};
#endif
struct SMBOemProcessorType {
SMB_STRUCT_HEADER
SMBWord ProcessorType;
};
#ifdef SUPPORT_LEGACY_BIOS_PIRQ
struct PIREntry {
UInt8 PCIBusNumber;
UInt8 PCIDevNumber;
UInt8 LinkINTA;
UInt16 IRQBitmapINTA;
UInt8 LinkINTB;
UInt16 IRQBitmapINTB;
UInt8 LinkINTC;
UInt16 IRQBitmapINTC;
UInt8 LinkINTD;
UInt16 IRQBitmapINTD;
UInt8 SlotNumber;
UInt8 Reserved;
};
struct PIRTableHeader {
UInt32 Signature;
UInt16 Version;
UInt16 TableSize;
};
struct PIRTable {
UInt32 Signature;
UInt16 Version;
UInt16 TableSize;
UInt8 RouterBus;
UInt8 RouterDevFunc;
UInt16 PCIExclusiveIRQs;
UInt32 CompatibleRouter;
UInt32 MiniportData;
UInt8 Reserved[11];
UInt8 Checksum;
PIREntry SlotEntry[0];
};
#endif
#pragma pack(pop) // reset to default struct packing
#endif