xref: /openbmc/linux/arch/powerpc/include/asm/prom.h (revision 22ae782f86b726f9cea752c0f269ff6dcdf2f6e1)
19d24c888SGrant Likely #include <linux/of.h>	/* linux/of.h gets to determine #include ordering */
2b8b572e1SStephen Rothwell #ifndef _POWERPC_PROM_H
3b8b572e1SStephen Rothwell #define _POWERPC_PROM_H
4b8b572e1SStephen Rothwell #ifdef __KERNEL__
5b8b572e1SStephen Rothwell 
6b8b572e1SStephen Rothwell /*
7b8b572e1SStephen Rothwell  * Definitions for talking to the Open Firmware PROM on
8b8b572e1SStephen Rothwell  * Power Macintosh computers.
9b8b572e1SStephen Rothwell  *
10b8b572e1SStephen Rothwell  * Copyright (C) 1996-2005 Paul Mackerras.
11b8b572e1SStephen Rothwell  *
12b8b572e1SStephen Rothwell  * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
13b8b572e1SStephen Rothwell  *
14b8b572e1SStephen Rothwell  * This program is free software; you can redistribute it and/or
15b8b572e1SStephen Rothwell  * modify it under the terms of the GNU General Public License
16b8b572e1SStephen Rothwell  * as published by the Free Software Foundation; either version
17b8b572e1SStephen Rothwell  * 2 of the License, or (at your option) any later version.
18b8b572e1SStephen Rothwell  */
19b8b572e1SStephen Rothwell #include <linux/types.h>
20b8b572e1SStephen Rothwell #include <asm/irq.h>
21b8b572e1SStephen Rothwell #include <asm/atomic.h>
22b8b572e1SStephen Rothwell 
23b8b572e1SStephen Rothwell #define HAVE_ARCH_DEVTREE_FIXUPS
24b8b572e1SStephen Rothwell 
25b8b572e1SStephen Rothwell #ifdef CONFIG_PPC32
26b8b572e1SStephen Rothwell /*
27b8b572e1SStephen Rothwell  * PCI <-> OF matching functions
28b8b572e1SStephen Rothwell  * (XXX should these be here?)
29b8b572e1SStephen Rothwell  */
30b8b572e1SStephen Rothwell struct pci_bus;
31b8b572e1SStephen Rothwell struct pci_dev;
32b8b572e1SStephen Rothwell extern int pci_device_from_OF_node(struct device_node *node,
33b8b572e1SStephen Rothwell 				   u8* bus, u8* devfn);
34b8b572e1SStephen Rothwell extern struct device_node* pci_busdev_to_OF_node(struct pci_bus *, int);
35b8b572e1SStephen Rothwell extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
36b8b572e1SStephen Rothwell extern void pci_create_OF_bus_map(void);
37b8b572e1SStephen Rothwell #endif
38b8b572e1SStephen Rothwell 
39b8b572e1SStephen Rothwell /*
40b8b572e1SStephen Rothwell  * OF address retreival & translation
41b8b572e1SStephen Rothwell  */
42b8b572e1SStephen Rothwell 
43b8b572e1SStephen Rothwell /* Translate a DMA address from device space to CPU space */
44b8b572e1SStephen Rothwell extern u64 of_translate_dma_address(struct device_node *dev,
45b8b572e1SStephen Rothwell 				    const u32 *in_addr);
46b8b572e1SStephen Rothwell 
471f5bef30SGrant Likely #ifdef CONFIG_PCI
481f5bef30SGrant Likely extern unsigned long pci_address_to_pio(phys_addr_t address);
49*22ae782fSGrant Likely #define pci_address_to_pio pci_address_to_pio
501f5bef30SGrant Likely #endif	/* CONFIG_PCI */
511f5bef30SGrant Likely 
52b8b572e1SStephen Rothwell /* Parse the ibm,dma-window property of an OF node into the busno, phys and
53b8b572e1SStephen Rothwell  * size parameters.
54b8b572e1SStephen Rothwell  */
55b8b572e1SStephen Rothwell void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
56b8b572e1SStephen Rothwell 		unsigned long *busno, unsigned long *phys, unsigned long *size);
57b8b572e1SStephen Rothwell 
58b8b572e1SStephen Rothwell extern void kdump_move_device_tree(void);
59b8b572e1SStephen Rothwell 
60b8b572e1SStephen Rothwell /* CPU OF node matching */
61b8b572e1SStephen Rothwell struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
62b8b572e1SStephen Rothwell 
63e523f723SNathan Lynch /* cache lookup */
64e523f723SNathan Lynch struct device_node *of_find_next_cache_node(struct device_node *np);
65e523f723SNathan Lynch 
66b8b572e1SStephen Rothwell /* Get the MAC address */
67b8b572e1SStephen Rothwell extern const void *of_get_mac_address(struct device_node *np);
68b8b572e1SStephen Rothwell 
69559e2b7eSGrant Likely #ifdef CONFIG_NUMA
70559e2b7eSGrant Likely extern int of_node_to_nid(struct device_node *device);
71559e2b7eSGrant Likely #else
72559e2b7eSGrant Likely static inline int of_node_to_nid(struct device_node *device) { return 0; }
73559e2b7eSGrant Likely #endif
74559e2b7eSGrant Likely #define of_node_to_nid of_node_to_nid
75559e2b7eSGrant Likely 
76b8b572e1SStephen Rothwell /**
77b8b572e1SStephen Rothwell  * of_irq_map_pci - Resolve the interrupt for a PCI device
78b8b572e1SStephen Rothwell  * @pdev:	the device whose interrupt is to be resolved
79b8b572e1SStephen Rothwell  * @out_irq:	structure of_irq filled by this function
80b8b572e1SStephen Rothwell  *
81b8b572e1SStephen Rothwell  * This function resolves the PCI interrupt for a given PCI device. If a
82b8b572e1SStephen Rothwell  * device-node exists for a given pci_dev, it will use normal OF tree
83b8b572e1SStephen Rothwell  * walking. If not, it will implement standard swizzling and walk up the
84b8b572e1SStephen Rothwell  * PCI tree until an device-node is found, at which point it will finish
85b8b572e1SStephen Rothwell  * resolving using the OF tree walking.
86b8b572e1SStephen Rothwell  */
87b8b572e1SStephen Rothwell struct pci_dev;
88*22ae782fSGrant Likely struct of_irq;
89b8b572e1SStephen Rothwell extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
90b8b572e1SStephen Rothwell 
91129ac799SGrant Likely extern void of_instantiate_rtc(void);
92129ac799SGrant Likely 
93*22ae782fSGrant Likely /* These includes are put at the bottom because they may contain things
94*22ae782fSGrant Likely  * that are overridden by this file.  Ideally they shouldn't be included
95*22ae782fSGrant Likely  * by this file, but there are a bunch of .c files that currently depend
96*22ae782fSGrant Likely  * on it.  Eventually they will be cleaned up. */
97*22ae782fSGrant Likely #include <linux/of_fdt.h>
98*22ae782fSGrant Likely #include <linux/of_address.h>
99*22ae782fSGrant Likely #include <linux/of_irq.h>
100*22ae782fSGrant Likely #include <linux/platform_device.h>
101*22ae782fSGrant Likely 
102b8b572e1SStephen Rothwell #endif /* __KERNEL__ */
103b8b572e1SStephen Rothwell #endif /* _POWERPC_PROM_H */
104