1c2c66affSColin Finck /******************************************************************************
2c2c66affSColin Finck  *
3c2c66affSColin Finck  * Name: acmacros.h - C macros for the entire subsystem.
4c2c66affSColin Finck  *
5c2c66affSColin Finck  *****************************************************************************/
6c2c66affSColin Finck 
7c2c66affSColin Finck /*
8*03b24380SThomas Faber  * Copyright (C) 2000 - 2022, Intel Corp.
9c2c66affSColin Finck  * All rights reserved.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * Redistribution and use in source and binary forms, with or without
12c2c66affSColin Finck  * modification, are permitted provided that the following conditions
13c2c66affSColin Finck  * are met:
14c2c66affSColin Finck  * 1. Redistributions of source code must retain the above copyright
15c2c66affSColin Finck  *    notice, this list of conditions, and the following disclaimer,
16c2c66affSColin Finck  *    without modification.
17c2c66affSColin Finck  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18c2c66affSColin Finck  *    substantially similar to the "NO WARRANTY" disclaimer below
19c2c66affSColin Finck  *    ("Disclaimer") and any redistribution must be conditioned upon
20c2c66affSColin Finck  *    including a substantially similar Disclaimer requirement for further
21c2c66affSColin Finck  *    binary redistribution.
22c2c66affSColin Finck  * 3. Neither the names of the above-listed copyright holders nor the names
23c2c66affSColin Finck  *    of any contributors may be used to endorse or promote products derived
24c2c66affSColin Finck  *    from this software without specific prior written permission.
25c2c66affSColin Finck  *
26c2c66affSColin Finck  * Alternatively, this software may be distributed under the terms of the
27c2c66affSColin Finck  * GNU General Public License ("GPL") version 2 as published by the Free
28c2c66affSColin Finck  * Software Foundation.
29c2c66affSColin Finck  *
30c2c66affSColin Finck  * NO WARRANTY
31c2c66affSColin Finck  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32c2c66affSColin Finck  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
336eb8cc49SThomas Faber  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34c2c66affSColin Finck  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35c2c66affSColin Finck  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36c2c66affSColin Finck  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37c2c66affSColin Finck  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38c2c66affSColin Finck  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39c2c66affSColin Finck  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40c2c66affSColin Finck  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41c2c66affSColin Finck  * POSSIBILITY OF SUCH DAMAGES.
42c2c66affSColin Finck  */
43c2c66affSColin Finck 
44c2c66affSColin Finck #ifndef __ACMACROS_H__
45c2c66affSColin Finck #define __ACMACROS_H__
46c2c66affSColin Finck 
47c2c66affSColin Finck 
48c2c66affSColin Finck /*
49c2c66affSColin Finck  * Extract data using a pointer. Any more than a byte and we
50c2c66affSColin Finck  * get into potential alignment issues -- see the STORE macros below.
51c2c66affSColin Finck  * Use with care.
52c2c66affSColin Finck  */
53c2c66affSColin Finck #define ACPI_CAST8(ptr)                 ACPI_CAST_PTR (UINT8, (ptr))
54c2c66affSColin Finck #define ACPI_CAST16(ptr)                ACPI_CAST_PTR (UINT16, (ptr))
55c2c66affSColin Finck #define ACPI_CAST32(ptr)                ACPI_CAST_PTR (UINT32, (ptr))
56c2c66affSColin Finck #define ACPI_CAST64(ptr)                ACPI_CAST_PTR (UINT64, (ptr))
57c2c66affSColin Finck #define ACPI_GET8(ptr)                  (*ACPI_CAST8 (ptr))
58c2c66affSColin Finck #define ACPI_GET16(ptr)                 (*ACPI_CAST16 (ptr))
59c2c66affSColin Finck #define ACPI_GET32(ptr)                 (*ACPI_CAST32 (ptr))
60c2c66affSColin Finck #define ACPI_GET64(ptr)                 (*ACPI_CAST64 (ptr))
61c2c66affSColin Finck #define ACPI_SET8(ptr, val)             (*ACPI_CAST8 (ptr) = (UINT8) (val))
62c2c66affSColin Finck #define ACPI_SET16(ptr, val)            (*ACPI_CAST16 (ptr) = (UINT16) (val))
63c2c66affSColin Finck #define ACPI_SET32(ptr, val)            (*ACPI_CAST32 (ptr) = (UINT32) (val))
64c2c66affSColin Finck #define ACPI_SET64(ptr, val)            (*ACPI_CAST64 (ptr) = (UINT64) (val))
65c2c66affSColin Finck 
66c2c66affSColin Finck /*
67c2c66affSColin Finck  * printf() format helper. This macro is a workaround for the difficulties
68c2c66affSColin Finck  * with emitting 64-bit integers and 64-bit pointers with the same code
69c2c66affSColin Finck  * for both 32-bit and 64-bit hosts.
70c2c66affSColin Finck  */
71c2c66affSColin Finck #define ACPI_FORMAT_UINT64(i)           ACPI_HIDWORD(i), ACPI_LODWORD(i)
72c2c66affSColin Finck 
73c2c66affSColin Finck 
74c2c66affSColin Finck /*
75c2c66affSColin Finck  * Macros for moving data around to/from buffers that are possibly unaligned.
76c2c66affSColin Finck  * If the hardware supports the transfer of unaligned data, just do the store.
77c2c66affSColin Finck  * Otherwise, we have to move one byte at a time.
78c2c66affSColin Finck  */
79c2c66affSColin Finck #ifdef ACPI_BIG_ENDIAN
80c2c66affSColin Finck /*
81c2c66affSColin Finck  * Macros for big-endian machines
82c2c66affSColin Finck  */
83c2c66affSColin Finck 
84c2c66affSColin Finck /* These macros reverse the bytes during the move, converting little-endian to big endian */
85c2c66affSColin Finck 
86c2c66affSColin Finck                                                      /* Big Endian      <==        Little Endian */
87c2c66affSColin Finck                                                      /*  Hi...Lo                     Lo...Hi     */
88c2c66affSColin Finck /* 16-bit source, 16/32/64 destination */
89c2c66affSColin Finck 
90c2c66affSColin Finck #define ACPI_MOVE_16_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\
91c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];}
92c2c66affSColin Finck 
93c2c66affSColin Finck #define ACPI_MOVE_16_TO_32(d, s)        {(*(UINT32 *)(void *)(d))=0;\
94c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
95c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
96c2c66affSColin Finck 
97c2c66affSColin Finck #define ACPI_MOVE_16_TO_64(d, s)        {(*(UINT64 *)(void *)(d))=0;\
98c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
99c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
100c2c66affSColin Finck 
101c2c66affSColin Finck /* 32-bit source, 16/32/64 destination */
102c2c66affSColin Finck 
103c2c66affSColin Finck #define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
104c2c66affSColin Finck 
105c2c66affSColin Finck #define ACPI_MOVE_32_TO_32(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
106c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\
107c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
108c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
109c2c66affSColin Finck 
110c2c66affSColin Finck #define ACPI_MOVE_32_TO_64(d, s)        {(*(UINT64 *)(void *)(d))=0;\
111c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
112c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
113c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
114c2c66affSColin Finck                                            ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
115c2c66affSColin Finck 
116c2c66affSColin Finck /* 64-bit source, 16/32/64 destination */
117c2c66affSColin Finck 
118c2c66affSColin Finck #define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
119c2c66affSColin Finck 
120c2c66affSColin Finck #define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)    /* Truncate to 32 */
121c2c66affSColin Finck 
122c2c66affSColin Finck #define ACPI_MOVE_64_TO_64(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
123c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
124c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\
125c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\
126c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
127c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
128c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
129c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
130c2c66affSColin Finck #else
131c2c66affSColin Finck /*
132c2c66affSColin Finck  * Macros for little-endian machines
133c2c66affSColin Finck  */
134c2c66affSColin Finck 
135c2c66affSColin Finck #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
136c2c66affSColin Finck 
137c2c66affSColin Finck /* The hardware supports unaligned transfers, just do the little-endian move */
138c2c66affSColin Finck 
139c2c66affSColin Finck /* 16-bit source, 16/32/64 destination */
140c2c66affSColin Finck 
141c2c66affSColin Finck #define ACPI_MOVE_16_TO_16(d, s)        *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
142c2c66affSColin Finck #define ACPI_MOVE_16_TO_32(d, s)        *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
143c2c66affSColin Finck #define ACPI_MOVE_16_TO_64(d, s)        *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s)
144c2c66affSColin Finck 
145c2c66affSColin Finck /* 32-bit source, 16/32/64 destination */
146c2c66affSColin Finck 
147c2c66affSColin Finck #define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
148c2c66affSColin Finck #define ACPI_MOVE_32_TO_32(d, s)        *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
149c2c66affSColin Finck #define ACPI_MOVE_32_TO_64(d, s)        *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s)
150c2c66affSColin Finck 
151c2c66affSColin Finck /* 64-bit source, 16/32/64 destination */
152c2c66affSColin Finck 
153c2c66affSColin Finck #define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
154c2c66affSColin Finck #define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)    /* Truncate to 32 */
155c2c66affSColin Finck #define ACPI_MOVE_64_TO_64(d, s)        *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
156c2c66affSColin Finck 
157c2c66affSColin Finck #else
158c2c66affSColin Finck /*
159c2c66affSColin Finck  * The hardware does not support unaligned transfers. We must move the
160c2c66affSColin Finck  * data one byte at a time. These macros work whether the source or
161c2c66affSColin Finck  * the destination (or both) is/are unaligned. (Little-endian move)
162c2c66affSColin Finck  */
163c2c66affSColin Finck 
164c2c66affSColin Finck /* 16-bit source, 16/32/64 destination */
165c2c66affSColin Finck 
166c2c66affSColin Finck #define ACPI_MOVE_16_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
167c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
168c2c66affSColin Finck 
169c2c66affSColin Finck #define ACPI_MOVE_16_TO_32(d, s)        {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
170c2c66affSColin Finck #define ACPI_MOVE_16_TO_64(d, s)        {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
171c2c66affSColin Finck 
172c2c66affSColin Finck /* 32-bit source, 16/32/64 destination */
173c2c66affSColin Finck 
174c2c66affSColin Finck #define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
175c2c66affSColin Finck 
176c2c66affSColin Finck #define ACPI_MOVE_32_TO_32(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
177c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
178c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
179c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];}
180c2c66affSColin Finck 
181c2c66affSColin Finck #define ACPI_MOVE_32_TO_64(d, s)        {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);}
182c2c66affSColin Finck 
183c2c66affSColin Finck /* 64-bit source, 16/32/64 destination */
184c2c66affSColin Finck 
185c2c66affSColin Finck #define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
186c2c66affSColin Finck #define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)    /* Truncate to 32 */
187c2c66affSColin Finck #define ACPI_MOVE_64_TO_64(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
188c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
189c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
190c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\
191c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\
192c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\
193c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\
194c2c66affSColin Finck                                          ((  UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];}
195c2c66affSColin Finck #endif
196c2c66affSColin Finck #endif
197c2c66affSColin Finck 
198c2c66affSColin Finck 
199c2c66affSColin Finck /*
200c2c66affSColin Finck  * Fast power-of-two math macros for non-optimized compilers
201c2c66affSColin Finck  */
202c2c66affSColin Finck #define _ACPI_DIV(value, PowerOf2)      ((UINT32) ((value) >> (PowerOf2)))
203c2c66affSColin Finck #define _ACPI_MUL(value, PowerOf2)      ((UINT32) ((value) << (PowerOf2)))
204c2c66affSColin Finck #define _ACPI_MOD(value, Divisor)       ((UINT32) ((value) & ((Divisor) -1)))
205c2c66affSColin Finck 
206c2c66affSColin Finck #define ACPI_DIV_2(a)                   _ACPI_DIV(a, 1)
207c2c66affSColin Finck #define ACPI_MUL_2(a)                   _ACPI_MUL(a, 1)
208c2c66affSColin Finck #define ACPI_MOD_2(a)                   _ACPI_MOD(a, 2)
209c2c66affSColin Finck 
210c2c66affSColin Finck #define ACPI_DIV_4(a)                   _ACPI_DIV(a, 2)
211c2c66affSColin Finck #define ACPI_MUL_4(a)                   _ACPI_MUL(a, 2)
212c2c66affSColin Finck #define ACPI_MOD_4(a)                   _ACPI_MOD(a, 4)
213c2c66affSColin Finck 
214c2c66affSColin Finck #define ACPI_DIV_8(a)                   _ACPI_DIV(a, 3)
215c2c66affSColin Finck #define ACPI_MUL_8(a)                   _ACPI_MUL(a, 3)
216c2c66affSColin Finck #define ACPI_MOD_8(a)                   _ACPI_MOD(a, 8)
217c2c66affSColin Finck 
218c2c66affSColin Finck #define ACPI_DIV_16(a)                  _ACPI_DIV(a, 4)
219c2c66affSColin Finck #define ACPI_MUL_16(a)                  _ACPI_MUL(a, 4)
220c2c66affSColin Finck #define ACPI_MOD_16(a)                  _ACPI_MOD(a, 16)
221c2c66affSColin Finck 
222c2c66affSColin Finck #define ACPI_DIV_32(a)                  _ACPI_DIV(a, 5)
223c2c66affSColin Finck #define ACPI_MUL_32(a)                  _ACPI_MUL(a, 5)
224c2c66affSColin Finck #define ACPI_MOD_32(a)                  _ACPI_MOD(a, 32)
225c2c66affSColin Finck 
226c2c66affSColin Finck /* Test for ASCII character */
227c2c66affSColin Finck 
228c2c66affSColin Finck #define ACPI_IS_ASCII(c)                ((c) < 0x80)
229c2c66affSColin Finck 
230c2c66affSColin Finck /* Signed integers */
231c2c66affSColin Finck 
232c2c66affSColin Finck #define ACPI_SIGN_POSITIVE              0
233c2c66affSColin Finck #define ACPI_SIGN_NEGATIVE              1
234c2c66affSColin Finck 
235c2c66affSColin Finck 
236c2c66affSColin Finck /*
237c2c66affSColin Finck  * Rounding macros (Power of two boundaries only)
238c2c66affSColin Finck  */
239c2c66affSColin Finck #define ACPI_ROUND_DOWN(value, boundary)    (((ACPI_SIZE)(value)) & \
240c2c66affSColin Finck                                                 (~(((ACPI_SIZE) boundary)-1)))
241c2c66affSColin Finck 
242c2c66affSColin Finck #define ACPI_ROUND_UP(value, boundary)      ((((ACPI_SIZE)(value)) + \
243c2c66affSColin Finck                                                 (((ACPI_SIZE) boundary)-1)) & \
244c2c66affSColin Finck                                                 (~(((ACPI_SIZE) boundary)-1)))
245c2c66affSColin Finck 
246c2c66affSColin Finck /* Note: sizeof(ACPI_SIZE) evaluates to either 4 or 8 (32- vs 64-bit mode) */
247c2c66affSColin Finck 
248c2c66affSColin Finck #define ACPI_ROUND_DOWN_TO_32BIT(a)         ACPI_ROUND_DOWN(a, 4)
249c2c66affSColin Finck #define ACPI_ROUND_DOWN_TO_64BIT(a)         ACPI_ROUND_DOWN(a, 8)
250c2c66affSColin Finck #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a)   ACPI_ROUND_DOWN(a, sizeof(ACPI_SIZE))
251c2c66affSColin Finck 
252c2c66affSColin Finck #define ACPI_ROUND_UP_TO_32BIT(a)           ACPI_ROUND_UP(a, 4)
253c2c66affSColin Finck #define ACPI_ROUND_UP_TO_64BIT(a)           ACPI_ROUND_UP(a, 8)
254c2c66affSColin Finck #define ACPI_ROUND_UP_TO_NATIVE_WORD(a)     ACPI_ROUND_UP(a, sizeof(ACPI_SIZE))
255c2c66affSColin Finck 
256c2c66affSColin Finck #define ACPI_ROUND_BITS_UP_TO_BYTES(a)      ACPI_DIV_8((a) + 7)
257c2c66affSColin Finck #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a)    ACPI_DIV_8((a))
258c2c66affSColin Finck 
259c2c66affSColin Finck #define ACPI_ROUND_UP_TO_1K(a)              (((a) + 1023) >> 10)
260c2c66affSColin Finck 
261c2c66affSColin Finck /* Generic (non-power-of-two) rounding */
262c2c66affSColin Finck 
263c2c66affSColin Finck #define ACPI_ROUND_UP_TO(value, boundary)   (((value) + ((boundary)-1)) / (boundary))
264c2c66affSColin Finck 
265c2c66affSColin Finck #define ACPI_IS_MISALIGNED(value)           (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1))
266c2c66affSColin Finck 
267c2c66affSColin Finck /* Generic bit manipulation */
268c2c66affSColin Finck 
269c2c66affSColin Finck #ifndef ACPI_USE_NATIVE_BIT_FINDER
270c2c66affSColin Finck 
271c2c66affSColin Finck #define __ACPI_FIND_LAST_BIT_2(a, r)        ((((UINT8)  (a)) & 0x02) ? (r)+1 : (r))
272c2c66affSColin Finck #define __ACPI_FIND_LAST_BIT_4(a, r)        ((((UINT8)  (a)) & 0x0C) ? \
273c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_2  ((a)>>2,  (r)+2) : \
274c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_2  ((a), (r)))
275c2c66affSColin Finck #define __ACPI_FIND_LAST_BIT_8(a, r)        ((((UINT8)  (a)) & 0xF0) ? \
276c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_4  ((a)>>4,  (r)+4) : \
277c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_4  ((a), (r)))
278c2c66affSColin Finck #define __ACPI_FIND_LAST_BIT_16(a, r)       ((((UINT16) (a)) & 0xFF00) ? \
279c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_8  ((a)>>8,  (r)+8) : \
280c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_8  ((a), (r)))
281c2c66affSColin Finck #define __ACPI_FIND_LAST_BIT_32(a, r)       ((((UINT32) (a)) & 0xFFFF0000) ? \
282c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_16 ((a)>>16, (r)+16) : \
283c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_16 ((a), (r)))
284c2c66affSColin Finck #define __ACPI_FIND_LAST_BIT_64(a, r)       ((((UINT64) (a)) & 0xFFFFFFFF00000000) ? \
285c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_32 ((a)>>32, (r)+32) : \
286c2c66affSColin Finck                                              __ACPI_FIND_LAST_BIT_32 ((a), (r)))
287c2c66affSColin Finck 
288c2c66affSColin Finck #define ACPI_FIND_LAST_BIT_8(a)             ((a) ? __ACPI_FIND_LAST_BIT_8 (a, 1) : 0)
289c2c66affSColin Finck #define ACPI_FIND_LAST_BIT_16(a)            ((a) ? __ACPI_FIND_LAST_BIT_16 (a, 1) : 0)
290c2c66affSColin Finck #define ACPI_FIND_LAST_BIT_32(a)            ((a) ? __ACPI_FIND_LAST_BIT_32 (a, 1) : 0)
291c2c66affSColin Finck #define ACPI_FIND_LAST_BIT_64(a)            ((a) ? __ACPI_FIND_LAST_BIT_64 (a, 1) : 0)
292c2c66affSColin Finck 
293c2c66affSColin Finck #define __ACPI_FIND_FIRST_BIT_2(a, r)       ((((UINT8) (a)) & 0x01) ? (r) : (r)+1)
294c2c66affSColin Finck #define __ACPI_FIND_FIRST_BIT_4(a, r)       ((((UINT8) (a)) & 0x03) ? \
295c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_2  ((a), (r)) : \
296c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_2  ((a)>>2, (r)+2))
297c2c66affSColin Finck #define __ACPI_FIND_FIRST_BIT_8(a, r)       ((((UINT8) (a)) & 0x0F) ? \
298c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_4  ((a), (r)) : \
299c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_4  ((a)>>4, (r)+4))
300c2c66affSColin Finck #define __ACPI_FIND_FIRST_BIT_16(a, r)      ((((UINT16) (a)) & 0x00FF) ? \
301c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_8  ((a), (r)) : \
302c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_8  ((a)>>8, (r)+8))
303c2c66affSColin Finck #define __ACPI_FIND_FIRST_BIT_32(a, r)      ((((UINT32) (a)) & 0x0000FFFF) ? \
304c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_16 ((a), (r)) : \
305c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_16 ((a)>>16, (r)+16))
306c2c66affSColin Finck #define __ACPI_FIND_FIRST_BIT_64(a, r)      ((((UINT64) (a)) & 0x00000000FFFFFFFF) ? \
307c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_32 ((a), (r)) : \
308c2c66affSColin Finck                                              __ACPI_FIND_FIRST_BIT_32 ((a)>>32, (r)+32))
309c2c66affSColin Finck 
310c2c66affSColin Finck #define ACPI_FIND_FIRST_BIT_8(a)            ((a) ? __ACPI_FIND_FIRST_BIT_8 (a, 1) : 0)
311c2c66affSColin Finck #define ACPI_FIND_FIRST_BIT_16(a)           ((a) ? __ACPI_FIND_FIRST_BIT_16 (a, 1) : 0)
312c2c66affSColin Finck #define ACPI_FIND_FIRST_BIT_32(a)           ((a) ? __ACPI_FIND_FIRST_BIT_32 (a, 1) : 0)
313c2c66affSColin Finck #define ACPI_FIND_FIRST_BIT_64(a)           ((a) ? __ACPI_FIND_FIRST_BIT_64 (a, 1) : 0)
314c2c66affSColin Finck 
315c2c66affSColin Finck #endif /* ACPI_USE_NATIVE_BIT_FINDER */
316c2c66affSColin Finck 
317c2c66affSColin Finck /* Generic (power-of-two) rounding */
318c2c66affSColin Finck 
319c2c66affSColin Finck #define ACPI_ROUND_UP_POWER_OF_TWO_8(a)     ((UINT8) \
320c2c66affSColin Finck                                             (((UINT16) 1) <<  ACPI_FIND_LAST_BIT_8  ((a)  - 1)))
321c2c66affSColin Finck #define ACPI_ROUND_DOWN_POWER_OF_TWO_8(a)   ((UINT8) \
322c2c66affSColin Finck                                             (((UINT16) 1) << (ACPI_FIND_LAST_BIT_8  ((a)) - 1)))
323c2c66affSColin Finck #define ACPI_ROUND_UP_POWER_OF_TWO_16(a)    ((UINT16) \
324c2c66affSColin Finck                                             (((UINT32) 1) <<  ACPI_FIND_LAST_BIT_16 ((a)  - 1)))
325c2c66affSColin Finck #define ACPI_ROUND_DOWN_POWER_OF_TWO_16(a)  ((UINT16) \
326c2c66affSColin Finck                                             (((UINT32) 1) << (ACPI_FIND_LAST_BIT_16 ((a)) - 1)))
327c2c66affSColin Finck #define ACPI_ROUND_UP_POWER_OF_TWO_32(a)    ((UINT32) \
328c2c66affSColin Finck                                             (((UINT64) 1) <<  ACPI_FIND_LAST_BIT_32 ((a)  - 1)))
329c2c66affSColin Finck #define ACPI_ROUND_DOWN_POWER_OF_TWO_32(a)  ((UINT32) \
330c2c66affSColin Finck                                             (((UINT64) 1) << (ACPI_FIND_LAST_BIT_32 ((a)) - 1)))
331c2c66affSColin Finck #define ACPI_IS_ALIGNED(a, s)               (((a) & ((s) - 1)) == 0)
332c2c66affSColin Finck #define ACPI_IS_POWER_OF_TWO(a)             ACPI_IS_ALIGNED(a, a)
333c2c66affSColin Finck 
334c2c66affSColin Finck /*
335c2c66affSColin Finck  * Bitmask creation
336c2c66affSColin Finck  * Bit positions start at zero.
337c2c66affSColin Finck  * MASK_BITS_ABOVE creates a mask starting AT the position and above
338c2c66affSColin Finck  * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
339c2c66affSColin Finck  * MASK_BITS_ABOVE/BELOW accepts a bit offset to create a mask
340c2c66affSColin Finck  * MASK_BITS_ABOVE/BELOW_32/64 accepts a bit width to create a mask
341c2c66affSColin Finck  * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler
342c2c66affSColin Finck  * differences with the shift operator
343c2c66affSColin Finck  */
344c2c66affSColin Finck #define ACPI_MASK_BITS_ABOVE(position)      (~((ACPI_UINT64_MAX) << ((UINT32) (position))))
345c2c66affSColin Finck #define ACPI_MASK_BITS_BELOW(position)      ((ACPI_UINT64_MAX) << ((UINT32) (position)))
346c2c66affSColin Finck #define ACPI_MASK_BITS_ABOVE_32(width)      ((UINT32) ACPI_MASK_BITS_ABOVE(width))
347c2c66affSColin Finck #define ACPI_MASK_BITS_BELOW_32(width)      ((UINT32) ACPI_MASK_BITS_BELOW(width))
348c2c66affSColin Finck #define ACPI_MASK_BITS_ABOVE_64(width)      ((width) == ACPI_INTEGER_BIT_SIZE ? \
349c2c66affSColin Finck                                                 ACPI_UINT64_MAX : \
350c2c66affSColin Finck                                                 ACPI_MASK_BITS_ABOVE(width))
351c2c66affSColin Finck #define ACPI_MASK_BITS_BELOW_64(width)      ((width) == ACPI_INTEGER_BIT_SIZE ? \
352c2c66affSColin Finck                                                 (UINT64) 0 : \
353c2c66affSColin Finck                                                 ACPI_MASK_BITS_BELOW(width))
354c2c66affSColin Finck 
355c2c66affSColin Finck /* Bitfields within ACPI registers */
356c2c66affSColin Finck 
357c2c66affSColin Finck #define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) \
358c2c66affSColin Finck     ((Val << Pos) & Mask)
359c2c66affSColin Finck 
360c2c66affSColin Finck #define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) \
361c2c66affSColin Finck     Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
362c2c66affSColin Finck 
363c2c66affSColin Finck #define ACPI_INSERT_BITS(Target, Mask, Source) \
364c2c66affSColin Finck     Target = ((Target & (~(Mask))) | (Source & Mask))
365c2c66affSColin Finck 
366c2c66affSColin Finck /* Generic bitfield macros and masks */
367c2c66affSColin Finck 
368c2c66affSColin Finck #define ACPI_GET_BITS(SourcePtr, Position, Mask) \
369c2c66affSColin Finck     ((*(SourcePtr) >> (Position)) & (Mask))
370c2c66affSColin Finck 
371c2c66affSColin Finck #define ACPI_SET_BITS(TargetPtr, Position, Mask, Value) \
372c2c66affSColin Finck     (*(TargetPtr) |= (((Value) & (Mask)) << (Position)))
373c2c66affSColin Finck 
374c2c66affSColin Finck #define ACPI_1BIT_MASK      0x00000001
375c2c66affSColin Finck #define ACPI_2BIT_MASK      0x00000003
376c2c66affSColin Finck #define ACPI_3BIT_MASK      0x00000007
377c2c66affSColin Finck #define ACPI_4BIT_MASK      0x0000000F
378c2c66affSColin Finck #define ACPI_5BIT_MASK      0x0000001F
379c2c66affSColin Finck #define ACPI_6BIT_MASK      0x0000003F
380c2c66affSColin Finck #define ACPI_7BIT_MASK      0x0000007F
381c2c66affSColin Finck #define ACPI_8BIT_MASK      0x000000FF
382c2c66affSColin Finck #define ACPI_16BIT_MASK     0x0000FFFF
383c2c66affSColin Finck #define ACPI_24BIT_MASK     0x00FFFFFF
384c2c66affSColin Finck 
385c2c66affSColin Finck /* Macros to extract flag bits from position zero */
386c2c66affSColin Finck 
387c2c66affSColin Finck #define ACPI_GET_1BIT_FLAG(Value)                   ((Value) & ACPI_1BIT_MASK)
388c2c66affSColin Finck #define ACPI_GET_2BIT_FLAG(Value)                   ((Value) & ACPI_2BIT_MASK)
389c2c66affSColin Finck #define ACPI_GET_3BIT_FLAG(Value)                   ((Value) & ACPI_3BIT_MASK)
390c2c66affSColin Finck #define ACPI_GET_4BIT_FLAG(Value)                   ((Value) & ACPI_4BIT_MASK)
391c2c66affSColin Finck 
392c2c66affSColin Finck /* Macros to extract flag bits from position one and above */
393c2c66affSColin Finck 
394c2c66affSColin Finck #define ACPI_EXTRACT_1BIT_FLAG(Field, Position)     (ACPI_GET_1BIT_FLAG ((Field) >> Position))
395c2c66affSColin Finck #define ACPI_EXTRACT_2BIT_FLAG(Field, Position)     (ACPI_GET_2BIT_FLAG ((Field) >> Position))
396c2c66affSColin Finck #define ACPI_EXTRACT_3BIT_FLAG(Field, Position)     (ACPI_GET_3BIT_FLAG ((Field) >> Position))
397c2c66affSColin Finck #define ACPI_EXTRACT_4BIT_FLAG(Field, Position)     (ACPI_GET_4BIT_FLAG ((Field) >> Position))
398c2c66affSColin Finck 
399c2c66affSColin Finck /* ACPI Pathname helpers */
400c2c66affSColin Finck 
401c2c66affSColin Finck #define ACPI_IS_ROOT_PREFIX(c)      ((c) == (UINT8) 0x5C) /* Backslash */
402c2c66affSColin Finck #define ACPI_IS_PARENT_PREFIX(c)    ((c) == (UINT8) 0x5E) /* Carat */
403c2c66affSColin Finck #define ACPI_IS_PATH_SEPARATOR(c)   ((c) == (UINT8) 0x2E) /* Period (dot) */
404c2c66affSColin Finck 
405c2c66affSColin Finck /*
406c2c66affSColin Finck  * An object of type ACPI_NAMESPACE_NODE can appear in some contexts
407c2c66affSColin Finck  * where a pointer to an object of type ACPI_OPERAND_OBJECT can also
408c2c66affSColin Finck  * appear. This macro is used to distinguish them.
409c2c66affSColin Finck  *
410c2c66affSColin Finck  * The "DescriptorType" field is the second field in both structures.
411c2c66affSColin Finck  */
412c2c66affSColin Finck #define ACPI_GET_DESCRIPTOR_PTR(d)      (((ACPI_DESCRIPTOR *)(void *)(d))->Common.CommonPointer)
413c2c66affSColin Finck #define ACPI_SET_DESCRIPTOR_PTR(d, p)   (((ACPI_DESCRIPTOR *)(void *)(d))->Common.CommonPointer = (p))
414c2c66affSColin Finck #define ACPI_GET_DESCRIPTOR_TYPE(d)     (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType)
415c2c66affSColin Finck #define ACPI_SET_DESCRIPTOR_TYPE(d, t)  (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = (t))
416c2c66affSColin Finck 
417c2c66affSColin Finck /*
418c2c66affSColin Finck  * Macros for the master AML opcode table
419c2c66affSColin Finck  */
420c2c66affSColin Finck #if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
421c2c66affSColin Finck #define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \
422c2c66affSColin Finck     {Name, (UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type}
423c2c66affSColin Finck #else
424c2c66affSColin Finck #define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \
425c2c66affSColin Finck     {(UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type}
426c2c66affSColin Finck #endif
427c2c66affSColin Finck 
428c2c66affSColin Finck #define ARG_TYPE_WIDTH                  5
429c2c66affSColin Finck #define ARG_1(x)                        ((UINT32)(x))
430c2c66affSColin Finck #define ARG_2(x)                        ((UINT32)(x) << (1 * ARG_TYPE_WIDTH))
431c2c66affSColin Finck #define ARG_3(x)                        ((UINT32)(x) << (2 * ARG_TYPE_WIDTH))
432c2c66affSColin Finck #define ARG_4(x)                        ((UINT32)(x) << (3 * ARG_TYPE_WIDTH))
433c2c66affSColin Finck #define ARG_5(x)                        ((UINT32)(x) << (4 * ARG_TYPE_WIDTH))
434c2c66affSColin Finck #define ARG_6(x)                        ((UINT32)(x) << (5 * ARG_TYPE_WIDTH))
435c2c66affSColin Finck 
436c2c66affSColin Finck #define ARGI_LIST1(a)                   (ARG_1(a))
437c2c66affSColin Finck #define ARGI_LIST2(a, b)                (ARG_1(b)|ARG_2(a))
438c2c66affSColin Finck #define ARGI_LIST3(a, b, c)             (ARG_1(c)|ARG_2(b)|ARG_3(a))
439c2c66affSColin Finck #define ARGI_LIST4(a, b, c, d)          (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
440c2c66affSColin Finck #define ARGI_LIST5(a, b, c, d, e)       (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
441c2c66affSColin Finck #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))
442c2c66affSColin Finck 
443c2c66affSColin Finck #define ARGP_LIST1(a)                   (ARG_1(a))
444c2c66affSColin Finck #define ARGP_LIST2(a, b)                (ARG_1(a)|ARG_2(b))
445c2c66affSColin Finck #define ARGP_LIST3(a, b, c)             (ARG_1(a)|ARG_2(b)|ARG_3(c))
446c2c66affSColin Finck #define ARGP_LIST4(a, b, c, d)          (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
447c2c66affSColin Finck #define ARGP_LIST5(a, b, c, d, e)       (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
448c2c66affSColin Finck #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))
449c2c66affSColin Finck 
450c2c66affSColin Finck #define GET_CURRENT_ARG_TYPE(List)      (List & ((UINT32) 0x1F))
451c2c66affSColin Finck #define INCREMENT_ARG_LIST(List)        (List >>= ((UINT32) ARG_TYPE_WIDTH))
452c2c66affSColin Finck 
453c2c66affSColin Finck /*
454c2c66affSColin Finck  * Ascii error messages can be configured out
455c2c66affSColin Finck  */
456c2c66affSColin Finck #ifndef ACPI_NO_ERROR_MESSAGES
457c2c66affSColin Finck /*
458c2c66affSColin Finck  * Error reporting. The callers module and line number are inserted by AE_INFO,
459c2c66affSColin Finck  * the plist contains a set of parens to allow variable-length lists.
460c2c66affSColin Finck  * These macros are used for both the debug and non-debug versions of the code.
461c2c66affSColin Finck  */
462ec55f0ebSThomas Faber #define ACPI_ERROR_NAMESPACE(s, p, e)       AcpiUtPrefixedNamespaceError (AE_INFO, s, p, e);
463c2c66affSColin Finck #define ACPI_ERROR_METHOD(s, n, p, e)       AcpiUtMethodError (AE_INFO, s, n, p, e);
464c2c66affSColin Finck #define ACPI_WARN_PREDEFINED(plist)         AcpiUtPredefinedWarning plist
465c2c66affSColin Finck #define ACPI_INFO_PREDEFINED(plist)         AcpiUtPredefinedInfo plist
466c2c66affSColin Finck #define ACPI_BIOS_ERROR_PREDEFINED(plist)   AcpiUtPredefinedBiosError plist
4676847cc3aSThomas Faber #define ACPI_ERROR_ONLY(s)                  s
468c2c66affSColin Finck 
469c2c66affSColin Finck #else
470c2c66affSColin Finck 
471c2c66affSColin Finck /* No error messages */
472c2c66affSColin Finck 
4736847cc3aSThomas Faber #define ACPI_ERROR_NAMESPACE(s, p, e)
474c2c66affSColin Finck #define ACPI_ERROR_METHOD(s, n, p, e)
475c2c66affSColin Finck #define ACPI_WARN_PREDEFINED(plist)
476c2c66affSColin Finck #define ACPI_INFO_PREDEFINED(plist)
477c2c66affSColin Finck #define ACPI_BIOS_ERROR_PREDEFINED(plist)
4786847cc3aSThomas Faber #define ACPI_ERROR_ONLY(s)
479c2c66affSColin Finck 
480c2c66affSColin Finck #endif /* ACPI_NO_ERROR_MESSAGES */
481c2c66affSColin Finck 
482c2c66affSColin Finck #if (!ACPI_REDUCED_HARDWARE)
483c2c66affSColin Finck #define ACPI_HW_OPTIONAL_FUNCTION(addr)     addr
484c2c66affSColin Finck #else
485c2c66affSColin Finck #define ACPI_HW_OPTIONAL_FUNCTION(addr)     NULL
486c2c66affSColin Finck #endif
487c2c66affSColin Finck 
488c2c66affSColin Finck 
489c2c66affSColin Finck /*
490c2c66affSColin Finck  * Macros used for ACPICA utilities only
491c2c66affSColin Finck  */
492c2c66affSColin Finck 
493c2c66affSColin Finck /* Generate a UUID */
494c2c66affSColin Finck 
495c2c66affSColin Finck #define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
496c2c66affSColin Finck     (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
497c2c66affSColin Finck     (b) & 0xFF, ((b) >> 8) & 0xFF, \
498c2c66affSColin Finck     (c) & 0xFF, ((c) >> 8) & 0xFF, \
499c2c66affSColin Finck     (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
500c2c66affSColin Finck 
501c2c66affSColin Finck #define ACPI_IS_OCTAL_DIGIT(d)              (((char)(d) >= '0') && ((char)(d) <= '7'))
502c2c66affSColin Finck 
503c2c66affSColin Finck 
504c2c66affSColin Finck /*
5059d53c935SThomas Faber  * Macros used for the ASL-/ASL+ converter utility
506c2c66affSColin Finck  */
507c2c66affSColin Finck #ifdef ACPI_ASL_COMPILER
508c2c66affSColin Finck 
509c2c66affSColin Finck #define ASL_CV_LABEL_FILENODE(a)         CvLabelFileNode(a);
510c2c66affSColin Finck #define ASL_CV_CAPTURE_COMMENTS_ONLY(a)   CvCaptureCommentsOnly (a);
511c2c66affSColin Finck #define ASL_CV_CAPTURE_COMMENTS(a)       CvCaptureComments (a);
512c2c66affSColin Finck #define ASL_CV_TRANSFER_COMMENTS(a)      CvTransferComments (a);
513c2c66affSColin Finck #define ASL_CV_CLOSE_PAREN(a,b)          CvCloseParenWriteComment(a,b);
514c2c66affSColin Finck #define ASL_CV_CLOSE_BRACE(a,b)          CvCloseBraceWriteComment(a,b);
515c2c66affSColin Finck #define ASL_CV_SWITCH_FILES(a,b)         CvSwitchFiles(a,b);
516c2c66affSColin Finck #define ASL_CV_CLEAR_OP_COMMENTS(a)       CvClearOpComments(a);
517c2c66affSColin Finck #define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) CvPrintOneCommentType (a,b,c,d);
518c2c66affSColin Finck #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) CvPrintOneCommentList (a,b);
519c2c66affSColin Finck #define ASL_CV_FILE_HAS_SWITCHED(a)       CvFileHasSwitched(a)
520696cdc63SThomas Faber #define ASL_CV_INIT_FILETREE(a,b)      CvInitFileTree(a,b);
521c2c66affSColin Finck 
522c2c66affSColin Finck #else
523c2c66affSColin Finck 
524c2c66affSColin Finck #define ASL_CV_LABEL_FILENODE(a)
525c2c66affSColin Finck #define ASL_CV_CAPTURE_COMMENTS_ONLY(a)
526c2c66affSColin Finck #define ASL_CV_CAPTURE_COMMENTS(a)
527c2c66affSColin Finck #define ASL_CV_TRANSFER_COMMENTS(a)
528c2c66affSColin Finck #define ASL_CV_CLOSE_PAREN(a,b)          AcpiOsPrintf (")");
529c2c66affSColin Finck #define ASL_CV_CLOSE_BRACE(a,b)          AcpiOsPrintf ("}");
530c2c66affSColin Finck #define ASL_CV_SWITCH_FILES(a,b)
531c2c66affSColin Finck #define ASL_CV_CLEAR_OP_COMMENTS(a)
532c2c66affSColin Finck #define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d)
533c2c66affSColin Finck #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b)
534c2c66affSColin Finck #define ASL_CV_FILE_HAS_SWITCHED(a)       0
535696cdc63SThomas Faber #define ASL_CV_INIT_FILETREE(a,b)
536c2c66affSColin Finck 
537c2c66affSColin Finck #endif
538c2c66affSColin Finck 
539c2c66affSColin Finck #endif /* ACMACROS_H */
540