diff --git a/drivers/acpid/src/aml_physmem.rs b/drivers/acpid/src/aml_physmem.rs index 3f4465d0d2..3abfa3661c 100644 --- a/drivers/acpid/src/aml_physmem.rs +++ b/drivers/acpid/src/aml_physmem.rs @@ -178,7 +178,9 @@ impl AmlPhysMemHandler { let pci_fd = if let Some(pci_fd) = pci_fd_opt { Some(libredox::Fd::new(pci_fd.raw())) } else { - log::error!("pci_fd is not registered"); + log::warn!( + "acpid: AmlPhysMemHandler created without PCI fd; AML init will retry once pcid sends it via scheme:acpid sendfd" + ); None }; Self { diff --git a/drivers/acpid/src/scheme.rs b/drivers/acpid/src/scheme.rs index a066f14e9d..cc7ead81d9 100644 --- a/drivers/acpid/src/scheme.rs +++ b/drivers/acpid/src/scheme.rs @@ -1070,10 +1070,27 @@ impl SchemeSync for AcpiScheme<'_, '_> { } let new_fd = libredox::Fd::new(new_fd); + // Allow replacement: pcid may resend the fd after a restart, + // and the previous one-shot EINVAL left aml init permanently + // broken if the first sendfd raced with an early aml request. if self.pci_fd.is_some() { - return Err(Error::new(EINVAL)); - } else { - self.pci_fd = Some(new_fd); + log::warn!( + "acpid: replacing previously-registered PCI fd; AML symbol cache will rebuild on next request" + ); + } + self.pci_fd = Some(new_fd); + + // Kick aml symbol init now that pci_fd is registered. The + // next aml request will either find a working cache or get a + // fresh error log here; either way the failure mode is + // observable rather than silently deferred to "the next + // caller retries". + match self.ctx.aml_symbols(self.pci_fd.as_ref()) { + Ok(_) => log::info!("acpid: AML symbols initialized on PCI fd registration"), + Err(err) => { + log::error!("acpid: AML symbol init failed after PCI fd registration"); + log::error!("acpid: AML error detail: {:?}", err); + } } Ok(num_fds)