powerpc: Fix build error for book3e
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tue, 30 Apr 2013 20:26:08 +0000 (20:26 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 2 May 2013 00:37:37 +0000 (10:37 +1000)
We moved the definition of shift_to_mmu_psize and mmu_psize_to_shift
out of hugetlbpage.c in patch "powerpc: New hugepage directory format".

These functions are not related to hugetlbpage and we want to use them
outside hugetlbpage.c We missed a definition for book3e when we moved
these functions. Add similar functions to mmu-book3e.h

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/mmu-book3e.h

index 8bd560c..936db36 100644 (file)
 #define TLBILX_T_CLASS3                        7
 
 #ifndef __ASSEMBLY__
 #define TLBILX_T_CLASS3                        7
 
 #ifndef __ASSEMBLY__
+#include <asm/bug.h>
 
 extern unsigned int tlbcam_index;
 
 
 extern unsigned int tlbcam_index;
 
@@ -254,6 +255,23 @@ struct mmu_psize_def
 };
 extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
 
 };
 extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
 
+static inline int shift_to_mmu_psize(unsigned int shift)
+{
+       int psize;
+
+       for (psize = 0; psize < MMU_PAGE_COUNT; ++psize)
+               if (mmu_psize_defs[psize].shift == shift)
+                       return psize;
+       return -1;
+}
+
+static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
+{
+       if (mmu_psize_defs[mmu_psize].shift)
+               return mmu_psize_defs[mmu_psize].shift;
+       BUG();
+}
+
 /* The page sizes use the same names as 64-bit hash but are
  * constants
  */
 /* The page sizes use the same names as 64-bit hash but are
  * constants
  */