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: 710933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 299E4C001DB for ; Thu, 3 Aug 2023 18:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235548AbjHCSA6 (ORCPT ); Thu, 3 Aug 2023 14:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235309AbjHCSAg (ORCPT ); Thu, 3 Aug 2023 14:00:36 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 258F0423F for ; Thu, 3 Aug 2023 11:00:20 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-686f0d66652so1090415b3a.2 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=N05ITnY846bFQ+98jfBqDmrOHoPT+FWhLli3dQSLrEP6DncrVYQDtl7TUZaa3FrQ1W jUN0QdvRE/z6W6veRhjvVjD0aonKGGD8TuKrazaHi3kSl4vxX2nne6vCuP5Jn2FX1oM2 DiRAyR/cL6wzVoteSN78bnltUSi4/Ju1j9xbS9BvPpKwbbR2fhkR/TMgSgY/cE+4QKS4 WeL5mawA1pdBIIlDOIK9O+vLoSLs/yrAwdy6wL+66GCbeUP7+mI0xF9PQj6903A483Jj A5KeXHY5170uc/D1ndxjVHhXDxEf/nUrl3BT0RDD8cfHN1BN+KzS5k2mC8HkygnVPnGr syJQ== X-Gm-Message-State: ABy/qLbJUcM3Spt8crxV2OH56pIrSZ47xAldGO49eizqO4hwec3AfzX8 vT++dT2PmQKOI2xRlN0w2n7bgA== X-Google-Smtp-Source: APBJJlEzbrnno8tMNvQ3OeUKWzuED/8IeQRaqcQag7dwUOCCbEcY3VwgrJDme+hmO3Kc0CFMYucNRA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 */