Skip to content

[REBASE & FF]AdvLogger: Add Dynamic HW Port Error Level Filtering - #1763

Open
os-d wants to merge 2 commits into
OpenDevicePartnership:mainfrom
os-d:hdw_port
Open

[REBASE & FF]AdvLogger: Add Dynamic HW Port Error Level Filtering#1763
os-d wants to merge 2 commits into
OpenDevicePartnership:mainfrom
os-d:hdw_port

Conversation

@os-d

@os-d os-d commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

This adds partial responsibility of the C AdvLoggerHdwPortLib to Patina. That lib in the C code allows for abstracting the hw port logged to, which is already provided by the SerialIO interface in Patina. However, that lib also allows for dynamic hw port error level filtering, which Patina does not currently provide.

This PR adds an optional callback for platforms to provide an opportunity to dynamically set the hw port error level.

This originally targeted the major branch in: #1759 but feedback there gave an approach to avoid a breaking change.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

On a platform with the existing SerialIO initialization and another platform with a custom HW port trait.

Integration Instructions

This is not a breaking change, but platforms may now introduce a custom callback, e.g.

fn platform_hw_print_level(hw_print_level: u32) -> u32 {
   if platform_debug_port_enabled() {
      hw_print_level
   } else {
      0
   }
}

static LOGGER: AdvancedLogger<UartNull> = AdvancedLogger::new(
   Format::Standard,
   &[],
   log::LevelFilter::Info,
   UartNull {},
).with_hw_print_level_override_callback(platform_hw_print_level);

@patina-automation

patina-automation Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

✅ QEMU Validation Passed

All QEMU validation jobs completed successfully.

Note: Q35 is only built on Windows hosts (QEMU boot is disabled due to a QEMU vfat issue).

Workflow run: https://github.com/OpenDevicePartnership/patina/actions/runs/33894217197

Boot Time to EFI Shell

Platform Elapsed
ArmVirt (Linux Host) 23.4s
Q35 (Linux Host) 26.2s

Dependencies

Repository Ref
patina 1120550
patina-dxe-core-qemu d2b4d6a
patina-fw-patcher c28ab7d
patina-qemu firmware v4.0.5
patina-qemu build script a8b6551

This comment was automatically generated by the Patina QEMU PR Validation Post workflow.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread components/patina_adv_logger/src/logger.rs
Comment thread components/patina_adv_logger/src/hardware_port.rs Outdated
Comment thread sdk/patina/src/debug/log.rs
Comment thread sdk/patina/src/peripheral/serial/shared.rs Outdated
Comment thread components/patina_adv_logger/src/hardware_port.rs Outdated
@os-d os-d added the semver:minor Pull requests that should increment the release minor version label Sep 2, 2026
@os-d os-d changed the title [REBASE & FF] adv_logger: Create adv_logger HW Port Trait [REBASE & FF]AdvLogger: Add Dynamic HW Port Error Level Filtering Sep 4, 2026
@os-d

os-d commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@cfernald @joschock @Javagedes I have updated this to just be the callback and leaving the SerialIO trait to be the hw port abstraction. If we want to revisit a write only trait for that, we can do that in a separate PR. Let me know your thoughts.

os-d added 2 commits September 4, 2026 09:01
Currently, the EDK2 defined log levels are only partially defined
in Patina (but we must respect them for compat), internal to
adv logger.

This commit makes them publicly available in the SDK so that
a future change can allow platforms to implement hw port
traits that rely on debug level.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This adds partial responsibility of the C AdvLoggerHdwPortLib
to Patina. That lib in the C code allows for abstracting
the hw port logged to, which is already provided by the
SerialIO interface in Patina. However, that lib also
allows for dynamic hw port error level filtering, which
Patina does not currently provide.

This commit adds an optional callback for platforms to provide
an opportunity to dynamically set the hw port error level.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:minor Pull requests that should increment the release minor version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants