core: Simplify config field accessors

Express config field accessors by using the accessor of the previous
field. This removes duplicate statements for field sizes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
configs: Clean up PIO bitmaps

Remove unneeded access permissions to PIC1 from all config. DMA and IDE
access is only relevant to QEMU in PIIX2 mode, so drop this from real
machines and the config template. ACPI access is also not needed during
typical operation, nor is it safe.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Account for larger sets of CPUs

Reserves as many cpu set words as actually required. Format the
initialization in hex to improve readability with large numbers of CPUs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Return empty dir list when running in generator mode

No point in returning valid results here. The files in this directory
may not be accessible for normal users, and then the collector
generation will fail prematurely.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Get rid of record switch in input_open

We no longer invoke input_open if the file is part of a recorded
directory. So this switch became obsolete.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Cleanup typos and style in collector template

No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Differentiate between optional and mandatory files during collect

Bail out if a required file is missing but continue without irritating
warnings if an optional one cannot be found.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Simplify optional file handling and generator mode

Stop passing exceptions from input_open to its callers: An optional file
can be returned as empty (derived from /dev/null), same on failures
during collector creation. The typical mode for input_open is 'r', so we
can save passing this explicitly in most cases. Same for optional which
is generally False.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Do not bail out on missing ACPI tables

Rather warn and give the user a chance to post-process the config file.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>