Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
David Gibson | 2e60161 | 2007-06-13 14:52:54 +1000 | [diff] [blame] | 2 | #ifndef _PPC_BOOT_OF_H_ |
| 3 | #define _PPC_BOOT_OF_H_ |
| 4 | |
Cédric Le Goater | 98fd433 | 2014-04-24 09:23:33 +0200 | [diff] [blame] | 5 | #include "swab.h" |
| 6 | |
David Gibson | 2e60161 | 2007-06-13 14:52:54 +1000 | [diff] [blame] | 7 | typedef void *phandle; |
Cédric Le Goater | 6413010 | 2014-04-24 09:23:31 +0200 | [diff] [blame] | 8 | typedef u32 ihandle; |
David Gibson | 2e60161 | 2007-06-13 14:52:54 +1000 | [diff] [blame] | 9 | |
| 10 | void of_init(void *promptr); |
| 11 | int of_call_prom(const char *service, int nargs, int nret, ...); |
Cédric Le Goater | 034e55e | 2014-04-24 09:23:30 +0200 | [diff] [blame] | 12 | unsigned int of_claim(unsigned long virt, unsigned long size, |
| 13 | unsigned long align); |
David Gibson | 0846471 | 2007-06-27 16:54:58 +1000 | [diff] [blame] | 14 | void *of_vmlinux_alloc(unsigned long size); |
David Gibson | 2e60161 | 2007-06-13 14:52:54 +1000 | [diff] [blame] | 15 | void of_exit(void); |
David Gibson | 0846471 | 2007-06-27 16:54:58 +1000 | [diff] [blame] | 16 | void *of_finddevice(const char *name); |
| 17 | int of_getprop(const void *phandle, const char *name, void *buf, |
| 18 | const int buflen); |
| 19 | int of_setprop(const void *phandle, const char *name, const void *buf, |
| 20 | const int buflen); |
David Gibson | 2e60161 | 2007-06-13 14:52:54 +1000 | [diff] [blame] | 21 | |
| 22 | /* Console functions */ |
| 23 | void of_console_init(void); |
| 24 | |
Rob Herring | f1ec718 | 2015-04-29 16:02:30 -0500 | [diff] [blame] | 25 | typedef u16 __be16; |
Cédric Le Goater | fed23ed | 2014-04-24 09:23:26 +0200 | [diff] [blame] | 26 | typedef u32 __be32; |
Rob Herring | f1ec718 | 2015-04-29 16:02:30 -0500 | [diff] [blame] | 27 | typedef u64 __be64; |
Cédric Le Goater | fed23ed | 2014-04-24 09:23:26 +0200 | [diff] [blame] | 28 | |
Cédric Le Goater | 98fd433 | 2014-04-24 09:23:33 +0200 | [diff] [blame] | 29 | #ifdef __LITTLE_ENDIAN__ |
Jeremy Kerr | 6c87b22 | 2015-02-11 12:55:44 +0800 | [diff] [blame] | 30 | #define cpu_to_be16(x) swab16(x) |
| 31 | #define be16_to_cpu(x) swab16(x) |
Cédric Le Goater | 98fd433 | 2014-04-24 09:23:33 +0200 | [diff] [blame] | 32 | #define cpu_to_be32(x) swab32(x) |
| 33 | #define be32_to_cpu(x) swab32(x) |
Jeremy Kerr | 6c87b22 | 2015-02-11 12:55:44 +0800 | [diff] [blame] | 34 | #define cpu_to_be64(x) swab64(x) |
| 35 | #define be64_to_cpu(x) swab64(x) |
Cédric Le Goater | 98fd433 | 2014-04-24 09:23:33 +0200 | [diff] [blame] | 36 | #else |
Jeremy Kerr | 6c87b22 | 2015-02-11 12:55:44 +0800 | [diff] [blame] | 37 | #define cpu_to_be16(x) (x) |
| 38 | #define be16_to_cpu(x) (x) |
Cédric Le Goater | 926e694 | 2014-04-24 09:23:28 +0200 | [diff] [blame] | 39 | #define cpu_to_be32(x) (x) |
| 40 | #define be32_to_cpu(x) (x) |
Jeremy Kerr | 6c87b22 | 2015-02-11 12:55:44 +0800 | [diff] [blame] | 41 | #define cpu_to_be64(x) (x) |
| 42 | #define be64_to_cpu(x) (x) |
Cédric Le Goater | 98fd433 | 2014-04-24 09:23:33 +0200 | [diff] [blame] | 43 | #endif |
Cédric Le Goater | 926e694 | 2014-04-24 09:23:28 +0200 | [diff] [blame] | 44 | |
Cédric Le Goater | 9cc36bb | 2014-04-24 09:23:29 +0200 | [diff] [blame] | 45 | #define PROM_ERROR (-1u) |
| 46 | |
David Gibson | 2e60161 | 2007-06-13 14:52:54 +1000 | [diff] [blame] | 47 | #endif /* _PPC_BOOT_OF_H_ */ |