acmacros.h (f8146b882bc156c1d8ddf14bbea67253ebc064bb) | acmacros.h (3920312eeb2e7efdf36defc51e24014a53c31bb0) |
---|---|
1/****************************************************************************** 2 * 3 * Name: acmacros.h - C macros for the entire subsystem. 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2016, Intel Corp. --- 250 unchanged lines hidden (view full) --- 259#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) 260 261/* Generic (non-power-of-two) rounding */ 262 263#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) 264 265#define ACPI_IS_MISALIGNED(value) (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1)) 266 | 1/****************************************************************************** 2 * 3 * Name: acmacros.h - C macros for the entire subsystem. 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2016, Intel Corp. --- 250 unchanged lines hidden (view full) --- 259#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) 260 261/* Generic (non-power-of-two) rounding */ 262 263#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) 264 265#define ACPI_IS_MISALIGNED(value) (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1)) 266 |
267/* Generic (power-of-two) rounding */ 268 269#define ACPI_IS_POWER_OF_TWO(a) (((a) & ((a) - 1)) == 0) 270 | |
271/* 272 * Bitmask creation 273 * Bit positions start at zero. 274 * MASK_BITS_ABOVE creates a mask starting AT the position and above 275 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position | 267/* 268 * Bitmask creation 269 * Bit positions start at zero. 270 * MASK_BITS_ABOVE creates a mask starting AT the position and above 271 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position |
276 * MASK_BITS_ABOVE/BELOW accpets a bit offset to create a mask 277 * MASK_BITS_ABOVE/BELOW_32/64 accpets a bit width to create a mask 278 * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler 279 * differences with the shift operator | |
280 */ 281#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((UINT32) (position)))) 282#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((UINT32) (position))) | 272 */ 273#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((UINT32) (position)))) 274#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((UINT32) (position))) |
283#define ACPI_MASK_BITS_ABOVE_32(width) ((UINT32) ACPI_MASK_BITS_ABOVE(width)) 284#define ACPI_MASK_BITS_BELOW_32(width) ((UINT32) ACPI_MASK_BITS_BELOW(width)) 285#define ACPI_MASK_BITS_ABOVE_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \ 286 ACPI_UINT64_MAX : \ 287 ACPI_MASK_BITS_ABOVE(width)) 288#define ACPI_MASK_BITS_BELOW_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \ 289 (UINT64) 0 : \ 290 ACPI_MASK_BITS_BELOW(width)) | |
291 292/* Bitfields within ACPI registers */ 293 294#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) \ 295 ((Val << Pos) & Mask) 296 297#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) \ 298 Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) --- 141 unchanged lines hidden --- | 275 276/* Bitfields within ACPI registers */ 277 278#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) \ 279 ((Val << Pos) & Mask) 280 281#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) \ 282 Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) --- 141 unchanged lines hidden --- |