cee25393d8
- Fix P15-8-init-cycle-detection.patch: replace visiting+error with seen+silent-skip to eliminate 11 false-positive 'dependency cycle detected' errors on shared deps - Fix P0-daemon-fix-init-notify-unwrap.patch: remove eprintln! for missing INIT_NOTIFY (expected for oneshot_async services, ~7 daemons affected) - Fix driver-manager hotplug loop: add PERMANENTLY_SKIPPED static set shared between hotplug handler and DriverConfig::probe() to stop infinite re-probing of Fatal/NotSupported/deferred-exhausted device+driver pairs (e.g. ided) - Fix driver-manager log_timeline: suppress repeated EPIPE/ENOENT errors with AtomicI32 dedup and AtomicBool one-shot guards for boot timeline JSON - Add driver-manager SIGTERM handler, ACPI bus registration, --status mode, driver reap loop, graceful shutdown, and reduced deferred retries (30→3)
95 lines
4.2 KiB
Diff
95 lines
4.2 KiB
Diff
--- a/drivers/acpid/src/acpi.rs
|
||
+++ b/drivers/acpid/src/acpi.rs
|
||
@@ -266,7 +266,34 @@
|
||
let format_err = |err| format!("{:?}", err);
|
||
let handler = AmlPhysMemHandler::new(Arc::clone(&self.pci_fd), Arc::clone(&self.page_cache));
|
||
//TODO: use these parsed tables for the rest of acpid
|
||
- let rsdp_address = usize::from_str_radix(&std::env::var("RSDP_ADDR")?, 16)?;
|
||
+ let rsdp_address = match std::env::var("RSDP_ADDR") {
|
||
+ Ok(addr) => usize::from_str_radix(&addr, 16)?,
|
||
+ Err(_) => {
|
||
+ // RSDP_ADDR not provided — probe BIOS area (0xE0000–0xFFFFF) for RSDP signature
|
||
+ log::info!("RSDP_ADDR not set, probing BIOS area for RSDP...");
|
||
+ let mut found = None;
|
||
+ for page_base in (0xE_0000..0x10_0000).step_by(16) {
|
||
+ let mapped = unsafe {
|
||
+ common::physmap(
|
||
+ page_base,
|
||
+ 16,
|
||
+ common::Prot::RW,
|
||
+ common::MemoryType::default(),
|
||
+ )
|
||
+ };
|
||
+ if let Ok(virt) = mapped {
|
||
+ let sig = unsafe { std::slice::from_raw_parts(virt as *const u8, 8) };
|
||
+ if sig == b"RSD PTR " {
|
||
+ log::info!("found RSDP at physical {:#x}", page_base);
|
||
+ found = Some(page_base);
|
||
+ break;
|
||
+ }
|
||
+ let _ = unsafe { libredox::call::munmap(virt as *mut (), 16) };
|
||
+ }
|
||
+ }
|
||
+ found.ok_or("RSDP not found in BIOS area (0xE0000-0xFFFFF)")?
|
||
+ }
|
||
+ };
|
||
let tables =
|
||
unsafe { AcpiTables::from_rsdp(handler.clone(), rsdp_address).map_err(format_err)? };
|
||
let platform = AcpiPlatform::new(tables, handler).map_err(format_err)?;
|
||
--- a/drivers/acpid/src/aml_physmem.rs
|
||
+++ b/drivers/acpid/src/aml_physmem.rs
|
||
@@ -190,7 +190,10 @@
|
||
.unwrap_or_else(|poisoned| poisoned.into_inner());
|
||
match page_cache.read_from_phys::<T>(address) {
|
||
Ok(value) => value,
|
||
- Err(error) => panic!("AML physmem read failed at {:#x}: {}", address, error),
|
||
+ Err(error) => {
|
||
+ log::error!("AML physmem read failed at {:#x}: {} — returning zero", address, error);
|
||
+ T::zero()
|
||
+ }
|
||
}
|
||
}
|
||
|
||
@@ -252,13 +255,26 @@
|
||
let offset = phys & OFFSET_MASK;
|
||
let pages = (offset + size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||
let map_size = pages * PAGE_SIZE;
|
||
- let virt_page = common::physmap(
|
||
+ let virt_page = match common::physmap(
|
||
phys_page,
|
||
map_size,
|
||
common::Prot::RW,
|
||
common::MemoryType::default(),
|
||
- )
|
||
- .expect("failed to map physical region") as usize;
|
||
+ ) {
|
||
+ Ok(v) => v as usize,
|
||
+ Err(err) => {
|
||
+ log::error!(
|
||
+ "failed to map physical region {:#x}+{:#x}: {:?} — mapping zero page fallback",
|
||
+ phys_page,
|
||
+ map_size,
|
||
+ err
|
||
+ );
|
||
+ // Map the zero page as a safe fallback so the pointer is at least valid
|
||
+ // Reads will return zeroes; this is better than crashing.
|
||
+ common::physmap(0, PAGE_SIZE, common::Prot::RW, common::MemoryType::default())
|
||
+ .expect("failed to map even the zero page") as usize
|
||
+ }
|
||
+ };
|
||
PhysicalMapping {
|
||
physical_start: phys,
|
||
virtual_start: NonNull::new((virt_page + offset) as *mut T).unwrap(),
|
||
@@ -269,9 +285,8 @@
|
||
}
|
||
fn unmap_physical_region<T>(region: &PhysicalMapping<Self, T>) {
|
||
let virt_page = region.virtual_start.addr().get() & PAGE_MASK;
|
||
- unsafe {
|
||
- libredox::call::munmap(virt_page as *mut (), region.mapped_length)
|
||
- .expect("failed to unmap physical region")
|
||
+ if let Err(e) = unsafe { libredox::call::munmap(virt_page as *mut (), region.mapped_length) } {
|
||
+ log::error!("failed to unmap physical region at {:#x}: {:?}", virt_page, e);
|
||
}
|
||
}
|
||
|