summaryrefslogtreecommitdiffstats
path: root/include/asm-ppc/prom.h
blob: 9dd8609810abcc9ff7791aa8514c8826d9a1900f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Definitions for talking to the Open Firmware PROM on
 * Power Macintosh computers.
 *
 * Copyright (C) 1996 Paul Mackerras.
 */

typedef void *phandle;
typedef void *ihandle;

#ifndef FB_MAX
#define FB_MAX	8	/* I don't want to include the whole console stuff */
#endif
extern char *prom_display_paths[FB_MAX];
extern unsigned int prom_num_displays;

struct address_range {
	unsigned int space;
	unsigned int address;
	unsigned int size;
};

struct interrupt_info {
	int	line;
	int	sense;		/* +ve/-ve logic, edge or level, etc. */
};

struct reg_property {
	unsigned int address;
	unsigned int size;
};

struct translation_property {
	unsigned int virt;
	unsigned int size;
	unsigned int phys;
	unsigned int flags;
};

struct property {
	char	*name;
	int	length;
	unsigned char *value;
	struct property *next;
};

struct device_node {
	char	*name;
	char	*type;
	phandle	node;
	int	n_addrs;
	struct	address_range *addrs;
	int	n_intrs;
	struct	interrupt_info *intrs;
	char	*full_name;
	struct	property *properties;
	struct	device_node *parent;
	struct	device_node *child;
	struct	device_node *sibling;
	struct	device_node *next;	/* next device of same type */
	struct	device_node *allnext;	/* next in list of all nodes */
};

struct prom_args;
typedef void (*prom_entry)(struct prom_args *);

/* Prototypes */
void abort(void);
void prom_init(int, int, prom_entry);
void finish_device_tree(void);
struct device_node *find_devices(const char *name);
struct device_node *find_type_devices(const char *type);
struct device_node *find_path_device(const char *path);
struct device_node *find_compatible_devices(const char *type,
					    const char *compat);
struct device_node *find_phandle(phandle);
unsigned char *get_property(struct device_node *node, const char *name,
	int *lenp);
void print_properties(struct device_node *node);
int call_rtas(const char *service, int nargs, int nret,
	      unsigned long *outputs, ...);