aboutsummaryrefslogtreecommitdiffstats
path: root/arch/openrisc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/openrisc')
-rw-r--r--arch/openrisc/include/asm/Kbuild1
-rw-r--r--arch/openrisc/include/asm/pgalloc.h10
-rw-r--r--arch/openrisc/include/asm/prom.h66
-rw-r--r--arch/openrisc/kernel/prom.c70
-rw-r--r--arch/openrisc/kernel/setup.c6
5 files changed, 12 insertions, 141 deletions
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 195653e851da..78405625e799 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -67,3 +67,4 @@ generic-y += ucontext.h
67generic-y += user.h 67generic-y += user.h
68generic-y += word-at-a-time.h 68generic-y += word-at-a-time.h
69generic-y += xor.h 69generic-y += xor.h
70generic-y += preempt.h
diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h
index 05c39ecd2efd..21484e5b9e9a 100644
--- a/arch/openrisc/include/asm/pgalloc.h
+++ b/arch/openrisc/include/asm/pgalloc.h
@@ -78,8 +78,13 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
78{ 78{
79 struct page *pte; 79 struct page *pte;
80 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); 80 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
81 if (pte) 81 if (!pte)
82 clear_page(page_address(pte)); 82 return NULL;
83 clear_page(page_address(pte));
84 if (!pgtable_page_ctor(pte)) {
85 __free_page(pte);
86 return NULL;
87 }
83 return pte; 88 return pte;
84} 89}
85 90
@@ -90,6 +95,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
90 95
91static inline void pte_free(struct mm_struct *mm, struct page *pte) 96static inline void pte_free(struct mm_struct *mm, struct page *pte)
92{ 97{
98 pgtable_page_dtor(pte);
93 __free_page(pte); 99 __free_page(pte);
94} 100}
95 101
diff --git a/arch/openrisc/include/asm/prom.h b/arch/openrisc/include/asm/prom.h
deleted file mode 100644
index eb59bfe23e85..000000000000
--- a/arch/openrisc/include/asm/prom.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * OpenRISC Linux
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * OpenRISC implementation:
9 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
10 * et al.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 */
17
18#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
19
20#ifndef _ASM_OPENRISC_PROM_H
21#define _ASM_OPENRISC_PROM_H
22#ifdef __KERNEL__
23#ifndef __ASSEMBLY__
24
25#include <linux/types.h>
26#include <asm/irq.h>
27#include <linux/irqdomain.h>
28#include <linux/atomic.h>
29#include <linux/of_irq.h>
30#include <linux/of_fdt.h>
31#include <linux/of_address.h>
32#include <linux/proc_fs.h>
33#include <linux/platform_device.h>
34#define HAVE_ARCH_DEVTREE_FIXUPS
35
36/* Other Prototypes */
37extern int early_uartlite_console(void);
38
39/* Parse the ibm,dma-window property of an OF node into the busno, phys and
40 * size parameters.
41 */
42void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
43 unsigned long *busno, unsigned long *phys, unsigned long *size);
44
45extern void kdump_move_device_tree(void);
46
47/* Get the MAC address */
48extern const void *of_get_mac_address(struct device_node *np);
49
50/**
51 * of_irq_map_pci - Resolve the interrupt for a PCI device
52 * @pdev: the device whose interrupt is to be resolved
53 * @out_irq: structure of_irq filled by this function
54 *
55 * This function resolves the PCI interrupt for a given PCI device. If a
56 * device-node exists for a given pci_dev, it will use normal OF tree
57 * walking. If not, it will implement standard swizzling and walk up the
58 * PCI tree until an device-node is found, at which point it will finish
59 * resolving using the OF tree walking.
60 */
61struct pci_dev;
62extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
63
64#endif /* __ASSEMBLY__ */
65#endif /* __KERNEL__ */
66#endif /* _ASM_OPENRISC_PROM_H */
diff --git a/arch/openrisc/kernel/prom.c b/arch/openrisc/kernel/prom.c
index a63e76872f84..6a44340d1b18 100644
--- a/arch/openrisc/kernel/prom.c
+++ b/arch/openrisc/kernel/prom.c
@@ -18,83 +18,15 @@
18 * 18 *
19 */ 19 */
20 20
21#include <stdarg.h>
22#include <linux/kernel.h>
23#include <linux/string.h>
24#include <linux/init.h> 21#include <linux/init.h>
25#include <linux/threads.h>
26#include <linux/spinlock.h>
27#include <linux/types.h> 22#include <linux/types.h>
28#include <linux/pci.h>
29#include <linux/stringify.h>
30#include <linux/delay.h>
31#include <linux/initrd.h>
32#include <linux/bitops.h>
33#include <linux/module.h>
34#include <linux/kexec.h>
35#include <linux/debugfs.h>
36#include <linux/irq.h>
37#include <linux/memblock.h> 23#include <linux/memblock.h>
38#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
39 25
40#include <asm/prom.h>
41#include <asm/page.h> 26#include <asm/page.h>
42#include <asm/processor.h>
43#include <asm/irq.h>
44#include <linux/io.h>
45#include <asm/mmu.h>
46#include <asm/pgtable.h>
47#include <asm/sections.h>
48#include <asm/setup.h>
49
50extern char cmd_line[COMMAND_LINE_SIZE];
51
52void __init early_init_dt_add_memory_arch(u64 base, u64 size)
53{
54 size &= PAGE_MASK;
55 memblock_add(base, size);
56}
57 27
58void __init early_init_devtree(void *params) 28void __init early_init_devtree(void *params)
59{ 29{
60 void *alloc; 30 early_init_dt_scan(params);
61
62 /* Setup flat device-tree pointer */
63 initial_boot_params = params;
64
65
66 /* Retrieve various informations from the /chosen node of the
67 * device-tree, including the platform type, initrd location and
68 * size, TCE reserve, and more ...
69 */
70 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
71
72 /* Scan memory nodes and rebuild MEMBLOCKs */
73 of_scan_flat_dt(early_init_dt_scan_root, NULL);
74 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
75
76 /* Save command line for /proc/cmdline and then parse parameters */
77 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
78
79 memblock_allow_resize(); 31 memblock_allow_resize();
80
81 /* We must copy the flattend device tree from init memory to regular
82 * memory because the device tree references the strings in it
83 * directly.
84 */
85
86 alloc = __va(memblock_alloc(initial_boot_params->totalsize, PAGE_SIZE));
87
88 memcpy(alloc, initial_boot_params, initial_boot_params->totalsize);
89
90 initial_boot_params = alloc;
91}
92
93#ifdef CONFIG_BLK_DEV_INITRD
94void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
95{
96 initrd_start = (unsigned long)__va(start);
97 initrd_end = (unsigned long)__va(end);
98 initrd_below_start_ok = 1;
99} 32}
100#endif
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index d7359ffbcbdd..09a769b69572 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -50,8 +50,6 @@
50 50
51#include "vmlinux.h" 51#include "vmlinux.h"
52 52
53char __initdata cmd_line[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
54
55static unsigned long __init setup_memory(void) 53static unsigned long __init setup_memory(void)
56{ 54{
57 unsigned long bootmap_size; 55 unsigned long bootmap_size;
@@ -285,7 +283,7 @@ void __init setup_arch(char **cmdline_p)
285{ 283{
286 unsigned long max_low_pfn; 284 unsigned long max_low_pfn;
287 285
288 unflatten_device_tree(); 286 unflatten_and_copy_device_tree();
289 287
290 setup_cpuinfo(); 288 setup_cpuinfo();
291 289
@@ -316,7 +314,7 @@ void __init setup_arch(char **cmdline_p)
316 conswitchp = &dummy_con; 314 conswitchp = &dummy_con;
317#endif 315#endif
318 316
319 *cmdline_p = cmd_line; 317 *cmdline_p = boot_command_line;
320 318
321 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n"); 319 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n");
322} 320}