public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit
@ 2021-08-10  3:36 Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 1/6] Platform/RaspberryPi: Add XHCI/PCI selection menu Jeremy Linton
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-10  3:36 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton

A new Arm standard DEN0115A specifies how
platforms that don't have standard ECAM can
use the firmware to handle config read/write
operations. This is mostly implemented in TFA
but UEFI needs to assure that there is a
description of the root complex in the ACPI
namespace.

This set adds that description based on
a new menu item which toggles between XHCI
platform description and PCIe via a BDS
menu selection on the RPi4. The CM4 is really
the platform that needs this as it has a PCIe
slot. On that platform PCIe is enabled by default.

v1->v2:
    Use global shared interrupts in PCI PRT
        which is a pretty significant
        simplification.
    Modify bus max to use the secondary side
        of the root port for enforcing device
        limits
    Various other AML cleanups per Ard (drop
        redundant _DMA, bump UID to make it
        unique, etc)
    Break link status move into its own patch
    MADT->MCFG typos in various comments
    Commit message tweaking
		
Jeremy Linton (6):
  Platform/RaspberryPi: Add XHCI/PCI selection menu
  Platform/RaspberryPi: Break XHCI into its own SSDT
  Platform/RaspberryPi: Add PCIe SSDT
  Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction
  Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor
  Platform/RaspberryPi: Enable NVMe boot on CM4

 Platform/RaspberryPi/AcpiTables/AcpiTables.inf     |   4 +
 Platform/RaspberryPi/AcpiTables/Dsdt.asl           |   3 -
 Platform/RaspberryPi/AcpiTables/Pci.asl            | 209 +++++++++++++++++++++
 Platform/RaspberryPi/AcpiTables/Xhci.asl           |  35 ++--
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  56 ++++++
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf    |   1 +
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |   5 +
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr |  17 ++
 Platform/RaspberryPi/Include/ConfigVars.h          |   4 +
 Platform/RaspberryPi/RPi3/RPi3.dsc                 |   6 +
 Platform/RaspberryPi/RPi4/RPi4.dsc                 |  13 ++
 Platform/RaspberryPi/RPi4/RPi4.fdf                 |   5 +
 Platform/RaspberryPi/RaspberryPi.dec               |   1 +
 .../Bcm2711PciHostBridgeLibConstructor.c           |   5 -
 .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c   |  28 ++-
 15 files changed, 364 insertions(+), 28 deletions(-)
 create mode 100644 Platform/RaspberryPi/AcpiTables/Pci.asl

-- 
2.13.7


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/6] Platform/RaspberryPi: Add XHCI/PCI selection menu
  2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
@ 2021-08-10  3:36 ` Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 2/6] Platform/RaspberryPi: Break XHCI into its own SSDT Jeremy Linton
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-10  3:36 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton

Arm has standardized a PCI SMC conduit that can be used
to access the PCI config space in a standardized way. This
functionality doesn't yet exist in many OS/Distro's. Lets
add another advanced config item that allows the user
to toggle between presenting the XHCI on the base RPi4
as a platform device, or presenting this newer PCIe
conduit. The CM4 doesn't have an attached XHCI controller
soldered to the PCIe, so PCIe mode is the default.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 42 ++++++++++++++++++++++
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf    |  1 +
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |  5 +++
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 +++++++++
 Platform/RaspberryPi/Include/ConfigVars.h          |  4 +++
 Platform/RaspberryPi/RPi3/RPi3.dsc                 |  6 ++++
 Platform/RaspberryPi/RPi4/RPi4.dsc                 |  8 +++++
 Platform/RaspberryPi/RaspberryPi.dec               |  1 +
 8 files changed, 84 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 9e78cb47ad..87f6b4e7bb 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -43,6 +43,7 @@ extern UINT8 ConfigDxeStrings[];
 STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
 STATIC UINT32 mModelFamily = 0;
 STATIC UINT32 mModelInstalledMB = 0;
+STATIC UINT32 mModelRevision = 0;
 
 STATIC EFI_MAC_ADDRESS  mMacAddress;
 
@@ -271,6 +272,40 @@ SetupVariables (
     ASSERT_EFI_ERROR (Status);
   }
 
+  if (mModelFamily >= 4) {
+    if (((mModelRevision >> 4) & 0xFF) == 0x14) {
+      /*
+       * Enable PCIe by default on CM4
+       */
+      Status = PcdSet32S (PcdXhciPci, 2);
+      ASSERT_EFI_ERROR (Status);
+    } else {
+      Size = sizeof (UINT32);
+      Status = gRT->GetVariable (L"XhciPci",
+                                 &gConfigDxeFormSetGuid,
+                                 NULL, &Size, &Var32);
+      if (EFI_ERROR (Status) || (Var32 == 0)) {
+        /*
+         * Enable XHCI by default
+         */
+        Status = PcdSet32S (PcdXhciPci, 0);
+        ASSERT_EFI_ERROR (Status);
+      } else {
+        /* 
+         * Enable PCIe
+         */
+        Status = PcdSet32S (PcdXhciPci, 1);
+        ASSERT_EFI_ERROR (Status);
+      }
+    }
+  } else {
+    /* 
+     * Disable PCIe and XHCI
+     */
+    Status = PcdSet32S (PcdXhciPci, 0);
+    ASSERT_EFI_ERROR (Status);
+  }
+
   Size = sizeof (AssetTagVar);
   Status = gRT->GetVariable (L"AssetTag",
                   &gConfigDxeFormSetGuid,
@@ -888,6 +923,13 @@ ConfigInitialize (
     DEBUG ((DEBUG_INFO, "Current Raspberry Pi installed RAM size is %d MB\n", mModelInstalledMB));
   }
 
+  Status = mFwProtocol->GetModelRevision (&mModelRevision);
+  if (Status != EFI_SUCCESS) {
+    DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi revision: %r\n", Status));
+  } else {
+    DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevision));
+  }
+
   Status = SetupVariables ();
   if (Status != EFI_SUCCESS) {
     DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status));
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
index 4bb2d08550..e6e22ad82e 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
@@ -94,6 +94,7 @@
   gRaspberryPiTokenSpaceGuid.PcdFanOnGpio
   gRaspberryPiTokenSpaceGuid.PcdFanTemp
   gRaspberryPiTokenSpaceGuid.PcdUartInUse
+  gRaspberryPiTokenSpaceGuid.PcdXhciPci
 
 [Depex]
   gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
index 466fa852cb..5ec17072c3 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
@@ -57,6 +57,11 @@
 #string STR_ADVANCED_FANTEMP_PROMPT   #language en-US "ACPI fan temperature"
 #string STR_ADVANCED_FANTEMP_HELP     #language en-US "Cycle a fan at C"
 
+#string STR_ADVANCED_XHCIPCI_PROMPT   #language en-US "ACPI XHCI/PCIe"
+#string STR_ADVANCED_XHCIPCI_HELP     #language en-US "OS sees XHCI USB platform device or PCIe bridge"
+#string STR_ADVANCED_XHCIPCI_XHCI     #language en-US "XHCI"
+#string STR_ADVANCED_XHCIPCI_PCIE     #language en-US "PCIe"
+
 #string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag"
 #string STR_ADVANCED_ASSET_TAG_HELP   #language en-US "Set the system Asset Tag"
 
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
index fa34eab809..18b3ec726e 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
@@ -56,6 +56,11 @@ formset
       name  = FanTemp,
       guid  = CONFIGDXE_FORM_SET_GUID;
 
+    efivarstore ADVANCED_XHCIPCI_VARSTORE_DATA,
+      attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+      name  = XhciPci,
+      guid  = CONFIGDXE_FORM_SET_GUID;
+
     efivarstore SYSTEM_TABLE_MODE_VARSTORE_DATA,
       attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
       name  = SystemTableMode,
@@ -212,6 +217,18 @@ formset
               default = 60,
           endnumeric;
         endif;
+
+        suppressif ideqval XhciPci.Value == 2;
+          grayoutif NOT ideqval SystemTableMode.Mode == SYSTEM_TABLE_MODE_ACPI;
+            oneof varid = XhciPci.Value,
+              prompt      = STRING_TOKEN(STR_ADVANCED_XHCIPCI_PROMPT),
+              help        = STRING_TOKEN(STR_ADVANCED_XHCIPCI_HELP),
+              flags       = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
+              option text = STRING_TOKEN(STR_ADVANCED_XHCIPCI_XHCI), value = 0, flags = DEFAULT;
+              option text = STRING_TOKEN(STR_ADVANCED_XHCIPCI_PCIE), value = 1, flags = 0;
+            endoneof;
+          endif;
+        endif;
 #endif
         string varid = AssetTag.AssetTag,
             prompt  = STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT),
diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/RaspberryPi/Include/ConfigVars.h
index 142317985a..a5b32b5284 100644
--- a/Platform/RaspberryPi/Include/ConfigVars.h
+++ b/Platform/RaspberryPi/Include/ConfigVars.h
@@ -77,6 +77,10 @@ typedef struct {
 } ADVANCED_FANTEMP_VARSTORE_DATA;
 
 typedef struct {
+  UINT32 Value;
+} ADVANCED_XHCIPCI_VARSTORE_DATA;
+
+typedef struct {
 #define SYSTEM_TABLE_MODE_ACPI 0
 #define SYSTEM_TABLE_MODE_BOTH 1
 #define SYSTEM_TABLE_MODE_DT   2
diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 1c8a5408e7..6ab5d1ae6d 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -520,6 +520,12 @@
 
   gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRaspberryPiTokenSpaceGuid|0x0|0
 
+  # Select XHCI/PCIe mode (not valid on rpi3)
+  #
+  # 0  - DISABLED
+  #
+  gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0x0|0
+
   #
   # Common UEFI ones.
   #
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index dcf9bb5f11..babcbb2f41 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -536,6 +536,14 @@
 
   gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRaspberryPiTokenSpaceGuid|0x0|0
 
+  # Select XHCI/PCIe mode
+  #
+  # 0  - XHCI Enabled (default on !cm4)
+  # 1  - PCIe Enabled
+  # 2  - PCIe Enabled (default on cm4)
+  #
+  gRaspberryPiTokenSpaceGuid.PcdXhciPci|L"XhciPci"|gConfigDxeFormSetGuid|0x0|0
+
   #
   # Common UEFI ones.
   #
diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
index 2ca25ff9e6..797be59274 100644
--- a/Platform/RaspberryPi/RaspberryPi.dec
+++ b/Platform/RaspberryPi/RaspberryPi.dec
@@ -71,3 +71,4 @@
   gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|0|UINT32|0x0000001E
   gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
   gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021
+  gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/6] Platform/RaspberryPi: Break XHCI into its own SSDT
  2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 1/6] Platform/RaspberryPi: Add XHCI/PCI selection menu Jeremy Linton
@ 2021-08-10  3:36 ` Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 3/6] Platform/RaspberryPi: Add PCIe SSDT Jeremy Linton
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-10  3:36 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton

Lets prepare to switch between XHCI and PCI by moving
the XHCI definition into its own SSDT. That way we can
select it based on the menu settings. The resource
producer/consumer flag is also corrected.

Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/AcpiTables/AcpiTables.inf     |  1 +
 Platform/RaspberryPi/AcpiTables/Dsdt.asl           |  3 --
 Platform/RaspberryPi/AcpiTables/Xhci.asl           | 35 ++++++++++++++--------
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  8 +++++
 4 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
index 1ddc9ca5fe..f3e8d950c1 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
@@ -38,6 +38,7 @@
   SpcrPl011.aslc
   Pptt.aslc
   SsdtThermal.asl
+  Xhci.asl
 
 [Packages]
   ArmPkg/ArmPkg.dec
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index 1ee6379f46..b594d50bdf 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -64,9 +64,6 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
   Scope (\_SB_)
   {
     include ("Pep.asl")
-#if (RPI_MODEL == 4)
-    include ("Xhci.asl")
-#endif
 
     Device (CPU0)
     {
diff --git a/Platform/RaspberryPi/AcpiTables/Xhci.asl b/Platform/RaspberryPi/AcpiTables/Xhci.asl
index bc3fea60f9..9b37277956 100644
--- a/Platform/RaspberryPi/AcpiTables/Xhci.asl
+++ b/Platform/RaspberryPi/AcpiTables/Xhci.asl
@@ -9,6 +9,8 @@
 
 #include <IndustryStandard/Bcm2711.h>
 
+#include "AcpiTables.h"
+
 /*
  * The following can be used to remove parenthesis from
  * defined macros that the compiler complains about.
@@ -24,12 +26,17 @@
  */
 #define XHCI_REG_LENGTH                 0x1000
 
-Device (SCB0) {
-    Name (_HID, "ACPI0004")
-    Name (_UID, 0x0)
-    Name (_CCA, 0x0)
+DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4XHCI", 2)
+{
+  Scope (\_SB_)
+  {
+
+    Device (SCB0) {
+      Name (_HID, "ACPI0004")
+      Name (_UID, 0x0)
+      Name (_CCA, 0x0)
 
-    Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings
+      Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings
         /*
          * Container devices with _DMA must have _CRS, meaning SCB0
          * to provide all resources that XHC0 consumes (except
@@ -57,15 +64,15 @@ Device (SCB0) {
         Add (MMBE, XHCI_REG_LENGTH - 1, MMBE)
         Add (MMLE, XHCI_REG_LENGTH - 1, MMLE)
         Return (RBUF)
-    }
+      }
 
-    Name (_DMA, ResourceTemplate() {
+      Name (_DMA, ResourceTemplate() {
         /*
          * XHC0 is limited to DMA to first 3GB. Note this
          * only applies to PCIe, not GENET or other devices
          * next to the A72.
          */
-        QWordMemory (ResourceConsumer,
+        QWordMemory (ResourceProducer,
             ,
             MinFixed,
             MaxFixed,
@@ -79,10 +86,10 @@ Device (SCB0) {
             ,
             ,
             )
-    })
+      })
 
-    Device (XHC0)
-    {
+      Device (XHC0)
+      {
         Name (_HID, "PNP0D10")      // _HID: Hardware ID
         Name (_UID, 0x0)            // _UID: Unique ID
         Name (_CCA, 0x0)            // _CCA: Cache Coherency Attribute
@@ -131,5 +138,7 @@ Device (SCB0) {
             Debug = "xHCI enable"
             Store (0x6, CMND)
         }
-    }
-}
+      } // end XHC0
+    } //end SCB0
+  } //end scope sb
+} //end definition block
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 87f6b4e7bb..7c5786303d 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -814,6 +814,14 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] = {
     PcdToken(PcdSdIsArasan),
     SsdtEmmcNameOpReplace
   },
+#if (RPI_MODEL == 4)
+  {
+    SIGNATURE_64 ('R', 'P', 'I', '4', 'X', 'H', 'C', 'I'),
+    0,
+    PcdToken(PcdXhciPci),
+    NULL
+  },
+#endif
   { // DSDT
     SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0),
     0,
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/6] Platform/RaspberryPi: Add PCIe SSDT
  2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 1/6] Platform/RaspberryPi: Add XHCI/PCI selection menu Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 2/6] Platform/RaspberryPi: Break XHCI into its own SSDT Jeremy Linton
@ 2021-08-10  3:36 ` Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 4/6] Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction Jeremy Linton
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-10  3:36 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton

Since we plan on toggling between XHCI and PCI the PCI
root needs to be in its own SSDT. This is all thats needed
of UEFI. The SMC conduit is provided directly to the running
OS. When the OS detects this PCIe port on a machine without
a MCFG it attempts to connect to the SMC conduit. The RPi
definition doesn't have any power mgmt, and only provides
a description of the root port.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/AcpiTables/AcpiTables.inf     |   3 +
 Platform/RaspberryPi/AcpiTables/Pci.asl            | 209 +++++++++++++++++++++
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |   6 +
 3 files changed, 218 insertions(+)
 create mode 100644 Platform/RaspberryPi/AcpiTables/Pci.asl

diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
index f3e8d950c1..da2a6db85f 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
@@ -39,6 +39,7 @@
   Pptt.aslc
   SsdtThermal.asl
   Xhci.asl
+  Pci.asl
 
 [Packages]
   ArmPkg/ArmPkg.dec
@@ -59,6 +60,8 @@
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
   gArmTokenSpaceGuid.PcdGicDistributorBase
   gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioAdr
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioLen
   gBcm27xxTokenSpaceGuid.PcdBcm27xxPciRegBase
   gBcm27xxTokenSpaceGuid.PcdBcmGenetRegistersAddress
   gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress
diff --git a/Platform/RaspberryPi/AcpiTables/Pci.asl b/Platform/RaspberryPi/AcpiTables/Pci.asl
new file mode 100644
index 0000000000..31527d87b5
--- /dev/null
+++ b/Platform/RaspberryPi/AcpiTables/Pci.asl
@@ -0,0 +1,209 @@
+/** @file
+ *
+ *  Copyright (c) 2019 Linaro, Limited. All rights reserved.
+ *  Copyright (c) 2021 Arm
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#include <IndustryStandard/Bcm2711.h>
+
+#include "AcpiTables.h"
+
+/*
+ * The following can be used to remove parenthesis from
+ * defined macros that the compiler complains about.
+ */
+#define ISOLATE_ARGS(...)               __VA_ARGS__
+#define REMOVE_PARENTHESES(x)           ISOLATE_ARGS x
+
+#define SANITIZED_PCIE_CPU_MMIO_WINDOW  REMOVE_PARENTHESES(PCIE_CPU_MMIO_WINDOW)
+#define SANITIZED_PCIE_MMIO_LEN         REMOVE_PARENTHESES(PCIE_BRIDGE_MMIO_LEN)
+#define SANITIZED_PCIE_PCI_MMIO_BEGIN   REMOVE_PARENTHESES(PCIE_TOP_OF_MEM_WIN)
+
+/*
+ * According to UEFI boot log for the VLI device on Pi 4.
+ */
+#define RT_REG_LENGTH                 0x1000
+
+DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4PCIE", 2)
+{
+  Scope (\_SB_)
+  {
+
+    Device (SCB0) {
+      Name (_HID, "ACPI0004")
+      Name (_UID, 0x1)
+      Name (_CCA, 0x0)
+
+      Method (_CRS, 0, Serialized) {
+        // Container devices with _DMA must have _CRS, 
+        // meaning SCB0 to provide all resources that
+        // PCI0 consumes (except interrupts).
+        Name (RBUF, ResourceTemplate () {
+            QWordMemory (ResourceProducer,
+                ,
+                MinFixed,
+                MaxFixed,
+                NonCacheable,
+                ReadWrite,
+                0x0,
+                SANITIZED_PCIE_CPU_MMIO_WINDOW, // MIN
+                SANITIZED_PCIE_CPU_MMIO_WINDOW, // MAX
+                0x0,
+                0x1,                            // LEN
+                ,
+                ,
+                MMIO
+                )
+        })
+        CreateQwordField (RBUF, MMIO._MAX, MMBE)
+        CreateQwordField (RBUF, MMIO._LEN, MMLE)
+        Add (MMBE, RT_REG_LENGTH - 1, MMBE)
+        Add (MMLE, RT_REG_LENGTH - 1, MMLE)
+        Return (RBUF)
+      }
+
+      Name (_DMA, ResourceTemplate() {
+        // PCIe can only DMA to first 3GB with early SOC's
+        // But we keep the restriction on the later ones
+        // To avoid DMA translation problems.
+        QWordMemory (ResourceProducer,
+            ,
+            MinFixed,
+            MaxFixed,
+            NonCacheable,
+            ReadWrite,
+            0x0,
+            0x0,        // MIN
+            0xbfffffff, // MAX
+            0x0,        // TRA
+            0xc0000000, // LEN
+            ,
+            ,
+            )
+      })
+
+
+      Device(PCI0)
+      {
+        Name(_HID, EISAID("PNP0A08")) // PCI Express Root Bridge
+        Name(_CID, EISAID("PNP0A03")) // Compatible PCI Root Bridge
+        Name(_SEG, Zero) // PCI Segment Group number
+        Name(_BBN, Zero) // PCI Base Bus Number
+        Name(_CCA, 0)    // Mark the PCI noncoherent
+
+        // Root Complex 0
+        Device (RP0) {
+         Name(_ADR, 0xF0000000)    // Dev 0, Func 0
+        }
+
+        Name (_DMA, ResourceTemplate() {
+          QWordMemory (ResourceConsumer,
+            ,
+            MinFixed,
+            MaxFixed,
+            NonCacheable,
+            ReadWrite,
+            0x0,
+            0x0,        // MIN
+            0xbfffffff, // MAX
+            0x0,        // TRA
+            0xc0000000, // LEN
+            ,
+            ,
+            )
+        })
+
+        // PCI Routing Table
+        Name(_PRT, Package() {
+          Package (4) { 0x0000FFFF, 0, zero, 175 },
+          Package (4) { 0x0000FFFF, 1, zero, 176 },
+          Package (4) { 0x0000FFFF, 2, zero, 177 },
+          Package (4) { 0x0000FFFF, 3, zero, 178 }
+        })
+
+        // Root complex resources
+        Method (_CRS, 0, Serialized) {
+          Name (RBUF, ResourceTemplate () {
+            WordBusNumber ( // Bus numbers assigned to this root
+              ResourceProducer,
+              MinFixed, MaxFixed, PosDecode,
+              0,   // AddressGranularity
+              0,   // AddressMinimum - Minimum Bus Number
+              255, // AddressMaximum - Maximum Bus Number
+              0,   // AddressTranslation - Set to 0
+              256  // RangeLength - Number of Busses
+            )
+
+            QWordMemory ( // 32-bit BAR Windows in 64-bit addr
+              ResourceProducer, PosDecode,
+              MinFixed, MaxFixed,
+              NonCacheable, ReadWrite,        //cacheable? is that right?
+              0x00000000,                     // Granularity
+              0,                              // SANITIZED_PCIE_PCI_MMIO_BEGIN
+              1,                              // SANITIZED_PCIE_MMIO_LEN + SANITIZED_PCIE_PCI_MMIO_BEGIN
+              SANITIZED_PCIE_CPU_MMIO_WINDOW, // SANITIZED_PCIE_PCI_MMIO_BEGIN - SANITIZED_PCIE_CPU_MMIO_WINDOW
+              2                               // SANITIZED_PCIE_MMIO_LEN + 1
+              ,,,MMI1,,TypeTranslation
+            )
+          }) // end Name(RBUF)
+
+          // Work around ASL's inability to add in a resource definition
+          // or for that matter compute the min,max,len properly
+          CreateQwordField (RBUF, MMI1._MIN, MMIB)
+          CreateQwordField (RBUF, MMI1._MAX, MMIE)
+          CreateQwordField (RBUF, MMI1._TRA, MMIT)
+          CreateQwordField (RBUF, MMI1._LEN, MMIL)
+          Add (MMIB, SANITIZED_PCIE_PCI_MMIO_BEGIN, MMIB)
+          Add (SANITIZED_PCIE_MMIO_LEN, SANITIZED_PCIE_PCI_MMIO_BEGIN, MMIE)
+          Subtract (MMIT, SANITIZED_PCIE_PCI_MMIO_BEGIN, MMIT)
+          Add (SANITIZED_PCIE_MMIO_LEN, 1 , MMIL)
+
+          Return (RBUF)
+        } // end Method(_CRS)
+        //
+        // OS Control Handoff
+        //
+        Name(SUPP, Zero) // PCI _OSC Support Field value
+        Name(CTRL, Zero) // PCI _OSC Control Field value
+
+        // See [1] 6.2.10, [2] 4.5
+        Method(_OSC,4) {
+          // Note, This code is very similar to the code in the PCIe firmware
+          // specification which can be used as a reference
+          // Check for proper UUID
+          If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
+            // Create DWord-adressable fields from the Capabilities Buffer
+            CreateDWordField(Arg3,0,CDW1)
+            CreateDWordField(Arg3,4,CDW2)
+            CreateDWordField(Arg3,8,CDW3)
+            // Save Capabilities DWord2 & 3
+            Store(CDW2,SUPP)
+            Store(CDW3,CTRL)
+            // Mask out Native HotPlug
+            And(CTRL,0x1E,CTRL)
+            // Always allow native PME, AER (no dependencies)
+            // Never allow SHPC (no SHPC controller in this system)
+            And(CTRL,0x1D,CTRL)
+
+            If(LNotEqual(Arg1,One)) { // Unknown revision
+              Or(CDW1,0x08,CDW1)
+            }
+
+            If(LNotEqual(CDW3,CTRL)) {  // Capabilities bits were masked
+              Or(CDW1,0x10,CDW1)
+            }
+            // Update DWORD3 in the buffer
+            Store(CTRL,CDW3)
+            Return(Arg3)
+          } Else {
+            Or(CDW1,4,CDW1) // Unrecognized UUID
+            Return(Arg3)
+          }
+        } // End _OSC
+      } // PCI0
+    } //end SCB0
+  } //end scope sb
+} //end definition block
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 7c5786303d..4c40820858 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -821,6 +821,12 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] = {
     PcdToken(PcdXhciPci),
     NULL
   },
+  {
+    SIGNATURE_64 ('R', 'P', 'I', '4', 'P', 'C', 'I', 'E'),
+    PcdToken(PcdXhciPci),
+    0,
+    NULL
+  },
 #endif
   { // DSDT
     SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0),
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/6] Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction
  2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
                   ` (2 preceding siblings ...)
  2021-08-10  3:36 ` [PATCH v2 3/6] Platform/RaspberryPi: Add PCIe SSDT Jeremy Linton
@ 2021-08-10  3:36 ` Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 5/6] Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor Jeremy Linton
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-10  3:36 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton, René Treffer

The CM4 has an actual PCIe slot, so the device filtering
need to be a little less restrictive WRT busses with more
than 1 device given that switches can now appear in the
topology. Since it is possible to start numbering the
busses with a non-zero value, the bus restriction should
be based on the secondary side of the root port. This
isn't likely but its better than hard-coding the limit.

Suggested-by: René Treffer <treffer+groups.io@measite.de>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c    | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
index 44ce3b4b99..6d15e82fa2 100644
--- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
+++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
@@ -19,6 +19,7 @@
 #include <Library/PciSegmentLib.h>
 #include <Library/UefiLib.h>
 #include <IndustryStandard/Bcm2711.h>
+#include <IndustryStandard/Pci30.h>
 
 typedef enum {
   PciCfgWidthUint8 = 0,
@@ -78,6 +79,9 @@ PciSegmentLibGetConfigBase (
   UINT64        Base;
   UINT64        Offset;
   UINT32        Dev;
+  UINT32        Bus;
+  UINT32        Data;
+  UINT32        HostPortSec;
 
   Base = PCIE_REG_BASE;
   Offset = Address & 0xFFF;         /* Pick off the 4k register offset */
@@ -89,17 +93,20 @@ PciSegmentLibGetConfigBase (
     Base += PCIE_EXT_CFG_DATA;
     if (mPciSegmentLastAccess != Address) {
       Dev = EFI_PCI_ADDR_DEV (Address);
+      Bus = EFI_PCI_ADDR_BUS (Address);
+      HostPortSec = MmioRead8 (PCIE_REG_BASE +
+                               PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET);
+
       /*
-       * Scan things out directly rather than translating the "bus" to a device, etc..
-       * only we need to limit each bus to a single device.
+       * There can only be a single device on bus 1 (downstream of root).
+       * Subsequent busses (behind a PCIe switch) can have more.
        */
-      if (Dev < 1) {
-          MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address);
-          mPciSegmentLastAccess = Address;
-      } else {
-          mPciSegmentLastAccess = 0;
+      if (Dev > 0 && (Bus <= HostPortSec)) {
           return 0xFFFFFFFF;
       }
+
+      MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address);
+      mPciSegmentLastAccess = Address;
     }
   }
   return Base + Offset;
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 5/6] Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor
  2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
                   ` (3 preceding siblings ...)
  2021-08-10  3:36 ` [PATCH v2 4/6] Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction Jeremy Linton
@ 2021-08-10  3:36 ` Jeremy Linton
  2021-08-10  3:36 ` [PATCH v2 6/6] Platform/RaspberryPi: Enable NVMe boot on CM4 Jeremy Linton
  2021-08-17 15:09 ` [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Ard Biesheuvel
  6 siblings, 0 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-10  3:36 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton

The existing code fails to create/finish configuring the
pcie subsystem if it fails to get a linkup. This is reasonable
on the RPi4 because it generally won't happen, and the OS
could not see the root port. Now that the OS can see the
root port, its a bit odd if it only shows up when
something is plugged into the first slot. Lets move the
link up check into the config accessor where it will be used
to restrict sending CFG TLP's out the port when nothing is
plugged in. Thus avoiding a SERROR during probe.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 .../Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c   | 5 -----
 .../Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c  | 7 +++++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c
index 8587d2d36d..4d4c584726 100644
--- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c
+++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLibConstructor.c
@@ -204,11 +204,6 @@ Bcm2711PciHostBridgeLibConstructor (
   } while (((Data & 0x30) != 0x030) && (Timeout));
   DEBUG ((DEBUG_VERBOSE, "PCIe link ready (status=%x) Timeout=%d\n", Data, Timeout));
 
-  if ((Data & 0x30) != 0x30) {
-    DEBUG ((DEBUG_ERROR, "PCIe link not ready (status=%x)\n", Data));
-    return EFI_DEVICE_ERROR;
-  }
-
   if ((Data & 0x80) != 0x80) {
     DEBUG ((DEBUG_ERROR, "PCIe link not in RC mode (status=%x)\n", Data));
     return EFI_UNSUPPORTED;
diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
index 6d15e82fa2..b627e5730b 100644
--- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
+++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
@@ -105,6 +105,13 @@ PciSegmentLibGetConfigBase (
           return 0xFFFFFFFF;
       }
 
+      /* Don't probe slots if the link is down */
+      Data = MmioRead32 (PCIE_REG_BASE + PCIE_MISC_PCIE_STATUS);
+      if ((Data & 0x30) != 0x30) {
+          DEBUG ((DEBUG_ERROR, "PCIe link not ready (status=%x)\n", Data));
+          return 0xFFFFFFFF;
+      }
+
       MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address);
       mPciSegmentLastAccess = Address;
     }
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 6/6] Platform/RaspberryPi: Enable NVMe boot on CM4
  2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
                   ` (4 preceding siblings ...)
  2021-08-10  3:36 ` [PATCH v2 5/6] Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor Jeremy Linton
@ 2021-08-10  3:36 ` Jeremy Linton
  2021-08-17 15:09 ` [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Ard Biesheuvel
  6 siblings, 0 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-10  3:36 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton

The CM4 has a number of carrier boards with PCIe
slots. With the PCIe changes in place its quite
possible to utilize a NVMe root device. Lets allow
people to boot from it.

Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/RPi4/RPi4.dsc | 5 +++++
 Platform/RaspberryPi/RPi4/RPi4.fdf | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index babcbb2f41..25c29a0fbf 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -754,6 +754,11 @@
   }
 
   #
+  # NVMe boot devices
+  #
+  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
+
+  #
   # UEFI application (Shell Embedded Boot Loader)
   #
   ShellPkg/Application/Shell/Shell.inf {
diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4/RPi4.fdf
index 3534cd3dc3..0c782d2f35 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.fdf
+++ b/Platform/RaspberryPi/RPi4/RPi4.fdf
@@ -283,6 +283,11 @@ READ_LOCK_STATUS   = TRUE
   INF EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf
 
   #
+  # NVMe boot devices
+  #
+  INF MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
+
+  #
   # SCSI Bus and Disk Driver
   #
   INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit
  2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
                   ` (5 preceding siblings ...)
  2021-08-10  3:36 ` [PATCH v2 6/6] Platform/RaspberryPi: Enable NVMe boot on CM4 Jeremy Linton
@ 2021-08-17 15:09 ` Ard Biesheuvel
  2021-08-19 23:35   ` Jeremy Linton
  6 siblings, 1 reply; 9+ messages in thread
From: Ard Biesheuvel @ 2021-08-17 15:09 UTC (permalink / raw)
  To: Jeremy Linton
  Cc: edk2-devel-groups-io, Peter Batard, Ard Biesheuvel,
	Andrei Warkentin, Sunny Wang, Samer El-Haj-Mahmoud

On Tue, 10 Aug 2021 at 05:36, Jeremy Linton <jeremy.linton@arm.com> wrote:
>
> A new Arm standard DEN0115A specifies how
> platforms that don't have standard ECAM can
> use the firmware to handle config read/write
> operations. This is mostly implemented in TFA
> but UEFI needs to assure that there is a
> description of the root complex in the ACPI
> namespace.
>
> This set adds that description based on
> a new menu item which toggles between XHCI
> platform description and PCIe via a BDS
> menu selection on the RPi4. The CM4 is really
> the platform that needs this as it has a PCIe
> slot. On that platform PCIe is enabled by default.
>
> v1->v2:
>     Use global shared interrupts in PCI PRT
>         which is a pretty significant
>         simplification.
>     Modify bus max to use the secondary side
>         of the root port for enforcing device
>         limits
>     Various other AML cleanups per Ard (drop
>         redundant _DMA, bump UID to make it
>         unique, etc)

I still see a _DMA method on the PCIE node, and the UID you chose is
already used elsewhere.

>     Break link status move into its own patch
>     MADT->MCFG typos in various comments
>     Commit message tweaking
>
> Jeremy Linton (6):
>   Platform/RaspberryPi: Add XHCI/PCI selection menu
>   Platform/RaspberryPi: Break XHCI into its own SSDT
>   Platform/RaspberryPi: Add PCIe SSDT
>   Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction
>   Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor
>   Platform/RaspberryPi: Enable NVMe boot on CM4
>
>  Platform/RaspberryPi/AcpiTables/AcpiTables.inf     |   4 +
>  Platform/RaspberryPi/AcpiTables/Dsdt.asl           |   3 -
>  Platform/RaspberryPi/AcpiTables/Pci.asl            | 209 +++++++++++++++++++++
>  Platform/RaspberryPi/AcpiTables/Xhci.asl           |  35 ++--
>  Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  56 ++++++
>  .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf    |   1 +
>  .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |   5 +
>  .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr |  17 ++
>  Platform/RaspberryPi/Include/ConfigVars.h          |   4 +
>  Platform/RaspberryPi/RPi3/RPi3.dsc                 |   6 +
>  Platform/RaspberryPi/RPi4/RPi4.dsc                 |  13 ++
>  Platform/RaspberryPi/RPi4/RPi4.fdf                 |   5 +
>  Platform/RaspberryPi/RaspberryPi.dec               |   1 +
>  .../Bcm2711PciHostBridgeLibConstructor.c           |   5 -
>  .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c   |  28 ++-
>  15 files changed, 364 insertions(+), 28 deletions(-)
>  create mode 100644 Platform/RaspberryPi/AcpiTables/Pci.asl
>
> --
> 2.13.7
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit
  2021-08-17 15:09 ` [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Ard Biesheuvel
@ 2021-08-19 23:35   ` Jeremy Linton
  0 siblings, 0 replies; 9+ messages in thread
From: Jeremy Linton @ 2021-08-19 23:35 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: edk2-devel-groups-io, Peter Batard, Ard Biesheuvel,
	Andrei Warkentin, Sunny Wang, Samer El-Haj-Mahmoud

Hi,

On 8/17/21 10:09 AM, Ard Biesheuvel wrote:
> On Tue, 10 Aug 2021 at 05:36, Jeremy Linton <jeremy.linton@arm.com> wrote:
>>
>> A new Arm standard DEN0115A specifies how
>> platforms that don't have standard ECAM can
>> use the firmware to handle config read/write
>> operations. This is mostly implemented in TFA
>> but UEFI needs to assure that there is a
>> description of the root complex in the ACPI
>> namespace.
>>
>> This set adds that description based on
>> a new menu item which toggles between XHCI
>> platform description and PCIe via a BDS
>> menu selection on the RPi4. The CM4 is really
>> the platform that needs this as it has a PCIe
>> slot. On that platform PCIe is enabled by default.
>>
>> v1->v2:
>>      Use global shared interrupts in PCI PRT
>>          which is a pretty significant
>>          simplification.
>>      Modify bus max to use the secondary side
>>          of the root port for enforcing device
>>          limits
>>      Various other AML cleanups per Ard (drop
>>          redundant _DMA, bump UID to make it
>>          unique, etc)
> 
> I still see a _DMA method on the PCIE node, and the UID you chose is
> already used elsewhere.

Yah, thanks for keeping me honest here, I'm not really sure what 
happened with the _UID, but I would have probably killed windows again. 
<sigh>

OTOH, picking off the pcie bridge specific _DMA causes, failures, which 
don't really make sense either, except that the ACPI spec explicitly 
notes the case of a PCIe bridge with a DMA constrain needs to have it 
defined on the device responsible for the translation/limitation.

In the end really, the container is unnecessarily, so removing it solves 
both the problem of all these duplicate containers as well as the 
duplicate DMA producer.

I will repost RSN.

> 
>>      Break link status move into its own patch
>>      MADT->MCFG typos in various comments
>>      Commit message tweaking
>>
>> Jeremy Linton (6):
>>    Platform/RaspberryPi: Add XHCI/PCI selection menu
>>    Platform/RaspberryPi: Break XHCI into its own SSDT
>>    Platform/RaspberryPi: Add PCIe SSDT
>>    Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction
>>    Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor
>>    Platform/RaspberryPi: Enable NVMe boot on CM4
>>
>>   Platform/RaspberryPi/AcpiTables/AcpiTables.inf     |   4 +
>>   Platform/RaspberryPi/AcpiTables/Dsdt.asl           |   3 -
>>   Platform/RaspberryPi/AcpiTables/Pci.asl            | 209 +++++++++++++++++++++
>>   Platform/RaspberryPi/AcpiTables/Xhci.asl           |  35 ++--
>>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  56 ++++++
>>   .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf    |   1 +
>>   .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |   5 +
>>   .../RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr |  17 ++
>>   Platform/RaspberryPi/Include/ConfigVars.h          |   4 +
>>   Platform/RaspberryPi/RPi3/RPi3.dsc                 |   6 +
>>   Platform/RaspberryPi/RPi4/RPi4.dsc                 |  13 ++
>>   Platform/RaspberryPi/RPi4/RPi4.fdf                 |   5 +
>>   Platform/RaspberryPi/RaspberryPi.dec               |   1 +
>>   .../Bcm2711PciHostBridgeLibConstructor.c           |   5 -
>>   .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c   |  28 ++-
>>   15 files changed, 364 insertions(+), 28 deletions(-)
>>   create mode 100644 Platform/RaspberryPi/AcpiTables/Pci.asl
>>
>> --
>> 2.13.7
>>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-19 23:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-10  3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
2021-08-10  3:36 ` [PATCH v2 1/6] Platform/RaspberryPi: Add XHCI/PCI selection menu Jeremy Linton
2021-08-10  3:36 ` [PATCH v2 2/6] Platform/RaspberryPi: Break XHCI into its own SSDT Jeremy Linton
2021-08-10  3:36 ` [PATCH v2 3/6] Platform/RaspberryPi: Add PCIe SSDT Jeremy Linton
2021-08-10  3:36 ` [PATCH v2 4/6] Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction Jeremy Linton
2021-08-10  3:36 ` [PATCH v2 5/6] Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor Jeremy Linton
2021-08-10  3:36 ` [PATCH v2 6/6] Platform/RaspberryPi: Enable NVMe boot on CM4 Jeremy Linton
2021-08-17 15:09 ` [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Ard Biesheuvel
2021-08-19 23:35   ` Jeremy Linton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox