From patchwork Thu Jan 21 17:18:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Hofstaedtler X-Patchwork-Id: 74394 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0LHLdJZ018176 for ; Thu, 21 Jan 2010 17:21:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754598Ab0AURU4 (ORCPT ); Thu, 21 Jan 2010 12:20:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752989Ab0AURUo (ORCPT ); Thu, 21 Jan 2010 12:20:44 -0500 Received: from percival.namespace.at ([77.244.242.130]:52025 "EHLO percival.namespace.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752737Ab0AURUn (ORCPT ); Thu, 21 Jan 2010 12:20:43 -0500 Received: from 83-64-115-202.static.xdsl-line.inode.at ([83.64.115.202]:48443 helo=localhost.localdomain) by percival.namespace.at with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NY0gn-0004fS-BF; Thu, 21 Jan 2010 18:19:25 +0100 From: Christian Hofstaedtler To: x86@kernel.org Cc: hpa@zytor.com, lenb@kernel.org, tglx@linutronix.de, linux-acpi@vger.kernel.org, venkatesh.pallipadi@intel.com, arjan@infradead.org, bruce.w.allan@intel.com, linux-kernel@vger.kernel.org, Christian Hofstaedtler Subject: [PATCH 2/2] Default to ACPI reboots on newish X86 hardware Date: Thu, 21 Jan 2010 18:18:43 +0100 Message-Id: <1264094323-7187-2-git-send-email-ch@zeha.at> X-Mailer: git-send-email 1.6.4.4 In-Reply-To: <1264094323-7187-1-git-send-email-ch@zeha.at> References: <1264094323-7187-1-git-send-email-ch@zeha.at> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 36f0c86..919453a 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -453,10 +453,33 @@ static struct dmi_system_id __initdata reboot_dmi_table_all[] = { { } }; +/* See if the Hardware is new enough to support ACPI reboots. */ +static int __init reboot_acpi_likey_supported(void) +{ + int year; + + /* No BIOS date? We can safely say "Yes" here, because ACPI-reboot + * will only work when acpi=force was specified, else it falls back + * to KBD-reboots anyway. */ + if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) { + return 1; + } + if (year == 0) { + return 1; + } + + /* 2003 was decided as the cut-off year. */ + if (year < 2003) { + return 0; + } + return 1; +} + /* Decide how we will reboot: * - Check the X86_32-only quirks table. * - Check the generic quirks table. - * - Default to old-style Keyboard Controller reboot. + * - Check if we could use ACPI-based reboot. + * - Fall back to old-style Keyboard Controller reboot. */ static int __init reboot_init(void) { @@ -472,7 +495,12 @@ static int __init reboot_init(void) if (reboot_type != BOOT_UNDECIDED) return 0; - reboot_type = BOOT_KBD; + if (reboot_acpi_likey_supported()) { + reboot_type = BOOT_ACPI; + } else { + printk(KERN_INFO "Selecting old-style reboot for older hardware\n"); + reboot_type = BOOT_KBD; + } return 0; }