rpms/kernel/F-7 linux-2.6-acpi-dont-init-ec-early-with-no-ini.patch, NONE, 1.1 linux-2.6-acpi-git-ec-init-fixes.patch, NONE, 1.1 linux-2.6-acpi_ec_early_init_fix.patch, NONE, 1.1 kernel-2.6.spec, 1.3426, 1.3427

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Wed Feb 6 01:21:56 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20675

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-acpi-dont-init-ec-early-with-no-ini.patch 
	linux-2.6-acpi-git-ec-init-fixes.patch 
	linux-2.6-acpi_ec_early_init_fix.patch 
Log Message:
* Tue Feb 05 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.23.14-76
- ACPI: sync EC patches with F8


linux-2.6-acpi-dont-init-ec-early-with-no-ini.patch:

--- NEW FILE linux-2.6-acpi-dont-init-ec-early-with-no-ini.patch ---
bz 334781

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5870a8cd23181703cc76f88f630372f8602c7648
Commit:     5870a8cd23181703cc76f88f630372f8602c7648
Parent:     2ffbb8377c7a0713baf6644e285adc27a5654582
Author:     Alexey Starikovskiy <astarikovskiy at suse.de>
AuthorDate: Thu Nov 15 21:52:47 2007 +0300
Committer:  Len Brown <len.brown at intel.com>
CommitDate: Mon Nov 19 12:20:48 2007 -0500

    ACPI: EC: Don't init EC early if it has no _INI
    
    Option to init EC early inserted to handle #8598 ASUS problem,
    introduced several others.
    
    EC driver in this particular case has fake _INI method, not present on
    other machines, which don't need or break from this workaround, so lets use
    its presence as a flag for early init.
    
    http://bugzilla.kernel.org/show_bug.cgi?id=9262
    http://bugzilla.kernel.org/show_bug.cgi?id=8598
    https://bugzilla.novell.com/show_bug.cgi?id=334806
    
    Signed-off-by: Alexey Starikovskiy <astarikovskiy at suse.de>
    Signed-off-by: Len Brown <len.brown at intel.com>
---
 drivers/acpi/ec.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 06b78e5..56afe13 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -881,12 +881,20 @@ int __init acpi_ec_ecdt_probe(void)
 		boot_ec->gpe = ecdt_ptr->gpe;
 		boot_ec->handle = ACPI_ROOT_OBJECT;
 	} else {
+		/* This workaround is needed only on some broken machines,
+		 * which require early EC, but fail to provide ECDT */
+		acpi_handle x;
 		printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
 		status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
 						boot_ec, NULL);
 		/* Check that acpi_get_devices actually find something */
 		if (ACPI_FAILURE(status) || !boot_ec->handle)
 			goto error;
+		/* We really need to limit this workaround, the only ASUS,
+		 * which needs it, has fake EC._INI method, so use it as flag.
+		 */
+		if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
+			goto error;
 	}
 
 	ret = ec_install_handlers(boot_ec);

linux-2.6-acpi-git-ec-init-fixes.patch:

--- NEW FILE linux-2.6-acpi-git-ec-init-fixes.patch ---
From: Alexey Starikovskiy <astarikovskiy at suse.de>
Date: Wed, 5 Sep 2007 23:56:38 +0000 (-0400)
Subject: ACPI: EC: Drop ECDT-based boot_ec as soon as we find DSDT-based one.
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Flenb%2Flinux-acpi-2.6.git;a=commitdiff_plain;h=4c611060660f0de3e9b8f02df207312bc6f5c331

ACPI: EC: Drop ECDT-based boot_ec as soon as we find DSDT-based one.

ASUS notebooks have numerous problems with EC initialization
This patch tries to work around three known issues reported
in bugzilla 8598, 8709 and 8909/8919.

Signed-off-by: Alexey Starikovskiy <astarikovskiy at suse.de>
Signed-off-by: Len Brown <len.brown at intel.com>
---

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 3f7935a..9cd7997 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -121,6 +121,7 @@ static struct acpi_ec {
 	atomic_t event_count;
 	wait_queue_head_t wait;
 	struct list_head list;
+	u8 handlers_installed;
 } *boot_ec, *first_ec;
 
 /* --------------------------------------------------------------------------
@@ -680,32 +681,50 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
 	status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
 	if (ACPI_FAILURE(status))
 		return status;
-
 	/* Find and register all query methods */
 	acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
 			    acpi_ec_register_query_methods, ec, NULL);
-
 	/* Use the global lock for all EC transactions? */
 	acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
-
 	ec->handle = handle;
-
-	printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
-			  ec->gpe, ec->command_addr, ec->data_addr);
-
 	return AE_CTRL_TERMINATE;
 }
 
+static void ec_remove_handlers(struct acpi_ec *ec)
+{
+	if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
+				ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
+		printk(KERN_ERR PREFIX "failed to remove space handler\n");
+	if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
+				&acpi_ec_gpe_handler)))
+		printk(KERN_ERR PREFIX "failed to remove gpe handler\n");
+	ec->handlers_installed = 0;
+}
+
 static int acpi_ec_add(struct acpi_device *device)
 {
 	struct acpi_ec *ec = NULL;
 
 	if (!device)
 		return -EINVAL;
-
 	strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_EC_CLASS);
 
+	/* Check for boot EC */
+	if (boot_ec) {
+		if (boot_ec->handle == device->handle) {
+			/* Pre-loaded EC from DSDT, just move pointer */
+			ec = boot_ec;
+			boot_ec = NULL;
+			goto end;
+		} else if (boot_ec->handle == ACPI_ROOT_OBJECT) {
+			/* ECDT-based EC, time to shut it down */
+			ec_remove_handlers(boot_ec);
+			kfree(boot_ec);
+			first_ec = boot_ec = NULL;
+		}
+	}
+
 	ec = make_acpi_ec();
 	if (!ec)
 		return -ENOMEM;
@@ -715,25 +734,14 @@ static int acpi_ec_add(struct acpi_device *device)
 		kfree(ec);
 		return -EINVAL;
 	}
-
-	/* Check if we found the boot EC */
-	if (boot_ec) {
-		if (boot_ec->gpe == ec->gpe) {
-			/* We might have incorrect info for GL at boot time */
-			mutex_lock(&boot_ec->lock);
-			boot_ec->global_lock = ec->global_lock;
-			/* Copy handlers from new ec into boot ec */
-			list_splice(&ec->list, &boot_ec->list);
-			mutex_unlock(&boot_ec->lock);
-			kfree(ec);
-			ec = boot_ec;
-		}
-	} else
-		first_ec = ec;
 	ec->handle = device->handle;
+      end:
+	if (!first_ec)
+		first_ec = ec;
 	acpi_driver_data(device) = ec;
-
 	acpi_ec_add_fs(device);
+	printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
+			  ec->gpe, ec->command_addr, ec->data_addr);
 	return 0;
 }
 
@@ -756,10 +764,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
 	acpi_driver_data(device) = NULL;
 	if (ec == first_ec)
 		first_ec = NULL;
-
-	/* Don't touch boot EC */
-	if (boot_ec != ec)
-		kfree(ec);
+	kfree(ec);
 	return 0;
 }
 
@@ -789,6 +794,8 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
 static int ec_install_handlers(struct acpi_ec *ec)
 {
 	acpi_status status;
+	if (ec->handlers_installed)
+		return 0;
 	status = acpi_install_gpe_handler(NULL, ec->gpe,
 					  ACPI_GPE_EDGE_TRIGGERED,
 					  &acpi_ec_gpe_handler, ec);
@@ -807,6 +814,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
 		return -ENODEV;
 	}
 
+	ec->handlers_installed = 1;
 	return 0;
 }
 
@@ -823,41 +831,22 @@ static int acpi_ec_start(struct acpi_device *device)
 	if (!ec)
 		return -EINVAL;
 
-	/* Boot EC is already working */
-	if (ec != boot_ec)
-		ret = ec_install_handlers(ec);
+	ret = ec_install_handlers(ec);
 
 	/* EC is fully operational, allow queries */
 	atomic_set(&ec->query_pending, 0);
-
 	return ret;
 }
 
 static int acpi_ec_stop(struct acpi_device *device, int type)
 {
-	acpi_status status;
 	struct acpi_ec *ec;
-
 	if (!device)
 		return -EINVAL;
-
 	ec = acpi_driver_data(device);
 	if (!ec)
 		return -EINVAL;
-
-	/* Don't touch boot EC */
-	if (ec == boot_ec)
-		return 0;
-
-	status = acpi_remove_address_space_handler(ec->handle,
-						   ACPI_ADR_SPACE_EC,
-						   &acpi_ec_space_handler);
-	if (ACPI_FAILURE(status))
-		return -ENODEV;
-
-	status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
-	if (ACPI_FAILURE(status))
-		return -ENODEV;
+	ec_remove_handlers(ec);
 
 	return 0;
 }
@@ -877,7 +866,7 @@ int __init acpi_ec_ecdt_probe(void)
 	status = acpi_get_table(ACPI_SIG_ECDT, 1,
 				(struct acpi_table_header **)&ecdt_ptr);
 	if (ACPI_SUCCESS(status)) {
-		printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n\n");
+		printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n");
 		boot_ec->command_addr = ecdt_ptr->control.address;
 		boot_ec->data_addr = ecdt_ptr->data.address;
 		boot_ec->gpe = ecdt_ptr->gpe;
@@ -899,7 +888,6 @@ int __init acpi_ec_ecdt_probe(void)
       error:
 	kfree(boot_ec);
 	boot_ec = NULL;
-
 	return -ENODEV;
 }
 

linux-2.6-acpi_ec_early_init_fix.patch:

--- NEW FILE linux-2.6-acpi_ec_early_init_fix.patch ---
Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c04209a7948b95e8c52084e8595e74e9428653d3
Commit:     c04209a7948b95e8c52084e8595e74e9428653d3
Parent:     e697789d64f8748cb219d7f5c413c512953802cc
Author:     Alexey Starikovskiy <astarikovskiy at suse.de>
AuthorDate: Tue Jan 1 14:12:55 2008 -0500
Committer:  Len Brown <len.brown at intel.com>
CommitDate: Tue Jan 1 14:12:55 2008 -0500

    ACPI: EC: Enable boot EC before bus_scan
    
    Some _STA methods called during bus_scan() might require EC region handler,
    which might be enabled later in the scan.
    Enable it explicitly before scan to avoid errors.
    
    Reference: http://bugzilla.kernel.org/show_bug.cgi?id=9627
    
    Signed-off-by: Alexey Starikovskiy <astarikovskiy at suse.de>
    Signed-off-by: Len Brown <len.brown at intel.com>
---
 drivers/acpi/ec.c   |   14 +++++++++++++-
 drivers/acpi/scan.c |    6 ++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d411017..97dc161 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -892,6 +892,17 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
 	return 0;
 }
 
+int __init acpi_boot_ec_enable(void)
+{
+	if (!boot_ec || boot_ec->handlers_installed)
+		return 0;
+	if (!ec_install_handlers(boot_ec)) {
+		first_ec = boot_ec;
+		return 0;
+	}
+	return -EFAULT;
+}
+
 int __init acpi_ec_ecdt_probe(void)
 {
 	int ret;
@@ -924,9 +935,10 @@ int __init acpi_ec_ecdt_probe(void)
 			goto error;
 		/* We really need to limit this workaround, the only ASUS,
 		 * which needs it, has fake EC._INI method, so use it as flag.
+		 * Keep boot_ec struct as it will be needed soon.
 		 */
 		if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
-			goto error;
+			return -ENODEV;
 	}
 
 	ret = ec_install_handlers(boot_ec);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5b4d462..cbfe9ae 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1449,6 +1449,8 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
 	return result;
 }
 
+int __init acpi_boot_ec_enable(void);
+
 static int __init acpi_scan_init(void)
 {
 	int result;
@@ -1480,6 +1482,10 @@ static int __init acpi_scan_init(void)
 	 * Enumerate devices in the ACPI namespace.
 	 */
 	result = acpi_bus_scan_fixed(acpi_root);
+
+	/* EC region might be needed at bus_scan, so enable it now */
+	acpi_boot_ec_enable();
+
 	if (!result)
 		result = acpi_bus_scan(acpi_root, &ops);
 


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3426
retrieving revision 1.3427
diff -u -r1.3426 -r1.3427
--- kernel-2.6.spec	6 Feb 2008 00:51:49 -0000	1.3426
+++ kernel-2.6.spec	6 Feb 2008 01:21:05 -0000	1.3427
@@ -639,6 +639,9 @@
 Patch761: linux-2.6-acpi-video-backlight-rationalize.patch
 Patch762: linux-2.6-acpi-video-brightness-bigger-buffer.patch
 Patch763: linux-2.6-acpi-video-fix-multiple-busses.patch
+Patch764: linux-2.6-acpi-git-ec-init-fixes.patch
+Patch765: linux-2.6-acpi-dont-init-ec-early-with-no-ini.patch
+Patch766: linux-2.6-acpi_ec_early_init_fix.patch
 
 Patch780: linux-2.6-usb-storage-initialize-huawei-e220-properly.patch
 Patch781: linux-2.6-usb-autosuspend-default-disable.patch
@@ -1378,6 +1381,10 @@
 ApplyPatch linux-2.6-acpi-video-backlight-rationalize.patch
 ApplyPatch linux-2.6-acpi-video-brightness-bigger-buffer.patch
 ApplyPatch linux-2.6-acpi-video-fix-multiple-busses.patch
+# copy EC fixes from F8
+ApplyPatch linux-2.6-acpi-git-ec-init-fixes.patch
+ApplyPatch linux-2.6-acpi-dont-init-ec-early-with-no-ini.patch
+ApplyPatch linux-2.6-acpi_ec_early_init_fix.patch
 
 # Fix excessive wakeups
 # Make hdaps timer only tick when in use.
@@ -2329,6 +2336,9 @@
 %endif
 
 %changelog
+* Tue Feb 05 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.23.14-76
+- ACPI: sync EC patches with F8
+
 * Tue Feb 05 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.23.14-75
 - ACPI: fix multiple problems with brightness controls (F8#427518)
 




More information about the fedora-extras-commits mailing list