Convert literal uses of CONFIG_MAINBOARD_{VENDOR,PART_NUMBER}

Only expand these strings in lib/identity.o.

Change-Id: I8732bbeff8cf8a757bf32fdb615b1d0f97584585
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74907
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Kyösti Mälkki
2022-12-15 22:12:29 +02:00
committed by Felix Held
parent f574c3305a
commit b78e462037
7 changed files with 24 additions and 19 deletions

View File

@@ -9,6 +9,7 @@
#include <device/device.h> #include <device/device.h>
#include <device/path.h> #include <device/path.h>
#include <device/pci_ids.h> #include <device/pci_ids.h>
#include <identity.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@@ -33,16 +34,16 @@ void mptable_init(struct mp_config_table *mc)
mc->mpe_checksum = 0; mc->mpe_checksum = 0;
mc->reserved = 0; mc->reserved = 0;
strncpy(mc->mpc_oem, CONFIG_MAINBOARD_VENDOR, 8); strncpy(mc->mpc_oem, mainboard_vendor, 8);
strncpy(mc->mpc_productid, CONFIG_MAINBOARD_PART_NUMBER, 12); strncpy(mc->mpc_productid, mainboard_part_number, 12);
/* /*
* The oem/productid fields are exactly 8/12 bytes long. If the resp. * The oem/productid fields are exactly 8/12 bytes long. If the resp.
* entry is shorter, the remaining bytes are filled with spaces. * entry is shorter, the remaining bytes are filled with spaces.
*/ */
for (i = MIN(strlen(CONFIG_MAINBOARD_VENDOR), 8); i < 8; i++) for (i = MIN(strlen(mainboard_vendor), 8); i < 8; i++)
mc->mpc_oem[i] = ' '; mc->mpc_oem[i] = ' ';
for (i = MIN(strlen(CONFIG_MAINBOARD_PART_NUMBER), 12); i < 12; i++) for (i = MIN(strlen(mainboard_part_number), 12); i < 12; i++)
mc->mpc_productid[i] = ' '; mc->mpc_productid[i] = ' ';
} }

View File

@@ -6,6 +6,7 @@
#include <device/i2c.h> #include <device/i2c.h>
#include <device/device.h> #include <device/device.h>
#include <device/path.h> #include <device/path.h>
#include <identity.h>
#include <stdint.h> #include <stdint.h>
#include <vendorcode/google/chromeos/chromeos.h> #include <vendorcode/google/chromeos/chromeos.h>
#include "chip.h" #include "chip.h"
@@ -68,8 +69,8 @@ static void max98390_fill_ssdt(const struct device *dev)
dp = acpi_dp_new_table("_DSD"); dp = acpi_dp_new_table("_DSD");
size_t chars = snprintf(dsm_name, sizeof(dsm_name), "%s_%s_%s.bin", size_t chars = snprintf(dsm_name, sizeof(dsm_name), "%s_%s_%s.bin",
config->dsm_param_file_name, CONFIG_MAINBOARD_VENDOR, config->dsm_param_file_name, mainboard_vendor,
CONFIG_MAINBOARD_PART_NUMBER); mainboard_part_number);
if (chars >= sizeof(dsm_name)) if (chars >= sizeof(dsm_name))
printk(BIOS_ERR, "String too long in %s\n", __func__); printk(BIOS_ERR, "String too long in %s\n", __func__);

View File

@@ -5,6 +5,7 @@
#include <console/console.h> #include <console/console.h>
#include <ctype.h> #include <ctype.h>
#include <endian.h> #include <endian.h>
#include <identity.h>
#include <bootmem.h> #include <bootmem.h>
#include <string.h> #include <string.h>
#include <program_loading.h> #include <program_loading.h>
@@ -42,30 +43,28 @@ static void fit_add_default_compat_strings(void)
if ((board_id() != UNDEFINED_STRAPPING_ID) && if ((board_id() != UNDEFINED_STRAPPING_ID) &&
(sku_id() != UNDEFINED_STRAPPING_ID)) { (sku_id() != UNDEFINED_STRAPPING_ID)) {
snprintf(compat_string, sizeof(compat_string), snprintf(compat_string, sizeof(compat_string),
"%s,%s-rev%u-sku%u", CONFIG_MAINBOARD_VENDOR, "%s,%s-rev%u-sku%u", mainboard_vendor, mainboard_part_number,
CONFIG_MAINBOARD_PART_NUMBER, board_id(), sku_id()); board_id(), sku_id());
fit_add_compat_string(compat_string); fit_add_compat_string(compat_string);
} }
if (board_id() != UNDEFINED_STRAPPING_ID) { if (board_id() != UNDEFINED_STRAPPING_ID) {
snprintf(compat_string, sizeof(compat_string), "%s,%s-rev%u", snprintf(compat_string, sizeof(compat_string), "%s,%s-rev%u",
CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER, mainboard_vendor, mainboard_part_number, board_id());
board_id());
fit_add_compat_string(compat_string); fit_add_compat_string(compat_string);
} }
if (sku_id() != UNDEFINED_STRAPPING_ID) { if (sku_id() != UNDEFINED_STRAPPING_ID) {
snprintf(compat_string, sizeof(compat_string), "%s,%s-sku%u", snprintf(compat_string, sizeof(compat_string), "%s,%s-sku%u",
CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER, mainboard_vendor, mainboard_part_number, sku_id());
sku_id());
fit_add_compat_string(compat_string); fit_add_compat_string(compat_string);
} }
snprintf(compat_string, sizeof(compat_string), "%s,%s", snprintf(compat_string, sizeof(compat_string), "%s,%s",
CONFIG_MAINBOARD_VENDOR, CONFIG_MAINBOARD_PART_NUMBER); mainboard_vendor, mainboard_part_number);
fit_add_compat_string(compat_string); fit_add_compat_string(compat_string);
} }

View File

@@ -1,14 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/io.h>
#include <arch/ioapic.h>
#include <console/console.h> #include <console/console.h>
#include <cpu/cpu.h> #include <cpu/cpu.h>
#include <cpu/x86/lapic_def.h> #include <cpu/x86/lapic_def.h>
#include <cpu/x86/mp.h> #include <cpu/x86/mp.h>
#include <arch/io.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <arch/ioapic.h>
#include <device/device.h> #include <device/device.h>
#include <identity.h>
#include <stdlib.h> #include <stdlib.h>
#include <smbios.h> #include <smbios.h>
#include <types.h> #include <types.h>
@@ -191,7 +192,7 @@ static int qemu_get_smbios_data17(int handle, int parent_handle, unsigned long *
t->type_detail = MEMORY_TYPE_DETAIL_SYNCHRONOUS; t->type_detail = MEMORY_TYPE_DETAIL_SYNCHRONOUS;
t->speed = 200; t->speed = 200;
t->clock_speed = 200; t->clock_speed = 200;
t->manufacturer = smbios_add_string(t->eos, CONFIG_MAINBOARD_VENDOR); t->manufacturer = smbios_add_string(t->eos, mainboard_vendor);
const int len = smbios_full_table_len(&t->header, t->eos); const int len = smbios_full_table_len(&t->header, t->eos);
*current += len; *current += len;

View File

@@ -11,6 +11,7 @@
#include <edid.h> #include <edid.h>
#include <framebuffer_info.h> #include <framebuffer_info.h>
#include <gpio.h> #include <gpio.h>
#include <identity.h>
#include <soc/bl31.h> #include <soc/bl31.h>
#include <soc/ddp.h> #include <soc/ddp.h>
#include <soc/dsi.h> #include <soc/dsi.h>
@@ -65,7 +66,7 @@ static void configure_ec(void)
struct panel_description __weak *get_panel_description(int panel_id) struct panel_description __weak *get_panel_description(int panel_id)
{ {
printk(BIOS_ERR, "%s: ERROR: No panels defined for board: %s.\n", printk(BIOS_ERR, "%s: ERROR: No panels defined for board: %s.\n",
__func__, CONFIG_MAINBOARD_PART_NUMBER); __func__, mainboard_part_number);
return NULL; return NULL;
} }

View File

@@ -2,6 +2,7 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <device/device.h> #include <device/device.h>
#include <identity.h>
#include <soc/pci_devs.h> #include <soc/pci_devs.h>
#include <soc/ramstage.h> #include <soc/ramstage.h>
#include <smbios.h> #include <smbios.h>
@@ -49,7 +50,7 @@ const char *smbios_mainboard_product_name(void)
return "PRO Z690-A (MS-7D25)"; return "PRO Z690-A (MS-7D25)";
} }
return CONFIG_MAINBOARD_PART_NUMBER; return mainboard_part_number;
} }
/* Only baseboard serial number is populated */ /* Only baseboard serial number is populated */

View File

@@ -7,6 +7,7 @@
#include <device/device.h> #include <device/device.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <gpio.h> #include <gpio.h>
#include <identity.h>
#include <southbridge/amd/pi/hudson/hudson.h> #include <southbridge/amd/pi/hudson/hudson.h>
#include <southbridge/amd/pi/hudson/pci_devs.h> #include <southbridge/amd/pi/hudson/pci_devs.h>
#include <southbridge/amd/pi/hudson/amd_pci_int_defs.h> #include <southbridge/amd/pi/hudson/amd_pci_int_defs.h>
@@ -226,7 +227,7 @@ static int mainboard_smbios_data(struct device *dev, int *handle,
static void mainboard_enable(struct device *dev) static void mainboard_enable(struct device *dev)
{ {
/* Maintain this text unchanged for manufacture process. */ /* Maintain this text unchanged for manufacture process. */
printk(BIOS_INFO, "Mainboard " CONFIG_MAINBOARD_PART_NUMBER " Enable.\n"); printk(BIOS_INFO, "Mainboard %s Enable.\n", mainboard_part_number);
config_gpio_mux(); config_gpio_mux();