1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

Move cpu_features to hwcap and cpu_features2 to hwcap2

ok jca@
This commit is contained in:
gkoehler 2024-11-28 18:54:36 +00:00
parent db835d3241
commit d9a6171acb
3 changed files with 9 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.h,v 1.38 2024/07/21 16:49:26 jca Exp $ */
/* $OpenBSD: cpu.h,v 1.39 2024/11/28 18:54:36 gkoehler Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@ -175,9 +175,6 @@ void signotify(struct proc *);
#define curpcb curcpu()->ci_curpcb
extern uint32_t cpu_features;
extern uint32_t cpu_features2;
void cpu_init_features(void);
void cpu_init(void);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.29 2024/07/21 16:49:26 jca Exp $ */
/* $OpenBSD: cpu.c,v 1.30 2024/11/28 18:54:36 gkoehler Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@ -58,8 +58,6 @@ struct cpu_version cpu_version[] = {
};
char cpu_model[64];
uint32_t cpu_features;
uint32_t cpu_features2;
uint64_t tb_freq = 512000000; /* POWER8, POWER9 */
@ -180,7 +178,7 @@ cpu_attach(struct device *parent, struct device *dev, void *aux)
level++;
}
if (CPU_IS_PRIMARY(ci) && (cpu_features2 & PPC_FEATURE2_DARN)) {
if (CPU_IS_PRIMARY(ci) && (hwcap2 & PPC_FEATURE2_DARN)) {
timeout_set(&cpu_darn_to, cpu_darn, NULL);
cpu_darn(NULL);
}
@ -226,20 +224,17 @@ cpu_init_features(void)
{
uint32_t pvr = mfpvr();
cpu_features = PPC_FEATURE_32 | PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU |
hwcap = PPC_FEATURE_32 | PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU |
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_ALTIVEC |
PPC_FEATURE_HAS_VSX;
switch (CPU_VERSION(pvr)) {
case CPU_IBMPOWER9:
case CPU_IBMPOWER9P:
cpu_features2 |= PPC_FEATURE2_ARCH_3_00;
cpu_features2 |= PPC_FEATURE2_DARN;
hwcap2 |= PPC_FEATURE2_ARCH_3_00;
hwcap2 |= PPC_FEATURE2_DARN;
break;
}
hwcap = cpu_features;
hwcap2 = cpu_features2;
}
void
@ -247,7 +242,7 @@ cpu_init(void)
{
uint64_t lpcr = LPCR_LPES;
if (cpu_features2 & PPC_FEATURE2_ARCH_3_00)
if (hwcap2 & PPC_FEATURE2_ARCH_3_00)
lpcr |= LPCR_PECE | LPCR_HVICE;
mtlpcr(lpcr);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.63 2024/11/27 20:30:15 gkoehler Exp $ */
/* $OpenBSD: pmap.c,v 1.64 2024/11/28 18:54:36 gkoehler Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@ -1601,7 +1601,7 @@ pmap_bootstrap_cpu(void)
/* Clear TLB. */
tlbia();
if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) {
if (hwcap2 & PPC_FEATURE2_ARCH_3_00) {
/* Set partition table. */
mtptcr((paddr_t)pmap_pat | PATSIZE);
} else {