Lines Matching full:sti
4 * core code for console driver using HP's STI firmware
11 * - call STI in virtual mode rather than in real mode
12 * - screen blanking with state_mgmt() in text mode STI ?
40 /* number of STI ROMS found and their ptrs to each struct */
45 /* The colour indices used by STI are
63 #define c_fg(sti, c) col_trans[((c>> 8) & 7)] argument
64 #define c_bg(sti, c) col_trans[((c>>11) & 7)] argument
65 #define c_index(sti, c) ((c) & 0xff) argument
77 static int sti_init_graph(struct sti_struct *sti) in sti_init_graph() argument
79 struct sti_init_inptr *inptr = &sti->sti_data->init_inptr; in sti_init_graph()
80 struct sti_init_inptr_ext *inptr_ext = &sti->sti_data->init_inptr_ext; in sti_init_graph()
81 struct sti_init_outptr *outptr = &sti->sti_data->init_outptr; in sti_init_graph()
85 spin_lock_irqsave(&sti->lock, flags); in sti_init_graph()
88 inptr->text_planes = 3; /* # of text planes (max 3 for STI) */ in sti_init_graph()
93 ret = sti_call(sti, sti->init_graph, &default_init_flags, inptr, in sti_init_graph()
94 outptr, sti->glob_cfg); in sti_init_graph()
97 sti->text_planes = outptr->text_planes; in sti_init_graph()
100 spin_unlock_irqrestore(&sti->lock, flags); in sti_init_graph()
103 pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err); in sti_init_graph()
114 static void sti_inq_conf(struct sti_struct *sti) in sti_inq_conf() argument
116 struct sti_conf_inptr *inptr = &sti->sti_data->inq_inptr; in sti_inq_conf()
117 struct sti_conf_outptr *outptr = &sti->sti_data->inq_outptr; in sti_inq_conf()
121 outptr->ext_ptr = STI_PTR(&sti->sti_data->inq_outptr_ext); in sti_inq_conf()
124 spin_lock_irqsave(&sti->lock, flags); in sti_inq_conf()
126 ret = sti_call(sti, sti->inq_conf, &default_conf_flags, in sti_inq_conf()
127 inptr, outptr, sti->glob_cfg); in sti_inq_conf()
128 spin_unlock_irqrestore(&sti->lock, flags); in sti_inq_conf()
138 sti_putc(struct sti_struct *sti, int c, int y, int x, in sti_putc() argument
141 struct sti_font_inptr *inptr = &sti->sti_data->font_inptr; in sti_putc()
144 .index = c_index(sti, c), in sti_putc()
145 .fg_color = c_fg(sti, c), in sti_putc()
146 .bg_color = c_bg(sti, c), in sti_putc()
150 struct sti_font_outptr *outptr = &sti->sti_data->font_outptr; in sti_putc()
155 spin_lock_irqsave(&sti->lock, flags); in sti_putc()
157 ret = sti_call(sti, sti->font_unpmv, &default_font_flags, in sti_putc()
158 inptr, outptr, sti->glob_cfg); in sti_putc()
159 spin_unlock_irqrestore(&sti->lock, flags); in sti_putc()
170 sti_set(struct sti_struct *sti, int src_y, int src_x, in sti_set() argument
173 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; in sti_set()
184 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_set()
189 spin_lock_irqsave(&sti->lock, flags); in sti_set()
191 ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, in sti_set()
192 inptr, outptr, sti->glob_cfg); in sti_set()
193 spin_unlock_irqrestore(&sti->lock, flags); in sti_set()
198 sti_clear(struct sti_struct *sti, int src_y, int src_x, in sti_clear() argument
201 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; in sti_clear()
203 .fg_color = c_fg(sti, c), in sti_clear()
204 .bg_color = c_bg(sti, c), in sti_clear()
212 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_clear()
217 spin_lock_irqsave(&sti->lock, flags); in sti_clear()
219 ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, in sti_clear()
220 inptr, outptr, sti->glob_cfg); in sti_clear()
221 spin_unlock_irqrestore(&sti->lock, flags); in sti_clear()
230 sti_bmove(struct sti_struct *sti, int src_y, int src_x, in sti_bmove() argument
234 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; in sti_bmove()
243 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_bmove()
248 spin_lock_irqsave(&sti->lock, flags); in sti_bmove()
250 ret = sti_call(sti, sti->block_move, &default_blkmv_flags, in sti_bmove()
251 inptr, outptr, sti->glob_cfg); in sti_bmove()
252 spin_unlock_irqrestore(&sti->lock, flags); in sti_bmove()
297 /* Assuming the machine has multiple STI consoles (=graphic cards) which
299 * parameter sti=<x> which of them will be the initial boot-console.
301 * STI screen.
303 __setup("sti=", sti_setup);
320 * the first HP STI ROM built-in font.. in sti_font_setup()
348 * most STI ROMs have built-in HP specific fonts, which can be selected
350 * NOTE: This number is machine and STI ROM dependend.
400 static void sti_dump_outptr(struct sti_struct *sti) in sti_dump_outptr() argument
406 sti->sti_data->inq_outptr.bits_per_pixel, in sti_dump_outptr()
407 sti->sti_data->inq_outptr.bits_used, in sti_dump_outptr()
408 sti->sti_data->inq_outptr.planes, in sti_dump_outptr()
409 sti->sti_data->inq_outptr.attributes); in sti_dump_outptr()
412 static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, in sti_init_glob_cfg() argument
421 if (sti->sti_mem_request < 256) in sti_init_glob_cfg()
422 sti->sti_mem_request = 256; /* STI default */ in sti_init_glob_cfg()
424 size = sizeof(struct sti_all_data) + sti->sti_mem_request - 256; in sti_init_glob_cfg()
426 sti->sti_data = kzalloc(size, STI_LOWMEM); in sti_init_glob_cfg()
427 if (!sti->sti_data) in sti_init_glob_cfg()
430 glob_cfg = &sti->sti_data->glob_cfg; in sti_init_glob_cfg()
431 glob_cfg_ext = &sti->sti_data->glob_cfg_ext; in sti_init_glob_cfg()
432 save_addr = &sti->sti_data->save_addr; in sti_init_glob_cfg()
433 sti_mem_addr = &sti->sti_data->sti_mem_addr; in sti_init_glob_cfg()
440 if (sti->pd) { in sti_init_glob_cfg()
441 unsigned char offs = sti->rm_entry[i]; in sti_init_glob_cfg()
448 pr_warn("STI pci region mapping for region %d (%02x) can't be mapped\n", in sti_init_glob_cfg()
449 i,sti->rm_entry[i]); in sti_init_glob_cfg()
452 newhpa = pci_resource_start (sti->pd, (offs - PCI_BASE_ADDRESS_0) / 4); in sti_init_glob_cfg()
456 sti->regions_phys[i] = in sti_init_glob_cfg()
457 REGION_OFFSET_TO_PHYS(sti->regions[i], newhpa); in sti_init_glob_cfg()
459 len = sti->regions[i].region_desc.length * 4096; in sti_init_glob_cfg()
461 glob_cfg->region_ptrs[i] = sti->regions_phys[i]; in sti_init_glob_cfg()
465 i, sti->regions_phys[i], glob_cfg->region_ptrs[i], in sti_init_glob_cfg()
467 sti->regions[i].region_desc.btlb, in sti_init_glob_cfg()
468 sti->regions[i].region_desc.sys_only, in sti_init_glob_cfg()
469 sti->regions[i].region_desc.cache, in sti_init_glob_cfg()
470 sti->regions[i].region_desc.last); in sti_init_glob_cfg()
473 if (sti->regions[i].region_desc.last) in sti_init_glob_cfg()
477 if (++i<8 && sti->regions[i].region) in sti_init_glob_cfg()
479 sti->regions[i].region); in sti_init_glob_cfg()
483 sti->glob_cfg = glob_cfg; in sti_init_glob_cfg()
505 pr_info("STI selected %ux%u framebuffer font %s for sticon\n", in sti_select_fbfont()
592 static void sti_dump_rom(struct sti_struct *sti) in sti_dump_rom() argument
594 struct sti_rom *rom = sti->rom->raw; in sti_dump_rom()
611 font_start = sti->rom->font_start; in sti_dump_rom()
660 void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f) in sti_font_convert_bytemode() argument
666 if (sti->wordmode) in sti_font_convert_bytemode()
751 static int sti_read_rom(int wordmode, struct sti_struct *sti, in sti_read_rom() argument
771 pr_warn("No font found for STI at %08lx\n", address); in sti_read_rom()
776 memcpy(sti->regions, ((void *)raw)+raw->region_list, sizeof(sti->regions)); in sti_read_rom()
780 pr_info("STI %s ROM supports 32 %sbit firmware functions.\n", in sti_read_rom()
785 sti->font_unpmv = address + (raw->font_unpmv & 0x03ffffff); in sti_read_rom()
786 sti->block_move = address + (raw->block_move & 0x03ffffff); in sti_read_rom()
787 sti->init_graph = address + (raw->init_graph & 0x03ffffff); in sti_read_rom()
788 sti->inq_conf = address + (raw->inq_conf & 0x03ffffff); in sti_read_rom()
790 sti->rom = cooked; in sti_read_rom()
791 sti->rom->raw = raw; in sti_read_rom()
792 sti_dump_rom(sti); in sti_read_rom()
794 sti->wordmode = wordmode; in sti_read_rom()
795 sti->font = sti_select_font(sti->rom); in sti_read_rom()
796 sti->font->width = sti->font->raw->width; in sti_read_rom()
797 sti->font->height = sti->font->raw->height; in sti_read_rom()
798 sti_font_convert_bytemode(sti, sti->font); in sti_read_rom()
800 sti->sti_mem_request = raw->sti_mem_req; in sti_read_rom()
801 sti->graphics_id[0] = raw->graphics_id[0]; in sti_read_rom()
802 sti->graphics_id[1] = raw->graphics_id[1]; in sti_read_rom()
805 if (wordmode || sti->graphics_id[1] != 0x09A02587) in sti_read_rom()
810 switch (sti->graphics_id[0]) { in sti_read_rom()
828 pr_warn("Sorry, this GSC/STI card is not yet supported.\n"); in sti_read_rom()
842 struct sti_struct *sti; in sti_try_rom_generic() local
847 pr_warn("maximum number of STI ROMS reached !\n"); in sti_try_rom_generic()
851 sti = kzalloc(sizeof(*sti), GFP_KERNEL); in sti_try_rom_generic()
852 if (!sti) in sti_try_rom_generic()
855 spin_lock_init(&sti->lock); in sti_try_rom_generic()
859 * to read the hpa is okay, for romless sti */ in sti_try_rom_generic()
873 pr_warn("PCI ROM is not a STI ROM type image (0x%8x)\n", i); in sti_try_rom_generic()
877 sti->pd = pd; in sti_try_rom_generic()
885 rm = (u32*) &sti->rm_entry; in sti_try_rom_generic()
893 pr_debug("sig %04x, PCI STI ROM at %08lx\n", sig, address); in sti_try_rom_generic()
902 ok = sti_read_rom(0, sti, address); in sti_try_rom_generic()
908 ok = sti_read_rom(1, sti, address); in sti_try_rom_generic()
914 if (sti_init_glob_cfg(sti, address, hpa)) in sti_try_rom_generic()
917 /* disable STI PCI ROM. ROM and card RAM overlap and in sti_try_rom_generic()
920 if (sti->pd) { in sti_try_rom_generic()
922 rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE); in sti_try_rom_generic()
923 pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE); in sti_try_rom_generic()
924 pr_debug("STI PCI ROM disabled\n"); in sti_try_rom_generic()
927 if (sti_init_graph(sti)) in sti_try_rom_generic()
930 sti_inq_conf(sti); in sti_try_rom_generic()
931 sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request); in sti_try_rom_generic()
932 sti_dump_outptr(sti); in sti_try_rom_generic()
935 sti->sti_data->inq_outptr.dev_name); in sti_try_rom_generic()
937 sti_roms[num_sti_roms] = sti; in sti_try_rom_generic()
940 return sti; in sti_try_rom_generic()
943 kfree(sti); in sti_try_rom_generic()
947 static void sticore_check_for_default_sti(struct sti_struct *sti, char *path) in sticore_check_for_default_sti() argument
950 default_sti = sti; in sticore_check_for_default_sti()
961 struct sti_struct *sti = NULL; in sticore_pa_init() local
965 sti = sti_try_rom_generic(dev->addr[0], hpa, NULL); in sticore_pa_init()
966 if (!sti) in sticore_pa_init()
967 sti = sti_try_rom_generic(hpa, hpa, NULL); in sticore_pa_init()
968 if (!sti) in sticore_pa_init()
969 sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL); in sticore_pa_init()
970 if (!sti) in sticore_pa_init()
974 sticore_check_for_default_sti(sti, pa_path); in sticore_pa_init()
985 struct sti_struct *sti; in sticore_pci_init() local
999 pr_debug("STI PCI ROM enabled at 0x%08lx\n", rom_base); in sticore_pci_init()
1002 pr_info("STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n", in sticore_pci_init()
1005 pr_debug("Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n", in sticore_pci_init()
1008 sti = sti_try_rom_generic(rom_base, fb_base, pd); in sticore_pci_init()
1009 if (sti) { in sticore_pci_init()
1012 sticore_check_for_default_sti(sti, pa_path); in sticore_pci_init()
1015 if (!sti) { in sticore_pci_init()
1016 pr_warn("Unable to handle STI device '%s'\n", pci_name(pd)); in sticore_pci_init()
1042 .name = "sti",
1056 .name = "sti",
1063 * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[]
1075 pr_info("STI GSC/PCI core graphics driver " in sti_init_roms()
1082 /* if we didn't find the given default sti, take the first one */ in sti_init_roms()
1089 * index = 0 gives default sti
1108 int sti_call(const struct sti_struct *sti, unsigned long func, in sti_call() argument
1119 /* Check for overflow when using 32bit STI on 64bit kernel. */ in sti_call()
1131 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");