acmacros.h (0b6c404a07e3240b95aa5682fb8fd57c41609d7a) | acmacros.h (be030a576854238250d70135644cde6a0ba34b0d) |
---|---|
1/****************************************************************************** 2 * 3 * Name: acmacros.h - C macros for the entire subsystem. 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2012, Intel Corp. --- 263 unchanged lines hidden (view full) --- 272 * MASK_BITS_ABOVE creates a mask starting AT the position and above 273 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position 274 */ 275#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position)))) 276#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position))) 277 278/* Bitfields within ACPI registers */ 279 | 1/****************************************************************************** 2 * 3 * Name: acmacros.h - C macros for the entire subsystem. 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2012, Intel Corp. --- 263 unchanged lines hidden (view full) --- 272 * MASK_BITS_ABOVE creates a mask starting AT the position and above 273 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position 274 */ 275#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position)))) 276#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position))) 277 278/* Bitfields within ACPI registers */ 279 |
280#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) 281#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | 280#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) \ 281 ((val << pos) & mask) |
282 | 282 |
283#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) | 283#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) \ 284 reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) |
284 | 285 |
286#define ACPI_INSERT_BITS(target, mask, source) \ 287 target = ((target & (~(mask))) | (source & mask)) 288 289/* Generic bitfield macros and masks */ 290 291#define ACPI_GET_BITS(source_ptr, position, mask) \ 292 ((*source_ptr >> position) & mask) 293 294#define ACPI_SET_BITS(target_ptr, position, mask, value) \ 295 (*target_ptr |= ((value & mask) << position)) 296 297#define ACPI_1BIT_MASK 0x00000001 298#define ACPI_2BIT_MASK 0x00000003 299#define ACPI_3BIT_MASK 0x00000007 300#define ACPI_4BIT_MASK 0x0000000F 301#define ACPI_5BIT_MASK 0x0000001F 302#define ACPI_6BIT_MASK 0x0000003F 303#define ACPI_7BIT_MASK 0x0000007F 304#define ACPI_8BIT_MASK 0x000000FF 305#define ACPI_16BIT_MASK 0x0000FFFF 306#define ACPI_24BIT_MASK 0x00FFFFFF 307 |
|
285/* 286 * An object of type struct acpi_namespace_node can appear in some contexts 287 * where a pointer to an object of type union acpi_operand_object can also 288 * appear. This macro is used to distinguish them. 289 * 290 * The "Descriptor" field is the first field in both structures. 291 */ 292#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) --- 292 unchanged lines hidden --- | 308/* 309 * An object of type struct acpi_namespace_node can appear in some contexts 310 * where a pointer to an object of type union acpi_operand_object can also 311 * appear. This macro is used to distinguish them. 312 * 313 * The "Descriptor" field is the first field in both structures. 314 */ 315#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) --- 292 unchanged lines hidden --- |