blob: d1b5c913ae724d4a4f794d0590e263d305a4a58a [file] [log] [blame]
Chris Metcalf867e3592010-05-28 23:09:12 -04001/*
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 Metcalf0707ad32010-06-25 17:04:17 -040018#include <linux/pm.h>
Chris Metcalf7c63e1e2013-02-01 15:06:06 -050019#include <linux/export.h>
Chris Metcalf867e3592010-05-28 23:09:12 -040020#include <asm/page.h>
21#include <asm/setup.h>
22#include <hv/hypervisor.h>
23
24#ifndef CONFIG_SMP
25#define smp_send_stop()
26#endif
27
28void machine_halt(void)
29{
30 warn_early_printk();
Chris Metcalf5d966112010-11-01 15:24:29 -040031 arch_local_irq_disable_all();
Chris Metcalf867e3592010-05-28 23:09:12 -040032 smp_send_stop();
33 hv_halt();
34}
35
36void machine_power_off(void)
37{
38 warn_early_printk();
Chris Metcalf5d966112010-11-01 15:24:29 -040039 arch_local_irq_disable_all();
Chris Metcalf867e3592010-05-28 23:09:12 -040040 smp_send_stop();
41 hv_power_off();
42}
43
44void machine_restart(char *cmd)
45{
Chris Metcalf5d966112010-11-01 15:24:29 -040046 arch_local_irq_disable_all();
Chris Metcalf867e3592010-05-28 23:09:12 -040047 smp_send_stop();
48 hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
49}
50
Chris Metcalf0707ad32010-06-25 17:04:17 -040051/* No interesting distinction to be made here. */
52void (*pm_power_off)(void) = NULL;
Chris Metcalf7c63e1e2013-02-01 15:06:06 -050053EXPORT_SYMBOL(pm_power_off);