Skip to contentSkip to conversation

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

PATCH New Helge Deller 1 participant 1 message May 10, 2023

Subsystems (2)
lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH v4 1/1 console/parisc: Fix STI console on 64-bit only machines

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.

When calling 32-bit code from a 64-bit kernel one may need to copy contents on the CPU stack from high memory down below the 4GB limit.

---
 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(-)

v4: resend to avoid merge conflicts, no code changes
v3: Fix check for overflow of 32-bit pointers
v2: Forward-ported to apply cleanly on drm-misc-next git tree

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/fbdev/stifb.c +2 -2
index baca6974e288..fe54ca8726e6 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.38.1