Lines Matching +full:hp +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/drivers/video/console/sticore.c -
4 * core code for console driver using HP's STI firmware
7 * Copyright (C) 2001-2023 Helge Deller <deller@gmx.de>
8 * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
11 * - call STI in virtual mode rather than in real mode
12 * - screen blanking with state_mgmt() in text mode STI ?
13 * - try to make it work on m68k hp workstations ;)
29 #include <asm/parisc-device.h>
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()
66 * 0 - Black
67 * 1 - White
68 * 2 - Red
69 * 3 - Yellow/Brown
70 * 4 - Green
71 * 5 - Cyan
72 * 6 - Blue
73 * 7 - Magenta
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()
111 outptr->errno = 0; 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()
118 err = outptr->errno; in sti_init_graph()
120 spin_unlock_irqrestore(&sti->lock, flags); in sti_init_graph()
124 return -1; in sti_init_graph()
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()
163 .font_start_addr = (void *)STI_PTR(font->raw), in sti_putc()
167 .dest_x = x * font->width, in sti_putc()
168 .dest_y = y * font->height, 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()
178 /* copy below 4G if calling 32-bit on LP64 kernel */ 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()
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()
219 /* copy below 4G if calling 32-bit on LP64 kernel */ 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()
237 .src_x = src_x * font->width, in sti_clear()
238 .src_y = src_y * font->height, in sti_clear()
239 .dest_x = src_x * font->width, in sti_clear()
240 .dest_y = src_y * font->height, in sti_clear()
241 .width = width * font->width, in sti_clear()
242 .height = height * font->height, 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()
252 /* copy below 4G if calling 32-bit on LP64 kernel */ 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()
273 .src_x = src_x * font->width, in sti_bmove()
274 .src_y = src_y * font->height, in sti_bmove()
275 .dest_x = dst_x * font->width, in sti_bmove()
276 .dest_y = dst_y * font->height, in sti_bmove()
277 .width = width * font->width, in sti_bmove()
278 .height = height * font->height, in sti_bmove()
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()
288 /* copy below 4G if calling 32-bit on LP64 kernel */ 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()
310 count -= 4; in sti_rom_copy()
316 count--; in sti_rom_copy()
341 * parameter sti=<x> which of them will be the initial boot-console.
360 * an built-in Linux framebuffer font. in sti_font_setup()
362 * the first HP STI ROM built-in font.. in sti_font_setup()
384 * - sti_font=<fb_fontname>:
385 * <fb_fontname> is the name of one of the linux-kernel built-in
389 * - sti_font=<number> (<number> = 1,2,3,...)
390 * most STI ROMs have built-in HP specific fonts, which can be selected
393 * - sti_font=<height>x<width> (e.g. sti_font=16x8)
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() local
413 glob_cfg->text_planes, in sti_dump_globcfg()
414 glob_cfg->onscreen_x, glob_cfg->onscreen_y, in sti_dump_globcfg()
415 glob_cfg->offscreen_x, glob_cfg->offscreen_y, in sti_dump_globcfg()
416 glob_cfg->total_x, glob_cfg->total_y); in sti_dump_globcfg()
418 /* dump extended cfg */ in sti_dump_globcfg()
424 cfg->curr_mon, in sti_dump_globcfg()
425 cfg->friendly_boot, in sti_dump_globcfg()
426 cfg->power, in sti_dump_globcfg()
427 cfg->freq_ref, in sti_dump_globcfg()
428 cfg->sti_mem_addr, sti->sti_mem_request); in sti_dump_globcfg()
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()
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()
459 return -ENOMEM; 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()
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()
503 ptr = &glob_cfg->region_ptrs; in sti_init_glob_cfg()
505 ptr = store_sti_val(sti, ptr, sti->regions_phys[i]); 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()
537 fbfont->width, fbfont->height, fbfont->name); in sti_select_fbfont()
539 bpc = ((fbfont->width+7)/8) * fbfont->height; in sti_select_fbfont()
540 size = bpc * fbfont->charcount; in sti_select_fbfont()
547 nf->first_char = 0; in sti_select_fbfont()
548 nf->last_char = fbfont->charcount - 1; in sti_select_fbfont()
549 nf->width = fbfont->width; in sti_select_fbfont()
550 nf->height = fbfont->height; in sti_select_fbfont()
551 nf->font_type = STI_FONT_HPROMAN8; in sti_select_fbfont()
552 nf->bytes_per_char = bpc; in sti_select_fbfont()
553 nf->next_font = 0; in sti_select_fbfont()
554 nf->underline_height = 1; in sti_select_fbfont()
555 nf->underline_pos = fbfont->height - nf->underline_height; in sti_select_fbfont()
559 memcpy(dest, fbfont->data, bpc * fbfont->charcount); in sti_select_fbfont()
567 cooked_font->raw = nf; in sti_select_fbfont()
568 cooked_font->raw_ptr = nf; in sti_select_fbfont()
569 cooked_font->next_font = NULL; in sti_select_fbfont()
571 cooked_rom->font_start = cooked_font; in sti_select_fbfont()
586 unsigned char *p = (unsigned char *)font->raw; in sti_dump_font()
590 pr_debug(" w %d h %d bpc %d\n", font->width, font->height, in sti_dump_font()
591 font->raw->bytes_per_char); in sti_dump_font()
593 for (n = 0; n < 256 * font->raw->bytes_per_char; n += 16, p += 16) { in sti_dump_font()
608 for (font = rom->font_start; font; font = font->next_font, i++) { in sti_search_font()
609 if ((font->raw->width == width) && in sti_search_font()
610 (font->raw->height == height)) in sti_search_font()
621 /* check for framebuffer-font first */ in sti_select_font()
632 for (font = rom->font_start, i = font_index - 1; in sti_select_font()
634 font = font->next_font, i--); in sti_select_font()
639 return rom->font_start; in sti_select_font()
645 struct sti_rom *rom = sti->rom->raw; in sti_dump_rom()
649 pr_info(" id %04x-%04x, conforms to spec rev. %d.%02x\n", in sti_dump_rom()
650 rom->graphics_id[0], in sti_dump_rom()
651 rom->graphics_id[1], in sti_dump_rom()
652 rom->revno[0] >> 4, in sti_dump_rom()
653 rom->revno[0] & 0x0f); in sti_dump_rom()
654 pr_debug(" supports %d monitors\n", rom->num_mons); in sti_dump_rom()
655 pr_debug(" font start %08x\n", rom->font_start); in sti_dump_rom()
656 pr_debug(" region list %08x\n", rom->region_list); in sti_dump_rom()
657 pr_debug(" init_graph %08x\n", rom->init_graph); in sti_dump_rom()
658 pr_debug(" bus support %02x\n", rom->bus_support); in sti_dump_rom()
659 pr_debug(" ext bus support %02x\n", rom->ext_bus_support); in sti_dump_rom()
660 pr_debug(" alternate code type %d\n", rom->alt_code_type); in sti_dump_rom()
662 font_start = sti->rom->font_start; in sti_dump_rom()
665 struct sti_rom_font *f = font_start->raw; in sti_dump_rom()
667 pr_info(" built-in font #%d: size %dx%d, chars %d-%d, bpc %d\n", ++nr, in sti_dump_rom()
668 f->width, f->height, in sti_dump_rom()
669 f->first_char, f->last_char, f->bytes_per_char); in sti_dump_rom()
670 font_start = font_start->next_font; in sti_dump_rom()
685 cooked_rom->font_start = cooked_font; in sti_cook_fonts()
687 raw_font = ((void *)raw_rom) + (raw_rom->font_start); in sti_cook_fonts()
690 cooked_font->raw = raw_font; in sti_cook_fonts()
692 while (raw_font->next_font) { in sti_cook_fonts()
693 raw_font = ((void *)font_start) + (raw_font->next_font); in sti_cook_fonts()
695 cooked_font->next_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); in sti_cook_fonts()
696 if (!cooked_font->next_font) in sti_cook_fonts()
699 cooked_font = cooked_font->next_font; in sti_cook_fonts()
701 cooked_font->raw = raw_font; in sti_cook_fonts()
704 cooked_font->next_font = NULL; in sti_cook_fonts()
714 int size = f->raw->bytes_per_char * (f->raw->last_char + 1) + sizeof(struct sti_rom_font); in sti_font_convert_bytemode()
717 if (sti->wordmode) in sti_font_convert_bytemode()
720 old_font = f->raw_ptr; in sti_font_convert_bytemode()
722 f->raw_ptr = n; in sti_font_convert_bytemode()
726 q = (unsigned char *) f->raw; in sti_font_convert_bytemode()
727 while (size--) { in sti_font_convert_bytemode()
731 /* store new ptr to byte-mode font and delete old font */ in sti_font_convert_bytemode()
732 f->raw = (struct sti_rom_font *) (n + 3); in sti_font_convert_bytemode()
743 count--; in sti_bmode_rom_copy()
764 memmove (&raw->res004, &raw->type[0], 0x3c); in sti_get_bmode_rom()
765 raw->type[3] = raw->res004; in sti_get_bmode_rom()
767 BMODE_RELOCATE (raw->region_list); in sti_get_bmode_rom()
768 BMODE_RELOCATE (raw->font_start); in sti_get_bmode_rom()
770 BMODE_RELOCATE (raw->init_graph); in sti_get_bmode_rom()
771 BMODE_RELOCATE (raw->state_mgmt); in sti_get_bmode_rom()
772 BMODE_RELOCATE (raw->font_unpmv); in sti_get_bmode_rom()
773 BMODE_RELOCATE (raw->block_move); in sti_get_bmode_rom()
774 BMODE_RELOCATE (raw->inq_conf); in sti_get_bmode_rom()
776 raw_font = ((void *)raw) + raw->font_start; in sti_get_bmode_rom()
779 while (raw_font->next_font) { in sti_get_bmode_rom()
780 BMODE_RELOCATE (raw_font->next_font); in sti_get_bmode_rom()
781 raw_font = ((void *)font_start) + raw_font->next_font; in sti_get_bmode_rom()
826 if (raw->region_list) in sti_read_rom()
827 memcpy(sti->regions, ((void *)raw)+raw->region_list, sizeof(sti->regions)); in sti_read_rom()
833 raw->alt_code_type == ALT_CODE_TYPE_PA_RISC_64 in sti_read_rom()
837 raw->alt_code_type == ALT_CODE_TYPE_PA_RISC_64) { 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()
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()
875 revno = (raw->revno[0] << 8) | raw->revno[1]; in sti_read_rom()
877 switch (sti->graphics_id[0]) { in sti_read_rom()
922 spin_lock_init(&sti->lock); in sti_try_rom_generic()
925 /* pdc_add_valid() works only on 32-bit kernels */ 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()
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()
1004 sti->sti_data->inq_outptr.dev_name); in sti_try_rom_generic()
1018 pr_info(" located at [%s]\n", sti->pa_path); in sticore_check_for_default_sti()
1026 * older Systems the PDC stores it in page0->proc_sti
1031 int hpa = dev->hpa.start; in sticore_pa_init()
1033 if (dev->num_addrs && dev->addr[0]) in sticore_pa_init()
1034 sti = sti_try_rom_generic(dev->addr[0], hpa, NULL); in sticore_pa_init()
1038 sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL); 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()
1061 dev_err(&pd->dev, "Cannot enable PCI device\n"); 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()
1088 return -ENODEV; in sticore_pci_init()
1091 sti->dev = &pd->dev; in sticore_pci_init()
1136 * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[]
1176 return sti_roms[index-1]; in sti_get_rom()
1192 if (WARN_ONCE(IS_ENABLED(CONFIG_64BIT) && !sti->do_call64 && in sti_call()
1195 "Out of 32bit-range pointers!")) in sti_call()
1196 return -1; 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");