X-Sender: ddkilzer@mail.earthlink.net
X-Files: Sundays at 8 PM CDT on Fox!
Date: Mon, 24 Aug 1998 00:42:25 -0500
To: Linux-m68k Mailing List <linux-m68k@lists.linux-m68k.org>
From: "David D. Kilzer" <ddkilzer@earthlink.net>
Subject: L68K: Patch for m68k-machine-independent halt and power_off functions
Sender: owner-linux-m68k@phil.uni-sb.de

Hi,

I recently discovered the magic code required to reboot and to power-off 
the newer Macintosh computers (you send special packets to the ADB).  In 
order to accomplish this, I must call code from machine_restart(), 
machine_halt() and machine_power_off() that is specific to the Macintosh 
port.

The machine_restart() already provides mach_reset() as an m68k-specific 
function, so the patch below extends this functionality to include 
mach_halt() and mach_power_off().

The patch was made against 2.1.105.

Is this the correct way to do this?

Thanks!

Dave


diff -u linux-2.1.105/arch/m68k/kernel/process.c.cln linux-2.1.105/arch/m68k/kernel/process.c
--- linux-2.1.105/arch/m68k/kernel/process.c.cln	Wed Mar 18 10:02:25 1998
+++ linux-2.1.105/arch/m68k/kernel/process.c	Mon Aug 24 00:02:11 1998
@@ -90,6 +90,8 @@
 
 void machine_halt(void)
 {
+	if (mach_halt)
+		mach_halt();
 }
 
 void machine_power_off(void)
@@ -97,6 +99,9 @@
 #if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF)
 	apm_set_power_state(APM_STATE_OFF);
 #endif
+
+	if (mach_power_off)
+		mach_power_off();
 }
 
 void show_regs(struct pt_regs * regs)
diff -u linux-2.1.105/arch/m68k/kernel/setup.c.cln linux-2.1.105/arch/m68k/kernel/setup.c
--- linux-2.1.105/arch/m68k/kernel/setup.c.cln	Sun Jul 12 22:26:52 1998
+++ linux-2.1.105/arch/m68k/kernel/setup.c	Mon Aug 24 00:03:08 1998
@@ -76,6 +76,8 @@
 int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
 int (*mach_set_clock_mmss) (unsigned long) = NULL;
 void (*mach_reset)( void );
+void (*mach_halt)( void ) = NULL;
+void (*mach_power_off)( void ) = NULL;
 long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
 #if defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY)
 void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
diff -u linux-2.1.105/include/asm-m68k/machdep.h.cln linux-2.1.105/include/asm-m68k/machdep.h
--- linux-2.1.105/include/asm-m68k/machdep.h.cln	Sun Jul 12 22:26:59 1998
+++ linux-2.1.105/include/asm-m68k/machdep.h	Mon Aug 24 00:08:55 1998
@@ -31,6 +31,8 @@
 extern int (*mach_hwclk)(int, struct hwclk_time*);
 extern int (*mach_set_clock_mmss)(unsigned long);
 extern void (*mach_reset)( void );
+extern void (*mach_halt)( void );
+extern void (*mach_power_off)( void );
 extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
 extern void (*mach_hd_setup)(char *, int *);
 extern long mach_max_dma_address;

--
David D. Kilzer
ddkilzer@earthlink.net


