mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-05 03:21:13 +00:00
vmm: cpu: Port CpuManager to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
a7786b4e0c
commit
986e43f899
@ -1253,7 +1253,7 @@ impl Cpu {
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
impl Aml for Cpu {
|
||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
let mat_data: Vec<u8> = self.generate_mat();
|
||||
|
||||
@ -1305,7 +1305,7 @@ impl Aml for Cpu {
|
||||
),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes()
|
||||
.append_aml_bytes(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1316,13 +1316,13 @@ struct CpuNotify {
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
impl Aml for CpuNotify {
|
||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||
let object = aml::Path::new(&format!("C{:03}", self.cpu_id));
|
||||
aml::If::new(
|
||||
&aml::Equal::new(&aml::Arg(0), &self.cpu_id),
|
||||
vec![&aml::Notify::new(&object, &aml::Arg(1))],
|
||||
)
|
||||
.to_aml_bytes()
|
||||
.append_aml_bytes(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1333,11 +1333,9 @@ struct CpuMethods {
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
impl Aml for CpuMethods {
|
||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||
let mut bytes = Vec::new();
|
||||
bytes.extend_from_slice(
|
||||
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||
// CPU status method
|
||||
&aml::Method::new(
|
||||
aml::Method::new(
|
||||
"CSTA".into(),
|
||||
1,
|
||||
true,
|
||||
@ -1358,8 +1356,7 @@ impl Aml for CpuMethods {
|
||||
&aml::Return::new(&aml::Local(0)),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes(),
|
||||
);
|
||||
.append_aml_bytes(bytes);
|
||||
|
||||
let mut cpu_notifies = Vec::new();
|
||||
for cpu_id in 0..self.max_vcpus {
|
||||
@ -1371,12 +1368,9 @@ impl Aml for CpuMethods {
|
||||
cpu_notifies_refs.push(&cpu_notifies[usize::from(cpu_id)]);
|
||||
}
|
||||
|
||||
bytes.extend_from_slice(
|
||||
&aml::Method::new("CTFY".into(), 2, true, cpu_notifies_refs).to_aml_bytes(),
|
||||
);
|
||||
aml::Method::new("CTFY".into(), 2, true, cpu_notifies_refs).append_aml_bytes(bytes);
|
||||
|
||||
bytes.extend_from_slice(
|
||||
&aml::Method::new(
|
||||
aml::Method::new(
|
||||
"CEJ0".into(),
|
||||
1,
|
||||
true,
|
||||
@ -1389,11 +1383,9 @@ impl Aml for CpuMethods {
|
||||
&aml::Release::new("\\_SB_.PRES.CPLK".into()),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes(),
|
||||
);
|
||||
.append_aml_bytes(bytes);
|
||||
|
||||
bytes.extend_from_slice(
|
||||
&aml::Method::new(
|
||||
aml::Method::new(
|
||||
"CSCN".into(),
|
||||
0,
|
||||
true,
|
||||
@ -1416,10 +1408,7 @@ impl Aml for CpuMethods {
|
||||
vec![&aml::Local(0), &aml::ONE],
|
||||
),
|
||||
// Reset CINS bit
|
||||
&aml::Store::new(
|
||||
&aml::Path::new("\\_SB_.PRES.CINS"),
|
||||
&aml::ONE,
|
||||
),
|
||||
&aml::Store::new(&aml::Path::new("\\_SB_.PRES.CINS"), &aml::ONE),
|
||||
],
|
||||
),
|
||||
// Check if CRMV bit is set
|
||||
@ -1427,15 +1416,9 @@ impl Aml for CpuMethods {
|
||||
&aml::Equal::new(&aml::Path::new("\\_SB_.PRES.CRMV"), &aml::ONE),
|
||||
// Notify device if it is (with the eject constant 0x3)
|
||||
vec![
|
||||
&aml::MethodCall::new(
|
||||
"CTFY".into(),
|
||||
vec![&aml::Local(0), &3u8],
|
||||
),
|
||||
&aml::MethodCall::new("CTFY".into(), vec![&aml::Local(0), &3u8]),
|
||||
// Reset CRMV bit
|
||||
&aml::Store::new(
|
||||
&aml::Path::new("\\_SB_.PRES.CRMV"),
|
||||
&aml::ONE,
|
||||
),
|
||||
&aml::Store::new(&aml::Path::new("\\_SB_.PRES.CRMV"), &aml::ONE),
|
||||
],
|
||||
),
|
||||
&aml::Add::new(&aml::Local(0), &aml::Local(0), &aml::ONE),
|
||||
@ -1445,20 +1428,16 @@ impl Aml for CpuMethods {
|
||||
&aml::Release::new("\\_SB_.PRES.CPLK".into()),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes(),
|
||||
);
|
||||
bytes
|
||||
.append_aml_bytes(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
impl Aml for CpuManager {
|
||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||
let mut bytes = Vec::new();
|
||||
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||
// CPU hotplug controller
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
bytes.extend_from_slice(
|
||||
&aml::Device::new(
|
||||
aml::Device::new(
|
||||
"_SB_.PRES".into(),
|
||||
vec![
|
||||
&aml::Name::new("_HID".into(), &aml::EisaName::new("PNP0A06")),
|
||||
@ -1507,8 +1486,7 @@ impl Aml for CpuManager {
|
||||
),
|
||||
],
|
||||
)
|
||||
.to_aml_bytes(),
|
||||
);
|
||||
.append_aml_bytes(bytes);
|
||||
|
||||
// CPU devices
|
||||
let hid = aml::Name::new("_HID".into(), &"ACPI0010");
|
||||
@ -1534,10 +1512,7 @@ impl Aml for CpuManager {
|
||||
cpu_data_inner.push(cpu_device);
|
||||
}
|
||||
|
||||
bytes.extend_from_slice(
|
||||
&aml::Device::new("_SB_.CPUS".into(), cpu_data_inner).to_aml_bytes(),
|
||||
);
|
||||
bytes
|
||||
aml::Device::new("_SB_.CPUS".into(), cpu_data_inner).append_aml_bytes(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user