This source file includes following definitions.
- tga_identify
- tga_getconf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #include <sys/param.h>
32 #include <sys/device.h>
33
34 #include <dev/pci/pcivar.h>
35 #include <dev/pci/tgareg.h>
36 #include <dev/pci/tgavar.h>
37
38 #include <dev/ic/bt485var.h>
39 #include <dev/ic/bt463var.h>
40 #include <dev/ic/ibm561var.h>
41
42 #undef KB
43 #define KB * 1024
44 #undef MB
45 #define MB * 1024 * 1024
46
47 static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = {
48
49 {
50 "T8-01",
51 bt485_funcs,
52 8,
53 4 MB,
54 2 KB,
55 1, { 2 MB, 0 }, { 1 MB, 0 },
56 0, { 0, 0 }, { 0, 0 },
57 },
58
59 {
60 "T8-02",
61 bt485_funcs,
62 8,
63 4 MB,
64 4 KB,
65 1, { 2 MB, 0 }, { 2 MB, 0 },
66 0, { 0, 0 }, { 0, 0 },
67 },
68
69 {
70 "T8-22",
71 bt485_funcs,
72 8,
73 8 MB,
74 4 KB,
75 1, { 4 MB, 0 }, { 2 MB, 0 },
76 1, { 6 MB, 0 }, { 2 MB, 0 },
77 },
78
79 {
80 "T8-44",
81 bt485_funcs,
82 8,
83 16 MB,
84 4 KB,
85 2, { 8 MB, 12 MB }, { 2 MB, 2 MB },
86 2, { 10 MB, 14 MB }, { 2 MB, 2 MB },
87 },
88
89 {
90 "T32-04",
91 bt463_funcs,
92 32,
93 16 MB,
94 8 KB,
95 1, { 8 MB, 0 }, { 4 MB, 0 },
96 0, { 0, 0 }, { 0, 0 },
97 },
98
99 {
100 "T32-08",
101 bt463_funcs,
102 32,
103 16 MB,
104 16 KB,
105 1, { 8 MB, 0 }, { 8 MB, 0 },
106 0, { 0, 0 }, { 0, 0 },
107 },
108
109 {
110 "T32-88",
111 bt463_funcs,
112 32,
113 32 MB,
114 16 KB,
115 1, { 16 MB, 0 }, { 8 MB, 0 },
116 1, { 24 MB, 0 }, { 8 MB, 0 },
117 },
118
119
120 {
121 "PS4d20",
122 ibm561_funcs,
123 32,
124 32 MB,
125 16 KB,
126 1, { 16 MB, 0 }, { 8 MB, 0 },
127 1, { 24 MB, 0 }, { 8 MB, 0 },
128 },
129 };
130
131 #undef KB
132 #undef MB
133
134 int
135 tga_identify(dc)
136 struct tga_devconfig *dc;
137 {
138 int type;
139 int gder;
140 int grev;
141 int deep, addrmask, wide;
142 int tga2;
143
144 gder = TGARREG(dc, TGA_REG_GDER);
145 grev = TGARREG(dc, TGA_REG_GREV);
146
147 deep = (gder & 0x1) != 0;
148 addrmask = (gder >> 2) & 0x7;
149 wide = (gder & 0x200) == 0;
150 tga2 = (grev & 0x20) != 0;
151
152
153 type = TGA_TYPE_UNKNOWN;
154
155 if (!deep) {
156
157
158 if (addrmask == 0x0) {
159
160
161 if (!wide)
162 type = TGA_TYPE_T8_01;
163 else
164 type = TGA_TYPE_T8_02;
165 } else if (addrmask == 0x1) {
166
167
168 if (wide)
169 type = TGA_TYPE_T8_22;
170 } else if (addrmask == 0x3) {
171
172
173 if (wide)
174 type = TGA_TYPE_T8_44;
175 }
176 } else {
177
178 if (addrmask == 0x00 && tga2 && wide) {
179
180 type = TGA_TYPE_POWERSTORM_4D20;
181 }
182
183 if (addrmask == 0x3) {
184
185
186 if (!wide)
187 type = TGA_TYPE_T32_04;
188 else
189 type = TGA_TYPE_T32_08;
190 } else if (addrmask == 0x7) {
191
192
193 if (wide && !tga2)
194 type = TGA_TYPE_T32_88;
195 }
196 }
197
198 return (type);
199 }
200
201 const struct tga_conf *
202 tga_getconf(type)
203 int type;
204 {
205
206 if (type >= 0 && type < TGA_TYPE_UNKNOWN)
207 return &tga_configs[type];
208
209 return (NULL);
210 }