--- a/drivers/pcid-spawner/src/main.rs +++ b/drivers/pcid-spawner/src/main.rs @@ -54,11 +54,12 @@ fn main() -> Result<()> { } }; - let full_device_id = handle.config().func.full_device_id; + let func = handle.config().func; + let full_device_id = func.full_device_id; log::debug!( "pcid-spawner enumerated: PCI {} {}", - handle.config().func.addr, + func.addr, full_device_id.display() ); @@ -67,7 +68,7 @@ fn main() -> Result<()> { .iter() .find(|driver| driver.match_function(&full_device_id)) else { - log::debug!("no driver for {}, continuing", handle.config().func.addr); + log::debug!("no driver for {}, continuing", func.addr); continue; }; @@ -91,6 +92,10 @@ fn main() -> Result<()> { let channel_fd = handle.into_inner_fd(); command.env("PCID_CLIENT_CHANNEL", channel_fd.to_string()); + command.env("PCID_SEGMENT", format!("{:04x}", func.addr.segment())); + command.env("PCID_BUS", format!("{:02x}", func.addr.bus())); + command.env("PCID_DEVICE", format!("{:02x}", func.addr.device())); + command.env("PCID_FUNCTION", format!("{}", func.addr.function())); #[allow(deprecated, reason = "we can't yet move this to init")] daemon::Daemon::spawn(command);