5 * Definitions for talking to the Open Firmware PROM on
6 * Power Macintosh computers.
8 * Copyright (C) 1996 Paul Mackerras.
10 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
18 #define PTRRELOC(x) ((typeof(x))((unsigned long)(x) - offset))
19 #define PTRUNRELOC(x) ((typeof(x))((unsigned long)(x) + offset))
20 #define RELOC(x) (*PTRRELOC(&(x)))
22 #define LONG_LSW(X) (((unsigned long)X) & 0xffffffff)
23 #define LONG_MSW(X) (((unsigned long)X) >> 32)
26 typedef void *ihandle;
27 typedef u32 phandle32;
28 typedef u32 ihandle32;
30 extern char *prom_display_paths[];
31 extern unsigned int prom_num_displays;
33 struct address_range {
35 unsigned long address;
39 struct interrupt_info {
41 int sense; /* +ve/-ve logic, edge or level, etc. */
51 struct pci_address child_addr;
52 unsigned int parent_addr;
57 struct pci_address child_addr;
58 unsigned long parent_addr;
64 struct pci_address addr;
69 struct pci_address addr;
77 struct _of_tce_table {
84 unsigned long address;
88 struct reg_property32 {
93 struct reg_property64 {
94 unsigned long address;
98 struct translation_property {
108 unsigned char *value;
109 struct property *next;
112 /* NOTE: the device_node contains PCI specific info for pci devices.
113 * This perhaps could be hung off the device_node with another struct,
114 * but for now it is directly in the node. The phb ptr is a good
115 * indication of a real PCI node. Other nodes leave these fields zeroed.
117 struct pci_controller;
123 phandle linux_phandle;
125 struct address_range *addrs;
127 struct interrupt_info *intrs;
130 /* PCI stuff probably doesn't belong here */
131 int busno; /* for pci devices */
132 int devfn; /* for pci devices */
133 #define DN_STATUS_BIST_FAILED (1<<0)
134 int status; /* Current device status (non-zero is bad) */
135 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
137 struct pci_controller *phb; /* for pci devices */
138 struct TceTable *tce_table; /* for phb's or bridges */
140 struct property *properties;
141 struct device_node *parent;
142 struct device_node *child;
143 struct device_node *sibling;
144 struct device_node *next; /* next device of same type */
145 struct device_node *allnext; /* next in list of all nodes */
148 typedef u32 prom_arg_t;
155 prom_arg_t *rets; /* Pointer to return values in args[16]. */
159 u32 printf; /* void (*printf)(char *, ...); */
160 u32 memdump; /* void (*memdump)(unsigned char *, unsigned long); */
161 u32 dummy; /* void (*dummy)(void); */
170 struct prom_args args;
171 unsigned long version;
172 unsigned long encode_phys_size;
173 struct bi_record *bi_recs;
175 yaboot_debug_t *yaboot;
179 extern struct prom_t prom;
180 extern char *of_stdout_device;
183 extern unsigned long prom_init(unsigned long, unsigned long, unsigned long,
184 unsigned long, unsigned long, yaboot_debug_t *);
185 extern void prom_print(const char *msg);
186 extern void relocate_nodes(void);
187 extern void finish_device_tree(void);
188 extern struct device_node *find_devices(const char *name);
189 extern struct device_node *find_type_devices(const char *type);
190 extern struct device_node *find_path_device(const char *path);
191 extern struct device_node *find_compatible_devices(const char *type,
193 extern struct device_node *find_pci_device_OFnode(unsigned char bus,
194 unsigned char dev_fn);
195 extern struct device_node *find_all_nodes(void);
196 extern int device_is_compatible(struct device_node *device, const char *);
197 extern int machine_is_compatible(const char *compat);
198 extern unsigned char *get_property(struct device_node *node, const char *name,
200 extern void print_properties(struct device_node *node);
201 extern int prom_n_addr_cells(struct device_node* np);
202 extern int prom_n_size_cells(struct device_node* np);
203 extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
204 extern void prom_add_property(struct device_node* np, struct property* prop);
206 #endif /* _PPC64_PROM_H */