From patchwork Tue Dec 3 16:36:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 21975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 82D34202AE for ; Tue, 3 Dec 2013 16:37:39 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id l109sf33885921yhq.5 for ; Tue, 03 Dec 2013 08:37:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=g358fmj8tmGuyDObOZ/FDbb+bzDsbdiy8sekJcPlIwU=; b=GMxo0L2BNrrmi7KDm+dUZlXQeOz/oI2OwqLnNLHBFf41udT3nnd8/I1oZJaR06//NV AzDlp1hmr8OQDWWl45306yvhLqUiuehSiUA/xHLqDDi4+dTnrBB9x58gma5KB5Rd0TMd VQL7DHg4jYkdefpanvIYCeG+lBpT3I00gTCipjH1JXkSY2JQ58HFGNZcseL6D76NCXnk 19nRnHdspMHSU5yQEv7Y0YrDz1Ze0DDHt6IL7DKSf8oqFMqZZ6oX5He484EqK74664sB pNrPMSz/mMvFhhXIXBlxaaDugcs67JeXfO5ERBymB/UspF0t1G4NX2qYuFWsqO56R0dS 9aBw== X-Gm-Message-State: ALoCoQnUIMjzWGpdYAsX4MCHszmth9lM6XVONAGZ63fqpEDMkES+hX9M1TYvu4VRow1gYbtA6ewK X-Received: by 10.58.196.145 with SMTP id im17mr1082904vec.38.1386088659213; Tue, 03 Dec 2013 08:37:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.103 with SMTP id c7ls641983qen.24.gmail; Tue, 03 Dec 2013 08:37:39 -0800 (PST) X-Received: by 10.52.168.106 with SMTP id zv10mr47750465vdb.21.1386088659102; Tue, 03 Dec 2013 08:37:39 -0800 (PST) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id im16si29457327vec.130.2013.12.03.08.37.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:37:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu19so10288724vcb.0 for ; Tue, 03 Dec 2013 08:37:39 -0800 (PST) X-Received: by 10.58.155.162 with SMTP id vx2mr255804veb.46.1386088658898; Tue, 03 Dec 2013 08:37:38 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp222372vcz; Tue, 3 Dec 2013 08:37:38 -0800 (PST) X-Received: by 10.67.23.164 with SMTP id ib4mr76449279pad.42.1386088657856; Tue, 03 Dec 2013 08:37:37 -0800 (PST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by mx.google.com with ESMTPS id xa2si51860845pab.84.2013.12.03.08.37.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:37:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.176 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.192.176; Received: by mail-pd0-f176.google.com with SMTP id w10so20381730pde.35 for ; Tue, 03 Dec 2013 08:37:35 -0800 (PST) X-Received: by 10.66.226.46 with SMTP id rp14mr51755059pac.133.1386088655441; Tue, 03 Dec 2013 08:37:35 -0800 (PST) Received: from localhost ([219.142.3.202]) by mx.google.com with ESMTPSA id er3sm131145790pbb.40.2013.12.03.08.37.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:37:34 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Russell King - ARM Linux , Daniel Lezcano Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Grant Likely , Matthew Garrett , Olof Johansson , Linus Walleij , Bjorn Helgaas , Rob Herring , Mark Rutland , Jon Masters , patches@linaro.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, Hanjun Guo , Graeme Gregory , Al Stone Subject: [RFC part1 PATCH 1/7] ACPI: Make ACPI core running without PCI on ARM64 Date: Wed, 4 Dec 2013 00:36:45 +0800 Message-Id: <1386088611-2801-2-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386088611-2801-1-git-send-email-hanjun.guo@linaro.org> References: <1386088611-2801-1-git-send-email-hanjun.guo@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Not all the ARM64 targets that are using ACPI have PCI, so introduce some stub functions to make ACPI core run without CONFIG_PCI on ARM64. 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 --- drivers/acpi/Makefile | 2 +- drivers/acpi/internal.h | 5 +++++ drivers/acpi/osl.c | 16 ++++++++++++++ drivers/acpi/reboot.c | 47 +++++++++++++++++++++++++++++----------- drivers/pnp/pnpacpi/rsparser.c | 2 ++ 5 files changed, 58 insertions(+), 14 deletions(-) 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 b125fdb..b1ef8fa 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -26,8 +26,13 @@ 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); +#else +static inline void acpi_pci_root_init(void) {} +static inline void acpi_pci_link_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 c543626..6434045 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1016,6 +1016,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width) return AE_OK; } +#ifdef CONFIG_PCI acpi_status acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, u64 *value, u32 width) @@ -1074,6 +1075,21 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, return (result ? AE_ERROR : AE_OK); } +#else +acpi_status +acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, u32 reg, + u64 *value, u32 width) +{ + return AE_ERROR; +} + +acpi_status +acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, u32 reg, + u64 value, u32 width) +{ + return AE_ERROR; +} +#endif /* CONFIG_PCI */ static void acpi_os_execute_deferred(struct work_struct *work) { diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index a6c77e8b..89a181f 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c @@ -3,12 +3,43 @@ #include #include +/* + * There are some rare cases in the ARM world with PCI is not one + * of the buses available to us, even though we use ACPI. + */ +#ifdef CONFIG_PCI +static void acpi_reset_with_writing_pci_config(u64 address, u8 reset_value) +{ + struct pci_bus *bus0; + unsigned int devfn; + + /* The reset register can only live on bus 0. */ + bus0 = pci_find_bus(0, 0); + if (!bus0) + return; + + /* Form PCI device/function pair. */ + devfn = PCI_DEVFN((address >> 32) & 0xffff, + (address >> 16) & 0xffff); + pr_debug("Resetting with ACPI PCI RESET_REG.\n"); + /* Write the value that resets us. */ + pci_bus_write_config_byte(bus0, devfn, + (address & 0xffff), reset_value); + + return; +} +#else +static void acpi_reset_with_writing_pci_config(u64 address, u8 reset_value) +{ + pr_warn("Resetting with ACPI PCI RESET_REG failed, PCI is disabled\n"); + return; +} +#endif + void acpi_reboot(void) { struct acpi_generic_address *rr; - struct pci_bus *bus0; u8 reset_value; - unsigned int devfn; if (acpi_disabled) return; @@ -32,17 +63,7 @@ void acpi_reboot(void) * on a device on bus 0. */ switch (rr->space_id) { case ACPI_ADR_SPACE_PCI_CONFIG: - /* The reset register can only live on bus 0. */ - bus0 = pci_find_bus(0, 0); - if (!bus0) - return; - /* Form PCI device/function pair. */ - devfn = PCI_DEVFN((rr->address >> 32) & 0xffff, - (rr->address >> 16) & 0xffff); - printk(KERN_DEBUG "Resetting with ACPI PCI RESET_REG."); - /* Write the value that resets us. */ - pci_bus_write_config_byte(bus0, devfn, - (rr->address & 0xffff), reset_value); + acpi_reset_with_writing_pci_config(rr->address, reset_value); break; case ACPI_ADR_SPACE_SYSTEM_MEMORY: diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 167f3d0..5804e77 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -113,8 +113,10 @@ static int dma_flags(struct pnp_dev *dev, int type, int bus_master, static void pnpacpi_add_irqresource(struct pnp_dev *dev, struct resource *r) { +#ifdef CONFIG_PCI if (!(r->flags & IORESOURCE_DISABLED)) pcibios_penalize_isa_irq(r->start, 1); +#endif pnp_add_resource(dev, r); }