autoboot.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * Add to readline cmdline-editing by
  7. * (C) Copyright 2005
  8. * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
  9. */
  10. #ifndef __AUTOBOOT_H
  11. #define __AUTOBOOT_H
  12. #include <stdbool.h>
  13. #ifdef CONFIG_SANDBOX
  14. /**
  15. * autoboot_keyed() - check whether keyed autoboot should be used
  16. *
  17. * This is only implemented for sandbox since other platforms don't have a way
  18. * of controlling the feature at runtime.
  19. *
  20. * @return true if enabled, false if not
  21. */
  22. bool autoboot_keyed(void);
  23. /**
  24. * autoboot_set_keyed() - set whether keyed autoboot should be used
  25. *
  26. * @autoboot_keyed: true to enable the feature, false to disable
  27. * @return old value of the flag
  28. */
  29. bool autoboot_set_keyed(bool autoboot_keyed);
  30. #else
  31. static inline bool autoboot_keyed(void)
  32. {
  33. /* There is no runtime flag, so just use the CONFIG */
  34. return IS_ENABLED(CONFIG_AUTOBOOT_KEYED);
  35. }
  36. static inline bool autoboot_set_keyed(bool autoboot_keyed)
  37. {
  38. /* There is no runtime flag to set */
  39. return false;
  40. }
  41. #endif
  42. #ifdef CONFIG_AUTOBOOT
  43. /**
  44. * bootdelay_process() - process the bootd delay
  45. *
  46. * Process the boot delay, boot limit, then get the value of either
  47. * bootcmd, failbootcmd or altbootcmd depending on the current state.
  48. * Return this command so it can be executed.
  49. *
  50. * @return command to executed
  51. */
  52. const char *bootdelay_process(void);
  53. /**
  54. * autoboot_command() - run the autoboot command
  55. *
  56. * If enabled, run the autoboot command returned from bootdelay_process().
  57. * Also do the CONFIG_AUTOBOOT_MENUKEY processing if enabled.
  58. *
  59. * @cmd: Command to run
  60. */
  61. void autoboot_command(const char *cmd);
  62. #else
  63. static inline const char *bootdelay_process(void)
  64. {
  65. return NULL;
  66. }
  67. static inline void autoboot_command(const char *s)
  68. {
  69. }
  70. #endif
  71. #endif