X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Externals%2FACPICA%2Facacess.h;h=10ab242d89ad6d3db1d749d5abfb36a3f1284076;hb=969efab9ce5b5233222f130fbbf5794ce5592508;hp=154b202cb7db3c0c329c0f1457ae5c51b8379d45;hpb=fb2379add2a38e3725401e1860d50df5d1b1430e;p=tpg%2Facess2.git diff --git a/Externals/ACPICA/acacess.h b/Externals/ACPICA/acacess.h index 154b202c..10ab242d 100644 --- a/Externals/ACPICA/acacess.h +++ b/Externals/ACPICA/acacess.h @@ -1,124 +1,39 @@ -/****************************************************************************** - * - * Name: aclinux.h - OS specific defines, etc. for Linux +/* + * Acess-specific ACPI header. * - *****************************************************************************/ - -#ifndef _ACPICA__ACACESS_H_ -#define _ACPICA__ACACESS_H_ - -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_USE_DO_WHILE_0 -#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX - - -#ifdef __KERNEL__ + * A modified version of the ForgeOS acforge.h, copied and modified with permision. + */ +#ifndef __ACACESS_H__ +#define __ACACESS_H__ #include +#include +#include -/* Host-dependent types and defines for in-kernel ACPICA */ +#define ACPI_SINGLE_THREADED -#define ACPI_MACHINE_WIDTH BITS +#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_SPINLOCK tShortSpinlock* -#define ACPI_CPU_FLAGS unsigned long +#define ACPI_USE_DO_WHILE_0 +#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX -#define COMPILER_DEPENDENT_UINT64 Uint64 -#define COMPILER_DEPENDENT_INT64 Sint64 +#define ACPI_USE_NATIVE_DIVIDE -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) do { \ - Uint64 rem; \ - Sint64 num = ((Sint64)n_hi<<32)|n_lo; \ - int sgn = 1; \ - if(num < 0) {num = -num; sgn = -sgn; } \ - if(d32 < 0) {d32 = -d32; sgn = -sgn; } \ - q32 = sgn * DivMod64U( num, d32, &rem ); \ - r32 = rem; \ - }while(0) -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) do { \ - n_lo >>= 1; \ - if(n_hi & 1) n_lo |= (1 << 31); \ - n_hi >>= 1; \ - }while(0) +#define ACPI_CACHE_T ACPI_MEMORY_LIST +#define ACPI_USE_LOCAL_CACHE 1 -#else /* !__KERNEL__ */ +#ifdef ARCHDIR_IS_x86 +#define ACPI_MACHINE_WIDTH 32 +#else +#error TODO - 64-bit support +#endif -#error "Kernel only" +#define ACPI_MUTEX void * -#endif /* __KERNEL__ */ +#define ACPI_UINTPTR_T uintptr_t -/* Linux uses GCC */ +#define ACPI_FLUSH_CPU_CACHE() __asm__ __volatile__("wbinvd"); #include "acgcc.h" - -#if 0 -#ifdef __KERNEL__ -#define ACPI_SYSTEM_XFACE -#include -/* - * Overrides for in-kernel ACPICA - */ -static inline acpi_thread_id acpi_os_get_thread_id(void) -{ - return (ACPI_THREAD_ID) (unsigned long) current; -} - -/* - * 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. - */ -static inline void *acpi_os_allocate(acpi_size size) -{ - return malloc(size); -} - -static inline void *acpi_os_allocate_zeroed(acpi_size size) -{ - return calloc(size, 1); -} - -static inline void *acpi_os_acquire_object(acpi_cache_t * cache) -{ -// return kmem_cache_zalloc(cache, -// irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); -} - -#define ACPI_ALLOCATE(a) acpi_os_allocate(a) -#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) -#define ACPI_FREE(a) free(a) - -#ifndef CONFIG_PREEMPT -/* - * Used within ACPICA to show where it is safe to preempt execution - * when CONFIG_PREEMPT=n - */ -#define ACPI_PREEMPTION_POINT() \ - do { \ - Threads_Yield(); \ - } while (0) -#endif - -/* - * 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 AcpiOsCreateLock(__handle) \ -({ \ - tShortlock *lock = ACPI_ALLOCATE_ZEROED(sizeof(*lock)); \ - \ - if (lock) { \ - *(__handle) = lock; \ - } \ - lock ? AE_OK : AE_NO_MEMORY; \ -}) - -#endif /* __KERNEL__ */ -#endif - -#endif /* __ACLINUX_H__ */ +#endif /* __ACACESS_H__ */