Module Name: src
Committed By: martin
Date: Tue Dec 7 12:37:04 UTC 2021
Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1718):
sys/arch/x86/x86/identcpu.c: revision 1.103
sys/arch/x86/x86/identcpu.c: revision 1.104
sys/arch/x86/x86/identcpu.c: revision 1.105
Add EX2 for Vortex86 SoCs (Andrius V)
use __arraycount, and fix comparison
flip the comparison again
To generate a diff of this commit:
cvs rdiff -u -r1.55.2.9 -r1.55.2.10 src/sys/arch/x86/x86/identcpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.55.2.9 src/sys/arch/x86/x86/identcpu.c:1.55.2.10
--- src/sys/arch/x86/x86/identcpu.c:1.55.2.9 Fri Aug 16 15:36:17 2019
+++ src/sys/arch/x86/x86/identcpu.c Tue Dec 7 12:37:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: identcpu.c,v 1.55.2.9 2019/08/16 15:36:17 martin Exp $ */
+/* $NetBSD: identcpu.c,v 1.55.2.10 2021/12/07 12:37:04 martin Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.9 2019/08/16 15:36:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.10 2021/12/07 12:37:04 martin Exp $");
#include "opt_xen.h"
@@ -691,7 +691,7 @@ cpu_probe_vortex86(struct cpu_info *ci)
#define PCI_MODE1_DATA_REG 0x0cfc
#define PCI_MODE1_ENABLE 0x80000000UL
- uint32_t reg;
+ uint32_t reg, idx;
if (cpu_vendor != CPUVENDOR_VORTEX86)
return;
@@ -705,17 +705,18 @@ cpu_probe_vortex86(struct cpu_info *ci)
outl(PCI_MODE1_ADDRESS_REG, PCI_MODE1_ENABLE | 0x90);
reg = inl(PCI_MODE1_DATA_REG);
- if ((reg & 0xf8ffffff) != 0x30504d44) {
- reg = 0;
+ if ((reg & 0xf0ffffff) != 0x30504d44) {
+ idx = 0;
} else {
- reg = (reg >> 24) & 7;
+ idx = (reg >> 24) & 0xf;
}
static const char *cpu_vortex86_flavor[] = {
- "??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX",
+ "??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX", "EX2",
};
+ idx = idx < __arraycount(cpu_vortex86_flavor) ? idx : 0;
snprintf(cpu_brand_string, sizeof(cpu_brand_string), "Vortex86%s",
- cpu_vortex86_flavor[reg]);
+ cpu_vortex86_flavor[idx]);
#undef PCI_MODE1_ENABLE
#undef PCI_MODE1_ADDRESS_REG