From patchwork Wed Dec 4 00:38:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 3280101 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8AF61C0D4A for ; Wed, 4 Dec 2013 00:42:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98E3A20457 for ; Wed, 4 Dec 2013 00:42:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9517C20109 for ; Wed, 4 Dec 2013 00:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755636Ab3LDAlm (ORCPT ); Tue, 3 Dec 2013 19:41:42 -0500 Received: from mga14.intel.com ([143.182.124.37]:49145 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755583Ab3LDAll (ORCPT ); Tue, 3 Dec 2013 19:41:41 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga102.ch.intel.com with ESMTP; 03 Dec 2013 16:39:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,821,1378882800"; d="scan'208";a="438056541" Received: from unknown (HELO lvzheng-z530.sh.intel.com) ([10.239.37.15]) by fmsmga001.fm.intel.com with ESMTP; 03 Dec 2013 16:38:43 -0800 From: Lv Zheng To: "Rafael J. Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , , linux-acpi@vger.kernel.org, Bjorn Helgaas , Len Brown , Feng Tang , sfi-devel@simplefirmware.org, linux-pci@vger.kernel.org Subject: [PATCH 2/3] ACPI/SFI: Fix wrong inclusion in SFI/ACPI wrapper - acpi_disabled linkage. Date: Wed, 4 Dec 2013 08:38:21 +0800 Message-Id: X-Mailer: git-send-email 1.7.10 In-Reply-To: References: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In Linux kernel, ACPICA is wrapped and safely exported by CONFIG_ACPI. So all external modules should depend on CONFIG_ACPI rather than using ACPICA header directly for stubbing. But if we moves inclusions into "#ifdef CONFIG_ACPI", build breakge can help to detect wrong ACPICA dependent modules. One of the build breakage is: arch/x86/pci/mmconfig-shared.c:389:1: error: unknown type name 'acpi_status' arch/x86/pci/mmconfig-shared.c:389:47: warning: 'struct acpi_resource' declared inside parameter list [enabled by default] arch/x86/pci/mmconfig-shared.c:389:47: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] arch/x86/pci/mmconfig-shared.c: In function 'check_mcfg_resource': arch/x86/pci/mmconfig-shared.c:392:33: error: storage size of 'address' isn't known arch/x86/pci/mmconfig-shared.c:393:2: error: unknown type name 'acpi_status' arch/x86/pci/mmconfig-shared.c:395:9: error: dereferencing pointer to incomplete type arch/x86/pci/mmconfig-shared.c:395:19: error: 'ACPI_RESOURCE_TYPE_FIXED_MEMORY32' undeclared (first use in this function) arch/x86/pci/mmconfig-shared.c:395:19: note: each undeclared identifier is reported only once for each function it appears in arch/x86/pci/mmconfig-shared.c:397:8: error: dereferencing pointer to incomplete type arch/x86/pci/mmconfig-shared.c:399:11: error: 'AE_OK' undeclared (first use in this function) arch/x86/pci/mmconfig-shared.c:400:35: error: dereferencing pointer to incomplete type arch/x86/pci/mmconfig-shared.c:401:33: error: dereferencing pointer to incomplete type arch/x86/pci/mmconfig-shared.c:402:19: error: dereferencing pointer to incomplete type arch/x86/pci/mmconfig-shared.c:404:11: error: 'AE_CTRL_TERMINATE' undeclared (first use in this function) arch/x86/pci/mmconfig-shared.c:407:10: error: dereferencing pointer to incomplete type arch/x86/pci/mmconfig-shared.c:407:20: error: 'ACPI_RESOURCE_TYPE_ADDRESS32' undeclared (first use in this function) arch/x86/pci/mmconfig-shared.c:408:10: error: dereferencing pointer to incomplete type arch/x86/pci/mmconfig-shared.c:408:20: error: 'ACPI_RESOURCE_TYPE_ADDRESS64' undeclared (first use in this function) arch/x86/pci/mmconfig-shared.c:411:2: error: implicit declaration of function 'acpi_resource_to_address64' [-Werror=implicit-function-declaration] arch/x86/pci/mmconfig-shared.c:412:2: error: implicit declaration of function 'ACPI_FAILURE' [-Werror=implicit-function-declaration] arch/x86/pci/mmconfig-shared.c:414:31: error: 'ACPI_MEMORY_RANGE' undeclared (first use in this function) arch/x86/pci/mmconfig-shared.c:392:33: warning: unused variable 'address' [-Wunused-variable] arch/x86/pci/mmconfig-shared.c: At top level: arch/x86/pci/mmconfig-shared.c:425:1: error: unknown type name 'acpi_status' arch/x86/pci/mmconfig-shared.c:425:41: error: unknown type name 'acpi_handle' arch/x86/pci/mmconfig-shared.c: In function 'is_acpi_reserved': arch/x86/pci/mmconfig-shared.c:447:2: error: implicit declaration of function 'acpi_get_devices' [-Werror=implicit-function-declaration] arch/x86/pci/mmconfig-shared.c:447:30: error: 'find_mboard_resource' undeclared (first use in this function) arch/x86/pci/mmconfig-shared.c: At top level: arch/x86/pci/mmconfig-shared.c:389:20: warning: 'check_mcfg_resource' defined but not used [-Wunused-function] The root cause of this breakage is: 1. The following commit doesn't protect ACPICA functions like acpi_get_devices()/acpi_walk_resources()/acpi_resource_to_address64() in CONFIG_SFI=y and CONFIG_ACPI=n environment: Commit: 5f0db7a2fb78895a197f64e548333b3bbd433996 Author: Feng Tang Subject: SFI: Hook PCI MMCONFIG First check ACPI, and if that fails, ask SFI to find the MCFG. So it actually depends on the logic that in !CONFIG_ACPI builds, code blocks under "if (!acpi_disabled)" will not be linked in. This patch fixes this issue by introducing a stub for MCFG entry checker is_acpi_reserved() in !CONFIG_ACPI builds. Signed-off-by: Lv Zheng Cc: Bjorn Helgaas Cc: Len Brown Cc: Feng Tang Cc: sfi-devel@simplefirmware.org Cc: linux-pci@vger.kernel.org --- arch/x86/pci/mmconfig-shared.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 082e881..9f23a77 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -370,6 +370,7 @@ static int __init pci_mmcfg_check_hostbridge(void) return !list_empty(&pci_mmcfg_list); } +#ifdef CONFIG_ACPI static acpi_status check_mcfg_resource(struct acpi_resource *res, void *data) { struct resource *mcfg_res = data; @@ -436,6 +437,12 @@ static int is_acpi_reserved(u64 start, u64 end, unsigned not_used) return mcfg_res.flags; } +#else +static inline int is_acpi_reserved(u64 start, u64 end, unsigned not_used) +{ + return 0; +} +#endif typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type);