of.h 1.1 KB

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