From patchwork Thu Aug 3 17:59:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 130804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1341765vqx; Thu, 3 Aug 2023 11:51:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlHXLMVp0r+FZwvSnaJ/RdVBHQ8LvZL0Evj+6WmiFz24Ltgm8Nb43dcgc11XmRBHQB5K9/Rg X-Received: by 2002:a05:6a00:2316:b0:687:535f:6712 with SMTP id h22-20020a056a00231600b00687535f6712mr10416464pfh.14.1691088685022; Thu, 03 Aug 2023 11:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691088685; cv=none; d=google.com; s=arc-20160816; b=hpK7wyYWnCEegpw2utKcX1PMp/TpAE0cRcA2wSHKilFA9FIsycTHgSvjR/AJHK8V+f wkp8RQTCdAes/sRIZbctw7i2o4nzcSGqLr3J3MVIfwonMU4/amohv1OjgknLGizVsR9M WlYCif3WxXK/Wm4pSL2nZ35mhLq4SQa1Kj8w5KzCdls8HTl65yOt9xpHoiIYtvTxga1U TevJBXaxXBSjm1WlYaK1ZFjheR9tStY7BtUl/gxjV10pymXiJt1dQ2t38hJ/8AZooekk HTHjCfi9mrV8KK3rNE8i7jk7EFcTIKTYVXr/q13khVh1EsbIXWVz/txDyX0h8dR0V4kx QPnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7mbYpJBEy7QtZn0rLm+Z46rszMOgig5KvbO250k7OII=; fh=dzn7FZXuyjRD/SsADoLVmv8ajN6bypv0shpvYBNDmUc=; b=ryDeuYneHm9j2l8oSTHp83uwzbOVML+np8pQ2P+eRlFgezrPb7/Com4mfgxd4iSzIH Tm00MwGyfBzqY77H0jnfmOepRZa8afATFxU4w8OSOEnJHFMES51lazCmp4YPu9q0zDTU i12FvNlO1n4QakfmClbBSyxa05My+ScB+rwjNQW3xh/SS9mh1sqQodDYHTpwHVcGvZ0m +xP9kykjfdnge8A41jPvQKASBwe+YNJdfFJ63VngtNTq5BvOI0tzgF2diVhBpRri3XRI RH++Oyc4noJsf7+v+5MRqkUe5M9PgOlZ3xpH5xhDBCwtWOwldHwIXUFMEXS8Fkz1B3/t 7VIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=YfGQrWrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx11-20020a056a00428b00b00680a955d325si350837pfb.45.2023.08.03.11.51.11; Thu, 03 Aug 2023 11:51:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=YfGQrWrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235413AbjHCSBB (ORCPT + 99 others); Thu, 3 Aug 2023 14:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235386AbjHCSAh (ORCPT ); Thu, 3 Aug 2023 14:00:37 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25FAD4481 for ; Thu, 3 Aug 2023 11:00:20 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-68336d06620so1100949b3a.1 for ; Thu, 03 Aug 2023 11:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1691085619; x=1691690419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7mbYpJBEy7QtZn0rLm+Z46rszMOgig5KvbO250k7OII=; b=YfGQrWrqKxoHHrzv18a348oKjGYv1gGQ4cGmgyQBPY/sWq0LFcGm3LxWdqhhJX9N9s kBW3WG3VU+N9md0iX82nHkzuBp2q4t7soDxrCACNYYUFhcdhqpGhV2tZlHEQyVp7yC3I x3MZPiXRWfo/DCgcuqSvtbtyM5q1vXWl9zSat0C7GiPgfaHAdZmmf9DiiUkALXzC3yVv lSUTih5Yk/drJWTl6Lrv8KwxCFUZRYPN1Z/RXZ1bregl5jLq9/rXwM4R/ZO28pBL35/9 Tkint7JkljbwD6bJlr3TRUg/dGfiJuJLTrbOaZxni/zO2Vd+5zxHdGnGLPVhestQq1s9 FtbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691085619; x=1691690419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7mbYpJBEy7QtZn0rLm+Z46rszMOgig5KvbO250k7OII=; b=YZiKvpp55Nmatnka5+5U3AMasf2Xz/hKL6sjOPhwh2liaSDc4n2aQKVwXJDe5aMaHd Zhou7nQGHkBDklXgYNlC2xTTrPpp0psLi6DlZvQHGqvnAKBDeJSiRJxQiXy3QrAt5lzM 4XDZHk6Yg5hv8oLvZXmg5BoDAi0bYFvBD7YgvhzScg6nUEDi5pSnW9NrxuNT29wKzY52 HQHO+NsB8970PpmdZzBW04s/O+9Mb3WZ8a6UXOW3tZFvJep1CQs0LswoJeoQBkGZUIB+ 2QdVxRMvwEmu/Hr4nsXY1YKrgOLhmUKdiGkTKe7g/Dt+m5jvn0RHKv0HjPhGvq+w0lPd TWUg== X-Gm-Message-State: ABy/qLaF4++8WLQWU0yu5icoiLOH9VK/vSeq4yvir+BU2Oh4DLv1Xu/J 7k2sUkAIHHyKIygLqqBTXVGKtw== X-Received: by 2002:a05:6a21:718b:b0:134:b28f:b581 with SMTP id wq11-20020a056a21718b00b00134b28fb581mr20904425pzb.28.1691085619659; Thu, 03 Aug 2023 11:00:19 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.190.143]) by smtp.gmail.com with ESMTPSA id s8-20020aa78d48000000b0065a1b05193asm134952pfe.185.2023.08.03.11.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 11:00:19 -0700 (PDT) From: Sunil V L To: linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , Daniel Lezcano , Thomas Gleixner , Anup Patel , Marc Zyngier , Bjorn Helgaas , Robert Moore , Haibo Xu , Andrew Jones , Conor Dooley , Atish Kumar Patra , Sunil V L Subject: [RFC PATCH v1 06/21] RISC-V: ACPI: Implement PCI related functionality Date: Thu, 3 Aug 2023 23:29:01 +0530 Message-Id: <20230803175916.3174453-7-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803175916.3174453-1-sunilvl@ventanamicro.com> References: <20230803175916.3174453-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773235008620211222 X-GMAIL-MSGID: 1773235008620211222 Replace the dummy implementation for PCI related functions with actual implementation. Signed-off-by: Sunil V L --- arch/riscv/kernel/acpi.c | 32 +++++++++++++++----------------- drivers/pci/pci-acpi.c | 2 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index aa4433bca6d9..01022c5802ec 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -307,29 +307,27 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) #ifdef CONFIG_PCI /* - * These interfaces are defined just to enable building ACPI core. - * TODO: Update it with actual implementation when external interrupt - * controller support is added in RISC-V ACPI. + * raw_pci_read/write - Platform-specific PCI config space access. */ -int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, - int reg, int len, u32 *val) +int raw_pci_read(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 *val) { - return PCIBIOS_DEVICE_NOT_FOUND; -} + struct pci_bus *b = pci_find_bus(domain, bus); -int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, - int reg, int len, u32 val) -{ - return PCIBIOS_DEVICE_NOT_FOUND; -} + if (!b) + return PCIBIOS_DEVICE_NOT_FOUND; -int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) -{ - return -1; + return b->ops->read(b, devfn, reg, len, val); } -struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) +int raw_pci_write(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 val) { - return NULL; + struct pci_bus *b = pci_find_bus(domain, bus); + + if (!b) + return PCIBIOS_DEVICE_NOT_FOUND; + + return b->ops->write(b, devfn, reg, len, val); } #endif /* CONFIG_PCI */ diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index d6b2d64b8237..5af6188cdbe0 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -1521,7 +1521,7 @@ static int __init acpi_pci_init(void) arch_initcall(acpi_pci_init); -#if defined(CONFIG_ARM64) +#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV) /* * Try to assign the IRQ number when probing a new device */