Skip to contentSkip to conversation

Fix STI console on 64-bit parisc machines

PATCH New Helge Deller 1 participant 3 messages May 22, 2023

Subsystems (2)
lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

cover Fix STI console on 64-bit parisc machines

Two patches to fix the STI text console on parisc machines.

Helge Deller (2):
sticon/parisc: Allow 64-bit STI calls in PDC firmware abstration sticon/parisc: Fix STI console on 64-bit only machines

 arch/parisc/include/asm/pdc.h |   4 +-
 arch/parisc/kernel/firmware.c |  21 +++--
 drivers/video/fbdev/stifb.c   |   4 +-
 drivers/video/sticore.c       | 159 ++++++++++++++++++++++------------
 include/video/sticore.h       |  42 ++++-----
 5 files changed, 143 insertions(+), 87 deletions(-)

--
2.40.1

author maintainer
#1 lore raw

PATCH 1/2 sticon/parisc: Allow 64-bit STI calls in PDC firmware abstration

Some 64-bit machines require us to call the STI ROM in 64-bit mode, e.g. with the VisFXe graphic card.
This patch allows drivers to use such 64-bit calling conventions.

---
 arch/parisc/include/asm/pdc.h |  4 ++--
 arch/parisc/kernel/firmware.c | 21 ++++++++++++++-------
 drivers/video/sticore.c       |  2 +-
 3 files changed, 17 insertions(+), 10 deletions(-)
arch/parisc/include/asm/pdc.h +2 -2
index 2b4fad8328e8..269b9a159f01 100644
@@ -88,8 +88,8 @@ int pdc_iodc_print(const unsigned char *str, unsigned count);
 
 void pdc_emergency_unlock(void);
 int pdc_sti_call(unsigned long func, unsigned long flags,
-                 unsigned long inptr, unsigned long outputr,
-                 unsigned long glob_cfg);
+		unsigned long inptr, unsigned long outputr,
+		unsigned long glob_cfg, int do_call64);
 
 int __pdc_cpu_rendezvous(void);
 void pdc_cpu_rendezvous_lock(void);
arch/parisc/kernel/firmware.c +14 -7
index cc124d9f1f7f..71ef1640db5a 100644
@@ -1389,17 +1389,24 @@ int pdc_iodc_getc(void)
 }
 
 int pdc_sti_call(unsigned long func, unsigned long flags,
-                 unsigned long inptr, unsigned long outputr,
-                 unsigned long glob_cfg)
+		unsigned long inptr, unsigned long outputr,
+		unsigned long glob_cfg, int do_call64)
 {
-        int retval;
+	int retval = 0;
 	unsigned long irqflags;
 
-        spin_lock_irqsave(&pdc_lock, irqflags);
-        retval = real32_call(func, flags, inptr, outputr, glob_cfg);
-        spin_unlock_irqrestore(&pdc_lock, irqflags);
+	spin_lock_irqsave(&pdc_lock, irqflags);
+	if (IS_ENABLED(CONFIG_64BIT) && do_call64) {
+#ifdef CONFIG_64BIT
+		retval = real64_call(func, flags, inptr, outputr, glob_cfg);
+#else
+		WARN_ON(1);
+#endif
+	} else
+		retval = real32_call(func, flags, inptr, outputr, glob_cfg);
+	spin_unlock_irqrestore(&pdc_lock, irqflags);
 
-        return retval;
+	return retval;
 }
 EXPORT_SYMBOL(pdc_sti_call);
 
drivers/video/sticore.c +1 -1
index 7eb925f2ba9c..60ba3ab5b6cc 100644
@@ -1142,7 +1142,7 @@ int sti_call(const struct sti_struct *sti, unsigned long func,
 		return -1;
 #endif
 
-	ret = pdc_sti_call(func, _flags, _inptr, _outptr, _glob_cfg);
+	ret = pdc_sti_call(func, _flags, _inptr, _outptr, _glob_cfg, 0);
 
 	return ret;
 }

--
2.40.1

author maintainer
#2 lore raw

PATCH 2/2 sticon/parisc: Fix STI console on 64-bit only machines

In reply to Helge Deller

Fix the STI console to be able to execute either the 64-bit STI ROM code or the 32-bit STI ROM code.

This is necessary on 64-bit only machines (e.g. C8000 workstation) which otherwise won't show the STI text console with HP graphic cards like Visualize-FX5/FX10/FXe.

Note that when calling 32-bit code from a 64-bit kernel one needs to copy contents on the CPU stack from high memory down below the 4GB limit.

---
 drivers/video/fbdev/stifb.c |   4 +-
 drivers/video/sticore.c     | 159 +++++++++++++++++++++++-------------
 include/video/sticore.h     |  42 +++++-----
 3 files changed, 127 insertions(+), 78 deletions(-)
drivers/video/fbdev/stifb.c +2 -2
index 01363dccfdaf..7b3b954b266d 100644
@@ -71,9 +71,9 @@
 
 #include <video/sticore.h>
 
-/* REGION_BASE(fb_info, index) returns the virtual address for region <index> */
+/* REGION_BASE(fb_info, index) returns the physical address for region <index> */
 #define REGION_BASE(fb_info, index) \
-	F_EXTEND(fb_info->sti->glob_cfg->region_ptrs[index])
+	F_EXTEND(fb_info->sti->regions_phys[index])
 
 #define NGLEDEVDEPROM_CRT_REGION 1
 
drivers/video/sticore.c +104 -55

319 lines not on this page · raw message

include/video/sticore.h +21 -21

146 lines not on this page · raw message

--
2.40.1