This patch adds default 64-bit mathematics in aclinux.h using do_div. As do_div can be used for all Linux architectures, this can also be used as stub macros for ACPICA 64-bit mathematics. Signed-off-by: Lv Zheng <lv.zheng@xxxxxxxxx> --- arch/ia64/include/asm/acenv.h | 2 ++ arch/x86/include/asm/acenv.h | 4 ++++ include/acpi/platform/aclinux.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h index eb13318..f142a9d 100644 --- a/arch/ia64/include/asm/acenv.h +++ b/arch/ia64/include/asm/acenv.h @@ -66,6 +66,8 @@ ia64_acpi_release_global_lock (unsigned int *lock) #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock)) +#define ARCH_HAS_ACPI_GLOBAL_LOCK 1 + #endif #endif /* _ASM_IA64_ACENV_H */ diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h index 2359989..a85b478 100644 --- a/arch/x86/include/asm/acenv.h +++ b/arch/x86/include/asm/acenv.h @@ -45,6 +45,8 @@ int __acpi_release_global_lock(unsigned int *lock); #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ ((Acq) = __acpi_release_global_lock(&facs->global_lock)) +#define ARCH_HAS_ACPI_GLOBAL_LOCK 1 + /* * Math helper asm macros */ @@ -61,6 +63,8 @@ int __acpi_release_global_lock(unsigned int *lock); : "=r"(n_hi), "=r"(n_lo) \ : "0"(n_hi), "1"(n_lo)) +#define ARCH_HAS_ACPI_MATH64_HELPER 1 + #endif #endif /* _ASM_X86_ACENV_H */ diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index e9e6374..8176181 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -221,6 +221,35 @@ #define acpi_spinlock spinlock_t * #define acpi_cpu_flags unsigned long +#if ACPI_MACHINE_WIDTH == 64 + +#ifndef ARCH_HAS_ACPI_MATH64_HELPER + +/* Default to ACPI_USE_NATIVE_DIVIDE support */ + +#define ARCH_HAS_ACPI_MATH64_HELPER + +#endif + +#endif + +#ifndef ARCH_HAS_ACPI_MATH64_HELPER + +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ + do { \ + u64 __dividend = (((u64)(n_hi) << 32) | (n_lo)); \ + (r32) = do_div(__dividend, (d32)); \ + (q32) = (u32)__dividend; \ + } while (0) + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ + do { \ + (n_lo) = ((n_lo) >> 1) | (((n_hi) & 1) << 31); \ + (n_hi) >>= 1; \ + } while (0) + +#endif + #else /* !__KERNEL__ */ #include <stdarg.h> -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html