Chameleon

Chameleon Commit Details

Date:2015-04-29 15:00:46 (4 years 2 months ago)
Author:ErmaC
Commit:2663
Parents: 2662
Message:Update and improve gma source.
Changes:
M/trunk/i386/libsaio/gma.c
M/trunk/i386/libsaio/gma.h

File differences

trunk/i386/libsaio/gma.c
2929
3030
3131
32
32
3333
3434
3535
......
4545
4646
4747
48
48
4949
5050
5151
......
5959
6060
6161
62
63
64
65
6266
6367
68
6469
6570
6671
......
312317
313318
314319
315
320
316321
317322
318323
......
551556
552557
553558
554
559
555560
556561
557562
......
568573
569574
570575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
571595
572596
573597
......
590614
591615
592616
593
594
595617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
596640
597641
598642
......
600644
601645
602646
603
604
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
605670
606671
607672
......
610675
611676
612677
678
679
613680
681
614682
615
616
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
617710
618711
619712
......
697790
698791
699792
793
700794
701795
702796
......
853947
854948
855949
856
950
857951
858952
859953
http://forum.voodooprojects.org/index.php/topic,1029.0.html
Original Intel HDx000 code from valv
Intel Ivy Bridge and Haswell code from ErmaC:
Intel Ivy Bridge, Haswell and Broadwell code from ErmaC:
- http://www.insanelymac.com/forum/topic/288241-intel-hd4000-inject-aaplig-platform-id/
*/
#include "graphics.h"
#ifndef DEBUG_GMA
#define DEBUG_GMA 0
#define DEBUG_GMA 0
#endif
#ifndef DEBUG_BDW
#endif
static booldoit= false;
static uint8_t default_aapl_snb[]={ 0x00,0x03,0x00,0x01 };
#define AAPL_LEN_SNB ( sizeof(default_aapl_snb) / sizeof(uint8_t) )
static uint8_t default_aapl_ivy[]={ 0x05,0x00,0x62,0x01 }; // ivy_bridge_ig_vals[5]
#define AAPL_LEN_IVY ( sizeof(default_aapl_ivy) / sizeof(uint8_t) )
static uint8_t default_aapl_haswell[]={ 0x00,0x00,0x26,0x0c }; // haswell_ig_vals[7]
#define AAPL_LEN_HSW ( sizeof(default_aapl_haswell) / sizeof(uint8_t) )
{GMA_IVYBRIDGE_D_GT2,HD_GRAPHICS_4000 },/* 0162 */
{GMA_IVYBRIDGE_S_GT1,HD_GRAPHICS },/* 015a */
{GMA_IVYBRIDGE_S_GT2,"HD Graphics P4000" }, /* 016a */
{GMA_IVYBRIDGE_S_GT3, HD_GRAPHICS },/* 015e */
{GMA_IVYBRIDGE_S_GT3,HD_GRAPHICS },/* 015e */
{GMA_IVYBRIDGE_S_GT4,HD_GRAPHICS_2500 },/* 0172 */
{GMA_IVYBRIDGE_S_GT5,HD_GRAPHICS_2500 },/* 0176 */
/* 0106 */
case GMA_SANDYBRIDGE_M_GT1: // HD Graphics 2000 Mobile
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "class-code",ClassFix, 4);
devprop_add_value(device, "AAPL00,PixelFormat",HD2000_vals[0], 4);
devprop_add_value(device, "AAPL00,T1",HD2000_vals[1], 4);
devprop_add_value(device, "AAPL00,T2",HD2000_vals[2], 4);
devprop_add_value(device, "graphic-options",HD2000_vals[13], 4);
devprop_add_value(device, "AAPL,tbl-info",HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD2000_os_info, 20);
if (getValueForKey(kAAPLCustomIG, &value, &len, &bootInfo->chameleonConfig) && len == AAPL_LEN_SNB * 2)
{
uint8_t new_aapl0[AAPL_LEN_SNB];
if (hex2bin(value, new_aapl0, AAPL_LEN_SNB) == 0)
{
memcpy(default_aapl_snb, new_aapl0, AAPL_LEN_SNB);
verbose("Using user supplied AAPL,snb-platform-id\n");
verbose("AAPL,snb-platform-id: %02x%02x%02x%02x\n",
default_aapl_snb[0], default_aapl_snb[1], default_aapl_snb[2], default_aapl_snb[3]);
}
devprop_add_value(device, "AAPL,snb-platform-id", default_aapl_snb, AAPL_LEN_SNB);
}
else
{
uint32_t ig_platform_id = 0x00030010; // set the default platform ig
devprop_add_value(device, "AAPL,snb-platform-id", (uint8_t *)&ig_platform_id, 4);
}
break;
/* 0116, 0126 */
devprop_add_value(device, "graphic-options",HD3000_vals[13], 4);
devprop_add_value(device, "AAPL,tbl-info",HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD3000_os_info, 20);
devprop_add_value(device, "AAPL,snb-platform-id",HD3000_vals[16], 4);// previusly commented
break;
if (getValueForKey(kAAPLCustomIG, &value, &len, &bootInfo->chameleonConfig) && len == AAPL_LEN_SNB * 2)
{
uint8_t new_aapl0[AAPL_LEN_SNB];
if (hex2bin(value, new_aapl0, AAPL_LEN_SNB) == 0)
{
memcpy(default_aapl_snb, new_aapl0, AAPL_LEN_SNB);
verbose("Using user supplied AAPL,snb-platform-id\n");
verbose("AAPL,snb-platform-id: %02x%02x%02x%02x\n",
default_aapl_snb[0], default_aapl_snb[1], default_aapl_snb[2], default_aapl_snb[3]);
}
devprop_add_value(device, "AAPL,snb-platform-id", default_aapl_snb, AAPL_LEN_SNB);
}
else
{
uint32_t ig_platform_id = 0x00010000; // set the default platform ig
devprop_add_value(device, "AAPL,snb-platform-id", (uint8_t *)&ig_platform_id, 4);
}
break;
/* 0102 */
/* HD Graphics 2000 */
case GMA_SANDYBRIDGE_GT1: // 0102
devprop_add_value(device, "built-in",&BuiltIn, 1);
devprop_add_value(device, "class-code",ClassFix, 4);
devprop_add_value(device, "device-id",(uint8_t *)&device_id, sizeof(device_id));
devprop_add_value(device, "AAPL,tbl-info",HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD2000_os_info, 20);
devprop_add_value(device, "AAPL,tbl-info",HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD2000_os_info, 20);
if (getValueForKey(kAAPLCustomIG, &value, &len, &bootInfo->chameleonConfig) && len == AAPL_LEN_SNB * 2)
{
uint8_t new_aapl0[AAPL_LEN_SNB];
if (hex2bin(value, new_aapl0, AAPL_LEN_SNB) == 0)
{
memcpy(default_aapl_snb, new_aapl0, AAPL_LEN_SNB);
verbose("Using user supplied AAPL,snb-platform-id\n");
verbose("AAPL,snb-platform-id: %02x%02x%02x%02x\n",
default_aapl_snb[0], default_aapl_snb[1], default_aapl_snb[2], default_aapl_snb[3]);
}
devprop_add_value(device, "AAPL,snb-platform-id", default_aapl_snb, AAPL_LEN_SNB);
}
else
{
uint32_t ig_platform_id = 0x00030010; // set the default platform ig
devprop_add_value(device, "AAPL,snb-platform-id", (uint8_t *)&ig_platform_id, 4);
}
break;
/* Sandy Bridge */
case GMA_SANDYBRIDGE_GT2_PLUS: // 0122
devprop_add_value(device, "built-in",&BuiltIn, 1);
devprop_add_value(device, "class-code",ClassFix, 4);
verbose("Injecting a valid desktop GPU device id (0x0126) instead of patching kexts.\n");
device_id = 0x00000126;// Inject a valid mobile GPU device id instead of patching kexts
devprop_add_value(device, "vendor-id",(uint8_t *)INTEL_VENDORID, 4);
devprop_add_value(device, "device-id",(uint8_t *)&device_id, sizeof(device_id));
devprop_add_value(device, "AAPL,tbl-info",HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD3000_os_info, 20);
devprop_add_value(device, "compatible",(uint8_t *)"pci8086,0126", 13);
devprop_add_value(device, "name",(uint8_t *)"pci8086,0126", 13);
verbose("Injeting done: was [%04x:%04x] now is [%04x:%04x]\n", gma_dev->vendor_id, gma_dev->device_id, gma_dev->vendor_id, device_id);
devprop_add_value(device, "AAPL,tbl-info",HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD3000_os_info, 20);
if (getValueForKey(kAAPLCustomIG, &value, &len, &bootInfo->chameleonConfig) && len == AAPL_LEN_SNB * 2)
{
uint8_t new_aapl0[AAPL_LEN_SNB];
if (hex2bin(value, new_aapl0, AAPL_LEN_SNB) == 0)
{
memcpy(default_aapl_snb, new_aapl0, AAPL_LEN_SNB);
verbose("Using user supplied AAPL,snb-platform-id\n");
verbose("AAPL,snb-platform-id: %02x%02x%02x%02x\n",
default_aapl_snb[0], default_aapl_snb[1], default_aapl_snb[2], default_aapl_snb[3]);
}
devprop_add_value(device, "AAPL,snb-platform-id", default_aapl_snb, AAPL_LEN_SNB);
}
else
{
uint32_t ig_platform_id = 0x00030010; // set the default platform ig
devprop_add_value(device, "AAPL,snb-platform-id", (uint8_t *)&ig_platform_id, 4);
}
break;
/* Ivy Bridge */
case GMA_HASWELL_E_GT2: // 041e
case GMA_HASWELL_ULT_M_GT2: // 0a16
case GMA_HASWELL_ULT_E_GT2: // 0a1e
verbose("Injecting a valid desktop GPU device id (0x0412) instead of patching kexts.\n");
device_id = 0x00000412;// Inject a valid desktop GPU device id (0x0412) instead of patching kexts
devprop_add_value(device, "vendor-id",(uint8_t *)INTEL_VENDORID, 4);
devprop_add_value(device, "class-code", ClassFix, 4);
break;
#endif
#endif // DEBUG_BDW
default:
break;
}
trunk/i386/libsaio/gma.h
2424
2525
2626
27
28
29
30
31
32
27
28
3329
30
31
32
33
34
3435
3536
3637
......
7071
7172
7273
73
74
7475
7576
76
77
7778
7879
7980
*/
/*
Original patch by Nawcom
http://forum.voodooprojects.org/index.php/topic,1029.0.html
Original Intel HDx000 code from valv
Intel HD4xx and HD5xx code by ErmaC http://www.insanelymac.com/forum/topic/288241-intel-hd4000-inject-aaplig-platform-id/
*/
Original patch by Nawcom
http://forum.voodooprojects.org/index.php/topic,1029.0.html
Original Intel HDx000 code from valv
Intel Ivy Bridge, Haswell and Broadwell code from ErmaC:
- http://www.insanelymac.com/forum/topic/288241-intel-hd4000-inject-aaplig-platform-id/
*/
#ifndef __LIBSAIO_GMA_H
#define __LIBSAIO_GMA_H
#define HD_GRAPHICS_5500 "HD Graphics 5500"
#define HD_GRAPHICS_5600 "HD Graphics 5600"
#define HD_GRAPHICS_6000 "HD Graphics 6000"
#define IRIS_6100 "Iris graphics 6100"
#define IRIS_6100 "Iris Graphics 6100"
#define IRIS_6200 "Iris Pro Graphics 6200"
#define IRIS_6300 "Iris Pro Graphics P6300"
#define INTEL_VENDORID0x8086
#define INTEL_VENDORID 0x8086
/* http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/tree/src/intel_driver.h */
/* http://people.redhat.com/agk/patches/linux/patches-3.6/git-update1.patch */

Archive Download the corresponding diff file

Revision: 2663