1/*
2 *  asm-ia64/acpi.h
3 *
4 *  Copyright (C) 1999 VA Linux Systems
5 *  Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
6 *  Copyright (C) 2000,2001 J.I. Lee <jung-ik.lee@intel.com>
7 *  Copyright (C) 2001,2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
8 *
9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 *
11 *  This program is free software; you can redistribute it and/or modify
12 *  it under the terms of the GNU General Public License as published by
13 *  the Free Software Foundation; either version 2 of the License, or
14 *  (at your option) any later version.
15 *
16 *  This program is distributed in the hope that it will be useful,
17 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *  GNU General Public License for more details.
20 *
21 *  You should have received a copy of the GNU General Public License
22 *  along with this program; if not, write to the Free Software
23 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 *
25 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 */
27
28#ifndef _ASM_ACPI_H
29#define _ASM_ACPI_H
30
31#ifdef __KERNEL__
32
33#define COMPILER_DEPENDENT_INT64	long
34#define COMPILER_DEPENDENT_UINT64	unsigned long
35
36/*
37 * Calling conventions:
38 *
39 * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
40 * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
41 * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
42 * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
43 */
44#define ACPI_SYSTEM_XFACE
45#define ACPI_EXTERNAL_XFACE
46#define ACPI_INTERNAL_XFACE
47#define ACPI_INTERNAL_VAR_XFACE
48
49/* Asm macros */
50
51#define ACPI_ASM_MACROS
52#define BREAKPOINT3
53#define ACPI_DISABLE_IRQS() __cli()
54#define ACPI_ENABLE_IRQS()  __sti()
55#define ACPI_FLUSH_CPU_CACHE()
56
57#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
58	do { \
59	__asm__ volatile ("1:  ld4      r29=%1\n"  \
60		";;\n"                  \
61		"mov    ar.ccv=r29\n"   \
62		"mov    r2=r29\n"       \
63		"shr.u  r30=r29,1\n"    \
64		"and    r29=-4,r29\n"   \
65		";;\n"                  \
66		"add    r29=2,r29\n"    \
67		"and    r30=1,r30\n"    \
68		";;\n"                  \
69		"add    r29=r29,r30\n"  \
70		";;\n"                  \
71		"cmpxchg4.acq   r30=%1,r29,ar.ccv\n" \
72		";;\n"                  \
73		"cmp.eq p6,p7=r2,r30\n" \
74		"(p7) br.dpnt.few 1b\n" \
75		"cmp.gt p8,p9=3,r29\n"  \
76		";;\n"                  \
77		"(p8) mov %0=-1\n"      \
78		"(p9) mov %0=r0\n"      \
79		:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
80	} while (0)
81
82#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
83	do { \
84	__asm__ volatile ("1:  ld4      r29=%1\n" \
85		";;\n"                  \
86		"mov    ar.ccv=r29\n"   \
87		"mov    r2=r29\n"       \
88		"and    r29=-4,r29\n"   \
89		";;\n"                  \
90		"cmpxchg4.acq   r30=%1,r29,ar.ccv\n" \
91		";;\n"                  \
92		"cmp.eq p6,p7=r2,r30\n" \
93		"(p7) br.dpnt.few 1b\n" \
94		"and    %0=1,r2\n"      \
95		";;\n"                  \
96		:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
97	} while (0)
98
99const char *acpi_get_sysname (void);
100int acpi_boot_init (char *cdline);
101int acpi_request_vector (u32 int_type);
102int acpi_get_prt (struct pci_vector_struct **vectors, int *count);
103int acpi_get_interrupt_model (int *type);
104int acpi_irq_to_vector (u32 irq);
105
106#ifdef CONFIG_DISCONTIGMEM
107#define NODE_ARRAY_INDEX(x)	((x) / 8)	/* 8 bits/char */
108#define NODE_ARRAY_OFFSET(x)	((x) % 8)	/* 8 bits/char */
109#define MAX_PXM_DOMAINS		(256)
110#endif /* CONFIG_DISCONTIGMEM */
111
112#endif /*__KERNEL__*/
113
114#endif /*_ASM_ACPI_H*/
115