util.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2013 Google, Inc
  4. */
  5. #ifndef __DM_UTIL_H
  6. #define __DM_UTIL_H
  7. #ifdef CONFIG_DM_WARN
  8. void dm_warn(const char *fmt, ...);
  9. #else
  10. static inline void dm_warn(const char *fmt, ...)
  11. {
  12. }
  13. #endif
  14. struct list_head;
  15. /**
  16. * list_count_items() - Count number of items in a list
  17. *
  18. * @param head: Head of list
  19. * @return number of items, or 0 if empty
  20. */
  21. int list_count_items(struct list_head *head);
  22. /* Dump out a tree of all devices */
  23. void dm_dump_all(void);
  24. /* Dump out a list of uclasses and their devices */
  25. void dm_dump_uclass(void);
  26. #ifdef CONFIG_DEBUG_DEVRES
  27. /* Dump out a list of device resources */
  28. void dm_dump_devres(void);
  29. #else
  30. static inline void dm_dump_devres(void)
  31. {
  32. }
  33. #endif
  34. /**
  35. * Check if a dt node should be or was bound before relocation.
  36. *
  37. * Devicetree nodes can be marked as needed to be bound
  38. * in the loader stages via special devicetree properties.
  39. *
  40. * Before relocation this function can be used to check if nodes
  41. * are required in either SPL or TPL stages.
  42. *
  43. * After relocation and jumping into the real U-Boot binary
  44. * it is possible to determine if a node was bound in one of
  45. * SPL/TPL stages.
  46. *
  47. * There are 3 settings currently in use
  48. * -
  49. * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
  50. * Existing platforms only use it to indicate nodes needee in
  51. * SPL. Should probably be replaced by u-boot,dm-spl for
  52. * existing platforms.
  53. * @blob: devicetree
  54. * @offset: node offset
  55. *
  56. * Returns true if node is needed in SPL/TL, false otherwise.
  57. */
  58. bool dm_fdt_pre_reloc(const void *blob, int offset);
  59. #endif