acenv.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * X86 specific ACPICA environments and implementation
  3. *
  4. * Copyright (C) 2014, Intel Corporation
  5. * Author: Lv Zheng <lv.zheng@intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _ASM_X86_ACENV_H
  12. #define _ASM_X86_ACENV_H
  13. #include <asm/special_insns.h>
  14. /* Asm macros */
  15. #define ACPI_FLUSH_CPU_CACHE() wbinvd()
  16. #ifdef CONFIG_ACPI
  17. int __acpi_acquire_global_lock(unsigned int *lock);
  18. int __acpi_release_global_lock(unsigned int *lock);
  19. #define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
  20. ((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
  21. #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
  22. ((Acq) = __acpi_release_global_lock(&facs->global_lock))
  23. /*
  24. * Math helper asm macros
  25. */
  26. #define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
  27. asm("divl %2;" \
  28. : "=a"(q32), "=d"(r32) \
  29. : "r"(d32), \
  30. "0"(n_lo), "1"(n_hi))
  31. #define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
  32. asm("shrl $1,%2 ;" \
  33. "rcrl $1,%3;" \
  34. : "=r"(n_hi), "=r"(n_lo) \
  35. : "0"(n_hi), "1"(n_lo))
  36. #endif
  37. #endif /* _ASM_X86_ACENV_H */