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 ?
41 /* number of STI ROMS found and their ptrs to each struct */
46 /* The colour indices used by STI are
64 #define c_fg(sti, c) col_trans[((c>> 8) & 7)] argument
65 #define c_bg(sti, c) col_trans[((c>>11) & 7)] argument
66 #define c_index(sti, c) ((c) & 0xff) argument
78 static int sti_init_graph(struct sti_struct *sti) in sti_init_graph() argument
80 struct sti_init_inptr *inptr = &sti->sti_data->init_inptr; in sti_init_graph()
81 struct sti_init_inptr_ext *inptr_ext = &sti->sti_data->init_inptr_ext; in sti_init_graph()
82 struct sti_init_outptr *outptr = &sti->sti_data->init_outptr; in sti_init_graph()
86 spin_lock_irqsave(&sti->lock, flags); in sti_init_graph()
89 inptr->text_planes = 3; /* # of text planes (max 3 for STI) */ in sti_init_graph()
94 ret = sti_call(sti, sti->init_graph, &default_init_flags, inptr, in sti_init_graph()
95 outptr, sti->glob_cfg); in sti_init_graph()
98 sti->text_planes = outptr->text_planes; in sti_init_graph()
101 spin_unlock_irqrestore(&sti->lock, flags); in sti_init_graph()
104 pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err); in sti_init_graph()
115 static void sti_inq_conf(struct sti_struct *sti) in sti_inq_conf() argument
117 struct sti_conf_inptr *inptr = &sti->sti_data->inq_inptr; in sti_inq_conf()
118 struct sti_conf_outptr *outptr = &sti->sti_data->inq_outptr; in sti_inq_conf()
122 outptr->ext_ptr = STI_PTR(&sti->sti_data->inq_outptr_ext); in sti_inq_conf()
125 spin_lock_irqsave(&sti->lock, flags); in sti_inq_conf()
127 ret = sti_call(sti, sti->inq_conf, &default_conf_flags, in sti_inq_conf()
128 inptr, outptr, sti->glob_cfg); in sti_inq_conf()
129 spin_unlock_irqrestore(&sti->lock, flags); in sti_inq_conf()
139 sti_putc(struct sti_struct *sti, int c, int y, int x, in sti_putc() argument
142 struct sti_font_inptr *inptr = &sti->sti_data->font_inptr; in sti_putc()
145 .index = c_index(sti, c), in sti_putc()
146 .fg_color = c_fg(sti, c), in sti_putc()
147 .bg_color = c_bg(sti, c), in sti_putc()
151 struct sti_font_outptr *outptr = &sti->sti_data->font_outptr; in sti_putc()
156 spin_lock_irqsave(&sti->lock, flags); in sti_putc()
158 ret = sti_call(sti, sti->font_unpmv, &default_font_flags, in sti_putc()
159 inptr, outptr, sti->glob_cfg); in sti_putc()
160 spin_unlock_irqrestore(&sti->lock, flags); in sti_putc()
171 sti_set(struct sti_struct *sti, int src_y, int src_x, in sti_set() argument
174 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; in sti_set()
185 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_set()
190 spin_lock_irqsave(&sti->lock, flags); in sti_set()
192 ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, in sti_set()
193 inptr, outptr, sti->glob_cfg); in sti_set()
194 spin_unlock_irqrestore(&sti->lock, flags); in sti_set()
199 sti_clear(struct sti_struct *sti, int src_y, int src_x, in sti_clear() argument
202 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; in sti_clear()
204 .fg_color = c_fg(sti, c), in sti_clear()
205 .bg_color = c_bg(sti, c), in sti_clear()
213 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_clear()
218 spin_lock_irqsave(&sti->lock, flags); in sti_clear()
220 ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, in sti_clear()
221 inptr, outptr, sti->glob_cfg); in sti_clear()
222 spin_unlock_irqrestore(&sti->lock, flags); in sti_clear()
231 sti_bmove(struct sti_struct *sti, int src_y, int src_x, in sti_bmove() argument
235 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; in sti_bmove()
244 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_bmove()
249 spin_lock_irqsave(&sti->lock, flags); in sti_bmove()
251 ret = sti_call(sti, sti->block_move, &default_blkmv_flags, in sti_bmove()
252 inptr, outptr, sti->glob_cfg); in sti_bmove()
253 spin_unlock_irqrestore(&sti->lock, flags); in sti_bmove()
298 /* Assuming the machine has multiple STI consoles (=graphic cards) which
300 * parameter sti=<x> which of them will be the initial boot-console.
302 * STI screen.
304 __setup("sti=", sti_setup);
321 * the first HP STI ROM built-in font.. in sti_font_setup()
349 * most STI ROMs have built-in HP specific fonts, which can be selected
351 * NOTE: This number is machine and STI ROM dependend.
401 static void sti_dump_outptr(struct sti_struct *sti) in sti_dump_outptr() argument
407 sti->sti_data->inq_outptr.bits_per_pixel, in sti_dump_outptr()
408 sti->sti_data->inq_outptr.bits_used, in sti_dump_outptr()
409 sti->sti_data->inq_outptr.planes, in sti_dump_outptr()
410 sti->sti_data->inq_outptr.attributes); in sti_dump_outptr()
413 static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, in sti_init_glob_cfg() argument
422 if (sti->sti_mem_request < 256) in sti_init_glob_cfg()
423 sti->sti_mem_request = 256; /* STI default */ in sti_init_glob_cfg()
425 size = sizeof(struct sti_all_data) + sti->sti_mem_request - 256; in sti_init_glob_cfg()
427 sti->sti_data = kzalloc(size, STI_LOWMEM); in sti_init_glob_cfg()
428 if (!sti->sti_data) in sti_init_glob_cfg()
431 glob_cfg = &sti->sti_data->glob_cfg; in sti_init_glob_cfg()
432 glob_cfg_ext = &sti->sti_data->glob_cfg_ext; in sti_init_glob_cfg()
433 save_addr = &sti->sti_data->save_addr; in sti_init_glob_cfg()
434 sti_mem_addr = &sti->sti_data->sti_mem_addr; in sti_init_glob_cfg()
441 if (sti->pd) { in sti_init_glob_cfg()
442 unsigned char offs = sti->rm_entry[i]; in sti_init_glob_cfg()
449 pr_warn("STI pci region mapping for region %d (%02x) can't be mapped\n", in sti_init_glob_cfg()
450 i,sti->rm_entry[i]); in sti_init_glob_cfg()
453 newhpa = pci_resource_start (sti->pd, (offs - PCI_BASE_ADDRESS_0) / 4); in sti_init_glob_cfg()
457 sti->regions_phys[i] = in sti_init_glob_cfg()
458 REGION_OFFSET_TO_PHYS(sti->regions[i], newhpa); in sti_init_glob_cfg()
460 len = sti->regions[i].region_desc.length * 4096; in sti_init_glob_cfg()
462 glob_cfg->region_ptrs[i] = sti->regions_phys[i]; in sti_init_glob_cfg()
466 i, sti->regions_phys[i], glob_cfg->region_ptrs[i], in sti_init_glob_cfg()
468 sti->regions[i].region_desc.btlb, in sti_init_glob_cfg()
469 sti->regions[i].region_desc.sys_only, in sti_init_glob_cfg()
470 sti->regions[i].region_desc.cache, in sti_init_glob_cfg()
471 sti->regions[i].region_desc.last); in sti_init_glob_cfg()
474 if (sti->regions[i].region_desc.last) in sti_init_glob_cfg()
478 if (++i<8 && sti->regions[i].region) in sti_init_glob_cfg()
480 sti->regions[i].region); in sti_init_glob_cfg()
484 sti->glob_cfg = glob_cfg; in sti_init_glob_cfg()
613 static void sti_dump_rom(struct sti_struct *sti) in sti_dump_rom() argument
615 struct sti_rom *rom = sti->rom->raw; in sti_dump_rom()
632 font_start = sti->rom->font_start; in sti_dump_rom()
681 void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f) in sti_font_convert_bytemode() argument
687 if (sti->wordmode) in sti_font_convert_bytemode()
772 static int sti_read_rom(int wordmode, struct sti_struct *sti, in sti_read_rom() argument
792 pr_warn("No font found for STI at %08lx\n", address); in sti_read_rom()
797 memcpy(sti->regions, ((void *)raw)+raw->region_list, sizeof(sti->regions)); in sti_read_rom()
801 pr_info("STI %s ROM supports 32 %sbit firmware functions.\n", in sti_read_rom()
806 sti->font_unpmv = address + (raw->font_unpmv & 0x03ffffff); in sti_read_rom()
807 sti->block_move = address + (raw->block_move & 0x03ffffff); in sti_read_rom()
808 sti->init_graph = address + (raw->init_graph & 0x03ffffff); in sti_read_rom()
809 sti->inq_conf = address + (raw->inq_conf & 0x03ffffff); in sti_read_rom()
811 sti->rom = cooked; in sti_read_rom()
812 sti->rom->raw = raw; in sti_read_rom()
813 sti_dump_rom(sti); in sti_read_rom()
815 sti->wordmode = wordmode; in sti_read_rom()
816 sti->font = sti_select_font(sti->rom); in sti_read_rom()
817 sti->font->width = sti->font->raw->width; in sti_read_rom()
818 sti->font->height = sti->font->raw->height; in sti_read_rom()
819 sti_font_convert_bytemode(sti, sti->font); in sti_read_rom()
820 sti_dump_font(sti->font); in sti_read_rom()
822 sti->sti_mem_request = raw->sti_mem_req; in sti_read_rom()
823 sti->graphics_id[0] = raw->graphics_id[0]; in sti_read_rom()
824 sti->graphics_id[1] = raw->graphics_id[1]; in sti_read_rom()
827 if (wordmode || sti->graphics_id[1] != 0x09A02587) in sti_read_rom()
832 switch (sti->graphics_id[0]) { in sti_read_rom()
850 pr_warn("Sorry, this GSC/STI card is not yet supported.\n"); in sti_read_rom()
864 struct sti_struct *sti; in sti_try_rom_generic() local
869 pr_warn("maximum number of STI ROMS reached !\n"); in sti_try_rom_generic()
873 sti = kzalloc(sizeof(*sti), GFP_KERNEL); in sti_try_rom_generic()
874 if (!sti) in sti_try_rom_generic()
877 spin_lock_init(&sti->lock); in sti_try_rom_generic()
881 * to read the hpa is okay, for romless sti */ in sti_try_rom_generic()
895 pr_warn("PCI ROM is not a STI ROM type image (0x%8x)\n", i); in sti_try_rom_generic()
899 sti->pd = pd; in sti_try_rom_generic()
907 rm = (u32*) &sti->rm_entry; in sti_try_rom_generic()
915 pr_debug("sig %04x, PCI STI ROM at %08lx\n", sig, address); in sti_try_rom_generic()
924 ok = sti_read_rom(0, sti, address); in sti_try_rom_generic()
930 ok = sti_read_rom(1, sti, address); in sti_try_rom_generic()
936 if (sti_init_glob_cfg(sti, address, hpa)) in sti_try_rom_generic()
939 /* disable STI PCI ROM. ROM and card RAM overlap and in sti_try_rom_generic()
942 if (sti->pd) { in sti_try_rom_generic()
944 rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE); in sti_try_rom_generic()
945 pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE); in sti_try_rom_generic()
946 pr_debug("STI PCI ROM disabled\n"); in sti_try_rom_generic()
949 if (sti_init_graph(sti)) in sti_try_rom_generic()
952 sti_inq_conf(sti); in sti_try_rom_generic()
953 sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request); in sti_try_rom_generic()
954 sti_dump_outptr(sti); in sti_try_rom_generic()
957 sti->sti_data->inq_outptr.dev_name); in sti_try_rom_generic()
959 sti_roms[num_sti_roms] = sti; in sti_try_rom_generic()
962 return sti; in sti_try_rom_generic()
965 kfree(sti); in sti_try_rom_generic()
969 static void sticore_check_for_default_sti(struct sti_struct *sti, char *path) in sticore_check_for_default_sti() argument
971 pr_info(" located at [%s]\n", sti->pa_path); in sticore_check_for_default_sti()
973 default_sti = sti; in sticore_check_for_default_sti()
983 struct sti_struct *sti = NULL; in sticore_pa_init() local
987 sti = sti_try_rom_generic(dev->addr[0], hpa, NULL); in sticore_pa_init()
988 if (!sti) in sticore_pa_init()
989 sti = sti_try_rom_generic(hpa, hpa, NULL); in sticore_pa_init()
990 if (!sti) in sticore_pa_init()
991 sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL); in sticore_pa_init()
992 if (!sti) in sticore_pa_init()
995 print_pa_hwpath(dev, sti->pa_path); in sticore_pa_init()
996 sticore_check_for_default_sti(sti, sti->pa_path); in sticore_pa_init()
1007 struct sti_struct *sti; in sticore_pci_init() local
1021 pr_debug("STI PCI ROM enabled at 0x%08lx\n", rom_base); in sticore_pci_init()
1024 pr_info("STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n", in sticore_pci_init()
1027 pr_debug("Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n", in sticore_pci_init()
1030 sti = sti_try_rom_generic(rom_base, fb_base, pd); in sticore_pci_init()
1031 if (sti) { in sticore_pci_init()
1032 print_pci_hwpath(pd, sti->pa_path); in sticore_pci_init()
1033 sticore_check_for_default_sti(sti, sti->pa_path); in sticore_pci_init()
1036 if (!sti) { in sticore_pci_init()
1037 pr_warn("Unable to handle STI device '%s'\n", pci_name(pd)); in sticore_pci_init()
1063 .name = "sti",
1077 .name = "sti",
1084 * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[]
1096 pr_info("STI GSC/PCI core graphics driver " in sti_init_roms()
1103 /* if we didn't find the given default sti, take the first one */ in sti_init_roms()
1110 * index = 0 gives default sti
1129 int sti_call(const struct sti_struct *sti, unsigned long func, in sti_call() argument
1140 /* Check for overflow when using 32bit STI on 64bit kernel. */ in sti_call()
1155 struct sti_struct *sti; in fb_is_primary_device() local
1157 sti = sti_get_rom(0); in fb_is_primary_device()
1160 if (!sti) in fb_is_primary_device()
1164 return (sti->info == info); in fb_is_primary_device()
1170 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");