diff options
Diffstat (limited to 'include/asm-ppc/prom.h')
-rw-r--r-- | include/asm-ppc/prom.h | 143 |
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 | |||
14 | typedef u32 phandle; | ||
15 | typedef u32 ihandle; | ||
16 | |||
17 | extern char *prom_display_paths[]; | ||
18 | extern unsigned int prom_num_displays; | ||
19 | |||
20 | struct address_range { | ||
21 | unsigned int space; | ||
22 | unsigned int address; | ||
23 | unsigned int size; | ||
24 | }; | ||
25 | |||
26 | struct interrupt_info { | ||
27 | int line; | ||
28 | int sense; /* +ve/-ve logic, edge or level, etc. */ | ||
29 | }; | ||
30 | |||
31 | struct reg_property { | ||
32 | unsigned int address; | ||
33 | unsigned int size; | ||
34 | }; | ||
35 | |||
36 | struct 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 | */ | ||
46 | struct 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 | |||
63 | struct prom_args; | ||
64 | typedef void (*prom_entry)(struct prom_args *); | ||
65 | |||
66 | /* OBSOLETE: Old style node lookup */ | ||
67 | extern struct device_node *find_devices(const char *name); | ||
68 | extern struct device_node *find_type_devices(const char *type); | ||
69 | extern struct device_node *find_path_device(const char *path); | ||
70 | extern struct device_node *find_compatible_devices(const char *type, | ||
71 | const char *compat); | ||
72 | extern struct device_node *find_all_nodes(void); | ||
73 | |||
74 | /* New style node lookup */ | ||
75 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
76 | const char *name); | ||
77 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
78 | const char *type); | ||
79 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
80 | const char *type, const char *compat); | ||
81 | extern struct device_node *of_find_node_by_path(const char *path); | ||
82 | extern struct device_node *of_find_all_nodes(struct device_node *prev); | ||
83 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
84 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
85 | struct device_node *prev); | ||
86 | extern struct device_node *of_node_get(struct device_node *node); | ||
87 | extern void of_node_put(struct device_node *node); | ||
88 | |||
89 | /* Other Prototypes */ | ||
90 | extern void abort(void); | ||
91 | extern unsigned long prom_init(int, int, prom_entry); | ||
92 | extern void prom_print(const char *msg); | ||
93 | extern void relocate_nodes(void); | ||
94 | extern void finish_device_tree(void); | ||
95 | extern int device_is_compatible(struct device_node *device, const char *); | ||
96 | extern int machine_is_compatible(const char *compat); | ||
97 | extern unsigned char *get_property(struct device_node *node, const char *name, | ||
98 | int *lenp); | ||
99 | extern void prom_add_property(struct device_node* np, struct property* prop); | ||
100 | extern void prom_get_irq_senses(unsigned char *, int, int); | ||
101 | extern int prom_n_addr_cells(struct device_node* np); | ||
102 | extern int prom_n_size_cells(struct device_node* np); | ||
103 | |||
104 | extern struct resource* | ||
105 | request_OF_resource(struct device_node* node, int index, const char* name_postfix); | ||
106 | extern int release_OF_resource(struct device_node* node, int index); | ||
107 | |||
108 | extern void print_properties(struct device_node *node); | ||
109 | extern int call_rtas(const char *service, int nargs, int nret, | ||
110 | unsigned long *outputs, ...); | ||
111 | |||
112 | /* | ||
113 | * PCI <-> OF matching functions | ||
114 | */ | ||
115 | struct pci_bus; | ||
116 | struct pci_dev; | ||
117 | extern int pci_device_from_OF_node(struct device_node *node, | ||
118 | u8* bus, u8* devfn); | ||
119 | extern struct device_node* pci_busdev_to_OF_node(struct pci_bus *, int); | ||
120 | extern struct device_node* pci_device_to_OF_node(struct pci_dev *); | ||
121 | extern 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 | */ | ||
135 | extern unsigned long reloc_offset(void); | ||
136 | extern unsigned long add_reloc_offset(unsigned long); | ||
137 | extern 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__ */ | ||