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.
This commit is contained in:
4lDO2
2021-03-11 17:50:17 +01:00
parent 5fc0f0fa4e
commit 3989477669
3 changed files with 13 additions and 0 deletions
+2
View File
@@ -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);
+3
View File
@@ -129,7 +129,10 @@ pub enum AmlValue {
String(String),
PowerResource(PowerResource),
Processor(Processor),
#[allow(dead_code)]
RawDataBuffer(Vec<u8>),
ThermalZone(ThermalZone)
}
+8
View File
@@ -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 {