/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ /****************************************************************************** * * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux * * Copyright (C) 2000 - 2025, Intel Corp. *
*****************************************************************************/
/* * Overrides for in-kernel ACPICA
*/
acpi_status ACPI_INIT_FUNCTION acpi_os_initialize(void);
acpi_status acpi_os_terminate(void);
/* * The irqs_disabled() check is for resume from RAM. * Interrupts are off during resume, just like they are for boot. * However, boot has (system_state != SYSTEM_RUNNING) * to quiet __might_sleep() in kmalloc() and resume does not. * * These specialized allocators have to be macros for their allocations to be * accounted separately (to have separate alloc_tag).
*/ #define acpi_os_allocate(_size) \
kmalloc(_size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL)
/* * 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) \
({ \
spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ if (lock) { \
*(__handle) = lock; \
spin_lock_init(*(__handle)); \
} \
lock ? AE_OK : AE_NO_MEMORY; \
})