acpica_machdep.h revision 118046
1/*-
2 * Copyright (c) 2002 Mitsuru IWASAKI
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/ia64/include/acpica_machdep.h 118046 2003-07-26 07:23:25Z marcel $
27 */
28
29/******************************************************************************
30 *
31 * Name: acpica_machdep.h - arch-specific defines, etc.
32 *       $Revision$
33 *
34 *****************************************************************************/
35
36#ifndef __ACPICA_MACHDEP_H__
37#define __ACPICA_MACHDEP_H__
38
39#ifdef _KERNEL
40#define _IA64
41
42/*
43 * Calling conventions:
44 *
45 * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
46 * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
47 * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
48 * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
49 */
50#define ACPI_SYSTEM_XFACE
51#define ACPI_EXTERNAL_XFACE
52#define ACPI_INTERNAL_XFACE
53#define ACPI_INTERNAL_VAR_XFACE
54
55/* Asm macros */
56
57#define ACPI_ASM_MACROS
58#define BREAKPOINT3
59#define ACPI_DISABLE_IRQS() disable_intr()
60#define ACPI_ENABLE_IRQS()  enable_intr()
61
62#define ACPI_FLUSH_CPU_CACHE()	/* XXX ia64_fc()? */
63
64/*! [Begin] no source code translation */
65
66#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
67    do { \
68    __asm__ volatile ("1:  ld4      r29=[%1]\n"  \
69        ";;\n"                  \
70        "mov    ar.ccv=r29\n"   \
71        "mov    r2=r29\n"       \
72        "shr.u  r30=r29,1\n"    \
73        "and    r29=-4,r29\n"   \
74        ";;\n"                  \
75        "add    r29=2,r29\n"    \
76        "and    r30=1,r30\n"    \
77        ";;\n"                  \
78        "add    r29=r29,r30\n"  \
79        ";;\n"                  \
80        "cmpxchg4.acq   r30=[%1],r29,ar.ccv\n" \
81        ";;\n"                  \
82        "cmp.eq p6,p7=r2,r30\n" \
83        "(p7) br.dpnt.few 1b\n" \
84        "cmp.gt p8,p9=3,r29\n"  \
85        ";;\n"                  \
86        "(p8) mov %0=-1\n"      \
87        "(p9) mov %0=r0\n"      \
88        :"=r"(Acq):"r"(GLptr):"r2","r29","r30","memory"); \
89    } while (0)
90
91#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
92    do { \
93    __asm__ volatile ("1:  ld4      r29=[%1]\n" \
94        ";;\n"                  \
95        "mov    ar.ccv=r29\n"   \
96        "mov    r2=r29\n"       \
97        "and    r29=-4,r29\n"   \
98        ";;\n"                  \
99        "cmpxchg4.acq   r30=[%1],r29,ar.ccv\n" \
100        ";;\n"                  \
101        "cmp.eq p6,p7=r2,r30\n" \
102        "(p7) br.dpnt.few 1b\n" \
103        "and    %0=1,r2\n"      \
104        ";;\n"                  \
105        :"=r"(Acq):"r"(GLptr):"r2","r29","r30","memory"); \
106    } while (0)
107/*! [End] no source code translation !*/
108
109#endif /* _KERNEL */
110
111#define ACPI_MACHINE_WIDTH             64
112#define COMPILER_DEPENDENT_INT64       long
113#define COMPILER_DEPENDENT_UINT64      unsigned long
114
115#endif /* __ACPICA_MACHDEP_H__ */
116