Chameleon

View IntelHDGen7_patch.txt

1diff --git a/i386/libsaio/gma.c b/i386/libsaio/gma.c
2index fa3a11e..2425652 100644
3--- a/i386/libsaio/gma.c
4+++ b/i386/libsaio/gma.c
5@@ -1,7 +1,7 @@
6 /*
7 Original patch by Nawcom
8 http://forum.voodooprojects.org/index.php/topic,1029.0.html
9-
10+
11 Original Intel HDx000 code from valv
12 */
13
14@@ -134,11 +134,15 @@ static struct gma_gpu_t KnownGPUS[] = {
15 { 0x80860116, "Intel HD Graphics 3000 Mobile"},
16 { 0x80860122, "Intel HD Graphics 3000"},
17 { 0x80860126, "Intel HD Graphics 3000 Mobile"},
18+{ 0x80860152, "Intel HD Graphics 2500"},
19+{ 0x80860156, "Intel HD Graphics 2500 Mobile"},
20+{ 0x80860162, "Intel HD Graphics 4000"},
21+{ 0x80860166, "Intel HD Graphics 4000 Mobile"},
22 };
23
24 char *get_gma_model(uint32_t id) {
25-int i = 0;
26-
27+int i;
28+
29 for (i = 0; i < (sizeof(KnownGPUS) / sizeof(KnownGPUS[0])); i++)
30 {
31 if (KnownGPUS[i].device == id)
32@@ -156,34 +160,34 @@ bool setup_gma_devprop(pci_dt_t *gma_dev)
33 uint8_t BuiltIn =0x00;
34 uint8_t ClassFix[4] ={ 0x00, 0x00, 0x03, 0x00 };
35 unsigned intdevice_id;
36-
37+struct DevPropDevice *device = NULL;
38+
39 devicepath = get_pci_dev_path(gma_dev);
40-
41+
42 bar[0] = pci_config_read32(gma_dev->dev.addr, 0x10);
43 regs = (uint8_t *) (bar[0] & ~0x0f);
44-
45+
46 model = get_gma_model((gma_dev->vendor_id << 16) | gma_dev->device_id);
47 device_id = gma_dev->device_id;
48-
49+
50 verbose("Intel %s [%04x:%04x] :: %s\n",
51 model, gma_dev->vendor_id, gma_dev->device_id, devicepath);
52-
53+
54 if (!string)
55 string = devprop_create_string();
56-
57-struct DevPropDevice *device = malloc(sizeof(struct DevPropDevice));
58+
59 device = devprop_add_device(string, devicepath);
60-
61+
62 if (!device)
63 {
64 printf("Failed initializing dev-prop string dev-entry.\n");
65 pause();
66 return false;
67 }
68-
69+
70 devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1));
71-devprop_add_value(device, "device_type", (uint8_t*)"display", 8);
72-
73+devprop_add_value(device, "device_type", (uint8_t*)"display", 8);
74+
75 if ((model == (char *)&"Mobile GMA950")
76 || (model == (char *)&"Mobile GMA3150"))
77 {
78@@ -285,7 +289,36 @@ bool setup_gma_devprop(pci_dt_t *gma_dev)
79 devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18);
80 devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20);
81 }
82-
83+else if (!strncmp(model, "Intel HD Graphics 2500", 12U) ||
84+ !strncmp(model, "Intel HD Graphics 4000", 12U))
85+{
86+uint32_t ig_platform_id = 0U;// Default to 0x01660000
87+getIntForKey("IGPlatformId", (int*)&ig_platform_id, &bootInfo->chameleonConfig);
88+if (ig_platform_id > 11U) ig_platform_id = 0U;
89+if (ig_platform_id >= 5U && ig_platform_id <= 7U)
90+ig_platform_id |= 0x01620000U;
91+else
92+ig_platform_id |= 0x01660000U;
93+devprop_add_value(device, "AAPL,ig-platform-id", (uint8_t*)&ig_platform_id, sizeof ig_platform_id);
94+#if 0
95+devprop_add_value(device, "built-in", &BuiltIn, 1);
96+devprop_add_value(device, "class-code", ClassFix, 4);
97+devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
98+#endif
99+
100+#if 0
101+{
102+struct DevPropDevice *meiDevice = NULL;
103+uint32_t mei_device_id = 0x1e3aU;
104+meiDevice = devprop_add_device(string, "PciRoot(0x0)/Pci(0x16,0x0)");
105+if (meiDevice)
106+devprop_add_value(meiDevice, "device-id", (uint8_t*)&mei_device_id, sizeof mei_device_id);
107+else
108+printf("Failed initializing dev-prop MEIDevice.\n");
109+}
110+#endif
111+}
112+
113 stringdata = malloc(sizeof(uint8_t) * string->length);
114 if (!stringdata)
115 {
116@@ -293,9 +326,9 @@ bool setup_gma_devprop(pci_dt_t *gma_dev)
117 pause();
118 return false;
119 }
120-
121+
122 memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length);
123 stringlength = string->length;
124-
125+
126 return true;
127 }
128

Archive Download this file

Attachment to issue 303

Created: 11 years 4 months ago by zenith432