From patchwork Wed Nov 19 16:04:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 5339101 Return-Path: X-Original-To: patchwork-linux-acpi@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 2FA43C11AC for ; Wed, 19 Nov 2014 16:06:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6838E20211 for ; Wed, 19 Nov 2014 16:06:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D635620212 for ; Wed, 19 Nov 2014 16:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756367AbaKSQGA (ORCPT ); Wed, 19 Nov 2014 11:06:00 -0500 Received: from mail-wg0-f45.google.com ([74.125.82.45]:54668 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932322AbaKSQFn (ORCPT ); Wed, 19 Nov 2014 11:05:43 -0500 Received: by mail-wg0-f45.google.com with SMTP id b13so1178017wgh.18 for ; Wed, 19 Nov 2014 08:05:42 -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=m7+TvXlliLp51Nfc5u8yQkHg6QpsqxRAldDpDMcJDGs=; b=C42ErqvAJ7WOTWj9Uzw2lFC/qiozjXrMnIvrKp1A/5PnNBm2I+GMgTjp2lG9Kp1R5o koepc1gvZZWhQBI80eS/MeQEHEFsYmmVSI76/6Yi6F1xNOXVIfcMDWgwEaei1NTahrlo JPmW3VuT+tDd0LrxtjTjzgECsxtquEUUFQHxtwNaDVuQK5LNGWIsg/0+5TWTpJ3vklih dKEOFaMdGD/s1/1vHcBKx2q7AyrJvOwoikdi7wJaG0c6nS5Q7tSjZjRViVTiNPNp8oGS 4reJX2salDsmQu4kJP7lMFSPUF1c5OrHxSrPXS/1yALvvonuVv3V4S5WAJNOS65NKJ7i 3nAg== X-Gm-Message-State: ALoCoQlkKGJT2WD9PxFVC9wYCnlnh69jX4DYutRxfBKrN30F8IjByxyX8k+iPgAVBgYZHDd4mSuf X-Received: by 10.194.62.163 with SMTP id z3mr13643130wjr.74.1416413142047; Wed, 19 Nov 2014 08:05:42 -0800 (PST) Received: from tn-HP-4.semihalf.com (cardhu.semihalf.com. [213.17.239.108]) by mx.google.com with ESMTPSA id e7sm2842175wjx.31.2014.11.19.08.05.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Nov 2014 08:05:41 -0800 (PST) From: Tomasz Nowicki To: catalin.marinas@arm.com, will.deacon@arm.com, bhelgaas@google.com, lorenzo.pieralisi@arm.com, wangyijing@huawei.com, arnd@arndb.de, hanjun.guo@linaro.org, Liviu.Dudau@arm.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, rjw@rjwysocki.net Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linaro-acpi@lists.linaro.org, Tomasz Nowicki Subject: [PATCH 6/6] pci, acpi: Share ACPI PCI config space accessors. Date: Wed, 19 Nov 2014 17:04:51 +0100 Message-Id: <1416413091-13452-7-git-send-email-tomasz.nowicki@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416413091-13452-1-git-send-email-tomasz.nowicki@linaro.org> References: <1416413091-13452-1-git-send-email-tomasz.nowicki@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 MMCFG can be used perfectly for all architectures which support ACPI. ACPI mandates MMCFG to describe PCI config space ranges which means we should use MMCONFIG accessors by default. Signed-off-by: Tomasz Nowicki Tested-by: Hanjun Guo --- drivers/acpi/mmconfig.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/acpi/mmconfig.c b/drivers/acpi/mmconfig.c index c0ad05f..c9c6e05 100644 --- a/drivers/acpi/mmconfig.c +++ b/drivers/acpi/mmconfig.c @@ -23,6 +23,26 @@ static DEFINE_MUTEX(pci_mmcfg_lock); LIST_HEAD(pci_mmcfg_list); +/* + * raw_pci_read/write - ACPI PCI config space accessors. + * + * ACPI spec defines MMCFG as the way we can access PCI config space, + * so let MMCFG be default (__weak). + * + * If platform needs more fancy stuff, should provides its own implementation. + */ +int __weak raw_pci_read(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 *val) +{ + return pci_mmcfg_read(domain, bus, devfn, reg, len, val); +} + +int __weak raw_pci_write(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 val) +{ + return pci_mmcfg_write(domain, bus, devfn, reg, len, val); +} + static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) {