From: Jiang Liu <jiang.liu@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
Yinghai Lu <yinghai@kernel.org>,
Taku Izumi <izumi.taku@jp.fujitsu.com>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
Don Dutile <ddutile@redhat.com>
Cc: Jiang Liu <jiang.liu@huawei.com>,
Yijing Wang <wangyijing@huawei.com>,
Keping Chen <chenkeping@huawei.com>, <linux-pci@vger.kernel.org>,
Jiang Liu <liuj97@gmail.com>
Subject: [PATCH v9 10/11] x86, PCI: refine __pci_mmcfg_init() for better code readability
Date: Thu, 21 Jun 2012 17:37:02 +0800 [thread overview]
Message-ID: <1340271423-4352-11-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <1340271423-4352-1-git-send-email-jiang.liu@huawei.com>
Refine __pci_mmcfg_init() for better code readability.
Signed-off-by: Jiang Liu <liuj97@gmail.com>
---
arch/x86/pci/mmconfig-shared.c | 46 ++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 332fabd..ffe72b9 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -544,8 +544,6 @@ static void __init pci_mmcfg_reject_broken(int early)
}
}
-static int __initdata known_bridge;
-
static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg,
struct acpi_mcfg_allocation *cfg)
{
@@ -617,28 +615,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
static void __init __pci_mmcfg_init(int early)
{
- /* MMCONFIG disabled */
- if ((pci_probe & PCI_PROBE_MMCONF) == 0)
- return;
-
- /* MMCONFIG already enabled */
- if (!early && !(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF))
- return;
-
- /* for late to exit */
- if (known_bridge)
- return;
-
- if (early) {
- if (pci_mmcfg_check_hostbridge())
- known_bridge = 1;
- }
-
- if (!known_bridge)
- acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
-
pci_mmcfg_reject_broken(early);
-
if (list_empty(&pci_mmcfg_list))
return;
@@ -660,14 +637,33 @@ static void __init __pci_mmcfg_init(int early)
}
}
+static int __initdata known_bridge;
+
void __init pci_mmcfg_early_init(void)
{
- __pci_mmcfg_init(1);
+ if (pci_probe & PCI_PROBE_MMCONF) {
+ if (pci_mmcfg_check_hostbridge())
+ known_bridge = 1;
+ else
+ acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
+ __pci_mmcfg_init(1);
+ }
}
void __init pci_mmcfg_late_init(void)
{
- __pci_mmcfg_init(0);
+ /* MMCONFIG disabled */
+ if ((pci_probe & PCI_PROBE_MMCONF) == 0)
+ return;
+
+ if (known_bridge)
+ return;
+
+ /* MMCONFIG hasn't been enabled yet, try again */
+ if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF) {
+ acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
+ __pci_mmcfg_init(0);
+ }
}
static int __init pci_mmcfg_late_insert_resources(void)
--
1.7.1
next prev parent reply other threads:[~2012-06-21 9:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-21 9:36 [PATCH v9 00/11] PCI, x86: update MMCFG information when hot-plugging PCI host bridges Jiang Liu
2012-06-21 9:36 ` [PATCH v9 01/11] x86/PCI: split out pci_mmcfg_check_reserved() for code reuse Jiang Liu
2012-06-21 9:36 ` [PATCH v9 02/11] x86/PCI: split out pci_mmconfig_alloc() " Jiang Liu
2012-06-21 9:36 ` [PATCH v9 03/11] x86/PCI: use RCU list to protect mmconfig list Jiang Liu
2012-06-21 9:36 ` [PATCH v9 04/11] x86/PCI: introduce pci_mmcfg_arch_map()/pci_mmcfg_arch_unmap() Jiang Liu
2012-06-21 21:25 ` Yinghai Lu
2012-06-21 9:36 ` [PATCH v9 05/11] x86/PCI: add pci_mmconfig_insert()/delete() for PCI root bridge hotplug Jiang Liu
2012-06-21 21:44 ` Yinghai Lu
2012-06-21 9:36 ` [PATCH v9 06/11] PCI/ACPI: provide MCFG address for PCI host bridges Jiang Liu
2012-06-21 9:36 ` [PATCH v9 07/11] x86/PCI: update MMCFG information when hot-plugging " Jiang Liu
2012-06-21 22:11 ` Yinghai Lu
2012-06-21 9:37 ` [PATCH v9 08/11] x86/PCI: simplify pci_mmcfg_late_insert_resources() Jiang Liu
2012-06-21 9:37 ` [PATCH v9 09/11] x86/PCI: get rid of redundant log messages Jiang Liu
2012-06-21 9:37 ` Jiang Liu [this message]
2012-06-21 9:37 ` [PATCH v9 11/11] ACPI: mark acpi_sfi_table_parse() as __init Jiang Liu
2012-06-21 20:06 ` [PATCH v9 00/11] PCI, x86: update MMCFG information when hot-plugging PCI host bridges Bjorn Helgaas
2012-06-21 21:20 ` Yinghai Lu
2012-06-21 22:22 ` Yinghai Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340271423-4352-11-git-send-email-jiang.liu@huawei.com \
--to=jiang.liu@huawei.com \
--cc=bhelgaas@google.com \
--cc=chenkeping@huawei.com \
--cc=ddutile@redhat.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-pci@vger.kernel.org \
--cc=liuj97@gmail.com \
--cc=wangyijing@huawei.com \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).