From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753142AbdCPXLy (ORCPT ); Thu, 16 Mar 2017 19:11:54 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:55014 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752072AbdCPXLw (ORCPT ); Thu, 16 Mar 2017 19:11:52 -0400 Message-Id: <20170316215057.374990930@linutronix.de> User-Agent: quilt/0.63-1 Date: Thu, 16 Mar 2017 22:50:08 +0100 From: Thomas Gleixner To: LKML Cc: Bjorn Helgaas , x86@kernel.org, Peter Anvin , Borislav Petkov , Peter Zijlstra , Stephane Eranian , Andi Kleen Subject: [patch 6/7] x86/pci/mmcfg: Include 32/64 bit code into shared code References: <20170316215002.726697858@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=x86-pci-mmcfg--Include-32-64-bit-code-into-shared-code.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Preparatory patch so the shared mmconfig code can access static functions in the 32/64bit specific mmconfig implementations. This is useful for the upcoming implementation of mmconfig based (ECAM) PCI configuration space access for both the legacy part (0-0xff) and the extended part (0x100-0xfff). Being able to access the low level mmconfig read/write functions directly avoids extra indirections. Signed-off-by: Thomas Gleixner --- arch/x86/pci/Makefile | 2 +- arch/x86/pci/mmconfig-shared.c | 6 ++++++ arch/x86/pci/mmconfig_32.c | 12 ++---------- arch/x86/pci/mmconfig_64.c | 16 ++++------------ 4 files changed, 13 insertions(+), 23 deletions(-) --- a/arch/x86/pci/Makefile +++ b/arch/x86/pci/Makefile @@ -1,7 +1,7 @@ obj-y := i386.o init.o obj-$(CONFIG_PCI_BIOS) += pcbios.o -obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o +obj-$(CONFIG_PCI_MMCONFIG) += direct.o mmconfig-shared.o obj-$(CONFIG_PCI_DIRECT) += direct.o obj-$(CONFIG_PCI_OLPC) += olpc.o obj-$(CONFIG_PCI_XEN) += xen.o --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -24,6 +24,12 @@ #define PREFIX "PCI: " +#ifdef CONFIG_X86_64 +# include "mmconfig_64.c" +#else +# include "mmconfig_32.c" +#endif + /* Indicate if the mmcfg resources have been placed into the resource table. */ static bool pci_mmcfg_running_state; static bool pci_mmcfg_arch_init_failed; --- a/arch/x86/pci/mmconfig_32.c +++ b/arch/x86/pci/mmconfig_32.c @@ -3,18 +3,10 @@ * Copyright (C) 2004 Intel Corp. * * This code is released under the GNU General Public License version 2. + * + * Low-level direct PCI config space access via MMCONFIG, 32bit version. */ -/* - * mmconfig.c - Low-level direct PCI config space access via MMCONFIG - */ - -#include -#include -#include -#include -#include - /* Assume systems with more busses have correct MCFG */ #define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c @@ -1,20 +1,12 @@ /* - * mmconfig.c - Low-level direct PCI config space access via MMCONFIG + * Low-level direct PCI config space access via MMCONFIG * * This is an 64bit optimized version that always keeps the full mmconfig * space mapped. This allows lockless config space operation. + * + * This file is included into the 32/64bit shared code so the read/write + * accessors are directly reachable there. */ - -#include -#include -#include -#include -#include -#include -#include - -#define PREFIX "PCI: " - static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) { struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus);