1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5 * Inspired by cmd_ext_common.c, cmd_fat.c.
11 #include <efi_loader.h>
13 static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
15 return do_size(cmdtp, flag, argc, argv, FS_TYPE_ANY);
19 size, 4, 0, do_size_wrapper,
20 "determine a file's size",
21 "<interface> <dev[:part]> <filename>\n"
22 " - Find file 'filename' from 'dev' on 'interface'\n"
23 " and determine its size."
26 static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
29 #ifdef CONFIG_CMD_BOOTEFI
30 efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
31 (argc > 4) ? argv[4] : "");
33 return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
37 load, 7, 0, do_load_wrapper,
38 "load binary file from a filesystem",
39 "<interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]\n"
40 " - Load binary file 'filename' from partition 'part' on device\n"
41 " type 'interface' instance 'dev' to address 'addr' in memory.\n"
42 " 'bytes' gives the size to load in bytes.\n"
43 " If 'bytes' is 0 or omitted, the file is read until the end.\n"
44 " 'pos' gives the file byte position to start reading from.\n"
45 " If 'pos' is 0 or omitted, the file is read from the start."
48 static int do_save_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
51 return do_save(cmdtp, flag, argc, argv, FS_TYPE_ANY);
55 save, 7, 0, do_save_wrapper,
56 "save file to a filesystem",
57 "<interface> <dev[:part]> <addr> <filename> bytes [pos]\n"
58 " - Save binary file 'filename' to partition 'part' on device\n"
59 " type 'interface' instance 'dev' from addr 'addr' in memory.\n"
60 " 'bytes' gives the size to save in bytes and is mandatory.\n"
61 " 'pos' gives the file byte position to start writing to.\n"
62 " If 'pos' is 0 or omitted, the file is written from the start."
65 static int do_ls_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
68 return do_ls(cmdtp, flag, argc, argv, FS_TYPE_ANY);
72 ls, 4, 1, do_ls_wrapper,
73 "list files in a directory (default /)",
74 "<interface> [<dev[:part]> [directory]]\n"
75 " - List files in directory 'directory' of partition 'part' on\n"
76 " device type 'interface' instance 'dev'."
79 static int do_fstype_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
82 return do_fs_type(cmdtp, flag, argc, argv);
86 fstype, 4, 1, do_fstype_wrapper,
87 "Look up a filesystem type",
88 "<interface> <dev>:<part>\n"
89 "- print filesystem type\n"
90 "fstype <interface> <dev>:<part> <varname>\n"
91 "- set environment variable to filesystem type\n"