Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * xen-stub.c - stub drivers to reserve space for Xen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 2012 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *    Author: Liu Jinsong <jinsong.liu@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *    Author: Jiang Yunhong <yunhong.jiang@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * Copyright (C) 2012 Oracle Inc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *    Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <xen/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #ifdef CONFIG_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /*--------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	stub driver for Xen memory hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) --------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static const struct acpi_device_id memory_device_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	{ACPI_MEMORY_DEVICE_HID, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	{"", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static struct acpi_driver xen_stub_memory_device_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	/* same name as native memory driver to block native loaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	.name = "acpi_memhotplug",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	.class = ACPI_MEMORY_DEVICE_CLASS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	.ids = memory_device_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int xen_stub_memory_device_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	if (!xen_initial_domain())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	/* just reserve space for Xen, block native driver loaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	return acpi_bus_register_driver(&xen_stub_memory_device_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) EXPORT_SYMBOL_GPL(xen_stub_memory_device_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) subsys_initcall(xen_stub_memory_device_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void xen_stub_memory_device_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	acpi_bus_unregister_driver(&xen_stub_memory_device_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) EXPORT_SYMBOL_GPL(xen_stub_memory_device_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /*--------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	stub driver for Xen cpu hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) --------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static const struct acpi_device_id processor_device_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	{ACPI_PROCESSOR_OBJECT_HID, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	{ACPI_PROCESSOR_DEVICE_HID, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	{"", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) static struct acpi_driver xen_stub_processor_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	/* same name as native processor driver to block native loaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	.name = "processor",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	.class = ACPI_PROCESSOR_CLASS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	.ids = processor_device_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) int xen_stub_processor_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	if (!xen_initial_domain())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	/* just reserve space for Xen, block native driver loaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	return acpi_bus_register_driver(&xen_stub_processor_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) EXPORT_SYMBOL_GPL(xen_stub_processor_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) subsys_initcall(xen_stub_processor_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) void xen_stub_processor_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 	acpi_bus_unregister_driver(&xen_stub_processor_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) EXPORT_SYMBOL_GPL(xen_stub_processor_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #endif