aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohnny Lin <johnny_lin@wiwynn.com>2023-01-16 17:21:01 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-02-08 19:14:03 +0000
commit6e7645e4febcb254300b79e6dc4e66341fcb3ef4 (patch)
tree718d4f5e00f967eae0a87cb6c2502af3782086b0 /src
parent663efbb0f74aa375e9c96a7ac433082d3a4f6f43 (diff)
drivers/ocp, mb/ocp/deltalake: move get_loglevel_from_vpd function
Move get_loglevel_from_vpd from mb/ocp/deltalake to driver drivers/ocp/vpd/loglevel_vpd.c. Change-Id: I70af1051f63c527fd8150f5ecbe4765b4aaacd20 Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/71936 Reviewed-by: David Hendricks <david.hendricks@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/ocp/include/vpd.h1
-rw-r--r--src/drivers/ocp/vpd/Makefile.inc3
-rw-r--r--src/drivers/ocp/vpd/loglevel_vpd.c21
-rw-r--r--src/mainboard/ocp/deltalake/Makefile.inc1
-rw-r--r--src/mainboard/ocp/deltalake/loglevel_vpd.c17
5 files changed, 25 insertions, 18 deletions
diff --git a/src/drivers/ocp/include/vpd.h b/src/drivers/ocp/include/vpd.h
index d58f79120f..33fece5c4d 100644
--- a/src/drivers/ocp/include/vpd.h
+++ b/src/drivers/ocp/include/vpd.h
@@ -82,4 +82,5 @@ int get_int_from_vpd_range(const char *const key, const int fallback, const int
const int max);
bool get_bool_from_vpd(const char *const key, const bool fallback);
int get_cxl_mode_from_vpd(void);
+int get_loglevel_from_vpd(const char *const key, const int fallback);
#endif
diff --git a/src/drivers/ocp/vpd/Makefile.inc b/src/drivers/ocp/vpd/Makefile.inc
index c34866ff38..8db5afaf47 100644
--- a/src/drivers/ocp/vpd/Makefile.inc
+++ b/src/drivers/ocp/vpd/Makefile.inc
@@ -1,2 +1,5 @@
romstage-$(CONFIG_OCP_VPD) += vpd_util.c
ramstage-$(CONFIG_OCP_VPD) += vpd_util.c
+ifeq ($(CONFIG_VPD),y)
+all-$(CONFIG_CONSOLE_OVERRIDE_LOGLEVEL) += loglevel_vpd.c
+endif
diff --git a/src/drivers/ocp/vpd/loglevel_vpd.c b/src/drivers/ocp/vpd/loglevel_vpd.c
new file mode 100644
index 0000000000..7a6db5750f
--- /dev/null
+++ b/src/drivers/ocp/vpd/loglevel_vpd.c
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <console/console.h>
+#include <drivers/vpd/vpd.h>
+#include <drivers/ocp/include/vpd.h>
+
+int get_loglevel_from_vpd(const char *const key, const int fallback)
+{
+ int log_level = fallback;
+
+ if (vpd_get_int(key, VPD_RW_THEN_RO, &log_level)) {
+ if (log_level < 0 || log_level >= BIOS_NEVER)
+ log_level = fallback;
+ }
+ return log_level;
+}
+
+int get_console_loglevel(void)
+{
+ return get_loglevel_from_vpd(COREBOOT_LOG_LEVEL, COREBOOT_LOG_LEVEL_DEFAULT);
+}
diff --git a/src/mainboard/ocp/deltalake/Makefile.inc b/src/mainboard/ocp/deltalake/Makefile.inc
index c1dc8d7e6a..1b05344abf 100644
--- a/src/mainboard/ocp/deltalake/Makefile.inc
+++ b/src/mainboard/ocp/deltalake/Makefile.inc
@@ -7,6 +7,5 @@ romstage-$(CONFIG_IPMI_KCS_ROMSTAGE) += ipmi.c
ramstage-y += ramstage.c ipmi.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fadt.c
-all-$(CONFIG_CONSOLE_OVERRIDE_LOGLEVEL) += loglevel_vpd.c
all-y += console.c
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
diff --git a/src/mainboard/ocp/deltalake/loglevel_vpd.c b/src/mainboard/ocp/deltalake/loglevel_vpd.c
deleted file mode 100644
index aa85cb9d57..0000000000
--- a/src/mainboard/ocp/deltalake/loglevel_vpd.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <console/console.h>
-#include <drivers/vpd/vpd.h>
-
-#include "vpd.h"
-
-int get_console_loglevel(void)
-{
- int log_level = COREBOOT_LOG_LEVEL_DEFAULT;
-
- if (vpd_get_int(COREBOOT_LOG_LEVEL, VPD_RW_THEN_RO, &log_level)) {
- if (log_level < 0 || log_level >= BIOS_NEVER)
- log_level = COREBOOT_LOG_LEVEL_DEFAULT;
- }
- return log_level;
-}