From owner-svn-src-all@freebsd.org Thu Dec 3 10:59:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A20A2A3F2CD; Thu, 3 Dec 2015 10:59:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5213C13D1; Thu, 3 Dec 2015 10:59:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB3AxAhR061345; Thu, 3 Dec 2015 10:59:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB3AxAjI061344; Thu, 3 Dec 2015 10:59:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512031059.tB3AxAjI061344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 3 Dec 2015 10:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291686 - head/sys/x86/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2015 10:59:11 -0000 Author: kib Date: Thu Dec 3 10:59:10 2015 New Revision: 291686 URL: https://svnweb.freebsd.org/changeset/base/291686 Log: In the SandyBridge x2APIC workaround detection code, only fetch the environment variable when SandyBridge CPU is detected. Reduce code duplication. Sponsored by: The FreeBSD Foundation Modified: head/sys/x86/acpica/madt.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Dec 3 10:33:57 2015 (r291685) +++ head/sys/x86/acpica/madt.c Thu Dec 3 10:59:10 2015 (r291686) @@ -166,37 +166,30 @@ madt_setup_local(void) } else if (vm_guest == VM_GUEST_XEN) { x2apic_mode = 0; reason = "due to running under XEN"; - } else if (vm_guest == VM_GUEST_NO) { + } else if (vm_guest == VM_GUEST_NO && + CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) == 0x2a) { hw_vendor = kern_getenv("smbios.planar.maker"); /* - * It seems that some Lenovo 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 - * SandyBridge machines. + * 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 + * machines. */ - if (hw_vendor != NULL && - !strcmp(hw_vendor, "LENOVO") && - CPUID_TO_FAMILY(cpu_id) == 0x6 && - CPUID_TO_MODEL(cpu_id) == 0x2a) { - x2apic_mode = 0; - reason = - "for a suspected Lenovo SandyBridge BIOS bug"; + if (hw_vendor != NULL) { + if (!strcmp(hw_vendor, "LENOVO") || + !strcmp(hw_vendor, + "ASUSTeK Computer Inc.")) { + x2apic_mode = 0; + reason = + "for a suspected SandyBridge BIOS bug"; + } + freeenv(hw_vendor); } - /* - * Same reason, ASUS SandyBridge. - */ - if (hw_vendor != NULL && - !strcmp(hw_vendor, "ASUSTeK Computer Inc.") && - CPUID_TO_FAMILY(cpu_id) == 0x6 && - CPUID_TO_MODEL(cpu_id) == 0x2a) { - x2apic_mode = 0; - reason = - "for a suspected ASUS SandyBridge BIOS bug"; - } - freeenv(hw_vendor); } TUNABLE_INT_FETCH("hw.x2apic_enable", &x2apic_mode); if (!x2apic_mode && reason != NULL && bootverbose)