diff options
author | Michael Niewöhner <foss@mniewoehner.de> | 2021-10-05 22:22:21 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-10-21 20:03:14 +0000 |
commit | 38107fa80eb81fe5077dbee0dd9a46618c71a196 (patch) | |
tree | d8f040f30350f52a5ccc8fcc63ef37042e08ff46 /src/include | |
parent | 679f4fa46578267989b55635e50ef500f7327338 (diff) |
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>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/acpi/acpigen.h | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h index 3af0959cfd..463c16d2b2 100644 --- a/src/include/acpi/acpigen.h +++ b/src/include/acpi/acpigen.h @@ -265,24 +265,37 @@ enum cppc_fields { CPPC_MAX_FIELDS_VER_3, }; +typedef struct cppc_entry { + enum { CPPC_TYPE_REG, CPPC_TYPE_DWORD } type; + union { + acpi_addr_t reg; + uint32_t dword; + }; +} cppc_entry_t; + +#define CPPC_DWORD(_dword) \ + (cppc_entry_t){ \ + .type = CPPC_TYPE_DWORD, \ + .dword = _dword, \ + } + +#define CPPC_REG(_reg) \ + (cppc_entry_t){ \ + .type = CPPC_TYPE_REG, \ + .reg = _reg, \ + } + +#define CPPC_REG_MSR(address, offset, width) CPPC_REG(ACPI_REG_MSR(address, offset, width)) +#define CPPC_UNSUPPORTED CPPC_REG(ACPI_REG_UNSUPPORTED) + struct cppc_config { u32 version; /* must be 1, 2, or 3 */ /* * The generic acpi_addr_t structure is being used, though * anything besides PPC or FFIXED generally requires checking * if the OS has advertised support for it (via _OSC). - * - * NOTE: some fields permit DWORDs to be used. If you - * provide a System Memory register with all zeros (which - * represents unsupported) then this will be used as-is. - * Otherwise, a System Memory register with a 32-bit - * width will be converted into a DWORD field (the value - * of which will be the value of 'addrl'. Any other use - * of System Memory register is currently undefined. - * (i.e., if you have an actual need for System Memory - * then you'll need to adjust this kludge). */ - acpi_addr_t regs[CPPC_MAX_FIELDS_VER_3]; + cppc_entry_t entries[CPPC_MAX_FIELDS_VER_3]; }; void acpigen_write_return_integer(uint64_t arg); |