From 22162579563de2f4a42d43134e448a7277dae7c5 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Wed, 10 Apr 2024 21:30:49 +0200 Subject: try to get sti rom working on 64-bit --- .config | 5 ++++- src/parisc/c3700.h | 6 ------ src/parisc/parisc.c | 59 ++++++++++++++++++++++++++++++++++++++++++---------- src/parisc/sti.c | 10 ++++++--- src/parisc/sticore.h | 2 +- src/parisc/stirom.c | 3 ++- 6 files changed, 62 insertions(+), 23 deletions(-) diff --git a/.config b/.config index 722c564..69b6356 100644 --- a/.config +++ b/.config @@ -78,4 +78,7 @@ CONFIG_VGA_EXTRA_STACK_SIZE=512 # # Debugging # -CONFIG_DEBUG_LEVEL=0 +CONFIG_DEBUG_LEVEL=10 +CONFIG_DEBUG_SERIAL=y +CONFIG_DEBUG_SERIAL_PORT=0x3f8 +CONFIG_DEBUG_IO=y diff --git a/src/parisc/c3700.h b/src/parisc/c3700.h index 36749b5..be9e2e5 100644 --- a/src/parisc/c3700.h +++ b/src/parisc/c3700.h @@ -281,12 +281,6 @@ static struct pdc_iodc iodc_data_hpa_fed10200 = { .mod_path = &mod_path_hpa_fed10200,\ .num_addr = HPA_fed10200_num_addr,\ .add_addr = { HPA_fed10200_add_addr } },\ - { .hpa = LASI_GFX_HPA, /* HACKED IN: Coral GSC graphics */ \ - .iodc = &iodc_data_hpa_f8000000,\ - .mod_info = &mod_info_hpa_f8000000,\ - .mod_path = &mod_path_hpa_f8000000,\ - .num_addr = HPA_f8000000_num_addr,\ - .add_addr = { HPA_f8000000_add_addr } },\ { .hpa = CPU_HPA /* XXX: 0xfffa0000 */ ,\ .iodc = &iodc_data_hpa_fffa0000,\ .mod_info = &mod_info_hpa_fffa0000,\ diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c index 8aec3bc..dc6aad2 100644 --- a/src/parisc/parisc.c +++ b/src/parisc/parisc.c @@ -552,16 +552,47 @@ static int HPA_is_keyboard_device(unsigned long hpa) } #endif +static hppa_device_t *gfx_card; + +/* shall detect Artist GSC card only, not the Visualize EG PCI! */ static int artist_present(void) { - return !!(*(u32 *)F_EXTEND(0xf8380004) == 0x6dc20006); + /* qemu sets identifier at 0xf8380004 */ + return !is_64bit_PDC() && (*(u32 *)F_EXTEND(LASI_GFX_HPA + 0x0380004) == 0x6dc20006); +} + +static void find_graphics_card(void) +{ + gfx_card = NULL; + + if (artist_present()) { + gfx_card = find_hpa_device(LASI_GFX_HPA); + } + + if (!gfx_card && is_64bit_PDC()) { + /* find Visualize EG PCI card (artist, to be used as console) */ + struct pci_device *pci; + pci = pci_find_device(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_VISUALIZE_EG); + if (pci) { + void *p = pci_enable_membar(pci, PCI_BASE_ADDRESS_0); + gfx_card = find_hpa_device((uintptr_t) p); + } + } + + if (is_64bit_PDC() && gfx_card) { + sti_rom_init(); + sti_console_init(&sti_proc_rom, gfx_card->hpa); + if (has_astro) + kbd_init(); + } } int HPA_is_LASI_graphics(unsigned long hpa) { /* return true if hpa is LASI graphics (artist graphics card) */ - return (hpa == LASI_GFX_HPA) && artist_present(); + return hpa && gfx_card && F_EXTEND(hpa) == F_EXTEND(gfx_card->hpa); } + #define GFX_NUM_PAGES 0x2000 int HPA_is_graphics_device(unsigned long hpa) { @@ -1085,8 +1116,10 @@ static void parisc_serial_out(char c) static void parisc_putchar_internal(char c) { - if (HPA_is_LASI_graphics(PAGE0->mem_cons.hpa)) + if (HPA_is_LASI_graphics(PAGE0->mem_cons.hpa)) { sti_putc(c); + builtin_console_out(c); // XXX temporary hack to show same output on serial console during debugging artist PCI + } else parisc_serial_out(c); } @@ -2898,7 +2931,7 @@ static int parisc_boot_menu(unsigned long *iplstart, unsigned long *iplend, ********************************************************/ static struct pz_device mem_cons_sti_boot = { - .hpa = LASI_GFX_HPA, + .hpa = LASI_GFX_HPA, /* will be overwritten */ .cl_class = CL_DISPL, }; @@ -3281,14 +3314,12 @@ void __VISIBLE start_parisc_firmware(void) PAGE0->imm_max_mem = ram_size; /* initialize graphics (if available) */ - if (artist_present()) { + if (!is_64bit_PDC() && artist_present()) { sti_rom_init(); - sti_console_init(&sti_proc_rom); + sti_console_init(&sti_proc_rom, gfx_card->hpa); + /* proc_sti will be set for GSC card only */ PAGE0->proc_sti = (uintptr_t)&sti_proc_rom; - if (has_astro) - kbd_init(); - else - ps2port_setup(); + ps2port_setup(); } else { remove_from_keep_list(LASI_GFX_HPA); remove_from_keep_list(LASI_PS2KBD_HPA); @@ -3353,14 +3384,20 @@ void __VISIBLE start_parisc_firmware(void) /* find SCSI PCI card when running on Astro or Dino */ find_scsi_pci_card(); + /* find Artist GSC or Visualize EG PCI card */ + find_graphics_card(); + // Initialize boot paths (graphics & keyboard) +printf("ARTIST PRESENT %p IS_GRAPHICS %d\n", gfx_card, pdc_console == CONSOLE_GRAPHICS); if (pdc_console != CONSOLE_SERIAL) { - if (artist_present()) + if (gfx_card) pdc_console = CONSOLE_GRAPHICS; else pdc_console = CONSOLE_SERIAL; } +printf("ARTIST PRESENT %p WANTS_GRAPHICS %d\n", gfx_card, pdc_console == CONSOLE_GRAPHICS); if (pdc_console == CONSOLE_GRAPHICS) { + mem_cons_sti_boot.hpa = gfx_card->hpa; prepare_boot_path(&(PAGE0->mem_cons), &mem_cons_sti_boot, 0x60); prepare_boot_path(&(PAGE0->mem_kbd), &mem_kbd_sti_boot, 0xa0); } else { diff --git a/src/parisc/sti.c b/src/parisc/sti.c index 1bba989..4009142 100644 --- a/src/parisc/sti.c +++ b/src/parisc/sti.c @@ -33,7 +33,7 @@ static struct sti_glob_cfg_ext sti_glob_ext_cfg = { }; static struct sti_glob_cfg sti_glob_cfg = { - .region_ptrs = { 0, ARTIST_FB_ADDR, 0xf8100000, 0xf8380000, 0, 0, 0, 0 }, + .region_ptrs = { 0, }, }; static struct sti_init_inptr_ext sti_init_inptr_ext = { @@ -111,7 +111,7 @@ static void sti_block_move(struct sti_rom *rom, int src_x, int src_y, &sti_blkmv_outptr, &sti_glob_cfg); } -void sti_console_init(struct sti_rom *rom) +void sti_console_init(struct sti_rom *rom, u32 gfx_addr) { int (*sti_init)(struct sti_init_flags *, struct sti_init_inptr *, @@ -121,6 +121,10 @@ void sti_console_init(struct sti_rom *rom) sti_init = (void *)rom + rom->init_graph; sti_glob_cfg.ext_ptr = (u32)&sti_glob_ext_cfg; sti_init_inptr.ext_ptr = (u32)&sti_init_inptr_ext; + sti_glob_cfg.region_ptrs[0] = 0; + sti_glob_cfg.region_ptrs[1] = gfx_addr + 0x01000000; + sti_glob_cfg.region_ptrs[2] = gfx_addr + 0x00100000; + sti_glob_cfg.region_ptrs[3] = gfx_addr + 0x00380000; sti_init(&sti_init_flags, &sti_init_inptr, &sti_init_outptr, &sti_glob_cfg); @@ -130,7 +134,7 @@ void sti_console_init(struct sti_rom *rom) void sti_putc(const char c) { - struct sti_rom *rom = (struct sti_rom *) ROM_EXTEND(PAGE0->proc_sti); + struct sti_rom *rom = &sti_proc_rom; struct sti_rom_font *font = (void *)rom + rom->font_start; static int row, col; diff --git a/src/parisc/sticore.h b/src/parisc/sticore.h index d53ddff..7d61f1d 100644 --- a/src/parisc/sticore.h +++ b/src/parisc/sticore.h @@ -324,7 +324,7 @@ struct setcm_outptr { }; void sti_rom_init(void); -void sti_console_init(struct sti_rom *rom); +void sti_console_init(struct sti_rom *rom, u32 gfx_addr); void sti_putc(const char c); extern struct sti_rom sti_proc_rom; diff --git a/src/parisc/stirom.c b/src/parisc/stirom.c index ff74c90..55fa99d 100644 --- a/src/parisc/stirom.c +++ b/src/parisc/stirom.c @@ -3349,7 +3349,8 @@ static int __stifunc("font_unpmv") sti_font_unpmv(struct sti_font_flags *flags, struct sti_font_outptr *out, struct sti_glob_cfg *cfg) { - struct font *font = (struct font *) ROM_EXTEND(in->font_start_addr); + // struct font *font = (struct font *) ROM_EXTEND(in->font_start_addr); + struct font *font = (struct font *) (0xfffffff0f0000000 | in->font_start_addr); int bpc = font->hdr.bytes_per_char; int width = font->hdr.width; unsigned char *src; -- cgit v1.1