Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion lib/propolis/src/firmware/acpi/dsdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use super::{
LOCAL_APIC_ADDR, LOCAL_APIC_LEN, PCI_LINK_IRQS,
};
use crate::common::DeviceMetadataMap;
use crate::hw::{chipset::i440fx, pci, qemu};
use crate::hw::{chipset::i440fx, ibmpc, pci, qemu};
use acpi_tables::{aml, sdt::Sdt, Aml, AmlSink};

// The DSDT and SSDT table headers are currently kept the same as the ones
Expand Down Expand Up @@ -803,6 +803,39 @@ impl<'a> Aml for PciRootBridgeLpc<'a> {
])),
],
),
// PS2 keyboard controller.
//
// This device could be generated by the PS2Ctrl struct and
// passed as a DsdtGenerator, but its position in the DSDT
// could change depending on the name of other components
// provided in the VM spec, such as the serial ports.
//
// For now, it is always generated here to maintain consistency
// with the original EDK2 static tables.
&AcpiVariantFilter::new(
self.config.acpi_variant,
vec![AcpiVariant::V0],
&aml::Device::new(
"PS2K".into(),
vec![
&names::hid(&aml::EISAName::new(
devids::IBM_ENHANCED_KEYBOARD,
)),
&names::cid(&aml::EISAName::new(
devids::MICROSOFT_RESERVED_KEYBOARD,
)),
&names::crs(&aml::ResourceTemplate::new(vec![
&io_port(ibmpc::PORT_PS2_DATA, 0x00, 0x01),
&io_port(
ibmpc::PORT_PS2_CMD_STATUS,
0x00,
0x01,
),
&aml::IrqNoFlags::new(ibmpc::IRQ_PS2_PRI),
])),
],
),
),
&DsdtGeneratorAml {
scope: DsdtScope::Lpc,
config: self.config,
Expand Down
36 changes: 0 additions & 36 deletions lib/propolis/src/hw/ps2/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ use std::convert::TryFrom;
use std::mem::replace;
use std::sync::{Arc, Mutex};

use crate::common::DeviceMetadataMap;
use crate::common::*;
use crate::firmware::acpi;
use crate::hw::ibmpc;
use crate::intr_pins::IntrPin;
use crate::migrate::*;
use crate::pio::{PioBus, PioFn};

use acpi_tables::{aml, Aml, AmlSink};
use rfb::proto::KeyEvent;

use super::keyboard::KeyEventRep;
Expand Down Expand Up @@ -608,9 +605,6 @@ impl Lifecycle for PS2Ctrl {
fn migrate(&self) -> Migrator<'_> {
Migrator::Single(self)
}
fn as_dsdt_generator(&self) -> Option<&dyn acpi::DsdtGenerator> {
Some(self)
}
}
impl MigrateSingle for PS2Ctrl {
fn export(
Expand Down Expand Up @@ -709,36 +703,6 @@ impl MigrateSingle for PS2Ctrl {
Ok(())
}
}
impl acpi::DsdtGenerator for PS2Ctrl {
fn dsdt_scope(&self) -> acpi::DsdtScope {
acpi::DsdtScope::Lpc
}

fn to_aml_bytes(
&self,
_: acpi::AcpiVariant,
_: &DeviceMetadataMap,
sink: &mut dyn AmlSink,
) {
aml::Device::new(
"PS2K".into(),
vec![
&acpi::aml::names::hid(&aml::EISAName::new(
acpi::aml::devids::IBM_ENHANCED_KEYBOARD,
)),
&acpi::aml::names::cid(&aml::EISAName::new(
acpi::aml::devids::MICROSOFT_RESERVED_KEYBOARD,
)),
&acpi::aml::names::crs(&aml::ResourceTemplate::new(vec![
&acpi::aml::io_port(ibmpc::PORT_PS2_DATA, 0x00, 0x01),
&acpi::aml::io_port(ibmpc::PORT_PS2_CMD_STATUS, 0x00, 0x01),
&aml::IrqNoFlags::new(ibmpc::IRQ_PS2_PRI),
])),
],
)
.to_aml_bytes(sink);
}
}

// Keyboard-specific commands

Expand Down
Binary file modified phd-tests/tests/testdata/acpi/v0/dsdt.dat
Binary file not shown.
Loading