diff options
author | Lv Zheng <lv.zheng@intel.com> | 2014-07-30 09:13:05 +0800 |
---|---|---|
committer | Lv Zheng <lv.zheng@intel.com> | 2014-07-30 09:13:05 +0800 |
commit | 8e2e6d963ca7fb8291d7ade9eac59341d8a2bc4d (patch) | |
tree | 146ad7c1ea00a6175578aa25a370ed4e77f683cb | |
parent | ee2e8fc3c303f856fc4ce8844dec4450c7af36ef (diff) | |
download | acpica-8e2e6d963ca7fb8291d7ade9eac59341d8a2bc4d.tar.gz |
Linux: Add stub implementation of ACPICA 64-bit mathematics.
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.
But this is not a performance friendly way, as ACPICA's architecture
specific division OSL only requires a dividing 64-bit number with a 32-bit
number implementation, while Linux __div64_32() is not available for all
build environments. So currently, if an architecture really wants to
support ACPICA, it must implement its own division OSL.
This is required by the ACPICA header stub support. ACPICA header stubs are
useful to protect CONFIG_ACPI=n Linux kernel builds where ACPICA headers
are included. Lv Zheng.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
-rw-r--r-- | source/include/platform/aclinuxex.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/include/platform/aclinuxex.h b/source/include/platform/aclinuxex.h index e3d5d5bb7..d4111a135 100644 --- a/source/include/platform/aclinuxex.h +++ b/source/include/platform/aclinuxex.h @@ -118,6 +118,28 @@ #ifdef __KERNEL__ +#ifndef ACPI_USE_NATIVE_DIVIDE + +#ifndef ACPI_DIV_64_BY_32 +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ + do { \ + UINT64 (__n) = ((UINT64) n_hi) << 32 | (n_lo); \ + (r32) = do_div ((__n), (d32)); \ + (q32) = (UINT32) (__n); \ + } while (0) +#endif + +#ifndef ACPI_SHIFT_RIGHT_64 +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ + do { \ + (n_lo) >>= 1; \ + (n_lo) |= (((n_hi) & 1) << 31); \ + (n_hi) >>= 1; \ + } while (0) +#endif + +#endif + /* * Overrides for in-kernel ACPICA */ |