X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fcli.h;h=39b913743b55089266a38a32c6e94b9bb3cb077e;hb=f643fb9f4c8fc5c5dceb8c2c2893447d18413d77;hp=10dbc6665153427c215bed6fffdf65f8a222ef4e;hpb=b26440f1fa243396000536028ea00e5e185b6b6a;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/cli.h b/include/cli.h index 10dbc66..39b9137 100644 --- a/include/cli.h +++ b/include/cli.h @@ -1,8 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2014 Google, Inc * Simon Glass - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CLI_H @@ -14,7 +13,7 @@ * This will return if we get a timeout waiting for a command. See * CONFIG_BOOT_RETRY_TIME. */ -void cli_loop(void); +void cli_simple_loop(void); /** * cli_simple_run_command() - Execute a command with the simple CLI @@ -31,6 +30,14 @@ void cli_loop(void); int cli_simple_run_command(const char *cmd, int flag); /** + * cli_simple_process_macros() - Expand $() and ${} format env. variables + * + * @param input Input string possible containing $() / ${} vars + * @param output Output string with $() / ${} vars expanded + */ +void cli_simple_process_macros(const char *input, char *output); + +/** * cli_simple_run_command_list() - Execute a list of command * * The commands should be separated by ; or \n and will be executed @@ -100,6 +107,50 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, */ int cli_simple_parse_line(char *line, char *argv[]); +#if CONFIG_IS_ENABLED(OF_CONTROL) +/** + * cli_process_fdt() - process the boot command from the FDT + * + * If bootcmmd is defined in the /config node of the FDT, we use that + * as the boot command. Further, if bootsecure is set to 1 (in the same + * node) then we return true, indicating that the command should be executed + * as securely as possible, avoiding the CLI parser. + * + * @cmdp: On entry, the command that will be executed if the FDT does + * not have a command. Returns the command to execute after + * checking the FDT. + * @return true to execute securely, else false + */ +bool cli_process_fdt(const char **cmdp); + +/** cli_secure_boot_cmd() - execute a command as securely as possible + * + * This avoids using the parser, thus executing the command with the + * smallest amount of code. Parameters are not supported. + */ +void cli_secure_boot_cmd(const char *cmd); +#else +static inline bool cli_process_fdt(const char **cmdp) +{ + return false; +} + +static inline void cli_secure_boot_cmd(const char *cmd) +{ +} +#endif /* CONFIG_OF_CONTROL */ + +/** + * Go into the command loop + * + * This will return if we get a timeout waiting for a command, but only for + * the simple parser (not hush). See CONFIG_BOOT_RETRY_TIME. + */ +void cli_loop(void); + +/** Set up the command line interpreter ready for action */ +void cli_init(void); + #define endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk()) #endif