mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
- bootstd: Add a bootmeth for ChromiumOS on x86 - x86: Use qemu-x86_64 to boot EFI installers
This commit is contained in:
@@ -135,6 +135,14 @@ config CMD_BDI
|
||||
help
|
||||
Print board info
|
||||
|
||||
config CMD_BDINFO_EXTRA
|
||||
bool "bdinfo extra features"
|
||||
default y if SANDBOX || X86
|
||||
help
|
||||
Show additional information about the board. This uses a little more
|
||||
code space but provides more options, particularly those useful for
|
||||
bringup, development and debugging.
|
||||
|
||||
config CMD_CONFIG
|
||||
bool "config"
|
||||
default SANDBOX
|
||||
|
||||
24
cmd/acpi.c
24
cmd/acpi.c
@@ -118,6 +118,22 @@ static int do_acpi_list(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_acpi_set(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
ulong val;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("ACPI pointer: %lx\n", gd_acpi_start());
|
||||
} else {
|
||||
val = hextoul(argv[1], NULL);
|
||||
printf("Setting ACPI pointer to %lx\n", val);
|
||||
gd_set_acpi_start(val);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_acpi_items(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
@@ -157,12 +173,14 @@ static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
|
||||
#ifdef CONFIG_SYS_LONGHELP
|
||||
static char acpi_help_text[] =
|
||||
"list - list ACPI tables\n"
|
||||
"acpi items [-d] - List/dump each piece of ACPI data from devices\n"
|
||||
"acpi dump <name> - Dump ACPI table";
|
||||
"list - list ACPI tables\n"
|
||||
"acpi items [-d] - List/dump each piece of ACPI data from devices\n"
|
||||
"acpi set [<addr>] - Set or show address of ACPI tables\n"
|
||||
"acpi dump <name> - Dump ACPI table";
|
||||
#endif
|
||||
|
||||
U_BOOT_CMD_WITH_SUBCMDS(acpi, "ACPI tables", acpi_help_text,
|
||||
U_BOOT_SUBCMD_MKENT(list, 1, 1, do_acpi_list),
|
||||
U_BOOT_SUBCMD_MKENT(items, 2, 1, do_acpi_items),
|
||||
U_BOOT_SUBCMD_MKENT(set, 2, 1, do_acpi_set),
|
||||
U_BOOT_SUBCMD_MKENT(dump, 2, 1, do_acpi_dump));
|
||||
|
||||
27
cmd/bdinfo.c
27
cmd/bdinfo.c
@@ -13,6 +13,7 @@
|
||||
#include <lmb.h>
|
||||
#include <mapmem.h>
|
||||
#include <net.h>
|
||||
#include <serial.h>
|
||||
#include <video.h>
|
||||
#include <vsprintf.h>
|
||||
#include <asm/cache.h>
|
||||
@@ -113,6 +114,25 @@ static void show_video_info(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void print_serial(struct udevice *dev)
|
||||
{
|
||||
struct serial_device_info info;
|
||||
int ret;
|
||||
|
||||
if (!dev || !IS_ENABLED(CONFIG_DM_SERIAL))
|
||||
return;
|
||||
|
||||
ret = serial_getinfo(dev, &info);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
bdinfo_print_num_l("serial addr", info.addr);
|
||||
bdinfo_print_num_l(" width", info.reg_width);
|
||||
bdinfo_print_num_l(" shift", info.reg_shift);
|
||||
bdinfo_print_num_l(" offset", info.reg_offset);
|
||||
bdinfo_print_num_l(" clock", info.clock);
|
||||
}
|
||||
|
||||
int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
{
|
||||
struct bd_info *bd = gd->bd;
|
||||
@@ -151,6 +171,13 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
if (IS_ENABLED(CONFIG_OF_REAL))
|
||||
printf("devicetree = %s\n", fdtdec_get_srcname());
|
||||
}
|
||||
print_serial(gd->cur_serial_dev);
|
||||
|
||||
if (IS_ENABLED(CONFIG_CMD_BDINFO_EXTRA)) {
|
||||
bdinfo_print_num_ll("stack ptr", (ulong)&bd);
|
||||
bdinfo_print_num_ll("ram_top ptr", (ulong)gd->ram_top);
|
||||
bdinfo_print_num_l("malloc base", gd_malloc_start());
|
||||
}
|
||||
|
||||
arch_print_bdinfo();
|
||||
|
||||
|
||||
@@ -288,6 +288,12 @@ static int do_bootflow_select(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
std->cur_bootflow = found;
|
||||
if (IS_ENABLED(CONFIG_BOOTSTD_FULL)) {
|
||||
if (env_set("bootargs", found->cmdline)) {
|
||||
printf("Cannot set bootargs\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -324,6 +330,14 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
printf("Buffer: %lx\n", (ulong)map_to_sysmem(bflow->buf));
|
||||
printf("Size: %x (%d bytes)\n", bflow->size, bflow->size);
|
||||
printf("OS: %s\n", bflow->os_name ? bflow->os_name : "(none)");
|
||||
printf("Cmdline: ");
|
||||
if (bflow->cmdline)
|
||||
puts(bflow->cmdline);
|
||||
else
|
||||
puts("(none)");
|
||||
putc('\n');
|
||||
if (bflow->x86_setup)
|
||||
printf("X86 setup: %p\n", bflow->x86_setup);
|
||||
printf("Logo: %s\n", bflow->logo ?
|
||||
simple_xtoa((ulong)map_to_sysmem(bflow->logo)) : "(none)");
|
||||
if (bflow->logo) {
|
||||
@@ -417,6 +431,75 @@ static int do_bootflow_menu(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_bootflow_cmdline(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
struct bootstd_priv *std;
|
||||
struct bootflow *bflow;
|
||||
const char *op, *arg, *val = NULL;
|
||||
int ret;
|
||||
|
||||
if (argc < 3)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
ret = bootstd_get_priv(&std);
|
||||
if (ret)
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
bflow = std->cur_bootflow;
|
||||
if (!bflow) {
|
||||
printf("No bootflow selected\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
op = argv[1];
|
||||
arg = argv[2];
|
||||
if (*op == 's') {
|
||||
if (argc < 4)
|
||||
return CMD_RET_USAGE;
|
||||
val = argv[3];
|
||||
}
|
||||
|
||||
switch (*op) {
|
||||
case 'c': /* clear */
|
||||
val = "";
|
||||
fallthrough;
|
||||
case 's': /* set */
|
||||
case 'd': /* delete */
|
||||
ret = bootflow_cmdline_set_arg(bflow, arg, val, true);
|
||||
break;
|
||||
case 'g': /* get */
|
||||
ret = bootflow_cmdline_get_arg(bflow, arg, &val);
|
||||
if (ret >= 0)
|
||||
printf("%.*s\n", ret, val);
|
||||
break;
|
||||
case 'a': /* auto */
|
||||
ret = bootflow_cmdline_auto(bflow, arg);
|
||||
break;
|
||||
}
|
||||
switch (ret) {
|
||||
case -E2BIG:
|
||||
printf("Argument too long\n");
|
||||
break;
|
||||
case -ENOENT:
|
||||
printf("Argument not found\n");
|
||||
break;
|
||||
case -EINVAL:
|
||||
printf("Mismatched quotes\n");
|
||||
break;
|
||||
case -EBADF:
|
||||
printf("Value must be quoted\n");
|
||||
break;
|
||||
default:
|
||||
if (ret < 0)
|
||||
printf("Unknown error: %dE\n", ret);
|
||||
}
|
||||
if (ret < 0)
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_CMD_BOOTFLOW_FULL */
|
||||
|
||||
#ifdef CONFIG_SYS_LONGHELP
|
||||
@@ -427,7 +510,8 @@ static char bootflow_help_text[] =
|
||||
"bootflow select [<num>|<name>] - select a bootflow\n"
|
||||
"bootflow info [-d] - show info on current bootflow (-d dump bootflow)\n"
|
||||
"bootflow boot - boot current bootflow (or first available if none selected)\n"
|
||||
"bootflow menu [-t] - show a menu of available bootflows";
|
||||
"bootflow menu [-t] - show a menu of available bootflows\n"
|
||||
"bootflow cmdline [set|get|clear|delete|auto] <param> [<value>] - update cmdline";
|
||||
#else
|
||||
"scan - boot first available bootflow\n";
|
||||
#endif
|
||||
@@ -441,5 +525,6 @@ U_BOOT_CMD_WITH_SUBCMDS(bootflow, "Boot flows", bootflow_help_text,
|
||||
U_BOOT_SUBCMD_MKENT(info, 2, 1, do_bootflow_info),
|
||||
U_BOOT_SUBCMD_MKENT(boot, 1, 1, do_bootflow_boot),
|
||||
U_BOOT_SUBCMD_MKENT(menu, 2, 1, do_bootflow_menu),
|
||||
U_BOOT_SUBCMD_MKENT(cmdline, 4, 1, do_bootflow_cmdline),
|
||||
#endif
|
||||
);
|
||||
|
||||
34
cmd/part.c
34
cmd/part.c
@@ -182,6 +182,36 @@ static int do_part_number(int argc, char *const argv[])
|
||||
return do_part_info(argc, argv, CMD_PART_INFO_NUMBER);
|
||||
}
|
||||
|
||||
static int do_part_set(int argc, char *const argv[])
|
||||
{
|
||||
const char *devname, *partstr, *typestr;
|
||||
struct blk_desc *desc;
|
||||
int dev;
|
||||
|
||||
if (argc < 3)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
/* Look up the device */
|
||||
devname = argv[0];
|
||||
partstr = argv[1];
|
||||
typestr = argv[2];
|
||||
dev = blk_get_device_by_str(devname, partstr, &desc);
|
||||
if (dev < 0) {
|
||||
printf("** Bad device specification %s %s **\n", devname,
|
||||
partstr);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
desc->part_type = part_get_type_by_name(typestr);
|
||||
if (!desc->part_type) {
|
||||
printf("Unknown partition type '%s'\n", typestr);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
part_print(desc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PARTITION_TYPE_GUID
|
||||
static int do_part_type(int argc, char *const argv[])
|
||||
{
|
||||
@@ -245,6 +275,8 @@ static int do_part(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
return do_part_number(argc - 2, argv + 2);
|
||||
else if (!strcmp(argv[1], "types"))
|
||||
return do_part_types(argc - 2, argv + 2);
|
||||
else if (!strcmp(argv[1], "set"))
|
||||
return do_part_set(argc - 2, argv + 2);
|
||||
#ifdef CONFIG_PARTITION_TYPE_GUID
|
||||
else if (!strcmp(argv[1], "type"))
|
||||
return do_part_type(argc - 2, argv + 2);
|
||||
@@ -279,6 +311,8 @@ U_BOOT_CMD(
|
||||
#endif
|
||||
"part type <interface> <dev>:<part> <varname>\n"
|
||||
" - set environment variable to partition type\n"
|
||||
"part set <interface> <dev> type\n"
|
||||
" - set partition type for a device\n"
|
||||
"part types\n"
|
||||
" - list supported partition table types"
|
||||
);
|
||||
|
||||
@@ -26,7 +26,7 @@ static int qemu_fwcfg_cmd_list_firmware(void)
|
||||
for (file = qfw_file_iter_init(qfw_dev, &iter);
|
||||
!qfw_file_iter_end(&iter);
|
||||
file = qfw_file_iter_next(&iter)) {
|
||||
printf("%-56s\n", file->cfg.name);
|
||||
printf("%08lx %-56s\n", file->addr, file->cfg.name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -10,71 +10,19 @@
|
||||
#include <asm/mp.h>
|
||||
#include <asm/mtrr.h>
|
||||
|
||||
static const char *const mtrr_type_name[MTRR_TYPE_COUNT] = {
|
||||
"Uncacheable",
|
||||
"Combine",
|
||||
"2",
|
||||
"3",
|
||||
"Through",
|
||||
"Protect",
|
||||
"Back",
|
||||
};
|
||||
|
||||
static void read_mtrrs(void *arg)
|
||||
{
|
||||
struct mtrr_info *info = arg;
|
||||
|
||||
mtrr_read_all(info);
|
||||
}
|
||||
|
||||
static int do_mtrr_list(int reg_count, int cpu_select)
|
||||
{
|
||||
struct mtrr_info info;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
printf("Reg Valid Write-type %-16s %-16s %-16s\n", "Base ||",
|
||||
"Mask ||", "Size ||");
|
||||
memset(&info, '\0', sizeof(info));
|
||||
ret = mp_run_on_cpus(cpu_select, read_mtrrs, &info);
|
||||
if (ret)
|
||||
return log_msg_ret("run", ret);
|
||||
for (i = 0; i < reg_count; i++) {
|
||||
const char *type = "Invalid";
|
||||
uint64_t base, mask, size;
|
||||
bool valid;
|
||||
|
||||
base = info.mtrr[i].base;
|
||||
mask = info.mtrr[i].mask;
|
||||
size = ~mask & ((1ULL << CONFIG_CPU_ADDR_BITS) - 1);
|
||||
size |= (1 << 12) - 1;
|
||||
size += 1;
|
||||
valid = mask & MTRR_PHYS_MASK_VALID;
|
||||
type = mtrr_type_name[base & MTRR_BASE_TYPE_MASK];
|
||||
printf("%d %-5s %-12s %016llx %016llx %016llx\n", i,
|
||||
valid ? "Y" : "N", type, base & ~MTRR_BASE_TYPE_MASK,
|
||||
mask & ~MTRR_PHYS_MASK_VALID, size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_mtrr_set(int cpu_select, uint reg, int argc, char *const argv[])
|
||||
{
|
||||
const char *typename = argv[0];
|
||||
uint32_t start, size;
|
||||
uint64_t base, mask;
|
||||
int i, type = -1;
|
||||
int type = -1;
|
||||
bool valid;
|
||||
int ret;
|
||||
|
||||
if (argc < 3)
|
||||
return CMD_RET_USAGE;
|
||||
for (i = 0; i < MTRR_TYPE_COUNT; i++) {
|
||||
if (*typename == *mtrr_type_name[i])
|
||||
type = i;
|
||||
}
|
||||
if (type == -1) {
|
||||
type = mtrr_get_type_by_name(typename);
|
||||
if (type < 0) {
|
||||
printf("Invalid type name %s\n", typename);
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
@@ -146,7 +94,7 @@ static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
if (!first)
|
||||
printf("\n");
|
||||
printf("CPU %d:\n", i);
|
||||
ret = do_mtrr_list(reg_count, i);
|
||||
ret = mtrr_list(reg_count, i);
|
||||
if (ret) {
|
||||
printf("Failed to read CPU %s (err=%d)\n",
|
||||
i < MP_SELECT_ALL ? simple_itoa(i) : "",
|
||||
|
||||
Reference in New Issue
Block a user