acpi: fix incorrect encoding for 0x{F-1}FFFF
authorIgor Mammedov <imammedo@redhat.com>
Sun, 13 Apr 2014 21:55:51 +0000 (23:55 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 14 Apr 2014 12:13:27 +0000 (15:13 +0300)
Fix typo in build_append_int() which causes integer
truncation when it's in range 0x{F-1}FFFF by packing it
as WordConst instead of required DWordConst.

In partucular this fixes a regression: hotplug in slots 16,17,18 and 19
didn't work, since SSDT had code like this:

                If (And (Arg0, 0x0000))
                {
                    Notify (S80, Arg1)
                }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
hw/i386/acpi-build.c

index a5d3fbfcbdd5d8d73ea29b45b4cd92ba613708f3..c98df88cd23a8351d7c0614f7b86fa6d6075f80e 100644 (file)
@@ -391,7 +391,7 @@ static void build_append_int(GArray *table, uint32_t value)
         build_append_byte(table, 0x01); /* OneOp */
     } else if (value <= 0xFF) {
         build_append_value(table, value, 1);
-    } else if (value <= 0xFFFFF) {
+    } else if (value <= 0xFFFF) {
         build_append_value(table, value, 2);
     } else {
         build_append_value(table, value, 4);