Skip to contentSkip to conversation

i8042 ACPI enumeration update

PATCH Applied Bjorn Helgaas 3 participants 5 messages Sep 21, 2004 – Sep 24, 2004

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

PATCH 1/1 i8042 ACPI enumeration update

This adds a few updates:

- Fix build on ia64 (I8042_MAP_IRQ() isn't defined at compile-time)
- Add FixedIO support from Hans-Frieder Vogt
- Add ACPI device name (e.g., "PS/2 Keyboard Controller")
- Fall back to default ports/IRQ if ACPI _CRS doesn't supply them
- Fall back to previous blind probing if ACPI is disabled

I'd appreciate any comments or feedback. If it looks reasonable, please include this in the next -mm patchset.

drivers/input/serio/i8042-x86ia64io.h 2004-09-21 13:06:33.000000000 -0600 renamed from drivers/input/serio/i8042-x86ia64io.h 2004-09-21 12:51:48.000000000 -0600 +49 -13
diff -u -ur 2.6.9-rc2-mm1/drivers/input/serio/i8042-x86ia64io.h kbd4/drivers/input/serio/i8042-x86ia64io.h
@@ -28,8 +28,8 @@
 #define I8042_KBD_IRQ i8042_kbd_irq
 #define I8042_AUX_IRQ i8042_aux_irq
 
-static int i8042_kbd_irq = I8042_MAP_IRQ(1);
-static int i8042_aux_irq = I8042_MAP_IRQ(12);
+static int i8042_kbd_irq;
+static int i8042_aux_irq;
 
 /*
  * Register numbers.
@@ -105,6 +105,7 @@
 {
  struct i8042_acpi_resources *i8042_res = data;
  struct acpi_resource_io *io;
+ struct acpi_resource_fixed_io *fixed_io;
  struct acpi_resource_irq *irq;
  struct acpi_resource_ext_irq *ext_irq;
 
@@ -119,6 +120,16 @@
    }
    break;
 
+  case ACPI_RSTYPE_FIXED_IO:
+   fixed_io = &res->data.fixed_io;
+   if (fixed_io->range_length) {
+    if (!i8042_res->port1)
+     i8042_res->port1 = fixed_io->base_address;
+    else
+     i8042_res->port2 = fixed_io->base_address;
+   }
+   break;
+
   case ACPI_RSTYPE_IRQ:
    irq = &res->data.irq;
    if (irq->number_of_interrupts > 0)
@@ -151,13 +162,29 @@
  if (ACPI_FAILURE(status))
   return -ENODEV;
 
- printk("i8042: ACPI %s [%s] at I/O 0x%x, 0x%x, irq %d\n",
+ if (kbd_res.port1)
+  i8042_data_reg = kbd_res.port1;
+ else
+  printk(KERN_WARNING "ACPI: [%s] has no data port; default is 0x%x\n",
+   acpi_device_bid(device), i8042_data_reg);
+
+ if (kbd_res.port2)
+  i8042_command_reg = kbd_res.port2;
+ else
+  printk(KERN_WARNING "ACPI: [%s] has no command port; default is 0x%x\n",
+   acpi_device_bid(device), i8042_command_reg);
+
+ if (kbd_res.irq)
+  i8042_kbd_irq = kbd_res.irq;
+ else
+  printk(KERN_WARNING "ACPI: [%s] has no IRQ; default is %d\n",
+   acpi_device_bid(device), i8042_kbd_irq);
+
+ strncpy(acpi_device_name(device), "PS/2 Keyboard Controller",
+  sizeof(acpi_device_name(device)));
+ printk("ACPI: %s [%s] at I/O 0x%x, 0x%x, irq %d\n",
   acpi_device_name(device), acpi_device_bid(device),
-  kbd_res.port1, kbd_res.port2, kbd_res.irq);
-
- i8042_data_reg = kbd_res.port1;
- i8042_command_reg = kbd_res.port2;
- i8042_kbd_irq = kbd_res.irq;
+  i8042_data_reg, i8042_command_reg, i8042_kbd_irq);
 
  return 0;
 }
@@ -173,10 +200,16 @@
  if (ACPI_FAILURE(status))
   return -ENODEV;
 
- printk("i8042: ACPI %s [%s] at irq %d\n",
-  acpi_device_name(device), acpi_device_bid(device), aux_res.irq);
-
- i8042_aux_irq = aux_res.irq;
+ if (aux_res.irq)
+  i8042_aux_irq = aux_res.irq;
+ else
+  printk(KERN_WARNING "ACPI: [%s] has no IRQ; default is %d\n",
+   acpi_device_bid(device), i8042_aux_irq);
+
+ strncpy(acpi_device_name(device), "PS/2 Mouse Controller",
+  sizeof(acpi_device_name(device)));
+ printk("ACPI: %s [%s] at irq %d\n",
+  acpi_device_name(device), acpi_device_bid(device), i8042_aux_irq);
 
  return 0;
 }
@@ -201,7 +234,7 @@
 {
  int result;
 
- if (i8042_noacpi) {
+ if (acpi_disabled || i8042_noacpi) {
   printk("i8042: ACPI detection disabled\n");
   return 0;
  }
@@ -245,6 +278,9 @@
  *  return -1;
  */
 
+ i8042_kbd_irq = I8042_MAP_IRQ(1);
+ i8042_aux_irq = I8042_MAP_IRQ(12);
+
 #ifdef CONFIG_ACPI
  if (i8042_acpi_init())
   return -1;
#1 lore raw
Quoted 8 lines · Bjorn Helgaas

This adds a few updates:

- Fix build on ia64 (I8042_MAP_IRQ() isn't defined at compile-time)
- Add FixedIO support from Hans-Frieder Vogt
- Add ACPI device name (e.g., "PS/2 Keyboard Controller")
- Fall back to default ports/IRQ if ACPI _CRS doesn't supply them
- Fall back to previous blind probing if ACPI is disabled

Quoted 5 lines

I'd appreciate any comments or feedback. If it looks reasonable, please include this in the next -mm patchset.

Perhaps this cures my kbd/mouse disdetections (it fails somteimes at boot, I suddenly find myself without mouse or keyboard. Replugging works.

But...your mailer has screwed the patch, tabs were changed to spaces...

Please, could you resend it ?

TIA

--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandrakelinux release 10.1 (Community) for i586
Linux 2.6.9-rc2-mm1 (gcc 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)) #2

#2 lore raw
In reply to Bjorn Helgaas
Quoted 8 lines · Bjorn Helgaas

This adds a few updates:

- Fix build on ia64 (I8042_MAP_IRQ() isn't defined at compile-time)
- Add FixedIO support from Hans-Frieder Vogt
- Add ACPI device name (e.g., "PS/2 Keyboard Controller")
- Fall back to default ports/IRQ if ACPI _CRS doesn't supply them
- Fall back to previous blind probing if ACPI is disabled

Quoted 4 lines

I'd appreciate any comments or feedback. If it looks reasonable, please include this in the next -mm patchset.

Could you send me the complete patch (as opposed to this differential one)? I think it's probably time to include it into the input tree as it seems functional enough.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#3 lore raw
Quoted 3 lines · Vojtech Pavlik

Could you send me the complete patch (as opposed to this differential one)? I think it's probably time to include it into the input tree as it seems functional enough.

Here it is. This includes allow-i8042-register-location-override-2.patch from the -mm patchset and the differential patch I sent yesterday.

Attached rather than inline because I haven't figured out how to unbreak Kmail-1.7's tab to space conversions.

From: Bjorn Helgaas <[email protected]>

Input: Add ACPI-based i8042 keyboard and aux controller enumeration; can be disabled by passing i8042.noacpi as a boot parameter.

Original code by Bjorn Helgaas <[email protected]>, reworked by Dmitry Torokhov <[email protected]>, FixedIO support from Hans-Frieder Vogt <[email protected]>

---

 Documentation/kernel-parameters.txt   |    2 
 drivers/input/serio/i8042-io.h        |   51 -----
 drivers/input/serio/i8042-x86ia64io.h |  308 ++++++++++++++++++++++++++++++++++
 drivers/input/serio/i8042.c           |    6 
 drivers/input/serio/i8042.h           |    2 
 5 files changed, 325 insertions(+), 44 deletions(-)
Documentation/kernel-parameters.txt +2 -0
diff -u -urN 2.6.9-rc2-mm1/Documentation/kernel-parameters.txt kbd5/Documentation/kernel-parameters.txt
@@ -483,6 +483,8 @@
 	i8042.dumbkbd	[HW] Pretend that controlled can only read data from
 			     keyboard and can not control its state
 			     (Don't attempt to blink the leds)
+	i8042.noacpi	[HW] Don't use ACPI to discover KBD/AUX controller
+			     settings
 	i8042.noaux	[HW] Don't check for auxiliary (== mouse) port
 	i8042.nomux	[HW] Don't check presence of an active multiplexing
 			     controller
drivers/input/serio/i8042-io.h +7 -44

97 lines not on this page · raw message

drivers/input/serio/i8042-x86ia64io.h +308 -0

308 lines not on this page · raw message

drivers/input/serio/i8042.c +6 -0
diff -u -urN 2.6.9-rc2-mm1/drivers/input/serio/i8042.c kbd5/drivers/input/serio/i8042.c
@@ -58,6 +58,12 @@
 module_param_named(noloop, i8042_noloop, bool, 0);
 MODULE_PARM_DESC(dumbkbd, "Disable the AUX Loopback command while probing for the AUX port");
 
+#ifdef CONFIG_ACPI
+static int i8042_noacpi;
+module_param_named(noacpi, i8042_noacpi, bool, 0);
+MODULE_PARM_DESC(noacpi, "Do not use ACPI to detect controller settings");
+#endif
+
 __obsolete_setup("i8042_noaux");
 __obsolete_setup("i8042_nomux");
 __obsolete_setup("i8042_unlock");
drivers/input/serio/i8042.h +2 -0
diff -u -urN 2.6.9-rc2-mm1/drivers/input/serio/i8042.h kbd5/drivers/input/serio/i8042.h
@@ -23,6 +23,8 @@
 #include "i8042-ppcio.h"
 #elif defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64)
 #include "i8042-sparcio.h"
+#elif defined(CONFIG_X86) || defined(CONFIG_IA64)
+#include "i8042-x86ia64io.h"
 #else
 #include "i8042-io.h"
 #endif
#4 lore raw
Quoted 10 lines · Bjorn Helgaas
Quoted 3 lines · Vojtech Pavlik

Could you send me the complete patch (as opposed to this differential one)? I think it's probably time to include it into the input tree as it seems functional enough.

Here it is. This includes allow-i8042-register-location-override-2.patch from the -mm patchset and the differential patch I sent yesterday.

Attached rather than inline because I haven't figured out how to unbreak Kmail-1.7's tab to space conversions.

Thanks, applied.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR