aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/console
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@parisc-linux.org>2005-10-21 22:41:49 -0400
committerKyle McMartin <kyle@parisc-linux.org>2005-10-21 22:41:49 -0400
commit951a0150135c46c7791d68e0d1112900d99302d7 (patch)
tree19ca9f01cc7159814f3db9566061be3afeb3033e /drivers/video/console
parent14e256c107304367eff401d20f2ab9fa72e33136 (diff)
[PARISC] Reorganize sticore probe routine to be a little less convoluted
Fix some whitespace issues Reorganise parisc_device probe routine to be a little less convoluted Use ->hpa.start instead of ->hpa Signed-off-by: Matthew Wilcox <willy@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r--drivers/video/console/sticore.c126
1 files changed, 60 insertions, 66 deletions
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index d940f605acb6..a7bcd17112c0 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -511,12 +511,12 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
511 struct sti_cooked_font *cooked_font; 511 struct sti_cooked_font *cooked_font;
512 512
513 if (!fbfont_name || !strlen(fbfont_name)) 513 if (!fbfont_name || !strlen(fbfont_name))
514 return NULL; 514 return NULL;
515 fbfont = find_font(fbfont_name); 515 fbfont = find_font(fbfont_name);
516 if (!fbfont) 516 if (!fbfont)
517 fbfont = get_default_font(1024,768); 517 fbfont = get_default_font(1024,768);
518 if (!fbfont) 518 if (!fbfont)
519 return NULL; 519 return NULL;
520 520
521 DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n", 521 DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n",
522 fbfont->width, fbfont->height, fbfont->name)); 522 fbfont->width, fbfont->height, fbfont->name));
@@ -527,7 +527,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
527 527
528 nf = kmalloc(size, GFP_KERNEL); 528 nf = kmalloc(size, GFP_KERNEL);
529 if (!nf) 529 if (!nf)
530 return NULL; 530 return NULL;
531 memset(nf, 0, size); 531 memset(nf, 0, size);
532 532
533 nf->first_char = 0; 533 nf->first_char = 0;
@@ -546,8 +546,8 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
546 546
547 cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); 547 cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL);
548 if (!cooked_font) { 548 if (!cooked_font) {
549 kfree(nf); 549 kfree(nf);
550 return NULL; 550 return NULL;
551 } 551 }
552 552
553 cooked_font->raw = nf; 553 cooked_font->raw = nf;
@@ -595,7 +595,7 @@ sti_select_font(struct sti_cooked_rom *rom,
595static void __init 595static void __init
596sti_dump_rom(struct sti_rom *rom) 596sti_dump_rom(struct sti_rom *rom)
597{ 597{
598 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n", 598 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n",
599 rom->graphics_id[0], 599 rom->graphics_id[0],
600 rom->graphics_id[1], 600 rom->graphics_id[1],
601 rom->revno[0] >> 4, 601 rom->revno[0] >> 4,
@@ -651,15 +651,16 @@ sti_search_font(struct sti_cooked_rom *rom, int height, int width)
651 struct sti_cooked_font *font; 651 struct sti_cooked_font *font;
652 int i = 0; 652 int i = 0;
653 653
654 for(font = rom->font_start; font; font = font->next_font, i++) { 654 for (font = rom->font_start; font; font = font->next_font, i++) {
655 if((font->raw->width == width) && (font->raw->height == height)) 655 if ((font->raw->width == width) &&
656 (font->raw->height == height))
656 return i; 657 return i;
657 } 658 }
658 return 0; 659 return 0;
659} 660}
660 661
661#define BMODE_RELOCATE(offset) offset = (offset) / 4; 662#define BMODE_RELOCATE(offset) offset = (offset) / 4;
662#define BMODE_LAST_ADDR_OFFS 0x50 663#define BMODE_LAST_ADDR_OFFS 0x50
663 664
664static void * __init 665static void * __init
665sti_bmode_font_raw(struct sti_cooked_font *f) 666sti_bmode_font_raw(struct sti_cooked_font *f)
@@ -700,35 +701,35 @@ sti_get_bmode_rom (unsigned long address)
700{ 701{
701 struct sti_rom *raw; 702 struct sti_rom *raw;
702 u32 size; 703 u32 size;
703 struct sti_rom_font *raw_font, *font_start; 704 struct sti_rom_font *raw_font, *font_start;
704 705
705 sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size); 706 sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size);
706 707
707 size = (size+3) / 4; 708 size = (size+3) / 4;
708 raw = kmalloc(size, GFP_KERNEL); 709 raw = kmalloc(size, GFP_KERNEL);
709 if (raw) { 710 if (raw) {
710 sti_bmode_rom_copy(address, size, raw); 711 sti_bmode_rom_copy(address, size, raw);
711 memmove (&raw->res004, &raw->type[0], 0x3c); 712 memmove (&raw->res004, &raw->type[0], 0x3c);
712 raw->type[3] = raw->res004; 713 raw->type[3] = raw->res004;
713 714
714 BMODE_RELOCATE (raw->region_list); 715 BMODE_RELOCATE (raw->region_list);
715 BMODE_RELOCATE (raw->font_start); 716 BMODE_RELOCATE (raw->font_start);
716 717
717 BMODE_RELOCATE (raw->init_graph); 718 BMODE_RELOCATE (raw->init_graph);
718 BMODE_RELOCATE (raw->state_mgmt); 719 BMODE_RELOCATE (raw->state_mgmt);
719 BMODE_RELOCATE (raw->font_unpmv); 720 BMODE_RELOCATE (raw->font_unpmv);
720 BMODE_RELOCATE (raw->block_move); 721 BMODE_RELOCATE (raw->block_move);
721 BMODE_RELOCATE (raw->inq_conf); 722 BMODE_RELOCATE (raw->inq_conf);
722 723
723 raw_font = ((void *)raw) + raw->font_start; 724 raw_font = ((void *)raw) + raw->font_start;
724 font_start = raw_font; 725 font_start = raw_font;
725 726
726 while (raw_font->next_font) { 727 while (raw_font->next_font) {
727 BMODE_RELOCATE (raw_font->next_font); 728 BMODE_RELOCATE (raw_font->next_font);
728 raw_font = ((void *)font_start) + raw_font->next_font; 729 raw_font = ((void *)font_start) + raw_font->next_font;
729 } 730 }
730 } 731 }
731 return raw; 732 return raw;
732} 733}
733 734
734struct sti_rom * __init 735struct sti_rom * __init
@@ -736,15 +737,15 @@ sti_get_wmode_rom (unsigned long address)
736{ 737{
737 struct sti_rom *raw; 738 struct sti_rom *raw;
738 unsigned long size; 739 unsigned long size;
739 740
740 /* read the ROM size directly from the struct in ROM */ 741 /* read the ROM size directly from the struct in ROM */
741 size = gsc_readl(address + offsetof(struct sti_rom,last_addr)); 742 size = gsc_readl(address + offsetof(struct sti_rom,last_addr));
742 743
743 raw = kmalloc(size, GFP_KERNEL); 744 raw = kmalloc(size, GFP_KERNEL);
744 if(raw) 745 if (raw)
745 sti_rom_copy(address, size, raw); 746 sti_rom_copy(address, size, raw);
746 747
747 return raw; 748 return raw;
748} 749}
749 750
750int __init 751int __init
@@ -757,14 +758,14 @@ sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address)
757 if (!cooked) 758 if (!cooked)
758 goto out_err; 759 goto out_err;
759 760
760 if (wordmode) 761 if (wordmode)
761 raw = sti_get_wmode_rom (address); 762 raw = sti_get_wmode_rom (address);
762 else 763 else
763 raw = sti_get_bmode_rom (address); 764 raw = sti_get_bmode_rom (address);
765
766 if (!raw)
767 goto out_err;
764 768
765 if (!raw)
766 goto out_err;
767
768 if (!sti_cook_fonts(cooked, raw)) { 769 if (!sti_cook_fonts(cooked, raw)) {
769 printk(KERN_ERR "No font found for STI at %08lx\n", address); 770 printk(KERN_ERR "No font found for STI at %08lx\n", address);
770 goto out_err; 771 goto out_err;
@@ -787,7 +788,7 @@ sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address)
787 sti->font_width = sti->font->raw->width; 788 sti->font_width = sti->font->raw->width;
788 sti->font_height = sti->font->raw->height; 789 sti->font_height = sti->font->raw->height;
789 if (!wordmode) 790 if (!wordmode)
790 sti->font->raw = sti_bmode_font_raw(sti->font); 791 sti->font->raw = sti_bmode_font_raw(sti->font);
791 792
792 sti->sti_mem_request = raw->sti_mem_req; 793 sti->sti_mem_request = raw->sti_mem_req;
793 sti->graphics_id[0] = raw->graphics_id[0]; 794 sti->graphics_id[0] = raw->graphics_id[0];
@@ -811,16 +812,16 @@ sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd
811 u32 sig; 812 u32 sig;
812 813
813 if (num_sti_roms >= MAX_STI_ROMS) { 814 if (num_sti_roms >= MAX_STI_ROMS) {
814 printk(KERN_WARNING "maximum number of STI ROMS reached !\n"); 815 printk(KERN_WARNING "maximum number of STI ROMS reached !\n");
815 return NULL; 816 return NULL;
816 } 817 }
817 818
818 sti = kmalloc(sizeof(*sti), GFP_KERNEL); 819 sti = kmalloc(sizeof(*sti), GFP_KERNEL);
819 if (!sti) { 820 if (!sti) {
820 printk(KERN_ERR "Not enough memory !\n"); 821 printk(KERN_ERR "Not enough memory !\n");
821 return NULL; 822 return NULL;
822 } 823 }
823 824
824 memset(sti, 0, sizeof(*sti)); 825 memset(sti, 0, sizeof(*sti));
825 spin_lock_init(&sti->lock); 826 spin_lock_init(&sti->lock);
826 827
@@ -932,28 +933,21 @@ static void __init sticore_check_for_default_sti(struct sti_struct *sti, char *p
932 */ 933 */
933static int __init sticore_pa_init(struct parisc_device *dev) 934static int __init sticore_pa_init(struct parisc_device *dev)
934{ 935{
935 unsigned long rom = 0;
936 char pa_path[21]; 936 char pa_path[21];
937 struct sti_struct *sti = NULL; 937 struct sti_struct *sti = NULL;
938 938 int hpa = dev->hpa.start;
939 if(dev->num_addrs) { 939
940 rom = dev->addr[0]; 940 if (dev->num_addrs && dev->addr[0])
941 } 941 sti = sti_try_rom_generic(dev->addr[0], hpa, NULL);
942 if (!rom) { 942 if (!sti)
943 rom = dev->hpa; 943 sti = sti_try_rom_generic(hpa, hpa, NULL);
944 DPRINTK((KERN_DEBUG "Trying STI ROM at %08lx, hpa at %08lx\n", rom, dev->hpa)); 944 if (!sti)
945 sti = sti_try_rom_generic(rom, dev->hpa, NULL); 945 sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL);
946 rom = PAGE0->proc_sti;
947 }
948 if (!sti) {
949 DPRINTK((KERN_DEBUG "Trying STI ROM at %08lx, hpa at %08lx\n", rom, dev->hpa));
950 sti = sti_try_rom_generic(rom, dev->hpa, NULL);
951 }
952 if (!sti) 946 if (!sti)
953 return 1; 947 return 1;
954 948
955 print_pa_hwpath(dev, pa_path); 949 print_pa_hwpath(dev, pa_path);
956 sticore_check_for_default_sti (sti, pa_path); 950 sticore_check_for_default_sti(sti, pa_path);
957 return 0; 951 return 0;
958} 952}
959 953