aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc/prom.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ppc/prom.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-ppc/prom.h')
-rw-r--r--include/asm-ppc/prom.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
new file mode 100644
index 000000000000..56394c6cf52e
--- /dev/null
+++ b/include/asm-ppc/prom.h
@@ -0,0 +1,143 @@
1/*
2 * Definitions for talking to the Open Firmware PROM on
3 * Power Macintosh computers.
4 *
5 * Copyright (C) 1996 Paul Mackerras.
6 */
7#ifdef __KERNEL__
8#ifndef _PPC_PROM_H
9#define _PPC_PROM_H
10
11#include <linux/config.h>
12#include <linux/types.h>
13
14typedef u32 phandle;
15typedef u32 ihandle;
16
17extern char *prom_display_paths[];
18extern unsigned int prom_num_displays;
19
20struct address_range {
21 unsigned int space;
22 unsigned int address;
23 unsigned int size;
24};
25
26struct interrupt_info {
27 int line;
28 int sense; /* +ve/-ve logic, edge or level, etc. */
29};
30
31struct reg_property {
32 unsigned int address;
33 unsigned int size;
34};
35
36struct property {
37 char *name;
38 int length;
39 unsigned char *value;
40 struct property *next;
41};
42
43/*
44 * Note: don't change this structure for now or you'll break BootX !
45 */
46struct device_node {
47 char *name;
48 char *type;
49 phandle node;
50 int n_addrs;
51 struct address_range *addrs;
52 int n_intrs;
53 struct interrupt_info *intrs;
54 char *full_name;
55 struct property *properties;
56 struct device_node *parent;
57 struct device_node *child;
58 struct device_node *sibling;
59 struct device_node *next; /* next device of same type */
60 struct device_node *allnext; /* next in list of all nodes */
61};
62
63struct prom_args;
64typedef void (*prom_entry)(struct prom_args *);
65
66/* OBSOLETE: Old style node lookup */
67extern struct device_node *find_devices(const char *name);
68extern struct device_node *find_type_devices(const char *type);
69extern struct device_node *find_path_device(const char *path);
70extern struct device_node *find_compatible_devices(const char *type,
71 const char *compat);
72extern struct device_node *find_all_nodes(void);
73
74/* New style node lookup */
75extern struct device_node *of_find_node_by_name(struct device_node *from,
76 const char *name);
77extern struct device_node *of_find_node_by_type(struct device_node *from,
78 const char *type);
79extern struct device_node *of_find_compatible_node(struct device_node *from,
80 const char *type, const char *compat);
81extern struct device_node *of_find_node_by_path(const char *path);
82extern struct device_node *of_find_all_nodes(struct device_node *prev);
83extern struct device_node *of_get_parent(const struct device_node *node);
84extern struct device_node *of_get_next_child(const struct device_node *node,
85 struct device_node *prev);
86extern struct device_node *of_node_get(struct device_node *node);
87extern void of_node_put(struct device_node *node);
88
89/* Other Prototypes */
90extern void abort(void);
91extern unsigned long prom_init(int, int, prom_entry);
92extern void prom_print(const char *msg);
93extern void relocate_nodes(void);
94extern void finish_device_tree(void);
95extern int device_is_compatible(struct device_node *device, const char *);
96extern int machine_is_compatible(const char *compat);
97extern unsigned char *get_property(struct device_node *node, const char *name,
98 int *lenp);
99extern void prom_add_property(struct device_node* np, struct property* prop);
100extern void prom_get_irq_senses(unsigned char *, int, int);
101extern int prom_n_addr_cells(struct device_node* np);
102extern int prom_n_size_cells(struct device_node* np);
103
104extern struct resource*
105request_OF_resource(struct device_node* node, int index, const char* name_postfix);
106extern int release_OF_resource(struct device_node* node, int index);
107
108extern void print_properties(struct device_node *node);
109extern int call_rtas(const char *service, int nargs, int nret,
110 unsigned long *outputs, ...);
111
112/*
113 * PCI <-> OF matching functions
114 */
115struct pci_bus;
116struct pci_dev;
117extern int pci_device_from_OF_node(struct device_node *node,
118 u8* bus, u8* devfn);
119extern struct device_node* pci_busdev_to_OF_node(struct pci_bus *, int);
120extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
121extern void pci_create_OF_bus_map(void);
122
123/*
124 * When we call back to the Open Firmware client interface, we usually
125 * have to do that before the kernel is relocated to its final location
126 * (this is because we can't use OF after we have overwritten the
127 * exception vectors with our exception handlers). These macros assist
128 * in performing the address calculations that we need to do to access
129 * data when the kernel is running at an address that is different from
130 * the address that the kernel is linked at. The reloc_offset() function
131 * returns the difference between these two addresses and the macros
132 * simplify the process of adding or subtracting this offset to/from
133 * pointer values. See arch/ppc/kernel/prom.c for how these are used.
134 */
135extern unsigned long reloc_offset(void);
136extern unsigned long add_reloc_offset(unsigned long);
137extern unsigned long sub_reloc_offset(unsigned long);
138
139#define PTRRELOC(x) ((typeof(x))add_reloc_offset((unsigned long)(x)))
140#define PTRUNRELOC(x) ((typeof(x))sub_reloc_offset((unsigned long)(x)))
141
142#endif /* _PPC_PROM_H */
143#endif /* __KERNEL__ */