1 #include <linux/of.h> /* linux/of.h gets to determine #include ordering */
2 #ifndef _POWERPC_PROM_H
3 #define _POWERPC_PROM_H
7 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers.
10 * Copyright (C) 1996-2005 Paul Mackerras.
12 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
19 #include <linux/types.h>
20 #include <linux/of_fdt.h>
21 #include <linux/of_irq.h>
22 #include <linux/proc_fs.h>
23 #include <linux/platform_device.h>
25 #include <asm/atomic.h>
27 #define HAVE_ARCH_DEVTREE_FIXUPS
31 * PCI <-> OF matching functions
32 * (XXX should these be here?)
36 extern int pci_device_from_OF_node(struct device_node
*node
,
38 extern struct device_node
* pci_busdev_to_OF_node(struct pci_bus
*, int);
39 extern struct device_node
* pci_device_to_OF_node(struct pci_dev
*);
40 extern void pci_create_OF_bus_map(void);
44 * OF address retreival & translation
47 /* Translate an OF address block into a CPU physical address
49 extern u64
of_translate_address(struct device_node
*np
, const u32
*addr
);
51 /* Translate a DMA address from device space to CPU space */
52 extern u64
of_translate_dma_address(struct device_node
*dev
,
55 /* Extract an address from a device, returns the region size and
56 * the address space flags too. The PCI version uses a BAR number
57 * instead of an absolute index
59 extern const u32
*of_get_address(struct device_node
*dev
, int index
,
60 u64
*size
, unsigned int *flags
);
62 extern const u32
*of_get_pci_address(struct device_node
*dev
, int bar_no
,
63 u64
*size
, unsigned int *flags
);
65 static inline const u32
*of_get_pci_address(struct device_node
*dev
,
66 int bar_no
, u64
*size
, unsigned int *flags
)
70 #endif /* CONFIG_PCI */
72 /* Get an address as a resource. Note that if your address is
73 * a PIO address, the conversion will fail if the physical address
74 * can't be internally converted to an IO token with
75 * pci_address_to_pio(), that is because it's either called to early
76 * or it can't be matched to any host bridge IO space
78 extern int of_address_to_resource(struct device_node
*dev
, int index
,
81 extern int of_pci_address_to_resource(struct device_node
*dev
, int bar
,
84 static inline int of_pci_address_to_resource(struct device_node
*dev
, int bar
,
89 #endif /* CONFIG_PCI */
91 /* Parse the ibm,dma-window property of an OF node into the busno, phys and
94 void of_parse_dma_window(struct device_node
*dn
, const void *dma_window_prop
,
95 unsigned long *busno
, unsigned long *phys
, unsigned long *size
);
97 extern void kdump_move_device_tree(void);
99 /* CPU OF node matching */
100 struct device_node
*of_get_cpu_node(int cpu
, unsigned int *thread
);
103 struct device_node
*of_find_next_cache_node(struct device_node
*np
);
105 /* Get the MAC address */
106 extern const void *of_get_mac_address(struct device_node
*np
);
109 * OF interrupt mapping
113 * of_irq_map_init - Initialize the irq remapper
114 * @flags: flags defining workarounds to enable
116 * Some machines have bugs in the device-tree which require certain workarounds
117 * to be applied. Call this before any interrupt mapping attempts to enable
120 #define OF_IMAP_OLDWORLD_MAC 0x00000001
121 #define OF_IMAP_NO_PHANDLE 0x00000002
123 extern void of_irq_map_init(unsigned int flags
);
126 * of_irq_map_raw - Low level interrupt tree parsing
127 * @parent: the device interrupt parent
128 * @intspec: interrupt specifier ("interrupts" property of the device)
129 * @ointsize: size of the passed in interrupt specifier
130 * @addr: address specifier (start of "reg" property of the device)
131 * @out_irq: structure of_irq filled by this function
133 * Returns 0 on success and a negative number on error
135 * This function is a low-level interrupt tree walking function. It
136 * can be used to do a partial walk with synthetized reg and interrupts
137 * properties, for example when resolving PCI interrupts when no device
138 * node exist for the parent.
142 extern int of_irq_map_raw(struct device_node
*parent
, const u32
*intspec
,
143 u32 ointsize
, const u32
*addr
,
144 struct of_irq
*out_irq
);
147 * of_irq_map_pci - Resolve the interrupt for a PCI device
148 * @pdev: the device whose interrupt is to be resolved
149 * @out_irq: structure of_irq filled by this function
151 * This function resolves the PCI interrupt for a given PCI device. If a
152 * device-node exists for a given pci_dev, it will use normal OF tree
153 * walking. If not, it will implement standard swizzling and walk up the
154 * PCI tree until an device-node is found, at which point it will finish
155 * resolving using the OF tree walking.
158 extern int of_irq_map_pci(struct pci_dev
*pdev
, struct of_irq
*out_irq
);
160 extern int of_irq_to_resource(struct device_node
*dev
, int index
,
164 * of_iomap - Maps the memory mapped IO for a given device_node
165 * @device: the device whose io range will be mapped
166 * @index: index of the io range
168 * Returns a pointer to the mapped memory
170 extern void __iomem
*of_iomap(struct device_node
*device
, int index
);
172 #endif /* __KERNEL__ */
173 #endif /* _POWERPC_PROM_H */
This page took 0.033867 seconds and 5 git commands to generate.