1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
22e601613SDavid Gibson#ifndef _PPC_BOOT_OF_H_
32e601613SDavid Gibson#define _PPC_BOOT_OF_H_
42e601613SDavid Gibson
598fd433aSCédric Le Goater#include "swab.h"
698fd433aSCédric Le Goater
72e601613SDavid Gibsontypedef void *phandle;
864130109SCédric Le Goatertypedef u32 ihandle;
92e601613SDavid Gibson
102e601613SDavid Gibsonvoid of_init(void *promptr);
112e601613SDavid Gibsonint of_call_prom(const char *service, int nargs, int nret, ...);
12034e55e6SCédric Le Goaterunsigned int of_claim(unsigned long virt, unsigned long size,
13034e55e6SCédric Le Goater	unsigned long align);
1408464712SDavid Gibsonvoid *of_vmlinux_alloc(unsigned long size);
152e601613SDavid Gibsonvoid of_exit(void);
1608464712SDavid Gibsonvoid *of_finddevice(const char *name);
1708464712SDavid Gibsonint of_getprop(const void *phandle, const char *name, void *buf,
1808464712SDavid Gibson	       const int buflen);
1908464712SDavid Gibsonint of_setprop(const void *phandle, const char *name, const void *buf,
2008464712SDavid Gibson	       const int buflen);
212e601613SDavid Gibson
222e601613SDavid Gibson/* Console functions */
232e601613SDavid Gibsonvoid of_console_init(void);
242e601613SDavid Gibson
25f1ec7187SRob Herringtypedef u16			__be16;
26fed23ed7SCédric Le Goatertypedef u32			__be32;
27f1ec7187SRob Herringtypedef u64			__be64;
28fed23ed7SCédric Le Goater
2998fd433aSCédric Le Goater#ifdef __LITTLE_ENDIAN__
306c87b220SJeremy Kerr#define cpu_to_be16(x) swab16(x)
316c87b220SJeremy Kerr#define be16_to_cpu(x) swab16(x)
3298fd433aSCédric Le Goater#define cpu_to_be32(x) swab32(x)
3398fd433aSCédric Le Goater#define be32_to_cpu(x) swab32(x)
346c87b220SJeremy Kerr#define cpu_to_be64(x) swab64(x)
356c87b220SJeremy Kerr#define be64_to_cpu(x) swab64(x)
3698fd433aSCédric Le Goater#else
376c87b220SJeremy Kerr#define cpu_to_be16(x) (x)
386c87b220SJeremy Kerr#define be16_to_cpu(x) (x)
39926e6940SCédric Le Goater#define cpu_to_be32(x) (x)
40926e6940SCédric Le Goater#define be32_to_cpu(x) (x)
416c87b220SJeremy Kerr#define cpu_to_be64(x) (x)
426c87b220SJeremy Kerr#define be64_to_cpu(x) (x)
4398fd433aSCédric Le Goater#endif
44926e6940SCédric Le Goater
459cc36bb0SCédric Le Goater#define PROM_ERROR (-1u)
469cc36bb0SCédric Le Goater
472e601613SDavid Gibson#endif /* _PPC_BOOT_OF_H_ */
48