Verified Commit 39894776 authored by 4lDO2's avatar 4lDO2 🖖

Also open a file descriptor in `debug:`.

This is to allow the shutdown logs to reach serial output before the
system shuts down, which is especially useful on QEMU.
parent 5fc0f0fa
......@@ -393,6 +393,7 @@ pub struct FadtAcpi2Struct {
}
unsafe impl plain::Plain for FadtAcpi2Struct {}
#[derive(Clone)]
pub struct Fadt(Sdt);
impl Fadt {
......@@ -456,6 +457,7 @@ impl Fadt {
}
};
context.fadt = Some(fadt.clone());
context.dsdt = Some(Dsdt(dsdt_sdt.clone()));
context.tables.push(dsdt_sdt);
......
......@@ -129,7 +129,10 @@ pub enum AmlValue {
String(String),
PowerResource(PowerResource),
Processor(Processor),
#[allow(dead_code)]
RawDataBuffer(Vec<u8>),
ThermalZone(ThermalZone)
}
......
......@@ -36,6 +36,7 @@ fn monotonic() -> (u64, u64) {
fn setup_logging() -> Option<&'static RedoxLogger> {
use redox_log::OutputBuilder;
#[allow(unused_mut)]
let mut logger = RedoxLogger::new()
.with_output(
OutputBuilder::stderr()
......@@ -45,6 +46,12 @@ fn setup_logging() -> Option<&'static RedoxLogger> {
.build()
);
#[cfg(target_os = "redox")]
match File::open("debug:") {
Ok(d) => logger = logger.with_output(OutputBuilder::with_endpoint(d).flush_on_newline(true).with_filter(log::LevelFilter::Info).build()),
Err(error) => eprintln!("Failed to open `debug:` scheme: {}", error),
}
#[cfg(target_os = "redox")]
match OutputBuilder::in_redox_logging_scheme("misc", "acpi", "acpid.log") {
Ok(b) => logger = logger.with_output(
......@@ -231,6 +238,7 @@ fn main() {
let _ = event_queue.read(&mut event).expect("acpid: failed to read from event queue");
if event.flags.contains(EventFlags::EVENT_READ) && event.id == shutdown_pipe.as_raw_fd() as usize {
log::info!("Received shutdown request from kernel.");
break 'events;
}
if !event.flags.contains(EventFlags::EVENT_READ) || event.id != scheme_socket.as_raw_fd() as usize {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment