Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazi/i386/modules/GraphicsEnabler/AMDGraphicsEnabler/ati.c

1/*
2 * ATI Graphics Card Enabler, part of the Chameleon Boot Loader Project
3 *
4 * Copyright 2010 by Islam M. Ahmed Zaid. All rights reserved.
5 *
6 */
7
8#include "libsa.h"
9#include "saio_internal.h"
10#include "bootstruct.h"
11#include "pci.h"
12#include "platform.h"
13#include "device_inject.h"
14#include "ati_reg.h"
15
16#define OFFSET_TO_GET_ATOMBIOS_STRINGS_START 0x6e
17
18#define kUseAtiROM"UseAtiROM"
19#define kAtiConfig"AtiConfig"
20#define kATYbinimage"ATYbinimage"
21
22#define Reg32(reg)(*(volatile uint32_t *)(card->mmio + reg))
23#define RegRead32(reg)(Reg32(reg))
24#define RegWrite32(reg, value)(Reg32(reg) = value)
25
26typedef enum {
27kNul,
28kStr,
29kPtr,
30kCst
31} type_t;
32
33typedef enum {
34CHIP_FAMILY_UNKNOW,
35CHIP_FAMILY_RS600,
36CHIP_FAMILY_RS690,
37CHIP_FAMILY_RS740,
38/* R600 */
39CHIP_FAMILY_R600,
40CHIP_FAMILY_RV610,
41CHIP_FAMILY_RV630,
42CHIP_FAMILY_RV670,
43CHIP_FAMILY_RV620,
44CHIP_FAMILY_RV635,
45CHIP_FAMILY_RS780,
46CHIP_FAMILY_RS880,
47/* R700 */
48CHIP_FAMILY_RV770,
49CHIP_FAMILY_RV730,
50CHIP_FAMILY_RV710,
51CHIP_FAMILY_RV740,
52/* Evergreen */
53CHIP_FAMILY_CEDAR,
54CHIP_FAMILY_REDWOOD,
55CHIP_FAMILY_JUNIPER,
56CHIP_FAMILY_CYPRESS,
57CHIP_FAMILY_HEMLOCK,
58/* Northern Islands */
59CHIP_FAMILY_BARTS,
60CHIP_FAMILY_CAICOS,
61CHIP_FAMILY_CAYMAN,
62CHIP_FAMILY_TURKS,
63CHIP_FAMILY_LAST
64} chip_family_t;
65
66static const char *chip_family_name[] = {
67"UNKNOW",
68"RS600",
69"RS690",
70"RS740",
71/* R600 */
72"R600",
73"RV610",
74"RV630",
75"RV670",
76"RV620",
77"RV635",
78"RS780",
79"RS880",
80/* R700 */
81"RV770",
82"RV730",
83"RV710",
84"RV740",
85/* Evergreen */
86"Cedar",// RV810
87"Redwood",// RV830
88"Juniper",// RV840
89"Cypress",// RV870
90"Hemlock",
91/* Northern Islands */
92"Barts",
93"Caicos",
94"Cayman",
95"Turks",
96""
97};
98
99typedef struct {
100const char*name;
101uint8_tports;
102} card_config_t;
103
104static card_config_t card_configs[] = {
105{NULL,0},
106{"Alopias",2},
107{"Alouatta",4},
108{"Baboon",3},
109{"Cardinal",2},
110{"Caretta",1},
111{"Colobus",2},
112{"Douc",2},
113{"Eulemur",3},
114{"Flicker",3},
115{"Galago",2},
116{"Gliff",3},
117{"Hoolock",3},
118{"Hypoprion",2},
119{"Iago",2},
120{"Kakapo",3},
121{"Kipunji",4},
122{"Lamna",2},
123{"Langur",3},
124{"Megalodon",3},
125{"Motmot",2},
126{"Nomascus",5},
127{"Orangutan",2},
128{"Peregrine",2},
129{"Quail",3},
130{"Raven",3},
131{"Shrike",3},
132{"Sphyrna",1},
133{"Triakis",2},
134{"Uakari",4},
135{"Vervet",4},
136{"Zonalis",6},
137{"Pithecia",3},
138{"Bulrushe