Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / arch / ppc.c
1 /* Copyright (C) 2017 International Business Machines Corp.
2  * All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version
7  * 2 of the License, or (at your option) any later version.
8  */
9 #include "arch/ppc.h"
10 #include "arch/probe.h"
11
12 /* flags we export */
13 int ceph_arch_ppc_crc32 = 0;
14
15 #include <stdio.h>
16
17 #if __linux__ && __powerpc64__
18 #include <sys/auxv.h>
19 #include <asm/cputable.h>
20 #endif /* __linux__ && __powerpc64__ */
21
22 #ifndef PPC_FEATURE2_VEC_CRYPTO
23 #define PPC_FEATURE2_VEC_CRYPTO         0x02000000
24 #endif
25
26 #ifndef AT_HWCAP2
27 #define AT_HWCAP2       26
28 #endif
29
30 int ceph_arch_ppc_probe(void)
31 {
32   ceph_arch_ppc_crc32 = 0;
33
34 #if __linux__ && __powerpc64__
35   if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO) ceph_arch_ppc_crc32 = 1;
36 #endif /* __linux__ && __powerpc64__ */
37
38   return 0;
39 }
40