Skip to contentSkip to conversation

Fix vgacon oops on 64-bit

PATCH In review Matt Porter 2 participants 3 messages Jan 30, 2006 – Jan 31, 2006 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix vgacon oops on 64-bit

Although I'm not running a VGA card, I noticed this building a working malta 32-bit defconfig (vgacon enabled) for 64-bit. Without it, the vgacon probe will access unmapped space when looking to see if a vga card is present.

include/asm-mips/vga.h +4 -0
index ca5cec9..1390ab6 100644
@@ -13,7 +13,11 @@
  *	access the videoram directly without any black magic.
  */
 
+#ifdef CONFIG_64BIT
+#define VGA_MAP_MEM(x)	(0xffffffffb0000000UL + (unsigned long)(x))
+#else
 #define VGA_MAP_MEM(x)	(0xb0000000L + (unsigned long)(x))
+#endif
 
 #define vga_readb(x)	(*(x))
 #define vga_writeb(x,y)	(*(y) = (x))
#1 lore raw
Quoted 12 lines · Matt Porter

Although I'm not running a VGA card, I noticed this building a working malta 32-bit defconfig (vgacon enabled) for 64-bit. Without it, the vgacon probe will access unmapped space when looking to see if a vga card is present.

include/asm-mips/vga.h +0 -0
index ca5cec9..1390ab6 100644

include/asm-mips/vga.h line 20

Quoted 8 lines
include/asm-mips/vga.h +4 -0
@@ -13,7 +13,11 @@
  *	access the videoram directly without any black magic.
  */
 
+#ifdef CONFIG_64BIT
+#define VGA_MAP_MEM(x)	(0xffffffffb0000000UL + (unsigned long)(x))
+#else
 #define VGA_MAP_MEM(x)	(0xb0000000L + (unsigned long)(x))
+#endif

Looks like driving out the devil with beelzebub. The 0xb0000000 address is totally platform specific and nobody ever noticed ...

Ralf

#2 lore raw
Quoted 9 lines · Ralf Baechle

Review

Quoted 5 lines · Matt Porter
(quoted diff) +4 -0
+#ifdef CONFIG_64BIT
+#define VGA_MAP_MEM(x)	(0xffffffffb0000000UL + (unsigned long)(x))
+#else
 #define VGA_MAP_MEM(x)	(0xb0000000L + (unsigned long)(x))
+#endif

Looks like driving out the devil with beelzebub. The 0xb0000000 address is totally platform specific and nobody ever noticed ...

Ok, added a platform dependent hook that the setup code can configure appropriately.

arch/mips/kernel/setup.c +4 -0
index d86affa..5e01f53 100644
@@ -51,6 +51,10 @@ EXPORT_SYMBOL(cpu_data);
 struct screen_info screen_info;
 #endif
 
+#ifdef CONFIG_VGA_CONSOLE
+unsigned long vgacon_remap_base;
+#endif
+
 /*
  * Despite it's name this variable is even if we don't have PCI
  */
arch/mips/mips-boards/malta/malta_setup.c +9 -0
index 2209e8a..b344095 100644
@@ -42,6 +42,9 @@
 #ifdef CONFIG_VT
 #include <linux/console.h>
 #endif
+#ifdef CONFIG_VGA_CONSOLE
+#include <asm/vga.h>
+#endif
 
 extern void mips_reboot_setup(void);
 extern void mips_time_init(void);
@@ -210,6 +213,12 @@ void __init plat_setup(void)
 		VIDEO_TYPE_VGAC,	/* orig-video-isVGA */
 		16			/* orig-video-points */
 	};
+
+#ifdef CONFIG_64BIT
+	vgacon_remap_base = 0xffffffffb0000000;
+#else
+	vgacon_remap_base = 0xb0000000;
+#endif
 #endif
 #endif
 
include/asm-mips/vga.h +3 -1
index ca5cec9..2bedca2 100644
@@ -13,7 +13,9 @@
  *	access the videoram directly without any black magic.
  */
 
-#define VGA_MAP_MEM(x)	(0xb0000000L + (unsigned long)(x))
+extern unsigned long vgacon_remap_base;
+
+#define VGA_MAP_MEM(x)	(vgacon_remap_base + (unsigned long)(x))
 
 #define vga_readb(x)	(*(x))
 #define vga_writeb(x,y)	(*(y) = (x))