binman.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: Intel */
  2. /*
  3. * Access to binman information at runtime
  4. *
  5. * Copyright 2019 Google LLC
  6. * Written by Simon Glass <sjg@chromium.org>
  7. */
  8. #ifndef _BINMAN_H_
  9. #define _BINMAN_H_
  10. #include <dm/ofnode.h>
  11. /**
  12. *struct binman_entry - information about a binman entry
  13. *
  14. * @image_pos: Position of entry in the image
  15. * @size: Size of entry
  16. */
  17. struct binman_entry {
  18. u32 image_pos;
  19. u32 size;
  20. };
  21. /**
  22. * binman_entry_map() - Look up the address of an entry in memory
  23. *
  24. * @parent: Parent binman node
  25. * @name: Name of entry
  26. * @bufp: Returns a pointer to the entry
  27. * @sizep: Returns the size of the entry
  28. * @return 0 on success, -EPERM if the ROM offset is not set, -ENOENT if the
  29. * entry cannot be found, other error code other error
  30. */
  31. int binman_entry_map(ofnode parent, const char *name, void **bufp, int *sizep);
  32. /**
  33. * binman_set_rom_offset() - Set the ROM memory-map offset
  34. *
  35. * @rom_offset: Offset from an image_pos to the memory-mapped address. This
  36. * tells binman that ROM image_pos x can be addressed at rom_offset + x
  37. */
  38. void binman_set_rom_offset(int rom_offset);
  39. /**
  40. * binman_entry_find() - Find a binman symbol
  41. *
  42. * This searches the binman information in the device tree for a symbol of the
  43. * given name
  44. *
  45. * @name: Path to entry to examine (e.g. "/read-only/u-boot")
  46. * @entry: Returns information about the entry
  47. * @return 0 if OK, -ENOENT if the path is not found, other -ve value if the
  48. * binman information is invalid (missing image-pos or size)
  49. */
  50. int binman_entry_find(const char *name, struct binman_entry *entry);
  51. /**
  52. * binman_section_find_node() - Find a binman node
  53. *
  54. * @name: Name of node to look for
  55. * @return Node that was found, ofnode_null() if not found
  56. */
  57. ofnode binman_section_find_node(const char *name);
  58. /**
  59. * binman_init() - Set up the binman symbol information
  60. *
  61. * This locates the binary symbol information in the device tree ready for use
  62. *
  63. * @return 0 if OK, -ENOMEM if out of memory, -EINVAL if there is no binman node
  64. */
  65. int binman_init(void);
  66. #endif