From b57b12f729947c83515b96e45885b69d73027d79 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 24 Jan 2023 19:31:00 +0100 Subject: acpi/acpigen: factor out acpigen_write_processor_namestring This functionality is used in multiple places, so factor it out into a function. Compared to acpigen_write_processor_cnot, the buffer size is decreased from 40 to 16 bytes, but the format string specified by CONFIG_ACPI_CPU_STRING results in 9 chars and a NULL byte which will fit into the buffer without any issue. I've seen the CPU devices being put into another scope within \_SB, but even in that case that would be 14 chars and a NULL byte whist still fits into the 16 byte buffer. For acpigen_write_processor and acpigen_write_processor_package this doesn't change any edge case behavior. In the unrealistic case of the format string resulting in a longer CPU device string, this would have been a problem before this patch too. Also drop the curly braces of the for loop in acpigen_write_processor_package. This makes the code a bit harder to read and isn't a very good idea, but with the curly braces in place, the linter breaks the build :( Signed-off-by: Felix Held Change-Id: I5d8291a2aaae2011cb185d72c7f7864b6e2220ec Reviewed-on: https://review.coreboot.org/c/coreboot/+/72452 Reviewed-by: Fred Reitberger Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Elyes Haouas --- src/include/acpi/acpigen.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/include/acpi') diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h index bb36707f9c..ac0cab2b6e 100644 --- a/src/include/acpi/acpigen.h +++ b/src/include/acpi/acpigen.h @@ -449,6 +449,7 @@ void acpigen_write_pct_package(const acpi_addr_t *perf_ctrl, const acpi_addr_t * void acpigen_write_xpss_package(const struct acpi_xpss_sw_pstate *pstate_value); void acpigen_write_xpss_object(const struct acpi_xpss_sw_pstate *pstate_values, size_t nentries); +void acpigen_write_processor_namestring(unsigned int cpu_index); void acpigen_write_processor(u8 cpuindex, u32 pblock_addr, u8 pblock_len); __always_inline void acpigen_write_processor_end(void) { -- cgit v1.2.3