mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 19:32:20 +00:00
vmm: Port DeviceManager to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
185f0c1bf3
commit
d96d98d88e
@ -3889,12 +3889,10 @@ fn numa_node_id_from_memory_zone_id(numa_nodes: &NumaNodes, memory_zone_id: &str
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
impl Aml for DeviceManager {
|
||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
use arch::aarch64::DeviceInfoForFdt;
|
||||
|
||||
let mut bytes = Vec::new();
|
||||
|
||||
let mut pci_scan_methods = Vec::new();
|
||||
for i in 0..self.pci_segments.len() {
|
||||
pci_scan_methods.push(aml::MethodCall::new(
|
||||
@ -3908,8 +3906,7 @@ impl Aml for DeviceManager {
|
||||
}
|
||||
|
||||
// PCI hotplug controller
|
||||
bytes.extend_from_slice(
|
||||
&aml::Device::new(
|
||||
aml::Device::new(
|
||||
"_SB_.PHPR".into(),
|
||||
vec![
|
||||
&aml::Name::new("_HID".into(), &aml::EisaName::new("PNP0A06")),
|
||||
@ -3963,10 +3960,13 @@ impl Aml for DeviceManager {
|
||||
&aml::Method::new("PSCN".into(), 0, true, pci_scan_inner),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes(),
|
||||
);
|
||||
.append_aml_bytes(bytes);
|
||||
|
||||
let mbrd_dsdt_data = aml::Device::new(
|
||||
for segment in &self.pci_segments {
|
||||
segment.append_aml_bytes(bytes);
|
||||
}
|
||||
|
||||
aml::Device::new(
|
||||
"_SB_.MBRD".into(),
|
||||
vec![
|
||||
&aml::Name::new("_HID".into(), &aml::EisaName::new("PNP0C02")),
|
||||
@ -3981,7 +3981,7 @@ impl Aml for DeviceManager {
|
||||
),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes();
|
||||
.append_aml_bytes(bytes);
|
||||
|
||||
// Serial device
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
@ -3998,7 +3998,8 @@ impl Aml for DeviceManager {
|
||||
// If serial is turned off, add a fake device with invalid irq.
|
||||
31
|
||||
};
|
||||
let com1_dsdt_data = aml::Device::new(
|
||||
if self.config.lock().unwrap().serial.mode != ConsoleOutputMode::Off {
|
||||
aml::Device::new(
|
||||
"_SB_.COM1".into(),
|
||||
vec![
|
||||
&aml::Name::new(
|
||||
@ -4025,41 +4026,26 @@ impl Aml for DeviceManager {
|
||||
),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes();
|
||||
.append_aml_bytes(bytes);
|
||||
}
|
||||
|
||||
let s5_sleep_data =
|
||||
aml::Name::new("_S5_".into(), &aml::Package::new(vec![&5u8])).to_aml_bytes();
|
||||
aml::Name::new("_S5_".into(), &aml::Package::new(vec![&5u8])).append_aml_bytes(bytes);
|
||||
|
||||
let power_button_dsdt_data = aml::Device::new(
|
||||
aml::Device::new(
|
||||
"_SB_.PWRB".into(),
|
||||
vec![
|
||||
&aml::Name::new("_HID".into(), &aml::EisaName::new("PNP0C0C")),
|
||||
&aml::Name::new("_UID".into(), &aml::ZERO),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes();
|
||||
.append_aml_bytes(bytes);
|
||||
|
||||
let ged_data = self
|
||||
.ged_notification_device
|
||||
self.ged_notification_device
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.to_aml_bytes();
|
||||
|
||||
for segment in &self.pci_segments {
|
||||
let pci_dsdt_data = segment.to_aml_bytes();
|
||||
bytes.extend_from_slice(pci_dsdt_data.as_slice());
|
||||
}
|
||||
|
||||
bytes.extend_from_slice(mbrd_dsdt_data.as_slice());
|
||||
if self.config.lock().unwrap().serial.mode != ConsoleOutputMode::Off {
|
||||
bytes.extend_from_slice(com1_dsdt_data.as_slice());
|
||||
}
|
||||
bytes.extend_from_slice(s5_sleep_data.as_slice());
|
||||
bytes.extend_from_slice(power_button_dsdt_data.as_slice());
|
||||
bytes.extend_from_slice(ged_data.as_slice());
|
||||
bytes
|
||||
.append_aml_bytes(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user