aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-06-02 22:19:09 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-06-10 00:47:50 +0000
commitca473f38c1568c89113e64e1495df3f17271b433 (patch)
treea57e258c08b709f2b28ed48fb36070627c5039dd
parentb48d1066d54b1a134cbf64f86c0bc2035fd08251 (diff)
downloadsrc-ca473f38c1568c89113e64e1495df3f17271b433.tar.gz
src-ca473f38c1568c89113e64e1495df3f17271b433.zip
madt_setup_local: convert series of strcmp to iteration over the array
(cherry picked from commit 92adf00d0512b674ce18eb1a542ae42e85dd5bca)
-rw-r--r--sys/x86/acpica/madt.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c
index 11c7b9de52d7..035a618f68a3 100644
--- a/sys/x86/acpica/madt.c
+++ b/sys/x86/acpica/madt.c
@@ -128,6 +128,11 @@ madt_probe_cpus(void)
return (0);
}
+static const char *x2apic_sandy_dis[] = {
+ "LENOVO",
+ "ASUSTeK Computer Inc.",
+};
+
/*
* Initialize the local APIC on the BSP.
*/
@@ -139,7 +144,7 @@ madt_setup_local(void)
const char *reason;
char *hw_vendor;
u_int p[4];
- int user_x2apic;
+ int i, user_x2apic;
bool bios_x2apic;
if ((cpu_feature2 & CPUID2_X2APIC) != 0) {
@@ -173,21 +178,22 @@ madt_setup_local(void)
CPUID_TO_MODEL(cpu_id) == 0x2a) {
hw_vendor = kern_getenv("smbios.planar.maker");
/*
- * It seems that some Lenovo and ASUS
- * SandyBridge-based notebook BIOSes have a
- * bug which prevents booting AP in x2APIC
- * mode. Since the only way to detect mobile
- * CPU is to check northbridge pci id, which
- * cannot be done that early, disable x2APIC
- * for all Lenovo and ASUS SandyBridge
+ * It seems that some SandyBridge-based
+ * notebook BIOSes have a bug which prevents
+ * booting AP in x2APIC mode. Since the only
+ * way to detect mobile CPU is to check
+ * northbridge pci id, which cannot be done
+ * that early, disable x2APIC for all such
* machines.
*/
if (hw_vendor != NULL) {
- if (!strcmp(hw_vendor, "LENOVO") ||
- !strcmp(hw_vendor,
- "ASUSTeK Computer Inc.")) {
- reason =
+ for (i = 0; i < nitems(x2apic_sandy_dis); i++) {
+ if (strcmp(hw_vendor,
+ x2apic_sandy_dis[i]) == 0) {
+ reason =
"for a suspected SandyBridge BIOS bug";
+ break;
+ }
}
freeenv(hw_vendor);
}