]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ACPI: RISC-V: Implement PCI related functionality
authorSunil V L <sunilvl@ventanamicro.com>
Mon, 12 Aug 2024 00:59:21 +0000 (06:29 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Aug 2024 13:48:35 +0000 (15:48 +0200)
Replace the dummy implementation for PCI related functions with actual
implementation. This needs ECAM and MCFG CONFIG options to be enabled
for RISC-V.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://patch.msgid.link/20240812005929.113499-10-sunilvl@ventanamicro.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
arch/riscv/Kconfig
arch/riscv/kernel/acpi.c
drivers/pci/pci-acpi.c

index 0f3cd7c3a4360529331d8dd0023c11460b957622..a269e577284ea47915a087ebe1da5a25f72566ce 100644 (file)
@@ -13,6 +13,7 @@ config 32BIT
 config RISCV
        def_bool y
        select ACPI_GENERIC_GSI if ACPI
+       select ACPI_MCFG if (ACPI && PCI)
        select ACPI_PPTT if ACPI
        select ACPI_REDUCED_HARDWARE_ONLY if ACPI
        select ACPI_SPCR_TABLE if ACPI
@@ -188,6 +189,7 @@ config RISCV
        select OF_EARLY_FLATTREE
        select OF_IRQ
        select PCI_DOMAINS_GENERIC if PCI
+       select PCI_ECAM if (ACPI && PCI)
        select PCI_MSI if PCI
        select RISCV_ALTERNATIVE if !XIP_KERNEL
        select RISCV_APLIC
index ba957aaca5cbb8ab3e4bdc832fcccd87d6ea7a5d..6e0d333f57e556912742e4282a6dcb03674ebb2d 100644 (file)
@@ -311,29 +311,26 @@ 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;
+       return b->ops->read(b, devfn, reg, len, val);
 }
 
-int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
+int raw_pci_write(unsigned int domain, unsigned int bus,
+                 unsigned int devfn, int reg, int len, u32 val)
 {
-       return -1;
-}
+       struct pci_bus *b = pci_find_bus(domain, bus);
 
-struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
-{
-       return NULL;
+       if (!b)
+               return PCIBIOS_DEVICE_NOT_FOUND;
+       return b->ops->write(b, devfn, reg, len, val);
 }
+
 #endif /* CONFIG_PCI */
index 8ed81a373bd7ddf6ce2b3375818133ed45dabded..af370628e58393aa0cbdf6d283b3afe33e5effb5 100644 (file)
@@ -1543,7 +1543,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