Lines Matching +full:- +full:a
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
4 * Name: acmacros.h - C macros for the entire subsystem.
6 * Copyright (C) 2000 - 2023, Intel Corp.
14 * Extract data using a pointer. Any more than a byte and we
15 * get into potential alignment issues -- see the STORE macros below.
32 * printf() format helper. This macro is a workaround for the difficulties
33 * with emitting 64-bit integers and 64-bit pointers with the same code
34 * for both 32-bit and 64-bit hosts.
41 * Otherwise, we have to move one byte at a time.
45 * Macros for big-endian machines
48 /* These macros reverse the bytes during the move, converting little-endian to big endian */
52 /* 16-bit source, 16/32/64 destination */
65 /* 32-bit source, 16/32/64 destination */
80 /* 64-bit source, 16/32/64 destination */
96 * Macros for little-endian machines
101 /* The hardware supports unaligned transfers, just do the little-endian move */
103 /* 16-bit source, 16/32/64 destination */
109 /* 32-bit source, 16/32/64 destination */
115 /* 64-bit source, 16/32/64 destination */
124 * data one byte at a time. These macros work whether the source or
125 * the destination (or both) is/are unaligned. (Little-endian move)
128 /* 16-bit source, 16/32/64 destination */
136 /* 32-bit source, 16/32/64 destination */
147 /* 64-bit source, 16/32/64 destination */
163 * Fast power-of-two math macros for non-optimized compilers
167 #define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1)))
169 #define ACPI_DIV_2(a) _ACPI_DIV(a, 1) argument
170 #define ACPI_MUL_2(a) _ACPI_MUL(a, 1) argument
171 #define ACPI_MOD_2(a) _ACPI_MOD(a, 2) argument
173 #define ACPI_DIV_4(a) _ACPI_DIV(a, 2) argument
174 #define ACPI_MUL_4(a) _ACPI_MUL(a, 2) argument
175 #define ACPI_MOD_4(a) _ACPI_MOD(a, 4) argument
177 #define ACPI_DIV_8(a) _ACPI_DIV(a, 3) argument
178 #define ACPI_MUL_8(a) _ACPI_MUL(a, 3) argument
179 #define ACPI_MOD_8(a) _ACPI_MOD(a, 8) argument
181 #define ACPI_DIV_16(a) _ACPI_DIV(a, 4) argument
182 #define ACPI_MUL_16(a) _ACPI_MUL(a, 4) argument
183 #define ACPI_MOD_16(a) _ACPI_MOD(a, 16) argument
185 #define ACPI_DIV_32(a) _ACPI_DIV(a, 5) argument
186 #define ACPI_MUL_32(a) _ACPI_MUL(a, 5) argument
187 #define ACPI_MOD_32(a) _ACPI_MOD(a, 32) argument
202 (~(((acpi_size) boundary)-1)))
205 (((acpi_size) boundary)-1)) & \
206 (~(((acpi_size) boundary)-1)))
208 /* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
210 #define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4) argument
211 #define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8) argument
212 #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(acpi_size)) argument
214 #define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4) argument
215 #define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8) argument
216 #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(acpi_size)) argument
218 #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) argument
219 #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) argument
221 #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) argument
223 /* Generic (non-power-of-two) rounding */
225 #define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary))
227 #define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
233 #define __ACPI_FIND_LAST_BIT_2(a, r) ((((u8) (a)) & 0x02) ? (r)+1 : (r)) argument
234 #define __ACPI_FIND_LAST_BIT_4(a, r) ((((u8) (a)) & 0x0C) ? \ argument
235 __ACPI_FIND_LAST_BIT_2 ((a)>>2, (r)+2) : \
236 __ACPI_FIND_LAST_BIT_2 ((a), (r)))
237 #define __ACPI_FIND_LAST_BIT_8(a, r) ((((u8) (a)) & 0xF0) ? \ argument
238 __ACPI_FIND_LAST_BIT_4 ((a)>>4, (r)+4) : \
239 __ACPI_FIND_LAST_BIT_4 ((a), (r)))
240 #define __ACPI_FIND_LAST_BIT_16(a, r) ((((u16) (a)) & 0xFF00) ? \ argument
241 __ACPI_FIND_LAST_BIT_8 ((a)>>8, (r)+8) : \
242 __ACPI_FIND_LAST_BIT_8 ((a), (r)))
243 #define __ACPI_FIND_LAST_BIT_32(a, r) ((((u32) (a)) & 0xFFFF0000) ? \ argument
244 __ACPI_FIND_LAST_BIT_16 ((a)>>16, (r)+16) : \
245 __ACPI_FIND_LAST_BIT_16 ((a), (r)))
246 #define __ACPI_FIND_LAST_BIT_64(a, r) ((((u64) (a)) & 0xFFFFFFFF00000000) ? \ argument
247 __ACPI_FIND_LAST_BIT_32 ((a)>>32, (r)+32) : \
248 __ACPI_FIND_LAST_BIT_32 ((a), (r)))
250 #define ACPI_FIND_LAST_BIT_8(a) ((a) ? __ACPI_FIND_LAST_BIT_8 (a, 1) : 0) argument
251 #define ACPI_FIND_LAST_BIT_16(a) ((a) ? __ACPI_FIND_LAST_BIT_16 (a, 1) : 0) argument
252 #define ACPI_FIND_LAST_BIT_32(a) ((a) ? __ACPI_FIND_LAST_BIT_32 (a, 1) : 0) argument
253 #define ACPI_FIND_LAST_BIT_64(a) ((a) ? __ACPI_FIND_LAST_BIT_64 (a, 1) : 0) argument
255 #define __ACPI_FIND_FIRST_BIT_2(a, r) ((((u8) (a)) & 0x01) ? (r) : (r)+1) argument
256 #define __ACPI_FIND_FIRST_BIT_4(a, r) ((((u8) (a)) & 0x03) ? \ argument
257 __ACPI_FIND_FIRST_BIT_2 ((a), (r)) : \
258 __ACPI_FIND_FIRST_BIT_2 ((a)>>2, (r)+2))
259 #define __ACPI_FIND_FIRST_BIT_8(a, r) ((((u8) (a)) & 0x0F) ? \ argument
260 __ACPI_FIND_FIRST_BIT_4 ((a), (r)) : \
261 __ACPI_FIND_FIRST_BIT_4 ((a)>>4, (r)+4))
262 #define __ACPI_FIND_FIRST_BIT_16(a, r) ((((u16) (a)) & 0x00FF) ? \ argument
263 __ACPI_FIND_FIRST_BIT_8 ((a), (r)) : \
264 __ACPI_FIND_FIRST_BIT_8 ((a)>>8, (r)+8))
265 #define __ACPI_FIND_FIRST_BIT_32(a, r) ((((u32) (a)) & 0x0000FFFF) ? \ argument
266 __ACPI_FIND_FIRST_BIT_16 ((a), (r)) : \
267 __ACPI_FIND_FIRST_BIT_16 ((a)>>16, (r)+16))
268 #define __ACPI_FIND_FIRST_BIT_64(a, r) ((((u64) (a)) & 0x00000000FFFFFFFF) ? \ argument
269 __ACPI_FIND_FIRST_BIT_32 ((a), (r)) : \
270 __ACPI_FIND_FIRST_BIT_32 ((a)>>32, (r)+32))
272 #define ACPI_FIND_FIRST_BIT_8(a) ((a) ? __ACPI_FIND_FIRST_BIT_8 (a, 1) : 0) argument
273 #define ACPI_FIND_FIRST_BIT_16(a) ((a) ? __ACPI_FIND_FIRST_BIT_16 (a, 1) : 0) argument
274 #define ACPI_FIND_FIRST_BIT_32(a) ((a) ? __ACPI_FIND_FIRST_BIT_32 (a, 1) : 0) argument
275 #define ACPI_FIND_FIRST_BIT_64(a) ((a) ? __ACPI_FIND_FIRST_BIT_64 (a, 1) : 0) argument
279 /* Generic (power-of-two) rounding */
281 #define ACPI_ROUND_UP_POWER_OF_TWO_8(a) ((u8) \ argument
282 (((u16) 1) << ACPI_FIND_LAST_BIT_8 ((a) - 1)))
283 #define ACPI_ROUND_DOWN_POWER_OF_TWO_8(a) ((u8) \ argument
284 (((u16) 1) << (ACPI_FIND_LAST_BIT_8 ((a)) - 1)))
285 #define ACPI_ROUND_UP_POWER_OF_TWO_16(a) ((u16) \ argument
286 (((u32) 1) << ACPI_FIND_LAST_BIT_16 ((a) - 1)))
287 #define ACPI_ROUND_DOWN_POWER_OF_TWO_16(a) ((u16) \ argument
288 (((u32) 1) << (ACPI_FIND_LAST_BIT_16 ((a)) - 1)))
289 #define ACPI_ROUND_UP_POWER_OF_TWO_32(a) ((u32) \ argument
290 (((u64) 1) << ACPI_FIND_LAST_BIT_32 ((a) - 1)))
291 #define ACPI_ROUND_DOWN_POWER_OF_TWO_32(a) ((u32) \ argument
292 (((u64) 1) << (ACPI_FIND_LAST_BIT_32 ((a)) - 1)))
293 #define ACPI_IS_ALIGNED(a, s) (((a) & ((s) - 1)) == 0) argument
294 #define ACPI_IS_POWER_OF_TWO(a) ACPI_IS_ALIGNED(a, a) argument
299 * MASK_BITS_ABOVE creates a mask starting AT the position and above
300 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
301 * MASK_BITS_ABOVE/BELOW accepts a bit offset to create a mask
302 * MASK_BITS_ABOVE/BELOW_32/64 accepts a bit width to create a mask
369 * where a pointer to an object of type union acpi_operand_object can also
374 #define ACPI_GET_DESCRIPTOR_PTR(d) (((union acpi_descriptor *)(void *)(d))->common.common_poin…
375 #define ACPI_SET_DESCRIPTOR_PTR(d, p) (((union acpi_descriptor *)(void *)(d))->common.common_poin…
376 #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_…
377 #define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_…
398 #define ARGI_LIST1(a) (ARG_1(a)) argument
399 #define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a)) argument
400 #define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) argument
401 #define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) argument
402 #define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) argument
403 #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)) argument
405 #define ARGP_LIST1(a) (ARG_1(a)) argument
406 #define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b)) argument
407 #define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) argument
408 #define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) argument
409 #define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) argument
410 #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)) argument
421 * the plist contains a set of parens to allow variable-length lists.
422 * These macros are used for both the debug and non-debug versions of the code.
454 /* Generate a UUID */
456 #define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ argument
457 (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
465 * Macros used for the ASL-/ASL+ converter utility
469 #define ASL_CV_LABEL_FILENODE(a) cv_label_file_node(a); argument
470 #define ASL_CV_CAPTURE_COMMENTS_ONLY(a) cv_capture_comments_only (a); argument
471 #define ASL_CV_CAPTURE_COMMENTS(a) cv_capture_comments (a); argument
472 #define ASL_CV_TRANSFER_COMMENTS(a) cv_transfer_comments (a); argument
473 #define ASL_CV_CLOSE_PAREN(a,b) cv_close_paren_write_comment(a,b); argument
474 #define ASL_CV_CLOSE_BRACE(a,b) cv_close_brace_write_comment(a,b); argument
475 #define ASL_CV_SWITCH_FILES(a,b) cv_switch_files(a,b); argument
476 #define ASL_CV_CLEAR_OP_COMMENTS(a) cv_clear_op_comments(a); argument
477 #define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) cv_print_one_comment_type (a,b,c,d); argument
478 #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) cv_print_one_comment_list (a,b); argument
479 #define ASL_CV_FILE_HAS_SWITCHED(a) cv_file_has_switched(a) argument
480 #define ASL_CV_INIT_FILETREE(a,b) cv_init_file_tree(a,b); argument
484 #define ASL_CV_LABEL_FILENODE(a) argument
485 #define ASL_CV_CAPTURE_COMMENTS_ONLY(a) argument
486 #define ASL_CV_CAPTURE_COMMENTS(a) argument
487 #define ASL_CV_TRANSFER_COMMENTS(a) argument
488 #define ASL_CV_CLOSE_PAREN(a,b) acpi_os_printf (")"); argument
489 #define ASL_CV_CLOSE_BRACE(a,b) acpi_os_printf ("}"); argument
490 #define ASL_CV_SWITCH_FILES(a,b) argument
491 #define ASL_CV_CLEAR_OP_COMMENTS(a) argument
492 #define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) argument
493 #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) argument
494 #define ASL_CV_FILE_HAS_SWITCHED(a) 0 argument
495 #define ASL_CV_INIT_FILETREE(a,b) argument