Merge tag 'iwlwifi-next-for-kalle-2014-12-30' of https://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / drivers / xen / xen-stub.c
1 /*
2  * xen-stub.c - stub drivers to reserve space for Xen
3  *
4  * Copyright (C) 2012 Intel Corporation
5  *    Author: Liu Jinsong <jinsong.liu@intel.com>
6  *    Author: Jiang Yunhong <yunhong.jiang@intel.com>
7  *
8  * Copyright (C) 2012 Oracle Inc
9  *    Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or (at
14  * your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
19  * NON INFRINGEMENT.  See the GNU General Public License for more
20  * details.
21  */
22
23 #include <linux/kernel.h>
24 #include <linux/init.h>
25 #include <linux/export.h>
26 #include <linux/types.h>
27 #include <linux/acpi.h>
28 #include <xen/acpi.h>
29
30 #ifdef CONFIG_ACPI
31
32 /*--------------------------------------------
33         stub driver for Xen memory hotplug
34 --------------------------------------------*/
35
36 static const struct acpi_device_id memory_device_ids[] = {
37         {ACPI_MEMORY_DEVICE_HID, 0},
38         {"", 0},
39 };
40
41 static struct acpi_driver xen_stub_memory_device_driver = {
42         /* same name as native memory driver to block native loaded */
43         .name = "acpi_memhotplug",
44         .class = ACPI_MEMORY_DEVICE_CLASS,
45         .ids = memory_device_ids,
46 };
47
48 int xen_stub_memory_device_init(void)
49 {
50         if (!xen_initial_domain())
51                 return -ENODEV;
52
53         /* just reserve space for Xen, block native driver loaded */
54         return acpi_bus_register_driver(&xen_stub_memory_device_driver);
55 }
56 EXPORT_SYMBOL_GPL(xen_stub_memory_device_init);
57 subsys_initcall(xen_stub_memory_device_init);
58
59 void xen_stub_memory_device_exit(void)
60 {
61         acpi_bus_unregister_driver(&xen_stub_memory_device_driver);
62 }
63 EXPORT_SYMBOL_GPL(xen_stub_memory_device_exit);
64
65
66 /*--------------------------------------------
67         stub driver for Xen cpu hotplug
68 --------------------------------------------*/
69
70 static const struct acpi_device_id processor_device_ids[] = {
71         {ACPI_PROCESSOR_OBJECT_HID, 0},
72         {ACPI_PROCESSOR_DEVICE_HID, 0},
73         {"", 0},
74 };
75
76 static struct acpi_driver xen_stub_processor_driver = {
77         /* same name as native processor driver to block native loaded */
78         .name = "processor",
79         .class = ACPI_PROCESSOR_CLASS,
80         .ids = processor_device_ids,
81 };
82
83 int xen_stub_processor_init(void)
84 {
85         if (!xen_initial_domain())
86                 return -ENODEV;
87
88         /* just reserve space for Xen, block native driver loaded */
89         return acpi_bus_register_driver(&xen_stub_processor_driver);
90 }
91 EXPORT_SYMBOL_GPL(xen_stub_processor_init);
92 subsys_initcall(xen_stub_processor_init);
93
94 void xen_stub_processor_exit(void)
95 {
96         acpi_bus_unregister_driver(&xen_stub_processor_driver);
97 }
98 EXPORT_SYMBOL_GPL(xen_stub_processor_exit);
99
100 #endif