The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=92adf00d0512b674ce18eb1a542ae42e85dd5bca

commit 92adf00d0512b674ce18eb1a542ae42e85dd5bca
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2021-06-02 22:19:09 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2021-06-03 19:47:31 +0000

    madt_setup_local: convert series of strcmp to iteration over the array
    
    to prepare for one more addition
    
    Reviewed by:    markj
    Tested by:      David Sebek <dase...@gmail.com>
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D30624
---
 sys/x86/acpica/madt.c | 30 ++++++++++++++++++------------
 1 file 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);
                        }
_______________________________________________
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to