Skip to contentSkip to conversation

input: i8042: add quirk to implement i8042 detect for AMD

PATCH In review Vincent Wan 5 participants 7 messages Oct 16, 2015 – Nov 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: i8042: add quirk to implement i8042 detect for AMD

Detecting platform supports i8042 or not, AMD resorted to BIOS's FADT i8042 flag.

---
 drivers/input/serio/i8042-x86ia64io.h | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +6 -0
index c115565..bf3a605 100644
@@ -9,6 +9,7 @@
 
 #ifdef CONFIG_X86
 #include <asm/x86_init.h>
+#include <linux/acpi.h>
 #endif
 
 /*
@@ -1047,6 +1048,11 @@ static int __init i8042_platform_init(void)
 	/* Just return if pre-detection shows no i8042 controller exist */
 	if (!x86_platform.i8042_detect())
 		return -ENODEV;
+
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
+		if (!(acpi_gbl_FADT.boot_flags & ACPI_FADT_8042))
+			return -ENODEV;
+	}
 #endif
 
 /*
Signature · 1 line
1.9.1
#1 lore raw
Quoted 21 lines · Vincent Wan

Detecting platform supports i8042 or not, AMD resorted to BIOS's FADT i8042 flag.

---
 drivers/input/serio/i8042-x86ia64io.h | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +1 -0
index c115565..bf3a605 100644
@@ -9,6 +9,7 @@
 
 #ifdef CONFIG_X86
 #include <asm/x86_init.h>
+#include <linux/acpi.h>
 #endif
 
 /*

drivers/input/serio/i8042-x86ia64io.h static int __init i8042_platform_init(void) · line 1052

Quoted 5 lines
drivers/input/serio/i8042-x86ia64io.h +2 -0
@@ -1047,6 +1048,11 @@ static int __init i8042_platform_init(void)
 	/* Just return if pre-detection shows no i8042 controller exist */
 	if (!x86_platform.i8042_detect())
 		return -ENODEV;
+
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {

Why the vendor check if you're accessing a bit defined in the ACPI spec?

Quoted 3 lines
drivers/input/serio/i8042-x86ia64io.h +3 -0
+		if (!(acpi_gbl_FADT.boot_flags & ACPI_FADT_8042))
+			return -ENODEV;
+	}
Signature · 4 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
#2 lore raw

2015-10-16 16:58 GMT+08:00 Borislav Petkov <[email protected]>:

Quoted 19 lines · Vincent Wan
Quoted 10 lines

Detecting platform supports i8042 or not, AMD resorted to BIOS's FADT i8042 flag.

---
 drivers/input/serio/i8042-x86ia64io.h | 6 ++++++
 1 file changed, 6 insertions(+)

/*

drivers/input/serio/i8042-x86ia64io.h static int __init i8042_platform_init(void) · line 1052

Quoted 5 lines
drivers/input/serio/i8042-x86ia64io.h +2 -0
@@ -1047,6 +1048,11 @@ static int __init i8042_platform_init(void)
      /* Just return if pre-detection shows no i8042 controller exist */
      if (!x86_platform.i8042_detect())
              return -ENODEV;
+
+     if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {

Why the vendor check if you're accessing a bit defined in the ACPI spec?

Quoted 1 line

From intel's 'x86_platform.i8042_detect' implementation, I doubt if

their BIOS is providing this i8024 flag.
So I have to implement my codes carefully.

Quoted 10 lines

drivers/input/serio/i8042-x86ia64io.h static int __init i8042_platform_init(void) · line 1055

Quoted 4 lines
drivers/input/serio/i8042-x86ia64io.h +3 -0
+             if (!(acpi_gbl_FADT.boot_flags & ACPI_FADT_8042))
+                     return -ENODEV;
+     }

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.

Signature · 3 lines
---
Vincent Wan(Zongshun)
www.mcuos.com
#3 lore raw
Quoted 20 lines · Wan ZongShun

2015-10-16 16:58 GMT+08:00 Borislav Petkov <[email protected]>:

Quoted 9 lines · Vincent Wan
Quoted 7 lines

Detecting platform supports i8042 or not, AMD resorted to BIOS's FADT i8042 flag.

---
 drivers/input/serio/i8042-x86ia64io.h | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 9 lines

drivers/input/serio/i8042-x86ia64io.h static int __init i8042_platform_init(void) · line 1052

Quoted 7 lines

/*

drivers/input/serio/i8042-x86ia64io.h +2 -0
@@ -1047,6 +1048,11 @@ static int __init i8042_platform_init(void)
      /* Just return if pre-detection shows no i8042 controller exist */
      if (!x86_platform.i8042_detect())
              return -ENODEV;
+
+     if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {

Why the vendor check if you're accessing a bit defined in the ACPI spec?

Quoted 2 lines

From intel's 'x86_platform.i8042_detect' implementation, I doubt if their BIOS is providing this i8024 flag.

Why would you doubt that - it is at least in ACPI v4, if not earlier. If you still doubt that, go and check it or ask Intel people.

Quoted 1 line

So I have to implement my codes carefully.

What are you people talking about?!

It is in the ACPI spec - this bit is either set or not. If it is not set, then that's a problem. But then it is the problem of this one BIOS. Vendor checks have nothing to do in vendor-agnostic code.

Besides, there's intel_mid_i8042_detect() which is platform-specific and Intel can supply a specific ->detect() function if, in the very distant chance, they don't implement that bit.

Still no need for a vendor check!

Signature · 4 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
#6 lore raw
In reply to Borislav Petkov
Quoted 20 lines · Borislav Petkov
Quoted 19 lines · Vincent Wan

Detecting platform supports i8042 or not, AMD resorted to BIOS's FADT i8042 flag.

---
 drivers/input/serio/i8042-x86ia64io.h | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +1 -0
index c115565..bf3a605 100644
@@ -9,6 +9,7 @@
 
 #ifdef CONFIG_X86
 #include <asm/x86_init.h>
+#include <linux/acpi.h>
 #endif
 
Quoted 10 lines

drivers/input/serio/i8042-x86ia64io.h static int __init i8042_platform_init(void) · line 1052

Quoted 7 lines
drivers/input/serio/i8042-x86ia64io.h +2 -0
 /*
@@ -1047,6 +1048,11 @@ static int __init i8042_platform_init(void)
 	/* Just return if pre-detection shows no i8042 controller exist */
 	if (!x86_platform.i8042_detect())
 		return -ENODEV;
+
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {

Why the vendor check if you're accessing a bit defined in the ACPI spec?

Yeah, I have the same concern with AMD vendor check. :)

Aaron, could you please help to check the impact at intel platfomrs if we remove this check?

Thanks,
Rui

maintainer
#4 lore raw
In reply to Borislav Petkov
Quoted 24 lines · Borislav Petkov
Quoted 20 lines · Wan ZongShun

2015-10-16 16:58 GMT+08:00 Borislav Petkov <[email protected]>:

Quoted 9 lines · Vincent Wan
Quoted 7 lines

Detecting platform supports i8042 or not, AMD resorted to BIOS's FADT i8042 flag.

---
 drivers/input/serio/i8042-x86ia64io.h | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 9 lines

drivers/input/serio/i8042-x86ia64io.h static int __init i8042_platform_init(void) · line 1052

Quoted 7 lines

/*

drivers/input/serio/i8042-x86ia64io.h +2 -0
@@ -1047,6 +1048,11 @@ static int __init i8042_platform_init(void)
      /* Just return if pre-detection shows no i8042 controller exist */
      if (!x86_platform.i8042_detect())
              return -ENODEV;
+
+     if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {

Why the vendor check if you're accessing a bit defined in the ACPI spec?

Quoted 2 lines

From intel's 'x86_platform.i8042_detect' implementation, I doubt if their BIOS is providing this i8024 flag.

Quoted 8 lines

Why would you doubt that - it is at least in ACPI v4, if not earlier. If you still doubt that, go and check it or ask Intel people.

Quoted 1 line

So I have to implement my codes carefully.

What are you people talking about?!

It is in the ACPI spec - this bit is either set or not. If it is not

Well, the fact that is is in a spec does not mean that vendors follow it (and BTW I do not think that AMD as a CPU vendor can vouch for a random notebook or desktop vendor that acquired and then hacked on some version of some BIOS from some BIOS vendor so I agree that this check is a no-go).

Historically we did not trust BIOS data with regard to i8042 on x86. Maybe we should now using certain date cutoff (anything manufactured past 201[2345?]).

Does Windows respect this flag? If it does then we could also trust it, and not only on AMD but for all x86 CPUs.

Thanks.

Signature · 1 line
Dmitry
#5 lore raw
Quoted 41 lines

Subject: Re: [PATCH] input: i8042: add quirk to implement i8042 detect for AMD

Quoted 24 lines · Borislav Petkov
Quoted 20 lines · Wan ZongShun

2015-10-16 16:58 GMT+08:00 Borislav Petkov <[email protected]>:

Quoted 9 lines · Vincent Wan
Quoted 7 lines

Detecting platform supports i8042 or not, AMD resorted to BIOS's FADT i8042 flag.

---
 drivers/input/serio/i8042-x86ia64io.h | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 9 lines

drivers/input/serio/i8042-x86ia64io.h static int __init i8042_platform_init(void) · line 1052

Quoted 7 lines

/*

drivers/input/serio/i8042-x86ia64io.h +2 -0
@@ -1047,6 +1048,11 @@ static int __init i8042_platform_init(void)
      /* Just return if pre-detection shows no i8042 controller exist */
      if (!x86_platform.i8042_detect())
              return -ENODEV;
+
+     if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {

Why the vendor check if you're accessing a bit defined in the ACPI spec?

Quoted 2 lines

From intel's 'x86_platform.i8042_detect' implementation, I doubt if their BIOS is providing this i8024 flag.

Quoted 8 lines

Why would you doubt that - it is at least in ACPI v4, if not earlier. If you still doubt that, go and check it or ask Intel people.

Quoted 1 line

So I have to implement my codes carefully.

What are you people talking about?!

It is in the ACPI spec - this bit is either set or not. If it is not

Well, the fact that is is in a spec does not mean that vendors follow it (and BTW I do not think that AMD as a CPU vendor can vouch for a random notebook or desktop vendor that acquired and then hacked on some version of some BIOS from some BIOS vendor so I agree that this check is a no-go).

Quoted 6 lines

Historically we did not trust BIOS data with regard to i8042 on x86. Maybe we should now using certain date cutoff (anything manufactured past 201[2345?]).

Does Windows respect this flag? If it does then we could also trust it, and not only on AMD but for all x86 CPUs.

Dmitry ,I found a document in MS MSDN, link:

http://download.microsoft.com/download/3/2/c/32cb69db-71e3-447e-a91b-4070cdc4548a/WLP22-10_a.doc

I copy a piece of comments from this doc here, seems MS is requiring this flag for legacy free system from BIOS. If you think it is ok, I will send v2 patch later to add detect function for all x86 CPUs.

"
A4.1 - Legacy-Free PC System - Windows Compatibility
A4.1.1 - ACPI legacy-free support is reported as described in "ACPI Changes for Legacy Free"
Any x86-based system designs that reduce the amount of legacy ISR support in conjunction with other legacy removal efforts (such as 8042 removal) must still provide the necessary ISRs required to boot systems using BIOS. The minimum requirements include support for ISR 8h, 13h, and 19h (all functions), and ISR 15h, function E820h. To achieve this, Fixed ACPI Description Table (FADT) settings must be supported and correctly implemented, including support for reporting legacy-free and hard reset/boot capabilities, as described in the specification at http://go.microsoft.com/fwlink/?LinkId=36697
* A4.1.1.1 LEGACY_DEVICES flag is set to 0 in the ACPI FADT as defined in ACPI section 5.2.1.
* A4.1.1.2 ACPI reset mechanism as defined in ACPI section 4.7.5.
* A4.1.1.3 8042 flag is set to 0 in systems that do not include an 8042 controller; value is set to 1 in a mobile or desktop system that includes an 8042 controller.
* A4.1.1.4 Debug Port Table in the BIOS, as described in ACPI section 5.2.11.
"

Quoted 5 lines

Thanks.

--
Dmitry