Skip to content

Commit 01415e7

Browse files
vlsunilrafaeljw
authored andcommitted
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 <[email protected]> Tested-by: Björn Töpel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2cb9155 commit 01415e7

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

arch/riscv/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config 32BIT
1313
config RISCV
1414
def_bool y
1515
select ACPI_GENERIC_GSI if ACPI
16+
select ACPI_MCFG if (ACPI && PCI)
1617
select ACPI_PPTT if ACPI
1718
select ACPI_REDUCED_HARDWARE_ONLY if ACPI
1819
select ACPI_SPCR_TABLE if ACPI
@@ -188,6 +189,7 @@ config RISCV
188189
select OF_EARLY_FLATTREE
189190
select OF_IRQ
190191
select PCI_DOMAINS_GENERIC if PCI
192+
select PCI_ECAM if (ACPI && PCI)
191193
select PCI_MSI if PCI
192194
select RISCV_ALTERNATIVE if !XIP_KERNEL
193195
select RISCV_APLIC

arch/riscv/kernel/acpi.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -311,29 +311,26 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
311311
#ifdef CONFIG_PCI
312312

313313
/*
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.
317315
*/
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)
320318
{
321-
return PCIBIOS_DEVICE_NOT_FOUND;
322-
}
319+
struct pci_bus *b = pci_find_bus(domain, bus);
323320

324-
int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
325-
int reg, int len, u32 val)
326-
{
327-
return PCIBIOS_DEVICE_NOT_FOUND;
321+
if (!b)
322+
return PCIBIOS_DEVICE_NOT_FOUND;
323+
return b->ops->read(b, devfn, reg, len, val);
328324
}
329325

330-
int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
326+
int raw_pci_write(unsigned int domain, unsigned int bus,
327+
unsigned int devfn, int reg, int len, u32 val)
331328
{
332-
return -1;
333-
}
329+
struct pci_bus *b = pci_find_bus(domain, bus);
334330

335-
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
336-
{
337-
return NULL;
331+
if (!b)
332+
return PCIBIOS_DEVICE_NOT_FOUND;
333+
return b->ops->write(b, devfn, reg, len, val);
338334
}
335+
339336
#endif /* CONFIG_PCI */

drivers/pci/pci-acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ static int __init acpi_pci_init(void)
15431543
}
15441544
arch_initcall(acpi_pci_init);
15451545

1546-
#if defined(CONFIG_ARM64)
1546+
#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV)
15471547

15481548
/*
15491549
* Try to assign the IRQ number when probing a new device

0 commit comments

Comments
 (0)