binman.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_get_rom_offset() - Get the ROM memory-map offset
  41. *
  42. * @returns offset from an image_pos to the memory-mapped address
  43. */
  44. int binman_get_rom_offset(void);
  45. /**
  46. * binman_entry_find() - Find a binman symbol
  47. *
  48. * This searches the binman information in the device tree for a symbol of the
  49. * given name
  50. *
  51. * @name: Path to entry to examine (e.g. "/read-only/u-boot")
  52. * @entry: Returns information about the entry
  53. * @return 0 if OK, -ENOENT if the path is not found, other -ve value if the
  54. * binman information is invalid (missing image-pos or size)
  55. */
  56. int binman_entry_find(const char *name, struct binman_entry *entry);
  57. /**
  58. * binman_section_find_node() - Find a binman node
  59. *
  60. * @name: Name of node to look for
  61. * @return Node that was found, ofnode_null() if not found
  62. */
  63. ofnode binman_section_find_node(const char *name);
  64. /**
  65. * binman_init() - Set up the binman symbol information
  66. *
  67. * This locates the binary symbol information in the device tree ready for use
  68. *
  69. * @return 0 if OK, -ENOMEM if out of memory, -EINVAL if there is no binman node
  70. */
  71. int binman_init(void);
  72. #endif