prom.h 990 字节
Newer Older
1 2 3
#ifndef _PPC_BOOT_PROM_H_
#define _PPC_BOOT_PROM_H_

4 5 6
typedef void *phandle;
typedef void *ihandle;

7
extern int (*prom) (void *);
8 9
extern phandle chosen_handle;
extern ihandle stdout;
10

11 12 13
int	call_prom(const char *service, int nargs, int nret, ...);
int	call_prom_ret(const char *service, int nargs, int nret,
		      unsigned int *rets, ...);
14 15

extern int write(void *handle, void *ptr, int nb);
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
extern void *claim(unsigned long virt, unsigned long size, unsigned long aln);

static inline void exit(void)
{
	call_prom("exit", 0, 0);
}

static inline phandle finddevice(const char *name)
{
	return (phandle) call_prom("finddevice", 1, 1, name);
}

static inline int getprop(void *phandle, const char *name,
			  void *buf, int buflen)
{
	return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
}

34 35 36 37 38 39 40

static inline int setprop(void *phandle, const char *name,
			  void *buf, int buflen)
{
	return call_prom("setprop", 4, 1, phandle, name, buf, buflen);
}

41
#endif				/* _PPC_BOOT_PROM_H_ */