Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/libsaio/gma.c

1/*
2 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3 * All Rights Reserved.
4 * Copyright © 2010 Intel Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 *
25 */
26
27/*
28Original patch by Nawcom
29http://forum.voodooprojects.org/index.php/topic,1029.0.html
30
31Original Intel HDx000 code from valv
32Intel Ivy Bridge and Haswell code from ErmaC:
33- http://www.insanelymac.com/forum/topic/288241-intel-hd4000-inject-aaplig-platform-id/
34*/
35
36#include "libsa.h"
37#include "saio_internal.h"
38#include "bootstruct.h"
39#include "pci.h"
40#include "platform.h"
41#include "device_inject.h"
42#include "gma.h"
43#include "vbe.h"
44#include "graphics.h"
45
46#ifndef DEBUG_GMA
47#define DEBUG_GMA 0
48#endif
49
50#if DEBUG_GMA
51#define DBG(x...)printf(x)
52#else
53#define DBG(x...)
54#endif
55
56uint8_t GMAX3100_vals[23][4] = {
57{ 0x01,0x00,0x00,0x00 },//0 "AAPL,HasPanel"
58{ 0x01,0x00,0x00,0x00 },//1 "AAPL,SelfRefreshSupported"
59{ 0x01,0x00,0x00,0x00 },//2 "AAPL,aux-power-connected"
60{ 0x00,0x00,0x00,0x08 },//3 "AAPL,backlight-control"
61{ 0x64,0x00,0x00,0x00 },//4 "AAPL00,blackscreen-preferences"
62{ 0x00,0x00,0x00,0x08 },//5 "AAPL01,BacklightIntensity"
63{ 0x01,0x00,0x00,0x00 },//6 "AAPL01,blackscreen-preferences"
64{ 0x20,0x00,0x00,0x00 },//7 "AAPL01,DataJustify"
65{ 0x00,0x00,0x00,0x00 },//8 "AAPL01,Depth"
66{ 0x01,0x00,0x00,0x00 },//9 "AAPL01,Dither"
67{ 0x20,0x03,0x00,0x00 },//10 "AAPL01,DualLink"
68{ 0x00,0x00,0x00,0x00 },//11 "AAPL01,Height"
69{ 0x00,0x00,0x00,0x00 },//12 "AAPL01,Interlace"
70{ 0x00,0x00,0x00,0x00 },//13 "AAPL01,Inverter"
71{ 0x08,0x52,0x00,0x00 },//14 "AAPL01,InverterCurrent"
72{ 0x00,0x00,0x00,0x00 },//15 "AAPL01,InverterCurrency"
73{ 0x00,0x00,0x00,0x00 },//16 "AAPL01,LinkFormat"
74{ 0x01,0x00,0x00,0x00 },//17 "AAPL01,LinkType"
75{ 0x01,0x00,0x00,0x00 },//18 "AAPL01,Pipe"
76{ 0x3B,0x00,0x00,0x00 },//19 "AAPL01,PixelFormat"
77{ 0x00,0x00,0x00,0x00 },//20 "AAPL01,Refresh"
78{ 0x6B,0x10,0x00,0x00 },//21 "AAPL01,Stretch"
79{ 0xc8,0x95,0x00,0x00 },//22 "AAPL01,InverterFrequency"
80};
81
82uint8_t ivy_bridge_ig_vals[12][4] = {
83{ 0x00,0x00,0x66,0x01 },//0 "AAPL,ig-platform-id" //FB: 96MB, Pipes: 3, Ports: 4, FBMem: 3
84{ 0x01,0x00,0x66,0x01 },//1 "AAPL,ig-platform-id" //FB: 96MB, Pipes: 3, Ports: 4, FBMem: 3
85{ 0x02,0x00,0x66,0x01 },//2 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 1, FBMem: 1
86{ 0x03,0x00,0x66,0x01 },//3 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 2, Ports: 2, FBMem: 2
87{ 0x04,0x00,0x66,0x01 },//4 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 3, Ports: 1, FBMem: 1
88{ 0x05,0x00,0x62,0x01 },//5 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 2, Ports: 3, FBMem: 2
89{ 0x06,0x00,0x62,0x01 },//6 "AAPL,ig-platform-id" //FB: 0MB, Pipes: 0, Ports: 0, FBMem: 0
90{ 0x07,0x00,0x62,0x01 },//7 "AAPL,ig-platform-id" //FB: 0MB, Pipes: 0, Ports: 0, FBMem: 0
91{ 0x08,0x00,0x66,0x01 },//8 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3
92{ 0x09,0x00,0x66,0x01 },//9 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3
93{ 0x0a,0x00,0x66,0x01 },//10 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 2, Ports: 3, FBMem: 2
94{ 0x0b,0x00,0x66,0x01 }//11 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 2, Ports: 3, FBMem: 2
95};
96
97uint8_t haswell_ig_vals[16][4] = { /* - TESTING DATA --*/
98{ 0x00,0x00,0x06,0x04 },// 0 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - mobile GT1
99{ 0x00,0x00,0x06,0x0c },// 1 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - SDV mobile GT1
100{ 0x00,0x00,0x16,0x04 },// 2 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - mobile GT2
101{ 0x00,0x00,0x16,0x0a },// 3 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT2
102{ 0x00,0x00,0x16,0x0c },// 4 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - SDV mobile GT2
103{ 0x00,0x00,0x26,0x04 },// 5 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - mobile GT3
104{ 0x00,0x00,0x26,0x0a },// 6 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT3
105{ 0x00,0x00,0x26,0x0c },// 7 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - SDV mobile GT3
106{ 0x00,0x00,0x26,0x0d }, // 8 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - CRW mobile GT3
107{ 0x02,0x00,0x16,0x04 },// 9 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 1, Ports: 1, FBMem: 1 - mobile GT2
108{ 0x03,0x00,0x22,0x0d }, // 10 "AAPL,ig-platform-id" //FB: 0MB, Pipes: 0, Ports: 0, FBMem: 0 - CRW Desktop GT3
109//{ 0x04,0x00,0x12,0x04 },// ?? "AAPL,ig-platform-id" //FB: 32MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT3
110{ 0x05,0x00,0x26,0x0a },// 11 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT3
111{ 0x06,0x00,0x26,0x0a },// 12 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT3
112{ 0x07,0x00,0x26,0x0d }, // 13 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 4, FBMem: 3 - CRW mobile GT3
113{ 0x08,0x00,0x26,0x0a },// 14 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT3
114{ 0x08,0x00,0x2e,0x0a },// 15 "AAPL,ig-platform-id" //FB: 64MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT reserved GT3
115};
116
117uint8_t HD2000_vals[16][4] = {
118{ 0x00,0x00,0x00,0x00 }, //0 "AAPL00,PixelFormat"
119{ 0x00,0x00,0x00,0x00 }, //1 "AAPL00,T1"
120{ 0x14,0x00,0x00,0x00 }, //2 "AAPL00,T2"
121{ 0xfa,0x00,0x00,0x00 }, //3 "AAPL00,T3"
122{ 0x2c,0x01,0x00,0x00 }, //4 "AAPL00,T4"
123{ 0x00,0x00,0x00,0x00 }, //5 "AAPL00,T5"
124{ 0x14,0x00,0x00,0x00 }, //6 "AAPL00,T6"
125{ 0xf4,0x01,0x00,0x00 }, //7 "AAPL00,T7"
126{ 0x00,0x00,0x00,0x00 }, //8 "AAPL00,LinkType"
127{ 0x00,0x00,0x00,0x00 }, //9 "AAPL00,LinkFormat"
128{ 0x00,0x00,0x00,0x00 }, //10 "AAPL00,DualLink"
129{ 0x00,0x00,0x00,0x00 }, //11 "AAPL00,Dither"
130{ 0x00,0x00,0x00,0x00 }, //12 "AAPL00,DataJustify"
131{ 0x00,0x00,0x00,0x00 }, //13 "graphic-options"
132{ 0x00,0x00,0x00,0x00 }, //14
133{ 0x01,0x00,0x00,0x00 } //15
134};
135
136uint8_t HD3000_vals[17][4] = {
137{ 0x00,0x00,0x00,0x00 }, //0 "AAPL00,PixelFormat"
138{ 0x00,0x00,0x00,0x00 }, //1 "AAPL00,T1"
139{ 0x14,0x00,0x00,0x00 }, //2 "AAPL00,T2"
140{ 0xfa,0x00,0x00,0x00 }, //3 "AAPL00,T3"
141{ 0x2c,0x01,0x00,0x00 }, //4 "AAPL00,T4"
142{ 0x00,0x00,0x00,0x00 }, //5 "AAPL00,T5"
143{ 0x14,0x00,0x00,0x00 }, //6 "AAPL00,T6"
144{ 0xf4,0x01,0x00,0x00 }, //7 "AAPL00,T7"
145{ 0x00,0x00,0x00,0x00 }, //8 "AAPL00,LinkType"
146{ 0x00,0x00,0x00,0x00 }, //9 "AAPL00,LinkFormat"
147{ 0x00,0x00,0x00,0x00 }, //10 "AAPL00,DualLink"
148{ 0x00,0x00,0x00,0x00 }, //11 "AAPL00,Dither"
149{ 0x00,0x00,0x00,0x00 }, //12 "AAPL00,DataJustify"
150{ 0x00,0x00,0x00,0x00 }, //13 "graphic-options"
151{ 0x00,0x00,0x00,0x00 }, //14
152{ 0x01,0x00,0x00,0x00 }, //15
153{ 0x00,0x00,0x01,0x00 } //16 AAPL,snb-platform-id
154};
155
156uint8_t HD4000_vals[15][4] = {
157{ 0x00,0x00,0x00,0x00 }, //0 "AAPL00,PixelFormat"
158{ 0x00,0x00,0x00,0x00 }, //1 "AAPL00,T1"
159{ 0x01,0x00,0x00,0x00 }, //2 "AAPL00,T2"
160{ 0xc8,0x00,0x00,0x00 }, //3 "AAPL00,T3"
161{ 0xc8,0x00,0x00,0x00 }, //4 "AAPL00,T4"
162{ 0x01,0x00,0x00,0x00 }, //5 "AAPL00,T5"
163{ 0x00,0x00,0x00,0x00 }, //6 "AAPL00,T6"
164{ 0x90,0x01,0x00,0x00 }, //7 "AAPL00,T7"
165{ 0x01,0x00,0x00,0x00 }, //8 "AAPL00,LinkType"
166{ 0x00,0x00,0x00,0x00 }, //9 "AAPL00,LinkFormat"
167{ 0x01,0x00,0x00,0x00 }, //10 "AAPL00,DualLink"
168{ 0x00,0x00,0x00,0x00 }, //11 "AAPL00,Dither"
169{ 0xc3,0x8c,0x64,0x00 }, //12 "AAPL,gray-value"
170{ 0x01,0x00,0x00,0x00 }, //13 "AAPL,gray-page"
171{ 0x0c,0x00,0x00,0x00 } //14 "graphics-options"
172};
173
174// http://www.insanelymac.com/forum/topic/286092-guide-1st-generation-intel-hd-graphics-qeci/
175uint8_t HDx000_os_info[20] = {
1760x30,0x49,0x01,0x11,0x01,0x10,0x08,0x00,0x00,0x01,
1770x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF
178};
179
180uint8_t HD2000_tbl_info[18] = {
1810x30,0x44,0x02,0x02,0x02,0x02,0x00,0x00,0x00,
1820x00,0x01,0x02,0x02,0x02,0x00,0x01,0x02,0x02
183};
184uint8_t HD2000_os_info[20] = {
1850x30,0x49,0x01,0x11,0x11,0x11,0x08,0x00,0x00,0x01,
1860xf0,0x1f,0x01,0x00,0x00,0x00,0x10,0x07,0x00,0x00
187};
188
189// The following values came from a Sandy Bridge MacBook Air
190uint8_t HD3000_tbl_info[18] = {
1910x30,0x44,0x02,0x02,0x02,0x02,0x00,0x00,0x00,
1920x00,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01
193};
194
195// The following values came from a Sandy Bridge MacBook Air
196uint8_t HD3000_os_info[20] = {
1970x30,0x49,0x01,0x12,0x12,0x12,0x08,0x00,0x00,0x01,
1980xf0,0x1f,0x01,0x00,0x00,0x00,0x10,0x07,0x00,0x00
199};
200
201
202uint8_t reg_TRUE[]= { 0x01, 0x00, 0x00, 0x00 };
203uint8_t reg_FALSE[] = { 0x00, 0x00, 0x00, 0x00 };
204
205// https://en.wikipedia.org/wiki/Comparison_of_Intel_graphics_processing_units#Seventh_generation
206
207/* http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/tree/src/intel_module.c */
208
209static intel_gfx_info_t intel_gfx_chipsets[] = {
210{GMA_I810, "i810"},
211{GMA_I810_DC100, "i810-dc100"},
212{GMA_I810_E, "i810e"},
213{GMA_I815, "i815"},
214{GMA_I830_M, "i830M"},
215{GMA_845_G, "845G"},
216{GMA_I854, "854"},
217{GMA_I855_GM, "852GM/855GM"},
218{GMA_I865_G, "865G"},
219{GMA_I915_G, "915G"},
220{GMA_E7221_G, "E7221 (i915)"},
221{GMA_I915_GM, "915GM"},
222{GMA_I945_G, "945G"},
223 // 2776 /* Desktop GMA950 */
224 // 2782 /* GMA 915 */
225 // 2792 /* Mobile GMA915 */
226{GMA_I945_GM, "945GM"},
227{GMA_I945_GME, "945GME"},
228 // 27A6 /* Mobile GMA950 */
229 // 29C3 /* Desktop GMA3100 */
230{GMA_PINEVIEW_M, "Pineview GM"},
231{GMA_GMA3150_M, "Pineview GM"}, // A012 /* Mobile GMA3150 */
232{GMA_PINEVIEW_G, "Pineview G"},
233{GMA_GMA3150_D, "Desktop GMA3150"}, // A002 /* Desktop GMA3150 */
234{GMA_I965_G, "965G"},
235{GMA_G35_G, "G35"},
236{GMA_I965_Q, "965Q"},
237{GMA_I946_GZ, "946GZ"},
238{GMA_I965_GM, "965GM"},
239{GMA_I965_GME, "965GME/GLE"},
240{GMA_G33_G, "G33"},
241 // 2A13 /* GMAX3100 */
242 // 2A43 /* GMAX3100 */
243{GMA_Q35_G, "Q35"},
244{GMA_Q33_G, "Q33"},
245{GMA_GM45_GM, "GM45"},
246{GMA_G45_E_G, "4 Series"},
247{GMA_G45_G, "G45/G43"},
248{GMA_Q45_G, "Q45/Q43"},
249{GMA_G41_G, "G41"},
250{GMA_B43_G, "B43"},
251{GMA_B43_G1, "B43"},
252 /**/
253{GMA_IRONLAKE_D_G, HD_GRAPHICS},
254{GMA_IRONLAKE_M_G, HD_GRAPHICS},
255 // 004A /* HD2000 */
256
257 /* Sandy */
258{GMA_SANDYBRIDGE_GT1, HD_GRAPHICS_2000 },
259{GMA_SANDYBRIDGE_GT2, HD_GRAPHICS_3000 },
260{GMA_SANDYBRIDGE_GT2_PLUS, HD_GRAPHICS_3000 },
261{GMA_SANDYBRIDGE_M_GT1, HD_GRAPHICS_2000 },
262{GMA_SANDYBRIDGE_M_GT2, HD_GRAPHICS_3000 },
263{GMA_SANDYBRIDGE_M_GT2_PLUS, HD_GRAPHICS_3000 },
264{GMA_SANDYBRIDGE_S_GT, HD_GRAPHICS },
265 // 010B /* ??? */
266 // 010E /* ??? */
267
268 /* Ivy */
269{GMA_IVYBRIDGE_M_GT1, HD_GRAPHICS_2500 },
270{GMA_IVYBRIDGE_M_GT2, HD_GRAPHICS_4000 },
271{GMA_IVYBRIDGE_D_GT1, HD_GRAPHICS_2500 },
272{GMA_IVYBRIDGE_D_GT2, HD_GRAPHICS_4000 },
273{GMA_IVYBRIDGE_S_GT1, HD_GRAPHICS },
274{GMA_IVYBRIDGE_S_GT2, "HD Graphics P4000" },
275{GMA_IVYBRIDGE_S_GT3, HD_GRAPHICS }, // 015e
276 {GMA_IVYBRIDGE_S_GT4, HD_GRAPHICS_2500 }, // 0172 /* HD Graphics 2500 Mobile */
277 {GMA_IVYBRIDGE_S_GT5, HD_GRAPHICS_2500 }, // 0176 /* HD Graphics 2500 Mobile */
278
279 /* Haswell */
280 // 0090 /* ??? */
281 // 0091 /* ??? */
282 // 0092 /* ??? */
283{GMA_HASWELL_D_GT1, HD_GRAPHICS },
284{GMA_HASWELL_D_GT2, HD_GRAPHICS_4600 },
285{GMA_HASWELL_D_GT3, HD_GRAPHICS_5000 }, /* ??? */
286{GMA_HASWELL_M_GT1, HD_GRAPHICS },
287{GMA_HASWELL_M_GT2, HD_GRAPHICS_4600 },
288{GMA_HASWELL_M_GT3, HD_GRAPHICS_5000 }, /* ??? */
289{GMA_HASWELL_S_GT1, HD_GRAPHICS },
290{GMA_HASWELL_S_GT2, "HD Graphics P4600/P4700" },
291{GMA_HASWELL_S_GT3, HD_GRAPHICS_5000 }, /* ??? */
292{GMA_HASWELL_B_GT1, HD_GRAPHICS }, /* ??? */
293{GMA_HASWELL_B_GT2, HD_GRAPHICS }, /* ??? */
294{GMA_HASWELL_B_GT3, HD_GRAPHICS }, /* ??? */
295{GMA_HASWELL_E_GT1, HD_GRAPHICS },
296{GMA_HASWELL_E_GT2, HD_GRAPHICS }, /* ??? */
297{GMA_HASWELL_E_GT3, HD_GRAPHICS }, /* ??? */
298{GMA_HASWELL_ULT_D_GT1, HD_GRAPHICS }, /* ??? */
299{GMA_HASWELL_ULT_D_GT2, HD_GRAPHICS }, /* ??? */
300{GMA_HASWELL_ULT_D_GT3, IRIS_5100 },
301{GMA_HASWELL_ULT_M_GT1, HD_GRAPHICS },
302{GMA_HASWELL_ULT_M_GT2, HD_GRAPHICS_4400 },
303{GMA_HASWELL_ULT_M_GT3, HD_GRAPHICS_5000 },
304{GMA_HASWELL_ULT_S_GT1, HD_GRAPHICS }, /* ??? */
305{GMA_HASWELL_ULT_S_GT2, HD_GRAPHICS }, /* ??? */
306{GMA_HASWELL_ULT_S_GT3, IRIS_5100 },
307{GMA_HASWELL_ULT_B_GT1, HD_GRAPHICS }, /* ??? */
308{GMA_HASWELL_ULT_B_GT2, HD_GRAPHICS }, /* ??? */
309{GMA_HASWELL_ULT_B_GT3, IRIS_5100 },
310{GMA_HASWELL_ULT_E_GT1, HD_GRAPHICS },
311{GMA_HASWELL_ULT_E_GT2, HD_GRAPHICS_4200 },
312// 0A2A /* ??? */
313{GMA_HASWELL_ULT_E_GT3, IRIS_5100 },
314// 0C02 /* Intel Haswell HD Graphics - GTL */
315// 0C04 /* ??? */
316// 0C06 /* Intel Haswell HD Graphics - GTL */
317// 0C12 /* Intel Haswell HD Graphics - GTM */
318// 0C16 /* Intel Haswell HD Graphics - GTH */
319// 0C22 /* Intel Haswell HD Graphics - GTH */
320// 0C26 /* Intel Haswell HD Graphics - GTH */
321{GMA_HASWELL_CRW_D_GT1, HD_GRAPHICS }, /* ??? */
322{GMA_HASWELL_CRW_D_GT2, HD_GRAPHICS_4600 },
323{GMA_HASWELL_CRW_D_GT3, IRIS_5200 },
324{GMA_HASWELL_CRW_M_GT1, HD_GRAPHICS }, /* ??? */
325{GMA_HASWELL_CRW_M_GT2, HD_GRAPHICS_4600 },
326{GMA_HASWELL_CRW_M_GT3, IRIS_5200 },
327{GMA_HASWELL_CRW_S_GT1, HD_GRAPHICS }, /* ??? */
328{GMA_HASWELL_CRW_S_GT2, HD_GRAPHICS }, /* ??? */
329{GMA_HASWELL_CRW_S_GT3, IRIS_5200 },
330{GMA_HASWELL_CRW_B_GT1, HD_GRAPHICS }, /* ??? */
331{GMA_HASWELL_CRW_B_GT2, HD_GRAPHICS }, /* ??? */
332{GMA_HASWELL_CRW_B_GT3, IRIS_5200 },
333{GMA_HASWELL_CRW_E_GT1, HD_GRAPHICS }, /* ??? */
334{GMA_HASWELL_CRW_E_GT2, HD_GRAPHICS }, /* ??? */
335{GMA_HASWELL_CRW_E_GT3, IRIS_5200 },
336{GMA_HASWELL_CRW_M_GT2_PLUS_IG, HD_GRAPHICS }
337};
338
339#define GFX_DEVICES_LEN (sizeof(intel_gfx_chipsets) / sizeof(intel_gfx_chipsets[0]))
340
341/* END http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/tree/src/intel_module.c */
342
343/* Get Intel GFX device name */
344static char *get_gma_controller_name(uint16_t device_id, uint16_t vendor_id)
345{
346int i = 0;
347static char desc[128];
348
349for (i = 0; i < GFX_DEVICES_LEN; i++)
350{
351if (intel_gfx_chipsets[i].model == ((device_id << 16) | vendor_id))
352{
353snprintf(desc, sizeof(desc), "%s %s", INTEL_NAME, intel_gfx_chipsets[i].label_info);
354return desc;
355}
356}
357snprintf(desc, sizeof(desc), "Unknown %s Graphics card", INTEL_NAME);
358return desc;
359}
360
361/*************************************************************************************
362 * Converts hexadecimal character string 'key' into a binary property for injection *
363 * with correct byte order. Base on hex2bin function from device_inject.c *
364 ************************************************************************************/
365static int hexkey2devprop(const char *key, uint8_t *prop, int length)
366{
367char*p;
368int i, x;
369charbuf[length+1];
370 int len;
371
372buf[length-1] = '\0';
373p = (char *) key;
374 x = length-1;
375 len = (length*2)+1;
376
377for (i = 0; i < len; i++) {
378buf[0] = *p++;
379buf[1] = *p++;
380prop[x] = (unsigned char) strtoul(buf, NULL, 16);
381 x--;
382}
383return 0;
384}
385
386bool setup_gma_devprop(pci_dt_t *gma_dev)
387{
388char*devicepath = NULL;
389volatile uint8_t*regs;
390uint32_tbar[7];
391char*model = NULL;
392uint8_t BuiltIn =0x00;
393int len;
394const char*value;
395uint16_tvendor_id = gma_dev->vendor_id;
396uint16_tdevice_id = gma_dev->device_id;
397uint8_t ClassFix[4] = { 0x00, 0x00, 0x03, 0x00 };
398
399 uint8_t hd3k_kmobile_device_id[4] = { 0x26, 0x01, 0x00 }; // MacMan
400 uint8_t hd4k_device_id[4] = { 0x62, 0x01, 0x00 }; // MacMan
401 uint8_t hd4400_mobile_device_id[4] = { 0x26, 0x0A, 0x00 }; // MacMan
402 uint8_t hd4600_device_id[4] = { 0x12, 0x04, 0x00 }; // MacMan
403 uint8_t hd4600_mobile_device_id[4] = { 0x16, 0x04, 0x00 }; // MacMan
404 uint8_t igp_device_id[4] = { 0x00, 0x00, 0x00 }; // MacMan
405
406 uint8_t snb_id_3k[4] = { 0x10, 0x00, 0x03, 0x00 }; // MacMan
407 uint8_t snb_id_3k_mobile[4] = { 0x00, 0x00, 0x01, 0x00 }; // MacMan
408 uint8_t ig_id_4k[4] = { 0x0A, 0x00, 0x66, 0x01 }; // MacMan
409 uint8_t ig_id_4k_mobile[4] = { 0x03, 0x00, 0x66, 0x01 }; // MacMan
410 uint8_t ig_id_4600[4] = { 0x03, 0x00, 0x22, 0x0D }; // MacMan
411 uint8_t ig_id_4600_mobile[4] = { 0x06, 0x00, 0x26, 0x0A }; // MacMan
412 uint8_t ig_platform_id[4] = { 0x00, 0x00, 0x00, 0x00 }; // MacMan
413
414devicepath = get_pci_dev_path(gma_dev);
415
416bar[0] = pci_config_read32(gma_dev->dev.addr, 0x10);
417regs = (uint8_t *) (bar[0] & ~0x0f);
418
419model = get_gma_controller_name(device_id, vendor_id);
420
421verbose("---------------------------------------------\n");
422 verbose("------------ INTEL DEVICE INFO --------------\n");
423verbose("---------------------------------------------\n");
424verbose("Class code: [%04x]\n%s [%04x:%04x] (rev %02x)\nSubsystem: [%04x:%04x] :: %s\n",
425gma_dev->class_id, model, gma_dev->vendor_id, gma_dev->device_id, gma_dev->revision_id, gma_dev->subsys_id.subsys.vendor_id, gma_dev->subsys_id.subsys.device_id, devicepath);
426
427if (!string) {
428string = devprop_create_string();
429}
430
431struct DevPropDevice *device = devprop_add_device(string, devicepath);
432if (!device) {
433printf("Failed initializing dev-prop string dev-entry.\n");
434pause();
435return false;
436}
437
438devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1));
439devprop_add_value(device, "device_type", (uint8_t*)"display", 8);
440
441
442switch ((device_id << 16) | vendor_id)
443{
444 case GMA_IRONLAKE_D_G: // 0042
445 case GMA_IRONLAKE_M_G: // 0046
446 devprop_add_value(device, "built-in", &BuiltIn, 1);
447 devprop_add_value(device, "class-code", ClassFix, 4);
448 devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
449 devprop_add_value(device, "AAPL,os-info", HDx000_os_info, 20);
450 break;
451 case GMA_I945_GM: // Mobile GMA950 Mobile GMA3150
452 case GMA_I945_GME:
453 //case GMA_945GM:
454 case GMA_PINEVIEW_G:
455 case GMA_PINEVIEW_M:
456 case GMA_GMA3150_M:
457 devprop_add_value(device, "AAPL,HasPanel", reg_TRUE, 4);
458 devprop_add_value(device, "built-in", &BuiltIn, 1);
459 devprop_add_value(device, "class-code", ClassFix, 4);
460 break;
461
462 case GMA_I945_G: // Desktop GMA950 Desktop GMA3150
463 //case GMA_82945G:
464 case GMA_GMA3150_D:
465 BuiltIn = 0x01;
466 devprop_add_value(device, "built-in", &BuiltIn, 1);
467 devprop_add_value(device, "class-code", ClassFix, 4);
468 break;
469
470 case GMA_I965_GM: // GMAX3100
471 case GMA_I965_GME:
472 //case 0x80862A13:
473 case GMA_GM45_GM:
474 //case GMA_GM45_GM2:
475 devprop_add_value(device, "AAPL,HasPanel", GMAX3100_vals[0], 4);
476 devprop_add_value(device, "AAPL,SelfRefreshSupported", GMAX3100_vals[1], 4);
477 devprop_add_value(device, "AAPL,aux-power-connected", GMAX3100_vals[2], 4);
478 devprop_add_value(device, "AAPL,backlight-control", GMAX3100_vals[3], 4);
479 devprop_add_value(device, "AAPL00,blackscreen-preferences",GMAX3100_vals[4], 4);
480 devprop_add_value(device, "AAPL01,BacklightIntensity", GMAX3100_vals[5], 4);
481 devprop_add_value(device, "AAPL01,blackscreen-preferences",GMAX3100_vals[6], 4);
482 devprop_add_value(device, "AAPL01,DataJustify", GMAX3100_vals[7], 4);
483 devprop_add_value(device, "AAPL01,Depth", GMAX3100_vals[8], 4);
484 devprop_add_value(device, "AAPL01,Dither", GMAX3100_vals[9], 4);
485 devprop_add_value(device, "AAPL01,DualLink", GMAX3100_vals[10], 4);
486 devprop_add_value(device, "AAPL01,Height", GMAX3100_vals[11], 4);
487 devprop_add_value(device, "AAPL01,Interlace", GMAX3100_vals[12], 4);
488 devprop_add_value(device, "AAPL01,Inverter", GMAX3100_vals[13], 4);
489 devprop_add_value(device, "AAPL01,InverterCurrent", GMAX3100_vals[14], 4);
490 devprop_add_value(device, "AAPL01,InverterCurrency", GMAX3100_vals[15], 4);
491 devprop_add_value(device, "AAPL01,LinkFormat", GMAX3100_vals[16], 4);
492 devprop_add_value(device, "AAPL01,LinkType", GMAX3100_vals[17], 4);
493 devprop_add_value(device, "AAPL01,Pipe", GMAX3100_vals[18], 4);
494 devprop_add_value(device, "AAPL01,PixelFormat", GMAX3100_vals[19], 4);
495 devprop_add_value(device, "AAPL01,Refresh", GMAX3100_vals[20], 4);
496 devprop_add_value(device, "AAPL01,Stretch", GMAX3100_vals[21], 4);
497 //devprop_add_value(device, "AAPL01,InverterFrequency",GMAX3100_vals[22], 4);
498 devprop_add_value(device, "class-code", ClassFix, 4);
499 break;
500
501 case GMA_SANDYBRIDGE_GT1: // HD Graphics 2000, found in kext
502 devprop_add_value(device, "built-in",&BuiltIn, 1);
503 devprop_add_value(device, "class-code",ClassFix, 4);
504 devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
505 devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
506 devprop_add_value(device, "AAPL,tbl-info",HD2000_tbl_info, 18);
507 devprop_add_value(device, "AAPL,os-info",HD2000_os_info, 20);
508 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
509 {
510 verbose("Setting %s for snb-platform-id\n", value);
511 hexkey2devprop(value, ig_platform_id, 4);
512 devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
513 }
514 else
515 {
516 devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k, 4);
517 verbose("Using default snb-platform-id of 00030010\n");
518 }
519 break;
520
521 case GMA_SANDYBRIDGE_M_GT1: // HD Graphics 2000 Mobile, found in kext
522 devprop_add_value(device, "class-code", ClassFix, 4);
523 devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
524 devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
525 devprop_add_value(device, "AAPL00,PixelFormat",HD2000_vals[0], 4);
526 devprop_add_value(device, "AAPL00,T1", HD2000_vals[1], 4);
527 devprop_add_value(device, "AAPL00,T2", HD2000_vals[2], 4);
528 devprop_add_value(device, "AAPL00,T3", HD2000_vals[3], 4);
529 devprop_add_value(device, "AAPL00,T4", HD2000_vals[4], 4);
530 devprop_add_value(device, "AAPL00,T5", HD2000_vals[5], 4);
531 devprop_add_value(device, "AAPL00,T6", HD2000_vals[6], 4);
532 devprop_add_value(device, "AAPL00,T7", HD2000_vals[7], 4);
533 devprop_add_value(device, "AAPL00,LinkType",HD2000_vals[8], 4);
534 devprop_add_value(device, "AAPL00,LinkFormat",HD2000_vals[9], 4);
535 devprop_add_value(device, "AAPL00,DualLink",HD2000_vals[10], 4);
536 devprop_add_value(device, "AAPL00,Dither",HD2000_vals[11], 4);
537 devprop_add_value(device, "AAPL00,DataJustify",HD2000_vals[12], 4);
538 devprop_add_value(device, "graphic-options",HD2000_vals[13], 4);
539 devprop_add_value(device, "AAPL,tbl-info",HD2000_tbl_info, 18);
540 devprop_add_value(device, "AAPL,os-info",HD2000_os_info, 20);
541 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
542 {
543 verbose("Setting %s for snb-platform-id\n", value);
544 hexkey2devprop(value, ig_platform_id, 4);
545 devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
546 }
547 else
548 {
549 devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k_mobile, 4);
550 verbose("Using default snb-platform-id of 00030010\n");
551 }
552 break;
553
554 case GMA_SANDYBRIDGE_GT2: // HD Graphics 3000
555 case GMA_SANDYBRIDGE_GT2_PLUS: // HD Graphics 3000
556 devprop_add_value(device, "built-in",&BuiltIn, 1);
557 devprop_add_value(device, "class-code",ClassFix, 4);
558 devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
559 devprop_add_value(device, "AAPL,tbl-info",HD3000_tbl_info, 18);
560 devprop_add_value(device, "AAPL,os-info",HD3000_os_info, 20);
561 if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
562 {
563 verbose("Using %s for unsupported device id injection.\n", value);
564 hexkey2devprop(value, igp_device_id, 2);
565 devprop_add_value(device, "device-id",igp_device_id, 4);
566 }
567 else
568 {
569 devprop_add_value(device, "device-id", hd3k_kmobile_device_id, 4); // MacMan Inject Mobile ID Instead of Patching Kext
570 verbose("Using default unsupported device id injection of 0126\n");
571 }
572 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
573 {
574 verbose("Using %s for snb-platform-id\n", value);
575 hexkey2devprop(value, ig_platform_id, 4);
576 devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
577 }
578 else
579 {
580 devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k, 4);
581 verbose("Using default snb-platform-id of 00030010\n");
582 }
583 break;
584
585 case GMA_SANDYBRIDGE_M_GT2: // HD Graphics 3000 Mobile, found in kext
586 case GMA_SANDYBRIDGE_M_GT2_PLUS: // HD Graphics 3000 Mobile, found in kext
587 devprop_add_value(device, "class-code", ClassFix, 4);
588 devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
589 devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
590 devprop_add_value(device, "AAPL00,PixelFormat",HD3000_vals[0], 4);
591 devprop_add_value(device, "AAPL00,T1", HD3000_vals[1], 4);
592 devprop_add_value(device, "AAPL00,T2", HD3000_vals[2], 4);
593 devprop_add_value(device, "AAPL00,T3", HD3000_vals[3], 4);
594 devprop_add_value(device, "AAPL00,T4", HD3000_vals[4], 4);
595 devprop_add_value(device, "AAPL00,T5", HD3000_vals[5], 4);
596 devprop_add_value(device, "AAPL00,T6", HD3000_vals[6], 4);
597 devprop_add_value(device, "AAPL00,T7", HD3000_vals[7], 4);
598 devprop_add_value(device, "AAPL00,LinkType",HD3000_vals[8], 4);
599 devprop_add_value(device, "AAPL00,LinkFormat",HD3000_vals[9], 4);
600 devprop_add_value(device, "AAPL00,DualLink",HD3000_vals[10], 4);
601 devprop_add_value(device, "AAPL00,Dither",HD3000_vals[11], 4);
602 devprop_add_value(device, "AAPL00,DataJustify",HD3000_vals[12], 4);
603 devprop_add_value(device, "graphic-options",HD3000_vals[13], 4);
604 devprop_add_value(device, "AAPL,tbl-info",HD3000_tbl_info, 18);
605 devprop_add_value(device, "AAPL,os-info",HD3000_os_info, 20);
606 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
607 {
608 verbose("Setting %s for snb-platform-id\n", value);
609 hexkey2devprop(value, ig_platform_id, 4);
610 devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4);
611 }
612 else
613 {
614 devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k_mobile, 4);
615 verbose("Using default snb-platform-id of 00010000\n");
616 }
617 break;
618
619 //
620 // Supported Ivy Bridge Desktop Device IDs
621 //
622 case GMA_IVYBRIDGE_D_GT1: // HD Graphics 2500, found in kext
623 case GMA_IVYBRIDGE_D_GT2: // HD Graphics 4000, found in kext
624// devprop_add_value(device, "AAPL00,DualLink", HD4000_vals[10], 4);
625 devprop_add_value(device, "built-in", &BuiltIn, 1);
626 devprop_add_value(device, "class-code", ClassFix, 4);
627 devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
628 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
629 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
630 {
631 verbose("Using %s for ig-platform-id\n", value);
632 hexkey2devprop(value, ig_platform_id, 4);
633 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
634 }
635 else
636 {
637 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k, 4);
638 verbose("Using default ig-platform-id of 0166000a\n");
639 }
640 break;
641
642 //
643 // Supported Ivy Bridge Mobile Device IDs
644 //
645 case GMA_IVYBRIDGE_M_GT1: // HD Graphics 2500 Mobile, found in kext
646 case GMA_IVYBRIDGE_M_GT2: // HD Graphics 4000 Mobile, found in kext
647// devprop_add_value(device, "AAPL00,DualLink", HD4000_vals[10], 4);
648 devprop_add_value(device, "built-in", &BuiltIn, 1);
649 devprop_add_value(device, "class-code", ClassFix, 4);
650 devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
651 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
652 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
653 {
654 verbose("Using %s for ig-platform-id\n", value);
655 hexkey2devprop(value, ig_platform_id, 4);
656 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
657 }
658 else
659 {
660 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k_mobile, 4);
661 verbose("Using default ig-platform-id of 01660003\n");
662 }
663 break;
664
665 //
666 // Unsupported Ivy Bridge Desktop Device IDs
667 //
668 case GMA_IVYBRIDGE_S_GT1: // HD Graphics 4000
669 case GMA_IVYBRIDGE_S_GT2: // HD Graphics P4000
670 case GMA_IVYBRIDGE_S_GT3: // Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller
671 case GMA_IVYBRIDGE_S_GT4: // HD Graphics 2500 // Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller
672 case GMA_IVYBRIDGE_S_GT5: // HD Graphics 2500 // 3rd Gen Core processor Graphics Controller
673// devprop_add_value(device, "AAPL00,DualLink", HD4000_vals[10], 4);
674 devprop_add_value(device, "built-in", &BuiltIn, 1);
675 devprop_add_value(device, "class-code", ClassFix, 4);
676 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
677 if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
678 {
679 verbose("Using %s for unsupported device id injection.\n", value);
680 hexkey2devprop(value, igp_device_id, 2);
681 devprop_add_value(device, "device-id",igp_device_id, 4);
682 }
683 else
684 {
685 devprop_add_value(device, "device-id", hd4k_device_id, 4); // MacMan Inject Supported ID Instead of Patching Kext
686 verbose("Using default unsupported device id injection of 0162\n");
687 }
688 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
689 {
690 verbose("Using %s for ig-platform-id\n", value);
691 hexkey2devprop(value, ig_platform_id, 4);
692 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
693 }
694 else
695 {
696 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k, 4);
697 verbose("Using default ig-platform-id of 0166000a\n");
698 }
699 break;
700
701 //
702 // Supported Haswell Desktop Device IDs
703 //
704 case GMA_HASWELL_D_GT2: // HD Graphics 4600, found in kext
705 case GMA_HASWELL_CRW_D_GT3: // HD Graphics 5200 Iris Pro and found in kext
706// devprop_add_value(device, "AAPL00,DualLink", HD4000_vals[10], 4);
707 devprop_add_value(device, "built-in", &BuiltIn, 1);
708 devprop_add_value(device, "class-code", ClassFix, 4);
709 devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
710 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
711 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
712 {
713 verbose("Using %s for ig-platform-id\n", value);
714 hexkey2devprop(value, ig_platform_id, 4);
715 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
716 }
717 else
718 {
719 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600, 4);
720 verbose("Using default ig-platform-id of 0d220003\n");
721 }
722 break;
723
724 //
725 // Supported Haswell Mobile Device IDs
726 //
727 case GMA_HASWELL_M_GT1: // HD Graphics Mobile, found in kext
728 case GMA_HASWELL_M_GT2: // HD Graphics 4600 Mobile, found in kext
729 case GMA_HASWELL_M_GT3: // HD Graphics 5000 Mobile, found in kext
730 case GMA_HASWELL_ULT_M_GT2: // HD Graphics 4400 Mobile, found in kext
731 case GMA_HASWELL_ULT_M_GT3: // HD Graphics 5000 Iris Mobile, found in kext
732 case GMA_HASWELL_ULT_E_GT2: // HD Graphics 4200 Mobile, found in kext
733 case GMA_HASWELL_ULT_E_GT3: // HD Graphics 5100 Iris Mobile, found in kext
734 case GMA_HASWELL_CRW_M_GT3: // HD Graphics 5200 Iris Pro Mobile and found in kext
735// devprop_add_value(device, "AAPL00,DualLink", HD4000_vals[10], 4);
736 devprop_add_value(device, "built-in", &BuiltIn, 1);
737 devprop_add_value(device, "class-code", ClassFix, 4);
738 devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
739 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
740 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
741 {
742 verbose("Using %s for ig-platform-id\n", value);
743 hexkey2devprop(value, ig_platform_id, 4);
744 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
745 }
746 else
747 {
748 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600_mobile, 4);
749 verbose("Using default ig-platform-id of 0a260006\n");
750 }
751 break;
752
753 //
754 // Unsupported Haswell Desktop Device IDs
755 //
756 //case 0x80860090:
757 //case 0x80860091:
758 //case 0x80860092:
759 case GMA_HASWELL_D_GT1: // HD Graphics
760 case GMA_HASWELL_D_GT3: // HD Graphics 5000
761 case GMA_HASWELL_S_GT1: // HD Graphics
762 case GMA_HASWELL_S_GT2: // HD Graphics
763 case GMA_HASWELL_S_GT3: //
764 case GMA_HASWELL_B_GT1: //
765 case GMA_HASWELL_B_GT2: // HD Graphics
766 case GMA_HASWELL_B_GT3: //
767 case GMA_HASWELL_E_GT1: //
768 case GMA_HASWELL_E_GT3: //
769 case GMA_HASWELL_ULT_D_GT1: //
770 case GMA_HASWELL_ULT_D_GT2: //
771 case GMA_HASWELL_ULT_D_GT3: // HD Graphics 5000 Iris
772 case GMA_HASWELL_ULT_S_GT1: //
773 case GMA_HASWELL_ULT_S_GT2: //
774 case GMA_HASWELL_ULT_S_GT3: //
775 case GMA_HASWELL_ULT_B_GT1: //
776 case GMA_HASWELL_ULT_B_GT2: //
777 case GMA_HASWELL_ULT_B_GT3: //
778 case GMA_HASWELL_ULT_E_GT1: // HD Graphics
779 //case GMA_HASWELL_SDV_D_GT1_IG: //
780 //case GMA_HASWELL_SDV_D_GT2_IG: //
781 //case GMA_HASWELL_SDV_D_GT2_PLUS_IG: //
782 case GMA_HASWELL_CRW_D_GT1: //
783 case GMA_HASWELL_CRW_D_GT2: // HD Graphics
784 case GMA_HASWELL_CRW_S_GT1: //
785 case GMA_HASWELL_CRW_S_GT2: //
786 case GMA_HASWELL_CRW_S_GT3: // HD Graphics Iris Pro
787 case GMA_HASWELL_CRW_B_GT1: //
788 case GMA_HASWELL_CRW_B_GT2: //
789 case GMA_HASWELL_CRW_B_GT3: //
790 case GMA_HASWELL_CRW_E_GT1: //
791 case GMA_HASWELL_CRW_E_GT2: //
792 case GMA_HASWELL_CRW_E_GT3: //
793// devprop_add_value(device, "AAPL00,DualLink", HD4000_vals[10], 4);
794 devprop_add_value(device, "built-in", &BuiltIn, 1);
795 devprop_add_value(device, "class-code", ClassFix, 4);
796 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
797 if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
798 {
799 verbose("Using %s for unsupported device id injection.\n", value);
800 hexkey2devprop(value, igp_device_id, 2);
801 devprop_add_value(device, "device-id",igp_device_id, 4);
802 }
803 else
804 {
805 devprop_add_value(device, "device-id", hd4600_device_id, 4); // MacMan Inject Supported ID Instead of Patching Kext
806 verbose("Using default unsupported device id injection of 0412\n");
807 }
808 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
809 {
810 verbose("Using %s for ig-platform-id\n", value);
811 hexkey2devprop(value, ig_platform_id, 4);
812 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
813 }
814 else
815 {
816 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600, 4);
817 verbose("Using default ig-platform-id of 0d220003\n");
818 }
819 break;
820
821 case GMA_HASWELL_E_GT2: // HD Graphics 4400
822 devprop_add_value(device, "built-in", &BuiltIn, 1);
823 devprop_add_value(device, "class-code", ClassFix, 4);
824 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
825 if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
826 {
827 verbose("Using %s for unsupported device id injection.\n", value);
828 hexkey2devprop(value, igp_device_id, 2);
829 devprop_add_value(device, "device-id",igp_device_id, 4);
830 }
831 else
832 {
833 devprop_add_value(device, "device-id", hd4400_mobile_device_id, 4); // MacMan Inject Supported ID Instead of Patching Kext
834 verbose("Using default unsupported device id injection of 0a26\n");
835 }
836 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
837 {
838 verbose("Using %s for ig-platform-id\n", value);
839 hexkey2devprop(value, ig_platform_id, 4);
840 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
841 }
842 else
843 {
844 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600, 4);
845 verbose("Using default ig-platform-id of 0d220003\n");
846 }
847 break;
848
849 //
850 // Unsupported Haswell Mobile Device IDs
851 //
852 case GMA_HASWELL_ULT_M_GT1: // HD Graphics Mobile
853 case GMA_HASWELL_CRW_M_GT1: //
854 case GMA_HASWELL_CRW_M_GT2: // HD Graphics 4600 Mobile
855 case GMA_HASWELL_CRW_M_GT2_PLUS_IG: //
856// devprop_add_value(device, "AAPL00,DualLink", HD4000_vals[10], 4);
857 devprop_add_value(device, "built-in", &BuiltIn, 1);
858 devprop_add_value(device, "class-code", ClassFix, 4);
859 devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
860 if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan
861 {
862 verbose("Using %s for unsupported device id injection.\n", value);
863 hexkey2devprop(value, igp_device_id, 2);
864 devprop_add_value(device, "device-id",igp_device_id, 4);
865 }
866 else
867 {
868 devprop_add_value(device, "device-id", hd4600_mobile_device_id, 4); // MacMan Inject Supported ID Instead of Patching Kext
869 verbose("Using default unsupported device id injection of 0416\n");
870 }
871 if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig))
872 {
873 verbose("Using %s for ig-platform-id\n", value);
874 hexkey2devprop(value, ig_platform_id, 4);
875 devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4);
876 }
877 else
878 {
879 devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600_mobile, 4);
880 verbose("Using default ig-platform-id of 0a260006\n");
881 }
882 break;
883
884 default:
885 break;
886}
887
888stringdata = malloc(sizeof(uint8_t) * string->length);
889if (!stringdata)
890{
891printf("No stringdata.\n");
892pause();
893return false;
894}
895
896verbose("---------------------------------------------\n");
897memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length);
898stringlength = string->length;
899
900return true;
901}
902

Archive Download this file

Revision: 2394