/******************************************************************************1* acpi.h2* acpi file for domain 0 kernel3*4* Copyright (c) 2011 Konrad Rzeszutek Wilk <[email protected]>5* Copyright (c) 2011 Yu Ke <[email protected]>6*7* This program is free software; you can redistribute it and/or8* modify it under the terms of the GNU General Public License version 29* as published by the Free Software Foundation; or, when distributed10* separately from the Linux kernel or incorporated into other11* software packages, subject to the following license:12*13* Permission is hereby granted, free of charge, to any person obtaining a copy14* of this source file (the "Software"), to deal in the Software without15* restriction, including without limitation the rights to use, copy, modify,16* merge, publish, distribute, sublicense, and/or sell copies of the Software,17* and to permit persons to whom the Software is furnished to do so, subject to18* the following conditions:19*20* The above copyright notice and this permission notice shall be included in21* all copies or substantial portions of the Software.22*23* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR24* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,25* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE26* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER27* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING28* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS29* IN THE SOFTWARE.30*/3132#ifndef _XEN_ACPI_H33#define _XEN_ACPI_H3435#include <linux/types.h>3637typedef int (*get_gsi_from_sbdf_t)(u32 sbdf);3839#ifdef CONFIG_XEN_DOM040#include <asm/xen/hypervisor.h>41#include <xen/xen.h>42#include <linux/acpi.h>4344int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,45u32 pm1a_cnt, u32 pm1b_cnd);46int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,47u32 val_a, u32 val_b);4849static inline int xen_acpi_suspend_lowlevel(void)50{51/*52* Xen will save and restore CPU context, so53* we can skip that and just go straight to54* the suspend.55*/56acpi_enter_sleep_state(ACPI_STATE_S3);57return 0;58}5960static inline void xen_acpi_sleep_register(void)61{62if (xen_initial_domain()) {63acpi_os_set_prepare_sleep(64&xen_acpi_notify_hypervisor_sleep);65acpi_os_set_prepare_extended_sleep(66&xen_acpi_notify_hypervisor_extended_sleep);6768acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;69}70}71int xen_pvh_setup_gsi(int gsi, int trigger, int polarity);72int xen_acpi_get_gsi_info(struct pci_dev *dev,73int *gsi_out,74int *trigger_out,75int *polarity_out);76void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func);77int xen_acpi_get_gsi_from_sbdf(u32 sbdf);78#else79static inline void xen_acpi_sleep_register(void)80{81}8283static inline int xen_pvh_setup_gsi(int gsi, int trigger, int polarity)84{85return -1;86}8788static inline int xen_acpi_get_gsi_info(struct pci_dev *dev,89int *gsi_out,90int *trigger_out,91int *polarity_out)92{93return -1;94}9596static inline void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func)97{98}99100static inline int xen_acpi_get_gsi_from_sbdf(u32 sbdf)101{102return -1;103}104#endif105106#endif /* _XEN_ACPI_H */107108109