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: 5339091 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C4E059F2ED for ; Wed, 19 Nov 2014 16:06:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5ED220211 for ; Wed, 19 Nov 2014 16:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E96D20122 for ; Wed, 19 Nov 2014 16:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756423AbaKSQGB (ORCPT ); Wed, 19 Nov 2014 11:06:01 -0500 Received: from mail-wi0-f180.google.com ([209.85.212.180]:52501 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932319AbaKSQFn (ORCPT ); Wed, 19 Nov 2014 11:05:43 -0500 Received: by mail-wi0-f180.google.com with SMTP id n3so2430983wiv.1 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=jJIvcJp5OsMsTZc7XItnTp68ffHyd0UFptiGMxICenkcQ+ffCo3IP7I56hhJOlBCXY Wemso+PDl4XpS9yD92Q04E+anaLmUPjs1egglTmA7nY5Mlee2sh0nzs5NmSEKvGHq0Ro Ln35ys4S+TcS39HUT8HYlio9nSe22PX9qQWtxJIhRQTfz7jnew8C4ROjbp9fyzY5sk+S a2hEzT7jo1SDs+P0GhdGX+hy/b94kr98q7Eew6qAK4BeWhptjN+Sw1ZY5seGNbbIZoA5 RaAT0xUYnXnaeR42ulpWJHlHaQ4RIckPQ3h8dTlWCz37j1kv4shdJa6+sbzJyTIKfYNq L9VQ== X-Gm-Message-State: ALoCoQnFel54zlpsX8OlQ83KASlkD+pBaRNAlSfOAcIVkAKWeQA6AweUp1lDFfCI42d6kVFcYuvN 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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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=ham 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) {