Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/libsaio/platform.h

1/*
2 * platform.h
3 * AsereBLN: reworked and extended
4 *
5 */
6
7#ifndef __LIBSAIO_PLATFORM_H
8#define __LIBSAIO_PLATFORM_H
9
10#include "libsaio.h"
11#include "cpuid.h"
12#include "cpu_data.h"
13
14extern bool platformCPUExtFeature(uint32_t);
15extern bool platformCPUFeature(uint32_t);
16extern void scan_platform(void);
17
18#define bitmask(h,l)((_Bit(h)|(_Bit(h)-1)) & ~(_Bit(l)-1))
19#define bitfield(x,h,l)(((x) & bitmask(h,l)) >> l)
20
21#define quad(hi,lo) (((uint64_t)(hi)) << 32 | (lo))
22
23
24/* CPUID index into cpuid_raw */
25#define CPUID_00
26#define CPUID_11
27#define CPUID_22
28#define CPUID_33
29#define CPUID_44
30#define CPUID_805
31#define CPUID_816
32#define CPUID_MAX7
33
34/* Additional models supported by Chameleon (NOT SUPPORTED BY THE APPLE'S ORIGINAL KERNEL) */
35#define CPUID_MODEL_BANIAS 0x09
36#define CPUID_MODEL_DOTHAN 0x0D
37#define CPUID_MODEL_ATOM0x1C
38
39/* SMBIOS Memory Types */
40#define SMB_MEM_TYPE_UNDEFINED0
41#define SMB_MEM_TYPE_OTHER1
42#define SMB_MEM_TYPE_UNKNOWN2
43#define SMB_MEM_TYPE_DRAM3
44#define SMB_MEM_TYPE_EDRAM4
45#define SMB_MEM_TYPE_VRAM5
46#define SMB_MEM_TYPE_SRAM6
47#define SMB_MEM_TYPE_RAM7
48#define SMB_MEM_TYPE_ROM8
49#define SMB_MEM_TYPE_FLASH9
50#define SMB_MEM_TYPE_EEPROM10
51#define SMB_MEM_TYPE_FEPROM11
52#define SMB_MEM_TYPE_EPROM12
53#define SMB_MEM_TYPE_CDRAM13
54#define SMB_MEM_TYPE_3DRAM14
55#define SMB_MEM_TYPE_SDRAM15
56#define SMB_MEM_TYPE_SGRAM16
57#define SMB_MEM_TYPE_RDRAM17
58#define SMB_MEM_TYPE_DDR18
59#define SMB_MEM_TYPE_DDR219
60#define SMB_MEM_TYPE_FBDIMM20
61#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
62
63/* Memory Configuration Types */
64#define SMB_MEM_CHANNEL_UNKNOWN0
65#define SMB_MEM_CHANNEL_SINGLE1
66#define SMB_MEM_CHANNEL_DUAL2
67#define SMB_MEM_CHANNEL_TRIPLE3
68
69/* Maximum number of ram slots */
70#define MAX_RAM_SLOTS8
71#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
72
73/* Maximum number of SPD bytes */
74#define MAX_SPD_SIZE256
75
76/* Size of SMBIOS UUID in bytes */
77#define UUID_LEN16
78
79typedef struct _RamSlotInfo_t {
80 uint32_tModuleSize;// Size of Module in MB
81 uint32_tFrequency; // in Mhz
82 const char*Vendor;
83 const char*PartNo;
84 const char*SerialNo;
85 char*spd;// SPD Dump
86 boolInUse;
87 uint8_tType;
88 uint8_tBankConnections; // table type 6, see (3.3.7)
89 uint8_tBankConnCnt;
90
91} RamSlotInfo_t;
92
93typedef struct _PlatformInfo_t {
94struct CPU {
95uint64_tFeatures;// CPU Features like MMX, SSE2, VT ...
96 uint64_tExtFeatures; // CPU Extended Features like SYSCALL, XD, EM64T, LAHF ...
97uint32_tVendor;// Vendor
98uint32_tSignature;// Signature
99uint8_t Stepping;// Stepping
100uint8_t Model;// Model
101uint8_t ExtModel;// Extended Model
102uint8_t Family;// Family
103uint8_t ExtFamily;// Extended Family
104uint32_tNoCores;// No Cores per Package
105uint32_tNoThreads;// Threads per Package
106uint8_tMaxCoef;// Max Multiplier
107uint8_tMaxDiv;
108uint8_tCurrCoef;// Current Multiplier
109uint8_tCurrDiv;
110uint64_tTSCFrequency;// TSC Frequency Hz
111uint64_tFSBFrequency;// FSB Frequency Hz
112uint64_tCPUFrequency;// CPU Frequency Hz
113charBrandString[48];// 48 Byte Branding String
114 uint8_t Brand;
115 uint32_tMicrocodeVersion; // The microcode version number a.k.a. signature a.k.a. BIOS ID
116 bool isMobile;
117boolisServer;// Unlike isMobile, if this value is set it will disable all kind of detection and enforce "Server" as platform (must be set by user)
118} CPU;
119
120struct RAM {
121uint64_tFrequency;// Ram Frequency
122uint32_tDivider;// Memory divider
123uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
124uint8_tTRC;
125uint8_tTRP;
126uint8_tRAS;
127uint8_tChannels;// Channel Configuration Single,Dual or Triple
128uint8_tNoSlots;// Maximum no of slots available
129uint8_tType;// Standard SMBIOS v2.5 Memory Type
130RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
131} RAM;
132
133struct DMI {
134intMaxMemorySlots;// number of memory slots polulated by SMBIOS
135intCntMemorySlots;// number of memory slots counted
136intMemoryModules;// number of memory modules installed
137intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
138} DMI;
139uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PreferredProfile)
140uint8_t*UUID; // SMBios UUID
141uint32_thardware_signature;
142int8_tsysid[16];
143} PlatformInfo_t;
144
145extern PlatformInfo_t *Platform;
146#endif /* !__LIBSAIO_PLATFORM_H */
147

Archive Download this file

Revision: 1119