| Chris Metcalf | 867e359 | 2010-05-28 23:09:12 -0400 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | 
|  | 3 | * | 
|  | 4 | *   This program is free software; you can redistribute it and/or | 
|  | 5 | *   modify it under the terms of the GNU General Public License | 
|  | 6 | *   as published by the Free Software Foundation, version 2. | 
|  | 7 | * | 
|  | 8 | *   This program is distributed in the hope that it will be useful, but | 
|  | 9 | *   WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 10 | *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | 
|  | 11 | *   NON INFRINGEMENT.  See the GNU General Public License for | 
|  | 12 | *   more details. | 
|  | 13 | */ | 
|  | 14 |  | 
|  | 15 | #include <linux/stddef.h> | 
|  | 16 | #include <linux/reboot.h> | 
|  | 17 | #include <linux/smp.h> | 
| Chris Metcalf | 0707ad3 | 2010-06-25 17:04:17 -0400 | [diff] [blame] | 18 | #include <linux/pm.h> | 
| Chris Metcalf | 867e359 | 2010-05-28 23:09:12 -0400 | [diff] [blame] | 19 | #include <asm/page.h> | 
|  | 20 | #include <asm/setup.h> | 
|  | 21 | #include <hv/hypervisor.h> | 
|  | 22 |  | 
|  | 23 | #ifndef CONFIG_SMP | 
|  | 24 | #define smp_send_stop() | 
|  | 25 | #endif | 
|  | 26 |  | 
|  | 27 | void machine_halt(void) | 
|  | 28 | { | 
|  | 29 | warn_early_printk(); | 
| Chris Metcalf | 5d96611 | 2010-11-01 15:24:29 -0400 | [diff] [blame] | 30 | arch_local_irq_disable_all(); | 
| Chris Metcalf | 867e359 | 2010-05-28 23:09:12 -0400 | [diff] [blame] | 31 | smp_send_stop(); | 
|  | 32 | hv_halt(); | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | void machine_power_off(void) | 
|  | 36 | { | 
|  | 37 | warn_early_printk(); | 
| Chris Metcalf | 5d96611 | 2010-11-01 15:24:29 -0400 | [diff] [blame] | 38 | arch_local_irq_disable_all(); | 
| Chris Metcalf | 867e359 | 2010-05-28 23:09:12 -0400 | [diff] [blame] | 39 | smp_send_stop(); | 
|  | 40 | hv_power_off(); | 
|  | 41 | } | 
|  | 42 |  | 
|  | 43 | void machine_restart(char *cmd) | 
|  | 44 | { | 
| Chris Metcalf | 5d96611 | 2010-11-01 15:24:29 -0400 | [diff] [blame] | 45 | arch_local_irq_disable_all(); | 
| Chris Metcalf | 867e359 | 2010-05-28 23:09:12 -0400 | [diff] [blame] | 46 | smp_send_stop(); | 
|  | 47 | hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd); | 
|  | 48 | } | 
|  | 49 |  | 
| Chris Metcalf | 0707ad3 | 2010-06-25 17:04:17 -0400 | [diff] [blame] | 50 | /* No interesting distinction to be made here. */ | 
|  | 51 | void (*pm_power_off)(void) = NULL; |