This registers the non-discoverable XHCI for sbsa-ref.

Signed-off-by: Yuquan Wang <wangyuquan1...@phytium.com.cn>
---
 .../SbsaQemuPlatformDxe.inf                   |  2 +
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 41 +++++++++++++++----
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 545794a8c7ff..06700331efea 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -37,6 +37,8 @@ [LibraryClasses]
 [Pcd]
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize
 
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index f6a3e84483fe..969c25ae0e17 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -26,22 +26,23 @@ InitializeSbsaQemuPlatformDxe (
   )
 {
   EFI_STATUS                     Status;
-  UINTN                          Size;
-  VOID*                          Base;
   UINTN                          Arg0;
   UINTN                          Arg1;
   UINTN                          SmcResult;
   RETURN_STATUS                  Result;
+  UINTN                          AhciSize, XhciSize;
+  VOID*                          AhciBase;
+  VOID*                          XhciBase;
 
   DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", 
__FUNCTION__));
 
-  Base = (VOID*)(UINTN)PcdGet64 (PcdPlatformAhciBase);
-  ASSERT (Base != NULL);
-  Size = (UINTN)PcdGet32 (PcdPlatformAhciSize);
-  ASSERT (Size != 0);
+  AhciBase = (VOID*)(UINTN)PcdGet64 (PcdPlatformAhciBase);
+  ASSERT (AhciBase != NULL);
+  AhciSize = (UINTN)PcdGet32 (PcdPlatformAhciSize);
+  ASSERT (AhciSize != 0);
 
   DEBUG ((DEBUG_INFO, "%a: Got platform AHCI %llx %u\n",
-          __FUNCTION__, Base, Size));
+          __FUNCTION__, AhciBase, AhciSize));
 
   Status = RegisterNonDiscoverableMmioDevice (
                    NonDiscoverableDeviceTypeAhci,
@@ -49,11 +50,33 @@ InitializeSbsaQemuPlatformDxe (
                    NULL,
                    NULL,
                    1,
-                   Base, Size);
+                   AhciBase, AhciSize);
 
   if (EFI_ERROR(Status)) {
     DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install AHCI device @%p 
(Staus == %r)\n",
-            __FUNCTION__, Base, Status));
+            __FUNCTION__, AhciBase, Status));
+    return Status;
+  }
+
+  XhciBase = (VOID*)(UINTN)PcdGet64 (PcdPlatformXhciBase);
+  ASSERT (XhciBase != NULL);
+  XhciSize = (UINTN)PcdGet32 (PcdPlatformXhciSize);
+  ASSERT (XhciSize != 0);
+
+  DEBUG ((DEBUG_INFO, "%a: Got platform XHCI %llx %u\n",
+          __FUNCTION__, XhciBase, XhciSize));
+
+  Status = RegisterNonDiscoverableMmioDevice (
+                   NonDiscoverableDeviceTypeXhci,
+                   NonDiscoverableDeviceDmaTypeCoherent,
+                   NULL,
+                   NULL,
+                   1,
+                   XhciBase, XhciSize);
+
+  if (EFI_ERROR(Status)) {
+    DEBUG ((DEBUG_ERROR, "%a: NonDiscoverable: Cannot install XHCI device @%p 
(Staus == %r)\n",
+            __FUNCTION__, XhciBase, Status));
     return Status;
   }
 
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106728): https://edk2.groups.io/g/devel/message/106728
Mute This Topic: https://groups.io/mt/100003411/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to