fix: expose pcid handoff to spawned drivers
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
--- a/drivers/pcid/src/driver_interface/mod.rs
|
||||
+++ b/drivers/pcid/src/driver_interface/mod.rs
|
||||
@@ -310,4 +310,4 @@ impl PciFunctionHandle {
|
||||
- fn connect_default() -> Self {
|
||||
+ pub fn connect_default() -> Self {
|
||||
let channel_fd = match env::var("PCID_CLIENT_CHANNEL") {
|
||||
Ok(channel_fd) => channel_fd,
|
||||
Err(err) => {
|
||||
@@ -0,0 +1,37 @@
|
||||
--- 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);
|
||||
Reference in New Issue
Block a user