File tree Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -1018,20 +1018,9 @@ AcpiExInsertIntoField (
1018
1018
1019
1019
AccessBitWidth = ACPI_MUL_8 (ObjDesc -> CommonField .AccessByteWidth );
1020
1020
1021
- /*
1022
- * Create the bitmasks used for bit insertion.
1023
- * Note: This if/else is used to bypass compiler differences with the
1024
- * shift operator
1025
- */
1026
- if (AccessBitWidth == ACPI_INTEGER_BIT_SIZE )
1027
- {
1028
- WidthMask = ACPI_UINT64_MAX ;
1029
- }
1030
- else
1031
- {
1032
- WidthMask = ACPI_MASK_BITS_ABOVE (AccessBitWidth );
1033
- }
1021
+ /* Create the bitmasks used for bit insertion */
1034
1022
1023
+ WidthMask = ACPI_MASK_BITS_ABOVE_64 (AccessBitWidth );
1035
1024
Mask = WidthMask &
1036
1025
ACPI_MASK_BITS_BELOW (ObjDesc -> CommonField .StartFieldBitOffset );
1037
1026
Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ AcpiHwRead (
315
315
}
316
316
317
317
ACPI_SET_BITS (Value , Index * AccessWidth ,
318
- ( 1 << AccessWidth ) - 1 , Value32 );
318
+ ACPI_MASK_BITS_ABOVE_32 ( AccessWidth ), Value32 );
319
319
320
320
BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth ;
321
321
Index ++ ;
@@ -386,7 +386,7 @@ AcpiHwWrite (
386
386
while (BitWidth )
387
387
{
388
388
NewValue32 = ACPI_GET_BITS (& Value , Index * AccessWidth ,
389
- ( 1 << AccessWidth ) - 1 );
389
+ ACPI_MASK_BITS_ABOVE_32 ( AccessWidth ));
390
390
391
391
if (BitOffset > AccessWidth )
392
392
{
Original file line number Diff line number Diff line change 345
345
* Bit positions start at zero.
346
346
* MASK_BITS_ABOVE creates a mask starting AT the position and above
347
347
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
348
+ * MASK_BITS_ABOVE/BELOW accpets a bit offset to create a mask
349
+ * MASK_BITS_ABOVE/BELOW_32/64 accpets a bit width to create a mask
350
+ * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler
351
+ * differences with the shift operator
348
352
*/
349
353
#define ACPI_MASK_BITS_ABOVE (position ) (~((ACPI_UINT64_MAX) << ((UINT32) (position))))
350
354
#define ACPI_MASK_BITS_BELOW (position ) ((ACPI_UINT64_MAX) << ((UINT32) (position)))
355
+ #define ACPI_MASK_BITS_ABOVE_32 (width ) ((UINT32) ACPI_MASK_BITS_ABOVE(width))
356
+ #define ACPI_MASK_BITS_BELOW_32 (width ) ((UINT32) ACPI_MASK_BITS_BELOW(width))
357
+ #define ACPI_MASK_BITS_ABOVE_64 (width ) ((width) == ACPI_INTEGER_BIT_SIZE ? \
358
+ ACPI_UINT64_MAX : \
359
+ ACPI_MASK_BITS_ABOVE(width))
360
+ #define ACPI_MASK_BITS_BELOW_64 (width ) ((width) == ACPI_INTEGER_BIT_SIZE ? \
361
+ (UINT64) 0 : \
362
+ ACPI_MASK_BITS_BELOW(width))
351
363
352
364
/* Bitfields within ACPI registers */
353
365
You can’t perform that action at this time.
0 commit comments