summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-10-18 22:32:45 -0600
committerTom Rini <[email protected]>2024-10-18 22:32:45 -0600
commit7036abbd5c3934059b020d5fd5bcb8b3bf3c788c (patch)
tree0fb8fd19b51862cf5742ec68ef889e4ad441dde7 /cmd
parentf83e36fd83c74b4e28a45a9d56abc4ad9b7848b9 (diff)
parent44917d586657eeae0401bc29af80011a264002e7 (diff)
Merge tag 'dm-pull-17oct24-take2' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
A few new x86 commands and minor improvements expo improvements binman support for signing FIT images
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig1
-rw-r--r--cmd/font.c17
-rw-r--r--cmd/x86/Makefile2
-rw-r--r--cmd/x86/cpuid.c37
-rw-r--r--cmd/x86/msr.c52
5 files changed, 100 insertions, 9 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index bff22b94de2..a4ca61c37dd 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2291,6 +2291,7 @@ config CMD_DATE
config CMD_RTC
bool "rtc"
depends on DM_RTC
+ default y if X86
help
Enable the 'rtc' command for low-level access to RTC devices.
diff --git a/cmd/font.c b/cmd/font.c
index eb13fb12f79..36e41203654 100644
--- a/cmd/font.c
+++ b/cmd/font.c
@@ -55,9 +55,6 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
uint size;
int ret;
- if (argc != 2)
- return CMD_RET_USAGE;
-
if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
return CMD_RET_FAILURE;
ret = vidconsole_get_font_size(dev, &font_name, &size);
@@ -66,12 +63,16 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- size = dectoul(argv[1], NULL);
+ if (argc < 2) {
+ printf("%d\n", size);
+ } else {
+ size = dectoul(argv[1], NULL);
- ret = vidconsole_select_font(dev, font_name, size);
- if (ret) {
- printf("Failed (error %d)\n", ret);
- return CMD_RET_FAILURE;
+ ret = vidconsole_select_font(dev, font_name, size);
+ if (ret) {
+ printf("Failed (error %d)\n", ret);
+ return CMD_RET_FAILURE;
+ }
}
return 0;
diff --git a/cmd/x86/Makefile b/cmd/x86/Makefile
index b1f39d3bfde..925215235d3 100644
--- a/cmd/x86/Makefile
+++ b/cmd/x86/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0+
obj-$(CONFIG_CMD_CBSYSINFO) += cbsysinfo.o
-obj-y += mtrr.o
+obj-y += cpuid.o msr.o mtrr.o
obj-$(CONFIG_CMD_EXCEPTION) += exception.o
obj-$(CONFIG_USE_HOB) += hob.o
obj-$(CONFIG_HAVE_FSP) += fsp.o
diff --git a/cmd/x86/cpuid.c b/cmd/x86/cpuid.c
new file mode 100644
index 00000000000..222754b5d15
--- /dev/null
+++ b/cmd/x86/cpuid.c
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * The 'cpuid' command provides access to the CPU's cpuid information
+ *
+ * Copyright 2024 Google, LLC
+ * Written by Simon Glass <[email protected]>
+ */
+
+#include <command.h>
+#include <vsprintf.h>
+#include <asm/cpu.h>
+
+static int do_cpuid(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ struct cpuid_result res;
+ ulong op;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ op = hextoul(argv[1], NULL);
+ res = cpuid(op);
+ printf("eax %08x\n", res.eax);
+ printf("ebx %08x\n", res.ebx);
+ printf("ecx %08x\n", res.ecx);
+ printf("edx %08x\n", res.edx);
+
+ return 0;
+}
+
+U_BOOT_LONGHELP(cpuid, "Show CPU Identification information");
+
+U_BOOT_CMD(
+ cpuid, 2, 1, do_cpuid,
+ "cpuid <op>", cpuid_help_text
+);
diff --git a/cmd/x86/msr.c b/cmd/x86/msr.c
new file mode 100644
index 00000000000..3cb70d1f89a
--- /dev/null
+++ b/cmd/x86/msr.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * The 'cpuid' command provides access to the CPU's cpuid information
+ *
+ * Copyright 2024 Google, LLC
+ * Written by Simon Glass <[email protected]>
+ */
+
+#include <command.h>
+#include <vsprintf.h>
+#include <asm/msr.h>
+
+static int do_read(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ struct msr_t msr;
+ ulong op;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ op = hextoul(argv[1], NULL);
+ msr = msr_read(op);
+ printf("%08x %08x\n", msr.hi, msr.lo);
+
+ return 0;
+}
+
+static int do_write(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ struct msr_t msr;
+ ulong op;
+
+ if (argc < 4)
+ return CMD_RET_USAGE;
+
+ op = hextoul(argv[1], NULL);
+ msr.hi = hextoul(argv[2], NULL);
+ msr.lo = hextoul(argv[3], NULL);
+ msr_write(op, msr);
+
+ return 0;
+}
+
+U_BOOT_LONGHELP(msr,
+ "read <op> - read a machine-status register (MSR) as <hi 32-bits> <lo 32-bits>\n"
+ "write <op< <hi> <lo> - write an MSR");
+
+U_BOOT_CMD_WITH_SUBCMDS(msr, "Machine Status Registers", msr_help_text,
+ U_BOOT_CMD_MKENT(read, CONFIG_SYS_MAXARGS, 1, do_read, "", ""),
+ U_BOOT_CMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_write, "", ""));