Chameleon

Chameleon Svn Source Tree

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

Source at commit 429 created 13 years 9 months ago.
By meklort, Updated module system. Hooks can now be used within modules when cetaion functions are called in chameleon. Note that onle two hooks currently exist, more need to be added. I also updated the HelloWorld module to use a hook instead of print out right away.
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
12extern bool platformCPUFeature(uint32_t);
13extern void scan_platform(void);
14extern void dumpPhysAddr(const char * title, void * a, int len);
15
16/* CPUID index into cpuid_raw */
17#define CPUID_00
18#define CPUID_11
19#define CPUID_22
20#define CPUID_33
21#define CPUID_44
22#define CPUID_805
23#define CPUID_816
24#define CPUID_MAX7
25
26/* CPU Features */
27#define CPU_FEATURE_MMX0x00000001// MMX Instruction Set
28#define CPU_FEATURE_SSE0x00000002// SSE Instruction Set
29#define CPU_FEATURE_SSE20x00000004// SSE2 Instruction Set
30#define CPU_FEATURE_SSE30x00000008// SSE3 Instruction Set
31#define CPU_FEATURE_SSE410x00000010// SSE41 Instruction Set
32#define CPU_FEATURE_SSE420x00000020// SSE42 Instruction Set
33#define CPU_FEATURE_EM64T0x00000040// 64Bit Support
34#define CPU_FEATURE_HTT0x00000080// HyperThreading
35#define CPU_FEATURE_MOBILE0x00000100// Mobile CPU
36
37/* SMBIOS Memory Types */
38#define SMB_MEM_TYPE_UNDEFINED0
39#define SMB_MEM_TYPE_OTHER1
40#define SMB_MEM_TYPE_UNKNOWN2
41#define SMB_MEM_TYPE_DRAM3
42#define SMB_MEM_TYPE_EDRAM4
43#define SMB_MEM_TYPE_VRAM5
44#define SMB_MEM_TYPE_SRAM6
45#define SMB_MEM_TYPE_RAM7
46#define SMB_MEM_TYPE_ROM8
47#define SMB_MEM_TYPE_FLASH9
48#define SMB_MEM_TYPE_EEPROM10
49#define SMB_MEM_TYPE_FEPROM11
50#define SMB_MEM_TYPE_EPROM12
51#define SMB_MEM_TYPE_CDRAM13
52#define SMB_MEM_TYPE_3DRAM14
53#define SMB_MEM_TYPE_SDRAM15
54#define SMB_MEM_TYPE_SGRAM16
55#define SMB_MEM_TYPE_RDRAM17
56#define SMB_MEM_TYPE_DDR18
57#define SMB_MEM_TYPE_DDR219
58#define SMB_MEM_TYPE_FBDIMM20
59#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
60
61/* Memory Configuration Types */
62#define SMB_MEM_CHANNEL_UNKNOWN0
63#define SMB_MEM_CHANNEL_SINGLE1
64#define SMB_MEM_CHANNEL_DUAL2
65#define SMB_MEM_CHANNEL_TRIPLE3
66
67/* Maximum number of ram slots */
68#define MAX_RAM_SLOTS8
69#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
70
71/* Maximum number of SPD bytes */
72#define MAX_SPD_SIZE256
73
74/* Size of SMBIOS UUID in bytes */
75#define UUID_LEN16
76
77typedef struct _RamSlotInfo_t {
78 uint32_t ModuleSize;// Size of Module in MB
79 uint32_t Frequency; // in Mhz
80 const char*Vendor;
81 const char*PartNo;
82 const char*SerialNo;
83 char*spd;// SPD Dump
84 boolInUse;
85 uint8_tType;
86 uint8_t BankConnections; // table type 6, see (3.3.7)
87 uint8_t BankConnCnt;
88
89} RamSlotInfo_t;
90
91typedef struct _PlatformInfo_t {
92struct CPU {
93uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
94uint32_tVendor;// Vendor
95uint32_tModel;// Model
96uint32_tExtModel;// Extended Model
97uint32_tFamily;// Family
98uint32_tExtFamily;// Extended Family
99uint32_tNoCores;// No Cores per Package
100uint32_tNoThreads;// Threads per Package
101uint8_tMaxCoef;// Max Multiplier
102uint8_tMaxDiv;
103uint8_tCurrCoef;// Current Multiplier
104uint8_tCurrDiv;
105uint64_tTSCFrequency;// TSC Frequency Hz
106uint64_tFSBFrequency;// FSB Frequency Hz
107uint64_tCPUFrequency;// CPU Frequency Hz
108uint32_tBrandString[16];// 48 Byte Branding String
109uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
110} CPU;
111
112struct RAM {
113RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
114} RAM;
115
116struct DMI {
117intMaxMemorySlots;// number of memory slots polulated by SMBIOS
118intCntMemorySlots;// number of memory slots counted
119intMemoryModules;// number of memory modules installed
120intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
121} DMI;
122uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
123} PlatformInfo_t;
124
125extern PlatformInfo_t Platform;
126
127#endif /* !__LIBSAIO_PLATFORM_H */
128

Archive Download this file

Revision: 429