Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: RISC-V: Implement PCI related functionality

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>

authored by

Sunil V L and committed by
Rafael J. Wysocki
01415e78 2cb9155d

+18 -19
+2
arch/riscv/Kconfig
··· 13 13 config RISCV 14 14 def_bool y 15 15 select ACPI_GENERIC_GSI if ACPI 16 + select ACPI_MCFG if (ACPI && PCI) 16 17 select ACPI_PPTT if ACPI 17 18 select ACPI_REDUCED_HARDWARE_ONLY if ACPI 18 19 select ACPI_SPCR_TABLE if ACPI ··· 189 188 select OF_EARLY_FLATTREE 190 189 select OF_IRQ 191 190 select PCI_DOMAINS_GENERIC if PCI 191 + select PCI_ECAM if (ACPI && PCI) 192 192 select PCI_MSI if PCI 193 193 select RISCV_ALTERNATIVE if !XIP_KERNEL 194 194 select RISCV_APLIC
+15 -18
arch/riscv/kernel/acpi.c
··· 311 311 #ifdef CONFIG_PCI 312 312 313 313 /* 314 - * These interfaces are defined just to enable building ACPI core. 315 - * TODO: Update it with actual implementation when external interrupt 316 - * controller support is added in RISC-V ACPI. 314 + * raw_pci_read/write - Platform-specific PCI config space access. 317 315 */ 318 - int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, 319 - int reg, int len, u32 *val) 316 + int raw_pci_read(unsigned int domain, unsigned int bus, 317 + unsigned int devfn, int reg, int len, u32 *val) 320 318 { 321 - return PCIBIOS_DEVICE_NOT_FOUND; 319 + struct pci_bus *b = pci_find_bus(domain, bus); 320 + 321 + if (!b) 322 + return PCIBIOS_DEVICE_NOT_FOUND; 323 + return b->ops->read(b, devfn, reg, len, val); 322 324 } 323 325 324 - int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, 325 - int reg, int len, u32 val) 326 + int raw_pci_write(unsigned int domain, unsigned int bus, 327 + unsigned int devfn, int reg, int len, u32 val) 326 328 { 327 - return PCIBIOS_DEVICE_NOT_FOUND; 329 + struct pci_bus *b = pci_find_bus(domain, bus); 330 + 331 + if (!b) 332 + return PCIBIOS_DEVICE_NOT_FOUND; 333 + return b->ops->write(b, devfn, reg, len, val); 328 334 } 329 335 330 - int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) 331 - { 332 - return -1; 333 - } 334 - 335 - struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) 336 - { 337 - return NULL; 338 - } 339 336 #endif /* CONFIG_PCI */
+1 -1
drivers/pci/pci-acpi.c
··· 1543 1543 } 1544 1544 arch_initcall(acpi_pci_init); 1545 1545 1546 - #if defined(CONFIG_ARM64) 1546 + #if defined(CONFIG_ARM64) || defined(CONFIG_RISCV) 1547 1547 1548 1548 /* 1549 1549 * Try to assign the IRQ number when probing a new device