Skip to contentSkip to conversation

SH: add machine-ops and Dreamcast specific fix-up

PATCH In review Adrian McMenamin 3 participants 4 messages Aug 3, 2007 – Aug 4, 2007 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SH: add machine-ops and Dreamcast specific fix-up

(This code is closely modelled on the i386 machine-ops, though currently the only board specific fixup is for the Dreamcast and so there is not a separate set of mach fixups.)

This needs to be tested against a wide range of SH boards and would be good to go in -mm if Paul acks it.

Add machine-ops code to the SH code base, allowing board specific reboot and halt code. Currently only Dreamcast specific warm reboot fixup in code.

Signed-off by: Adrian McMenamin <[email protected]>

(quoted diff) +0 -0

b/arch/sh/boards/dreamcast/Makefile
index e6fcd3d..7b97546 100644

arch/sh/boards/dreamcast/Makefile +1 -1
@@ -2,5 +2,5 @@
 # Makefile for the Sega Dreamcast specific parts of the kernel
 #
 
-obj-y	 := setup.o irq.o rtc.o reboot.o
+obj-y	 := setup.o irq.o rtc.o
 
arch/sh/kernel/Makefile +1 -5
index bdb30ba..7ab2359 100644
@@ -5,15 +5,11 @@
 extra-y	:= head.o init_task.o vmlinux.lds
 
 obj-y	:= debugtraps.o io.o io_generic.o irq.o machvec.o process.o ptrace.o \
-	   semaphore.o setup.o signal.o sys_sh.o syscalls.o \
+	   reboot.o semaphore.o setup.o signal.o sys_sh.o syscalls.o \
 	   time.o topology.o traps.o
 
 obj-y				+= cpu/ timers/
 
-ifneq ($(CONFIG_SH_DREAMCAST),y)
-	obj-y			+= reboot.o
-endif
-
 obj-$(CONFIG_VSYSCALL)		+= vsyscall/
 
 obj-$(CONFIG_SMP)		+= smp.o
arch/sh/kernel/machine_kexec.c +0 -3
index 790ed69..201b370 100644
@@ -29,9 +29,6 @@ extern const unsigned char relocate_new_kernel[];
 extern const unsigned int relocate_new_kernel_size;
 extern void *gdb_vbr_vector;
 
-void machine_shutdown(void)
-{
-}
 
 void machine_crash_shutdown(struct pt_regs *regs)
 {
arch/sh/kernel/reboot.c new file +107 -0

107 lines not on this page · raw message

(quoted diff) +0 -0

b/include/asm-sh/emergency-restart.h
index 108d8c4..d6bec92 100644

include/asm-sh/emergency-restart.h +4 -4
@@ -1,6 +1,6 @@
-#ifndef _ASM_EMERGENCY_RESTART_H
-#define _ASM_EMERGENCY_RESTART_H
+#ifndef _ASM_SH_EMERGENCY_RESTART_H
+#define _ASM_SH_EMERGENCY_RESTART_H
 
-#include <asm-generic/emergency-restart.h>
+extern void machine_emergency_restart(void);
 
-#endif /* _ASM_EMERGENCY_RESTART_H */
+#endif /* _ASM_SH_EMERGENCY_RESTART_H */
#1 lore raw

arch/sh/boards/dreamcast/Makefile line 6

Quoted 12 lines · Adrian McMenamin
arch/sh/boards/dreamcast/Makefile +1 -1
index e6fcd3d..7b97546 100644
@@ -2,5 +2,5 @@
 # Makefile for the Sega Dreamcast specific parts of the kernel
 #
 
-obj-y	 := setup.o irq.o rtc.o reboot.o
+obj-y	 := setup.o irq.o rtc.o
 

You've created this diff against a bogus kernel.

Quoted 26 lines
arch/sh/kernel/Makefile +1 -5
index bdb30ba..7ab2359 100644
@@ -5,15 +5,11 @@
 extra-y	:= head.o init_task.o vmlinux.lds
 
 obj-y	:= debugtraps.o io.o io_generic.o irq.o machvec.o process.o ptrace.o \
-	   semaphore.o setup.o signal.o sys_sh.o syscalls.o \
+	   reboot.o semaphore.o setup.o signal.o sys_sh.o syscalls.o \
 	   time.o topology.o traps.o
 
 obj-y				+= cpu/ timers/
 
-ifneq ($(CONFIG_SH_DREAMCAST),y)
-	obj-y			+= reboot.o
-endif
-
 obj-$(CONFIG_VSYSCALL)		+= vsyscall/
 
 obj-$(CONFIG_SMP)		+= smp.o
arch/sh/kernel/machine_kexec.c +0 -0
index 790ed69..201b370 100644

arch/sh/kernel/machine_kexec.c extern const unsigned char relocate_new_kernel[]; · line 34

Quoted 9 lines
arch/sh/kernel/machine_kexec.c +0 -3
@@ -29,9 +29,6 @@ extern const unsigned char relocate_new_kernel[];
 extern const unsigned int relocate_new_kernel_size;
 extern void *gdb_vbr_vector;
 
-void machine_shutdown(void)
-{
-}
 
 void machine_crash_shutdown(struct pt_regs *regs)
 {

You've missed machine_crash_shutdown().

arch/sh/kernel/machine_kexec.c

Quoted 7 lines
arch/sh/kernel/machine_kexec.c +7 -0
+static void mach_reboot_fixups(void)
+{
+	if (mach_is_dreamcast()) {
+		writel(0x00007611, 0xA05F6890);
+	}
+}
+

Whether it's only the dreamcast or not is irrelevant, why bother adding abstraction if you intend to add pointless hacks that completely side-steps it?

Quoted 7 lines
include/asm-sh/emergency-restart.h +0 -0
index 108d8c4..d6bec92 100644

include/asm-sh/emergency-restart.h line 6

Quoted 10 lines
include/asm-sh/emergency-restart.h +4 -4
@@ -1,6 +1,6 @@
-#ifndef _ASM_EMERGENCY_RESTART_H
-#define _ASM_EMERGENCY_RESTART_H
+#ifndef _ASM_SH_EMERGENCY_RESTART_H
+#define _ASM_SH_EMERGENCY_RESTART_H
 
-#include <asm-generic/emergency-restart.h>
+extern void machine_emergency_restart(void);
 
-#endif /* _ASM_EMERGENCY_RESTART_H */
+#endif /* _ASM_SH_EMERGENCY_RESTART_H */

Pointless. Separating out machine_emergency_restart() buys us nothing, leave this alone and just kill it off from the machine_ops entirely. You've also ignored my earlier mail where I suggested this and killing off some of the other ops we had no use for (as well as consolidating machine_crash_shutdown()). I do wish you would read these things and wait until there's been a resolution one way or another.

#2 lore raw
Quoted 10 lines · Paul Mundt
Quoted 9 lines · Adrian McMenamin
arch/sh/boards/dreamcast/Makefile +0 -0
index e6fcd3d..7b97546 100644
@@ -2,5 +2,5 @@
 # Makefile for the Sega Dreamcast specific parts of the kernel
 #
 
Quoted 5 lines

arch/sh/boards/dreamcast/Makefile line 6

Quoted 3 lines
arch/sh/boards/dreamcast/Makefile +1 -1
-obj-y	 := setup.o irq.o rtc.o reboot.o
+obj-y	 := setup.o irq.o rtc.o
 

You've created this diff against a bogus kernel.

True. My apologies - I missed that.

Quoted 5 lines
Quoted 5 lines
arch/sh/kernel/Makefile +0 -0
index bdb30ba..7ab2359 100644

....

Quoted 6 lines
Quoted 3 lines

void machine_crash_shutdown(struct pt_regs *regs) {

You've missed machine_crash_shutdown().

Apologies - though I am a bit puzzled as why the code compiled and linked with the two definitions, but that's not much of an excuse.

Quoted 11 lines

arch/sh/kernel/Makefile

Quoted 7 lines
arch/sh/kernel/Makefile +7 -0
+static void mach_reboot_fixups(void)
+{
+	if (mach_is_dreamcast()) {
+		writel(0x00007611, 0xA05F6890);
+	}
+}
+

Whether it's only the dreamcast or not is irrelevant, why bother adding abstraction if you intend to add pointless hacks that completely side-steps it?

I don't understand the point you are trying to make. Please explain with more clarity. What have I completely side stepped? I have followed, broadly, the same pattern used in i386. Just that there, afaics, they pick up on various PCI cards as the basis on which to modify the reboot.

Quoted 14 lines
Quoted 14 lines
include/asm-sh/emergency-restart.h +3 -3
index 108d8c4..d6bec92 100644
@@ -1,6 +1,6 @@
-#ifndef _ASM_EMERGENCY_RESTART_H
-#define _ASM_EMERGENCY_RESTART_H
+#ifndef _ASM_SH_EMERGENCY_RESTART_H
+#define _ASM_SH_EMERGENCY_RESTART_H
 
-#include <asm-generic/emergency-restart.h>
+extern void machine_emergency_restart(void);
 
Quoted 9 lines

include/asm-sh/emergency-restart.h line 6

Quoted 3 lines
include/asm-sh/emergency-restart.h +1 -1
-#endif /* _ASM_EMERGENCY_RESTART_H */
+#endif /* _ASM_SH_EMERGENCY_RESTART_H */

Pointless. Separating out machine_emergency_restart() buys us nothing, leave this alone and just kill it off from the machine_ops entirely. You've also ignored my earlier mail where I suggested this and killing off some of the other ops we had no use for (as well as consolidating machine_crash_shutdown()). I do wish you would read these things and wait until there's been a resolution one way or another.

I haven't ignored it. It was just explained with your customary clarity :)

#3 lore raw
Quoted 14 lines · Adrian McMenamin
Quoted 12 lines · Paul Mundt

arch/sh/kernel/reboot.c line 41

Quoted 7 lines · Adrian McMenamin
arch/sh/kernel/reboot.c new file +7 -0
+static void mach_reboot_fixups(void)
+{
+	if (mach_is_dreamcast()) {
+		writel(0x00007611, 0xA05F6890);
+	}
+}
+

Whether it's only the dreamcast or not is irrelevant, why bother adding abstraction if you intend to add pointless hacks that completely side-steps it?

Quoted 5 lines

I don't understand the point you are trying to make. Please explain with more clarity. What have I completely side stepped? I have followed, broadly, the same pattern used in i386. Just that there, afaics, they pick up on various PCI cards as the basis on which to modify the reboot.

You've introduced infrastructure to permit different machine types to provide their own reboot hooks, and instead of actually providing a machine-specific implementation, you've just hacked the native implementation ith machine-type checks. This is conceptually no different from your previous hack of sprinkling Dreamcast hooks in process.c.

The entire point of this abstraction is so that you can push what logic you need down in to your board directory and _not_ have to shove this sort of pointless crap in to the common code.

Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
include/asm-sh/emergency-restart.h +3 -3
index 108d8c4..d6bec92 100644
@@ -1,6 +1,6 @@
-#ifndef _ASM_EMERGENCY_RESTART_H
-#define _ASM_EMERGENCY_RESTART_H
+#ifndef _ASM_SH_EMERGENCY_RESTART_H
+#define _ASM_SH_EMERGENCY_RESTART_H
 
-#include <asm-generic/emergency-restart.h>
+extern void machine_emergency_restart(void);
 
Quoted 9 lines

include/asm-sh/emergency-restart.h line 6

Quoted 3 lines
include/asm-sh/emergency-restart.h +1 -1
-#endif /* _ASM_EMERGENCY_RESTART_H */
+#endif /* _ASM_SH_EMERGENCY_RESTART_H */

Pointless. Separating out machine_emergency_restart() buys us nothing, leave this alone and just kill it off from the machine_ops entirely. You've also ignored my earlier mail where I suggested this and killing off some of the other ops we had no use for (as well as consolidating machine_crash_shutdown()). I do wish you would read these things and wait until there's been a resolution one way or another.

Quoted 2 lines

I haven't ignored it. It was just explained with your customary clarity :)

If there was something you were unclear about, perhaps you should have asked for clarification instead of ignoring it? I didn't think any of these points were terribly difficult to parse.