mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-08 22:05:20 +00:00
vmm: Port PciSegment to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
986e43f899
commit
e04cbb2ad4
@ -177,7 +177,7 @@ struct PciDevSlot {
|
|||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for PciDevSlot {
|
impl Aml for PciDevSlot {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let sun = self.device_id;
|
let sun = self.device_id;
|
||||||
let adr: u32 = (self.device_id as u32) << 16;
|
let adr: u32 = (self.device_id as u32) << 16;
|
||||||
aml::Device::new(
|
aml::Device::new(
|
||||||
@ -196,7 +196,7 @@ impl Aml for PciDevSlot {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.to_aml_bytes()
|
.append_aml_bytes(bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,18 +207,15 @@ struct PciDevSlotNotify {
|
|||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for PciDevSlotNotify {
|
impl Aml for PciDevSlotNotify {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let device_id_mask: u32 = 1 << self.device_id;
|
let device_id_mask: u32 = 1 << self.device_id;
|
||||||
let object = aml::Path::new(&format!("S{:03}", self.device_id));
|
let object = aml::Path::new(&format!("S{:03}", self.device_id));
|
||||||
let mut bytes = aml::And::new(&aml::Local(0), &aml::Arg(0), &device_id_mask).to_aml_bytes();
|
aml::And::new(&aml::Local(0), &aml::Arg(0), &device_id_mask).append_aml_bytes(bytes);
|
||||||
bytes.extend_from_slice(
|
aml::If::new(
|
||||||
&aml::If::new(
|
|
||||||
&aml::Equal::new(&aml::Local(0), &device_id_mask),
|
&aml::Equal::new(&aml::Local(0), &device_id_mask),
|
||||||
vec![&aml::Notify::new(&object, &aml::Arg(1))],
|
vec![&aml::Notify::new(&object, &aml::Arg(1))],
|
||||||
)
|
)
|
||||||
.to_aml_bytes(),
|
.append_aml_bytes(bytes);
|
||||||
);
|
|
||||||
bytes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +224,7 @@ struct PciDevSlotMethods {}
|
|||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for PciDevSlotMethods {
|
impl Aml for PciDevSlotMethods {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let mut device_notifies = Vec::new();
|
let mut device_notifies = Vec::new();
|
||||||
for device_id in 0..32 {
|
for device_id in 0..32 {
|
||||||
device_notifies.push(PciDevSlotNotify { device_id });
|
device_notifies.push(PciDevSlotNotify { device_id });
|
||||||
@ -238,11 +235,8 @@ impl Aml for PciDevSlotMethods {
|
|||||||
device_notifies_refs.push(device_notify);
|
device_notifies_refs.push(device_notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut bytes =
|
aml::Method::new("DVNT".into(), 2, true, device_notifies_refs).append_aml_bytes(bytes);
|
||||||
aml::Method::new("DVNT".into(), 2, true, device_notifies_refs).to_aml_bytes();
|
aml::Method::new(
|
||||||
|
|
||||||
bytes.extend_from_slice(
|
|
||||||
&aml::Method::new(
|
|
||||||
"PCNT".into(),
|
"PCNT".into(),
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
@ -260,9 +254,7 @@ impl Aml for PciDevSlotMethods {
|
|||||||
&aml::Release::new("\\_SB_.PHPR.BLCK".into()),
|
&aml::Release::new("\\_SB_.PHPR.BLCK".into()),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.to_aml_bytes(),
|
.append_aml_bytes(bytes)
|
||||||
);
|
|
||||||
bytes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +263,7 @@ struct PciDsmMethod {}
|
|||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for PciDsmMethod {
|
impl Aml for PciDsmMethod {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
// Refer to ACPI spec v6.3 Ch 9.1.1 and PCI Firmware spec v3.3 Ch 4.6.1
|
// Refer to ACPI spec v6.3 Ch 9.1.1 and PCI Firmware spec v3.3 Ch 4.6.1
|
||||||
// _DSM (Device Specific Method), the following is the implementation in ASL.
|
// _DSM (Device Specific Method), the following is the implementation in ASL.
|
||||||
/*
|
/*
|
||||||
@ -327,13 +319,13 @@ impl Aml for PciDsmMethod {
|
|||||||
&aml::Return::new(&aml::Buffer::new(vec![0])),
|
&aml::Return::new(&aml::Buffer::new(vec![0])),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.to_aml_bytes()
|
.append_aml_bytes(bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for PciSegment {
|
impl Aml for PciSegment {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let mut pci_dsdt_inner_data: Vec<&dyn aml::Aml> = Vec::new();
|
let mut pci_dsdt_inner_data: Vec<&dyn aml::Aml> = Vec::new();
|
||||||
let hid = aml::Name::new("_HID".into(), &aml::EisaName::new("PNP0A08"));
|
let hid = aml::Name::new("_HID".into(), &aml::EisaName::new("PNP0A08"));
|
||||||
pci_dsdt_inner_data.push(&hid);
|
pci_dsdt_inner_data.push(&hid);
|
||||||
@ -447,6 +439,6 @@ impl Aml for PciSegment {
|
|||||||
format!("_SB_.PCI{:X}", self.id).as_str().into(),
|
format!("_SB_.PCI{:X}", self.id).as_str().into(),
|
||||||
pci_dsdt_inner_data,
|
pci_dsdt_inner_data,
|
||||||
)
|
)
|
||||||
.to_aml_bytes()
|
.append_aml_bytes(bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user