OSDN Git Service

acpi: make SSDT 1.0 spec compliant when possible
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 26 Mar 2014 10:31:31 +0000 (12:31 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 26 Mar 2014 10:31:31 +0000 (12:31 +0200)
commitb4f4d54812624581ce429c805e5179c78222c707
treeb78b76e6321f0e9e8b8c457863b5f84f4894c0c4
parent7f6613cedc59fa849105668ae971dc31004bca1c
acpi: make SSDT 1.0 spec compliant when possible

The ACPI specification says:

The ASL compiler can emit two different AML opcodes for a Package
declaration, either PackageOp or VarPackageOp. For small, fixed-length
packages, the PackageOp is used and this opcode is compatible with ACPI
1.0. A VarPackageOp will be emitted if any of the following conditions
are true:
. The NumElements argument is a TermArg that can only be resolved at
runtime.
. At compile time, NumElements resolves to a constant that is larger than
255.
. The PackageList contains more than 255 initializer elements.
Note: The ability to create variable-sized packages was first introduced
in ACPI 2.0. ACPI 1.0 only allowed fixed-size packages with up to 255 elements.

So the spec seems to say a fixed value up to 255 must always
be used with PackageOp and not VarPackageOp, and some guests
(windows up to win2k8) seem to interpret it like this.

Let's do just this, choosing the encoding depending on
the number of elements.

Fixes 9bcc80cd71892df42605e0c097d85c0237ff45d1
(i386/acpi-build: allow more than 255 elements in CPON).

https://bugs.launchpad.net/bugs/1297651

Reported-by: Robert Hu <robert.hu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/acpi-build.c