From patchwork Wed Jul 28 06:28:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ming X-Patchwork-Id: 114700 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6S6Rmb4019446 for ; Wed, 28 Jul 2010 06:28:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753836Ab0G1G2L (ORCPT ); Wed, 28 Jul 2010 02:28:11 -0400 Received: from mga11.intel.com ([192.55.52.93]:59581 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751830Ab0G1G2L (ORCPT ); Wed, 28 Jul 2010 02:28:11 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 27 Jul 2010 23:26:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.55,272,1278313200"; d="scan'208";a="590407873" Received: from minggr.sh.intel.com (HELO [10.239.13.71]) ([10.239.13.71]) by fmsmga002.fm.intel.com with ESMTP; 27 Jul 2010 23:27:22 -0700 Subject: [RFC][PATCH 3/4] ACPICA: _OSI implementation uses the new interfaces From: Lin Ming To: lenb Cc: "Moore, Robert" , linux-acpi Date: Wed, 28 Jul 2010 14:28:21 +0800 Message-ID: <1280298501.20797.70.camel@minggr.sh.intel.com> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 06:28:12 +0000 (UTC) diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index af09f71..85bdcd7 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c @@ -298,11 +298,11 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name) acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) { - acpi_status status; union acpi_operand_object *string_desc; union acpi_operand_object *return_desc; + struct acpi_interface_info *interface_info; u32 return_value; - u32 i; + acpi_cpu_flags flags; ACPI_FUNCTION_TRACE(ut_osi_implementation); @@ -323,51 +323,44 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) /* Default return value is 0, NOT SUPPORTED */ return_value = 0; + flags = acpi_os_acquire_lock(acpi_gbl_osi_lock); - /* Compare input string to static table of supported interfaces */ - - for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces); i++) { - if (!ACPI_STRCMP(string_desc->string.pointer, - acpi_default_supported_interfaces[i].name)) { - /* - * The interface is supported. - * Update the osi_data if necessary. We keep track of the latest - * version of Windows that has been requested by the BIOS. - */ - if (acpi_default_supported_interfaces[i].value > - acpi_gbl_osi_data) { - acpi_gbl_osi_data = - acpi_default_supported_interfaces[i].value; - } + /* + * Call the OSI interface handler first, host OS may do specific handling + * For example, print some warnings or even remove the interface + */ - return_value = ACPI_UINT32_MAX; - goto exit; - } + if (acpi_gbl_interface_handler) { + acpi_gbl_interface_handler(string_desc->string.pointer); } - /* - * Did not match the string in the static table, call the host OSL to - * check for a match with one of the optional strings (such as - * "Module Device", "3.0 Thermal Model", etc.) - */ - status = acpi_os_validate_interface(string_desc->string.pointer); - if (ACPI_SUCCESS(status)) { + interface_info = acpi_ut_get_interface(string_desc->string.pointer); - /* The interface is supported */ + if (interface_info && !(interface_info->flags & ACPI_OSI_INVALID)) { + /* + * The interface is supported. + * Update the osi_data if necessary. We keep track of the latest + * version of Windows that has been requested by the BIOS. + */ + if (interface_info->value > acpi_gbl_osi_data) { + acpi_gbl_osi_data = interface_info->value; + } return_value = ACPI_UINT32_MAX; } -exit: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, - "ACPI: BIOS _OSI(%s) is %ssupported\n", - string_desc->string.pointer, return_value == 0 ? "not " : "")); + acpi_os_release_lock(acpi_gbl_osi_lock, flags); + + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, + "ACPI: BIOS _OSI(%s) is %ssupported\n", + string_desc->string.pointer, + return_value == 0 ? "not " : "")); /* Complete the return value */ return_desc->integer.value = return_value; walk_state->return_desc = return_desc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /*******************************************************************************