summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2020-04-24 11:11:59 +1000
committerDamien Zammit <damien@zamaudio.com>2020-04-24 11:12:47 +1000
commit48fd97dcb03a19fbe17ae647bc0f57cee3d30139 (patch)
tree9e0f871b4711d622d09b68ce3919613193dc3e97
parent1f8c6bcbefd0c6775d3b01273eee0abc75512df9 (diff)
acpica: Add acgnuex.h extra configuration for GNU target
-rw-r--r--acpica/src/include/acpi/platform/acenvex.h3
-rw-r--r--acpica/src/include/acpi/platform/acgnuex.h78
2 files changed, 81 insertions, 0 deletions
diff --git a/acpica/src/include/acpi/platform/acenvex.h b/acpica/src/include/acpi/platform/acenvex.h
index c3facf5f..b0cbc5bf 100644
--- a/acpica/src/include/acpi/platform/acenvex.h
+++ b/acpica/src/include/acpi/platform/acenvex.h
@@ -25,6 +25,9 @@
#elif defined(__DragonFly__)
#include "acdragonflyex.h"
+#elif defined(__GNU__)
+#include "acgnuex.h"
+
/*
* EFI applications can be built with -nostdlib, in this case, it must be
* included after including all other host environmental definitions, in
diff --git a/acpica/src/include/acpi/platform/acgnuex.h b/acpica/src/include/acpi/platform/acgnuex.h
new file mode 100644
index 00000000..c65db895
--- /dev/null
+++ b/acpica/src/include/acpi/platform/acgnuex.h
@@ -0,0 +1,78 @@
+#ifndef __ACGNUEX_H__
+#define __ACGNUEX_H__
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+acpi_status ACPI_INIT_FUNCTION acpi_os_initialize(void);
+
+acpi_status acpi_os_terminate(void);
+
+static inline void *acpi_os_allocate(acpi_size size)
+{
+ return kmalloc(size, GFP_ATOMIC);
+}
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+ void *memory = acpi_os_allocate(size);
+ memset(memory, 0, size);
+ return memory;
+}
+
+static inline void acpi_os_free(void *memory)
+{
+ kfree(memory);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
+{
+ return kmem_cache_alloc(cache);
+}
+
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+ return (acpi_thread_id) (unsigned long)0; // XXX Single thread
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define acpi_os_create_lock(__handle) \
+ ({ \
+ int *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+ if (lock) { \
+ *(__handle) = lock; \
+ simple_lock_init(*(__handle)); \
+ } \
+ lock ? AE_OK : AE_NO_MEMORY; \
+ })
+
+static inline u8 acpi_os_readable(void *pointer, acpi_size length)
+{
+ return TRUE;
+}
+
+static inline acpi_status acpi_os_initialize_debugger(void)
+{
+ return AE_OK;
+}
+
+static inline void acpi_os_terminate_debugger(void)
+{
+ return;
+}
+
+/*
+ * OSL interfaces added by Linux
+ */
+
+#endif /* __KERNEL__ */
+
+#endif /* __ACGNUEX_H__ */