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 | ␉uint8_t␉␉Type;␊ |
74 | ␉char␉␉Vendor[64];␊ |
75 | ␉char␉␉PartNo[64];␊ |
76 | ␉char␉␉SerialNo[16];␊ |
77 | ␉uint8_t␉␉spd[MAX_SPD_SIZE];␊ |
78 | } RamSlotInfo_t;␊ |
79 | ␊ |
80 | typedef struct _PlatformInfo_t {␊ |
81 | ␉struct CPU {␊ |
82 | ␉␉uint32_t␉␉Features;␉␉// CPU Features like MMX, SSE2, VT, MobileCPU␊ |
83 | ␉␉uint32_t␉␉Vendor;␉␉␉// Vendor␊ |
84 | ␉␉uint32_t␉␉Model;␉␉␉// Model␊ |
85 | ␉␉uint32_t␉␉ExtModel;␉␉// Extended Model␊ |
86 | ␉␉uint32_t␉␉Family;␉␉␉// Family␊ |
87 | ␉␉uint32_t␉␉ExtFamily;␉␉// Extended Family␊ |
88 | ␉␉uint32_t␉␉NoCores;␉␉// No Cores per Package␊ |
89 | ␉␉uint32_t␉␉NoThreads;␉␉// Threads per Package␊ |
90 | ␉␉uint8_t␉␉␉MaxCoef;␉␉// Max Multiplier␊ |
91 | ␉␉uint8_t␉␉␉MaxDiv;␊ |
92 | ␉␉uint8_t␉␉␉CurrCoef;␉␉// Current Multiplier␊ |
93 | ␉␉uint8_t␉␉␉CurrDiv;␊ |
94 | ␉␉uint64_t␉␉TSCFrequency;␉␉// TSC Frequency Hz␊ |
95 | ␉␉uint64_t␉␉FSBFrequency;␉␉// FSB Frequency Hz␊ |
96 | ␉␉uint64_t␉␉CPUFrequency;␉␉// CPU Frequency Hz␊ |
97 | ␉␉uint32_t␉␉BrandString[16];␉// 48 Byte Branding String␊ |
98 | ␉␉uint32_t␉␉CPUID[CPUID_MAX][4];␉// CPUID 0..4, 80..81 Raw Values␊ |
99 | ␉} CPU;␊ |
100 | ␉struct RAM {␊ |
101 | ␉␉RamSlotInfo_t␉␉DIMM[MAX_RAM_SLOTS];␉// Information about each slot␊ |
102 | ␉␉uint64_t␉␉Frequency;␉␉// Ram Frequency␊ |
103 | ␉} RAM;␊ |
104 | ␊ |
105 | ␉uint8_t Type; // JrCs: System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FADT: PM_Profile)␊ |
106 | ␊ |
107 | } PlatformInfo_t;␊ |
108 | ␊ |
109 | extern PlatformInfo_t Platform;␊ |
110 | ␊ |
111 | #endif /* !__LIBSAIO_PLATFORM_H */␊ |
112 | |