From: John Hodge (sonata) Date: Sat, 1 Dec 2012 03:19:39 +0000 (+0800) Subject: Externals/ACPICA - Compiles (with hackery) X-Git-Tag: rel0.15~626 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=2c9b2856a7c2aaf6cbf3827c27d40dc456525a92;p=tpg%2Facess2.git Externals/ACPICA - Compiles (with hackery) --- diff --git a/Externals/ACPICA/Makefile b/Externals/ACPICA/Makefile index 378a042d..f91aa553 100644 --- a/Externals/ACPICA/Makefile +++ b/Externals/ACPICA/Makefile @@ -3,23 +3,52 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../Makefile.cfg COMPONENTS = utilities tables -BIN := ../$(ARCH)/libacpica.a +BIN := ../bin-$(ARCH)/libacpica.a -ACPICAROOT := acpica-unix-20121114/ +ACPICAVER = 20121114 +ACPICAROOT := acpica-unix-$(ACPICAVER)/ COMPDIR := $(ACPICAROOT)source/components/ +KERNELDIR := ../../KernelLand/Kernel/ -CPPFLAGS += -I $(ACPICAROOT)source/include +CPPFLAGS += -I $(KERNELDIR)include -I$(KERNELDIR)arch/$(ARCHDIR)/include -D_MODULE_NAME_=\"ACPICA\" +CPPFLAGS += -I $(ACPICAROOT)source/include -D _ACESS -D __KERNEL__ +CPPFLAGS += -D ARCH=$(ARCH) -D ARCHDIR=$(ARCHDIR) -D PLATFORM=\"$(PLATFORM)\" -D ARCHDIR_IS_$(ARCHDIR)=1 -D PLATFORM_is_$(PLATFORM)=1 +CPPFLAGS += -D KERNEL_VERSION=$(KERNEL_VERSION) -ffreestanding +CFLAGS += -Wall -fno-stack-protector -Wstrict-prototypes -std=gnu99 -g SRCS := $(foreach comp,$(COMPONENTS),$(wildcard $(COMPDIR)$(comp)/*.c)) OBJS := $(SRCS:$(COMPDIR)%.c=obj-$(ARCH)/%.o) +ACENV_H := $(ACPICAROOT)source/include/platform/acenv.h +ACACESS_H := $(ACPICAROOT)source/include/platform/acacess.h + .PHONY: all clean +all: $(BIN) + +clean: + $(RM) obj-$(ARCH)/ + $(BIN): $(OBJS) - ar -cu $@ $(OBJS) + @mkdir -p $(dir $@) + @echo [AR] $@ + @ar rcu $@ $(OBJS) -obj-$(ARCH)/%.o: $(COMPDIR)%.c +#include_exp/acpi: $(ACPICAROOT)source/include +# @mkdir -p $(dir $@) +# ln -s ../$< $@ + +$(ACACESS_H): acacess.h + cp $< $@ + +$(ACENV_H): acpica-unix-$(ACPICAVER).tar.gz Makefile + tar -x -O -f acpica-unix-$(ACPICAVER).tar.gz $(ACENV_H) | sed 's/aclinux/acacess/' | sed 's/_LINUX/_ACESS/' > $@ + +obj-$(ARCH)/%.o: $(COMPDIR)%.c $(ACENV_H) $(ACACESS_H) @mkdir -p $(dir $@) - $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< + @echo [CC] -o $@ + @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< @$(CC) -M -MP -MT $@ $(CPPFLAGS) $< -o $@.dep +-include $(OBJS:%=%.dep) + diff --git a/Externals/ACPICA/acacess.h b/Externals/ACPICA/acacess.h new file mode 100644 index 00000000..bcbdc9df --- /dev/null +++ b/Externals/ACPICA/acacess.h @@ -0,0 +1,118 @@ +/****************************************************************************** + * + * Name: aclinux.h - OS specific defines, etc. for Linux + * + *****************************************************************************/ + +#ifndef _ACPICA__ACACESS_H_ +#define _ACPICA__ACACESS_H_ + +#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_DO_WHILE_0 +#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE + + +#ifdef __KERNEL__ + +#include + +/* Host-dependent types and defines for in-kernel ACPICA */ + +#define ACPI_MACHINE_WIDTH BITS + +#define ACPI_SPINLOCK tShortSpinlock +#define ACPI_CPU_FLAGS unsigned long + +#define COMPILER_DEPENDENT_UINT64 Uint64 +#define COMPILER_DEPENDENT_INT64 Sint64 + +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) do { \ + q32 = DivMod64( ((Sint64)n_hi<<32)|n_lo, d32, &r32 ); \ + }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) + +#else /* !__KERNEL__ */ + +#error "Kernel only" + +#endif /* __KERNEL__ */ + +/* Linux uses GCC */ + +#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__ */