Cleanup asm/{elf,page,user}.h: #ifdef __KERNEL__ is no longer needed
[deliverable/linux.git] / include / asm-sparc64 / elf.h
index 69539a8ab833d4645eaab4ccd2536357af2540d9..dc7bc63e507ef67ca455827cddfa33abbb91d0b4 100644 (file)
@@ -7,10 +7,9 @@
  */
 
 #include <asm/ptrace.h>
-#ifdef __KERNEL__
 #include <asm/processor.h>
 #include <asm/uaccess.h>
-#endif
+#include <asm/spitfire.h>
 
 /*
  * Sparc section types
@@ -68,6 +67,8 @@
 #define HWCAP_SPARC_MULDIV      8
 #define HWCAP_SPARC_V9         16
 #define HWCAP_SPARC_ULTRA3     32
+#define HWCAP_SPARC_BLKINIT    64
+#define HWCAP_SPARC_N2         128
 
 /*
  * These are used to set parameters in the core dumps.
@@ -145,11 +146,26 @@ typedef struct {
    instruction set this cpu supports.  */
 
 /* On Ultra, we support all of the v8 capabilities. */
-#define ELF_HWCAP      ((HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
-                         HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \
-                         HWCAP_SPARC_V9) | \
-                        ((tlb_type == cheetah || tlb_type == cheetah_plus) ? \
-                         HWCAP_SPARC_ULTRA3 : 0))
+static inline unsigned int sparc64_elf_hwcap(void)
+{
+       unsigned int cap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR |
+                           HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV |
+                           HWCAP_SPARC_V9);
+
+       if (tlb_type == cheetah || tlb_type == cheetah_plus)
+               cap |= HWCAP_SPARC_ULTRA3;
+       else if (tlb_type == hypervisor) {
+               if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
+                   sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
+                       cap |= HWCAP_SPARC_BLKINIT;
+               if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
+                       cap |= HWCAP_SPARC_N2;
+       }
+
+       return cap;
+}
+
+#define ELF_HWCAP      sparc64_elf_hwcap();
 
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in
@@ -157,7 +173,6 @@ typedef struct {
 
 #define ELF_PLATFORM   (NULL)
 
-#ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2)                     \
 do {   unsigned long new_flags = current_thread_info()->flags; \
        new_flags &= _TIF_32BIT;                        \
@@ -176,6 +191,5 @@ do {        unsigned long new_flags = current_thread_info()->flags; \
        else if (current->personality != PER_LINUX32)   \
                set_personality(PER_LINUX);             \
 } while (0)
-#endif
 
 #endif /* !(__ASM_SPARC64_ELF_H) */
This page took 0.041177 seconds and 5 git commands to generate.