acpigen,soc/amd,cpu/intel: rework static DWORD for CPPC table

Some elements in the ACPI CPPC table allow static DWORDs. Instead of
using a fake register resource, use a tagged union with the two types
"register" and "DWORD" and respective macros for CPPC table entries.

Test: dumped SSDT before and after do not differ.

Change-Id: Ib853261b5c0ea87ae2424fed188f2d1872be9a06
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57886
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Michael Niewöhner
2021-10-05 22:22:21 +02:00
committed by Felix Held
parent 679f4fa465
commit 38107fa80e
6 changed files with 73 additions and 67 deletions

View File

@@ -1798,13 +1798,11 @@ void acpigen_write_CPPC_package(const struct cppc_config *config)
acpigen_write_byte(config->version);
for (i = 0; i < max; ++i) {
const acpi_addr_t *reg = &(config->regs[i]);
if (reg->space_id == ACPI_ADDRESS_SPACE_MEMORY &&
reg->bit_width == 32 && reg->access_size == ACPI_ACCESS_SIZE_UNDEFINED) {
acpigen_write_dword(reg->addrl);
} else {
acpigen_write_register_resource(reg);
}
const cppc_entry_t *entry = &config->entries[i];
if (entry->type == CPPC_TYPE_DWORD)
acpigen_write_dword(entry->dword);
else
acpigen_write_register_resource(&entry->reg);
}
acpigen_pop_len();
}