diff options
Diffstat (limited to 'arch/powerpc/include/asm/prom.h')
-rw-r--r-- | arch/powerpc/include/asm/prom.h | 133 |
1 files changed, 19 insertions, 114 deletions
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index ddd408a93b5a..ae26f2efd089 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h | |||
@@ -17,9 +17,6 @@ | |||
17 | * 2 of the License, or (at your option) any later version. | 17 | * 2 of the License, or (at your option) any later version. |
18 | */ | 18 | */ |
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/of_fdt.h> | ||
21 | #include <linux/proc_fs.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <asm/irq.h> | 20 | #include <asm/irq.h> |
24 | #include <asm/atomic.h> | 21 | #include <asm/atomic.h> |
25 | 22 | ||
@@ -43,49 +40,14 @@ extern void pci_create_OF_bus_map(void); | |||
43 | * OF address retreival & translation | 40 | * OF address retreival & translation |
44 | */ | 41 | */ |
45 | 42 | ||
46 | /* Translate an OF address block into a CPU physical address | ||
47 | */ | ||
48 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); | ||
49 | |||
50 | /* Translate a DMA address from device space to CPU space */ | 43 | /* Translate a DMA address from device space to CPU space */ |
51 | extern u64 of_translate_dma_address(struct device_node *dev, | 44 | extern u64 of_translate_dma_address(struct device_node *dev, |
52 | const u32 *in_addr); | 45 | const u32 *in_addr); |
53 | 46 | ||
54 | /* Extract an address from a device, returns the region size and | ||
55 | * the address space flags too. The PCI version uses a BAR number | ||
56 | * instead of an absolute index | ||
57 | */ | ||
58 | extern const u32 *of_get_address(struct device_node *dev, int index, | ||
59 | u64 *size, unsigned int *flags); | ||
60 | #ifdef CONFIG_PCI | 47 | #ifdef CONFIG_PCI |
61 | extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, | 48 | extern unsigned long pci_address_to_pio(phys_addr_t address); |
62 | u64 *size, unsigned int *flags); | 49 | #define pci_address_to_pio pci_address_to_pio |
63 | #else | 50 | #endif /* CONFIG_PCI */ |
64 | static inline const u32 *of_get_pci_address(struct device_node *dev, | ||
65 | int bar_no, u64 *size, unsigned int *flags) | ||
66 | { | ||
67 | return NULL; | ||
68 | } | ||
69 | #endif /* CONFIG_PCI */ | ||
70 | |||
71 | /* Get an address as a resource. Note that if your address is | ||
72 | * a PIO address, the conversion will fail if the physical address | ||
73 | * can't be internally converted to an IO token with | ||
74 | * pci_address_to_pio(), that is because it's either called to early | ||
75 | * or it can't be matched to any host bridge IO space | ||
76 | */ | ||
77 | extern int of_address_to_resource(struct device_node *dev, int index, | ||
78 | struct resource *r); | ||
79 | #ifdef CONFIG_PCI | ||
80 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | ||
81 | struct resource *r); | ||
82 | #else | ||
83 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, | ||
84 | struct resource *r) | ||
85 | { | ||
86 | return -ENOSYS; | ||
87 | } | ||
88 | #endif /* CONFIG_PCI */ | ||
89 | 51 | ||
90 | /* Parse the ibm,dma-window property of an OF node into the busno, phys and | 52 | /* Parse the ibm,dma-window property of an OF node into the busno, phys and |
91 | * size parameters. | 53 | * size parameters. |
@@ -104,69 +66,12 @@ struct device_node *of_find_next_cache_node(struct device_node *np); | |||
104 | /* Get the MAC address */ | 66 | /* Get the MAC address */ |
105 | extern const void *of_get_mac_address(struct device_node *np); | 67 | extern const void *of_get_mac_address(struct device_node *np); |
106 | 68 | ||
107 | /* | 69 | #ifdef CONFIG_NUMA |
108 | * OF interrupt mapping | 70 | extern int of_node_to_nid(struct device_node *device); |
109 | */ | 71 | #else |
110 | 72 | static inline int of_node_to_nid(struct device_node *device) { return 0; } | |
111 | /* This structure is returned when an interrupt is mapped. The controller | 73 | #endif |
112 | * field needs to be put() after use | 74 | #define of_node_to_nid of_node_to_nid |
113 | */ | ||
114 | |||
115 | #define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */ | ||
116 | |||
117 | struct of_irq { | ||
118 | struct device_node *controller; /* Interrupt controller node */ | ||
119 | u32 size; /* Specifier size */ | ||
120 | u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ | ||
121 | }; | ||
122 | |||
123 | /** | ||
124 | * of_irq_map_init - Initialize the irq remapper | ||
125 | * @flags: flags defining workarounds to enable | ||
126 | * | ||
127 | * Some machines have bugs in the device-tree which require certain workarounds | ||
128 | * to be applied. Call this before any interrupt mapping attempts to enable | ||
129 | * those workarounds. | ||
130 | */ | ||
131 | #define OF_IMAP_OLDWORLD_MAC 0x00000001 | ||
132 | #define OF_IMAP_NO_PHANDLE 0x00000002 | ||
133 | |||
134 | extern void of_irq_map_init(unsigned int flags); | ||
135 | |||
136 | /** | ||
137 | * of_irq_map_raw - Low level interrupt tree parsing | ||
138 | * @parent: the device interrupt parent | ||
139 | * @intspec: interrupt specifier ("interrupts" property of the device) | ||
140 | * @ointsize: size of the passed in interrupt specifier | ||
141 | * @addr: address specifier (start of "reg" property of the device) | ||
142 | * @out_irq: structure of_irq filled by this function | ||
143 | * | ||
144 | * Returns 0 on success and a negative number on error | ||
145 | * | ||
146 | * This function is a low-level interrupt tree walking function. It | ||
147 | * can be used to do a partial walk with synthetized reg and interrupts | ||
148 | * properties, for example when resolving PCI interrupts when no device | ||
149 | * node exist for the parent. | ||
150 | * | ||
151 | */ | ||
152 | |||
153 | extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, | ||
154 | u32 ointsize, const u32 *addr, | ||
155 | struct of_irq *out_irq); | ||
156 | |||
157 | |||
158 | /** | ||
159 | * of_irq_map_one - Resolve an interrupt for a device | ||
160 | * @device: the device whose interrupt is to be resolved | ||
161 | * @index: index of the interrupt to resolve | ||
162 | * @out_irq: structure of_irq filled by this function | ||
163 | * | ||
164 | * This function resolves an interrupt, walking the tree, for a given | ||
165 | * device-tree node. It's the high level pendant to of_irq_map_raw(). | ||
166 | * It also implements the workarounds for OldWolrd Macs. | ||
167 | */ | ||
168 | extern int of_irq_map_one(struct device_node *device, int index, | ||
169 | struct of_irq *out_irq); | ||
170 | 75 | ||
171 | /** | 76 | /** |
172 | * of_irq_map_pci - Resolve the interrupt for a PCI device | 77 | * of_irq_map_pci - Resolve the interrupt for a PCI device |
@@ -180,19 +85,19 @@ extern int of_irq_map_one(struct device_node *device, int index, | |||
180 | * resolving using the OF tree walking. | 85 | * resolving using the OF tree walking. |
181 | */ | 86 | */ |
182 | struct pci_dev; | 87 | struct pci_dev; |
88 | struct of_irq; | ||
183 | extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); | 89 | extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); |
184 | 90 | ||
185 | extern int of_irq_to_resource(struct device_node *dev, int index, | 91 | extern void of_instantiate_rtc(void); |
186 | struct resource *r); | ||
187 | 92 | ||
188 | /** | 93 | /* These includes are put at the bottom because they may contain things |
189 | * of_iomap - Maps the memory mapped IO for a given device_node | 94 | * that are overridden by this file. Ideally they shouldn't be included |
190 | * @device: the device whose io range will be mapped | 95 | * by this file, but there are a bunch of .c files that currently depend |
191 | * @index: index of the io range | 96 | * on it. Eventually they will be cleaned up. */ |
192 | * | 97 | #include <linux/of_fdt.h> |
193 | * Returns a pointer to the mapped memory | 98 | #include <linux/of_address.h> |
194 | */ | 99 | #include <linux/of_irq.h> |
195 | extern void __iomem *of_iomap(struct device_node *device, int index); | 100 | #include <linux/platform_device.h> |
196 | 101 | ||
197 | #endif /* __KERNEL__ */ | 102 | #endif /* __KERNEL__ */ |
198 | #endif /* _POWERPC_PROM_H */ | 103 | #endif /* _POWERPC_PROM_H */ |