Olaf Hering | decd300 | 2005-08-08 13:24:38 +1000 | [diff] [blame] | 1 | #ifndef _PPC_BOOT_PROM_H_ |
| 2 | #define _PPC_BOOT_PROM_H_ |
| 3 | |
Paul Mackerras | 66a45dd | 2006-01-14 15:04:06 +1100 | [diff] [blame] | 4 | typedef void *phandle; |
| 5 | typedef void *ihandle; |
Olaf Hering | decd300 | 2005-08-08 13:24:38 +1000 | [diff] [blame] | 6 | |
Paul Mackerras | 66a45dd | 2006-01-14 15:04:06 +1100 | [diff] [blame] | 7 | extern int (*prom) (void *); |
| 8 | extern phandle chosen_handle; |
| 9 | extern ihandle stdout; |
| 10 | |
| 11 | int call_prom(const char *service, int nargs, int nret, ...); |
| 12 | int call_prom_ret(const char *service, int nargs, int nret, |
| 13 | unsigned int *rets, ...); |
Olaf Hering | decd300 | 2005-08-08 13:24:38 +1000 | [diff] [blame] | 14 | |
| 15 | extern int write(void *handle, void *ptr, int nb); |
Paul Mackerras | 66a45dd | 2006-01-14 15:04:06 +1100 | [diff] [blame] | 16 | extern void *claim(unsigned long virt, unsigned long size, unsigned long aln); |
| 17 | |
| 18 | static inline void exit(void) |
| 19 | { |
| 20 | call_prom("exit", 0, 0); |
| 21 | } |
| 22 | |
| 23 | static inline phandle finddevice(const char *name) |
| 24 | { |
| 25 | return (phandle) call_prom("finddevice", 1, 1, name); |
| 26 | } |
| 27 | |
| 28 | static inline int getprop(void *phandle, const char *name, |
| 29 | void *buf, int buflen) |
| 30 | { |
| 31 | return call_prom("getprop", 4, 1, phandle, name, buf, buflen); |
| 32 | } |
| 33 | |
Olaf Hering | decd300 | 2005-08-08 13:24:38 +1000 | [diff] [blame] | 34 | #endif /* _PPC_BOOT_PROM_H_ */ |