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

Archive Download this file

Revision: 1815