blob: 53f8f27f94e4e57d37d0f8bb6ebc9a17e32b506e [file] [log] [blame]
David Gibson2e601612007-06-13 14:52:54 +10001#ifndef _PPC_BOOT_OF_H_
2#define _PPC_BOOT_OF_H_
3
Cédric Le Goater98fd4332014-04-24 09:23:33 +02004#include "swab.h"
5
David Gibson2e601612007-06-13 14:52:54 +10006typedef void *phandle;
Cédric Le Goater64130102014-04-24 09:23:31 +02007typedef u32 ihandle;
David Gibson2e601612007-06-13 14:52:54 +10008
9void of_init(void *promptr);
10int of_call_prom(const char *service, int nargs, int nret, ...);
Cédric Le Goater034e55e2014-04-24 09:23:30 +020011unsigned int of_claim(unsigned long virt, unsigned long size,
12 unsigned long align);
David Gibson08464712007-06-27 16:54:58 +100013void *of_vmlinux_alloc(unsigned long size);
David Gibson2e601612007-06-13 14:52:54 +100014void of_exit(void);
David Gibson08464712007-06-27 16:54:58 +100015void *of_finddevice(const char *name);
16int of_getprop(const void *phandle, const char *name, void *buf,
17 const int buflen);
18int of_setprop(const void *phandle, const char *name, const void *buf,
19 const int buflen);
David Gibson2e601612007-06-13 14:52:54 +100020
21/* Console functions */
22void of_console_init(void);
23
Rob Herringf1ec7182015-04-29 16:02:30 -050024typedef u16 __be16;
Cédric Le Goaterfed23ed2014-04-24 09:23:26 +020025typedef u32 __be32;
Rob Herringf1ec7182015-04-29 16:02:30 -050026typedef u64 __be64;
Cédric Le Goaterfed23ed2014-04-24 09:23:26 +020027
Cédric Le Goater98fd4332014-04-24 09:23:33 +020028#ifdef __LITTLE_ENDIAN__
Jeremy Kerr6c87b222015-02-11 12:55:44 +080029#define cpu_to_be16(x) swab16(x)
30#define be16_to_cpu(x) swab16(x)
Cédric Le Goater98fd4332014-04-24 09:23:33 +020031#define cpu_to_be32(x) swab32(x)
32#define be32_to_cpu(x) swab32(x)
Jeremy Kerr6c87b222015-02-11 12:55:44 +080033#define cpu_to_be64(x) swab64(x)
34#define be64_to_cpu(x) swab64(x)
Cédric Le Goater98fd4332014-04-24 09:23:33 +020035#else
Jeremy Kerr6c87b222015-02-11 12:55:44 +080036#define cpu_to_be16(x) (x)
37#define be16_to_cpu(x) (x)
Cédric Le Goater926e6942014-04-24 09:23:28 +020038#define cpu_to_be32(x) (x)
39#define be32_to_cpu(x) (x)
Jeremy Kerr6c87b222015-02-11 12:55:44 +080040#define cpu_to_be64(x) (x)
41#define be64_to_cpu(x) (x)
Cédric Le Goater98fd4332014-04-24 09:23:33 +020042#endif
Cédric Le Goater926e6942014-04-24 09:23:28 +020043
Cédric Le Goater9cc36bb2014-04-24 09:23:29 +020044#define PROM_ERROR (-1u)
45
David Gibson2e601612007-06-13 14:52:54 +100046#endif /* _PPC_BOOT_OF_H_ */