Chameleon

Chameleon Commit Details

Date:2011-06-04 05:48:33 (12 years 10 months ago)
Author:Azimutz
Commit:950
Parents: 949
Message:"Final" clean up to IntelGraphicsEnabler module. Ready for testing.
Changes:
M/branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/gma.c
M/branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/IntelGraphicsEnabler.c
M/branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/gma.h
M/branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/Readme.txt

File differences

branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/gma.c
1
2
1
2
33
4
4
55
66
77
8
98
109
1110
......
2221
2322
2423
24
2525
2626
2727
......
4545
4646
4747
48
48
49
4950
5051
5152
......
5354
5455
5556
56
57
58
59
5760
61
62
5863
5964
6065
61
66
67
68
6269
6370
6471
65
66
67
72
73
74
75
76
6877
6978
7079
......
7281
7382
7483
75
76
77
78
79
80
81
82
84
85
86
87
88
89
90
8391
84
92
8593
8694
87
95
8896
89
97
9098
9199
92100
93101
94102
103
95104
96105
97106
98
107
99108
100109
101110
......
105114
106115
107116
108
109
117
118
119
120
110121
111122
112123
113
124
125
126
127
114128
115129
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
130
139131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
140158
141159
142
160
143161
144162
145163
/**
Original patch by nawcom
/*
Original patch by Nawcom
http://forum.voodooprojects.org/index.php/topic,1029.msg4427.html#msg4427
**/
*/
#include "libsa.h"
#include "saio_internal.h"
#include "bootstruct.h"
#include "pci.h"
#include "platform.h"
#define DBG(x...)
#endif
uint8_t GMAX3100_vals[22][4] = {
{ 0x01,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x3B,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 }
};
uint8_t reg_TRUE[] = { 0x01 ,0x00 ,0x00 ,0x00 };
uint8_t reg_TRUE[]= { 0x01 ,0x00 ,0x00 ,0x00 };
uint8_t reg_FALSE[] = { 0x00,0x00,0x00,0x00 };
static struct gma_gpu_t KnownGPUS[] = {
{ 0x808627A2, "Mobile GMA950"},
{ 0x808627AE, "Mobile GMA950"},
{ 0x808627A6, "Mobile GMA950"},
{ 0x80862772, "Desktop GMA950"}, //Azi: never worked with mine.
{ 0x8086A011, "Mobile GMA3150"},
{ 0x8086A012, "Mobile GMA3150"},
{ 0x80862772, "Desktop GMA950"},
{ 0x80862776, "Desktop GMA950"},
{ 0x8086A001, "Mobile GMA3150"},
{ 0x8086A002, "Desktop GMA3150" },
{ 0x80862A02, "GMAX3100"},
{ 0x80862A03, "GMAX3100"},
{ 0x80862A12, "GMAX3100"},
{ 0x80862A13, "GMAX3100"}
{ 0x80862A13, "GMAX3100"},
{ 0x80862A42, "GMAX3100"},
{ 0x80862A43, "GMAX3100"},
};
char *get_gma_model(uint32_t id) {
int i=0;
for(i = 0; i < (sizeof(KnownGPUS) / sizeof(KnownGPUS[0])); i++) {
if(KnownGPUS[i].device == id)
int i = 0;
for (i = 0; i < (sizeof(KnownGPUS) / sizeof(KnownGPUS[0])); i++)
{
if (KnownGPUS[i].device == id)
return KnownGPUS[i].name;
}
return KnownGPUS[0].name;
bool setup_gma_devprop(pci_dt_t *gma_dev)
{
//intlen;
char *devicepath;
volatile uint8_t *regs;
uint32_t bar[7];
char *model;
uint8_t BuiltIn = 0x00;
uint8_t ClassFix[4] = { 0x00, 0x00, 0x03, 0x00 };
char*devicepath;
volatile uint8_t*regs;
uint32_tbar[7];
char*model;
uint8_t BuiltIn =0x00;
uint8_t ClassFix[4] ={ 0x00, 0x00, 0x03, 0x00 };
devicepath = get_pci_dev_path(gma_dev);
bar[0] = pci_config_read32(gma_dev->dev.addr, 0x10);
regs = (uint8_t *) (bar[0] & ~0x0f);
model = get_gma_model((gma_dev->vendor_id << 16) | gma_dev->device_id);
verbose("Intel %s [%04x:%04x] :: %s\n",
model, gma_dev->vendor_id, gma_dev->device_id, devicepath);
if (!string)
string = devprop_create_string();
struct DevPropDevice *device = malloc(sizeof(struct DevPropDevice));
device = devprop_add_device(string, devicepath);
if(!device)
if (!device)
{
printf("Failed initializing dev-prop string dev-entry, press any key...\n");
devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1));
devprop_add_value(device, "device_type", (uint8_t*)"display", 8);
if (model == (char *)"Mobile GMA950") {
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 (model == (char *)"Desktop GMA950") {
}
else if ((model == (char *)"Desktop GMA950")
|| (model == (char *)"Desktop GMA3150"))
{
BuiltIn = 0x01;
devprop_add_value(device, "built-in", &BuiltIn, 1);
} 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, "AAPL,aux-power-connected",GMAX3100_vals[2], 4);
devprop_add_value(device, "AAPL,backlight-control",GMAX3100_vals[3], 4);
devprop_add_value(device, "AAPL00,blackscreen-preferences",GMAX3100_vals[4], 4);
devprop_add_value(device, "AAPL01,BacklightIntensity",GMAX3100_vals[5], 4);
devprop_add_value(device, "AAPL01,blackscreen-preferences",GMAX3100_vals[6], 4);
devprop_add_value(device, "AAPL01,DataJustify",GMAX3100_vals[7], 4);
devprop_add_value(device, "AAPL01,Depth",GMAX3100_vals[8], 4);
devprop_add_value(device, "AAPL01,Dither",GMAX3100_vals[9], 4);
devprop_add_value(device, "AAPL01,DualLink",GMAX3100_vals[10], 4);
devprop_add_value(device, "AAPL01,Height",GMAX3100_vals[11], 4);
devprop_add_value(device, "AAPL01,Interlace",GMAX3100_vals[12], 4);
devprop_add_value(device, "AAPL01,Inverter",GMAX3100_vals[13], 4);
devprop_add_value(device, "AAPL01,InverterCurrent",GMAX3100_vals[14], 4);
devprop_add_value(device, "AAPL01,InverterCurrency",GMAX3100_vals[15], 4);
devprop_add_value(device, "AAPL01,LinkFormat",GMAX3100_vals[16], 4);
devprop_add_value(device, "AAPL01,LinkType",GMAX3100_vals[17], 4);
devprop_add_value(device, "AAPL01,Pipe",GMAX3100_vals[18], 4);
devprop_add_value(device, "AAPL01,PixelFormat",GMAX3100_vals[19], 4);
devprop_add_value(device, "AAPL01,Refresh",GMAX3100_vals[20], 4);
devprop_add_value(device, "AAPL01,Stretch",GMAX3100_vals[21], 4);
devprop_add_value(device, "class-code", ClassFix, 4);
}
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, "AAPL,aux-power-connected",GMAX3100_vals[2], 4);
devprop_add_value(device, "AAPL,backlight-control",GMAX3100_vals[3], 4);
devprop_add_value(device, "AAPL00,blackscreen-preferences", GMAX3100_vals[4], 4);
devprop_add_value(device, "AAPL01,BacklightIntensity",GMAX3100_vals[5], 4);
devprop_add_value(device, "AAPL01,blackscreen-preferences", GMAX3100_vals[6], 4);
devprop_add_value(device, "AAPL01,DataJustify",GMAX3100_vals[7], 4);
devprop_add_value(device, "AAPL01,Depth",GMAX3100_vals[8], 4);
devprop_add_value(device, "AAPL01,Dither",GMAX3100_vals[9], 4);
devprop_add_value(device, "AAPL01,DualLink",GMAX3100_vals[10], 4);
devprop_add_value(device, "AAPL01,Height",GMAX3100_vals[11], 4);
devprop_add_value(device, "AAPL01,Interlace",GMAX3100_vals[12], 4);
devprop_add_value(device, "AAPL01,Inverter",GMAX3100_vals[13], 4);
devprop_add_value(device, "AAPL01,InverterCurrent",GMAX3100_vals[14], 4);
devprop_add_value(device, "AAPL01,InverterCurrency",GMAX3100_vals[15], 4);
devprop_add_value(device, "AAPL01,LinkFormat",GMAX3100_vals[16], 4);
devprop_add_value(device, "AAPL01,LinkType",GMAX3100_vals[17], 4);
devprop_add_value(device, "AAPL01,Pipe",GMAX3100_vals[18], 4);
devprop_add_value(device, "AAPL01,PixelFormat",GMAX3100_vals[19], 4);
devprop_add_value(device, "AAPL01,Refresh",GMAX3100_vals[20], 4);
devprop_add_value(device, "AAPL01,Stretch",GMAX3100_vals[21], 4);
devprop_add_value(device, "class-code",ClassFix, 4);
}
stringdata = malloc(sizeof(uint8_t) * string->length);
if(!stringdata)
if (!stringdata)
{
printf("no stringdata press a key...\n");
getchar();
branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/IntelGraphicsEnabler.c
11
2
2
33
4
4
55
66
77
......
1111
1212
1313
14
1415
15
16
1716
1817
1918
/*
* IntelGraphicsEnabler Module ---
*IntelGraphicsEnabler Module ---
* Enables "some" Intel cards to be used out of the box ?? in OS X.
* This was converted from ... // AutoResolution reminder ---
* This was converted from ... // AutoResolution reminder ---
*
*/
#include "gma.h"
#include "modules.h"
#define kGraphicsEnablerKey "GraphicsEnabler"
#define kGraphicsEnablerKey"GraphicsEnabler"
void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4);
branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/gma.h
88
99
1010
11
12
13
11
12
13
1414
1515
1616
char *name;
};
#define REG8(reg) ((volatile uint8_t *)regs)[(reg)]
#define REG16(reg) ((volatile uint16_t *)regs)[(reg) >> 1]
#define REG32(reg) ((volatile uint32_t *)regs)[(reg) >> 2]
#define REG8(reg)((volatile uint8_t *)regs)[(reg)]
#define REG16(reg)((volatile uint16_t *)regs)[(reg) >> 1]
#define REG32(reg)((volatile uint32_t *)regs)[(reg) >> 2]
#endif /* !__LIBSAIO_GMA_H */
branches/azimutz/Cleancut/i386/modules/IntelGraphicsEnabler/Readme.txt
11
22
3
4
3
4
55
66
77
8
8
9
910
1011
12
13
14
1115
12
16
Module:IntelGraphicsEnabler
Description: Enables "some" ?? Intel cards to be used out of the box ?? in OS X.
This was converted from ...
Description: Enables a few Intel cards to be used out of the box,
mostly mobile ones.
Dependencies: none
Keys: GraphicsEnabler (enabled by default)
Keys: GraphicsEnablerYes/No (enabled by default)
Disable GraphicsEnabler patch.
Adaptation of Meklort's work.
Original patch by Nawcom:
http://forum.voodooprojects.org/index.php/topic,1029.0.html
TODO: ---
TODO: test my GMA desktop again (Azi)

Archive Download the corresponding diff file

Revision: 950