of_pdt.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Definitions for building a device tree by calling into the
  4. * Open Firmware PROM.
  5. *
  6. * Copyright (C) 2010 Andres Salomon <[email protected]>
  7. */
  8. #ifndef _LINUX_OF_PDT_H
  9. #define _LINUX_OF_PDT_H
  10. /* overridable operations for calling into the PROM */
  11. struct of_pdt_ops {
  12. /*
  13. * buf should be 32 bytes; return 0 on success.
  14. * If prev is NULL, the first property will be returned.
  15. */
  16. int (*nextprop)(phandle node, char *prev, char *buf);
  17. /* for both functions, return proplen on success; -1 on error */
  18. int (*getproplen)(phandle node, const char *prop);
  19. int (*getproperty)(phandle node, const char *prop, char *buf,
  20. int bufsize);
  21. /* phandles are 0 if no child or sibling exists */
  22. phandle (*getchild)(phandle parent);
  23. phandle (*getsibling)(phandle node);
  24. /* return 0 on success; fill in 'len' with number of bytes in path */
  25. int (*pkg2path)(phandle node, char *buf, const int buflen, int *len);
  26. };
  27. extern void *prom_early_alloc(unsigned long size);
  28. /* for building the device tree */
  29. extern void of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops);
  30. #endif /* _LINUX_OF_PDT_H */