aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>2017-08-28 23:23:32 -0700
committerMichael Ellerman <mpe@ellerman.id.au>2017-08-31 14:26:20 +1000
commitb6622a339e8670a1025d4dd84be473c76dabed33 (patch)
tree01494601391163cb2279753f4c51be6ad55e3835 /arch/powerpc/include/asm
parentpowerpc/powernv/vas: Define macros, register fields and structures (diff)
downloadlinux-dev-b6622a339e8670a1025d4dd84be473c76dabed33.tar.xz
linux-dev-b6622a339e8670a1025d4dd84be473c76dabed33.zip
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/asm')
-rw-r--r--arch/powerpc/include/asm/vas.h8
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 {