Chameleon

Chameleon Commit Details

Date:2015-03-13 02:03:22 (5 years 8 months ago)
Author:ErmaC
Commit:2626
Parents: 2625
Message:Reformatted ati.c
Changes:
M/trunk/i386/libsaio/ati.h
M/trunk/i386/libsaio/gma.h
M/trunk/i386/libsaio/ati.c

File differences

trunk/i386/libsaio/gma.h
247247
248248
249249
250
250
251251
252252
253253
254
254
255255
256
257
258
259
260
256
257
258
259
260
261261
262
263
264
262
263
264
265265
266
267
266
267
268268
269269
270
271
272
273
274
275
276
277
270
271
272
273
274
275
276
277
278278
279279
280280
#define GMA_HASWELL_CRW_E_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0D0E)
#define GMA_HASWELL_CRW_E_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0D1E)
#define GMA_HASWELL_CRW_E_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0D2E)
#define GMA_HASWELL_CRW_M_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D36)
#define GMA_HASWELL_CRW_M_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D36) // Crystal Well Integrated Graphics Controller
#define GMA_HASWELL_CRW_S_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D3A)
/* Brodwell */
#define GMA_BRODWELL_BDW_1602 GFX_MODEL_CONSTRUCT(INTEL, 0x1602) //
#define GMA_BRODWELL_BDW_1602 GFX_MODEL_CONSTRUCT(INTEL, 0x1602) // Intel(R) HD Graphics Drivers
#define GMA_BRODWELL_BDW_U_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x1606) // BDW U GT1
#define GMA_BRODWELL_BDW_160A GFX_MODEL_CONSTRUCT(INTEL, 0x160A) //
#define GMA_BRODWELL_BDW_160B GFX_MODEL_CONSTRUCT(INTEL, 0x160B) //
#define GMA_BRODWELL_BDW_160D GFX_MODEL_CONSTRUCT(INTEL, 0x160D) //
#define GMA_BRODWELL_BDW_160E GFX_MODEL_CONSTRUCT(INTEL, 0x160E) //
#define GMA_BRODWELL_BDW_1612 GFX_MODEL_CONSTRUCT(INTEL, 0x1612) //
#define GMA_BRODWELL_BDW_160A GFX_MODEL_CONSTRUCT(INTEL, 0x160A) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_160B GFX_MODEL_CONSTRUCT(INTEL, 0x160B) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_160D GFX_MODEL_CONSTRUCT(INTEL, 0x160D) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_160E GFX_MODEL_CONSTRUCT(INTEL, 0x160E) // Intel(R) HD Graphics Drivers
#define GMA_BRODWELL_BDW_1612 GFX_MODEL_CONSTRUCT(INTEL, 0x1612) // Intel(R) HD Graphics 5600 Drivers
#define GMA_BRODWELL_BDW_U_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x1616) // BDW U GT2 Intel(R) HD Graphics 5500 Drivers
#define GMA_BRODWELL_BDW_161B GFX_MODEL_CONSTRUCT(INTEL, 0x161B) //
#define GMA_BRODWELL_BDW_161A GFX_MODEL_CONSTRUCT(INTEL, 0x161A) //
#define GMA_BRODWELL_BDW_161D GFX_MODEL_CONSTRUCT(INTEL, 0x161D) //
#define GMA_BRODWELL_BDW_161B GFX_MODEL_CONSTRUCT(INTEL, 0x161B) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_161A GFX_MODEL_CONSTRUCT(INTEL, 0x161A) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_161D GFX_MODEL_CONSTRUCT(INTEL, 0x161D) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_Y_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x161E) // BDW Y GT2 Intel(R) HD Graphics 5300 Drivers
#define GMA_BRODWELL_BDW_1622 GFX_MODEL_CONSTRUCT(INTEL, 0x1622) //
#define GMA_BRODWELL_BDW_162A GFX_MODEL_CONSTRUCT(INTEL, 0x162A) //
#define GMA_BRODWELL_BDW_1622 GFX_MODEL_CONSTRUCT(INTEL, 0x1622) // Intel(R) Iris(TM) Pro Graphics 6200 Drivers
#define GMA_BRODWELL_BDW_162A GFX_MODEL_CONSTRUCT(INTEL, 0x162A) // Intel(R) Iris(TM) Pro Graphics 6300P Drivers
#define GMA_BRODWELL_BDW_U_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x1626) // BDW U GT3 15W Intel(R) HD Graphics 6000 Drivers
#define GMA_BRODWELL_BDW_U_GT3_2 GFX_MODEL_CONSTRUCT(INTEL, 0x162B) // BDW U GT3 28W Intel(R) Iris(TM) Pro Graphics 6100 Drivers
#define GMA_BRODWELL_BDW_162D GFX_MODEL_CONSTRUCT(INTEL, 0x162D) //
#define GMA_BRODWELL_BDW_162E GFX_MODEL_CONSTRUCT(INTEL, 0x162E) //
#define GMA_BRODWELL_BDW_1632 GFX_MODEL_CONSTRUCT(INTEL, 0x1632) //
#define GMA_BRODWELL_BDW_1636 GFX_MODEL_CONSTRUCT(INTEL, 0x1636) //
#define GMA_BRODWELL_BDW_163A GFX_MODEL_CONSTRUCT(INTEL, 0x163A) //
#define GMA_BRODWELL_BDW_163B GFX_MODEL_CONSTRUCT(INTEL, 0x163B) //
#define GMA_BRODWELL_BDW_163D GFX_MODEL_CONSTRUCT(INTEL, 0x163D) //
#define GMA_BRODWELL_BDW_163E GFX_MODEL_CONSTRUCT(INTEL, 0x163E) //
#define GMA_BRODWELL_BDW_162D GFX_MODEL_CONSTRUCT(INTEL, 0x162D) // Intel(R) Iris(TM) Pro Graphics 6300P Drivers
#define GMA_BRODWELL_BDW_162E GFX_MODEL_CONSTRUCT(INTEL, 0x162E) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_1632 GFX_MODEL_CONSTRUCT(INTEL, 0x1632) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_1636 GFX_MODEL_CONSTRUCT(INTEL, 0x1636) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_163A GFX_MODEL_CONSTRUCT(INTEL, 0x163A) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_163B GFX_MODEL_CONSTRUCT(INTEL, 0x163B) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_163D GFX_MODEL_CONSTRUCT(INTEL, 0x163D) // Broadwell-U Integrated Graphics
#define GMA_BRODWELL_BDW_163E GFX_MODEL_CONSTRUCT(INTEL, 0x163E) // Broadwell-U Integrated Graphics
/*
https://fossies.org/linux/MesaLib/include/pci_ids/i965_pci_ids.h
trunk/i386/libsaio/ati.c
77
88
99
10
11
12
13
14
1015
1116
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
7317
7418
7519
......
17661710
17671711
17681712
1769
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
17701775
17711776
17721777
......
18021807
18031808
18041809
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
18181810
18191811
18201812
......
18351827
18361828
18371829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
18381844
18391845
18401846
......
19992005
20002006
20012007
2002
2008
20032009
20042010
20052011
......
20652071
20662072
20672073
2074
20682075
20692076
20702077
......
20722079
20732080
20742081
2082
20752083
20762084
20772085
20782086
20792087
2088
20802089
20812090
20822091
......
21122121
21132122
21142123
2124
21152125
21162126
21172127
......
21612171
21622172
21632173
2174
21642175
21652176
21662177
......
23812392
23822393
23832394
2395
2396
23842397
23852398
23862399
......
24162429
24172430
24182431
2432
24192433
24202434
24212435
#include "ati.h"
/* vals */
static value_t aty_name;
static value_t aty_nameparent;
card_t *card;
static booldoit= false;
static const char *chip_family_name[] = {
"UNKNOW",
"R420",
"R423",
"RV410",
"RV515",
"R520",
"RV530",
"RV560",
"RV570",
"R580",
/* IGP */
"RS600",
"RS690",
"RS740",
"RS780",
"RS880",
/* R600 */
"R600",
"RV610",
"RV620",
"RV630",
"RV635",
"RV670",
/* R700 */
"RV710",
"RV730",
"RV740",
"RV770",
"RV772",
"RV790",
/* Evergreen */
"Cedar",
"Cypress",
"Hemlock",
"Juniper",
"Redwood",
/* Northern Islands */
"Barts",
"Caicos",
"Cayman",
"Turks",
/* Southern Islands */
"Palm",
"Sumo",
"Sumo2",
"Aruba",
"Tahiti",
"Pitcairn",
"Verde",
"Oland",
"Hainan",
"Bonaire",
"Kaveri",
"Kabini",
"Hawaii",
/* ... */
"Mullins",
""
};
static card_config_t card_configs[] = {
{NULL,0},
/* OLDController */
{ 0x0000,0x00000000, CHIP_FAMILY_UNKNOW,"AMD Unknown",kNull}
};
dev_prop_t ati_devprop_list[] = {
static const char *chip_family_name[] = {
"UNKNOW",
"R420",
"R423",
"RV410",
"RV515",
"R520",
"RV530",
"RV560",
"RV570",
"R580",
/* IGP */
"RS600",
"RS690",
"RS740",
"RS780",
"RS880",
/* R600 */
"R600",
"RV610",
"RV620",
"RV630",
"RV635",
"RV670",
/* R700 */
"RV710",
"RV730",
"RV740",
"RV770",
"RV772",
"RV790",
/* Evergreen */
"Cedar",
"Cypress",
"Hemlock",
"Juniper",
"Redwood",
/* Northern Islands */
"Barts",
"Caicos",
"Cayman",
"Turks",
/* Southern Islands */
"Palm",
"Sumo",
"Sumo2",
"Aruba",
"Tahiti",
"Pitcairn",
"Verde",
"Oland",
"Hainan",
"Bonaire",
"Kaveri",
"Kabini",
"Hawaii",
/* ... */
"Mullins",
""
};
AtiDevProp ati_devprop_list[] = {
{FLAGTRUE,false,"@0,AAPL,boot-display",get_bootdisplay_val,NULVAL},
//{FLAGTRUE,false,"@0,ATY,EFIDisplay",NULL,STRVAL("TMDSA")},
{FLAGTRUE,false,NULL,NULL,NULVAL}
};
bool get_hdmiaudio(value_t * val)
{
bool doit = false;
if(getBoolForKey(kEnableHDMIAudio, &doit, &bootInfo->chameleonConfig) && doit){
val->type = kStr;
val->size = strlen("onboard-1") + 1;
val->data = (uint8_t *)"onboard-1";
return true;
}
return false;
}
bool get_bootdisplay_val(value_t *val)
{
static uint32_t v = 0;
return true;
}
bool get_hdmiaudio(value_t * val)
{
bool doit = false;
if(getBoolForKey(kEnableHDMIAudio, &doit, &bootInfo->chameleonConfig) && doit)
{
val->type = kStr;
val->size = strlen("onboard-1") + 1;
val->data = (uint8_t *)"onboard-1";
return true;
}
return false;
}
bool get_vrammemory_val(value_t *val)
{
return false;
bzero(val, sizeof(value_t));
}
void devprop_add_list(dev_prop_t devprop_list[])
void devprop_add_list(AtiDevProp devprop_list[])
{
int i, pnum;
value_t *val = malloc(sizeof(value_t));
if (rom_header->signature != 0xaa55)
{
//verbose("invalid ROM signature %x\n", rom_header->signature);
return false;
}
if (rom_pci_header->signature != 0x52494350)
{
//verbose("invalid ROM header %x\n", rom_pci_header->signature);
return false;
}
if (rom_pci_header->vendor_id != pci_dev->vendor_id || rom_pci_header->device_id != pci_dev->device_id)
{
//verbose("invalid ROM vendor=%x deviceID=%d\n", rom_pci_header->vendor_id, rom_pci_header->device_id);
return false;
}
if (!validate_rom((option_rom_header_t *)card->rom, card->pci_dev))
{
verbose("validate_rom fails\n");
card->rom_size = 0;
card->rom = 0;
return false;
if (!validate_rom(rom_addr, card->pci_dev))
{
verbose("There is no ROM @0x%x\n", rom_addr);
return false;
}
card->rom_size = rom_addr->rom_size * 512;
pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id.subsys.vendor_id, pci_dev->subsys_id.subsys.device_id);
return false;
}
verbose("Found ATI card! Device ID:[%04X:%04X] Subsystem ID:[%08X] - Radeon [%04X:%08X] %s\n",
pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id, card->info->device_id, card->info->subsys_id, card->info->model_name);
card->fb= (uint8_t *)(pci_config_read32(pci_dev->dev.addr, PCI_BASE_ADDRESS_0) & ~0x0f);
card->mmio= (uint8_t *)(pci_config_read32(pci_dev->dev.addr, PCI_BASE_ADDRESS_2) & ~0x0f);
if (card->info->chip_family >= CHIP_FAMILY_CEDAR)
{
verbose("ATI Radeon EVERGREEN family\n");
card->flags |= EVERGREEN;
}
trunk/i386/libsaio/ati.h
1717
1818
1919
20
2120
22
23
21
22
2423
2524
26
27
28
29
30
25
3126
3227
3328
......
107102
108103
109104
105
106
107
108
109
110
110111
111112
112113
......
193194
194195
195196
196
197
197198
198
199
200
201
202
203
204
205
206
207
208
209
210
211199
212200
213
214
215
216
217
201
202
203
204
205
218206
219207
220
221208
222
223
224
225
226
227
228
229
230209
231210
232211
......
243222
244223
245224
225
226
227
228
229
230
231
246232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
247249
248250
249251
......
262264
263265
264266
265
266
267
268
269
270267
#include "ati_reg.h"
/* DEFINES */
#define OFFSET_TO_GET_ATOMBIOS_STRINGS_START 0x6e
#define Reg32(reg)(*(volatile uint32_t *)(card->mmio + reg))
#define RegRead32(reg)(Reg32(reg))
#define Reg32(reg)(*(volatile uint32_t *)(card->mmio + reg))
#define RegRead32(reg)(Reg32(reg))
#define RegWrite32(reg, value)(Reg32(reg) = value)
/* Flags */
#define MKFLAG(n)(1 << n)
#define FLAGTRUEMKFLAG(0)
#define EVERGREENMKFLAG(1)
#define OFFSET_TO_GET_ATOMBIOS_STRINGS_START 0x6e
#define DATVAL(x){kPtr, sizeof(x), (uint8_t *)x}
#define STRVAL(x){kStr, sizeof(x), (uint8_t *)x}
#define BYTVAL(x){kCst, 1, (uint8_t *)x}
CHIP_FAMILY_LAST
} ati_chip_family_t;
//card to #ports
typedef struct {
const char*name;
uint8_tports;
} card_config_t;
typedef enum {
kNull,
/* OLDController */
kBasset,
kGreyhound,
kCfgEnd
} ati_config_name_t;
} config_name_t;
/* Typedefs STRUCTS */
typedef struct {
type_ttype;
uint32_tsize;
uint8_t*data;
} value_t;
//card to #ports
typedef struct {
const char*name;
uint8_tports;
} card_config_t;
//radeon card (includes teh AtiConfig)
typedef struct {
uint16_tdevice_id;
uint32_tsubsys_id;
ati_chip_family_tchip_family;
const char*model_name;
ati_config_name_tcfg_name;
uint16_tdevice_id;
uint32_tsubsys_id;
ati_chip_family_tchip_family;
const char*model_name;
config_name_tcfg_name;
} radeon_card_info_t;
// dev_tree representation
typedef struct {
uint32_tflags;
boolall_ports;
char*name;
bool(*get_value)(value_t *val);
value_tdefault_val;
} dev_prop_t;
typedef struct {
struct DevPropDevice*device;
radeon_card_info_t*info;
pci_dt_t*pci_dev;
} card_t;
/* Flags */
#define MKFLAG(n)(1 << n)
#define FLAGTRUEMKFLAG(0)
#define EVERGREENMKFLAG(1)
#define FLAGMOBILEMKFLAG(2)
#define FLAGOLDMKFLAG(3)
#define FLAGNOTFAKEMKFLAG(4)
/* Typedefs STRUCTS */
typedef struct {
type_ttype;
uint32_tsize;
uint8_t*data;
} value_t;
// dev_tree representation
typedef struct {
uint32_tflags;
boolall_ports;
char*name;
bool(*get_value)(value_t *val);
value_tdefault_val;
} AtiDevProp;
/* functions */
bool get_bootdisplay_val(value_t *val);
bool get_vrammemory_val(value_t *val);
bool get_vramtotalsize_val(value_t *val);
bool get_hdmiaudio(value_t * val);
/* vals */
static value_t aty_name;
static value_t aty_nameparent;
card_t *card;
#endif

Archive Download the corresponding diff file

Revision: 2626