/*
- * Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2009-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
void OPENSSL_altivec_probe(void);
void OPENSSL_crypto207_probe(void);
void OPENSSL_madd300_probe(void);
+void OPENSSL_brd31_probe(void);
long OPENSSL_rdtsc_mftb(void);
long OPENSSL_rdtsc_mfspr268(void);
#endif
/* I wish <sys/auxv.h> was universally available */
-#define HWCAP 16 /* AT_HWCAP */
+#ifndef AT_HWCAP
+# define AT_HWCAP 16 /* AT_HWCAP */
+#endif
#define HWCAP_PPC64 (1U << 30)
#define HWCAP_ALTIVEC (1U << 28)
#define HWCAP_FPU (1U << 27)
#define HWCAP_POWER6_EXT (1U << 9)
#define HWCAP_VSX (1U << 7)
-#define HWCAP2 26 /* AT_HWCAP2 */
+#ifndef AT_HWCAP2
+# define AT_HWCAP2 26 /* AT_HWCAP2 */
+#endif
#define HWCAP_VEC_CRYPTO (1U << 25)
#define HWCAP_ARCH_3_00 (1U << 23)
+#define HWCAP_ARCH_3_1 (1U << 18)
# if defined(__GNUC__) && __GNUC__>=2
__attribute__ ((constructor))
if (__power_set(0xffffffffU<<17)) /* POWER9 and later */
OPENSSL_ppccap_P |= PPC_MADD300;
+ if (__power_set(0xffffffffU<<18)) /* POWER10 and later */
+ OPENSSL_ppccap_P |= PPC_BRD31;
+
return;
# endif
#endif
#ifdef OSSL_IMPLEMENT_GETAUXVAL
{
- unsigned long hwcap = getauxval(HWCAP);
- unsigned long hwcap2 = getauxval(HWCAP2);
+ unsigned long hwcap = getauxval(AT_HWCAP);
+ unsigned long hwcap2 = getauxval(AT_HWCAP2);
if (hwcap & HWCAP_FPU) {
OPENSSL_ppccap_P |= PPC_FPU;
if (hwcap2 & HWCAP_ARCH_3_00) {
OPENSSL_ppccap_P |= PPC_MADD300;
}
+
+ if (hwcap2 & HWCAP_ARCH_3_1) {
+ OPENSSL_ppccap_P |= PPC_BRD31;
+ }
}
#endif