1 // SPDX-License-Identifier: GPL-2.0
3 * (C) Copyright 2019 - 2020 Xilinx, Inc.
13 static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,
19 if (argc < cmdtp->maxargs)
22 addr = simple_strtoul(argv[2], &endp, 16);
23 if (*argv[1] == 0 || *endp != 0)
26 return fru_capture(addr);
29 static int do_fru_display(struct cmd_tbl *cmdtp, int flag, int argc,
33 return CMD_RET_SUCCESS;
36 static int do_fru_generate(struct cmd_tbl *cmdtp, int flag, int argc,
41 if (argc < cmdtp->maxargs)
44 addr = simple_strtoul(argv[2], NULL, 16);
46 return fru_generate(addr, argv[3], argv[4], argv[5], argv[6], argv[7]);
49 static struct cmd_tbl cmd_fru_sub[] = {
50 U_BOOT_CMD_MKENT(capture, 3, 0, do_fru_capture, "", ""),
51 U_BOOT_CMD_MKENT(display, 2, 0, do_fru_display, "", ""),
52 U_BOOT_CMD_MKENT(board_gen, 8, 0, do_fru_generate, "", ""),
55 static int do_fru(struct cmd_tbl *cmdtp, int flag, int argc,
64 c = find_cmd_tbl(argv[1], &cmd_fru_sub[0],
65 ARRAY_SIZE(cmd_fru_sub));
69 ret = c->cmd(c, flag, argc, argv);
71 return cmd_process_error(c, ret);
74 /***************************************************/
75 #ifdef CONFIG_SYS_LONGHELP
76 static char fru_help_text[] =
77 "capture <addr> - Parse and capture FRU table present at address.\n"
78 "fru display - Displays content of FRU table that was captured using\n"
79 " fru capture command\n"
80 "fru board_gen <addr> <manufacturer> <board name> <serial number>\n"
81 " <part number> <revision> - Generate FRU format with\n"
82 " board info area filled based on parameters. <addr> is\n"
83 " pointing to place where FRU is generated.\n"