Checking `is_present` first can break x86 migration from new Qemu
version to old Qemu. This is because CPRS Bit is not defined in the
older Qemu register block and will always be 0 resulting in check always
failing. Reversing the logic to first check `is_enabled` can alleviate
below problem:
- If ((\_SB.PCI0.PRES.CPEN == One))
- {
- Local0 = 0x0F
+ If ((\_SB.PCI0.PRES.CPRS == One))
+ {
+ If ((\_SB.PCI0.PRES.CPEN == One))
+ {
+ Local0 = 0x0F
+ }
+ Else
+ {
+ Local0 = 0x0D
+ }
}
Suggested-by: Igor Mammedov <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Salil Mehta <[email protected]>
---
hw/acpi/cpu.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 23443f09a5..b2f7a2b27e 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -490,22 +490,22 @@ void build_cpus_aml(Aml *table, MachineState *machine,
CPUHotplugFeatures opts,
aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
aml_append(method, aml_store(idx, cpu_selector));
aml_append(method, aml_store(zero, sta));
- ifctx = aml_if(aml_equal(is_present, one));
+ ifctx = aml_if(aml_equal(is_enabled, one));
{
- ifctx2 = aml_if(aml_equal(is_enabled, one));
- {
- /* cpu is present and enabled */
- aml_append(ifctx2, aml_store(aml_int(0xF), sta));
- }
- aml_append(ifctx, ifctx2);
- else_ctx = aml_else();
+ /* cpu is present and enabled */
+ aml_append(ifctx, aml_store(aml_int(0xF), sta));
+ }
+ aml_append(method, ifctx);
+ else_ctx = aml_else();
+ {
+ ifctx2 = aml_if(aml_equal(is_present, one));
{
/* cpu is present but disabled */
- aml_append(else_ctx, aml_store(aml_int(0xD), sta));
+ aml_append(ifctx2, aml_store(aml_int(0xD), sta));
}
- aml_append(ifctx, else_ctx);
+ aml_append(else_ctx, ifctx2);
}
- aml_append(method, ifctx);
+ aml_append(method, else_ctx);
aml_append(method, aml_release(ctrl_lock));
aml_append(method, aml_return(sta));
}
--
2.34.1