@@ -80,6 +80,7 @@ obj-$(CONFIG_ACPI_HED) += hed.o
obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
obj-$(CONFIG_ACPI_BGRT) += bgrt.o
+obj-$(CONFIG_IRQCHIP) += irq.o
obj-$(CONFIG_ACPI_SPCR) += acpi_spcr.o
# processor has its own "processor." module_param namespace
new file mode 100644
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, Linaro Ltd.
+ * Author: Tomasz Nowicki <tomasz.nowicki@linaro.org>
+ * Hanjun Guo <hanjun.guo@linaro.org>
+ *
+ * Inspired by drivers/irqchip/irqchip.c
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/acpi.h>
+
+/*
+ * This special acpi_table_id is the sentinel at the end of the
+ * acpi_table_id[] array of all irqchips. It is automatically placed at
+ * the end of the array by the linker, thanks to being part of a
+ * special section.
+ */
+static const struct acpi_table_id
+irqchip_acpi_match_end __used __section(__irqchip_acpi_table_end);
+
+extern struct acpi_table_id __irqchip_acpi_table[];
+
+void __init acpi_irqchip_init(void)
+{
+ struct acpi_table_id *id;
+
+ if (acpi_disabled)
+ return;
+
+ for (id = __irqchip_acpi_table; id->id[0]; id++)
+ acpi_table_parse(id->id, (acpi_tbl_table_handler)id->data);
+}
@@ -11,6 +11,7 @@
#ifndef _IRQCHIP_H
#define _IRQCHIP_H
+#include <linux/acpi.h>
#include <linux/of.h>
/*
@@ -25,4 +26,15 @@
*/
#define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
+/*
+ * This macro must be used by the different irqchip drivers to declare
+ * the association between their ACPI table and their initialization function.
+ *
+ * @name: name that must be unique accross all IRQCHIP_ACPI_DECLARE of the
+ * same file.
+ * @table_id: name of the ACPI table signature
+ * @fn: initialization function
+ */
+#define IRQCHIP_ACPI_DECLARE(name, table_id, fn) \
+ ACPI_DECLARE(irqchip, name, table_id, fn)
#endif
@@ -181,6 +181,18 @@
#define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
#define EARLYCON_OF_TABLES() OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon)
+#ifdef CONFIG_ACPI
+#define ACPI_TABLE(name) \
+ . = ALIGN(8); \
+ VMLINUX_SYMBOL(__##name##_acpi_table) = .; \
+ *(__##name##_acpi_table) \
+ *(__##name##_acpi_table_end)
+
+#define IRQCHIP_ACPI_MATCH_TABLE() ACPI_TABLE(irqchip)
+#else
+#define IRQCHIP_ACPI_MATCH_TABLE()
+#endif
+
#define KERNEL_DTB() \
STRUCT_ALIGN(); \
VMLINUX_SYMBOL(__dtb_start) = .; \
@@ -516,6 +528,7 @@
CPUIDLE_METHOD_OF_TABLES() \
KERNEL_DTB() \
IRQCHIP_OF_MATCH_TABLE() \
+ IRQCHIP_ACPI_MATCH_TABLE() \
EARLYCON_TABLE() \
EARLYCON_OF_TABLES()
@@ -820,6 +820,20 @@ static inline struct acpi_device *acpi_get_next_child(struct device *dev,
#endif
+#ifdef CONFIG_ACPI
+#define ACPI_DECLARE(table, name, table_id, fn) \
+ static const struct acpi_table_id __acpi_table_##name \
+ __used __section(__##table##_acpi_table) \
+ = { .id = table_id, \
+ .data = (void *)fn }
+#else
+#define ACPI_DECLARE(table, name, table_id, fn) \
+ static const struct acpi_table_id __acpi_table_##name \
+ __attribute__((unused)) \
+ = { .id = table_id, \
+ .data = (void*)fn }
+#endif
+
/* Provide support for using the SPCR table to define the console */
#ifdef CONFIG_ACPI_SPCR
extern u64 spcr_serial_addr;
@@ -199,6 +199,13 @@ struct pnp_device_id {
kernel_ulong_t driver_data;
};
+#define ACPI_TABLE_ID_LEN 5
+
+struct acpi_table_id {
+ __u8 id[ACPI_TABLE_ID_LEN];
+ const void *data;
+};
+
struct pnp_card_device_id {
__u8 id[PNP_ID_LEN];
kernel_ulong_t driver_data;