forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/video/console/sticore.c
....@@ -1,9 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/video/console/sticore.c -
34 * core code for console driver using HP's STI firmware
45 *
56 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
6
- * Copyright (C) 2001-2013 Helge Deller <deller@gmx.de>
7
+ * Copyright (C) 2001-2020 Helge Deller <deller@gmx.de>
78 * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
89 *
910 * TODO:
....@@ -12,6 +13,8 @@
1213 * - try to make it work on m68k hp workstations ;)
1314 *
1415 */
16
+
17
+#define pr_fmt(fmt) "%s: " fmt, KBUILD_MODNAME
1518
1619 #include <linux/module.h>
1720 #include <linux/types.h>
....@@ -27,6 +30,7 @@
2730 #include <asm/pdc.h>
2831 #include <asm/cacheflush.h>
2932 #include <asm/grfioctl.h>
33
+#include <asm/fb.h>
3034
3135 #include "../fbdev/sticore.h"
3236
....@@ -132,16 +136,17 @@
132136 };
133137
134138 void
135
-sti_putc(struct sti_struct *sti, int c, int y, int x)
139
+sti_putc(struct sti_struct *sti, int c, int y, int x,
140
+ struct sti_cooked_font *font)
136141 {
137142 struct sti_font_inptr *inptr = &sti->sti_data->font_inptr;
138143 struct sti_font_inptr inptr_default = {
139
- .font_start_addr= STI_PTR(sti->font->raw),
144
+ .font_start_addr = STI_PTR(font->raw),
140145 .index = c_index(sti, c),
141146 .fg_color = c_fg(sti, c),
142147 .bg_color = c_bg(sti, c),
143
- .dest_x = x * sti->font_width,
144
- .dest_y = y * sti->font_height,
148
+ .dest_x = x * font->width,
149
+ .dest_y = y * font->height,
145150 };
146151 struct sti_font_outptr *outptr = &sti->sti_data->font_outptr;
147152 s32 ret;
....@@ -192,18 +197,18 @@
192197
193198 void
194199 sti_clear(struct sti_struct *sti, int src_y, int src_x,
195
- int height, int width, int c)
200
+ int height, int width, int c, struct sti_cooked_font *font)
196201 {
197202 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr;
198203 struct sti_blkmv_inptr inptr_default = {
199204 .fg_color = c_fg(sti, c),
200205 .bg_color = c_bg(sti, c),
201
- .src_x = src_x * sti->font_width,
202
- .src_y = src_y * sti->font_height,
203
- .dest_x = src_x * sti->font_width,
204
- .dest_y = src_y * sti->font_height,
205
- .width = width * sti->font_width,
206
- .height = height* sti->font_height,
206
+ .src_x = src_x * font->width,
207
+ .src_y = src_y * font->height,
208
+ .dest_x = src_x * font->width,
209
+ .dest_y = src_y * font->height,
210
+ .width = width * font->width,
211
+ .height = height * font->height,
207212 };
208213 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr;
209214 s32 ret;
....@@ -224,16 +229,17 @@
224229
225230 void
226231 sti_bmove(struct sti_struct *sti, int src_y, int src_x,
227
- int dst_y, int dst_x, int height, int width)
232
+ int dst_y, int dst_x, int height, int width,
233
+ struct sti_cooked_font *font)
228234 {
229235 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr;
230236 struct sti_blkmv_inptr inptr_default = {
231
- .src_x = src_x * sti->font_width,
232
- .src_y = src_y * sti->font_height,
233
- .dest_x = dst_x * sti->font_width,
234
- .dest_y = dst_y * sti->font_height,
235
- .width = width * sti->font_width,
236
- .height = height* sti->font_height,
237
+ .src_x = src_x * font->width,
238
+ .src_y = src_y * font->height,
239
+ .dest_x = dst_x * font->width,
240
+ .dest_y = dst_y * font->height,
241
+ .width = width * font->width,
242
+ .height = height * font->height,
237243 };
238244 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr;
239245 s32 ret;
....@@ -300,36 +306,32 @@
300306
301307
302308
303
-static char *font_name[MAX_STI_ROMS];
304
-static int font_index[MAX_STI_ROMS],
305
- font_height[MAX_STI_ROMS],
306
- font_width[MAX_STI_ROMS];
309
+static char *font_name;
310
+static int font_index,
311
+ font_height,
312
+ font_width;
307313 #ifndef MODULE
308314 static int sti_font_setup(char *str)
309315 {
310
- char *x;
311
- int i = 0;
316
+ /*
317
+ * The default font can be selected in various ways.
318
+ * a) sti_font=VGA8x16, sti_font=10x20, sti_font=10*20 selects
319
+ * an built-in Linux framebuffer font.
320
+ * b) sti_font=<index>, where index is (1..x) with 1 selecting
321
+ * the first HP STI ROM built-in font..
322
+ */
312323
313
- /* we accept sti_font=VGA8x16, sti_font=10x20, sti_font=10*20
314
- * or sti_font=7 style command lines. */
324
+ if (*str >= '0' && *str <= '9') {
325
+ char *x;
315326
316
- while (i<MAX_STI_ROMS && str && *str) {
317
- if (*str>='0' && *str<='9') {
318
- if ((x = strchr(str, 'x')) || (x = strchr(str, '*'))) {
319
- font_height[i] = simple_strtoul(str, NULL, 0);
320
- font_width[i] = simple_strtoul(x+1, NULL, 0);
321
- } else {
322
- font_index[i] = simple_strtoul(str, NULL, 0);
323
- }
327
+ if ((x = strchr(str, 'x')) || (x = strchr(str, '*'))) {
328
+ font_height = simple_strtoul(str, NULL, 0);
329
+ font_width = simple_strtoul(x+1, NULL, 0);
324330 } else {
325
- font_name[i] = str; /* fb font name */
331
+ font_index = simple_strtoul(str, NULL, 0);
326332 }
327
-
328
- if ((x = strchr(str, ',')))
329
- *x++ = 0;
330
- str = x;
331
-
332
- i++;
333
+ } else {
334
+ font_name = str; /* fb font name */
333335 }
334336
335337 return 1;
....@@ -343,7 +345,7 @@
343345 * framebuffer font names (e.g. VGA8x16, SUN22x18).
344346 * This is only available if the fonts have been statically compiled
345347 * in with e.g. the CONFIG_FONT_8x16 or CONFIG_FONT_SUN12x22 options.
346
- * - sti_font=<number>
348
+ * - sti_font=<number> (<number> = 1,2,3,...)
347349 * most STI ROMs have built-in HP specific fonts, which can be selected
348350 * by giving the desired number to the sticon driver.
349351 * NOTE: This number is machine and STI ROM dependend.
....@@ -363,8 +365,7 @@
363365 {
364366 struct sti_glob_cfg_ext *cfg;
365367
366
- DPRINTK((KERN_INFO
367
- "%d text planes\n"
368
+ pr_debug("%d text planes\n"
368369 "%4d x %4d screen resolution\n"
369370 "%4d x %4d offscreen\n"
370371 "%4d x %4d layout\n"
....@@ -381,12 +382,11 @@
381382 glob_cfg->region_ptrs[4], glob_cfg->region_ptrs[5],
382383 glob_cfg->region_ptrs[6], glob_cfg->region_ptrs[7],
383384 glob_cfg->reent_lvl,
384
- glob_cfg->save_addr));
385
+ glob_cfg->save_addr);
385386
386387 /* dump extended cfg */
387388 cfg = PTR_STI((unsigned long)glob_cfg->ext_ptr);
388
- DPRINTK(( KERN_INFO
389
- "monitor %d\n"
389
+ pr_debug("monitor %d\n"
390390 "in friendly mode: %d\n"
391391 "power consumption %d watts\n"
392392 "freq ref %d\n"
....@@ -395,20 +395,19 @@
395395 cfg->friendly_boot,
396396 cfg->power,
397397 cfg->freq_ref,
398
- cfg->sti_mem_addr, sti_mem_request));
398
+ cfg->sti_mem_addr, sti_mem_request);
399399 }
400400
401401 static void sti_dump_outptr(struct sti_struct *sti)
402402 {
403
- DPRINTK((KERN_INFO
404
- "%d bits per pixel\n"
403
+ pr_debug("%d bits per pixel\n"
405404 "%d used bits\n"
406405 "%d planes\n"
407406 "attributes %08x\n",
408407 sti->sti_data->inq_outptr.bits_per_pixel,
409408 sti->sti_data->inq_outptr.bits_used,
410409 sti->sti_data->inq_outptr.planes,
411
- sti->sti_data->inq_outptr.attributes));
410
+ sti->sti_data->inq_outptr.attributes);
412411 }
413412
414413 static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address,
....@@ -447,8 +446,7 @@
447446 if (offs != PCI_ROM_ADDRESS &&
448447 (offs < PCI_BASE_ADDRESS_0 ||
449448 offs > PCI_BASE_ADDRESS_5)) {
450
- printk (KERN_WARNING
451
- "STI pci region mapping for region %d (%02x) can't be mapped\n",
449
+ pr_warn("STI pci region mapping for region %d (%02x) can't be mapped\n",
452450 i,sti->rm_entry[i]);
453451 continue;
454452 }
....@@ -463,14 +461,14 @@
463461 if (len)
464462 glob_cfg->region_ptrs[i] = sti->regions_phys[i];
465463
466
- DPRINTK(("region #%d: phys %08lx, region_ptr %08x, len=%lukB, "
464
+ pr_debug("region #%d: phys %08lx, region_ptr %08x, len=%lukB, "
467465 "btlb=%d, sysonly=%d, cache=%d, last=%d\n",
468466 i, sti->regions_phys[i], glob_cfg->region_ptrs[i],
469467 len/1024,
470468 sti->regions[i].region_desc.btlb,
471469 sti->regions[i].region_desc.sys_only,
472470 sti->regions[i].region_desc.cache,
473
- sti->regions[i].region_desc.last));
471
+ sti->regions[i].region_desc.last);
474472
475473 /* last entry reached ? */
476474 if (sti->regions[i].region_desc.last)
....@@ -478,8 +476,8 @@
478476 }
479477
480478 if (++i<8 && sti->regions[i].region)
481
- printk(KERN_WARNING "%s: *future ptr (0x%8x) not yet supported !\n",
482
- __FILE__, sti->regions[i].region);
479
+ pr_warn("future ptr (0x%8x) not yet supported !\n",
480
+ sti->regions[i].region);
483481
484482 glob_cfg_ext->sti_mem_addr = STI_PTR(sti_mem_addr);
485483
....@@ -537,6 +535,7 @@
537535 }
538536
539537 cooked_font->raw = nf;
538
+ cooked_font->raw_ptr = nf;
540539 cooked_font->next_font = NULL;
541540
542541 cooked_rom->font_start = cooked_font;
....@@ -551,24 +550,38 @@
551550 }
552551 #endif
553552
554
-static struct sti_cooked_font *sti_select_font(struct sti_cooked_rom *rom,
555
- int (*search_font_fnc)(struct sti_cooked_rom *, int, int))
553
+static int sti_search_font(struct sti_cooked_rom *rom, int height, int width)
554
+{
555
+ struct sti_cooked_font *font;
556
+ int i = 0;
557
+
558
+ for (font = rom->font_start; font; font = font->next_font, i++) {
559
+ if ((font->raw->width == width) &&
560
+ (font->raw->height == height))
561
+ return i;
562
+ }
563
+ return 0;
564
+}
565
+
566
+static struct sti_cooked_font *sti_select_font(struct sti_cooked_rom *rom)
556567 {
557568 struct sti_cooked_font *font;
558569 int i;
559
- int index = num_sti_roms;
560570
561571 /* check for framebuffer-font first */
562
- if ((font = sti_select_fbfont(rom, font_name[index])))
563
- return font;
572
+ if (!font_index) {
573
+ font = sti_select_fbfont(rom, font_name);
574
+ if (font)
575
+ return font;
576
+ }
564577
565
- if (font_width[index] && font_height[index])
566
- font_index[index] = search_font_fnc(rom,
567
- font_height[index], font_width[index]);
578
+ if (font_width && font_height)
579
+ font_index = sti_search_font(rom,
580
+ font_height, font_width);
568581
569
- for (font = rom->font_start, i = font_index[index];
570
- font && (i > 0);
571
- font = font->next_font, i--);
582
+ for (font = rom->font_start, i = font_index - 1;
583
+ font && (i > 0);
584
+ font = font->next_font, i--);
572585
573586 if (font)
574587 return font;
....@@ -577,20 +590,35 @@
577590 }
578591
579592
580
-static void sti_dump_rom(struct sti_rom *rom)
593
+static void sti_dump_rom(struct sti_struct *sti)
581594 {
582
- printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n",
595
+ struct sti_rom *rom = sti->rom->raw;
596
+ struct sti_cooked_font *font_start;
597
+ int nr;
598
+
599
+ pr_info(" id %04x-%04x, conforms to spec rev. %d.%02x\n",
583600 rom->graphics_id[0],
584601 rom->graphics_id[1],
585602 rom->revno[0] >> 4,
586603 rom->revno[0] & 0x0f);
587
- DPRINTK((" supports %d monitors\n", rom->num_mons));
588
- DPRINTK((" font start %08x\n", rom->font_start));
589
- DPRINTK((" region list %08x\n", rom->region_list));
590
- DPRINTK((" init_graph %08x\n", rom->init_graph));
591
- DPRINTK((" bus support %02x\n", rom->bus_support));
592
- DPRINTK((" ext bus support %02x\n", rom->ext_bus_support));
593
- DPRINTK((" alternate code type %d\n", rom->alt_code_type));
604
+ pr_debug(" supports %d monitors\n", rom->num_mons);
605
+ pr_debug(" font start %08x\n", rom->font_start);
606
+ pr_debug(" region list %08x\n", rom->region_list);
607
+ pr_debug(" init_graph %08x\n", rom->init_graph);
608
+ pr_debug(" bus support %02x\n", rom->bus_support);
609
+ pr_debug(" ext bus support %02x\n", rom->ext_bus_support);
610
+ pr_debug(" alternate code type %d\n", rom->alt_code_type);
611
+
612
+ font_start = sti->rom->font_start;
613
+ nr = 0;
614
+ while (font_start) {
615
+ struct sti_rom_font *f = font_start->raw;
616
+
617
+ pr_info(" built-in font #%d: size %dx%d, chars %d-%d, bpc %d\n", ++nr,
618
+ f->width, f->height,
619
+ f->first_char, f->last_char, f->bytes_per_char);
620
+ font_start = font_start->next_font;
621
+ }
594622 }
595623
596624
....@@ -627,39 +655,34 @@
627655 return 1;
628656 }
629657
630
-
631
-static int sti_search_font(struct sti_cooked_rom *rom, int height, int width)
632
-{
633
- struct sti_cooked_font *font;
634
- int i = 0;
635
-
636
- for (font = rom->font_start; font; font = font->next_font, i++) {
637
- if ((font->raw->width == width) &&
638
- (font->raw->height == height))
639
- return i;
640
- }
641
- return 0;
642
-}
643
-
644658 #define BMODE_RELOCATE(offset) offset = (offset) / 4;
645659 #define BMODE_LAST_ADDR_OFFS 0x50
646660
647
-static void *sti_bmode_font_raw(struct sti_cooked_font *f)
661
+void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f)
648662 {
649663 unsigned char *n, *p, *q;
650
- int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
651
-
664
+ int size = f->raw->bytes_per_char * 256 + sizeof(struct sti_rom_font);
665
+ struct sti_rom_font *old_font;
666
+
667
+ if (sti->wordmode)
668
+ return;
669
+
670
+ old_font = f->raw_ptr;
652671 n = kcalloc(4, size, STI_LOWMEM);
672
+ f->raw_ptr = n;
653673 if (!n)
654
- return NULL;
674
+ return;
655675 p = n + 3;
656
- q = (unsigned char *)f->raw;
676
+ q = (unsigned char *) f->raw;
657677 while (size--) {
658678 *p = *q++;
659
- p+=4;
679
+ p += 4;
660680 }
661
- return n + 3;
681
+ /* store new ptr to byte-mode font and delete old font */
682
+ f->raw = (struct sti_rom_font *) (n + 3);
683
+ kfree(old_font);
662684 }
685
+EXPORT_SYMBOL(sti_font_convert_bytemode);
663686
664687 static void sti_bmode_rom_copy(unsigned long base, unsigned long count,
665688 void *dest)
....@@ -746,7 +769,7 @@
746769 goto out_err;
747770
748771 if (!sti_cook_fonts(cooked, raw)) {
749
- printk(KERN_ERR "No font found for STI at %08lx\n", address);
772
+ pr_warn("No font found for STI at %08lx\n", address);
750773 goto out_err;
751774 }
752775
....@@ -755,7 +778,8 @@
755778
756779 address = (unsigned long) STI_PTR(raw);
757780
758
- pr_info("STI ROM supports 32 %sbit firmware functions.\n",
781
+ pr_info("STI %s ROM supports 32 %sbit firmware functions.\n",
782
+ wordmode ? "word mode" : "byte mode",
759783 raw->alt_code_type == ALT_CODE_TYPE_PA_RISC_64
760784 ? "and 64 " : "");
761785
....@@ -766,18 +790,17 @@
766790
767791 sti->rom = cooked;
768792 sti->rom->raw = raw;
769
-
770
- sti->font = sti_select_font(sti->rom, sti_search_font);
771
- sti->font_width = sti->font->raw->width;
772
- sti->font_height = sti->font->raw->height;
773
- if (!wordmode)
774
- sti->font->raw = sti_bmode_font_raw(sti->font);
793
+ sti_dump_rom(sti);
794
+
795
+ sti->wordmode = wordmode;
796
+ sti->font = sti_select_font(sti->rom);
797
+ sti->font->width = sti->font->raw->width;
798
+ sti->font->height = sti->font->raw->height;
799
+ sti_font_convert_bytemode(sti, sti->font);
775800
776801 sti->sti_mem_request = raw->sti_mem_req;
777802 sti->graphics_id[0] = raw->graphics_id[0];
778803 sti->graphics_id[1] = raw->graphics_id[1];
779
-
780
- sti_dump_rom(raw);
781804
782805 /* check if the ROM routines in this card are compatible */
783806 if (wordmode || sti->graphics_id[1] != 0x09A02587)
....@@ -803,9 +826,9 @@
803826 return 1;
804827
805828 msg_not_supported:
806
- printk(KERN_ERR "Sorry, this GSC/STI card is not yet supported.\n");
807
- printk(KERN_ERR "Please see http://parisc-linux.org/faq/"
808
- "graphics-howto.html for more info.\n");
829
+ pr_warn("Sorry, this GSC/STI card is not yet supported.\n");
830
+ pr_warn("Please see https://parisc.wiki.kernel.org/"
831
+ "index.php/Graphics_howto for more info.\n");
809832 /* fall through */
810833 out_err:
811834 kfree(raw);
....@@ -822,7 +845,7 @@
822845 u32 sig;
823846
824847 if (num_sti_roms >= MAX_STI_ROMS) {
825
- printk(KERN_WARNING "maximum number of STI ROMS reached !\n");
848
+ pr_warn("maximum number of STI ROMS reached !\n");
826849 return NULL;
827850 }
828851
....@@ -848,16 +871,15 @@
848871 if (i != 1) {
849872 /* The ROM could have multiple architecture
850873 * dependent images (e.g. i386, parisc,...) */
851
- printk(KERN_WARNING
852
- "PCI ROM is not a STI ROM type image (0x%8x)\n", i);
874
+ pr_warn("PCI ROM is not a STI ROM type image (0x%8x)\n", i);
853875 goto out_err;
854876 }
855877
856878 sti->pd = pd;
857879
858880 i = gsc_readl(address+0x0c);
859
- DPRINTK(("PCI ROM size (from header) = %d kB\n",
860
- le16_to_cpu(i>>16)*512/1024));
881
+ pr_debug("PCI ROM size (from header) = %d kB\n",
882
+ le16_to_cpu(i>>16)*512/1024);
861883 rm_offset = le16_to_cpu(i & 0xffff);
862884 if (rm_offset) {
863885 /* read 16 bytes from the pci region mapper array */
....@@ -866,29 +888,24 @@
866888 *rm++ = gsc_readl(address+rm_offset+0x04);
867889 *rm++ = gsc_readl(address+rm_offset+0x08);
868890 *rm++ = gsc_readl(address+rm_offset+0x0c);
869
- DPRINTK(("PCI region Mapper offset = %08x: ",
870
- rm_offset));
871
- for (i=0; i<16; i++)
872
- DPRINTK(("%02x ", sti->rm_entry[i]));
873
- DPRINTK(("\n"));
874891 }
875892
876893 address += le32_to_cpu(gsc_readl(address+8));
877
- DPRINTK(("sig %04x, PCI STI ROM at %08lx\n", sig, address));
894
+ pr_debug("sig %04x, PCI STI ROM at %08lx\n", sig, address);
878895 goto test_rom;
879896 }
880897
881898 ok = 0;
882899
883900 if ((sig & 0xff) == 0x01) {
884
- DPRINTK((" byte mode ROM at %08lx, hpa at %08lx\n",
885
- address, hpa));
901
+ pr_debug(" byte mode ROM at %08lx, hpa at %08lx\n",
902
+ address, hpa);
886903 ok = sti_read_rom(0, sti, address);
887904 }
888905
889906 if ((sig & 0xffff) == 0x0303) {
890
- DPRINTK((" word mode ROM at %08lx, hpa at %08lx\n",
891
- address, hpa));
907
+ pr_debug(" word mode ROM at %08lx, hpa at %08lx\n",
908
+ address, hpa);
892909 ok = sti_read_rom(1, sti, address);
893910 }
894911
....@@ -905,7 +922,7 @@
905922 unsigned long rom_base;
906923 rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE);
907924 pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE);
908
- DPRINTK((KERN_DEBUG "STI PCI ROM disabled\n"));
925
+ pr_debug("STI PCI ROM disabled\n");
909926 }
910927
911928 if (sti_init_graph(sti))
....@@ -980,14 +997,14 @@
980997 rom_len = pci_resource_len(pd, PCI_ROM_RESOURCE);
981998 if (rom_base) {
982999 pci_write_config_dword(pd, PCI_ROM_ADDRESS, rom_base | PCI_ROM_ADDRESS_ENABLE);
983
- DPRINTK((KERN_DEBUG "STI PCI ROM enabled at 0x%08lx\n", rom_base));
1000
+ pr_debug("STI PCI ROM enabled at 0x%08lx\n", rom_base);
9841001 }
9851002
986
- printk(KERN_INFO "STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n",
1003
+ pr_info("STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n",
9871004 rom_base, rom_len/1024, fb_base, fb_len/1024/1024);
9881005
989
- DPRINTK((KERN_DEBUG "Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n",
990
- rom_base, fb_base));
1006
+ pr_debug("Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n",
1007
+ rom_base, fb_base);
9911008
9921009 sti = sti_try_rom_generic(rom_base, fb_base, pd);
9931010 if (sti) {
....@@ -997,8 +1014,7 @@
9971014 }
9981015
9991016 if (!sti) {
1000
- printk(KERN_WARNING "Unable to handle STI device '%s'\n",
1001
- pci_name(pd));
1017
+ pr_warn("Unable to handle STI device '%s'\n", pci_name(pd));
10021018 return -ENODEV;
10031019 }
10041020 #endif /* CONFIG_PCI */
....@@ -1057,7 +1073,7 @@
10571073
10581074 sticore_initialized = 1;
10591075
1060
- printk(KERN_INFO "STI GSC/PCI core graphics driver "
1076
+ pr_info("STI GSC/PCI core graphics driver "
10611077 STI_DRIVERVERSION "\n");
10621078
10631079 /* Register drivers for native & PCI cards */
....@@ -1112,6 +1128,24 @@
11121128 return ret;
11131129 }
11141130
1131
+#if defined(CONFIG_FB_STI)
1132
+/* check if given fb_info is the primary device */
1133
+int fb_is_primary_device(struct fb_info *info)
1134
+{
1135
+ struct sti_struct *sti;
1136
+
1137
+ sti = sti_get_rom(0);
1138
+
1139
+ /* if no built-in graphics card found, allow any fb driver as default */
1140
+ if (!sti)
1141
+ return true;
1142
+
1143
+ /* return true if it's the default built-in framebuffer driver */
1144
+ return (sti->info == info);
1145
+}
1146
+EXPORT_SYMBOL(fb_is_primary_device);
1147
+#endif
1148
+
11151149 MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
11161150 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
11171151 MODULE_LICENSE("GPL v2");