1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * IA64 specific ACPICA environments and implementation
5 * Copyright (C) 2014, Intel Corporation
6 * Author: Lv Zheng <lv.zheng@intel.com>
9 #ifndef _ASM_IA64_ACENV_H
10 #define _ASM_IA64_ACENV_H
12 #include <asm/intrinsics.h>
14 #define COMPILER_DEPENDENT_INT64 long
15 #define COMPILER_DEPENDENT_UINT64 unsigned long
20 ia64_acpi_acquire_global_lock(unsigned int *lock
)
22 unsigned int old
, new, val
;
25 new = (((old
& ~0x3) + 2) + ((old
>> 1) & 0x1));
26 val
= ia64_cmpxchg4_acq(lock
, new, old
);
27 } while (unlikely (val
!= old
));
28 return (new < 3) ? -1 : 0;
32 ia64_acpi_release_global_lock(unsigned int *lock
)
34 unsigned int old
, new, val
;
38 val
= ia64_cmpxchg4_acq(lock
, new, old
);
39 } while (unlikely (val
!= old
));
43 #define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
44 ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
46 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
47 ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
49 #endif /* _ASM_IA64_ACENV_H */