[S390] use facility list for cpu type safety check
Martin Schwidefsky [Fri, 12 Jun 2009 08:26:23 +0000 (10:26 +0200)]
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

arch/s390/include/asm/lowcore.h
arch/s390/kernel/head.S

index 3aeca49..713fe9f 100644 (file)
@@ -30,6 +30,7 @@
 #define __LC_SUBCHANNEL_NR             0x00ba
 #define __LC_IO_INT_PARM               0x00bc
 #define __LC_IO_INT_WORD               0x00c0
+#define __LC_STFL_FAC_LIST             0x00c8
 #define __LC_MCCK_CODE                 0x00e8
 
 #define __LC_DUMP_REIPL                        0x0e00
index 22596d7..bf8cf1c 100644 (file)
@@ -479,27 +479,46 @@ startup:basr      %r13,0                  # get base
        mvc     __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
        mvc     __LC_EXIT_TIMER(8),5f-.LPG0(%r13)
 #ifndef CONFIG_MARCH_G5
-       # check processor version against MARCH_{G5,Z900,Z990,Z9_109,Z10}
-       stidp   __LC_CPUID              # store cpuid
-       lhi     %r0,(3f-2f) / 2
-       la      %r1,2f-.LPG0(%r13)
-0:     clc     __LC_CPUID+4(2),0(%r1)
-       jne     3f
-       lpsw    1f-.LPG0(13)            # machine type not good enough, crash
+       # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
+       xc      __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
+       stfl    __LC_STFL_FAC_LIST      # store facility list
+       tm      __LC_STFL_FAC_LIST,0x01 # stfle available ?
+       jz      0f
+       la      %r0,0
+       .insn   s,0xb2b00000,__LC_STFL_FAC_LIST # store facility list extended
+0:     l       %r0,__LC_STFL_FAC_LIST
+       n       %r0,2f+8-.LPG0(%r13)
+       cl      %r0,2f+8-.LPG0(%r13)
+       jne     1f
+       l       %r0,__LC_STFL_FAC_LIST+4
+       n       %r0,2f+12-.LPG0(%r13)
+       cl      %r0,2f+12-.LPG0(%r13)
+       je      3f
+1:     lpsw    2f-.LPG0(13)            # machine type not good enough, crash
        .align 16
-1:     .long   0x000a0000,0x00000000
-2:
+2:     .long   0x000a0000,0x8badcccc
+#if defined(CONFIG_64BIT)
+#if defined(CONFIG_MARCH_Z10)
+       .long 0xc100efe3, 0xf0680000
+#elif defined(CONFIG_MARCH_Z9_109)
+       .long 0xc100efc3, 0x00000000
+#elif defined(CONFIG_MARCH_Z990)
+       .long 0xc0002000, 0x00000000
+#elif defined(CONFIG_MARCH_Z900)
+       .long 0xc0000000, 0x00000000
+#endif
+#else
 #if defined(CONFIG_MARCH_Z10)
-       .short 0x9672, 0x2064, 0x2066, 0x2084, 0x2086, 0x2094, 0x2096
+       .long 0x8100c880, 0x00000000
 #elif defined(CONFIG_MARCH_Z9_109)
-       .short 0x9672, 0x2064, 0x2066, 0x2084, 0x2086
+       .long 0x8100c880, 0x00000000
 #elif defined(CONFIG_MARCH_Z990)
-       .short 0x9672, 0x2064, 0x2066
+       .long 0x80002000, 0x00000000
 #elif defined(CONFIG_MARCH_Z900)
-       .short 0x9672
+       .long 0x80000000, 0x00000000
+#endif
 #endif
-3:     la      %r1,2(%r1)
-       brct    %r0,0b
+3:
 #endif
 
        l       %r13,4f-.LPG0(%r13)