sysclt(2) and ID register access emulation can share the variables.
ok jca@
-/* $OpenBSD: autoconf.c,v 1.14 2022/09/08 10:22:06 kn Exp $ */
+/* $OpenBSD: autoconf.c,v 1.15 2024/07/17 15:21:59 kettenis Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
*
unmap_startup();
+ cpu_identify_cleanup();
+
#ifdef CRYPTO
if (arm64_has_aes)
cryptox_setup();
-/* $OpenBSD: cpu.c,v 1.126 2024/07/14 09:48:48 jca Exp $ */
+/* $OpenBSD: cpu.c,v 1.127 2024/07/17 15:21:59 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
#endif
}
+void
+cpu_identify_cleanup(void)
+{
+ uint64_t value;
+
+ /* ID_AA64ISAR0_EL1 */
+ value = cpu_id_aa64isar0 & ID_AA64ISAR0_MASK;
+ value &= ~ID_AA64ISAR0_TLB_MASK;
+ cpu_id_aa64isar0 = value;
+
+ /* ID_AA64ISAR1_EL1 */
+ value = cpu_id_aa64isar1 &= ID_AA64ISAR1_MASK;
+ value &= ~ID_AA64ISAR1_SPECRES_MASK;
+ cpu_id_aa64isar1 = value;
+
+ /* ID_AA64ISAR2_EL1 */
+ value = cpu_id_aa64isar2 &= ID_AA64ISAR2_MASK;
+ value &= ~ID_AA64ISAR2_CLRBHB_MASK;
+ cpu_id_aa64isar2 = value;
+
+ /* ID_AA64PFR0_EL1 */
+ value = 0;
+ value |= cpu_id_aa64pfr0 & ID_AA64PFR0_FP_MASK;
+ value |= cpu_id_aa64pfr0 & ID_AA64PFR0_ADV_SIMD_MASK;
+ value |= cpu_id_aa64pfr0 & ID_AA64PFR0_DIT_MASK;
+ cpu_id_aa64pfr0 = value;
+
+ /* ID_AA64PFR1_EL1 */
+ value = 0;
+ value |= cpu_id_aa64pfr1 & ID_AA64PFR1_BT_MASK;
+ value |= cpu_id_aa64pfr1 & ID_AA64PFR1_SSBS_MASK;
+ cpu_id_aa64pfr1 = value;
+}
+
void cpu_init(void);
int cpu_start_secondary(struct cpu_info *ci, int, uint64_t);
int cpu_clockspeed(int *);
-/* $OpenBSD: machdep.c,v 1.90 2024/07/03 21:04:04 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.91 2024/07/17 15:21:59 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
{
char *compatible;
int node, len, error;
- uint64_t value;
/* all sysctl names at this level are terminal */
if (namelen != 1)
free(compatible, M_TEMP, len);
return error;
case CPU_ID_AA64ISAR0:
- value = cpu_id_aa64isar0 & ID_AA64ISAR0_MASK;
- value &= ~ID_AA64ISAR0_TLB_MASK;
- return sysctl_rdquad(oldp, oldlenp, newp, value);
+ return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64isar0);
case CPU_ID_AA64ISAR1:
- value = cpu_id_aa64isar1 & ID_AA64ISAR1_MASK;
- value &= ~ID_AA64ISAR1_SPECRES_MASK;
- return sysctl_rdquad(oldp, oldlenp, newp, value);
+ return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64isar1);
+ case CPU_ID_AA64ISAR2:
+ return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64isar2);
case CPU_ID_AA64PFR0:
- value = 0;
- value |= cpu_id_aa64pfr0 & ID_AA64PFR0_FP_MASK;
- value |= cpu_id_aa64pfr0 & ID_AA64PFR0_ADV_SIMD_MASK;
- value |= cpu_id_aa64pfr0 & ID_AA64PFR0_DIT_MASK;
- return sysctl_rdquad(oldp, oldlenp, newp, value);
+ return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64pfr0);
case CPU_ID_AA64PFR1:
- value = 0;
- value |= cpu_id_aa64pfr1 & ID_AA64PFR1_BT_MASK;
- value |= cpu_id_aa64pfr1 & ID_AA64PFR1_SSBS_MASK;
- return sysctl_rdquad(oldp, oldlenp, newp, value);
- case CPU_ID_AA64ISAR2:
+ return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64pfr1);
case CPU_ID_AA64MMFR0:
case CPU_ID_AA64MMFR1:
case CPU_ID_AA64MMFR2:
-/* $OpenBSD: cpu.h,v 1.48 2024/07/10 11:01:24 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.49 2024/07/17 15:21:59 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
*
extern uint64_t cpu_id_aa64isar0;
extern uint64_t cpu_id_aa64isar1;
+extern uint64_t cpu_id_aa64isar2;
extern uint64_t cpu_id_aa64pfr0;
extern uint64_t cpu_id_aa64pfr1;
+void cpu_identify_cleanup(void);
+
#include <machine/intr.h>
#include <machine/frame.h>
#include <machine/armreg.h>