From patchwork Fri Jan 17 12:24:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 3503721 Return-Path: X-Original-To: patchwork-linux-arm@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 EE5A4C02DC for ; Fri, 17 Jan 2014 12:28:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9239220108 for ; Fri, 17 Jan 2014 12:28:30 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F7FC2015D for ; Fri, 17 Jan 2014 12:28:29 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48X9-0007Eo-1j; Fri, 17 Jan 2014 12:28:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48X6-00077u-G1; Fri, 17 Jan 2014 12:28:20 +0000 Received: from mail-pb0-f53.google.com ([209.85.160.53]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48X2-00076u-Pf for linux-arm-kernel@lists.infradead.org; Fri, 17 Jan 2014 12:28:17 +0000 Received: by mail-pb0-f53.google.com with SMTP id ma3so4035068pbc.40 for ; Fri, 17 Jan 2014 04:27:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OKjPpOo0sVA7IEF9y6r6zzSbrPjEx2sXtwPjtmucLh4=; b=H3KS4B3YQgb6pMzBiX3GH2evrlQ/adgjtQxR7OIMNFpITlqYCjpLzcHu0bimEl6xKV 4lpdElol3jzOiIdPuFcOjBmToEPeHO6bHKFBPCUIQdNwHcSrm/0KR3wXfrfcBlk8z+Mt U4iDE/9CLhe/YukXoLeGje0toD0LiMgVxoTRWl/uyvBoqV8/6lQhEMTYZ7eKK7XX07h0 9QWJqWybXSu9AVc9UM8psybge566s3AEzNl+EBorr9xtb5Zpp9UvH4ekgcKMPbU1sTZw 5jbKvhCClSgYMLTGYQB00Hl6YvBqL+1gSKnsVB8iNSGWUNXQ5wE41QkEIRzqXYL1YoGp q5Iw== X-Gm-Message-State: ALoCoQmxUtKP8MDNeKzaqXv4jG3Pn/lWWu1PZrWvVrzLxUuVryklvNUv0aMAc/qh3DDxFW+471Im X-Received: by 10.66.249.202 with SMTP id yw10mr1665836pac.111.1389961674787; Fri, 17 Jan 2014 04:27:54 -0800 (PST) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id y9sm30173502pas.10.2014.01.17.04.27.09 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 Jan 2014 04:27:54 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Russell King - ARM Linux Subject: [PATCH 01/20] ARM64 / ACPI: Make PCI optional for ACPI on ARM64 Date: Fri, 17 Jan 2014 20:24:55 +0800 Message-Id: <1389961514-13562-2-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389961514-13562-1-git-send-email-hanjun.guo@linaro.org> References: <1389961514-13562-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140117_072817_040990_F9E164C1 X-CRM114-Status: GOOD ( 18.80 ) X-Spam-Score: -1.8 (-) Cc: Mark Rutland , Matthew Garrett , linaro-kernel@lists.linaro.org, Graeme Gregory , Arnd Bergmann , Rob Herring , Linus Walleij , Olof Johansson , linux-kernel@vger.kernel.org, Al Stone , linaro-acpi@lists.linaro.org, linux-acpi@vger.kernel.org, Hanjun Guo , patches@linaro.org, Grant Likely , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Charles.Garcia-Tobin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, 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 Not all the ARM64 targets that are using ACPI have PCI, so introduce some stub functions to make PCI optional for ACPI, and make ACPI core run without CONFIG_PCI on ARM64. pcibios_penalize_isa_irq() is arch dependent, introduce asm/pci.h to include it. Since ACPI on X86 and IA64 depends on PCI, it will not break X86 and IA64 with this patch. Signed-off-by: Graeme Gregory Signed-off-by: Al Stone Signed-off-by: Hanjun Guo Acked-by: Bjorn Helgaas --- arch/arm64/include/asm/pci.h | 20 ++++++++++++++++++++ drivers/acpi/Makefile | 2 +- drivers/acpi/internal.h | 7 +++++++ drivers/acpi/osl.c | 3 ++- include/linux/pci.h | 33 ++++++++++++++++++++++++--------- 5 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 arch/arm64/include/asm/pci.h diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h new file mode 100644 index 0000000..455909d --- /dev/null +++ b/arch/arm64/include/asm/pci.h @@ -0,0 +1,20 @@ +#ifndef __ASMARM64_PCI_H +#define __ASMARM64_PCI_H + +#ifdef __KERNEL__ + +static inline void pcibios_penalize_isa_irq(int irq, int active) +{ + /* We don't do dynamic PCI IRQ allocation */ +} + +/* + * The PCI address space does equal the physical memory address space. + * The networking and block device layers use this boolean for bounce + * buffer decisions. + */ +#define PCI_DMA_BUS_IS_PHYS (1) + +#endif /* __KERNEL__ */ + +#endif /* __ASMARM64_PCI_H */ diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 0331f91..d8cebe3 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -38,7 +38,7 @@ acpi-y += acpi_processor.o acpi-y += processor_core.o acpi-y += ec.o acpi-$(CONFIG_ACPI_DOCK) += dock.o -acpi-y += pci_root.o pci_link.o pci_irq.o +acpi-$(CONFIG_PCI) += pci_root.o pci_link.o pci_irq.o acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o acpi-y += acpi_platform.o acpi-y += power.o diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index a29739c..52dff47 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -26,9 +26,16 @@ acpi_status acpi_os_initialize1(void); int init_acpi_device_notify(void); int acpi_scan_init(void); +#ifdef CONFIG_PCI void acpi_pci_root_init(void); void acpi_pci_link_init(void); void acpi_pci_root_hp_init(void); +#else +static inline void acpi_pci_root_init(void) {} +static inline void acpi_pci_link_init(void) {} +static inline void acpi_pci_root_hp_init(void) {} +#endif /* CONFIG_PCI */ + void acpi_processor_init(void); void acpi_platform_init(void); int acpi_sysfs_init(void); diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 54a20ff..14ee6fc 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1050,7 +1050,8 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, result = raw_pci_read(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), reg, size, &value32); - *value = value32; + if (!result) + *value = value32; return (result ? AE_ERROR : AE_OK); } diff --git a/include/linux/pci.h b/include/linux/pci.h index a13d682..726cf2a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -541,15 +541,6 @@ struct pci_ops { int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); }; -/* - * ACPI needs to be able to access PCI config space before we've done a - * PCI bus scan and created pci_bus structures. - */ -int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, - int reg, int len, u32 *val); -int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, - int reg, int len, u32 val); - struct pci_bus_region { resource_size_t start; resource_size_t end; @@ -1281,6 +1272,15 @@ typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, unsigned int command_bits, u32 flags); void pci_register_set_vga_state(arch_set_vga_state_t func); +/* + * ACPI needs to be able to access PCI config space before we've done a + * PCI bus scan and created pci_bus structures. + */ +int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, + int reg, int len, u32 *val); +int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, + int reg, int len, u32 val); + #else /* CONFIG_PCI is not enabled */ /* @@ -1477,6 +1477,21 @@ static inline int pci_domain_nr(struct pci_bus *bus) static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } +static inline struct pci_bus *pci_find_bus(int domain, int busnr) +{ return NULL; } + +static inline int pci_bus_write_config_byte(struct pci_bus *bus, + unsigned int devfn, int where, u8 val) +{ return -ENODEV; } + +static inline int raw_pci_read(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 *val) +{ return -EINVAL; } + +static inline int raw_pci_write(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 val) +{return -EINVAL; } + #define dev_is_pci(d) (false) #define dev_is_pf(d) (false) #define dev_num_vf(d) (0)