ACPICA - Replace acacess.h with a modified version of the ForgeOS one, no longer...
authorJohn Hodge <[email protected]>
Tue, 21 Jan 2014 09:49:56 +0000 (17:49 +0800)
committerJohn Hodge <[email protected]>
Tue, 21 Jan 2014 09:49:56 +0000 (17:49 +0800)
Externals/ACPICA/acacess.h
KernelLand/Kernel/arch/x86/acpica.c

index fdbf335..10ab242 100644 (file)
-/******************************************************************************
- *
- * 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
-
-//#define ACPI_DEBUG_OUTPUT    1
-
-#ifdef __KERNEL__
+ * A modified version of the ForgeOS acforge.h, copied and modified with permision.
+ */
+#ifndef __ACACESS_H__
+#define __ACACESS_H__
 
 #include <acess.h>
+#include <stdint.h>
+#include <stdarg.h>
 
-/* Host-dependent types and defines for in-kernel ACPICA */
-
-#define ACPI_MACHINE_WIDTH          BITS
+#define ACPI_SINGLE_THREADED
 
-typedef struct sACPICache      tACPICache;
+#define ACPI_USE_SYSTEM_CLIBRARY
 
-#define ACPI_CACHE_T   tACPICache
-#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 <actypes.h>
-/*
- * 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__ */
index 45a7317..433feaa 100644 (file)
@@ -118,6 +118,7 @@ ACPI_STATUS AcpiOsPhysicalTableOverride(ACPI_TABLE_HEADER *ExisitingTable, ACPI_
 }
 
 // -- Memory Management ---
+#if USE_ACESS_ACPI_CACHE
 struct sACPICache
 {
        Uint16  nObj;
@@ -231,6 +232,7 @@ ACPI_STATUS AcpiOsReleaseObject(ACPI_CACHE_T *Cache, void *Object)
        LEAVE('i', AE_OK);
        return AE_OK;
 }
+#endif
 
 void *AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length)
 {

UCC git Repository :: git.ucc.asn.au