1 | /*␊ |
2 | * platform.h␊ |
3 | *␊ |
4 | */␊ |
5 | ␊ |
6 | #ifndef __LIBSAIO_PLATFORM_H␊ |
7 | #define __LIBSAIO_PLATFORM_H␊ |
8 | ␊ |
9 | #include "libsaio.h"␊ |
10 | ␊ |
11 | extern bool platformCPUFeature(uint32_t);␊ |
12 | extern void scan_platform(void);␊ |
13 | ␊ |
14 | /* CPUID index into cpuid_raw */␊ |
15 | #define CPUID_0␉␉␉␉0␊ |
16 | #define CPUID_1␉␉␉␉1␊ |
17 | #define CPUID_2␉␉␉␉2␊ |
18 | #define CPUID_3␉␉␉␉3␊ |
19 | #define CPUID_4␉␉␉␉4␊ |
20 | #define CPUID_80␉␉␉5␊ |
21 | #define CPUID_81␉␉␉6␊ |
22 | #define CPUID_MAX␉␉␉7␊ |
23 | ␊ |
24 | /* CPU Features */␊ |
25 | #define CPU_FEATURE_MMX␉␉␉0x00000001␉␉// MMX Instruction Set␊ |
26 | #define CPU_FEATURE_SSE␉␉␉0x00000002␉␉// SSE Instruction Set␊ |
27 | #define CPU_FEATURE_SSE2␉␉0x00000004␉␉// SSE2 Instruction Set␊ |
28 | #define CPU_FEATURE_SSE3␉␉0x00000008␉␉// SSE3 Instruction Set␊ |
29 | #define CPU_FEATURE_SSE41␉␉0x00000010␉␉// SSE41 Instruction Set␊ |
30 | #define CPU_FEATURE_SSE42␉␉0x00000020␉␉// SSE42 Instruction Set␊ |
31 | #define CPU_FEATURE_EM64T␉␉0x00000040␉␉// 64Bit Support␊ |
32 | #define CPU_FEATURE_HTT␉␉␉0x00000080␉␉// HyperThreading␊ |
33 | #define CPU_FEATURE_MOBILE␉␉0x00000100␉␉// Mobile CPU␊ |
34 | ␊ |
35 | /* SMBIOS Memory Types */ ␊ |
36 | #define SMB_MEM_TYPE_UNDEFINED␉0 ␊ |
37 | #define SMB_MEM_TYPE_OTHER␉␉1 ␊ |
38 | #define SMB_MEM_TYPE_UNKNOWN␉2 ␊ |
39 | #define SMB_MEM_TYPE_DRAM␉␉3 ␊ |
40 | #define SMB_MEM_TYPE_EDRAM␉␉4 ␊ |
41 | #define SMB_MEM_TYPE_VRAM␉␉5 ␊ |
42 | #define SMB_MEM_TYPE_SRAM␉␉6 ␊ |
43 | #define SMB_MEM_TYPE_RAM␉␉7 ␊ |
44 | #define SMB_MEM_TYPE_ROM␉␉8 ␊ |
45 | #define SMB_MEM_TYPE_FLASH␉␉9 ␊ |
46 | #define SMB_MEM_TYPE_EEPROM␉␉10 ␊ |
47 | #define SMB_MEM_TYPE_FEPROM␉␉11 ␊ |
48 | #define SMB_MEM_TYPE_EPROM␉␉12 ␊ |
49 | #define SMB_MEM_TYPE_CDRAM␉␉13 ␊ |
50 | #define SMB_MEM_TYPE_3DRAM␉␉14 ␊ |
51 | #define SMB_MEM_TYPE_SDRAM␉␉15 ␊ |
52 | #define SMB_MEM_TYPE_SGRAM␉␉16 ␊ |
53 | #define SMB_MEM_TYPE_RDRAM␉␉17 ␊ |
54 | #define SMB_MEM_TYPE_DDR␉␉18 ␊ |
55 | #define SMB_MEM_TYPE_DDR2␉␉19 ␊ |
56 | #define SMB_MEM_TYPE_FBDIMM␉␉20 ␊ |
57 | #define SMB_MEM_TYPE_DDR3␉␉24␉␉␉// Supported in 10.5.6+ AppleSMBIOS␊ |
58 | ␊ |
59 | /* Memory Configuration Types */ ␊ |
60 | #define SMB_MEM_CHANNEL_UNKNOWN␉0 ␊ |
61 | #define SMB_MEM_CHANNEL_SINGLE␉1 ␊ |
62 | #define SMB_MEM_CHANNEL_DUAL␉2 ␊ |
63 | #define SMB_MEM_CHANNEL_TRIPLE␉3 ␊ |
64 | ␊ |
65 | /* Maximum number of ram slots */␊ |
66 | #define MAX_RAM_SLOTS␉␉␉8␊ |
67 | ␊ |
68 | /* Maximum number of SPD bytes */␊ |
69 | #define MAX_SPD_SIZE␉␉␉256␊ |
70 | ␊ |
71 | typedef struct _RamSlotInfo_t {␊ |
72 | ␉bool␉␉InUse;␊ |
73 | ␉uint32_t␉ModuleSize;␉␉␉␉// Size of Module in MB␊ |
74 | ␉uint8_t␉␉Type;␊ |
75 | ␉char␉␉Vendor[64];␊ |
76 | ␉char␉␉PartNo[64];␊ |
77 | ␉char␉␉SerialNo[16];␊ |
78 | ␉uint8_t␉␉spd[MAX_SPD_SIZE];␊ |
79 | } RamSlotInfo_t;␊ |
80 | ␊ |
81 | typedef struct _PlatformInfo_t {␊ |
82 | ␉struct CPU {␊ |
83 | ␉␉uint32_t␉␉Features;␉␉// CPU Features like MMX, SSE2, VT, MobileCPU␊ |
84 | ␉␉uint32_t␉␉Vendor;␉␉␉// Vendor␊ |
85 | ␉␉uint32_t␉␉Model;␉␉␉// Model␊ |
86 | ␉␉uint32_t␉␉ExtModel;␉␉// Extended Model␊ |
87 | ␉␉uint32_t␉␉Family;␉␉␉// Family␊ |
88 | ␉␉uint32_t␉␉ExtFamily;␉␉// Extended Family␊ |
89 | ␉␉uint32_t␉␉NoCores;␉␉// No Cores per Package␊ |
90 | ␉␉uint32_t␉␉NoThreads;␉␉// Threads per Package␊ |
91 | ␉␉uint8_t␉␉␉MaxCoef;␉␉// Max Multiplier␊ |
92 | ␉␉uint8_t␉␉␉MaxDiv;␊ |
93 | ␉␉uint8_t␉␉␉CurrCoef;␉␉␉␉// Current Multiplier␊ |
94 | ␉␉uint8_t␉␉␉CurrDiv;␊ |
95 | ␉␉uint64_t␉␉TSCFrequency;␉␉// TSC Frequency Hz␊ |
96 | ␉␉uint64_t␉␉FSBFrequency;␉␉// FSB Frequency Hz␊ |
97 | ␉␉uint64_t␉␉CPUFrequency;␉␉// CPU Frequency Hz␊ |
98 | ␉␉uint32_t␉␉BrandString[16];␉// 48 Byte Branding String␊ |
99 | ␉␉uint32_t␉␉CPUID[CPUID_MAX][4];␉// CPUID 0..4, 80..81 Raw Values␊ |
100 | ␉} CPU;␊ |
101 | ␊ |
102 | ␉struct RAM {␊ |
103 | ␉␉RamSlotInfo_t␉␉DIMM[MAX_RAM_SLOTS];␉// Information about each slot␊ |
104 | ␉␉uint64_t␉␉Frequency;␉␉// Ram Frequency␊ |
105 | ␉} RAM;␊ |
106 | ␊ |
107 | ␉uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FADT: PM_Profile)␊ |
108 | ␊ |
109 | } PlatformInfo_t;␊ |
110 | ␊ |
111 | extern PlatformInfo_t Platform;␊ |
112 | ␊ |
113 | #endif /* !__LIBSAIO_PLATFORM_H */␊ |
114 | ␊ |
115 | |