Chameleon

Chameleon Commit Details

Date:2013-09-20 21:01:40 (10 years 5 months ago)
Author:MacMan
Commit:2264
Parents: 2263
Message:Added support for Intel HD Graphics 2500, Intel HD Graphics 4600, Intel HD Graphics 4600 Mobile, Intel HD Graphics 5000. Added two new boot keys IGPlatformID=[value] to allow for overriding default Intel HD Graphics Platform ID and IGPEnabler=Yes/No to allow for Intel HD Graphics injection with GraphicsEnabler=No.
Changes:
M/branches/Chimera/.config
M/branches/Chimera/i386/libsaio/cpu.c
M/branches/Chimera/autoconf.h
M/branches/Chimera/version
M/branches/Chimera/autoconf.inc
M/branches/Chimera/i386/boot2/boot.h
M/branches/Chimera/i386/libsaio/pci_setup.c
M/branches/Chimera/CHANGES
M/branches/Chimera/auto.conf
M/branches/Chimera/doc/BootHelp.txt
M/branches/Chimera/i386/libsaio/gma.c
M/branches/Chimera/i386/modules/klibc/Makefile

File differences

branches/Chimera/.config
11
22
33
4
4
55
66
77
......
2222
2323
2424
25
25
26
2627
2728
2829
#
# Automatically generated make config: don't edit
# Chameleon Configuration
# Wed Aug 7 21:43:55 2013
# Fri Aug 9 19:56:27 2013
#
CONFIG_OPTIMIZATION_LEVEL="-Oz"
CONFIG_BDMESG=y
# Modules
#
# CONFIG_RESOLUTION_MODULE is not set
# CONFIG_KLIBC_MODULE is not set
CONFIG_KLIBC_MODULE=y
# CONFIG_UCLIBCXX_MODULE is not set
# CONFIG_SATA_MODULE is not set
CONFIG_KEYLAYOUT_MODULE=m
# CONFIG_ACPICODEC_MODULE is not set
branches/Chimera/version
1
1
2.1.2
2.2.0
branches/Chimera/autoconf.inc
11
22
33
4
4
55
6
67
78
8
9
910
1011
1112
;
; Automatically generated make config: don't edit
; Chameleon Configuration
; Wed Aug 7 21:43:55 2013
; Fri Aug 9 19:56:27 2013
;
CONFIG_UCLIBCXX_MODULE EQU 0
CONFIG_BOOT1_HFS_DEBUG EQU 0
CONFIG_SATA_MODULE EQU 0
CONFIG_KLIBC_MODULE EQU 0
CONFIG_KLIBC_MODULE EQU 1
CONFIG_BOOT0_DEBUG EQU 0
CONFIG_OPENUP EQU 0
CONFIG_BOOT1_HFS_VERBOSE EQU 1
branches/Chimera/i386/libsaio/gma.c
1414
1515
1616
17
1718
1819
1920
......
9697
9798
9899
99
100
100101
101102
102103
103104
104105
105
106
106107
107108
108109
......
139140
140141
141142
143
144
145
146
142147
143148
144149
......
154159
155160
156161
157
162
163
164
158165
159166
160167
......
163170
164171
165172
166
167
173
174
175
176
177
178
179
180
181
168182
169183
170184
......
240254
241255
242256
257
258
259
260
261
262
243263
244264
245265
......
261281
262282
263283
284
285
286
287
288
289
264290
265291
266292
......
270296
271297
272298
299
300
301
302
303
304
305
306
307
308
273309
274310
275311
......
291327
292328
293329
330
331
332
333
334
335
294336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
295354
296355
297356
298357
299358
300359
301
360
361
362
363
364
365
366
367
368
369
302370
303371
304372
305373
306374
307375
308
376
377
378
379
380
381
382
383
384
385
309386
310
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
311422
312423
313424
#include "gma.h"
#include "vbe.h"
#include "graphics.h"
#include "stdio.h"
#ifndef DEBUG_GMA
#define DEBUG_GMA 0
0xf0,0x1f,0x01,0x00,0x00,0x00,0x10,0x07,0x00,0x00
};
// The following values came from a Sandy Bridge MacBook Air
// MacMan: The following values came from a Sandy Bridge MacBook Air
uint8_t HD3000_tbl_info[18] = {
0x30,0x44,0x02,0x02,0x02,0x02,0x00,0x00,0x00,
0x00,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01
};
// The following values came from a Sandy Bridge MacBook Air
//MacMan: The following values came from a Sandy Bridge MacBook Air
uint8_t HD3000_os_info[20] = {
0x30,0x49,0x01,0x12,0x12,0x12,0x08,0x00,0x00,0x01,
0xf0,0x1f,0x01,0x00,0x00,0x00,0x10,0x07,0x00,0x00
{ 0x80860156, "Intel HD Graphics 2500 Mobile"},
{ 0x80860162, "Intel HD Graphics 4000"},
{ 0x80860166, "Intel HD Graphics 4000 Mobile"},
{ 0x80860412, "Intel HD Graphics 4600"}, // MacMan
{ 0x80860416, "Intel HD Graphics 4600 Mobile"}, // MacMan
{ 0x80860422, "Intel HD Graphics 5000"}, // MacMan
{ 0x80860426, "Intel HD Graphics 5000 Mobile"}, // MacMan
};
char *get_gma_model(uint32_t id) {
bool setup_gma_devprop(pci_dt_t *gma_dev)
{
char*devicepath;
intlen;
const char*value;
char*devicepath;
volatile uint8_t*regs;
uint32_tbar[7];
char*model;
uint8_t ClassFix[4] = { 0x00, 0x00, 0x03, 0x00 };
uint8_t hd3k_device_id[4] = { 0x26, 0x01, 0x00, 0x00 };
uint8_t hd4k_device_id[4] = { 0x66, 0x01, 0x00, 0x00 };
uint8_t ig_id[4] = { 0x0A, 0x00, 0x66, 0x01 };
uint8_t ig_id_mobile[4] = { 0x09, 0x00, 0x66, 0x01 };
uint8_t hd4600_device_id[4] = { 0x12, 0x04, 0x00, 0x00 }; // MacMan
uint8_t hd5k_device_id[4] = { 0x16, 0x04, 0x00, 0x00 }; // MacMan
uint8_t snb_id_3k[4] = { 0x10, 0x00, 0x03, 0x00 };
uint8_t ig_id_2500[4] = { 0x0B, 0x00, 0x66, 0x01 }; // MacMan
uint8_t ig_id_4k[4] = { 0x0A, 0x00, 0x66, 0x01 };
uint8_t ig_id_4k_mobile[4] = { 0x09, 0x00, 0x66, 0x01 }; // MacMan
uint8_t ig_id_4600[4] = { 0x00, 0x00, 0x16, 0x04 }; // MacMan
uint8_t ig_id_5k[4] = { 0x00, 0x00, 0x26, 0x04 }; // MacMan
uint8_t ig_platform_id[4] = { 0x00, 0x00, 0x00, 0x00 }; // MacMan
devicepath = get_pci_dev_path(gma_dev);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
verbose("Setting %s for snb-platform-id\n", value);
}
}
else if (model == (char *)&"Intel HD Graphics 2000 Mobile")
{
devprop_add_value(device, "AAPL00,T7", HD2000_vals[7], 4);
devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20);
devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
verbose("Setting %s for snb-platform-id\n", value);
}
}
else if (model == (char *)&"Intel HD Graphics 3000")
{
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
verbose("Using %s for snb-platform-id\n", value);
}
else
{
devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k, 4);
}
}
else if (model == (char *)&"Intel HD Graphics 3000 Mobile")
{
devprop_add_value(device, "AAPL00,T7", HD3000_vals[7], 4);
devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20);
devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
verbose("Setting %s for snb-platform-id\n", value);
}
}
else if (model == (char *)&"Intel HD Graphics 2500") // MacMan
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "device-id", hd4k_device_id, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
verbose("Using %s for ig-platform-id\n", value);
}
else
{
devprop_add_value(device, "AAPL,ig-platform-id", ig_id_2500, 4);
}
}
else if (model == (char *)&"Intel HD Graphics 4000")
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "device-id", hd4k_device_id, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,ig-platform-id", ig_id, 4);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
verbose("Using %s for ig-platform-id\n", value);
}
else
{
devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k, 4);
}
}
else if (model == (char *)&"Intel HD Graphics 4000 Mobile")
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,ig-platform-id", ig_id_mobile, 4);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
verbose("Using %s for ig-platform-id\n", value);
}
else
{
devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k_mobile, 4);
}
}
else if (model == (char *)&"Intel HD Graphics 4600") //MacMan
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "device-id", hd4600_device_id, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
verbose("Using %s for ig-platform-id\n", value);
}
else
{
devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600, 4);
}
}
else if (model == (char *)&"Intel HD Graphics 5000") //MacMan
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "device-id", hd5k_device_id, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
{
sscanf(value, "%8x", ig_platform_id);
devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
verbose("Using %s for ig-platform-id\n", value);
}
else
{
devprop_add_value(device, "AAPL,ig-platform-id", ig_id_5k, 4);
}
}
stringdata = malloc(sizeof(uint8_t) * string->length);
if (!stringdata)
{
branches/Chimera/i386/libsaio/cpu.c
286286
287287
288288
289
289
290290
291291
292292
......
389389
390390
391391
392
392
393393
394394
395395
......
461461
462462
463463
464
464
465465
466466
467467
p->CPU.Model != CPU_MODEL_ATOM// MSR is *NOT* available on the Intel Atom CPU
)
{
msr = rdmsr64(MSR_CORE_THREAD_COUNT);// Undocumented MSR in Nehalem and newer CPUs
msr = rdmsr64(MSR_CORE_THREAD_COUNT);// MacMan: Undocumented MSR in Nehalem and newer CPUs
p->CPU.NoCores= bitfield((uint32_t)msr, 31, 16);// Using undocumented MSR to get actual values
p->CPU.NoThreads= bitfield((uint32_t)msr, 15, 0);// Using undocumented MSR to get actual values
}
msr = rdmsr64(MSR_PLATFORM_INFO);
//DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0));
bus_ratio_max = bitfield(msr, 15, 8);//MacMan: Changed bitfield to match Apple tsc.c
bus_ratio_min = bitfield(msr, 47, 40);//MacMan: Changed bitfield to match Apple tsc.c
bus_ratio_min = bitfield(msr, 47, 40);//MacMan: Changed bitfield to match Apple tsc.c
msr = rdmsr64(MSR_FLEX_RATIO);
//DBG("msr(%d): flex_ratio %08x\n", __LINE__, bitfield(msr, 31, 0));
if (bitfield(msr, 16, 16)) {
} else {
msr = rdmsr64(MSR_IA32_PERF_STATUS);
DBG("msr(%d): ia32_perf_stat 0x%08x\n", __LINE__, bitfield(msr, 31, 0));
currcoef = bitfield(msr, 12, 8);
currcoef = bitfield(msr, 15, 8); //MacMan: Fixed bitfield to Intel documentation
/* Non-integer bus ratio for the max-multi*/
maxdiv = bitfield(msr, 46, 46);
/* Non-integer bus ratio for the current-multi (undocumented)*/
branches/Chimera/i386/libsaio/pci_setup.c
1717
1818
1919
20
20
2121
2222
2323
2424
2525
2626
27
2728
2829
2930
......
4344
4445
4546
46
47
4748
4849
4950
......
5960
6061
6162
63
64
65
66
6267
6368
6469
void setup_pci_devs(pci_dt_t *pci_dt)
{
char *devicepath;
bool do_eth_devprop, do_gfx_devprop, do_enable_hpet;
bool do_eth_devprop, do_gfx_devprop, do_enable_hpet, do_igp_devprop;
pci_dt_t *current = pci_dt;
do_eth_devprop = do_gfx_devprop = do_enable_hpet = false;
getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);
getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig);
getBoolForKey(kIGPEnabler, &do_igp_devprop, &bootInfo->chameleonConfig);
getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);
while (current)
break;
case PCI_CLASS_DISPLAY_VGA:
if (do_gfx_devprop)
if (do_gfx_devprop){
switch (current->vendor_id)
{
case PCI_VENDOR_ID_ATI:
break;
}
break;
} else if (do_igp_devprop){
setup_gma_devprop(current);
break;
}
case PCI_CLASS_SERIAL_USB:
notify_usb_dev(current);
branches/Chimera/i386/boot2/boot.h
112112
113113
114114
115
116
115117
116118
117119
......
119121
120122
121123
124
122125
123126
124127
#define kAtiPorts"AtiPorts"/* ati.c */
#define kATYbinimage"ATYbinimage"/* ati.c */
#define kIGPlatformID"IGPlatformID"/* gma.c */ // MacMan
#define kUseNvidiaROM"UseNvidiaROM"/* nvidia.c */
#define kVBIOS"VBIOS"/* nvidia.c */
#define kDcfg0"display_0"/* nvidia.c */
#define kEthernetBuiltIn"EthernetBuiltIn"/* pci_setup.c */
#define kGraphicsEnabler"GraphicsEnabler"/* pci_setup.c */
#define kIGPEnabler "IGPEnabler" /* pci_setup.c */ // MacMan
#define kEnableHDMIAudio"EnableHDMIAudio"/*ati.c && nvidia.c */
#define kForceHPET"ForceHPET"/* pci_setup.c */
branches/Chimera/i386/modules/klibc/Makefile
11
2
2
33
44
55
MODULE_NAME = klibc
MODULE_DESCRIPTION = This module provides a standard c library for modules to link to if the library provided by chameleon is insufficient. This is currently only used by the uClibc++ library.
MODULE_DESCRIPTION = Provides a standard c library to link to if the library provided by Chameleon is insufficient.
MODULE_AUTHOR =
MODULE_VERSION = "1.5.20"
MODULE_COMPAT_VERSION = "1.5.20"
branches/Chimera/auto.conf
11
22
33
4
4
55
6
67
78
89
#
# Automatically generated make config: don't edit
# Chameleon Configuration
# Wed Aug 7 21:43:55 2013
# Fri Aug 9 19:56:27 2013
#
CONFIG_KLIBC_MODULE=y
CONFIG_BOOT1_HFS_VERBOSE=y
CONFIG_BOOT1_HFS=y
CONFIG_MODULES=y
branches/Chimera/autoconf.h
11
22
33
4
4
55
66
77
8
89
910
1011
//
// Automatically generated make config: don't edit
// Chameleon Configuration
// Wed Aug 7 21:43:55 2013
// Fri Aug 9 19:56:27 2013
//
#define CONFIG_IS_BUILTIN 1
#define CONFIG_IS_MODULE 2
#define CONFIG_KLIBC_MODULE CONFIG_IS_BUILTIN
#define CONFIG_BOOT1_HFS_VERBOSE CONFIG_IS_BUILTIN
#define CONFIG_BOOT1_HFS CONFIG_IS_BUILTIN
#define CONFIG_MODULES CONFIG_IS_BUILTIN
branches/Chimera/doc/BootHelp.txt
8585
8686
8787
88
88
89
8990
9091
9192
VBIOS=Yes|No Inject NVIDIA VBIOS into device-properties.
display_0=<value> Inject alternate value of display-cfg into NVDA,Display-A@0 (HEX).
display_1=<value> Inject alternate value of display-cfg into NVDA,Display-B@1 (HEX).
EnableHDMIAudio=Yes Inject HDMI audio for NVIDIA
IGPlatformID=<value> Override or set Intel HD Graphics Platform ID
IGPEnabler=Yes|No Automatic device-properties generation for Intel IGP when GraphicsEnabler=No
EthernetBuiltIn=Yes|No Automatic "built-in"=yes device-properties generation
for ethernet interfaces.
branches/Chimera/CHANGES
1
2
3
4
15
26
37
-macman: Chimera 2.2.0 specific changes:
Added suport for Intel HD Graphics 2500, Intel HD Graphics 4600, Intel HD Graphics 4600 Mobile and Intel HD Graphics 5000
Added new boot key IGPEnabler=Yes|No for automatic device-properties generation for Intel IGP when GraphicsEnabler=No
Added new boot key IGPlatformID=<value> to allow for overriding or setting Intel HD Graphics Platform ID
-macman: Chimera 2.1.2 specific changes:
Removed all closed source modules
-macman: Chimera 2.1.i specific changes:

Archive Download the corresponding diff file

Revision: 2264