From patchwork Mon Feb 2 17:22:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 5074 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n12HMLZn003810 for ; Mon, 2 Feb 2009 17:22:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754048AbZBBRWY (ORCPT ); Mon, 2 Feb 2009 12:22:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757248AbZBBRWY (ORCPT ); Mon, 2 Feb 2009 12:22:24 -0500 Received: from ns1.suse.de ([195.135.220.2]:43208 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753462AbZBBRWW (ORCPT ); Mon, 2 Feb 2009 12:22:22 -0500 Received: from Relay2.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 8BC4944BC4; Mon, 2 Feb 2009 18:22:20 +0100 (CET) From: Thomas Renninger Organization: SUSE Products GmbH To: Luca Tettamanti Subject: [PATCH 2/2] RFC: ACPI: Set enforce_resources to strict if a ATK0110 device is found in namespace Date: Mon, 2 Feb 2009 18:22:19 +0100 User-Agent: KMail/1.10.3 (Linux/2.6.27.13-HEAD_20090130075504_71baee03-default; KDE/4.1.3; x86_64; ; ) References: <20090125210520.GA12963@dreamland.darkstar.lan> <20090202101103.1208c035@hyperion.delvare> <68676e00902020338o7326ff7dx4efadf94ed534acf@mail.gmail.com> In-Reply-To: <68676e00902020338o7326ff7dx4efadf94ed534acf@mail.gmail.com> Cc: Jean Delvare , Hans de Goede , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Len Brown MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200902021822.20237.trenn@suse.de> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Monday 02 February 2009 12:38:24 you wrote: > On Mon, Feb 2, 2009 at 10:11 AM, Jean Delvare wrote: > > On Sun, 1 Feb 2009 22:22:43 +0100, Luca Tettamanti wrote: > >> --- a/drivers/acpi/osl.c > >> +++ b/drivers/acpi/osl.c > >> @@ -1063,7 +1063,10 @@ __setup("acpi_wake_gpes_always_on", > >> acpi_wake_gpes_always_on_setup); * in arbitrary AML code and can > >> interfere with legacy drivers. * acpi_enforce_resources= can be set to: > >> * > >> - * - strict (2) > >> + * - auto (2) > >> + * -> detect possible conflicts with ACPI drivers and switch to > >> + * strict if needed, otherwise act like lax > >> + * - strict (3) > >> * -> further driver trying to access the resources will not load > >> * - lax (default) (1) > >> * -> further driver trying to access the resources will load, but > >> you @@ -1073,11 +1076,12 @@ __setup("acpi_wake_gpes_always_on", > >> acpi_wake_gpes_always_on_setup); * -> ACPI Operation Region > >> resources will not be registered * > >> */ > >> -#define ENFORCE_RESOURCES_STRICT 2 > >> +#define ENFORCE_RESOURCES_STRICT 3 > >> +#define ENFORCE_RESOURCES_AUTO 2 > >> #define ENFORCE_RESOURCES_LAX 1 > >> #define ENFORCE_RESOURCES_NO 0 > > > > I don't see any reason to change ENFORCE_RESOURCES_STRICT from 2 to 3. > > Just add ENFORCE_RESOURCES_AUTO as 3 and that's it, makes your patch > > smaller. > > There's an unspoken reason ;-) The options are ordered by > "strictness", I was experimenting with an API to export the parameter, > in order to move the code to a separate quirk file. Since it's not > relevant in this patch I'll back out the change. And the other one, implementing the ATK0110 quirk. The same probably could be easy done now with video_detect.c. The video device HID should get added in scan.c again as suggested by Bjorn. Then the video_detect.c can go into quirks.c and get deleted. What do you think? Thomas --- ACPI: Set enforce_resources to strict if a ATK0110 device is found in namespace ATK0110 acpi driver on ASUS boards touches the hwmon HW via ACPI functions. Every native hwmon driver which tries to acquire resources which are already defined as OperationRegions will not load on these boards by default. This avoids interference between non-atomic data/command register reads between the hwmon and the ATK0110 Asus ACPI drivers. Signed-off-by: Thomas Renninger diff --git a/drivers/acpi/acpi.h b/drivers/acpi/acpi.h index 95e29ca..c08037e 100644 --- a/drivers/acpi/acpi.h +++ b/drivers/acpi/acpi.h @@ -5,4 +5,28 @@ void __init acpi_device_quirks(void); +/* Check of resource interference between native drivers and ACPI + * OperationRegions (SystemIO and System Memory only). + * IO ports and memory declared in ACPI might be used by the ACPI subsystem + * in arbitrary AML code and can interfere with legacy drivers. + * acpi_enforce_resources= can be set to: + * + * - strict (2) + * -> further driver trying to access the resources will not load + * - lax (default) (1) + * -> further driver trying to access the resources will load, but you + * get a system message that something might go wrong... + * + * - no (0) + * -> ACPI Operation Region resources will not be registered + * + */ +#define ENFORCE_RESOURCES_AUTO 3 +#define ENFORCE_RESOURCES_STRICT 2 +#define ENFORCE_RESOURCES_LAX 1 +#define ENFORCE_RESOURCES_NO 0 + +extern unsigned int acpi_enforce_resources; + + #endif /* _LINUX_LOCAL_ACPI_H */ diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 6729a49..92e4226 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -50,6 +50,7 @@ #include #include #include +#include "acpi.h" #define _COMPONENT ACPI_OS_SERVICES ACPI_MODULE_NAME("osl"); @@ -1057,27 +1058,7 @@ static int __init acpi_wake_gpes_always_on_setup(char *str) __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); -/* Check of resource interference between native drivers and ACPI - * OperationRegions (SystemIO and System Memory only). - * IO ports and memory declared in ACPI might be used by the ACPI subsystem - * in arbitrary AML code and can interfere with legacy drivers. - * acpi_enforce_resources= can be set to: - * - * - strict (2) - * -> further driver trying to access the resources will not load - * - lax (default) (1) - * -> further driver trying to access the resources will load, but you - * get a system message that something might go wrong... - * - * - no (0) - * -> ACPI Operation Region resources will not be registered - * - */ -#define ENFORCE_RESOURCES_STRICT 2 -#define ENFORCE_RESOURCES_LAX 1 -#define ENFORCE_RESOURCES_NO 0 - -static unsigned int acpi_enforce_resources = ENFORCE_RESOURCES_LAX; +unsigned int acpi_enforce_resources = ENFORCE_RESOURCES_AUTO; static int __init acpi_enforce_resources_setup(char *str) { diff --git a/drivers/acpi/quirks.c b/drivers/acpi/quirks.c index 844480e..a0d0731 100644 --- a/drivers/acpi/quirks.c +++ b/drivers/acpi/quirks.c @@ -30,6 +30,20 @@ struct acpi_device_fixup { }; /* + * ATK0110 is known to interfere with several hwmon drivers, as it also + * reads temperture, fan, etc. on the same device hwmon drivers do. + * Make sure possibly interfering hwmon/i2c/smbus drivers touching IO areas + * which already got declared as ACPI Operation Regions cannot be loaded. + */ +int __init atk0110_interfere_fixups (struct acpi_device *dev) { + + printk ("Found device: %s\n", acpi_device_bid(dev)); + if (acpi_enforce_resources == ENFORCE_RESOURCES_AUTO) + acpi_enforce_resources = ENFORCE_RESOURCES_STRICT; + return 0; +} + +/* * Add a callback here if your module needs to process code after the ACPI * core has parsed the DSDT and initialized all devices, but the code must * be processed before module load time. @@ -37,6 +51,7 @@ struct acpi_device_fixup { * before the driver is loaded. */ const struct acpi_device_fixup __initdata fixup_table[] = { + { "ATK0110", atk0110_interfere_fixups }, }; static acpi_status __init