From owner-dev-commits-src-branches@freebsd.org Thu Jun 10 00:48:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34CF7657142; Thu, 10 Jun 2021 00:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G0lhG1124z4WlB; Thu, 10 Jun 2021 00:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C39D25E3D; Thu, 10 Jun 2021 00:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15A0mDnt023018; Thu, 10 Jun 2021 00:48:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15A0mDXd023017; Thu, 10 Jun 2021 00:48:13 GMT (envelope-from git) Date: Thu, 10 Jun 2021 00:48:13 GMT Message-Id: <202106100048.15A0mDXd023017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ca473f38c156 - stable/13 - madt_setup_local: convert series of strcmp to iteration over the array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ca473f38c1568c89113e64e1495df3f17271b433 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2021 00:48:14 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ca473f38c1568c89113e64e1495df3f17271b433 commit ca473f38c1568c89113e64e1495df3f17271b433 Author: Konstantin Belousov AuthorDate: 2021-06-02 22:19:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-10 00:47:50 +0000 madt_setup_local: convert series of strcmp to iteration over the array (cherry picked from commit 92adf00d0512b674ce18eb1a542ae42e85dd5bca) --- 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); }