summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/vpd/Kconfig5
-rw-r--r--src/drivers/vpd/Makefile.inc1
-rw-r--r--src/drivers/vpd/vpd_serial.c26
-rw-r--r--src/mainboard/google/drallion/Kconfig1
-rw-r--r--src/mainboard/google/drallion/ramstage.c21
-rw-r--r--src/mainboard/google/sarien/Kconfig1
-rw-r--r--src/mainboard/google/sarien/ramstage.c21
7 files changed, 34 insertions, 42 deletions
diff --git a/src/drivers/vpd/Kconfig b/src/drivers/vpd/Kconfig
index 0b16058006..7d45eb6a85 100644
--- a/src/drivers/vpd/Kconfig
+++ b/src/drivers/vpd/Kconfig
@@ -19,3 +19,8 @@ config VPD_FMAP_SIZE
default 0x4000
help
Size in bytes of the FMAP region created to store VPD tables.
+
+config SMBIOS_SERIAL_FROM_VPD
+ bool "Load device serial from VPD"
+ depends on VPD && GENERATE_SMBIOS_TABLES
+ default n
diff --git a/src/drivers/vpd/Makefile.inc b/src/drivers/vpd/Makefile.inc
index f54c4d0dd9..615e48a18e 100644
--- a/src/drivers/vpd/Makefile.inc
+++ b/src/drivers/vpd/Makefile.inc
@@ -5,3 +5,4 @@ verstage-$(CONFIG_VPD) += vpd_decode.c vpd.c
romstage-$(CONFIG_VPD) += vpd_decode.c vpd.c
postcar-$(CONFIG_VPD) += vpd_decode.c vpd.c
ramstage-$(CONFIG_VPD) += vpd_decode.c vpd.c
+ramstage-$(CONFIG_SMBIOS_SERIAL_FROM_VPD) += vpd_serial.c
diff --git a/src/drivers/vpd/vpd_serial.c b/src/drivers/vpd/vpd_serial.c
new file mode 100644
index 0000000000..528dcbb368
--- /dev/null
+++ b/src/drivers/vpd/vpd_serial.c
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#include <smbios.h>
+
+#include "vpd.h"
+#include "vpd_tables.h"
+
+#define VPD_KEY_SYSTEM_SERIAL "serial_number"
+#define VPD_KEY_MAINBOARD_SERIAL "mlb_serial_number"
+#define VPD_SERIAL_LEN 64
+
+const char *smbios_system_serial_number(void)
+{
+ static char serial[VPD_SERIAL_LEN];
+ if (vpd_gets(VPD_KEY_SYSTEM_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
+ return serial;
+ return "";
+}
+
+const char *smbios_mainboard_serial_number(void)
+{
+ static char serial[VPD_SERIAL_LEN];
+ if (vpd_gets(VPD_KEY_MAINBOARD_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
+ return serial;
+ return "";
+}
diff --git a/src/mainboard/google/drallion/Kconfig b/src/mainboard/google/drallion/Kconfig
index 6c90eed9a8..747010702c 100644
--- a/src/mainboard/google/drallion/Kconfig
+++ b/src/mainboard/google/drallion/Kconfig
@@ -16,6 +16,7 @@ config BOARD_GOOGLE_BASEBOARD_DRALLION
select MAINBOARD_HAS_CHROMEOS
select MAINBOARD_HAS_I2C_TPM_CR50
select MAINBOARD_HAS_TPM2
+ select SMBIOS_SERIAL_FROM_VPD if VPD
select SOC_INTEL_COMETLAKE_1
select SOC_INTEL_COMMON_BLOCK_HDA_VERB
select SOC_INTEL_COMMON_BLOCK_SMM_ESPI_DISABLE
diff --git a/src/mainboard/google/drallion/ramstage.c b/src/mainboard/google/drallion/ramstage.c
index 8725b83636..384e44bb57 100644
--- a/src/mainboard/google/drallion/ramstage.c
+++ b/src/mainboard/google/drallion/ramstage.c
@@ -2,33 +2,12 @@
#include <acpi/acpi.h>
#include <boardid.h>
-#include <drivers/vpd/vpd.h>
#include <smbios.h>
#include <soc/gpio.h>
#include <soc/ramstage.h>
#include <variant/gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
-#define VPD_KEY_SYSTEM_SERIAL "serial_number"
-#define VPD_KEY_MAINBOARD_SERIAL "mlb_serial_number"
-#define VPD_SERIAL_LEN 64
-
-const char *smbios_system_serial_number(void)
-{
- static char serial[VPD_SERIAL_LEN];
- if (vpd_gets(VPD_KEY_SYSTEM_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
- return serial;
- return "";
-}
-
-const char *smbios_mainboard_serial_number(void)
-{
- static char serial[VPD_SERIAL_LEN];
- if (vpd_gets(VPD_KEY_MAINBOARD_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
- return serial;
- return "";
-}
-
/* mainboard silk screen shows DIMM-A and DIMM-B */
void smbios_fill_dimm_locator(const struct dimm_info *dimm,
struct smbios_type17 *t)
diff --git a/src/mainboard/google/sarien/Kconfig b/src/mainboard/google/sarien/Kconfig
index 9b0d25158c..444234af45 100644
--- a/src/mainboard/google/sarien/Kconfig
+++ b/src/mainboard/google/sarien/Kconfig
@@ -16,6 +16,7 @@ config BOARD_GOOGLE_BASEBOARD_SARIEN
select MAINBOARD_HAS_CHROMEOS
select MAINBOARD_HAS_I2C_TPM_CR50
select MAINBOARD_HAS_TPM2
+ select SMBIOS_SERIAL_FROM_VPD if VPD
select SOC_INTEL_WHISKEYLAKE
select SOC_INTEL_COMMON_BLOCK_HDA_VERB
select SOC_INTEL_COMMON_BLOCK_SMM_ESPI_DISABLE
diff --git a/src/mainboard/google/sarien/ramstage.c b/src/mainboard/google/sarien/ramstage.c
index f4704faf86..de97c686ee 100644
--- a/src/mainboard/google/sarien/ramstage.c
+++ b/src/mainboard/google/sarien/ramstage.c
@@ -2,33 +2,12 @@
#include <acpi/acpi.h>
#include <boardid.h>
-#include <drivers/vpd/vpd.h>
#include <smbios.h>
#include <soc/gpio.h>
#include <variant/gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#if CONFIG(GENERATE_SMBIOS_TABLES)
-#define VPD_KEY_SYSTEM_SERIAL "serial_number"
-#define VPD_KEY_MAINBOARD_SERIAL "mlb_serial_number"
-#define VPD_SERIAL_LEN 64
-
-const char *smbios_system_serial_number(void)
-{
- static char serial[VPD_SERIAL_LEN];
- if (vpd_gets(VPD_KEY_SYSTEM_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
- return serial;
- return "";
-}
-
-const char *smbios_mainboard_serial_number(void)
-{
- static char serial[VPD_SERIAL_LEN];
- if (vpd_gets(VPD_KEY_MAINBOARD_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
- return serial;
- return "";
-}
-
/* mainboard silk screen shows DIMM-A and DIMM-B */
void smbios_fill_dimm_locator(const struct dimm_info *dimm,
struct smbios_type17 *t)