blob: 5603320dce07dc55b5c84f36dc834617f6db4597 [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
Cédric Le Goaterfed23ed2014-04-24 09:23:26 +020024typedef u32 __be32;
25
Cédric Le Goater98fd4332014-04-24 09:23:33 +020026#ifdef __LITTLE_ENDIAN__
Jeremy Kerr6c87b222015-02-11 12:55:44 +080027#define cpu_to_be16(x) swab16(x)
28#define be16_to_cpu(x) swab16(x)
Cédric Le Goater98fd4332014-04-24 09:23:33 +020029#define cpu_to_be32(x) swab32(x)
30#define be32_to_cpu(x) swab32(x)
Jeremy Kerr6c87b222015-02-11 12:55:44 +080031#define cpu_to_be64(x) swab64(x)
32#define be64_to_cpu(x) swab64(x)
Cédric Le Goater98fd4332014-04-24 09:23:33 +020033#else
Jeremy Kerr6c87b222015-02-11 12:55:44 +080034#define cpu_to_be16(x) (x)
35#define be16_to_cpu(x) (x)
Cédric Le Goater926e6942014-04-24 09:23:28 +020036#define cpu_to_be32(x) (x)
37#define be32_to_cpu(x) (x)
Jeremy Kerr6c87b222015-02-11 12:55:44 +080038#define cpu_to_be64(x) (x)
39#define be64_to_cpu(x) (x)
Cédric Le Goater98fd4332014-04-24 09:23:33 +020040#endif
Cédric Le Goater926e6942014-04-24 09:23:28 +020041
Cédric Le Goater9cc36bb2014-04-24 09:23:29 +020042#define PROM_ERROR (-1u)
43
David Gibson2e601612007-06-13 14:52:54 +100044#endif /* _PPC_BOOT_OF_H_ */