Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/drivers/video/console/sticore.c - | |
3 | * core code for console driver using HP's STI firmware | |
4 | * | |
5 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | |
6 | * Copyright (C) 2001-2003 Helge Deller <deller@gmx.de> | |
7 | * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de> | |
8 | * | |
9 | * TODO: | |
10 | * - call STI in virtual mode rather than in real mode | |
11 | * - screen blanking with state_mgmt() in text mode STI ? | |
12 | * - try to make it work on m68k hp workstations ;) | |
13 | * | |
14 | */ | |
15 | ||
1da177e4 LT |
16 | #include <linux/module.h> |
17 | #include <linux/types.h> | |
18 | #include <linux/kernel.h> | |
19 | #include <linux/slab.h> | |
20 | #include <linux/init.h> | |
21 | #include <linux/pci.h> | |
22 | #include <linux/font.h> | |
23 | ||
24 | #include <asm/hardware.h> | |
25 | #include <asm/parisc-device.h> | |
26 | #include <asm/cacheflush.h> | |
fdac4e69 | 27 | #include <asm/grfioctl.h> |
1da177e4 LT |
28 | |
29 | #include "../sticore.h" | |
30 | ||
31 | #define STI_DRIVERVERSION "Version 0.9a" | |
32 | ||
3d1e412a | 33 | static struct sti_struct *default_sti __read_mostly; |
1da177e4 | 34 | |
cb6fc18e HD |
35 | /* number of STI ROMS found and their ptrs to each struct */ |
36 | static int num_sti_roms __read_mostly; | |
37 | static struct sti_struct *sti_roms[MAX_STI_ROMS] __read_mostly; | |
1da177e4 LT |
38 | |
39 | ||
40 | /* The colour indices used by STI are | |
41 | * 0 - Black | |
42 | * 1 - White | |
43 | * 2 - Red | |
44 | * 3 - Yellow/Brown | |
45 | * 4 - Green | |
46 | * 5 - Cyan | |
47 | * 6 - Blue | |
48 | * 7 - Magenta | |
49 | * | |
50 | * So we have the same colours as VGA (basically one bit each for R, G, B), | |
51 | * but have to translate them, anyway. */ | |
52 | ||
53 | static const u8 col_trans[8] = { | |
54 | 0, 6, 4, 5, | |
55 | 2, 7, 3, 1 | |
56 | }; | |
57 | ||
58 | #define c_fg(sti, c) col_trans[((c>> 8) & 7)] | |
59 | #define c_bg(sti, c) col_trans[((c>>11) & 7)] | |
60 | #define c_index(sti, c) ((c) & 0xff) | |
61 | ||
62 | static const struct sti_init_flags default_init_flags = { | |
63 | .wait = STI_WAIT, | |
64 | .reset = 1, | |
65 | .text = 1, | |
66 | .nontext = 1, | |
67 | .no_chg_bet = 1, | |
68 | .no_chg_bei = 1, | |
69 | .init_cmap_tx = 1, | |
70 | }; | |
71 | ||
3d1e412a | 72 | static int sti_init_graph(struct sti_struct *sti) |
1da177e4 LT |
73 | { |
74 | struct sti_init_inptr_ext inptr_ext = { 0, }; | |
75 | struct sti_init_inptr inptr = { | |
76 | .text_planes = 3, /* # of text planes (max 3 for STI) */ | |
77 | .ext_ptr = STI_PTR(&inptr_ext) | |
78 | }; | |
79 | struct sti_init_outptr outptr = { 0, }; | |
80 | unsigned long flags; | |
81 | int ret; | |
82 | ||
83 | spin_lock_irqsave(&sti->lock, flags); | |
84 | ||
85 | ret = STI_CALL(sti->init_graph, &default_init_flags, &inptr, | |
86 | &outptr, sti->glob_cfg); | |
87 | ||
88 | spin_unlock_irqrestore(&sti->lock, flags); | |
89 | ||
90 | if (ret < 0) { | |
91 | printk(KERN_ERR "STI init_graph failed (ret %d, errno %d)\n",ret,outptr.errno); | |
92 | return -1; | |
93 | } | |
94 | ||
95 | sti->text_planes = outptr.text_planes; | |
96 | return 0; | |
97 | } | |
98 | ||
99 | static const struct sti_conf_flags default_conf_flags = { | |
100 | .wait = STI_WAIT, | |
101 | }; | |
102 | ||
3d1e412a | 103 | static void sti_inq_conf(struct sti_struct *sti) |
1da177e4 LT |
104 | { |
105 | struct sti_conf_inptr inptr = { 0, }; | |
106 | unsigned long flags; | |
107 | s32 ret; | |
108 | ||
109 | sti->outptr.ext_ptr = STI_PTR(&sti->outptr_ext); | |
110 | ||
111 | do { | |
112 | spin_lock_irqsave(&sti->lock, flags); | |
113 | ret = STI_CALL(sti->inq_conf, &default_conf_flags, | |
114 | &inptr, &sti->outptr, sti->glob_cfg); | |
115 | spin_unlock_irqrestore(&sti->lock, flags); | |
116 | } while (ret == 1); | |
117 | } | |
118 | ||
119 | static const struct sti_font_flags default_font_flags = { | |
120 | .wait = STI_WAIT, | |
121 | .non_text = 0, | |
122 | }; | |
123 | ||
124 | void | |
125 | sti_putc(struct sti_struct *sti, int c, int y, int x) | |
126 | { | |
127 | struct sti_font_inptr inptr = { | |
128 | .font_start_addr= STI_PTR(sti->font->raw), | |
129 | .index = c_index(sti, c), | |
130 | .fg_color = c_fg(sti, c), | |
131 | .bg_color = c_bg(sti, c), | |
132 | .dest_x = x * sti->font_width, | |
133 | .dest_y = y * sti->font_height, | |
134 | }; | |
135 | struct sti_font_outptr outptr = { 0, }; | |
136 | s32 ret; | |
137 | unsigned long flags; | |
138 | ||
139 | do { | |
140 | spin_lock_irqsave(&sti->lock, flags); | |
141 | ret = STI_CALL(sti->font_unpmv, &default_font_flags, | |
142 | &inptr, &outptr, sti->glob_cfg); | |
143 | spin_unlock_irqrestore(&sti->lock, flags); | |
144 | } while (ret == 1); | |
145 | } | |
146 | ||
147 | static const struct sti_blkmv_flags clear_blkmv_flags = { | |
148 | .wait = STI_WAIT, | |
149 | .color = 1, | |
150 | .clear = 1, | |
151 | }; | |
152 | ||
153 | void | |
154 | sti_set(struct sti_struct *sti, int src_y, int src_x, | |
155 | int height, int width, u8 color) | |
156 | { | |
157 | struct sti_blkmv_inptr inptr = { | |
158 | .fg_color = color, | |
159 | .bg_color = color, | |
160 | .src_x = src_x, | |
161 | .src_y = src_y, | |
162 | .dest_x = src_x, | |
163 | .dest_y = src_y, | |
164 | .width = width, | |
165 | .height = height, | |
166 | }; | |
167 | struct sti_blkmv_outptr outptr = { 0, }; | |
168 | s32 ret; | |
169 | unsigned long flags; | |
170 | ||
171 | do { | |
172 | spin_lock_irqsave(&sti->lock, flags); | |
173 | ret = STI_CALL(sti->block_move, &clear_blkmv_flags, | |
174 | &inptr, &outptr, sti->glob_cfg); | |
175 | spin_unlock_irqrestore(&sti->lock, flags); | |
176 | } while (ret == 1); | |
177 | } | |
178 | ||
179 | void | |
180 | sti_clear(struct sti_struct *sti, int src_y, int src_x, | |
181 | int height, int width, int c) | |
182 | { | |
183 | struct sti_blkmv_inptr inptr = { | |
184 | .fg_color = c_fg(sti, c), | |
185 | .bg_color = c_bg(sti, c), | |
186 | .src_x = src_x * sti->font_width, | |
187 | .src_y = src_y * sti->font_height, | |
188 | .dest_x = src_x * sti->font_width, | |
189 | .dest_y = src_y * sti->font_height, | |
190 | .width = width * sti->font_width, | |
191 | .height = height* sti->font_height, | |
192 | }; | |
193 | struct sti_blkmv_outptr outptr = { 0, }; | |
194 | s32 ret; | |
195 | unsigned long flags; | |
196 | ||
197 | do { | |
198 | spin_lock_irqsave(&sti->lock, flags); | |
199 | ret = STI_CALL(sti->block_move, &clear_blkmv_flags, | |
200 | &inptr, &outptr, sti->glob_cfg); | |
201 | spin_unlock_irqrestore(&sti->lock, flags); | |
202 | } while (ret == 1); | |
203 | } | |
204 | ||
205 | static const struct sti_blkmv_flags default_blkmv_flags = { | |
206 | .wait = STI_WAIT, | |
207 | }; | |
208 | ||
209 | void | |
210 | sti_bmove(struct sti_struct *sti, int src_y, int src_x, | |
211 | int dst_y, int dst_x, int height, int width) | |
212 | { | |
213 | struct sti_blkmv_inptr inptr = { | |
214 | .src_x = src_x * sti->font_width, | |
215 | .src_y = src_y * sti->font_height, | |
216 | .dest_x = dst_x * sti->font_width, | |
217 | .dest_y = dst_y * sti->font_height, | |
218 | .width = width * sti->font_width, | |
219 | .height = height* sti->font_height, | |
220 | }; | |
221 | struct sti_blkmv_outptr outptr = { 0, }; | |
222 | s32 ret; | |
223 | unsigned long flags; | |
224 | ||
225 | do { | |
226 | spin_lock_irqsave(&sti->lock, flags); | |
227 | ret = STI_CALL(sti->block_move, &default_blkmv_flags, | |
228 | &inptr, &outptr, sti->glob_cfg); | |
229 | spin_unlock_irqrestore(&sti->lock, flags); | |
230 | } while (ret == 1); | |
231 | } | |
232 | ||
233 | ||
03b18f1b | 234 | static void sti_flush(unsigned long start, unsigned long end) |
1da177e4 | 235 | { |
03b18f1b | 236 | flush_icache_range(start, end); |
1da177e4 LT |
237 | } |
238 | ||
3d1e412a AB |
239 | static void __devinit sti_rom_copy(unsigned long base, unsigned long count, |
240 | void *dest) | |
1da177e4 | 241 | { |
1da177e4 LT |
242 | unsigned long dest_start = (unsigned long) dest; |
243 | ||
244 | /* this still needs to be revisited (see arch/parisc/mm/init.c:246) ! */ | |
245 | while (count >= 4) { | |
246 | count -= 4; | |
247 | *(u32 *)dest = gsc_readl(base); | |
248 | base += 4; | |
249 | dest += 4; | |
250 | } | |
251 | while (count) { | |
252 | count--; | |
253 | *(u8 *)dest = gsc_readb(base); | |
254 | base++; | |
255 | dest++; | |
256 | } | |
257 | ||
03b18f1b | 258 | sti_flush(dest_start, (unsigned long)dest); |
1da177e4 LT |
259 | } |
260 | ||
261 | ||
262 | ||
263 | ||
cb6fc18e | 264 | static char default_sti_path[21] __read_mostly; |
1da177e4 LT |
265 | |
266 | #ifndef MODULE | |
48a7d5c6 | 267 | static int __devinit sti_setup(char *str) |
1da177e4 LT |
268 | { |
269 | if (str) | |
270 | strlcpy (default_sti_path, str, sizeof (default_sti_path)); | |
271 | ||
9b41046c | 272 | return 1; |
1da177e4 LT |
273 | } |
274 | ||
275 | /* Assuming the machine has multiple STI consoles (=graphic cards) which | |
276 | * all get detected by sticon, the user may define with the linux kernel | |
277 | * parameter sti=<x> which of them will be the initial boot-console. | |
278 | * <x> is a number between 0 and MAX_STI_ROMS, with 0 as the default | |
279 | * STI screen. | |
280 | */ | |
281 | __setup("sti=", sti_setup); | |
282 | #endif | |
283 | ||
284 | ||
285 | ||
48a7d5c6 HD |
286 | static char __devinitdata *font_name[MAX_STI_ROMS] = { "VGA8x16", }; |
287 | static int __devinitdata font_index[MAX_STI_ROMS], | |
288 | font_height[MAX_STI_ROMS], | |
289 | font_width[MAX_STI_ROMS]; | |
1da177e4 | 290 | #ifndef MODULE |
48a7d5c6 | 291 | static int __devinit sti_font_setup(char *str) |
1da177e4 LT |
292 | { |
293 | char *x; | |
294 | int i = 0; | |
295 | ||
296 | /* we accept sti_font=VGA8x16, sti_font=10x20, sti_font=10*20 | |
297 | * or sti_font=7 style command lines. */ | |
298 | ||
299 | while (i<MAX_STI_ROMS && str && *str) { | |
300 | if (*str>='0' && *str<='9') { | |
301 | if ((x = strchr(str, 'x')) || (x = strchr(str, '*'))) { | |
302 | font_height[i] = simple_strtoul(str, NULL, 0); | |
303 | font_width[i] = simple_strtoul(x+1, NULL, 0); | |
304 | } else { | |
305 | font_index[i] = simple_strtoul(str, NULL, 0); | |
306 | } | |
307 | } else { | |
308 | font_name[i] = str; /* fb font name */ | |
309 | } | |
310 | ||
311 | if ((x = strchr(str, ','))) | |
312 | *x++ = 0; | |
313 | str = x; | |
314 | ||
315 | i++; | |
316 | } | |
317 | ||
9b41046c | 318 | return 1; |
1da177e4 LT |
319 | } |
320 | ||
321 | /* The optional linux kernel parameter "sti_font" defines which font | |
322 | * should be used by the sticon driver to draw characters to the screen. | |
323 | * Possible values are: | |
324 | * - sti_font=<fb_fontname>: | |
325 | * <fb_fontname> is the name of one of the linux-kernel built-in | |
326 | * framebuffer font names (e.g. VGA8x16, SUN22x18). | |
327 | * This is only available if the fonts have been statically compiled | |
328 | * in with e.g. the CONFIG_FONT_8x16 or CONFIG_FONT_SUN12x22 options. | |
329 | * - sti_font=<number> | |
330 | * most STI ROMs have built-in HP specific fonts, which can be selected | |
331 | * by giving the desired number to the sticon driver. | |
332 | * NOTE: This number is machine and STI ROM dependend. | |
333 | * - sti_font=<height>x<width> (e.g. sti_font=16x8) | |
334 | * <height> and <width> gives hints to the height and width of the | |
335 | * font which the user wants. The sticon driver will try to use | |
336 | * a font with this height and width, but if no suitable font is | |
337 | * found, sticon will use the default 8x8 font. | |
338 | */ | |
339 | __setup("sti_font=", sti_font_setup); | |
340 | #endif | |
341 | ||
342 | ||
343 | ||
48a7d5c6 | 344 | static void __devinit |
1da177e4 LT |
345 | sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request) |
346 | { | |
347 | struct sti_glob_cfg_ext *cfg; | |
348 | ||
349 | DPRINTK((KERN_INFO | |
350 | "%d text planes\n" | |
351 | "%4d x %4d screen resolution\n" | |
352 | "%4d x %4d offscreen\n" | |
353 | "%4d x %4d layout\n" | |
354 | "regions at %08x %08x %08x %08x\n" | |
355 | "regions at %08x %08x %08x %08x\n" | |
356 | "reent_lvl %d\n" | |
357 | "save_addr %08x\n", | |
358 | glob_cfg->text_planes, | |
359 | glob_cfg->onscreen_x, glob_cfg->onscreen_y, | |
360 | glob_cfg->offscreen_x, glob_cfg->offscreen_y, | |
361 | glob_cfg->total_x, glob_cfg->total_y, | |
362 | glob_cfg->region_ptrs[0], glob_cfg->region_ptrs[1], | |
363 | glob_cfg->region_ptrs[2], glob_cfg->region_ptrs[3], | |
364 | glob_cfg->region_ptrs[4], glob_cfg->region_ptrs[5], | |
365 | glob_cfg->region_ptrs[6], glob_cfg->region_ptrs[7], | |
366 | glob_cfg->reent_lvl, | |
367 | glob_cfg->save_addr)); | |
368 | ||
369 | /* dump extended cfg */ | |
857600c7 | 370 | cfg = PTR_STI((unsigned long)glob_cfg->ext_ptr); |
1da177e4 LT |
371 | DPRINTK(( KERN_INFO |
372 | "monitor %d\n" | |
373 | "in friendly mode: %d\n" | |
374 | "power consumption %d watts\n" | |
375 | "freq ref %d\n" | |
376 | "sti_mem_addr %08x (size=%d bytes)\n", | |
377 | cfg->curr_mon, | |
378 | cfg->friendly_boot, | |
379 | cfg->power, | |
380 | cfg->freq_ref, | |
381 | cfg->sti_mem_addr, sti_mem_request)); | |
382 | } | |
383 | ||
48a7d5c6 | 384 | static void __devinit |
1da177e4 LT |
385 | sti_dump_outptr(struct sti_struct *sti) |
386 | { | |
387 | DPRINTK((KERN_INFO | |
388 | "%d bits per pixel\n" | |
389 | "%d used bits\n" | |
390 | "%d planes\n" | |
391 | "attributes %08x\n", | |
392 | sti->outptr.bits_per_pixel, | |
393 | sti->outptr.bits_used, | |
394 | sti->outptr.planes, | |
395 | sti->outptr.attributes)); | |
396 | } | |
397 | ||
48a7d5c6 | 398 | static int __devinit |
1da177e4 LT |
399 | sti_init_glob_cfg(struct sti_struct *sti, |
400 | unsigned long rom_address, unsigned long hpa) | |
401 | { | |
402 | struct sti_glob_cfg *glob_cfg; | |
403 | struct sti_glob_cfg_ext *glob_cfg_ext; | |
404 | void *save_addr; | |
405 | void *sti_mem_addr; | |
406 | const int save_addr_size = 1024; /* XXX */ | |
407 | int i; | |
408 | ||
409 | if (!sti->sti_mem_request) | |
410 | sti->sti_mem_request = 256; /* STI default */ | |
411 | ||
cb6fc18e HD |
412 | glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL); |
413 | glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL); | |
414 | save_addr = kzalloc(save_addr_size, GFP_KERNEL); | |
415 | sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL); | |
1da177e4 LT |
416 | |
417 | if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) { | |
418 | kfree(glob_cfg); | |
419 | kfree(glob_cfg_ext); | |
420 | kfree(save_addr); | |
421 | kfree(sti_mem_addr); | |
422 | return -ENOMEM; | |
423 | } | |
424 | ||
1da177e4 LT |
425 | glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext); |
426 | glob_cfg->save_addr = STI_PTR(save_addr); | |
427 | for (i=0; i<8; i++) { | |
428 | unsigned long newhpa, len; | |
429 | ||
430 | if (sti->pd) { | |
431 | unsigned char offs = sti->rm_entry[i]; | |
432 | ||
433 | if (offs == 0) | |
434 | continue; | |
435 | if (offs != PCI_ROM_ADDRESS && | |
436 | (offs < PCI_BASE_ADDRESS_0 || | |
437 | offs > PCI_BASE_ADDRESS_5)) { | |
438 | printk (KERN_WARNING | |
439 | "STI pci region maping for region %d (%02x) can't be mapped\n", | |
440 | i,sti->rm_entry[i]); | |
441 | continue; | |
442 | } | |
443 | newhpa = pci_resource_start (sti->pd, (offs - PCI_BASE_ADDRESS_0) / 4); | |
444 | } else | |
445 | newhpa = (i == 0) ? rom_address : hpa; | |
446 | ||
447 | sti->regions_phys[i] = | |
448 | REGION_OFFSET_TO_PHYS(sti->regions[i], newhpa); | |
449 | ||
1da177e4 | 450 | len = sti->regions[i].region_desc.length * 4096; |
1da177e4 LT |
451 | if (len) |
452 | glob_cfg->region_ptrs[i] = sti->regions_phys[i]; | |
1da177e4 | 453 | |
857600c7 | 454 | DPRINTK(("region #%d: phys %08lx, region_ptr %08x, len=%lukB, " |
1da177e4 LT |
455 | "btlb=%d, sysonly=%d, cache=%d, last=%d\n", |
456 | i, sti->regions_phys[i], glob_cfg->region_ptrs[i], | |
457 | len/1024, | |
458 | sti->regions[i].region_desc.btlb, | |
459 | sti->regions[i].region_desc.sys_only, | |
460 | sti->regions[i].region_desc.cache, | |
461 | sti->regions[i].region_desc.last)); | |
462 | ||
463 | /* last entry reached ? */ | |
464 | if (sti->regions[i].region_desc.last) | |
465 | break; | |
466 | } | |
467 | ||
468 | if (++i<8 && sti->regions[i].region) | |
469 | printk(KERN_WARNING "%s: *future ptr (0x%8x) not yet supported !\n", | |
470 | __FILE__, sti->regions[i].region); | |
471 | ||
472 | glob_cfg_ext->sti_mem_addr = STI_PTR(sti_mem_addr); | |
473 | ||
474 | sti->glob_cfg = glob_cfg; | |
475 | ||
476 | return 0; | |
477 | } | |
478 | ||
479 | #ifdef CONFIG_FB | |
3d1e412a AB |
480 | static struct sti_cooked_font __devinit |
481 | *sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) | |
1da177e4 | 482 | { |
cb6fc18e | 483 | const struct font_desc *fbfont; |
1da177e4 LT |
484 | unsigned int size, bpc; |
485 | void *dest; | |
486 | struct sti_rom_font *nf; | |
487 | struct sti_cooked_font *cooked_font; | |
488 | ||
489 | if (!fbfont_name || !strlen(fbfont_name)) | |
951a0150 | 490 | return NULL; |
1da177e4 LT |
491 | fbfont = find_font(fbfont_name); |
492 | if (!fbfont) | |
2d2699d9 | 493 | fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0); |
1da177e4 | 494 | if (!fbfont) |
951a0150 | 495 | return NULL; |
1da177e4 LT |
496 | |
497 | DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n", | |
498 | fbfont->width, fbfont->height, fbfont->name)); | |
499 | ||
500 | bpc = ((fbfont->width+7)/8) * fbfont->height; | |
501 | size = bpc * 256; | |
502 | size += sizeof(struct sti_rom_font); | |
503 | ||
cb6fc18e | 504 | nf = kzalloc(size, GFP_KERNEL); |
1da177e4 | 505 | if (!nf) |
951a0150 | 506 | return NULL; |
1da177e4 LT |
507 | |
508 | nf->first_char = 0; | |
509 | nf->last_char = 255; | |
510 | nf->width = fbfont->width; | |
511 | nf->height = fbfont->height; | |
512 | nf->font_type = STI_FONT_HPROMAN8; | |
513 | nf->bytes_per_char = bpc; | |
514 | nf->next_font = 0; | |
515 | nf->underline_height = 1; | |
516 | nf->underline_pos = fbfont->height - nf->underline_height; | |
517 | ||
518 | dest = nf; | |
519 | dest += sizeof(struct sti_rom_font); | |
520 | memcpy(dest, fbfont->data, bpc*256); | |
521 | ||
cb6fc18e | 522 | cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); |
1da177e4 | 523 | if (!cooked_font) { |
951a0150 MW |
524 | kfree(nf); |
525 | return NULL; | |
1da177e4 LT |
526 | } |
527 | ||
528 | cooked_font->raw = nf; | |
529 | cooked_font->next_font = NULL; | |
530 | ||
531 | cooked_rom->font_start = cooked_font; | |
532 | ||
533 | return cooked_font; | |
534 | } | |
535 | #else | |
3d1e412a AB |
536 | static struct sti_cooked_font __devinit |
537 | *sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) | |
1da177e4 LT |
538 | { |
539 | return NULL; | |
540 | } | |
541 | #endif | |
542 | ||
3d1e412a AB |
543 | static struct sti_cooked_font __devinit |
544 | *sti_select_font(struct sti_cooked_rom *rom, | |
545 | int (*search_font_fnc)(struct sti_cooked_rom *, int, int)) | |
1da177e4 LT |
546 | { |
547 | struct sti_cooked_font *font; | |
548 | int i; | |
549 | int index = num_sti_roms; | |
550 | ||
551 | /* check for framebuffer-font first */ | |
552 | if ((font = sti_select_fbfont(rom, font_name[index]))) | |
553 | return font; | |
554 | ||
555 | if (font_width[index] && font_height[index]) | |
556 | font_index[index] = search_font_fnc(rom, | |
557 | font_height[index], font_width[index]); | |
558 | ||
559 | for (font = rom->font_start, i = font_index[index]; | |
560 | font && (i > 0); | |
561 | font = font->next_font, i--); | |
562 | ||
563 | if (font) | |
564 | return font; | |
565 | else | |
566 | return rom->font_start; | |
567 | } | |
568 | ||
569 | ||
48a7d5c6 | 570 | static void __devinit |
1da177e4 LT |
571 | sti_dump_rom(struct sti_rom *rom) |
572 | { | |
951a0150 | 573 | printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n", |
1da177e4 LT |
574 | rom->graphics_id[0], |
575 | rom->graphics_id[1], | |
576 | rom->revno[0] >> 4, | |
577 | rom->revno[0] & 0x0f); | |
578 | DPRINTK((" supports %d monitors\n", rom->num_mons)); | |
579 | DPRINTK((" font start %08x\n", rom->font_start)); | |
580 | DPRINTK((" region list %08x\n", rom->region_list)); | |
581 | DPRINTK((" init_graph %08x\n", rom->init_graph)); | |
582 | DPRINTK((" bus support %02x\n", rom->bus_support)); | |
583 | DPRINTK((" ext bus support %02x\n", rom->ext_bus_support)); | |
584 | DPRINTK((" alternate code type %d\n", rom->alt_code_type)); | |
585 | } | |
586 | ||
587 | ||
48a7d5c6 | 588 | static int __devinit |
1da177e4 LT |
589 | sti_cook_fonts(struct sti_cooked_rom *cooked_rom, |
590 | struct sti_rom *raw_rom) | |
591 | { | |
592 | struct sti_rom_font *raw_font, *font_start; | |
593 | struct sti_cooked_font *cooked_font; | |
594 | ||
cb6fc18e | 595 | cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); |
1da177e4 LT |
596 | if (!cooked_font) |
597 | return 0; | |
598 | ||
599 | cooked_rom->font_start = cooked_font; | |
600 | ||
601 | raw_font = ((void *)raw_rom) + (raw_rom->font_start); | |
602 | ||
603 | font_start = raw_font; | |
604 | cooked_font->raw = raw_font; | |
605 | ||
606 | while (raw_font->next_font) { | |
607 | raw_font = ((void *)font_start) + (raw_font->next_font); | |
608 | ||
cb6fc18e | 609 | cooked_font->next_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); |
1da177e4 LT |
610 | if (!cooked_font->next_font) |
611 | return 1; | |
612 | ||
613 | cooked_font = cooked_font->next_font; | |
614 | ||
615 | cooked_font->raw = raw_font; | |
616 | } | |
617 | ||
618 | cooked_font->next_font = NULL; | |
619 | return 1; | |
620 | } | |
621 | ||
622 | ||
48a7d5c6 | 623 | static int __devinit |
1da177e4 LT |
624 | sti_search_font(struct sti_cooked_rom *rom, int height, int width) |
625 | { | |
626 | struct sti_cooked_font *font; | |
627 | int i = 0; | |
628 | ||
951a0150 MW |
629 | for (font = rom->font_start; font; font = font->next_font, i++) { |
630 | if ((font->raw->width == width) && | |
631 | (font->raw->height == height)) | |
1da177e4 LT |
632 | return i; |
633 | } | |
634 | return 0; | |
635 | } | |
636 | ||
951a0150 MW |
637 | #define BMODE_RELOCATE(offset) offset = (offset) / 4; |
638 | #define BMODE_LAST_ADDR_OFFS 0x50 | |
1da177e4 | 639 | |
48a7d5c6 | 640 | static void * __devinit |
1da177e4 LT |
641 | sti_bmode_font_raw(struct sti_cooked_font *f) |
642 | { | |
643 | unsigned char *n, *p, *q; | |
644 | int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); | |
645 | ||
cb6fc18e | 646 | n = kzalloc (4*size, GFP_KERNEL); |
1da177e4 LT |
647 | if (!n) |
648 | return NULL; | |
1da177e4 LT |
649 | p = n + 3; |
650 | q = (unsigned char *)f->raw; | |
651 | while (size--) { | |
652 | *p = *q++; | |
653 | p+=4; | |
654 | } | |
655 | return n + 3; | |
656 | } | |
657 | ||
48a7d5c6 | 658 | static void __devinit |
1da177e4 LT |
659 | sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest) |
660 | { | |
1da177e4 LT |
661 | unsigned long dest_start = (unsigned long) dest; |
662 | ||
663 | while (count) { | |
664 | count--; | |
665 | *(u8 *)dest = gsc_readl(base); | |
666 | base += 4; | |
667 | dest++; | |
668 | } | |
03b18f1b KM |
669 | |
670 | sti_flush(dest_start, (unsigned long)dest); | |
1da177e4 LT |
671 | } |
672 | ||
48a7d5c6 | 673 | static struct sti_rom * __devinit |
1da177e4 LT |
674 | sti_get_bmode_rom (unsigned long address) |
675 | { | |
676 | struct sti_rom *raw; | |
677 | u32 size; | |
951a0150 MW |
678 | struct sti_rom_font *raw_font, *font_start; |
679 | ||
1da177e4 | 680 | sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size); |
951a0150 MW |
681 | |
682 | size = (size+3) / 4; | |
1da177e4 LT |
683 | raw = kmalloc(size, GFP_KERNEL); |
684 | if (raw) { | |
951a0150 MW |
685 | sti_bmode_rom_copy(address, size, raw); |
686 | memmove (&raw->res004, &raw->type[0], 0x3c); | |
687 | raw->type[3] = raw->res004; | |
1da177e4 | 688 | |
951a0150 MW |
689 | BMODE_RELOCATE (raw->region_list); |
690 | BMODE_RELOCATE (raw->font_start); | |
1da177e4 | 691 | |
951a0150 MW |
692 | BMODE_RELOCATE (raw->init_graph); |
693 | BMODE_RELOCATE (raw->state_mgmt); | |
694 | BMODE_RELOCATE (raw->font_unpmv); | |
695 | BMODE_RELOCATE (raw->block_move); | |
696 | BMODE_RELOCATE (raw->inq_conf); | |
1da177e4 | 697 | |
951a0150 MW |
698 | raw_font = ((void *)raw) + raw->font_start; |
699 | font_start = raw_font; | |
1da177e4 | 700 | |
951a0150 MW |
701 | while (raw_font->next_font) { |
702 | BMODE_RELOCATE (raw_font->next_font); | |
703 | raw_font = ((void *)font_start) + raw_font->next_font; | |
704 | } | |
1da177e4 | 705 | } |
951a0150 | 706 | return raw; |
1da177e4 LT |
707 | } |
708 | ||
3d1e412a | 709 | static struct sti_rom __devinit *sti_get_wmode_rom(unsigned long address) |
1da177e4 LT |
710 | { |
711 | struct sti_rom *raw; | |
712 | unsigned long size; | |
951a0150 | 713 | |
1da177e4 LT |
714 | /* read the ROM size directly from the struct in ROM */ |
715 | size = gsc_readl(address + offsetof(struct sti_rom,last_addr)); | |
716 | ||
717 | raw = kmalloc(size, GFP_KERNEL); | |
951a0150 MW |
718 | if (raw) |
719 | sti_rom_copy(address, size, raw); | |
1da177e4 | 720 | |
951a0150 | 721 | return raw; |
1da177e4 LT |
722 | } |
723 | ||
3d1e412a AB |
724 | static int __devinit sti_read_rom(int wordmode, struct sti_struct *sti, |
725 | unsigned long address) | |
1da177e4 LT |
726 | { |
727 | struct sti_cooked_rom *cooked; | |
728 | struct sti_rom *raw = NULL; | |
fdac4e69 | 729 | unsigned long revno; |
1da177e4 LT |
730 | |
731 | cooked = kmalloc(sizeof *cooked, GFP_KERNEL); | |
732 | if (!cooked) | |
733 | goto out_err; | |
734 | ||
951a0150 MW |
735 | if (wordmode) |
736 | raw = sti_get_wmode_rom (address); | |
737 | else | |
738 | raw = sti_get_bmode_rom (address); | |
739 | ||
740 | if (!raw) | |
741 | goto out_err; | |
1da177e4 | 742 | |
1da177e4 LT |
743 | if (!sti_cook_fonts(cooked, raw)) { |
744 | printk(KERN_ERR "No font found for STI at %08lx\n", address); | |
745 | goto out_err; | |
746 | } | |
747 | ||
748 | if (raw->region_list) | |
749 | memcpy(sti->regions, ((void *)raw)+raw->region_list, sizeof(sti->regions)); | |
750 | ||
751 | address = (unsigned long) STI_PTR(raw); | |
752 | ||
753 | sti->font_unpmv = address + (raw->font_unpmv & 0x03ffffff); | |
754 | sti->block_move = address + (raw->block_move & 0x03ffffff); | |
755 | sti->init_graph = address + (raw->init_graph & 0x03ffffff); | |
756 | sti->inq_conf = address + (raw->inq_conf & 0x03ffffff); | |
757 | ||
758 | sti->rom = cooked; | |
759 | sti->rom->raw = raw; | |
760 | ||
761 | sti->font = sti_select_font(sti->rom, sti_search_font); | |
762 | sti->font_width = sti->font->raw->width; | |
763 | sti->font_height = sti->font->raw->height; | |
764 | if (!wordmode) | |
951a0150 | 765 | sti->font->raw = sti_bmode_font_raw(sti->font); |
1da177e4 LT |
766 | |
767 | sti->sti_mem_request = raw->sti_mem_req; | |
768 | sti->graphics_id[0] = raw->graphics_id[0]; | |
769 | sti->graphics_id[1] = raw->graphics_id[1]; | |
770 | ||
771 | sti_dump_rom(raw); | |
fdac4e69 HD |
772 | |
773 | /* check if the ROM routines in this card are compatible */ | |
774 | if (wordmode || sti->graphics_id[1] != 0x09A02587) | |
775 | goto ok; | |
776 | ||
777 | revno = (raw->revno[0] << 8) | raw->revno[1]; | |
778 | ||
779 | switch (sti->graphics_id[0]) { | |
780 | case S9000_ID_HCRX: | |
781 | /* HyperA or HyperB ? */ | |
782 | if (revno == 0x8408 || revno == 0x840b) | |
783 | goto msg_not_supported; | |
784 | break; | |
785 | case CRT_ID_THUNDER: | |
786 | if (revno == 0x8509) | |
787 | goto msg_not_supported; | |
788 | break; | |
789 | case CRT_ID_THUNDER2: | |
790 | if (revno == 0x850c) | |
791 | goto msg_not_supported; | |
792 | } | |
793 | ok: | |
1da177e4 LT |
794 | return 1; |
795 | ||
fdac4e69 HD |
796 | msg_not_supported: |
797 | printk(KERN_ERR "Sorry, this GSC/STI card is not yet supported.\n"); | |
798 | printk(KERN_ERR "Please see http://parisc-linux.org/faq/" | |
799 | "graphics-howto.html for more info.\n"); | |
800 | /* fall through */ | |
1da177e4 LT |
801 | out_err: |
802 | kfree(raw); | |
803 | kfree(cooked); | |
804 | return 0; | |
805 | } | |
806 | ||
48a7d5c6 | 807 | static struct sti_struct * __devinit |
1da177e4 LT |
808 | sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd) |
809 | { | |
810 | struct sti_struct *sti; | |
811 | int ok; | |
812 | u32 sig; | |
813 | ||
814 | if (num_sti_roms >= MAX_STI_ROMS) { | |
951a0150 MW |
815 | printk(KERN_WARNING "maximum number of STI ROMS reached !\n"); |
816 | return NULL; | |
1da177e4 LT |
817 | } |
818 | ||
cb6fc18e | 819 | sti = kzalloc(sizeof(*sti), GFP_KERNEL); |
1da177e4 | 820 | if (!sti) { |
951a0150 MW |
821 | printk(KERN_ERR "Not enough memory !\n"); |
822 | return NULL; | |
1da177e4 | 823 | } |
951a0150 | 824 | |
1da177e4 LT |
825 | spin_lock_init(&sti->lock); |
826 | ||
827 | test_rom: | |
828 | /* if we can't read the ROM, bail out early. Not being able | |
829 | * to read the hpa is okay, for romless sti */ | |
830 | if (pdc_add_valid(address)) | |
831 | goto out_err; | |
832 | ||
833 | sig = gsc_readl(address); | |
834 | ||
835 | /* check for a PCI ROM structure */ | |
836 | if ((le32_to_cpu(sig)==0xaa55)) { | |
837 | unsigned int i, rm_offset; | |
838 | u32 *rm; | |
839 | i = gsc_readl(address+0x04); | |
840 | if (i != 1) { | |
841 | /* The ROM could have multiple architecture | |
842 | * dependent images (e.g. i386, parisc,...) */ | |
843 | printk(KERN_WARNING | |
844 | "PCI ROM is not a STI ROM type image (0x%8x)\n", i); | |
845 | goto out_err; | |
846 | } | |
847 | ||
848 | sti->pd = pd; | |
849 | ||
850 | i = gsc_readl(address+0x0c); | |
851 | DPRINTK(("PCI ROM size (from header) = %d kB\n", | |
852 | le16_to_cpu(i>>16)*512/1024)); | |
853 | rm_offset = le16_to_cpu(i & 0xffff); | |
854 | if (rm_offset) { | |
855 | /* read 16 bytes from the pci region mapper array */ | |
856 | rm = (u32*) &sti->rm_entry; | |
857 | *rm++ = gsc_readl(address+rm_offset+0x00); | |
858 | *rm++ = gsc_readl(address+rm_offset+0x04); | |
859 | *rm++ = gsc_readl(address+rm_offset+0x08); | |
860 | *rm++ = gsc_readl(address+rm_offset+0x0c); | |
861 | DPRINTK(("PCI region Mapper offset = %08x: ", | |
862 | rm_offset)); | |
863 | for (i=0; i<16; i++) | |
864 | DPRINTK(("%02x ", sti->rm_entry[i])); | |
865 | DPRINTK(("\n")); | |
866 | } | |
867 | ||
868 | address += le32_to_cpu(gsc_readl(address+8)); | |
869 | DPRINTK(("sig %04x, PCI STI ROM at %08lx\n", sig, address)); | |
870 | goto test_rom; | |
871 | } | |
872 | ||
873 | ok = 0; | |
874 | ||
875 | if ((sig & 0xff) == 0x01) { | |
876 | DPRINTK((" byte mode ROM at %08lx, hpa at %08lx\n", | |
877 | address, hpa)); | |
878 | ok = sti_read_rom(0, sti, address); | |
879 | } | |
880 | ||
881 | if ((sig & 0xffff) == 0x0303) { | |
882 | DPRINTK((" word mode ROM at %08lx, hpa at %08lx\n", | |
883 | address, hpa)); | |
884 | ok = sti_read_rom(1, sti, address); | |
885 | } | |
886 | ||
887 | if (!ok) | |
888 | goto out_err; | |
889 | ||
890 | if (sti_init_glob_cfg(sti, address, hpa)) | |
891 | goto out_err; /* not enough memory */ | |
892 | ||
893 | /* disable STI PCI ROM. ROM and card RAM overlap and | |
894 | * leaving it enabled would force HPMCs | |
895 | */ | |
896 | if (sti->pd) { | |
897 | unsigned long rom_base; | |
898 | rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE); | |
899 | pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE); | |
900 | DPRINTK((KERN_DEBUG "STI PCI ROM disabled\n")); | |
901 | } | |
902 | ||
903 | if (sti_init_graph(sti)) | |
904 | goto out_err; | |
905 | ||
906 | sti_inq_conf(sti); | |
907 | sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request); | |
908 | sti_dump_outptr(sti); | |
909 | ||
910 | printk(KERN_INFO " graphics card name: %s\n", sti->outptr.dev_name ); | |
911 | ||
912 | sti_roms[num_sti_roms] = sti; | |
913 | num_sti_roms++; | |
914 | ||
915 | return sti; | |
916 | ||
917 | out_err: | |
918 | kfree(sti); | |
919 | return NULL; | |
920 | } | |
921 | ||
48a7d5c6 | 922 | static void __devinit sticore_check_for_default_sti(struct sti_struct *sti, char *path) |
1da177e4 LT |
923 | { |
924 | if (strcmp (path, default_sti_path) == 0) | |
925 | default_sti = sti; | |
926 | } | |
927 | ||
928 | /* | |
929 | * on newer systems PDC gives the address of the ROM | |
930 | * in the additional address field addr[1] while on | |
931 | * older Systems the PDC stores it in page0->proc_sti | |
932 | */ | |
48a7d5c6 | 933 | static int __devinit sticore_pa_init(struct parisc_device *dev) |
1da177e4 | 934 | { |
1da177e4 LT |
935 | char pa_path[21]; |
936 | struct sti_struct *sti = NULL; | |
951a0150 MW |
937 | int hpa = dev->hpa.start; |
938 | ||
939 | if (dev->num_addrs && dev->addr[0]) | |
940 | sti = sti_try_rom_generic(dev->addr[0], hpa, NULL); | |
941 | if (!sti) | |
942 | sti = sti_try_rom_generic(hpa, hpa, NULL); | |
943 | if (!sti) | |
944 | sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL); | |
1da177e4 LT |
945 | if (!sti) |
946 | return 1; | |
951a0150 | 947 | |
1da177e4 | 948 | print_pa_hwpath(dev, pa_path); |
951a0150 | 949 | sticore_check_for_default_sti(sti, pa_path); |
1da177e4 LT |
950 | return 0; |
951 | } | |
952 | ||
953 | ||
954 | static int __devinit sticore_pci_init(struct pci_dev *pd, | |
955 | const struct pci_device_id *ent) | |
956 | { | |
957 | #ifdef CONFIG_PCI | |
958 | unsigned long fb_base, rom_base; | |
959 | unsigned int fb_len, rom_len; | |
960 | struct sti_struct *sti; | |
961 | ||
962 | pci_enable_device(pd); | |
963 | ||
964 | fb_base = pci_resource_start(pd, 0); | |
965 | fb_len = pci_resource_len(pd, 0); | |
966 | rom_base = pci_resource_start(pd, PCI_ROM_RESOURCE); | |
967 | rom_len = pci_resource_len(pd, PCI_ROM_RESOURCE); | |
968 | if (rom_base) { | |
969 | pci_write_config_dword(pd, PCI_ROM_ADDRESS, rom_base | PCI_ROM_ADDRESS_ENABLE); | |
970 | DPRINTK((KERN_DEBUG "STI PCI ROM enabled at 0x%08lx\n", rom_base)); | |
971 | } | |
972 | ||
973 | printk(KERN_INFO "STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n", | |
974 | rom_base, rom_len/1024, fb_base, fb_len/1024/1024); | |
975 | ||
976 | DPRINTK((KERN_DEBUG "Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n", | |
977 | rom_base, fb_base)); | |
978 | ||
979 | sti = sti_try_rom_generic(rom_base, fb_base, pd); | |
980 | if (sti) { | |
981 | char pa_path[30]; | |
982 | print_pci_hwpath(pd, pa_path); | |
983 | sticore_check_for_default_sti(sti, pa_path); | |
984 | } | |
985 | ||
986 | if (!sti) { | |
987 | printk(KERN_WARNING "Unable to handle STI device '%s'\n", | |
988 | pci_name(pd)); | |
989 | return -ENODEV; | |
990 | } | |
991 | #endif /* CONFIG_PCI */ | |
992 | ||
993 | return 0; | |
994 | } | |
995 | ||
996 | ||
997 | static void __devexit sticore_pci_remove(struct pci_dev *pd) | |
998 | { | |
999 | BUG(); | |
1000 | } | |
1001 | ||
1002 | ||
1003 | static struct pci_device_id sti_pci_tbl[] = { | |
1004 | { PCI_DEVICE(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_VISUALIZE_EG) }, | |
1005 | { PCI_DEVICE(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_VISUALIZE_FX6) }, | |
1006 | { PCI_DEVICE(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_VISUALIZE_FX4) }, | |
1007 | { PCI_DEVICE(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_VISUALIZE_FX2) }, | |
1008 | { PCI_DEVICE(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_VISUALIZE_FXE) }, | |
1009 | { 0, } /* terminate list */ | |
1010 | }; | |
1011 | MODULE_DEVICE_TABLE(pci, sti_pci_tbl); | |
1012 | ||
1013 | static struct pci_driver pci_sti_driver = { | |
1014 | .name = "sti", | |
1015 | .id_table = sti_pci_tbl, | |
1016 | .probe = sticore_pci_init, | |
1017 | .remove = sticore_pci_remove, | |
1018 | }; | |
1019 | ||
1020 | static struct parisc_device_id sti_pa_tbl[] = { | |
1021 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00077 }, | |
1022 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00085 }, | |
1023 | { 0, } | |
1024 | }; | |
1025 | ||
1026 | static struct parisc_driver pa_sti_driver = { | |
1027 | .name = "sti", | |
1028 | .id_table = sti_pa_tbl, | |
1029 | .probe = sticore_pa_init, | |
1030 | }; | |
1031 | ||
1032 | ||
1033 | /* | |
1034 | * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[] | |
1035 | */ | |
1036 | ||
cb6fc18e | 1037 | static int sticore_initialized __read_mostly; |
1da177e4 | 1038 | |
48a7d5c6 | 1039 | static void __devinit sti_init_roms(void) |
1da177e4 LT |
1040 | { |
1041 | if (sticore_initialized) | |
1042 | return; | |
1043 | ||
1044 | sticore_initialized = 1; | |
1045 | ||
1046 | printk(KERN_INFO "STI GSC/PCI core graphics driver " | |
1047 | STI_DRIVERVERSION "\n"); | |
1048 | ||
1049 | /* Register drivers for native & PCI cards */ | |
1050 | register_parisc_driver(&pa_sti_driver); | |
1051 | pci_register_driver(&pci_sti_driver); | |
1052 | ||
1053 | /* if we didn't find the given default sti, take the first one */ | |
1054 | if (!default_sti) | |
1055 | default_sti = sti_roms[0]; | |
1056 | ||
1057 | } | |
1058 | ||
1059 | /* | |
1060 | * index = 0 gives default sti | |
1061 | * index > 0 gives other stis in detection order | |
1062 | */ | |
1063 | struct sti_struct * sti_get_rom(unsigned int index) | |
1064 | { | |
1065 | if (!sticore_initialized) | |
1066 | sti_init_roms(); | |
1067 | ||
1068 | if (index == 0) | |
1069 | return default_sti; | |
1070 | ||
1071 | if (index > num_sti_roms) | |
1072 | return NULL; | |
1073 | ||
1074 | return sti_roms[index-1]; | |
1075 | } | |
1076 | EXPORT_SYMBOL(sti_get_rom); | |
1077 | ||
1078 | MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); | |
1079 | MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); | |
1080 | MODULE_LICENSE("GPL v2"); | |
1081 |