1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (c) 2022, Linaro Limited
14 #include <linux/types.h>
16 static void print_mdata(struct fwu_data *data)
19 struct fwu_image_entry *img_entry;
20 struct fwu_image_bank_info *img_info;
22 printf("\tFWU Metadata\n");
23 printf("crc32: %#x\n", data->crc32);
24 printf("version: %#x\n", data->version);
25 printf("active_index: %#x\n", data->active_index);
26 printf("previous_active_index: %#x\n", data->previous_active_index);
28 if (data->version == 2) {
29 for (i = 0; i < 4; i++)
30 printf("bank_state[%d]: %#x\n",
31 i, data->bank_state[i]);
34 printf("\tImage Info\n");
35 for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) {
36 img_entry = &data->fwu_images[i];
37 printf("\nImage Type Guid: %pUL\n",
38 &img_entry->image_type_guid);
39 printf("Location Guid: %pUL\n", &img_entry->location_guid);
40 for (j = 0; j < CONFIG_FWU_NUM_BANKS; j++) {
41 img_info = &img_entry->img_bank_info[j];
42 printf("Image Guid: %pUL\n", &img_info->image_guid);
43 printf("Image Acceptance: %s\n",
44 img_info->accepted == 0x1 ? "yes" : "no");
49 int do_fwu_mdata_read(struct cmd_tbl *cmdtp, int flag,
50 int argc, char * const argv[])
52 struct fwu_data *data = fwu_get_data();
56 return CMD_RET_SUCCESS;
60 fwu_mdata_read, 1, 1, do_fwu_mdata_read,
61 "Read and print FWU metadata",