Chameleon

Chameleon Commit Details

Date:2012-05-09 01:40:15 (11 years 11 months ago)
Author:Cosmosis Jones
Commit:1956
Parents: 1955
Message:Added some HD3000 stuff from Conti's fork supplied by someone else, modified by god, and now committed
Changes:
M/trunk/i386/libsaio/gma.c

File differences

trunk/i386/libsaio/gma.c
11
22
33
4
5
46
57
68
......
2123
2224
2325
24
2526
2627
2728
......
4647
4748
4849
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
49110
50111
51112
......
67128
68129
69130
131
132
133
134
135
136
70137
71138
72139
......
88155
89156
90157
158
91159
92160
93161
......
95163
96164
97165
166
98167
99168
100169
......
115184
116185
117186
118
119
187
188
120189
121190
122191
123192
124193
125
126
194
195
127196
128197
129198
130199
131200
132
201
133202
134203
135204
......
155224
156225
157226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
158288
159289
160290
/*
Original patch by Nawcom
http://forum.voodooprojects.org/index.php/topic,1029.0.html
Original Intel HDx000 code from valv
*/
#include "libsa.h"
#define DBG(x...)
#endif
uint8_t GMAX3100_vals[22][4] = {
{ 0x01,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 }
};
uint8_t HD2000_vals[16][4] = {
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x14,0x00,0x00,0x00 },
{ 0xfa,0x00,0x00,0x00 },
{ 0x2c,0x01,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x14,0x00,0x00,0x00 },
{ 0xf4,0x01,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
};
uint8_t HD3000_vals[16][4] = {
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x14,0x00,0x00,0x00 },
{ 0xfa,0x00,0x00,0x00 },
{ 0x2c,0x01,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x14,0x00,0x00,0x00 },
{ 0xf4,0x01,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
};
uint8_t HD2000_tbl_info[18] = {
0x30,0x44,0x02,0x02,0x02,0x02,0x00,0x00,0x00,
0x00,0x01,0x02,0x02,0x02,0x00,0x01,0x02,0x02
};
uint8_t HD2000_os_info[20] = {
0x30,0x49,0x01,0x11,0x11,0x11,0x08,0x00,0x00,0x01,
0xf0,0x1f,0x01,0x00,0x00,0x00,0x10,0x07,0x00,0x00
};
// 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
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
};
uint8_t reg_TRUE[]= { 0x01, 0x00, 0x00, 0x00 };
uint8_t reg_FALSE[] = { 0x00, 0x00, 0x00, 0x00 };
{ 0x80862A13, "GMAX3100"},
{ 0x80862A42, "GMAX3100"},
{ 0x80862A43, "GMAX3100"},
{ 0x80860102, "Intel HD Graphics 2000"},
{ 0x80860106, "Intel HD Graphics 2000 Mobile"},
{ 0x80860112, "Intel HD Graphics 3000"},
{ 0x80860116, "Intel HD Graphics 3000 Mobile"},
{ 0x80860122, "Intel HD Graphics 3000"},
{ 0x80860126, "Intel HD Graphics 3000 Mobile"},
};
char *get_gma_model(uint32_t id) {
char*model;
uint8_t BuiltIn =0x00;
uint8_t ClassFix[4] ={ 0x00, 0x00, 0x03, 0x00 };
unsigned intdevice_id;
devicepath = get_pci_dev_path(gma_dev);
regs = (uint8_t *) (bar[0] & ~0x0f);
model = get_gma_model((gma_dev->vendor_id << 16) | gma_dev->device_id);
device_id = gma_dev->device_id;
verbose("Intel %s [%04x:%04x] :: %s\n",
model, gma_dev->vendor_id, gma_dev->device_id, devicepath);
devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1));
devprop_add_value(device, "device_type", (uint8_t*)"display", 8);
if ((strcmp("Mobile GMA950", model) == 0) ||
(strcmp("Mobile GMA3150",model) == 0))
if ((model == (char *)"Mobile GMA950")
|| (model == (char *)"Mobile GMA3150"))
{
devprop_add_value(device, "AAPL,HasPanel", reg_TRUE, 4);
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
}
else if ((strcmp("Desktop GMA950", model) == 0) ||
(strcmp("Desktop GMA3150",model) == 0))
else if ((model == (char *)"Desktop GMA950")
|| (model == (char *)"Desktop GMA3150"))
{
BuiltIn = 0x01;
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
}
else if (strcmp("GMAX3100",model) == 0)
else if (model == (char *)"GMAX3100")
{
devprop_add_value(device, "AAPL,HasPanel",GMAX3100_vals[0], 4);
devprop_add_value(device, "AAPL,SelfRefreshSupported",GMAX3100_vals[1], 4);
devprop_add_value(device, "AAPL01,Stretch",GMAX3100_vals[21], 4);
devprop_add_value(device, "class-code",ClassFix, 4);
}
else if (model == (char *)"Intel HD Graphics 2000 Mobile")
{
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
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, "AAPL00,T3", HD2000_vals[3], 4);
devprop_add_value(device, "AAPL00,T4", HD2000_vals[4], 4);
devprop_add_value(device, "AAPL00,T5", HD2000_vals[5], 4);
devprop_add_value(device, "AAPL00,T6", HD2000_vals[6], 4);
devprop_add_value(device, "AAPL00,T7", HD2000_vals[7], 4);
devprop_add_value(device, "AAPL00,LinkType", HD2000_vals[8], 4);
devprop_add_value(device, "AAPL00,LinkFormat", HD2000_vals[9], 4);
devprop_add_value(device, "AAPL00,DualLink", HD2000_vals[10], 4);
devprop_add_value(device, "AAPL00,Dither", HD2000_vals[11], 4);
devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 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);
}
else if (model == (char *)"Intel HD Graphics 3000 Mobile")
{
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL00,PixelFormat", HD3000_vals[0], 4);
devprop_add_value(device, "AAPL00,T1", HD3000_vals[1], 4);
devprop_add_value(device, "AAPL00,T2", HD3000_vals[2], 4);
devprop_add_value(device, "AAPL00,T3", HD3000_vals[3], 4);
devprop_add_value(device, "AAPL00,T4", HD3000_vals[4], 4);
devprop_add_value(device, "AAPL00,T5", HD3000_vals[5], 4);
devprop_add_value(device, "AAPL00,T6", HD3000_vals[6], 4);
devprop_add_value(device, "AAPL00,T7", HD3000_vals[7], 4);
devprop_add_value(device, "AAPL00,LinkType", HD3000_vals[8], 4);
devprop_add_value(device, "AAPL00,LinkFormat", HD3000_vals[9], 4);
devprop_add_value(device, "AAPL00,DualLink", HD3000_vals[10], 4);
devprop_add_value(device, "AAPL00,Dither", HD3000_vals[11], 4);
devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 4);
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);
}
else if (model == (char *)"Intel HD Graphics 2000")
{
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, "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);
}
else if (model == (char *)"Intel HD Graphics 3000")
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
device_id = 0x00000126;// Inject a valid mobile GPU device id instead of patching kexts
devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id));
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);
}
stringdata = malloc(sizeof(uint8_t) * string->length);
if (!stringdata)

Archive Download the corresponding diff file

Revision: 1956