Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicTablesPkg: Support for generic DBG2 devices #5779

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jbrasen
Copy link
Contributor

@jbrasen jbrasen commented Jun 14, 2024

Description

Add support for creating DBG2 nodes for non-serial port devices.
This allows for either COM based or devices that point to other nodes.

  • Breaking change?
    • Breaking change - Will this cause a break in build or boot behavior?
    • Examples: Add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does the change have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does the change include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

Generated DBG2 entries for PCIe network devices with and without a serial debug device.

Integration Instructions

N/A

Add support for creating DBG2 nodes for non-serial
port devices.
This allows for either COM based or devices that
point to other nodes.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Copy link
Contributor

@pierregondois pierregondois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Jeff,
Thanks for the patch, I added some comments,

Regards,
Pierre

@@ -949,6 +974,29 @@ PrintChar8 (
));
}

STATIC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a function description ?

Also, I don't think this will build as CM_OBJ_PARSER.PrintFormatter is a function pointer such as:
VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8 *Format, UINT8 *Ptr);
and this function has an additional parameter.

Maybe you can create a function Print6UINT64 instead

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw the PR at #5826
and I think it is indeed a better option than what I suggested (I wanted to avoid you the trouble of making a bigger modification)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this code was based on top of this internally, will rebase on that once that review is done.

DEBUG ((
DEBUG_ERROR,
"ERROR: DBG2: Serial port information not found. Status = %r\n",
EFI_NOT_FOUND
"WARNING: DBG2: Too many serial ports to populated. Count = %x\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to populate

UINT8 NumberOfAddresses;

/// The physical base address array for the device
UINT64 BaseAddress[PCI_MAX_BAR];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the max number of addresses should be bound to PCI_MAX_BAR and to the pci code.

In order to re-use the CM_ARM_SERIAL_PORT_INFO struct, would it be possible to do this instead ?

  • Add the following fields to CM_ARM_SERIAL_PORT_INFO:
  ///
  /// Reference Token for a CM_ARM_ADDRESS_RANGE_INFO,
  /// describing other addresses if the port needs multiple.
  /// Token identifying a CM_ARM_OBJ_REF structure.
  /// Only used in DBG2.
  ///
  CM_OBJECT_TOKEN    AdditionnalAddressesToken;

  ///
  /// The port type.
  /// Only used in DBG2.
  ///
  UINT16    PortType;

  ///
  /// ASCII Null terminated string.
  /// Only used in DBG2.
  ///
  CHAR8     ObjectName[AML_NAME_SEG_SIZE + 1];

  • Create the following object:
typedef struct CmArmAddressRangeInfo {
  /// Base Address
  UINT64    BaseAddress;

  /// Address length
  UINT8     AddressLength;
} CM_ARM_ADDRESS_RANGE_INFO;

This would allow the Dbg2Generator to only have to handle one type of serial port description.
If AdditionnalAddressesToken is not the NULL token, then other addresses need to be fetched.
You can check how the CM_ARM_PCI_ADDRESS_MAP_INFO object / CM_ARM_PCI_CONFIG_SPACE_INFO.AddressMapToken field are used at
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c

Also, would it be possible to make the changes on top of this branch:
https://github.com/pierregondois/edk2/commits/pg/dyntables_libraries_reorg/
The objects/code has been shuffled quite a lot, so it would avoid both of us some work if the changes were targeting this branch instead.
(this means that CM_ARM_ADDRESS_RANGE_INFO should go to the ArchCommon name space)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that sounds good. will work on getting a patch in both places, our platforms to test this uses current edk2 (Do you have ETA for when the reorg will hit tiancore?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I don't have a date to give, but hopefully this might happen next week (@samimujawar )

Copy link

This PR has been automatically marked as stale because it has not had activity in 60 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale Due to lack of updates, this item is pending deletion. label Aug 27, 2024
Copy link

mergify bot commented Aug 27, 2024

PR can not be merged due to conflict. Please rebase and resubmit

@github-actions github-actions bot removed the stale Due to lack of updates, this item is pending deletion. label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants