public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "PierreGondois via groups.io" <pierre.gondois=arm.com@groups.io>
To: yodagump@google.com, devel@edk2.groups.io
Subject: Re: [edk2-devel] ACPI table generator unit test
Date: Tue, 15 Apr 2025 17:30:51 +0200	[thread overview]
Message-ID: <093b6132-098d-4a97-9a14-21458deec2d1@arm.com> (raw)
In-Reply-To: <2395.1744303612205599529@groups.io>

Hello Sophia

On 4/10/25 18:46, Sophia Wang via Groups.Io wrote:
> Hi Pierre,
> RegisterAcpiTableGenerator() never get called in Dbg2GeneratorGoogleTest.cpp
> In addition, in order to get the generator by calling RegisterAcpiTableGenerator() -> then call the BuildAcpiTableEx() callback, we need to define Dbg2Generator as non-static, however, in current upstream code, Dbg2Generator is defined as STATIC, please see the code below.
> *STATIC*
> CONST
> ACPI_TABLE_GENERATOR  Dbg2Generator = {
>    // Generator ID
>    CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2),
>    // Generator Description
>    L"ACPI.STD.DBG2.GENERATOR",
>    // ACPI Table Signature
>    EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE,
>    // ACPI Table Revision supported by this Generator
>    EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
>    // Minimum supported ACPI Table Revision
>    EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
>    // Creator ID
>    TABLE_GENERATOR_CREATOR_ID,
>    // Creator Revision
>    DBG2_GENERATOR_REVISION,
>    // Build table function. Use the extended version instead.
>    NULL,
>    // Free table function. Use the extended version instead.
>    NULL,
>    // Extended Build table function.
>    BuildDbg2TableEx,
>    // Extended free function.
>    FreeDbg2TableEx
> };
> I doubt Dbg2GeneratorGoogleTest.cpp really tests the BuildAcpiTableEx() callback, please correct me if I am wrong.

When modifying the test file, the test fails, so I assume the Generator is registered
--- a/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/GoogleTest/Dbg2GeneratorGoogleTest.cpp
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/GoogleTest/Dbg2GeneratorGoogleTest.cpp
@@ -577,7 +577,7 @@ protected:
      for (UINT32 i = 0; i < config.DeviceCount; i++) {
        CM_ARCH_COMMON_DBG2_DEVICE_INFO  device = { 0 };
        device.AddressResourceToken = mDevices.size () + 1;
-      device.PortType             = EFI_ACPI_DBG2_PORT_TYPE_NET;
+      device.PortType             = 999;
        device.PortSubtype          = 0;
        device.AccessSize           = EFI_ACPI_6_3_DWORD;
        CopyMem (device.ObjectName, "DBG2", sizeof (device.ObjectName) - 1);


and I think you can see the results in Build/CI_BUILDLOG.txt or Build/DynamicTablesPkg/BUILDLOG_DynamicTablesPkg.txt:

"""
INFO - [----------] 6 tests from Dbg2GeneratorAdversarialTest
INFO - [ RUN      ] Dbg2GeneratorAdversarialTest.InvalidMemoryRangeBaseAddress
INFO - DBG2: Register Generator. Status = Success
INFO - INFO: GetEArchCommonObjSerialDebugPortInfo: Platform does not implement EArchCommonObjSerialDebugPortInfo. Status = Not Found
INFO - ERROR: DBG2: Memory range base address is 0. Index = 0
INFO - ERROR: DBG2: Failed to populate device 0. Status = Invalid Parameter
INFO - DBG2: Deregister Generator. Status = Success
INFO - [       OK ] Dbg2GeneratorAdversarialTest.InvalidMemoryRangeBaseAddress (0 ms)
INFO - [ RUN      ] Dbg2GeneratorAdversarialTest.MemoryRangeTooLarge
INFO - DBG2: Register Generator. Status = Success
INFO - INFO: GetEArchCommonObjSerialDebugPortInfo: Platform does not implement EArchCommonObjSerialDebugPortInfo. Status = Not Found
INFO - ERROR: DBG2: Memory range length too large. Length = 0
INFO - ERROR: DBG2: Failed to populate device 0. Status = Invalid Parameter
INFO - DBG2: Deregister Generator. Status = Success
"""


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121258): https://edk2.groups.io/g/devel/message/121258
Mute This Topic: https://groups.io/mt/111930977/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      reply	other threads:[~2025-04-15 15:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20 22:56 [edk2-devel] ACPI table generator unit test yodagump via groups.io
2025-03-27 13:36 ` Sami Mujawar via groups.io
2025-03-27 16:55   ` Sophia Wang via groups.io
2025-04-02 16:47     ` Paul Fagerburg via groups.io
2025-04-09 19:17       ` Sophia Wang via groups.io
2025-04-10  6:58         ` Ard Biesheuvel via groups.io
2025-04-10  9:19           ` PierreGondois via groups.io
2025-04-10 16:46             ` Sophia Wang via groups.io
2025-04-15 15:30               ` PierreGondois via groups.io [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=093b6132-098d-4a97-9a14-21458deec2d1@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox