From 84191f73847c351019bb50728d28220d91b0aee4 Mon Sep 17 00:00:00 2001 From: Max Merchel Date: Thu, 10 Feb 2022 10:16:39 +0100 Subject: cmd/mmc: fix output of mmc info for e-MMC e-MMC and SD standards differ for some CID fields: - 6 Byte Name - assigned by Manufacturer (SD 5 Byte) - 1 Byte OEM - assigned by Jedec (SD 2 Byte) See e-MMC standard (JEDEC Standard No. 84-B51), 7.2.3 (OID) and 7.2.4 (PNM) Signed-off-by: Max Merchel Signed-off-by: Markus Niebel Reviewed-by: Jaehoon Chung --- cmd/mmc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/cmd/mmc.c b/cmd/mmc.c index 503dbb6199c..7464f8d00cd 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -22,10 +22,18 @@ static void print_mmcinfo(struct mmc *mmc) printf("Device: %s\n", mmc->cfg->name); printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24); - printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff); - printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff, - (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff, - (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff); + if (IS_SD(mmc)) { + printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff); + printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff, + (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff, + (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff); + } else { + printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xff); + printf("Name: %c%c%c%c%c%c \n", mmc->cid[0] & 0xff, + (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff, + (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff, + (mmc->cid[2] >> 24)); + } printf("Bus Speed: %d\n", mmc->clock); #if CONFIG_IS_ENABLED(MMC_VERBOSE) -- cgit v1.3.1 From 0832dd2900f3ec7bf2ae12866138fc0fd9970168 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Sun, 27 Feb 2022 13:18:56 +0100 Subject: efi_loader: Ignore DT when ACPI is on For targets that enable ACPI, we should not pass Device Trees into the payload. However, our distro boot logic always passes the builtin DT as an argument. To make it easy to use ACPI with distro boot, let's just ignore the DT argument to bootefi when ACPI is enabled. That way, we can successfully distro boot payloads on ACPI enabled targets. Signed-off-by: Alexander Graf Reviewed-by: Mark Kettenis Reviewed-by: Heinrich Schuchardt --- cmd/bootefi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 46eebd5ee22..53d9f0e0dcc 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -265,8 +265,8 @@ efi_status_t efi_install_fdt(void *fdt) */ #if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) if (fdt) { - log_err("ERROR: can't have ACPI table and device tree.\n"); - return EFI_LOAD_ERROR; + log_warning("WARNING: Can't have ACPI table and device tree - ignoring DT.\n"); + return EFI_SUCCESS; } #else bootm_headers_t img = { 0 }; -- cgit v1.3.1 From 63276a569d4832d139206d652207663323df46eb Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 26 Feb 2022 12:10:10 +0100 Subject: efi_loader: use short-form DP for load options The GUID of partitions is sufficient for identification and will stay constant in the lifetime of a boot option. The preceding path of the device-path may change due to changes in the enumeration of devices. Therefore it is preferable to use the short-form of device-paths in load options. Adjust the 'efidebug boot add' command accordingly. Signed-off-by: Heinrich Schuchardt --- cmd/efidebug.c | 70 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 22 deletions(-) (limited to 'cmd') diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 401d13cc4ca..51e2850d218 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -734,20 +734,20 @@ static int do_efi_show_tables(struct cmd_tbl *cmdtp, int flag, } /** - * create_initrd_dp() - Create a special device for our Boot### option - * - * @dev: Device - * @part: Disk partition - * @file: Filename - * Return: Pointer to the device path or ERR_PTR + * create_initrd_dp() - create a special device for our Boot### option * + * @dev: device + * @part: disk partition + * @file: filename + * @shortform: create short form device path + * Return: pointer to the device path or ERR_PTR */ static struct efi_device_path *create_initrd_dp(const char *dev, const char *part, - const char *file) + const char *file, int shortform) { - struct efi_device_path *tmp_dp = NULL, *tmp_fp = NULL; + struct efi_device_path *tmp_dp = NULL, *tmp_fp = NULL, *short_fp = NULL; struct efi_device_path *initrd_dp = NULL; efi_status_t ret; const struct efi_initrd_dp id_dp = { @@ -771,9 +771,13 @@ struct efi_device_path *create_initrd_dp(const char *dev, const char *part, printf("Cannot create device path for \"%s %s\"\n", part, file); goto out; } + if (shortform) + short_fp = efi_dp_shorten(tmp_fp); + if (!short_fp) + short_fp = tmp_fp; initrd_dp = efi_dp_append((const struct efi_device_path *)&id_dp, - tmp_fp); + short_fp); out: efi_free_pool(tmp_dp); @@ -807,6 +811,7 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, size_t label_len, label_len16; u16 *label; struct efi_device_path *device_path = NULL, *file_path = NULL; + struct efi_device_path *fp_free = NULL; struct efi_device_path *final_fp = NULL; struct efi_device_path *initrd_dp = NULL; struct efi_load_option lo; @@ -826,7 +831,18 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, argc--; argv++; /* 'add' */ for (; argc > 0; argc--, argv++) { - if (!strcmp(argv[0], "-b")) { + int shortform; + + if (*argv[0] != '-' || strlen(argv[0]) != 2) { + r = CMD_RET_USAGE; + goto out; + } + shortform = 0; + switch (argv[0][1]) { + case 'b': + shortform = 1; + /* fallthrough */ + case 'B': if (argc < 5 || lo.label) { r = CMD_RET_USAGE; goto out; @@ -849,24 +865,33 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, /* file path */ ret = efi_dp_from_name(argv[3], argv[4], argv[5], - &device_path, &file_path); + &device_path, &fp_free); if (ret != EFI_SUCCESS) { printf("Cannot create device path for \"%s %s\"\n", argv[3], argv[4]); r = CMD_RET_FAILURE; goto out; } + if (shortform) + file_path = efi_dp_shorten(fp_free); + if (!file_path) + file_path = fp_free; fp_size += efi_dp_size(file_path) + sizeof(struct efi_device_path); argc -= 5; argv += 5; - } else if (!strcmp(argv[0], "-i")) { + break; + case 'i': + shortform = 1; + /* fallthrough */ + case 'I': if (argc < 3 || initrd_dp) { r = CMD_RET_USAGE; goto out; } - initrd_dp = create_initrd_dp(argv[1], argv[2], argv[3]); + initrd_dp = create_initrd_dp(argv[1], argv[2], argv[3], + shortform); if (!initrd_dp) { printf("Cannot add an initrd\n"); r = CMD_RET_FAILURE; @@ -876,7 +901,8 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, argv += 3; fp_size += efi_dp_size(initrd_dp) + sizeof(struct efi_device_path); - } else if (!strcmp(argv[0], "-s")) { + break; + case 's': if (argc < 1 || lo.optional_data) { r = CMD_RET_USAGE; goto out; @@ -884,7 +910,8 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, lo.optional_data = (const u8 *)argv[1]; argc -= 1; argv += 1; - } else { + break; + default: r = CMD_RET_USAGE; goto out; } @@ -927,7 +954,7 @@ out: efi_free_pool(final_fp); efi_free_pool(initrd_dp); efi_free_pool(device_path); - efi_free_pool(file_path); + efi_free_pool(fp_free); free(lo.label); return r; @@ -1571,12 +1598,11 @@ static int do_efidebug(struct cmd_tbl *cmdtp, int flag, static char efidebug_help_text[] = " - UEFI Shell-like interface to configure UEFI environment\n" "\n" - "efidebug boot add " - "-b