Skip to main content

bdf_string

Function bdf_string 

Source
pub fn bdf_string(bus: u32, device: u32, function: u32) -> Option<String>
Expand description

Format a D3DKMT ADAPTERADDRESS as the normalized BDF the whole tool keys on: "0000:bb:dd.f", lowercase hex. The struct has no PCI-domain field — client Windows is effectively always domain 0 (§2.5), hence the literal 0000. This is byte-compatible with what normalize_pci_id produces from NVML’s 8-hex-digit-domain form, which is exactly what makes first-wins dedupe work.

Out-of-range parts (bus > 0xff, device > 0x1f, function > 7 — not expressible in a PCI BDF) mean the thunk returned something we do not understand: None, so the caller falls back to the synthetic id instead of fabricating a plausible-looking address that might wrongly dedupe against a real device.