aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/devicetree.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/devicetree.c')
-rw-r--r--arch/x86/kernel/devicetree.c51
1 files changed, 10 insertions, 41 deletions
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 376dc7873447..d35078ea1446 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -20,22 +20,13 @@
20#include <asm/hpet.h> 20#include <asm/hpet.h>
21#include <asm/apic.h> 21#include <asm/apic.h>
22#include <asm/pci_x86.h> 22#include <asm/pci_x86.h>
23#include <asm/setup.h>
23 24
24__initdata u64 initial_dtb; 25__initdata u64 initial_dtb;
25char __initdata cmd_line[COMMAND_LINE_SIZE]; 26char __initdata cmd_line[COMMAND_LINE_SIZE];
26 27
27int __initdata of_ioapic; 28int __initdata of_ioapic;
28 29
29unsigned long pci_address_to_pio(phys_addr_t address)
30{
31 /*
32 * The ioport address can be directly used by inX / outX
33 */
34 BUG_ON(address >= (1 << 16));
35 return (unsigned long)address;
36}
37EXPORT_SYMBOL_GPL(pci_address_to_pio);
38
39void __init early_init_dt_scan_chosen_arch(unsigned long node) 30void __init early_init_dt_scan_chosen_arch(unsigned long node)
40{ 31{
41 BUG(); 32 BUG();
@@ -51,15 +42,6 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
51 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 42 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
52} 43}
53 44
54#ifdef CONFIG_BLK_DEV_INITRD
55void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
56{
57 initrd_start = (unsigned long)__va(start);
58 initrd_end = (unsigned long)__va(end);
59 initrd_below_start_ok = 1;
60}
61#endif
62
63void __init add_dtb(u64 data) 45void __init add_dtb(u64 data)
64{ 46{
65 initial_dtb = data + offsetof(struct setup_data, data); 47 initial_dtb = data + offsetof(struct setup_data, data);
@@ -105,7 +87,6 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
105 87
106static int x86_of_pci_irq_enable(struct pci_dev *dev) 88static int x86_of_pci_irq_enable(struct pci_dev *dev)
107{ 89{
108 struct of_irq oirq;
109 u32 virq; 90 u32 virq;
110 int ret; 91 int ret;
111 u8 pin; 92 u8 pin;
@@ -116,12 +97,7 @@ static int x86_of_pci_irq_enable(struct pci_dev *dev)
116 if (!pin) 97 if (!pin)
117 return 0; 98 return 0;
118 99
119 ret = of_irq_map_pci(dev, &oirq); 100 virq = of_irq_parse_and_map_pci(dev, 0, 0);
120 if (ret)
121 return ret;
122
123 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
124 oirq.size);
125 if (virq == 0) 101 if (virq == 0)
126 return -EINVAL; 102 return -EINVAL;
127 dev->irq = virq; 103 dev->irq = virq;
@@ -230,7 +206,7 @@ static void __init dtb_apic_setup(void)
230static void __init x86_flattree_get_config(void) 206static void __init x86_flattree_get_config(void)
231{ 207{
232 u32 size, map_len; 208 u32 size, map_len;
233 void *new_dtb; 209 struct boot_param_header *dt;
234 210
235 if (!initial_dtb) 211 if (!initial_dtb)
236 return; 212 return;
@@ -238,24 +214,17 @@ static void __init x86_flattree_get_config(void)
238 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), 214 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK),
239 (u64)sizeof(struct boot_param_header)); 215 (u64)sizeof(struct boot_param_header));
240 216
241 initial_boot_params = early_memremap(initial_dtb, map_len); 217 dt = early_memremap(initial_dtb, map_len);
242 size = be32_to_cpu(initial_boot_params->totalsize); 218 size = be32_to_cpu(dt->totalsize);
243 if (map_len < size) { 219 if (map_len < size) {
244 early_iounmap(initial_boot_params, map_len); 220 early_iounmap(dt, map_len);
245 initial_boot_params = early_memremap(initial_dtb, size); 221 dt = early_memremap(initial_dtb, size);
246 map_len = size; 222 map_len = size;
247 } 223 }
248 224
249 new_dtb = alloc_bootmem(size); 225 initial_boot_params = dt;
250 memcpy(new_dtb, initial_boot_params, size); 226 unflatten_and_copy_device_tree();
251 early_iounmap(initial_boot_params, map_len); 227 early_iounmap(dt, map_len);
252
253 initial_boot_params = new_dtb;
254
255 /* root level address cells */
256 of_scan_flat_dt(early_init_dt_scan_root, NULL);
257
258 unflatten_device_tree();
259} 228}
260#else 229#else
261static inline void x86_flattree_get_config(void) { } 230static inline void x86_flattree_get_config(void) { }