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