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 */
44 static void *store_sti_val(struct sti_struct *sti, void *ptr, unsigned long val) in store_sti_val() argument
48 if (IS_ENABLED(CONFIG_64BIT) && sti->do_call64) { in store_sti_val()
49 /* used for 64-bit STI ROM */ in store_sti_val()
57 /* used for 32-bit STI ROM */ in store_sti_val()
62 #define store_sti_ptr(sti, dest, ptr) \ argument
63 store_sti_val(sti, dest, STI_PTR(ptr))
65 /* The colour indices used by STI are
83 #define c_fg(sti, c) col_trans[((c>> 8) & 7)] argument
84 #define c_bg(sti, c) col_trans[((c>>11) & 7)] argument
85 #define c_index(sti, c) ((c) & 0xff) argument
97 static int sti_init_graph(struct sti_struct *sti) in sti_init_graph() argument
99 struct sti_init_inptr *inptr = &sti->sti_data->init_inptr; in sti_init_graph()
100 struct sti_init_inptr_ext *inptr_ext = &sti->sti_data->init_inptr_ext; in sti_init_graph()
101 struct sti_init_outptr *outptr = &sti->sti_data->init_outptr; in sti_init_graph()
105 spin_lock_irqsave(&sti->lock, flags); in sti_init_graph()
108 inptr->text_planes = 3; /* # of text planes (max 3 for STI) */ in sti_init_graph()
110 store_sti_ptr(sti, &inptr->ext_ptr, inptr_ext); in sti_init_graph()
113 ret = sti_call(sti, sti->init_graph, &default_init_flags, inptr, in sti_init_graph()
114 outptr, sti->glob_cfg); in sti_init_graph()
117 sti->text_planes = outptr->text_planes; in sti_init_graph()
120 spin_unlock_irqrestore(&sti->lock, flags); in sti_init_graph()
123 pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err); in sti_init_graph()
134 static void sti_inq_conf(struct sti_struct *sti) in sti_inq_conf() argument
136 struct sti_conf_inptr *inptr = &sti->sti_data->inq_inptr; in sti_inq_conf()
137 struct sti_conf_outptr *outptr = &sti->sti_data->inq_outptr; in sti_inq_conf()
141 store_sti_ptr(sti, &outptr->ext_ptr, &sti->sti_data->inq_outptr_ext); in sti_inq_conf()
144 spin_lock_irqsave(&sti->lock, flags); in sti_inq_conf()
146 ret = sti_call(sti, sti->inq_conf, &default_conf_flags, in sti_inq_conf()
147 inptr, outptr, sti->glob_cfg); in sti_inq_conf()
148 spin_unlock_irqrestore(&sti->lock, flags); in sti_inq_conf()
158 sti_putc(struct sti_struct *sti, int c, int y, int x, in sti_putc() argument
164 .index = c_index(sti, c), in sti_putc()
165 .fg_color = c_fg(sti, c), in sti_putc()
166 .bg_color = c_bg(sti, c), in sti_putc()
170 struct sti_font_outptr *outptr = &sti->sti_data->font_outptr; in sti_putc()
175 spin_lock_irqsave(&sti->lock, flags); in sti_putc()
177 if (IS_ENABLED(CONFIG_64BIT) && !sti->do_call64) { in sti_putc()
179 inptr = &sti->sti_data->font_inptr; in sti_putc()
181 /* skip first 4 bytes for 32-bit STI call */ in sti_putc()
184 ret = sti_call(sti, sti->font_unpmv, &default_font_flags, in sti_putc()
185 inptr, outptr, sti->glob_cfg); in sti_putc()
186 spin_unlock_irqrestore(&sti->lock, flags); in sti_putc()
197 sti_set(struct sti_struct *sti, int src_y, int src_x, in sti_set() argument
211 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_set()
216 spin_lock_irqsave(&sti->lock, flags); in sti_set()
218 if (IS_ENABLED(CONFIG_64BIT) && !sti->do_call64) { in sti_set()
220 inptr = &sti->sti_data->blkmv_inptr; in sti_set()
223 ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, in sti_set()
224 inptr, outptr, sti->glob_cfg); in sti_set()
225 spin_unlock_irqrestore(&sti->lock, flags); in sti_set()
230 sti_clear(struct sti_struct *sti, int src_y, int src_x, in sti_clear() argument
235 .fg_color = c_fg(sti, c), in sti_clear()
236 .bg_color = c_bg(sti, c), in sti_clear()
244 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_clear()
249 spin_lock_irqsave(&sti->lock, flags); in sti_clear()
251 if (IS_ENABLED(CONFIG_64BIT) && !sti->do_call64) { in sti_clear()
253 inptr = &sti->sti_data->blkmv_inptr; in sti_clear()
256 ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, in sti_clear()
257 inptr, outptr, sti->glob_cfg); in sti_clear()
258 spin_unlock_irqrestore(&sti->lock, flags); in sti_clear()
267 sti_bmove(struct sti_struct *sti, int src_y, int src_x, in sti_bmove() argument
280 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; in sti_bmove()
285 spin_lock_irqsave(&sti->lock, flags); in sti_bmove()
287 if (IS_ENABLED(CONFIG_64BIT) && !sti->do_call64) { in sti_bmove()
289 inptr = &sti->sti_data->blkmv_inptr; in sti_bmove()
292 ret = sti_call(sti, sti->block_move, &default_blkmv_flags, in sti_bmove()
293 inptr, outptr, sti->glob_cfg); in sti_bmove()
294 spin_unlock_irqrestore(&sti->lock, flags); in sti_bmove()
339 /* Assuming the machine has multiple STI consoles (=graphic cards) which
341 * parameter sti=<x> which of them will be the initial boot-console.
343 * STI screen.
345 __setup("sti=", sti_setup);
362 * the first HP STI ROM built-in font.. in sti_font_setup()
390 * most STI ROMs have built-in HP specific fonts, which can be selected
392 * NOTE: This number is machine and STI ROM dependend.
404 static void sti_dump_globcfg(struct sti_struct *sti) in sti_dump_globcfg() argument
406 struct sti_glob_cfg *glob_cfg = sti->glob_cfg; in sti_dump_globcfg()
407 struct sti_glob_cfg_ext *cfg = &sti->sti_data->glob_cfg_ext; in sti_dump_globcfg()
428 cfg->sti_mem_addr, sti->sti_mem_request); in sti_dump_globcfg()
431 static void sti_dump_outptr(struct sti_struct *sti) in sti_dump_outptr() argument
437 sti->sti_data->inq_outptr.bits_per_pixel, in sti_dump_outptr()
438 sti->sti_data->inq_outptr.bits_used, in sti_dump_outptr()
439 sti->sti_data->inq_outptr.planes, in sti_dump_outptr()
440 sti->sti_data->inq_outptr.attributes); in sti_dump_outptr()
443 static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, in sti_init_glob_cfg() argument
452 if (sti->sti_mem_request < 256) in sti_init_glob_cfg()
453 sti->sti_mem_request = 256; /* STI default */ in sti_init_glob_cfg()
455 size = sizeof(struct sti_all_data) + sti->sti_mem_request - 256; in sti_init_glob_cfg()
457 sti->sti_data = kzalloc(size, STI_LOWMEM); in sti_init_glob_cfg()
458 if (!sti->sti_data) in sti_init_glob_cfg()
461 glob_cfg = &sti->sti_data->glob_cfg; in sti_init_glob_cfg()
462 glob_cfg_ext = &sti->sti_data->glob_cfg_ext; in sti_init_glob_cfg()
463 save_addr = &sti->sti_data->save_addr; in sti_init_glob_cfg()
464 sti_mem_addr = &sti->sti_data->sti_mem_addr; in sti_init_glob_cfg()
469 if (sti->pd) { in sti_init_glob_cfg()
470 unsigned char offs = sti->rm_entry[i]; in sti_init_glob_cfg()
477 pr_warn("STI pci region mapping for region %d (%02x) can't be mapped\n", in sti_init_glob_cfg()
478 i,sti->rm_entry[i]); in sti_init_glob_cfg()
481 newhpa = pci_resource_start (sti->pd, (offs - PCI_BASE_ADDRESS_0) / 4); in sti_init_glob_cfg()
485 sti->regions_phys[i] = in sti_init_glob_cfg()
486 REGION_OFFSET_TO_PHYS(sti->regions[i], newhpa); in sti_init_glob_cfg()
488 len = sti->regions[i].region_desc.length * 4096; in sti_init_glob_cfg()
492 i, sti->regions_phys[i], len / 1024, in sti_init_glob_cfg()
493 sti->regions[i].region_desc.btlb, in sti_init_glob_cfg()
494 sti->regions[i].region_desc.sys_only, in sti_init_glob_cfg()
495 sti->regions[i].region_desc.cache, in sti_init_glob_cfg()
496 sti->regions[i].region_desc.last); in sti_init_glob_cfg()
499 if (sti->regions[i].region_desc.last) in sti_init_glob_cfg()
505 ptr = store_sti_val(sti, ptr, sti->regions_phys[i]); in sti_init_glob_cfg()
509 ptr = store_sti_ptr(sti, ptr, save_addr); in sti_init_glob_cfg()
510 ptr = store_sti_ptr(sti, ptr, glob_cfg_ext); in sti_init_glob_cfg()
512 store_sti_ptr(sti, &glob_cfg_ext->sti_mem_addr, sti_mem_addr); in sti_init_glob_cfg()
514 sti->glob_cfg = glob_cfg; in sti_init_glob_cfg()
643 static void sti_dump_rom(struct sti_struct *sti) in sti_dump_rom() argument
645 struct sti_rom *rom = sti->rom->raw; in sti_dump_rom()
662 font_start = sti->rom->font_start; in sti_dump_rom()
711 void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f) in sti_font_convert_bytemode() argument
717 if (sti->wordmode) in sti_font_convert_bytemode()
802 static int sti_read_rom(int wordmode, struct sti_struct *sti, in sti_read_rom() argument
822 pr_warn("No font found for STI at %08lx\n", address); in sti_read_rom()
827 memcpy(sti->regions, ((void *)raw)+raw->region_list, sizeof(sti->regions)); in sti_read_rom()
831 pr_info("STI %s ROM supports 32 %sbit firmware functions.\n", in sti_read_rom()
838 sti->do_call64 = 1; in sti_read_rom()
839 sti->font_unpmv = address + (raw->font_unp_addr & 0x03ffffff); in sti_read_rom()
840 sti->block_move = address + (raw->block_move_addr & 0x03ffffff); in sti_read_rom()
841 sti->init_graph = address + (raw->init_graph_addr & 0x03ffffff); in sti_read_rom()
842 sti->inq_conf = address + (raw->inq_conf_addr & 0x03ffffff); in sti_read_rom()
844 sti->font_unpmv = address + (raw->font_unpmv & 0x03ffffff); in sti_read_rom()
845 sti->block_move = address + (raw->block_move & 0x03ffffff); in sti_read_rom()
846 sti->init_graph = address + (raw->init_graph & 0x03ffffff); in sti_read_rom()
847 sti->inq_conf = address + (raw->inq_conf & 0x03ffffff); in sti_read_rom()
850 sti->rom = cooked; in sti_read_rom()
851 sti->rom->raw = raw; in sti_read_rom()
852 sti_dump_rom(sti); in sti_read_rom()
854 sti->wordmode = wordmode; in sti_read_rom()
855 sti->font = sti_select_font(sti->rom); in sti_read_rom()
856 sti->font->width = sti->font->raw->width; in sti_read_rom()
857 sti->font->height = sti->font->raw->height; in sti_read_rom()
858 sti_font_convert_bytemode(sti, sti->font); in sti_read_rom()
859 sti_dump_font(sti->font); in sti_read_rom()
861 pr_info(" using %d-bit STI ROM functions\n", in sti_read_rom()
862 (IS_ENABLED(CONFIG_64BIT) && sti->do_call64) ? 64 : 32); in sti_read_rom()
864 sti->sti_mem_request = raw->sti_mem_req; in sti_read_rom()
866 sti->sti_mem_request, raw->reentsize); in sti_read_rom()
868 sti->graphics_id[0] = raw->graphics_id[0]; in sti_read_rom()
869 sti->graphics_id[1] = raw->graphics_id[1]; in sti_read_rom()
872 if (wordmode || sti->graphics_id[1] != 0x09A02587) in sti_read_rom()
877 switch (sti->graphics_id[0]) { in sti_read_rom()
895 pr_warn("Sorry, this GSC/STI card is not yet supported.\n"); in sti_read_rom()
909 struct sti_struct *sti; in sti_try_rom_generic() local
914 pr_warn("maximum number of STI ROMS reached !\n"); in sti_try_rom_generic()
918 sti = kzalloc(sizeof(*sti), GFP_KERNEL); in sti_try_rom_generic()
919 if (!sti) in sti_try_rom_generic()
922 spin_lock_init(&sti->lock); in sti_try_rom_generic()
942 pr_warn("PCI ROM is not a STI ROM type image (0x%8x)\n", i); in sti_try_rom_generic()
946 sti->pd = pd; in sti_try_rom_generic()
954 rm = (u32*) &sti->rm_entry; in sti_try_rom_generic()
962 pr_debug("sig %04x, PCI STI ROM at %08lx\n", sig, address); in sti_try_rom_generic()
971 ok = sti_read_rom(0, sti, address); in sti_try_rom_generic()
977 ok = sti_read_rom(1, sti, address); in sti_try_rom_generic()
983 if (sti_init_glob_cfg(sti, address, hpa)) in sti_try_rom_generic()
986 /* disable STI PCI ROM. ROM and card RAM overlap and in sti_try_rom_generic()
989 if (sti->pd) { in sti_try_rom_generic()
991 rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE); in sti_try_rom_generic()
992 pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE); in sti_try_rom_generic()
993 pr_debug("STI PCI ROM disabled\n"); in sti_try_rom_generic()
996 if (sti_init_graph(sti)) in sti_try_rom_generic()
999 sti_inq_conf(sti); in sti_try_rom_generic()
1000 sti_dump_globcfg(sti); in sti_try_rom_generic()
1001 sti_dump_outptr(sti); in sti_try_rom_generic()
1004 sti->sti_data->inq_outptr.dev_name); in sti_try_rom_generic()
1006 sti_roms[num_sti_roms] = sti; in sti_try_rom_generic()
1009 return sti; in sti_try_rom_generic()
1012 kfree(sti); in sti_try_rom_generic()
1016 static void sticore_check_for_default_sti(struct sti_struct *sti, char *path) in sticore_check_for_default_sti() argument
1018 pr_info(" located at [%s]\n", sti->pa_path); in sticore_check_for_default_sti()
1020 default_sti = sti; in sticore_check_for_default_sti()
1030 struct sti_struct *sti = NULL; in sticore_pa_init() local
1034 sti = sti_try_rom_generic(dev->addr[0], hpa, NULL); in sticore_pa_init()
1035 if (!sti) in sticore_pa_init()
1036 sti = sti_try_rom_generic(hpa, hpa, NULL); in sticore_pa_init()
1037 if (!sti) in sticore_pa_init()
1038 sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL); in sticore_pa_init()
1039 if (!sti) in sticore_pa_init()
1042 print_pa_hwpath(dev, sti->pa_path); in sticore_pa_init()
1043 sticore_check_for_default_sti(sti, sti->pa_path); in sticore_pa_init()
1045 sti->dev = &dev->dev; in sticore_pa_init()
1057 struct sti_struct *sti; in sticore_pci_init() local
1071 pr_debug("STI PCI ROM enabled at 0x%08lx\n", rom_base); in sticore_pci_init()
1074 pr_info("STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n", in sticore_pci_init()
1077 pr_debug("Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n", in sticore_pci_init()
1080 sti = sti_try_rom_generic(rom_base, fb_base, pd); in sticore_pci_init()
1081 if (sti) { in sticore_pci_init()
1082 print_pci_hwpath(pd, sti->pa_path); in sticore_pci_init()
1083 sticore_check_for_default_sti(sti, sti->pa_path); in sticore_pci_init()
1086 if (!sti) { in sticore_pci_init()
1087 pr_warn("Unable to handle STI device '%s'\n", pci_name(pd)); in sticore_pci_init()
1091 sti->dev = &pd->dev; in sticore_pci_init()
1115 .name = "sti",
1129 .name = "sti",
1136 * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[]
1148 pr_info("STI GSC/PCI core graphics driver " in sti_init_roms()
1155 /* if we didn't find the given default sti, take the first one */ in sti_init_roms()
1162 * index = 0 gives default sti
1181 int sti_call(const struct sti_struct *sti, unsigned long func, in sti_call() argument
1191 /* Check for overflow when using 32bit STI on 64bit kernel. */ in sti_call()
1192 if (WARN_ONCE(IS_ENABLED(CONFIG_64BIT) && !sti->do_call64 && in sti_call()
1199 sti->do_call64); in sti_call()
1205 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");