1 // Copyright 2016 The Fuchsia Authors 2 // 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file or at 5 // https://opensource.org/licenses/MIT 6 7 #pragma once 8 9 #include <stdbool.h> 10 11 #include <kernel/spinlock.h> 12 13 /* 14 * Settings described in section 7 of 15 * https://acpica.org/sites/acpica/files/acpica-reference_17.pdf 16 */ 17 18 #if __x86_64__ 19 #define ACPI_MACHINE_WIDTH 64 20 #else 21 #error Unexpected architecture 22 #endif 23 24 #define ACPI_FLUSH_CPU_CACHE() __asm__ volatile ("wbinvd") 25 26 // Use the standard library headers 27 #define ACPI_USE_STANDARD_HEADERS 28 #define ACPI_USE_SYSTEM_CLIBRARY 29 30 // Use the builtin cache implementation 31 #define ACPI_USE_LOCAL_CACHE 32 33 // Specify the types Zircon uses for various common objects 34 #define ACPI_CPU_FLAGS spin_lock_saved_state_t 35 #define ACPI_SPINLOCK spin_lock_t* 36 37 // Borrowed from aclinuxex.h 38 39 // Include the gcc header since we're compiling on gcc 40 #include "acgcc.h" 41 42 __BEGIN_CDECLS 43 bool _acpica_acquire_global_lock(void *FacsPtr); 44 bool _acpica_release_global_lock(void *FacsPtr); 45 __END_CDECLS 46 47 #define ACPI_ACQUIRE_GLOBAL_LOCK(FacsPtr, Acq) Acq = _acpica_acquire_global_lock(FacsPtr) 48 #define ACPI_RELEASE_GLOBAL_LOCK(FacsPtr, Pnd) Pnd = _acpica_release_global_lock(FacsPtr) 49