Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Raspberry Pi 4 DMA range fix



Hi!

I tracked down why NVMe doesn't work on the 8 gig RPi4.
The UEFI firmware has this ACPI table excerpt:

  Scope (\_SB)
  {
    Device (PCI0)
    {
      Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */)
      ...
      Name (_DMA, ResourceTemplate ()
      {
        QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
          0x0000000000000000, // Granularity
          0x0000000000000000, // Range Minimum
          0x00000000BFFFFFFF, // Range Maximum

Note here that _DMA is on the actual device node PCI0.
But in sys/arch/arm/acpi/acpi_machdep.c we only check for _DMA on the
parent device node. Also the _HID doesn't match module_hid, ACPI0004.
This results in the default DMA range being used and the device uses
nonreachable memory.

I think the ACPI machdep code should be changed as below. Is this ok?
With this I can use NVMe with the full 8 GiB of RAM enabled.

--- sys/arch/arm/acpi/acpi_machdep.c	8 Aug 2021 10:28:26 -0000	1.25
+++ sys/arch/arm/acpi/acpi_machdep.c	3 May 2022 14:36:59 -0000
@@ -499,6 +499,9 @@ arm_acpi_dma_module(struct acpi_softc *s
 	ACPI_HANDLE tmp;
 	ACPI_STATUS rv;

+	rv = AcpiGetHandle(ad->ad_handle, "_DMA", &tmp);
+	if (ACPI_SUCCESS(rv))
+		return ad->ad_handle;
 	/*
 	 * Search up the tree for a module device with a _DMA method.
 	 */
@@ -525,7 +528,7 @@ arm_acpi_dma_init_ranges(struct acpi_sof
 	ACPI_STATUS rv;
 	int n;

-	module = arm_acpi_dma_module(sc, ad->ad_parent);
+	module = arm_acpi_dma_module(sc, ad);
 	if (module == NULL) {
 default_tag:
 		/* No translation required */


Home | Main Index | Thread Index | Old Index