of.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _PPC_BOOT_OF_H_
  3. #define _PPC_BOOT_OF_H_
  4. #include "swab.h"
  5. typedef void *phandle;
  6. typedef u32 ihandle;
  7. void of_init(void *promptr);
  8. int of_call_prom(const char *service, int nargs, int nret, ...);
  9. unsigned int of_claim(unsigned long virt, unsigned long size,
  10. unsigned long align);
  11. void *of_vmlinux_alloc(unsigned long size);
  12. void of_exit(void);
  13. void *of_finddevice(const char *name);
  14. int of_getprop(const void *phandle, const char *name, void *buf,
  15. const int buflen);
  16. int of_setprop(const void *phandle, const char *name, const void *buf,
  17. const int buflen);
  18. /* Console functions */
  19. void of_console_init(void);
  20. typedef u16 __be16;
  21. typedef u32 __be32;
  22. typedef u64 __be64;
  23. #ifdef __LITTLE_ENDIAN__
  24. #define cpu_to_be16(x) swab16(x)
  25. #define be16_to_cpu(x) swab16(x)
  26. #define cpu_to_be32(x) swab32(x)
  27. #define be32_to_cpu(x) swab32(x)
  28. #define cpu_to_be64(x) swab64(x)
  29. #define be64_to_cpu(x) swab64(x)
  30. #else
  31. #define cpu_to_be16(x) (x)
  32. #define be16_to_cpu(x) (x)
  33. #define cpu_to_be32(x) (x)
  34. #define be32_to_cpu(x) (x)
  35. #define cpu_to_be64(x) (x)
  36. #define be64_to_cpu(x) (x)
  37. #endif
  38. #define PROM_ERROR (-1u)
  39. #endif /* _PPC_BOOT_OF_H_ */