Deleted Added
full compact
acgcc.h (99146) acgcc.h (99679)
1/******************************************************************************
2 *
3 * Name: acgcc.h - GCC specific defines, etc.
1/******************************************************************************
2 *
3 * Name: acgcc.h - GCC specific defines, etc.
4 * $Revision: 22 $
4 * $Revision: 23 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

--- 99 unchanged lines hidden (view full) ---

112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#ifndef __ACGCC_H__
118#define __ACGCC_H__
119
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

--- 99 unchanged lines hidden (view full) ---

112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#ifndef __ACGCC_H__
118#define __ACGCC_H__
119
120
121#ifdef __ia64__
122#define _IA64
123
124#define COMPILER_DEPENDENT_INT64 long
125#define COMPILER_DEPENDENT_UINT64 unsigned long
126
127/*
128 * Calling conventions:
129 *
130 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
131 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
132 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
133 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
134 */
135#define ACPI_SYSTEM_XFACE
136#define ACPI_EXTERNAL_XFACE
137#define ACPI_INTERNAL_XFACE
138#define ACPI_INTERNAL_VAR_XFACE
139
140/* Single threaded */
141
142#define ACPI_APPLICATION
143
144/* Asm macros */
145
146#define ACPI_ASM_MACROS
147#define BREAKPOINT3
148#define ACPI_DISABLE_IRQS() __cli()
149#define ACPI_ENABLE_IRQS() __sti()
150
151/*! [Begin] no source code translation */
152
153#include <asm/pal.h>
154
155#define halt() ia64_pal_halt_light() /* PAL_HALT[_LIGHT] */
156#define safe_halt() ia64_pal_halt(1) /* PAL_HALT */
157
158
159#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
160 do { \
161 __asm__ volatile ("1: ld4 r29=%1\n" \
162 ";;\n" \
163 "mov ar.ccv=r29\n" \
164 "mov r2=r29\n" \
165 "shr.u r30=r29,1\n" \
166 "and r29=-4,r29\n" \
167 ";;\n" \
168 "add r29=2,r29\n" \
169 "and r30=1,r30\n" \
170 ";;\n" \
171 "add r29=r29,r30\n" \
172 ";;\n" \
173 "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
174 ";;\n" \
175 "cmp.eq p6,p7=r2,r30\n" \
176 "(p7) br.dpnt.few 1b\n" \
177 "cmp.gt p8,p9=3,r29\n" \
178 ";;\n" \
179 "(p8) mov %0=-1\n" \
180 "(p9) mov %0=r0\n" \
181 :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
182 } while (0)
183
184#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
185 do { \
186 __asm__ volatile ("1: ld4 r29=%1\n" \
187 ";;\n" \
188 "mov ar.ccv=r29\n" \
189 "mov r2=r29\n" \
190 "and r29=-4,r29\n" \
191 ";;\n" \
192 "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
193 ";;\n" \
194 "cmp.eq p6,p7=r2,r30\n" \
195 "(p7) br.dpnt.few 1b\n" \
196 "and %0=1,r2\n" \
197 ";;\n" \
198 :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
199 } while (0)
200/*! [End] no source code translation !*/
201
202
203#else /* DO IA32 */
204
205#define COMPILER_DEPENDENT_INT64 long long
206#define COMPILER_DEPENDENT_UINT64 unsigned long long
207
208/*
209 * Calling conventions:
210 *
211 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
212 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
213 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
214 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
215 */
216#define ACPI_SYSTEM_XFACE
217#define ACPI_EXTERNAL_XFACE
218#define ACPI_INTERNAL_XFACE
219#define ACPI_INTERNAL_VAR_XFACE
220
221/* Asm macros */
222
223#define ACPI_ASM_MACROS
224#define BREAKPOINT3
225#define ACPI_DISABLE_IRQS() __cli()
226#define ACPI_ENABLE_IRQS() __sti()
227
228/*! [Begin] no source code translation
229 *
230 * A brief explanation as GNU inline assembly is a bit hairy
231 * %0 is the output parameter in EAX ("=a")
232 * %1 and %2 are the input parameters in ECX ("c")
233 * and an immediate value ("i") respectively
234 * All actual register references are preceded with "%%" as in "%%edx"
235 * Immediate values in the assembly are preceded by "$" as in "$0x1"
236 * The final asm parameter are the operation altered non-output registers.
237 */
238#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
239 do { \
240 int dummy; \
241 asm("1: movl (%1),%%eax;" \
242 "movl %%eax,%%edx;" \
243 "andl %2,%%edx;" \
244 "btsl $0x1,%%edx;" \
245 "adcl $0x0,%%edx;" \
246 "lock; cmpxchgl %%edx,(%1);" \
247 "jnz 1b;" \
248 "cmpb $0x3,%%dl;" \
249 "sbbl %%eax,%%eax" \
250 :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
251 } while(0)
252
253#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
254 do { \
255 int dummy; \
256 asm("1: movl (%1),%%eax;" \
257 "movl %%eax,%%edx;" \
258 "andl %2,%%edx;" \
259 "lock; cmpxchgl %%edx,(%1);" \
260 "jnz 1b;" \
261 "andl $0x1,%%eax" \
262 :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
263 } while(0)
264
265
266/*
267 * Math helper asm macros
268 */
269#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
270 asm("divl %2;" \
271 :"=a"(q32), "=d"(r32) \
272 :"r"(d32), \
273 "0"(n_lo), "1"(n_hi))
274
275
276#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
277 asm("shrl $1,%2;" \
278 "rcrl $1,%3;" \
279 :"=r"(n_hi), "=r"(n_lo) \
280 :"0"(n_hi), "1"(n_lo))
281
282/*! [End] no source code translation !*/
283
284#endif /* IA 32 */
285
286/* This macro is used to tag functions as "printf-like" because
287 * some compilers (like GCC) can catch printf format string problems.
288 */
289#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
290
291#endif /* __ACGCC_H__ */
120/* This macro is used to tag functions as "printf-like" because
121 * some compilers (like GCC) can catch printf format string problems.
122 */
123#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
124
125#endif /* __ACGCC_H__ */