import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / acpi / include / acmacros.h
1 /******************************************************************************
2  *
3  * Name: acmacros.h - C macros for the entire subsystem.
4  *       $Revision: 1.1.1.1 $
5  *
6  *****************************************************************************/
7
8 /*
9  *  Copyright (C) 2000, 2001 R. Byron Moore
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 #ifndef __ACMACROS_H__
27 #define __ACMACROS_H__
28
29
30 /*
31  * Data manipulation macros
32  */
33
34 #ifndef LOWORD
35 #define LOWORD(l)                       ((u16)(NATIVE_UINT)(l))
36 #endif
37
38 #ifndef HIWORD
39 #define HIWORD(l)                       ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF))
40 #endif
41
42 #ifndef LOBYTE
43 #define LOBYTE(l)                       ((u8)(u16)(l))
44 #endif
45
46 #ifndef HIBYTE
47 #define HIBYTE(l)                       ((u8)((((u16)(l)) >> 8) & 0xFF))
48 #endif
49
50 #define BIT0(x)                         ((((x) & 0x01) > 0) ? 1 : 0)
51 #define BIT1(x)                         ((((x) & 0x02) > 0) ? 1 : 0)
52 #define BIT2(x)                         ((((x) & 0x04) > 0) ? 1 : 0)
53
54 #define BIT3(x)                         ((((x) & 0x08) > 0) ? 1 : 0)
55 #define BIT4(x)                         ((((x) & 0x10) > 0) ? 1 : 0)
56 #define BIT5(x)                         ((((x) & 0x20) > 0) ? 1 : 0)
57 #define BIT6(x)                         ((((x) & 0x40) > 0) ? 1 : 0)
58 #define BIT7(x)                         ((((x) & 0x80) > 0) ? 1 : 0)
59
60 #define LOW_BASE(w)                     ((u16) ((w) & 0x0000FFFF))
61 #define MID_BASE(b)                     ((u8) (((b) & 0x00FF0000) >> 16))
62 #define HI_BASE(b)                      ((u8) (((b) & 0xFF000000) >> 24))
63 #define LOW_LIMIT(w)                    ((u16) ((w) & 0x0000FFFF))
64 #define HI_LIMIT(b)                     ((u8) (((b) & 0x00FF0000) >> 16))
65
66
67 #ifdef _IA16
68 /*
69  * For 16-bit addresses, we have to assume that the upper 32 bits
70  * are zero.
71  */
72 #ifndef LODWORD
73 #define LODWORD(l)                      (l)
74 #endif
75
76 #ifndef HIDWORD
77 #define HIDWORD(l)                      (0)
78 #endif
79
80 #define ACPI_GET_ADDRESS(a)             ((a).lo)
81 #define ACPI_STORE_ADDRESS(a,b)         {(a).hi=0;(a).lo=(b);}
82 #define ACPI_VALID_ADDRESS(a)           ((a).hi | (a).lo)
83
84 #else
85 #ifdef ACPI_NO_INTEGER64_SUPPORT
86 /*
87  * acpi_integer is 32-bits, no 64-bit support on this platform
88  */
89 #ifndef LODWORD
90 #define LODWORD(l)                      ((u32)(l))
91 #endif
92
93 #ifndef HIDWORD
94 #define HIDWORD(l)                      (0)
95 #endif
96
97 #define ACPI_GET_ADDRESS(a)             (a)
98 #define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
99 #define ACPI_VALID_ADDRESS(a)           (a)
100
101 #else
102
103 /*
104  * Full 64-bit address/integer on both 32-bit and 64-bit platforms
105  */
106 #ifndef LODWORD
107 #define LODWORD(l)                      ((u32)(u64)(l))
108 #endif
109
110 #ifndef HIDWORD
111 #define HIDWORD(l)                      ((u32)(((*(uint64_struct *)(&l))).hi))
112 #endif
113
114 #define ACPI_GET_ADDRESS(a)             (a)
115 #define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
116 #define ACPI_VALID_ADDRESS(a)           (a)
117 #endif
118 #endif
119
120  /*
121   * Extract a byte of data using a pointer.  Any more than a byte and we
122   * get into potential aligment issues -- see the STORE macros below
123   */
124 #define GET8(addr)                      (*(u8*)(addr))
125
126 /* Pointer arithmetic */
127
128
129 #define POINTER_ADD(t,a,b)              (t *) ((NATIVE_UINT)(a) + (NATIVE_UINT)(b))
130 #define POINTER_DIFF(a,b)               ((u32) ((NATIVE_UINT)(a) - (NATIVE_UINT)(b)))
131
132 /*
133  * Macros for moving data around to/from buffers that are possibly unaligned.
134  * If the hardware supports the transfer of unaligned data, just do the store.
135  * Otherwise, we have to move one byte at a time.
136  */
137
138 #ifdef _HW_ALIGNMENT_SUPPORT
139
140 /* The hardware supports unaligned transfers, just do the move */
141
142 #define MOVE_UNALIGNED16_TO_16(d,s)     *(u16*)(d) = *(u16*)(s)
143 #define MOVE_UNALIGNED32_TO_32(d,s)     *(u32*)(d) = *(u32*)(s)
144 #define MOVE_UNALIGNED16_TO_32(d,s)     *(u32*)(d) = *(u16*)(s)
145 #define MOVE_UNALIGNED64_TO_64(d,s)     *(u64*)(d) = *(u64*)(s)
146
147 #else
148 /*
149  * The hardware does not support unaligned transfers.  We must move the
150  * data one byte at a time.  These macros work whether the source or
151  * the destination (or both) is/are unaligned.
152  */
153
154 #define MOVE_UNALIGNED16_TO_16(d,s)     {((u8 *)(d))[0] = ((u8 *)(s))[0];\
155          ((u8 *)(d))[1] = ((u8 *)(s))[1];}
156
157 #define MOVE_UNALIGNED32_TO_32(d,s)     {((u8 *)(d))[0] = ((u8 *)(s))[0];\
158                           ((u8 *)(d))[1] = ((u8 *)(s))[1];\
159                           ((u8 *)(d))[2] = ((u8 *)(s))[2];\
160                           ((u8 *)(d))[3] = ((u8 *)(s))[3];}
161
162 #define MOVE_UNALIGNED16_TO_32(d,s)     {(*(u32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);}
163
164 #define MOVE_UNALIGNED64_TO_64(d,s)     {((u8 *)(d))[0] = ((u8 *)(s))[0];\
165                                            ((u8 *)(d))[1] = ((u8 *)(s))[1];\
166                                            ((u8 *)(d))[2] = ((u8 *)(s))[2];\
167                                            ((u8 *)(d))[3] = ((u8 *)(s))[3];\
168                                            ((u8 *)(d))[4] = ((u8 *)(s))[4];\
169                                            ((u8 *)(d))[5] = ((u8 *)(s))[5];\
170                                            ((u8 *)(d))[6] = ((u8 *)(s))[6];\
171                                            ((u8 *)(d))[7] = ((u8 *)(s))[7];}
172
173 #endif
174
175
176 /*
177  * Fast power-of-two math macros for non-optimized compilers
178  */
179
180 #define _DIV(value,power_of2)           ((u32) ((value) >> (power_of2)))
181 #define _MUL(value,power_of2)           ((u32) ((value) << (power_of2)))
182 #define _MOD(value,divisor)             ((u32) ((value) & ((divisor) -1)))
183
184 #define DIV_2(a)                        _DIV(a,1)
185 #define MUL_2(a)                        _MUL(a,1)
186 #define MOD_2(a)                        _MOD(a,2)
187
188 #define DIV_4(a)                        _DIV(a,2)
189 #define MUL_4(a)                        _MUL(a,2)
190 #define MOD_4(a)                        _MOD(a,4)
191
192 #define DIV_8(a)                        _DIV(a,3)
193 #define MUL_8(a)                        _MUL(a,3)
194 #define MOD_8(a)                        _MOD(a,8)
195
196 #define DIV_16(a)                       _DIV(a,4)
197 #define MUL_16(a)                       _MUL(a,4)
198 #define MOD_16(a)                       _MOD(a,16)
199
200
201 /*
202  * Rounding macros (Power of two boundaries only)
203  */
204 #define ROUND_DOWN(value,boundary)      ((value) & (~((boundary)-1)))
205 #define ROUND_UP(value,boundary)        (((value) + ((boundary)-1)) & (~((boundary)-1)))
206
207 #define ROUND_DOWN_TO_32_BITS(a)        ROUND_DOWN(a,4)
208 #define ROUND_DOWN_TO_64_BITS(a)        ROUND_DOWN(a,8)
209 #define ROUND_DOWN_TO_NATIVE_WORD(a)    ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
210
211 #define ROUND_UP_TO_32_bITS(a)          ROUND_UP(a,4)
212 #define ROUND_UP_TO_64_bITS(a)          ROUND_UP(a,8)
213 #define ROUND_UP_TO_NATIVE_WORD(a)      ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
214
215 #define ROUND_PTR_UP_TO_4(a,b)          ((b *)(((NATIVE_UINT)(a) + 3) & ~3))
216 #define ROUND_PTR_UP_TO_8(a,b)          ((b *)(((NATIVE_UINT)(a) + 7) & ~7))
217
218 #define ROUND_BITS_UP_TO_BYTES(a)       DIV_8((a) + 7)
219 #define ROUND_BITS_DOWN_TO_BYTES(a)     DIV_8((a))
220
221 #define ROUND_UP_TO_1K(a)               (((a) + 1023) >> 10)
222
223 /* Generic (non-power-of-two) rounding */
224
225 #define ROUND_UP_TO(value,boundary)     (((value) + ((boundary)-1)) / (boundary))
226
227 /*
228  * Bitmask creation
229  * Bit positions start at zero.
230  * MASK_BITS_ABOVE creates a mask starting AT the position and above
231  * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
232  */
233 #define MASK_BITS_ABOVE(position)       (~(((u32)(-1)) << ((u32) (position))))
234 #define MASK_BITS_BELOW(position)       (((u32)(-1)) << ((u32) (position)))
235
236
237 /* Macros for GAS addressing */
238
239 #ifndef _IA16
240
241 #define ACPI_PCI_DEVICE_MASK            (u64) 0x0000FFFF00000000
242 #define ACPI_PCI_FUNCTION_MASK          (u64) 0x00000000FFFF0000
243 #define ACPI_PCI_REGISTER_MASK          (u64) 0x000000000000FFFF
244
245 #define ACPI_PCI_FUNCTION(a)            (u16) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16))
246 #define ACPI_PCI_DEVICE(a)              (u16) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32))
247 #define ACPI_PCI_REGISTER(a)            (u16) (((a) & ACPI_PCI_REGISTER_MASK))
248
249 #else
250
251 /* No support for GAS and PCI IDs in 16-bit mode  */
252
253 #define ACPI_PCI_FUNCTION(a)            (u16) ((a) & 0xFFFF0000)
254 #define ACPI_PCI_DEVICE(a)              (u16) ((a) & 0x0000FFFF)
255 #define ACPI_PCI_REGISTER(a)            (u16) ((a) & 0x0000FFFF)
256
257 #endif
258
259 /*
260  * An acpi_handle (which is actually an acpi_namespace_node *) can appear in some contexts,
261  * such as on ap_obj_stack, where a pointer to an acpi_operand_object can also
262  * appear.  This macro is used to distinguish them.
263  *
264  * The Data_type field is the first field in both structures.
265  */
266 #define VALID_DESCRIPTOR_TYPE(d,t)      (((acpi_namespace_node *)d)->data_type == t)
267
268
269 /* Macro to test the object type */
270
271 #define IS_THIS_OBJECT_TYPE(d,t)        (((acpi_operand_object  *)d)->common.type == (u8)t)
272
273 /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
274
275 #define IS_SINGLE_TABLE(x)              (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
276
277 /*
278  * Macro to check if a pointer is within an ACPI table.
279  * Parameter (a) is the pointer to check.  Parameter (b) must be defined
280  * as a pointer to an acpi_table_header.  (b+1) then points past the header,
281  * and ((u8 *)b+b->Length) points one byte past the end of the table.
282  */
283 #ifndef _IA16
284 #define IS_IN_ACPI_TABLE(a,b)           (((u8 *)(a) >= (u8 *)(b + 1)) &&\
285                                                            ((u8 *)(a) < ((u8 *)b + b->length)))
286
287 #else
288 #define IS_IN_ACPI_TABLE(a,b)           (_segment)(a) == (_segment)(b) &&\
289                                                                          (((u8 *)(a) >= (u8 *)(b + 1)) &&\
290                                                                          ((u8 *)(a) < ((u8 *)b + b->length)))
291 #endif
292
293 /*
294  * Macros for the master AML opcode table
295  */
296 #ifdef ACPI_DEBUG
297 #define ACPI_OP(name,Pargs,Iargs,class,type,flags)     {Pargs,Iargs,flags,class,type,name}
298 #else
299 #define ACPI_OP(name,Pargs,Iargs,class,type,flags)     {Pargs,Iargs,flags,class,type}
300 #endif
301
302 #define ARG_TYPE_WIDTH                  5
303 #define ARG_1(x)                        ((u32)(x))
304 #define ARG_2(x)                        ((u32)(x) << (1 * ARG_TYPE_WIDTH))
305 #define ARG_3(x)                        ((u32)(x) << (2 * ARG_TYPE_WIDTH))
306 #define ARG_4(x)                        ((u32)(x) << (3 * ARG_TYPE_WIDTH))
307 #define ARG_5(x)                        ((u32)(x) << (4 * ARG_TYPE_WIDTH))
308 #define ARG_6(x)                        ((u32)(x) << (5 * ARG_TYPE_WIDTH))
309
310 #define ARGI_LIST1(a)                   (ARG_1(a))
311 #define ARGI_LIST2(a,b)                 (ARG_1(b)|ARG_2(a))
312 #define ARGI_LIST3(a,b,c)               (ARG_1(c)|ARG_2(b)|ARG_3(a))
313 #define ARGI_LIST4(a,b,c,d)             (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
314 #define ARGI_LIST5(a,b,c,d,e)           (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
315 #define ARGI_LIST6(a,b,c,d,e,f)         (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
316
317 #define ARGP_LIST1(a)                   (ARG_1(a))
318 #define ARGP_LIST2(a,b)                 (ARG_1(a)|ARG_2(b))
319 #define ARGP_LIST3(a,b,c)               (ARG_1(a)|ARG_2(b)|ARG_3(c))
320 #define ARGP_LIST4(a,b,c,d)             (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
321 #define ARGP_LIST5(a,b,c,d,e)           (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
322 #define ARGP_LIST6(a,b,c,d,e,f)         (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
323
324 #define GET_CURRENT_ARG_TYPE(list)      (list & ((u32) 0x1F))
325 #define INCREMENT_ARG_LIST(list)        (list >>= ((u32) ARG_TYPE_WIDTH))
326
327
328 /*
329  * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions)
330  *
331  * 1) Address space
332  * 2) Length in bytes -- convert to length in bits
333  * 3) Bit offset is zero
334  * 4) Reserved field is zero
335  * 5) Expand address to 64 bits
336  */
337 #define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d)   {a.address_space_id = (u8) d;\
338                                                                                          a.register_bit_width = (u8) MUL_8 (b);\
339                                                                                          a.register_bit_offset = 0;\
340                                                                                          a.reserved = 0;\
341                                                                                          ACPI_STORE_ADDRESS (a.address,c);}
342
343 /* ACPI V1.0 entries -- address space is always I/O */
344
345 #define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c)  ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ACPI_ADR_SPACE_SYSTEM_IO)
346
347
348 /*
349  * Reporting macros that are never compiled out
350  */
351
352 #define PARAM_LIST(pl)                  pl
353
354 /*
355  * Error reporting.  These versions add callers module and line#.  Since
356  * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only
357  * use it in debug mode.
358  */
359
360 #ifdef ACPI_DEBUG
361
362 #define REPORT_INFO(fp)                 {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
363                                                                                         acpi_os_printf PARAM_LIST(fp);}
364 #define REPORT_ERROR(fp)                {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
365                                                                                         acpi_os_printf PARAM_LIST(fp);}
366 #define REPORT_WARNING(fp)              {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
367                                                                                         acpi_os_printf PARAM_LIST(fp);}
368
369 #else
370
371 #define REPORT_INFO(fp)                 {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
372                                                                                         acpi_os_printf PARAM_LIST(fp);}
373 #define REPORT_ERROR(fp)                {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
374                                                                                         acpi_os_printf PARAM_LIST(fp);}
375 #define REPORT_WARNING(fp)              {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
376                                                                                         acpi_os_printf PARAM_LIST(fp);}
377
378 #endif
379
380 /* Error reporting.  These versions pass thru the module and line# */
381
382 #define _REPORT_INFO(a,b,c,fp)          {acpi_ut_report_info(a,b,c); \
383                                                                                         acpi_os_printf PARAM_LIST(fp);}
384 #define _REPORT_ERROR(a,b,c,fp)         {acpi_ut_report_error(a,b,c); \
385                                                                                         acpi_os_printf PARAM_LIST(fp);}
386 #define _REPORT_WARNING(a,b,c,fp)       {acpi_ut_report_warning(a,b,c); \
387                                                                                         acpi_os_printf PARAM_LIST(fp);}
388
389 /*
390  * Debug macros that are conditionally compiled
391  */
392
393 #ifdef ACPI_DEBUG
394
395 #define MODULE_NAME(name)               static char *_THIS_MODULE = name;
396
397 /*
398  * Function entry tracing.
399  * The first parameter should be the procedure name as a quoted string.  This is declared
400  * as a local string ("_Proc_name) so that it can be also used by the function exit macros below.
401  */
402
403 #define PROC_NAME(a)                    acpi_debug_print_info _dbg;     \
404                                                                                 _dbg.component_id = _COMPONENT; \
405                                                                                 _dbg.proc_name   = a;           \
406                                                                                 _dbg.module_name = _THIS_MODULE;
407
408 #define FUNCTION_TRACE(a)               PROC_NAME(a)\
409                                                                                 acpi_ut_trace(__LINE__,&_dbg)
410 #define FUNCTION_TRACE_PTR(a,b)         PROC_NAME(a)\
411                                                                                 acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
412 #define FUNCTION_TRACE_U32(a,b)         PROC_NAME(a)\
413                                                                                 acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
414 #define FUNCTION_TRACE_STR(a,b)         PROC_NAME(a)\
415                                                                                 acpi_ut_trace_str(__LINE__,&_dbg,(NATIVE_CHAR *)b)
416
417 #define FUNCTION_ENTRY()                acpi_ut_track_stack_ptr()
418
419 /*
420  * Function exit tracing.
421  * WARNING: These macros include a return statement.  This is usually considered
422  * bad form, but having a separate exit macro is very ugly and difficult to maintain.
423  * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
424  * so that "_Proc_name" is defined.
425  */
426 #define return_VOID                     {acpi_ut_exit(__LINE__,&_dbg);return;}
427 #define return_ACPI_STATUS(s)           {acpi_ut_status_exit(__LINE__,&_dbg,s);return(s);}
428 #define return_VALUE(s)                 {acpi_ut_value_exit(__LINE__,&_dbg,s);return(s);}
429 #define return_PTR(s)                   {acpi_ut_ptr_exit(__LINE__,&_dbg,(u8 *)s);return(s);}
430
431
432 /* Conditional execution */
433
434 #define DEBUG_EXEC(a)                   a
435 #define NORMAL_EXEC(a)
436
437 #define DEBUG_DEFINE(a)                 a;
438 #define DEBUG_ONLY_MEMBERS(a)           a;
439 #define _OPCODE_NAMES
440 #define _VERBOSE_STRUCTURES
441
442
443 /* Stack and buffer dumping */
444
445 #define DUMP_STACK_ENTRY(a)             acpi_ex_dump_operand(a)
446 #define DUMP_OPERANDS(a,b,c,d,e)        acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
447
448
449 #define DUMP_ENTRY(a,b)                 acpi_ns_dump_entry (a,b)
450 #define DUMP_TABLES(a,b)                acpi_ns_dump_tables(a,b)
451 #define DUMP_PATHNAME(a,b,c,d)          acpi_ns_dump_pathname(a,b,c,d)
452 #define DUMP_RESOURCE_LIST(a)           acpi_rs_dump_resource_list(a)
453 #define DUMP_BUFFER(a,b)                acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
454 #define BREAK_MSG(a)                    acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
455
456
457 /*
458  * Generate INT3 on ACPI_ERROR (Debug only!)
459  */
460
461 #define ERROR_BREAK
462 #ifdef  ERROR_BREAK
463 #define BREAK_ON_ERROR(lvl)              if ((lvl)&ACPI_ERROR) acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
464 #else
465 #define BREAK_ON_ERROR(lvl)
466 #endif
467
468 /*
469  * Master debug print macros
470  * Print iff:
471  *    1) Debug print for the current component is enabled
472  *    2) Debug error level or trace level for the print statement is enabled
473  */
474
475 #define ACPI_DEBUG_PRINT(pl)            acpi_ut_debug_print PARAM_LIST(pl)
476 #define ACPI_DEBUG_PRINT_RAW(pl)        acpi_ut_debug_print_raw PARAM_LIST(pl)
477
478
479 #else
480 /*
481  * This is the non-debug case -- make everything go away,
482  * leaving no executable debug code!
483  */
484
485 #define MODULE_NAME(name)
486 #define _THIS_MODULE ""
487
488 #define DEBUG_EXEC(a)
489 #define NORMAL_EXEC(a)                  a;
490
491 #define DEBUG_DEFINE(a)
492 #define DEBUG_ONLY_MEMBERS(a)
493 #define PROC_NAME(a)
494 #define FUNCTION_TRACE(a)
495 #define FUNCTION_TRACE_PTR(a,b)
496 #define FUNCTION_TRACE_U32(a,b)
497 #define FUNCTION_TRACE_STR(a,b)
498 #define FUNCTION_EXIT
499 #define FUNCTION_STATUS_EXIT(s)
500 #define FUNCTION_VALUE_EXIT(s)
501 #define FUNCTION_ENTRY()
502 #define DUMP_STACK_ENTRY(a)
503 #define DUMP_OPERANDS(a,b,c,d,e)
504 #define DUMP_ENTRY(a,b)
505 #define DUMP_TABLES(a,b)
506 #define DUMP_PATHNAME(a,b,c,d)
507 #define DUMP_RESOURCE_LIST(a)
508 #define DUMP_BUFFER(a,b)
509 #define ACPI_DEBUG_PRINT(pl)
510 #define ACPI_DEBUG_PRINT_RAW(pl)
511 #define BREAK_MSG(a)
512
513 #define return_VOID                     return
514 #define return_ACPI_STATUS(s)           return(s)
515 #define return_VALUE(s)                 return(s)
516 #define return_PTR(s)                   return(s)
517
518 #endif
519
520 /*
521  * Some code only gets executed when the debugger is built in.
522  * Note that this is entirely independent of whether the
523  * DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not.
524  */
525 #ifdef ENABLE_DEBUGGER
526 #define DEBUGGER_EXEC(a)                a
527 #else
528 #define DEBUGGER_EXEC(a)
529 #endif
530
531
532 /*
533  * For 16-bit code, we want to shrink some things even though
534  * we are using ACPI_DEBUG to get the debug output
535  */
536 #ifdef _IA16
537 #undef DEBUG_ONLY_MEMBERS
538 #undef _VERBOSE_STRUCTURES
539 #define DEBUG_ONLY_MEMBERS(a)
540 #endif
541
542
543 #ifdef ACPI_DEBUG
544 /*
545  * 1) Set name to blanks
546  * 2) Copy the object name
547  */
548 #define ADD_OBJECT_NAME(a,b)            MEMSET (a->common.name, ' ', sizeof (a->common.name));\
549                                                                                 STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
550 #else
551
552 #define ADD_OBJECT_NAME(a,b)
553 #endif
554
555
556 /*
557  * Memory allocation tracking (DEBUG ONLY)
558  */
559
560 #ifndef ACPI_DBG_TRACK_ALLOCATIONS
561
562 /* Memory allocation */
563
564 #define ACPI_MEM_ALLOCATE(a)            acpi_os_allocate(a)
565 #define ACPI_MEM_CALLOCATE(a)           acpi_os_callocate(a)
566 #define ACPI_MEM_FREE(a)                acpi_os_free(a)
567 #define ACPI_MEM_TRACKING(a)
568
569
570 #else
571
572 /* Memory allocation */
573
574 #define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
575 #define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
576 #define ACPI_MEM_FREE(a)                acpi_ut_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
577 #define ACPI_MEM_TRACKING(a)            a
578
579 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
580
581
582 #define ACPI_GET_STACK_POINTER          _asm {mov eax, ebx}
583
584 #endif /* ACMACROS_H */