Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539658

[PATCH 1/4] x86/init: add i8042 state to the platform data

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 1/4] x86/init: add i8042 state to the platform data
Date Fri, 09 Dec 2016 22:00:02 +0100
Message-ID <sMAqS-7Wr-13@gated-at.bofh.it> (permalink)
References <sMAqS-7Wr-15@gated-at.bofh.it>
X-Original-To Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qcKMtdrHaeRagxraUFWePirlVdDG7HNHS1Uq8TV1ORQ=; b=HEVWgLZu5vbZaliIT5veMyWb8XIJlmanq4WOvLisN4B29mzht7oPgg1QI1GtZ0qbeq ZXd6i7DUKcQYpL9IyDa5Q80vNAFwAkqm3wPv3XH4gejWrGnwTG7HIAr4nEeaJxXFimHW bj7r2HOAllwleI5U0fJl5SNp8QCl5jHfdY78lZnPiwHQ7YX2saHXYRjj1NZqrRruhVxP beCZr1kO0Bvs+Rgj6Sy6/3fVJJu8Oo6/nZ2qdpzxffs4ZBV43Vqsca+wiH6KWZ4toP1W 2FNOaYljtoVjjqU6N76QZGsP4P6acWgI2+Et7PLjVqsszSpDSJ+YDQmgdf4ZmiIgyjdl PRfg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qcKMtdrHaeRagxraUFWePirlVdDG7HNHS1Uq8TV1ORQ=; b=ayRZI8uC/IcnbQNQIwswGDkDKwFk1RNZzwYPHFkUNPnYJybJ7KfeLsLRQWPwj4z3Xo m8JNU5Dq0LFgjpcEFQnGfgJMO9LoUOFIFgmHxvdzchDK53MMHACZCYiHr1eq0myale/f NOvxyGOSAIRRGKw94D+9QaZ2lTHw3TPYAQg35mR2/+YvBX4YXavBHxyZhsse6ViKzGHz 91Az1Ry2DdPaM67hXJPRgbZm9hdULsq06GasRPF2CxHoLMeqErO0J3RmlhXJl2pVZt0r 1COsq7wMy0569v31gWxy40SaMQg4cnght8qw0a28IAtwClUfC6VIoJvP1MVsIcyTFc3w jN8g==
X-Gm-Message-State AKaTC01WU9ATtFJhLe/uY7LzA8jTu3XbbJF9Xbtd6g/gQItuSpG8/KbmY1FnqPtc1NAL1Q==
X-Received by 10.84.216.25 with SMTP id m25mr161867734pli.117.1481317065036; Fri, 09 Dec 2016 12:57:45 -0800 (PST)
X-Mailer git-send-email 2.8.0.rc3.226.g39d4020
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 103
Organization linux.* mail to news gateway
X-Original-Cc "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Takashi Iwai <tiwai@suse.de>, Marcos Paulo de Souza <marcos.souza.org@gmail.com>
X-Original-Date Fri, 9 Dec 2016 12:57:38 -0800
X-Original-Message-ID <1481317061-31486-2-git-send-email-dmitry.torokhov@gmail.com>
X-Original-References <1481317061-31486-1-git-send-email-dmitry.torokhov@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1539658

Show key headers only | View raw


Add i8042 state to the platform data to help i8042 driver make decision
whether to probe for i8042 or not. We recognize 3 states: platform/subarch
ca not possible have i8042 (as is the case with Inrel MID platform),
firmware (such as ACPI) reports that i8042 is absent from the device,
or i8042 may be present and the driver should probe for it.

The intent is to allow i8042 driver abort initialization on x86 if PNP data
(absence of both keyboard and mouse PNP devices) agrees with firmware data.

It will also allow us to remove i8042_detect later.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/x86/include/asm/x86_init.h   | 18 ++++++++++++++++++
 arch/x86/kernel/acpi/boot.c       |  7 +++++++
 arch/x86/kernel/platform-quirks.c |  5 +++++
 3 files changed, 30 insertions(+)

diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index 6ba7931..c4d09c7 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -165,8 +165,25 @@ struct x86_legacy_devices {
 };
 
 /**
+ * enum x86_legacy_i8042_state - i8042 keyboard controller state
+ * @X86_LEGACY_I8042_PLATFORM_ABSENT: the controller is always absent on
+ *	given platform/subarch.
+ * @X86_LEGACY_I8042_FIRMWARE_ABSENT: firmware reports that the controller
+ *	is absent.
+ * @X86_LEGACY_i8042_EXPECTED_PRESENT: the controller is likely to be
+ *	present, the i8042 driver should probe for controller existence.
+ */
+enum x86_legacy_i8042_state {
+	X86_LEGACY_I8042_PLATFORM_ABSENT,
+	X86_LEGACY_I8042_FIRMWARE_ABSENT,
+	X86_LEGACY_I8042_EXPECTED_PRESENT,
+};
+
+/**
  * struct x86_legacy_features - legacy x86 features
  *
+ * @i8042: indicated if we expect the device to have i8042 controller
+ *	present.
  * @rtc: this device has a CMOS real-time clock present
  * @reserve_bios_regions: boot code will search for the EBDA address and the
  * 	start of the 640k - 1M BIOS region.  If false, the platform must
@@ -175,6 +192,7 @@ struct x86_legacy_devices {
  * 	documentation for further details.
  */
 struct x86_legacy_features {
+	enum x86_legacy_i8042_state i8042;
 	int rtc;
 	int reserve_bios_regions;
 	struct x86_legacy_devices devices;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 90d84c3..db15c77 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -925,6 +925,13 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 		x86_platform.legacy.devices.pnpbios = 0;
 	}
 
+	if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
+	    !(acpi_gbl_FADT.boot_flags & ACPI_FADT_8042) &&
+	    x86_platform.legacy.i8042 != X86_LEGACY_I8042_PLATFORM_ABSENT) {
+		pr_debug("ACPI: i8042 controller is absent\n");
+		x86_platform.legacy.i8042 = X86_LEGACY_I8042_FIRMWARE_ABSENT;
+	}
+
 	if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) {
 		pr_debug("ACPI: not registering RTC platform device\n");
 		x86_platform.legacy.rtc = 0;
diff --git a/arch/x86/kernel/platform-quirks.c b/arch/x86/kernel/platform-quirks.c
index 24a5030..9127112 100644
--- a/arch/x86/kernel/platform-quirks.c
+++ b/arch/x86/kernel/platform-quirks.c
@@ -6,6 +6,7 @@
 
 void __init x86_early_init_platform_quirks(void)
 {
+	x86_platform.legacy.i8042 = X86_LEGACY_I8042_EXPECTED_PRESENT;
 	x86_platform.legacy.rtc = 1;
 	x86_platform.legacy.reserve_bios_regions = 0;
 	x86_platform.legacy.devices.pnpbios = 1;
@@ -16,10 +17,14 @@ void __init x86_early_init_platform_quirks(void)
 		break;
 	case X86_SUBARCH_XEN:
 	case X86_SUBARCH_LGUEST:
+		x86_platform.legacy.devices.pnpbios = 0;
+		x86_platform.legacy.rtc = 0;
+		break;
 	case X86_SUBARCH_INTEL_MID:
 	case X86_SUBARCH_CE4100:
 		x86_platform.legacy.devices.pnpbios = 0;
 		x86_platform.legacy.rtc = 0;
+		x86_platform.legacy.i8042 = X86_LEGACY_I8042_PLATFORM_ABSENT;
 		break;
 	}
 
-- 
2.8.0.rc3.226.g39d4020

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] x86/init: add i8042 state to the platform data Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-12-09 22:00 +0100
  [tip:x86/urgent] x86/init: Add i8042 state to the platform data tip-bot for Dmitry Torokhov <tipbot@zytor.com> - 2016-12-19 11:50 +0100

csiph-web