pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled

ACPI parser in XP considers PNP0A06 devices of CPU and
memory hotplug as duplicates. Adding unique _UID
to CPU hotplug device fixes BSOD.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
pc: acpi: decribe bridge device as not hotpluggable

when bridge hotplug is disabled, i.e. for machine
types less then 2.0, bridge device was created as
hotpluggable by mistake since commit 133a2da.

Fix it by just creating it as a present device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
pc: acpi-build: cleanup AcpiPmInfo initialization

zero initialize AcpiPmInfo struct to reduce code bloat
a little bit.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: build_append_nameseg(): add padding if necessary

According to ACPI spec NameSeg shorter than 4 characters
must be padded up to 4 characters with "_" symbol.
ACPI 5.0:  20.2.2 "Name Objects Encoding"

Do it in build_append_nameseg() so that caller shouldn't know
or care about it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: move generic aml building helpers into dedictated file

the will be later used for composing AML primitives
and all that could be reused later for ARM machines
as well.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add build_append_namestring() helper

Use build_append_namestring() instead of build_append_nameseg()
So user won't have to care whether name is NameSeg, NamePath or
NameString.

See for refernce ACPI 5.0: 20.2.2 Name Objects Encoding

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: replace opencoded notify codes with named values

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: drop min-bytes in build_package()

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
pc: acpi-build: replace recursive PCI bus tree generation with loop based

it replaces PCI tree structure in SSDT with a set of scopes
describing each PCI bus as a separate scope with a child devices.
It makes code easier to follow and a little bit smaller.

In addition it makes simplier to convert current template
patching approach to completely dynamically generated SSDT
without dependency on IASL, which would allow to drop
template binary blobs from source tree.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add ASL primitives API needed for PCI bus generation

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: include PkgLength size only when requested

Named/Reserved{Field} definition uses PkgLength [1] encoding to specify
field length, however it doesn't include size of PkgLength field itself,
while other block objects that have explicit length of its body account
for PkgLength size while encoding it [2].
This special casing isn't mentioned in ACPI spec, but that's what 'iasl'
compiles NamedField to so add extra argument to build_prepend_pkg_length()
to allow it handle the case.

--
1. ACPI Spec 5.0, 20.2.5.2 Named Objects Encoding, page 822
2. ACPI Spec 5.0, 5.4 Definition Block Encoding

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add acpi_field(), acpi_operation_region(), acpi_io() terms

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add acpi_processor() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: factor out ACPI const int packing out build_append_value()

so it could be reused for adding plain integer value into AML.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: extend build_append_{value|int}() to support 64-bit values

it will be used for generating 64bit _CRS entries

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add acpi_word_bus_number(), acpi_word_io(), acpi_dword_memory(), acpi_qword_memory() terms

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add acpi_EisaId() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add acpi_arg2, acpi_call3, acpi_call4 terms

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
acpi: add acpi_reserved_field() term

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
pc: pcihp: expose MMIO base and len as properties

it will be used later to dynamically reserve MMIO region
instead of manually punching holes in PCI0._CRS

Signed-off-by: Igor Mammedov <imammedo@redhat.com>