From patchwork Tue May 26 12:49:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 6479691 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2A8519F38C for ; Tue, 26 May 2015 12:53:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 378DB204A7 for ; Tue, 26 May 2015 12:53:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F7DB2060E for ; Tue, 26 May 2015 12:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752999AbbEZMxH (ORCPT ); Tue, 26 May 2015 08:53:07 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:34027 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753013AbbEZMxD (ORCPT ); Tue, 26 May 2015 08:53:03 -0400 Received: by pdbki1 with SMTP id ki1so48622485pdb.1 for ; Tue, 26 May 2015 05:50:48 -0700 (PDT) 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=Typx6iPnWL16A6mbIRB97zYnY4taarcAtuC6hMrlPBs=; b=P0lf3ikinPwmKw1HQu0nZeil4YL3/MlKBP85hBQlsli7X8SAiHjvKy7OM19yyN3LmA k2OvParRiGFhLxmvcVJlD8Xilu8CLCI3MD1ygUWOtZMPwf4/fFy6zYWIwCA0L4aevwAP wQhOJ4ettnaId4wkszlfpXJ3s0U7IJccekQGKlj2z4Ki/Hg3ULNYz1mGDEpjviTwvBHQ HwIf6sgoFmOWrbMVARSztjdlg9VDQBHNiHqVsu+S1MEYBiUwQJN4U3OSY88Yi+qXNpxs /Fbzngs5OMCHl7bxlOn48RrUAnDiJPPI9k6OfWuERCzh7PFtQ9lz1zq8UNKNMLmawJtY 8ziw== X-Gm-Message-State: ALoCoQk3aYgQ+20OEFy7m9FMU3WdWPcZJw2Xz/RBJgnlPlv+2l7/2W7UI/Y0V1tsG2ReD4gZTygc X-Received: by 10.70.43.225 with SMTP id z1mr48253591pdl.45.1432644648854; Tue, 26 May 2015 05:50:48 -0700 (PDT) Received: from localhost ([180.150.153.56]) by mx.google.com with ESMTPSA id u8sm13054058pdj.46.2015.05.26.05.50.47 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 26 May 2015 05:50:47 -0700 (PDT) From: Hanjun Guo To: Bjorn Helgaas , Arnd Bergmann , Catalin Marinas , Will Deacon , "Rafael J. Wysocki" Cc: Jiang Liu , Liviu Dudau , Thomas Gleixner , Yijing Wang , Lorenzo Pieralisi , Tomasz Nowicki , Suravee Suthikulpanit , Mark Salter , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH 09/11] pci, acpi, mcfg: Share ACPI PCI config space accessors. Date: Tue, 26 May 2015 20:49:22 +0800 Message-Id: <1432644564-24746-10-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432644564-24746-1-git-send-email-hanjun.guo@linaro.org> References: <1432644564-24746-1-git-send-email-hanjun.guo@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 From: Tomasz Nowicki MCFG can be used perfectly for all architectures which support ACPI. ACPI mandates MCFG to describe PCI config space ranges which means we should use MMCONFIG accessors by default. Signed-off-by: Tomasz Nowicki Signed-off-by: Hanjun Guo Tested-by: Suravee Suthikulpanit --- drivers/acpi/mcfg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/acpi/mcfg.c b/drivers/acpi/mcfg.c index 745b83e..90c81fa 100644 --- a/drivers/acpi/mcfg.c +++ b/drivers/acpi/mcfg.c @@ -12,6 +12,26 @@ #define PREFIX "MCFG: " +/* + * raw_pci_read/write - ACPI PCI config space accessors. + * + * ACPI spec defines MCFG table as the way we can describe access to PCI config + * space, so let MCFG 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); +} + int __init acpi_parse_mcfg(struct acpi_table_header *header) { struct acpi_table_mcfg *mcfg;