18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _PPC_BOOT_OF_H_
38c2ecf20Sopenharmony_ci#define _PPC_BOOT_OF_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include "swab.h"
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_citypedef void *phandle;
88c2ecf20Sopenharmony_citypedef u32 ihandle;
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_civoid of_init(void *promptr);
118c2ecf20Sopenharmony_ciint of_call_prom(const char *service, int nargs, int nret, ...);
128c2ecf20Sopenharmony_ciunsigned int of_claim(unsigned long virt, unsigned long size,
138c2ecf20Sopenharmony_ci	unsigned long align);
148c2ecf20Sopenharmony_civoid *of_vmlinux_alloc(unsigned long size);
158c2ecf20Sopenharmony_civoid of_exit(void);
168c2ecf20Sopenharmony_civoid *of_finddevice(const char *name);
178c2ecf20Sopenharmony_ciint of_getprop(const void *phandle, const char *name, void *buf,
188c2ecf20Sopenharmony_ci	       const int buflen);
198c2ecf20Sopenharmony_ciint of_setprop(const void *phandle, const char *name, const void *buf,
208c2ecf20Sopenharmony_ci	       const int buflen);
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* Console functions */
238c2ecf20Sopenharmony_civoid of_console_init(void);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_citypedef u16			__be16;
268c2ecf20Sopenharmony_citypedef u32			__be32;
278c2ecf20Sopenharmony_citypedef u64			__be64;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN__
308c2ecf20Sopenharmony_ci#define cpu_to_be16(x) swab16(x)
318c2ecf20Sopenharmony_ci#define be16_to_cpu(x) swab16(x)
328c2ecf20Sopenharmony_ci#define cpu_to_be32(x) swab32(x)
338c2ecf20Sopenharmony_ci#define be32_to_cpu(x) swab32(x)
348c2ecf20Sopenharmony_ci#define cpu_to_be64(x) swab64(x)
358c2ecf20Sopenharmony_ci#define be64_to_cpu(x) swab64(x)
368c2ecf20Sopenharmony_ci#else
378c2ecf20Sopenharmony_ci#define cpu_to_be16(x) (x)
388c2ecf20Sopenharmony_ci#define be16_to_cpu(x) (x)
398c2ecf20Sopenharmony_ci#define cpu_to_be32(x) (x)
408c2ecf20Sopenharmony_ci#define be32_to_cpu(x) (x)
418c2ecf20Sopenharmony_ci#define cpu_to_be64(x) (x)
428c2ecf20Sopenharmony_ci#define be64_to_cpu(x) (x)
438c2ecf20Sopenharmony_ci#endif
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define PROM_ERROR (-1u)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#endif /* _PPC_BOOT_OF_H_ */
48