[edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present

Marcin Juszkiewicz posted 4 patches 2 years, 3 months ago
There is a newer version of this series
[edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Marcin Juszkiewicz 2 years, 3 months ago
We need platform version to be at least 0.3 to have XHCI
in virtual hardware. On older platforms there is non-working
EHCI which we ignore.

Set DSDT node to be disabled so operating system will not try
to initialize not-existing hardware.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf      |  4 ++
 .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c        | 66 +++++++++++++++++++-
 Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl            |  3 +-
 3 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
index 7c7e08e0fd3a..d5ded892d6ea 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
@@ -29,6 +29,7 @@ [Packages]
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
+  AcpiLib
   ArmLib
   BaseMemoryLib
   BaseLib
@@ -50,6 +51,8 @@ [Pcd]
   gArmTokenSpaceGuid.PcdGicRedistributorsBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdGicItsBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSmmuBase
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
 
 [Depex]
   gEfiAcpiTableProtocolGuid                       ## CONSUMES
@@ -59,6 +62,7 @@ [Guids]
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                       ## CONSUMES
+  gEfiAcpiSdtProtocolGuid
 
 [FixedPcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
index fd849ca1594b..4d8a57d5a8e4 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
@@ -10,6 +10,7 @@
 #include <IndustryStandard/AcpiAml.h>
 #include <IndustryStandard/IoRemappingTable.h>
 #include <IndustryStandard/SbsaQemuAcpi.h>
+#include <IndustryStandard/SbsaQemuPlatformVersion.h>
 #include <Library/AcpiLib.h>
 #include <Library/ArmLib.h>
 #include <Library/BaseMemoryLib.h>
@@ -682,6 +683,69 @@ AddGtdtTable (
   return Status;
 }
 
+EFI_STATUS
+DisableXhciOnOlderPlatVer (
+  VOID
+  )
+{
+  EFI_STATUS            Status;
+  EFI_ACPI_SDT_PROTOCOL                       *AcpiSdtProtocol;
+  EFI_ACPI_DESCRIPTION_HEADER                 *Table;
+  UINTN                                       TableKey;
+  UINTN                                       TableIndex;
+  EFI_ACPI_HANDLE                             TableHandle;
+
+  Status = EFI_SUCCESS;
+
+  if ( PLATFORM_VERSION_LESS_THAN(0, 3) ) {
+    DEBUG ((DEBUG_ERROR, "Platform Version < 0.3 - disabling XHCI\n"));
+    Status = gBS->LocateProtocol (
+                    &gEfiAcpiSdtProtocolGuid,
+                    NULL,
+                    (VOID **)&AcpiSdtProtocol
+                    );
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n"));
+      return Status;
+    }
+
+    TableIndex = 0;
+    Status = AcpiLocateTableBySignature (
+               AcpiSdtProtocol,
+               EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+               &TableIndex,
+               &Table,
+               &TableKey
+               );
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "ACPI DSDT table not found!\n"));
+      ASSERT_EFI_ERROR (Status);
+      return Status;
+    }
+
+    Status = AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle);
+    if (EFI_ERROR (Status)) {
+      ASSERT_EFI_ERROR (Status);
+      AcpiSdtProtocol->Close (TableHandle);
+      return Status;
+    }
+
+    Status = AcpiAmlObjectUpdateInteger (AcpiSdtProtocol, TableHandle, "\\_SB.USB0.XHCI", 0x0);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Failed to disable XHCI!\n"));
+      ASSERT_EFI_ERROR (Status);
+      AcpiSdtProtocol->Close (TableHandle);
+      return Status;
+    }
+
+    AcpiSdtProtocol->Close (TableHandle);
+    AcpiUpdateChecksum ((UINT8 *)Table, Table->Length);
+  }
+
+  return Status;
+}
+
+
 EFI_STATUS
 EFIAPI
 InitializeSbsaQemuAcpiDxe (
@@ -738,5 +802,5 @@ InitializeSbsaQemuAcpiDxe (
     DEBUG ((DEBUG_ERROR, "Failed to add GTDT table\n"));
   }
 
-  return EFI_SUCCESS;
+  return DisableXhciOnOlderPlatVer ();
 }
diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
index 543b5782580a..ba3eefc975a5 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
@@ -73,8 +73,9 @@ DefinitionBlock ("DsdtTable.aml", "DSDT",
         Name (_HID, "PNP0D10")      // _HID: Hardware ID
         Name (_UID, 0x00)            // _UID: Unique ID
         Name (_CCA, 0x01)            // _CCA: Cache Coherency Attribute
+        Name (XHCI, 0xF)            // will be set using AcpiLib
         Method (_STA) {
-          Return (0xF)
+          Return (XHCI)
         }
         Method (_CRS, 0x0, Serialized) {
             Name (RBUF, ResourceTemplate() {

-- 
2.41.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109723): https://edk2.groups.io/g/devel/message/109723
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Nhi Pham via groups.io 2 years, 3 months ago
Acked-by: Nhi Pham <nhi@os.amperecomputing.com>

Nit: I think you want to run uncrustify for Patch 3 as well :)

Regards,
Nhi

On 10/18/2023 5:07 PM, Marcin Juszkiewicz wrote:
> We need platform version to be at least 0.3 to have XHCI
> in virtual hardware. On older platforms there is non-working
> EHCI which we ignore.
> 
> Set DSDT node to be disabled so operating system will not try
> to initialize not-existing hardware.
> 
> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> ---
>   .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf      |  4 ++
>   .../Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c        | 66 +++++++++++++++++++-
>   Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl            |  3 +-
>   3 files changed, 71 insertions(+), 2 deletions(-)
> 
> diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
> index 7c7e08e0fd3a..d5ded892d6ea 100644
> --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.inf
> @@ -29,6 +29,7 @@ [Packages]
>     Silicon/Qemu/SbsaQemu/SbsaQemu.dec
>   
>   [LibraryClasses]
> +  AcpiLib
>     ArmLib
>     BaseMemoryLib
>     BaseLib
> @@ -50,6 +51,8 @@ [Pcd]
>     gArmTokenSpaceGuid.PcdGicRedistributorsBase
>     gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdGicItsBase
>     gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSmmuBase
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
>   
>   [Depex]
>     gEfiAcpiTableProtocolGuid                       ## CONSUMES
> @@ -59,6 +62,7 @@ [Guids]
>   
>   [Protocols]
>     gEfiAcpiTableProtocolGuid                       ## CONSUMES
> +  gEfiAcpiSdtProtocolGuid
>   
>   [FixedPcd]
>     gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
> diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
> index fd849ca1594b..4d8a57d5a8e4 100644
> --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c
> @@ -10,6 +10,7 @@
>   #include <IndustryStandard/AcpiAml.h>
>   #include <IndustryStandard/IoRemappingTable.h>
>   #include <IndustryStandard/SbsaQemuAcpi.h>
> +#include <IndustryStandard/SbsaQemuPlatformVersion.h>
>   #include <Library/AcpiLib.h>
>   #include <Library/ArmLib.h>
>   #include <Library/BaseMemoryLib.h>
> @@ -682,6 +683,69 @@ AddGtdtTable (
>     return Status;
>   }
>   
> +EFI_STATUS
> +DisableXhciOnOlderPlatVer (
> +  VOID
> +  )
> +{
> +  EFI_STATUS            Status;
> +  EFI_ACPI_SDT_PROTOCOL                       *AcpiSdtProtocol;
> +  EFI_ACPI_DESCRIPTION_HEADER                 *Table;
> +  UINTN                                       TableKey;
> +  UINTN                                       TableIndex;
> +  EFI_ACPI_HANDLE                             TableHandle;
> +
> +  Status = EFI_SUCCESS;
> +
> +  if ( PLATFORM_VERSION_LESS_THAN(0, 3) ) {
> +    DEBUG ((DEBUG_ERROR, "Platform Version < 0.3 - disabling XHCI\n"));
> +    Status = gBS->LocateProtocol (
> +                    &gEfiAcpiSdtProtocolGuid,
> +                    NULL,
> +                    (VOID **)&AcpiSdtProtocol
> +                    );
> +    if (EFI_ERROR (Status)) {
> +      DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n"));
> +      return Status;
> +    }
> +
> +    TableIndex = 0;
> +    Status = AcpiLocateTableBySignature (
> +               AcpiSdtProtocol,
> +               EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
> +               &TableIndex,
> +               &Table,
> +               &TableKey
> +               );
> +    if (EFI_ERROR (Status)) {
> +      DEBUG ((DEBUG_ERROR, "ACPI DSDT table not found!\n"));
> +      ASSERT_EFI_ERROR (Status);
> +      return Status;
> +    }
> +
> +    Status = AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle);
> +    if (EFI_ERROR (Status)) {
> +      ASSERT_EFI_ERROR (Status);
> +      AcpiSdtProtocol->Close (TableHandle);
> +      return Status;
> +    }
> +
> +    Status = AcpiAmlObjectUpdateInteger (AcpiSdtProtocol, TableHandle, "\\_SB.USB0.XHCI", 0x0);
> +    if (EFI_ERROR (Status)) {
> +      DEBUG ((DEBUG_ERROR, "Failed to disable XHCI!\n"));
> +      ASSERT_EFI_ERROR (Status);
> +      AcpiSdtProtocol->Close (TableHandle);
> +      return Status;
> +    }
> +
> +    AcpiSdtProtocol->Close (TableHandle);
> +    AcpiUpdateChecksum ((UINT8 *)Table, Table->Length);
> +  }
> +
> +  return Status;
> +}
> +
> +
>   EFI_STATUS
>   EFIAPI
>   InitializeSbsaQemuAcpiDxe (
> @@ -738,5 +802,5 @@ InitializeSbsaQemuAcpiDxe (
>       DEBUG ((DEBUG_ERROR, "Failed to add GTDT table\n"));
>     }
>   
> -  return EFI_SUCCESS;
> +  return DisableXhciOnOlderPlatVer ();
>   }
> diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
> index 543b5782580a..ba3eefc975a5 100644
> --- a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
> +++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
> @@ -73,8 +73,9 @@ DefinitionBlock ("DsdtTable.aml", "DSDT",
>           Name (_HID, "PNP0D10")      // _HID: Hardware ID
>           Name (_UID, 0x00)            // _UID: Unique ID
>           Name (_CCA, 0x01)            // _CCA: Cache Coherency Attribute
> +        Name (XHCI, 0xF)            // will be set using AcpiLib
>           Method (_STA) {
> -          Return (0xF)
> +          Return (XHCI)
>           }
>           Method (_CRS, 0x0, Serialized) {
>               Name (RBUF, ResourceTemplate() {
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109726): https://edk2.groups.io/g/devel/message/109726
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Marcin Juszkiewicz 2 years, 3 months ago
W dniu 18.10.2023 o 12:32, Nhi Pham pisze:
> Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
> 
> Nit: I think you want to run uncrustify for Patch 3 as well :)

Done, will check other changes too.

I have a strong feeling that Qemu part of EDK2 needs a bit
bigger patch when it comes to formatting:

  Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h                 |   7 +-
  Platform/Qemu/QemuOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c            |  33 +-
  Platform/Qemu/QemuOpenBoardPkg/Library/PlatformSecLib/Ia32/SecEntry.nasm          |  99 ++-
  Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c                           | 108 +--
  Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Pcie.c                             |  30 +-
  Platform/Qemu/QemuOpenBoardPkg/README.md                                          |  43 +-
  Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c                                    |  78 +-
  Silicon/Qemu/SbsaQemu/AcpiTables/Dbg2.aslc                                        |  31 +-
  Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl                                         | 808 +++++++++++---------
  Silicon/Qemu/SbsaQemu/AcpiTables/Fadt.aslc                                        |  14 +-
  Silicon/Qemu/SbsaQemu/AcpiTables/Mcfg.aslc                                        |  15 +-
  Silicon/Qemu/SbsaQemu/AcpiTables/Spcr.aslc                                        |  37 +-
  Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c           |  48 +-
  Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuSmbiosDxe/SbsaQemuSmbiosDxe.c               | 112 ++-
  Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuAcpi.h                     |  86 +--
  Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuPlatformVersion.h          |  50 +-
  Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuSmc.h                      |   4 +-
  Silicon/Qemu/SbsaQemu/Include/Library/FdtHelperLib.h                              |   2 +-
  Silicon/Qemu/SbsaQemu/Library/FdtHelperLib/FdtHelperLib.c                         |  37 +-
  Silicon/Qemu/SbsaQemu/Library/SbsaQemuLib/SbsaQemuLib.c                           |  23 +-
  Silicon/Qemu/SbsaQemu/Library/SbsaQemuLib/SbsaQemuMem.c                           |  57 +-
  Silicon/Qemu/SbsaQemu/Library/SbsaQemuNorFlashLib/SbsaQemuNorFlashLib.c           |  14 +-
  Silicon/Qemu/SbsaQemu/Library/SbsaQemuPciHostBridgeLib/SbsaQemuPciHostBridgeLib.c |  76 +-
  23 files changed, 982 insertions(+), 830 deletions(-)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109728): https://edk2.groups.io/g/devel/message/109728
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Pedro Falcato 2 years, 3 months ago
On Wed, Oct 18, 2023 at 12:16 PM Marcin Juszkiewicz
<marcin.juszkiewicz@linaro.org> wrote:
>
> W dniu 18.10.2023 o 12:32, Nhi Pham pisze:
> > Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
> >
> > Nit: I think you want to run uncrustify for Patch 3 as well :)
>
> Done, will check other changes too.
>
> I have a strong feeling that Qemu part of EDK2 needs a bit
> bigger patch when it comes to formatting:
>
>   Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h                 |   7 +-
>   Platform/Qemu/QemuOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c            |  33 +-
>   Platform/Qemu/QemuOpenBoardPkg/Library/PlatformSecLib/Ia32/SecEntry.nasm          |  99 ++-
>   Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c                           | 108 +--
>   Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Pcie.c                             |  30 +-
>   Platform/Qemu/QemuOpenBoardPkg/README.md                                          |  43 +-

Something must be wrong with your config because QemuOpenBoardPkg is
and was, AFAIK, all formatted using uncrustify. And if I run it
locally, it seems to agree with me.

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109730): https://edk2.groups.io/g/devel/message/109730
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Marcin Juszkiewicz 2 years, 3 months ago
W dniu 18.10.2023 o 13:23, Pedro Falcato pisze:
> On Wed, Oct 18, 2023 at 12:16 PM Marcin Juszkiewicz
> <marcin.juszkiewicz@linaro.org> wrote:
>>
>> W dniu 18.10.2023 o 12:32, Nhi Pham pisze:
>>> Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
>>>
>>> Nit: I think you want to run uncrustify for Patch 3 as well :)
>>
>> Done, will check other changes too.
>>
>> I have a strong feeling that Qemu part of EDK2 needs a bit
>> bigger patch when it comes to formatting:
>>
>>    Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h                 |   7 +-
>>    Platform/Qemu/QemuOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c            |  33 +-
>>    Platform/Qemu/QemuOpenBoardPkg/Library/PlatformSecLib/Ia32/SecEntry.nasm          |  99 ++-
>>    Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c                           | 108 +--
>>    Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Pcie.c                             |  30 +-
>>    Platform/Qemu/QemuOpenBoardPkg/README.md                                          |  43 +-
> 
> Something must be wrong with your config because QemuOpenBoardPkg is
> and was, AFAIK, all formatted using uncrustify. And if I run it
> locally, it seems to agree with me.

EDK2 expects some random version of uncrustify.

It is not part of BaseTools so I use upstream version. And it looks like 
they format in different way using the same config file.




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109731): https://edk2.groups.io/g/devel/message/109731
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Laszlo Ersek 2 years, 3 months ago
On 10/18/23 13:28, Marcin Juszkiewicz wrote:
> W dniu 18.10.2023 o 13:23, Pedro Falcato pisze:
>> On Wed, Oct 18, 2023 at 12:16 PM Marcin Juszkiewicz
>> <marcin.juszkiewicz@linaro.org> wrote:
>>>
>>> W dniu 18.10.2023 o 12:32, Nhi Pham pisze:
>>>> Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
>>>>
>>>> Nit: I think you want to run uncrustify for Patch 3 as well :)
>>>
>>> Done, will check other changes too.
>>>
>>> I have a strong feeling that Qemu part of EDK2 needs a bit
>>> bigger patch when it comes to formatting:
>>>
>>>   
>>> Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h                 |   7 +-
>>>   
>>> Platform/Qemu/QemuOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c            |  33 +-
>>>   
>>> Platform/Qemu/QemuOpenBoardPkg/Library/PlatformSecLib/Ia32/SecEntry.nasm          |  99 ++-
>>>   
>>> Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c                           | 108 +--
>>>   
>>> Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Pcie.c                             |  30 +-
>>>   
>>> Platform/Qemu/QemuOpenBoardPkg/README.md                                          |  43 +-
>>
>> Something must be wrong with your config because QemuOpenBoardPkg is
>> and was, AFAIK, all formatted using uncrustify. And if I run it
>> locally, it seems to agree with me.
> 
> EDK2 expects some random version of uncrustify.
> 
> It is not part of BaseTools so I use upstream version. And it looks like
> they format in different way using the same config file.

Project URL (to clone and build):

  https://projectmu@dev.azure.com/projectmu/Uncrustify/_git/Uncrustify

Command line options to pass to the binary:

  -c ${EDK2_ROOT}/.pytool/Plugin/UncrustifyCheck/uncrustify.cfg \
  --replace \
  --no-backup \
  --if-changed \

You can specify the pathnames to reformat as operands, or you can
additionally pass the "-F -" option, and then the pathnames will be read
from stdin.

Make sure you have committed or at least staged your changes, before
running this command, because these options will update the files in-place.

The only really important option is of course the "-c" one.

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109748): https://edk2.groups.io/g/devel/message/109748
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Marcin Juszkiewicz 2 years, 3 months ago
W dniu 18.10.2023 o 15:36, Laszlo Ersek pisze:
>> EDK2 expects some random version of uncrustify.
>>
>> It is not part of BaseTools so I use upstream version. And it looks like
>> they format in different way using the same config file.
> Project URL (to clone and build):
> 
>    https://projectmu@dev.azure.com/projectmu/Uncrustify/_git/Uncrustify
> 
> Command line options to pass to the binary:
> 
>    -c ${EDK2_ROOT}/.pytool/Plugin/UncrustifyCheck/uncrustify.cfg \
>    --replace \
>    --no-backup \
>    --if-changed \
> 
> You can specify the pathnames to reformat as operands, or you can
> additionally pass the "-F -" option, and then the pathnames will be read
> from stdin.
> 
> Make sure you have committed or at least staged your changes, before
> running this command, because these options will update the files in-place.
> 
> The only really important option is of course the "-c" one.

Thanks!


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109755): https://edk2.groups.io/g/devel/message/109755
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH edk2-platforms v4 4/4] SbsaQemu: disable XHCI in DSDT if not present
Posted by Pedro Falcato 2 years, 3 months ago
On Wed, Oct 18, 2023 at 12:28 PM Marcin Juszkiewicz
<marcin.juszkiewicz@linaro.org> wrote:
>
> W dniu 18.10.2023 o 13:23, Pedro Falcato pisze:
> > On Wed, Oct 18, 2023 at 12:16 PM Marcin Juszkiewicz
> > <marcin.juszkiewicz@linaro.org> wrote:
> >>
> >> W dniu 18.10.2023 o 12:32, Nhi Pham pisze:
> >>> Acked-by: Nhi Pham <nhi@os.amperecomputing.com>
> >>>
> >>> Nit: I think you want to run uncrustify for Patch 3 as well :)
> >>
> >> Done, will check other changes too.
> >>
> >> I have a strong feeling that Qemu part of EDK2 needs a bit
> >> bigger patch when it comes to formatting:
> >>
> >>    Platform/Qemu/QemuOpenBoardPkg/Include/Library/QemuOpenFwCfgLib.h                 |   7 +-
> >>    Platform/Qemu/QemuOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c            |  33 +-
> >>    Platform/Qemu/QemuOpenBoardPkg/Library/PlatformSecLib/Ia32/SecEntry.nasm          |  99 ++-
> >>    Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c                           | 108 +--
> >>    Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Pcie.c                             |  30 +-
> >>    Platform/Qemu/QemuOpenBoardPkg/README.md                                          |  43 +-
> >
> > Something must be wrong with your config because QemuOpenBoardPkg is
> > and was, AFAIK, all formatted using uncrustify. And if I run it
> > locally, it seems to agree with me.
>
> EDK2 expects some random version of uncrustify.
>
> It is not part of BaseTools so I use upstream version. And it looks like
> they format in different way using the same config file.

Right. But we used the correct uncrustify version, so things are well
formatted. I don't see the point in formatting with upstream
uncrustify, you're just going to end up misformatting everything.

Whether the current sanctioned solution is any sane at all (it is not)
is another matter, but I seriously have no stamina to discuss these
kinds of changes anymore.


-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109733): https://edk2.groups.io/g/devel/message/109733
Mute This Topic: https://groups.io/mt/102035954/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-