From patchwork Mon Apr 9 16:22:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 151447 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 26490B7007 for ; Tue, 10 Apr 2012 02:25:35 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757489Ab2DIQZe (ORCPT ); Mon, 9 Apr 2012 12:25:34 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:40501 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757437Ab2DIQZd (ORCPT ); Mon, 9 Apr 2012 12:25:33 -0400 Received: by mail-iy0-f174.google.com with SMTP id z16so6060703iag.19 for ; Mon, 09 Apr 2012 09:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=2h76h0g8rSvNR0V8oNyOooPiNLxM7l7QFj+vPx5CH5k=; b=sW5J9hMkhTJNIFwMvLJakm6++eFqZM4Syjz8qYuTQJdynt2eOzZBQTqLEG0Vw7XuA4 fpcBIDPc+SWeU77uauGMrodptYbkDiLNBhH+j/zvgWJrnteJOy0V6plDTl9uRTRCnhFv pqe5J/EYpuueP9SXFfQmEl1PgSPc/aB4HEHJD6tiZX6Rrl3qhSrcVgY5Rjo1pkH/2aB/ 5O53zWtCetQ83tU3WHsFbQO6YfA62LX9HSCXhUVwMe78JtqoaCiUWYWW6cSyF+WCWEI/ bkgdiIXcYjO9MyrVFWGjgUJ3BlbfCfXNCBaDOSeS7Cjec4dDxz10iyQiI4Cg+eilst3b sxwg== Received: by 10.50.196.230 with SMTP id ip6mr5464131igc.49.1333988732924; Mon, 09 Apr 2012 09:25:32 -0700 (PDT) Received: from localhost.localdomain ([221.221.23.44]) by mx.google.com with ESMTPS id en3sm38061224igc.2.2012.04.09.09.25.25 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Apr 2012 09:25:32 -0700 (PDT) From: Jiang Liu To: Taku Izumi , Kenji Kaneshige , Yinghai Lu Cc: Jiang Liu , Bjorn Helgaas , Jiang Liu , Keping Chen , x86@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH V2 1/6] PCI, x86: split out pci_mmcfg_check_reserved() for code reuse Date: Tue, 10 Apr 2012 00:22:43 +0800 Message-Id: <1333988568-11282-2-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1333988568-11282-1-git-send-email-jiang.liu@huawei.com> References: <1333988568-11282-1-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Split out pci_mmcfg_check_reserved() for code reuse, which will be used when supporting PCI host bridge hotplug. Signed-off-by: Jiang Liu --- arch/x86/pci/mmconfig-shared.c | 51 +++++++++++++++++++-------------------- 1 files changed, 25 insertions(+), 26 deletions(-) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 301e325..f799949 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -474,39 +474,38 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved, return valid; } +static int __devinit pci_mmcfg_check_reserved(struct pci_mmcfg_region *cfg, + int early) +{ + if (!early && !acpi_disabled) { + if (is_mmconf_reserved(is_acpi_reserved, cfg, 0)) + return 1; + else + printk(KERN_ERR FW_BUG PREFIX + "MMCONFIG at %pR not reserved in " + "ACPI motherboard resources\n", + &cfg->res); + } + + /* Don't try to do this check unless configuration + type 1 is available. how about type 2 ?*/ + if (raw_pci_ops) + return is_mmconf_reserved(e820_all_mapped, cfg, 1); + + return 0; +} + static void __init pci_mmcfg_reject_broken(int early) { struct pci_mmcfg_region *cfg; list_for_each_entry(cfg, &pci_mmcfg_list, list) { - int valid = 0; - - if (!early && !acpi_disabled) { - valid = is_mmconf_reserved(is_acpi_reserved, cfg, 0); - - if (valid) - continue; - else - printk(KERN_ERR FW_BUG PREFIX - "MMCONFIG at %pR not reserved in " - "ACPI motherboard resources\n", - &cfg->res); + if (pci_mmcfg_check_reserved(cfg, early) == 0) { + printk(KERN_INFO PREFIX "not using MMCONFIG\n"); + free_all_mmcfg(); + return; } - - /* Don't try to do this check unless configuration - type 1 is available. how about type 2 ?*/ - if (raw_pci_ops) - valid = is_mmconf_reserved(e820_all_mapped, cfg, 1); - - if (!valid) - goto reject; } - - return; - -reject: - printk(KERN_INFO PREFIX "not using MMCONFIG\n"); - free_all_mmcfg(); } static int __initdata known_bridge;