2 * Definitions for talking to the Open Firmware PROM on
3 * Power Macintosh computers.
5 * Copyright (C) 1996 Paul Mackerras.
11 #include <linux/config.h>
13 typedef void *phandle
;
14 typedef void *ihandle
;
16 extern char *prom_display_paths
[];
17 extern unsigned int prom_num_displays
;
19 struct address_range
{
25 struct interrupt_info
{
27 int sense
; /* +ve/-ve logic, edge or level, etc. */
39 struct property
*next
;
43 * Note: don't change this structure for now or you'll break BootX !
50 struct address_range
*addrs
;
52 struct interrupt_info
*intrs
;
54 struct property
*properties
;
55 struct device_node
*parent
;
56 struct device_node
*child
;
57 struct device_node
*sibling
;
58 struct device_node
*next
; /* next device of same type */
59 struct device_node
*allnext
; /* next in list of all nodes */
63 typedef void (*prom_entry
)(struct prom_args
*);
65 /* OBSOLETE: Old style node lookup */
66 extern struct device_node
*find_devices(const char *name
);
67 extern struct device_node
*find_type_devices(const char *type
);
68 extern struct device_node
*find_path_device(const char *path
);
69 extern struct device_node
*find_compatible_devices(const char *type
,
71 extern struct device_node
*find_all_nodes(void);
73 /* New style node lookup */
74 extern struct device_node
*of_find_node_by_name(struct device_node
*from
,
76 extern struct device_node
*of_find_node_by_type(struct device_node
*from
,
78 extern struct device_node
*of_find_compatible_node(struct device_node
*from
,
79 const char *type
, const char *compat
);
80 extern struct device_node
*of_find_node_by_path(const char *path
);
81 extern struct device_node
*of_find_all_nodes(struct device_node
*prev
);
82 extern struct device_node
*of_get_parent(const struct device_node
*node
);
83 extern struct device_node
*of_get_next_child(const struct device_node
*node
,
84 struct device_node
*prev
);
85 extern struct device_node
*of_node_get(struct device_node
*node
);
86 extern void of_node_put(struct device_node
*node
);
88 /* Other Prototypes */
89 extern void abort(void);
90 extern unsigned long prom_init(int, int, prom_entry
);
91 extern void prom_print(const char *msg
);
92 extern void relocate_nodes(void);
93 extern void finish_device_tree(void);
94 extern int device_is_compatible(struct device_node
*device
, const char *);
95 extern int machine_is_compatible(const char *compat
);
96 extern unsigned char *get_property(struct device_node
*node
, const char *name
,
98 extern void prom_add_property(struct device_node
* np
, struct property
* prop
);
99 extern void prom_get_irq_senses(unsigned char *, int, int);
100 extern int prom_n_addr_cells(struct device_node
* np
);
101 extern int prom_n_size_cells(struct device_node
* np
);
103 extern struct resource
*
104 request_OF_resource(struct device_node
* node
, int index
, const char* name_postfix
);
105 extern int release_OF_resource(struct device_node
* node
, int index
);
107 extern void print_properties(struct device_node
*node
);
108 extern int call_rtas(const char *service
, int nargs
, int nret
,
109 unsigned long *outputs
, ...);
112 * PCI <-> OF matching functions
116 extern int pci_device_from_OF_node(struct device_node
*node
,
118 extern struct device_node
* pci_busdev_to_OF_node(struct pci_bus
*, int);
119 extern struct device_node
* pci_device_to_OF_node(struct pci_dev
*);
120 extern void pci_create_OF_bus_map(void);
123 * When we call back to the Open Firmware client interface, we usually
124 * have to do that before the kernel is relocated to its final location
125 * (this is because we can't use OF after we have overwritten the
126 * exception vectors with our exception handlers). These macros assist
127 * in performing the address calculations that we need to do to access
128 * data when the kernel is running at an address that is different from
129 * the address that the kernel is linked at. The reloc_offset() function
130 * returns the difference between these two addresses and the macros
131 * simplify the process of adding or subtracting this offset to/from
132 * pointer values. See arch/ppc/kernel/prom.c for how these are used.
134 extern unsigned long reloc_offset(void);
135 extern unsigned long add_reloc_offset(unsigned long);
136 extern unsigned long sub_reloc_offset(unsigned long);
138 #define PTRRELOC(x) ((typeof(x))add_reloc_offset((unsigned long)(x)))
139 #define PTRUNRELOC(x) ((typeof(x))sub_reloc_offset((unsigned long)(x)))
141 #endif /* _PPC_PROM_H */
142 #endif /* __KERNEL__ */