diff options
author | Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> | 2017-08-28 23:23:32 -0700 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-08-31 14:26:20 +1000 |
commit | b6622a339e8670a1025d4dd84be473c76dabed33 (patch) | |
tree | 01494601391163cb2279753f4c51be6ad55e3835 /arch/powerpc/include | |
parent | 967689141eb37c4365eac0fac82d857773098475 (diff) | |
download | linux-b6622a339e8670a1025d4dd84be473c76dabed33.tar.bz2 |
powerpc/powernv: Move GET_FIELD/SET_FIELD to vas.h
Move the GET_FIELD and SET_FIELD macros to vas.h as VAS and other
users of VAS, including NX-842 can use those macros.
There is a lot of related code between the VAS/NX kernel drivers
and skiboot. For consistency, switch the order of parameters in
SET_FIELD to match the order in skiboot.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Reviewed-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/vas.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h index 9f81db68f27b..7dcf3bded343 100644 --- a/arch/powerpc/include/asm/vas.h +++ b/arch/powerpc/include/asm/vas.h @@ -30,6 +30,14 @@ #define VAS_THRESH_FIFO_GT_EIGHTH_FULL 3 /* + * Get/Set bit fields + */ +#define GET_FIELD(m, v) (((v) & (m)) >> MASK_LSH(m)) +#define MASK_LSH(m) (__builtin_ffsl(m) - 1) +#define SET_FIELD(m, v, val) \ + (((v) & ~(m)) | ((((typeof(v))(val)) << MASK_LSH(m)) & (m))) + +/* * Co-processor Engine type. */ enum vas_cop_type { |