Skip to content

[Task] patina_boot: Add connect-dispatch interleaving with DxeServices #1282

@kat-perez

Description

@kat-perez

Description

Update device enumeration to interleave controller connection with driver dispatch, ensuring drivers loaded from firmware volumes (e.g., PCI option ROMs) are dispatched before continuing enumeration.

Current State

The current connect_all() function connects controllers in a loop until the handle count stabilizes, but does not dispatch newly-loaded drivers between iterations:

for _iteration in 0..MAX_ITERATIONS {
    let handles = boot_services.locate_handle_buffer(...)?;
    for &handle in handles.iter() {
        let _ = boot_services.connect_controller(handle, ...);
    }
    // Missing: dxe_services.dispatch() call here
    if current_handle_count == prev_handle_count {
        break;
    }
}

Requirements

Per the Boot Orchestration RFC:

"interleave_connect_and_dispatch() - Orchestrate connect-dispatch loop for device enumeration"
"connect controllers, dispatch newly loaded drivers, repeat until stable"

  • Add DxeServices dependency to perform driver dispatch
  • Call dxe_services.dispatch() after each round of controller connection
  • Continue until both handle count stabilizes AND no new drivers are dispatched

Design

Either update the existing connect_all() function or provide a new interleave_connect_and_dispatch() helper that takes both BootServices and DxeServices:

pub fn interleave_connect_and_dispatch<B: BootServices, D: DxeServices>(
    boot_services: &B,
    dxe_services: &D,
) -> Result<()> {
    loop {
        connect_all_handles(boot_services)?;
        if !dxe_services.dispatch()? {
            break; // No more drivers to dispatch
        }
    }
    Ok(())
}

Impact

Without this fix, platforms with PCI option ROM drivers or other firmware volume-based drivers may not have those drivers dispatched during boot enumeration, potentially missing devices.

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Backlog

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions