From patchwork Thu Oct 29 03:05:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 56396 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 n9T34p69005758 for ; Thu, 29 Oct 2009 03:05:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754216AbZJ2DFD (ORCPT ); Wed, 28 Oct 2009 23:05:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754560AbZJ2DFD (ORCPT ); Wed, 28 Oct 2009 23:05:03 -0400 Received: from mga09.intel.com ([134.134.136.24]:58518 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754216AbZJ2DFC (ORCPT ); Wed, 28 Oct 2009 23:05:02 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 28 Oct 2009 19:48:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.44,643,1249282800"; d="scan'208";a="462468501" Received: from sli10-conroe.sh.intel.com (HELO sli10-desk.sh.intel.com) ([10.239.13.1]) by orsmga002.jf.intel.com with ESMTP; 28 Oct 2009 20:10:38 -0700 Received: from david by sli10-desk.sh.intel.com with local (Exim 4.69) (envelope-from ) id 1N3LJx-0001mO-P2; Thu, 29 Oct 2009 11:05:05 +0800 Date: Thu, 29 Oct 2009 11:05:05 +0800 From: Shaohua Li To: linux-acpi@vger.kernel.org Cc: lenb@kernel.org, bjorn.helgaas@hp.com, kaneshige.kenji@jp.fujitsu.com, aystarik@gmail.com Subject: [PATCH 3/3]add platform-wide _OSC support Message-ID: <20091029030505.GC5150@sli10-desk.sh.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Index: linux/drivers/acpi/bus.c =================================================================== --- linux.orig/drivers/acpi/bus.c 2009-10-29 10:26:43.000000000 +0800 +++ linux/drivers/acpi/bus.c 2009-10-29 10:31:58.000000000 +0800 @@ -466,6 +466,30 @@ out_kfree: } EXPORT_SYMBOL(acpi_run_osc); +static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48"; +static void acpi_bus_osc_support(void) +{ + u32 capbuf[2]; + struct acpi_osc_context context = { + .uuid_str = sb_uuid_str, + .rev = 1, + .cap.length = 8, + .cap.pointer = capbuf, + }; + acpi_handle handle; + + capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; + capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ +#ifdef CONFIG_ACPI_PROCESSOR_AGGREGATOR + capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; +#endif + if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) + return; + if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) + kfree(context.ret.pointer); + /* do we need to check the returned cap? Sounds no */ +} + /* -------------------------------------------------------------------------- Event Management -------------------------------------------------------------------------- */ @@ -856,6 +880,8 @@ static int __init acpi_bus_init(void) status = acpi_ec_ecdt_probe(); /* Ignore result. Not having an ECDT is not fatal. */ + acpi_bus_osc_support(); + status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION); if (ACPI_FAILURE(status)) { printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n"); Index: linux/include/linux/acpi.h =================================================================== --- linux.orig/include/linux/acpi.h 2009-10-29 10:29:30.000000000 +0800 +++ linux/include/linux/acpi.h 2009-10-29 10:31:06.000000000 +0800 @@ -273,6 +273,13 @@ struct acpi_osc_context { acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); +/* platform-wide _OSC bits */ +#define OSC_SB_PAD_SUPPORT 1 +#define OSC_SB_PPC_OST_SUPPORT 2 +#define OSC_SB_PR3_SUPPORT 4 +#define OSC_SB_CPUHP_OST_SUPPORT 8 +#define OSC_SB_APEI_SUPPORT 16 + /* PCI defined _OSC bits */ /* _OSC DW1 Definition (OS Support Fields) */ #define OSC_EXT_PCI_CONFIG_SUPPORT 1