Bläddra i källkod

Platform/RaspberryPi/AcpiTables: add a IORT ACPI table to limit XHCI DMA

Add an IORT table that will limit XHCI DMA to 2 GB, by setting the
DMA width to 31 bits. This is needed for Linux/arm64, which can
only reliably deal with devices that are unable to perform DMA to
the entire 32-bit address range if it can discover their existence
early during boot, and this is before the ACPI interpreter is up
and running (which rules out calling the _DMA method of the XHC0
object)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Ard Biesheuvel 4 år sedan
förälder
incheckning
dac891da5c

+ 1 - 0
Platform/RaspberryPi/AcpiTables/AcpiTables.inf

@@ -29,6 +29,7 @@
   Fadt.aslc
   Dbg2.aslc
   Gtdt.aslc
+  Iort.aslc
   Dsdt.asl
   Csrt.aslc
   Spcr.aslc

+ 58 - 0
Platform/RaspberryPi/AcpiTables/Iort.aslc

@@ -0,0 +1,58 @@
+/** @file
+
+  Copyright (c) 2020, Arm, Ltd. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <IndustryStandard/IoRemappingTable.h>
+
+#include "AcpiTables.h"
+
+#pragma pack(1)
+
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE Node;
+  CONST CHAR8                               Name[16];
+} RPI4_NC_NODE;
+
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_TABLE      Iort;
+  RPI4_NC_NODE                         NamedCompNode;
+} RPI4_IO_REMAPPING_STRUCTURE;
+
+STATIC RPI4_IO_REMAPPING_STRUCTURE Iort = {
+  {
+    ACPI_HEADER (EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE,
+                 RPI4_IO_REMAPPING_STRUCTURE,
+                 EFI_ACPI_IO_REMAPPING_TABLE_REVISION),
+    1,                                              // NumNodes
+    sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),       // NodeOffset
+    0                                               // Reserved
+  }, {
+    // XHCI named component node
+    {
+      {
+        EFI_ACPI_IORT_TYPE_NAMED_COMP,              // Type
+        sizeof (RPI4_NC_NODE),                      // Length
+        0x0,                                        // Revision
+        0x0,                                        // Reserved
+        0x0,                                        // NumIdMappings
+        0x0,                                        // IdReference
+      },
+      0x0,                                          // Flags
+      0x0,                                          // CacheCoherent
+      0x0,                                          // AllocationHints
+      0x0,                                          // Reserved
+      0x0,                                          // MemoryAccessFlags
+      31,                                           // AddressSizeLimit
+    }, {
+      "\\_SB_.SCB0.XHC0"                            // ObjectName
+    }
+  }
+};
+
+#pragma pack()
+
+VOID* CONST ReferenceAcpiTable = &Iort;