aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/apm.c3
-rw-r--r--arch/i386/kernel/reboot.c43
-rw-r--r--include/asm-i386/reboot.h20
3 files changed, 59 insertions, 7 deletions
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 4d073d390715..367ff1d930cb 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -233,11 +233,10 @@
233#include <asm/desc.h> 233#include <asm/desc.h>
234#include <asm/i8253.h> 234#include <asm/i8253.h>
235#include <asm/paravirt.h> 235#include <asm/paravirt.h>
236#include <asm/reboot.h>
236 237
237#include "io_ports.h" 238#include "io_ports.h"
238 239
239extern void machine_real_restart(unsigned char *, int);
240
241#if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT) 240#if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
242extern int (*console_blank_hook)(int); 241extern int (*console_blank_hook)(int);
243#endif 242#endif
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c
index 8b5ff6e15412..14b4de2882be 100644
--- a/arch/i386/kernel/reboot.c
+++ b/arch/i386/kernel/reboot.c
@@ -18,6 +18,7 @@
18#include <asm/desc.h> 18#include <asm/desc.h>
19#include "mach_reboot.h" 19#include "mach_reboot.h"
20#include <asm/reboot_fixups.h> 20#include <asm/reboot_fixups.h>
21#include <asm/reboot.h>
21 22
22/* 23/*
23 * Power off function, if any 24 * Power off function, if any
@@ -280,7 +281,7 @@ void machine_real_restart(unsigned char *code, int length)
280EXPORT_SYMBOL(machine_real_restart); 281EXPORT_SYMBOL(machine_real_restart);
281#endif 282#endif
282 283
283void machine_shutdown(void) 284static void native_machine_shutdown(void)
284{ 285{
285#ifdef CONFIG_SMP 286#ifdef CONFIG_SMP
286 int reboot_cpu_id; 287 int reboot_cpu_id;
@@ -320,7 +321,7 @@ void __attribute__((weak)) mach_reboot_fixups(void)
320{ 321{
321} 322}
322 323
323void machine_emergency_restart(void) 324static void native_machine_emergency_restart(void)
324{ 325{
325 if (!reboot_thru_bios) { 326 if (!reboot_thru_bios) {
326 if (efi_enabled) { 327 if (efi_enabled) {
@@ -344,17 +345,17 @@ void machine_emergency_restart(void)
344 machine_real_restart(jump_to_bios, sizeof(jump_to_bios)); 345 machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
345} 346}
346 347
347void machine_restart(char * __unused) 348static void native_machine_restart(char * __unused)
348{ 349{
349 machine_shutdown(); 350 machine_shutdown();
350 machine_emergency_restart(); 351 machine_emergency_restart();
351} 352}
352 353
353void machine_halt(void) 354static void native_machine_halt(void)
354{ 355{
355} 356}
356 357
357void machine_power_off(void) 358static void native_machine_power_off(void)
358{ 359{
359 if (pm_power_off) { 360 if (pm_power_off) {
360 machine_shutdown(); 361 machine_shutdown();
@@ -363,3 +364,35 @@ void machine_power_off(void)
363} 364}
364 365
365 366
367struct machine_ops machine_ops = {
368 .power_off = native_machine_power_off,
369 .shutdown = native_machine_shutdown,
370 .emergency_restart = native_machine_emergency_restart,
371 .restart = native_machine_restart,
372 .halt = native_machine_halt,
373};
374
375void machine_power_off(void)
376{
377 machine_ops.power_off();
378}
379
380void machine_shutdown(void)
381{
382 machine_ops.shutdown();
383}
384
385void machine_emergency_restart(void)
386{
387 machine_ops.emergency_restart();
388}
389
390void machine_restart(char *cmd)
391{
392 machine_ops.restart(cmd);
393}
394
395void machine_halt(void)
396{
397 machine_ops.halt();
398}
diff --git a/include/asm-i386/reboot.h b/include/asm-i386/reboot.h
new file mode 100644
index 000000000000..e9e3ffc22c07
--- /dev/null
+++ b/include/asm-i386/reboot.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_REBOOT_H
2#define _ASM_REBOOT_H
3
4struct pt_regs;
5
6struct machine_ops
7{
8 void (*restart)(char *cmd);
9 void (*halt)(void);
10 void (*power_off)(void);
11 void (*shutdown)(void);
12 void (*crash_shutdown)(struct pt_regs *);
13 void (*emergency_restart)(void);
14};
15
16extern struct machine_ops machine_ops;
17
18void machine_real_restart(unsigned char *code, int length);
19
20#endif /* _ASM_REBOOT_H */