Skip to contentSkip to conversation

KSEG/CKSEG fixes

PATCH In review Tom Rini 3 participants 5 messages Oct 21, 2004 – Oct 22, 2004

Subsystems (2)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 KSEG/CKSEG fixes

The following is needed to get an SB1250 to compile & boot in 64bit mode (briefly tested).

arch/mips/sibyte/sb1250/irq_handler.S +6 -1
@@ -121,9 +121,14 @@
 	/*
 	 * Default...we've hit an IP[2] interrupt, which means we've got to
 	 * check the 1250 interrupt registers to figure out what to do
-	 * Need to detect which CPU we're on, now that smp_affinity is supported.
+	 * Need to detect which CPU we're on, now that smp_affinity is
+	 * supported.
 	 */
+#ifdef CONFIG_MIPS64
+	PTR_LA	v0, CKSEG1 + A_IMR_CPU0_BASE
+#else
 	PTR_LA	v0, KSEG1 + A_IMR_CPU0_BASE
+#endif
 #ifdef CONFIG_SMP
 	lw	t1, TI_CPU($28)
 	sll	t1, IMR_REGISTER_SPACING_SHIFT
arch/mips/mm/c-sb1.c +4 -0
@@ -488,7 +488,11 @@ void ld_mmu_sb1(void)
 	/* Special cache error handler for SB1 */
 	memcpy((void *)(CAC_BASE   + 0x100), &except_vec2_sb1, 0x80);
 	memcpy((void *)(UNCAC_BASE + 0x100), &except_vec2_sb1, 0x80);
+#ifdef CONFIG_MIPS64
+	memcpy((void *)CKSEG1ADDR(&handle_vec2_sb1), &handle_vec2_sb1, 0x80);
+#else
 	memcpy((void *)KSEG1ADDR(&handle_vec2_sb1), &handle_vec2_sb1, 0x80);
+#endif
 
 	probe_cache_sizes();
 
drivers/net/sb1250-mac.c +5 -0
@@ -2879,8 +2879,13 @@ sbmac_init_module(void)
 		dev->mem_end = 0;
 		if (sbmac_init(dev, idx)) {
 			port = A_MAC_CHANNEL_BASE(idx);
+#ifdef CONFIG_MIPS64
+			SBMAC_WRITECSR(CKSEG1ADDR(port+R_MAC_ETHERNET_ADDR),
+					sbmac_orig_hwaddr[idx] );
+#else
 			SBMAC_WRITECSR(KSEG1ADDR(port+R_MAC_ETHERNET_ADDR),
 					sbmac_orig_hwaddr[idx] );
+#endif
 			free_netdev(dev);
 			continue;
 		}
arch/mips/mm/tlb-sb1.c +2 -2
@@ -26,14 +26,14 @@
 #ifdef CONFIG_MIPS32
 extern void except_vec0_sb1(void);
 extern void except_vec1_generic(void);
+#define UNIQUE_ENTRYHI(idx) (KSEG0 + ((idx) << (PAGE_SHIFT + 1)))
 #endif
 #ifdef CONFIG_MIPS64
 extern void except_vec0_generic(void);
 extern void except_vec1_sb1(void);
+#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
 #endif
 
-#define UNIQUE_ENTRYHI(idx) (KSEG0 + ((idx) << (PAGE_SHIFT + 1)))
-
 /* Dump the current entry* and pagemask registers */
 static inline void dump_cur_tlb_regs(void)
 {
Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#1 lore raw
Quoted 8 lines · Tom Rini

The following is needed to get an SB1250 to compile & boot in 64bit mode (briefly tested).

arch/mips/mm/c-sb1.c void ld_mmu_sb1(void) · line 495

Quoted 8 lines
arch/mips/mm/c-sb1.c +4 -0
@@ -488,7 +488,11 @@ void ld_mmu_sb1(void)
 	/* Special cache error handler for SB1 */
 	memcpy((void *)(CAC_BASE   + 0x100), &except_vec2_sb1, 0x80);
 	memcpy((void *)(UNCAC_BASE + 0x100), &except_vec2_sb1, 0x80);
+#ifdef CONFIG_MIPS64
+	memcpy((void *)CKSEG1ADDR(&handle_vec2_sb1), &handle_vec2_sb1, 0x80);
+#else
 	memcpy((void *)KSEG1ADDR(&handle_vec2_sb1), &handle_vec2_sb1, 0x80);
+#endif

I don't think this is best solution. Thomas Bogendoerfer messed with KSEG/CKSEG definitions recently and idea is to create board specific header file spaces.h

ladis

author
#2 lore raw
Quoted 6 lines · Ladislav Michl
Quoted 5 lines · Tom Rini

The following is needed to get an SB1250 to compile & boot in 64bit mode (briefly tested).

Quoted 15 lines

arch/mips/mm/c-sb1.c void ld_mmu_sb1(void) · line 495

Quoted 11 lines
arch/mips/mm/c-sb1.c +4 -0
@@ -488,7 +488,11 @@ void ld_mmu_sb1(void)
 	/* Special cache error handler for SB1 */
 	memcpy((void *)(CAC_BASE   + 0x100), &except_vec2_sb1, 0x80);
 	memcpy((void *)(UNCAC_BASE + 0x100), &except_vec2_sb1, 0x80);
+#ifdef CONFIG_MIPS64
+	memcpy((void *)CKSEG1ADDR(&handle_vec2_sb1), &handle_vec2_sb1, 0x80);
+#else
 	memcpy((void *)KSEG1ADDR(&handle_vec2_sb1), &handle_vec2_sb1, 0x80);
+#endif

I don't think this is best solution. Thomas Bogendoerfer messed with KSEG/CKSEG definitions recently and idea is to create board specific header file spaces.h

Would this include abstracting the notion of KSEG1/CKSEG1 into something where one name would get the right var on 32 or 64 ? If so, is this in CVS now? If not, wouldn't it make sense to put this in now and convert it when the changes do go in?

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#3 lore raw
Quoted 4 lines · Tom Rini

Would this include abstracting the notion of KSEG1/CKSEG1 into something where one name would get the right var on 32 or 64 ? If so, is this in CVS now? If not, wouldn't it make sense to put this in now and convert it when the changes do go in?

The plan was to use K0BASE / K1BASE and define them as appropriate for a platform. KSEG0 / KSEG1 / KSEG2 would always be 32-bit constants and CKSEG0/1/2 always 64-bit. Somebody recently screwed the latter with a checkin.

Ralf

author
#4 lore raw
Quoted 11 lines · Ralf Baechle
Quoted 4 lines · Tom Rini

Would this include abstracting the notion of KSEG1/CKSEG1 into something where one name would get the right var on 32 or 64 ? If so, is this in CVS now? If not, wouldn't it make sense to put this in now and convert it when the changes do go in?

The plan was to use K0BASE / K1BASE and define them as appropriate for a platform. KSEG0 / KSEG1 / KSEG2 would always be 32-bit constants and CKSEG0/1/2 always 64-bit. Somebody recently screwed the latter with a checkin.

Ah, that makes sense. I'll wait for it to show up in HEAD.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/