aboutsummaryrefslogtreecommitdiffstats
path: root/arch/openrisc/include
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/openrisc/include
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/openrisc/include')
-rw-r--r--arch/openrisc/include/asm/Kbuild12
-rw-r--r--arch/openrisc/include/asm/dma-mapping.h149
-rw-r--r--arch/openrisc/include/asm/elf.h48
-rw-r--r--arch/openrisc/include/asm/gpio.h69
-rw-r--r--arch/openrisc/include/asm/io.h1
-rw-r--r--arch/openrisc/include/asm/page.h6
-rw-r--r--arch/openrisc/include/asm/pgtable.h1
-rw-r--r--arch/openrisc/include/asm/processor.h12
-rw-r--r--arch/openrisc/include/asm/prom.h10
-rw-r--r--arch/openrisc/include/asm/ptrace.h35
-rw-r--r--arch/openrisc/include/asm/syscall.h7
-rw-r--r--arch/openrisc/include/asm/syscalls.h7
-rw-r--r--arch/openrisc/include/asm/thread_info.h3
-rw-r--r--arch/openrisc/include/asm/uaccess.h41
-rw-r--r--arch/openrisc/include/uapi/asm/Kbuild10
-rw-r--r--arch/openrisc/include/uapi/asm/byteorder.h1
-rw-r--r--arch/openrisc/include/uapi/asm/elf.h69
-rw-r--r--arch/openrisc/include/uapi/asm/param.h26
-rw-r--r--arch/openrisc/include/uapi/asm/ptrace.h35
-rw-r--r--arch/openrisc/include/uapi/asm/sigcontext.h33
-rw-r--r--arch/openrisc/include/uapi/asm/unistd.h29
21 files changed, 314 insertions, 290 deletions
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f20d01d9aaf..11162e6c878 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -1,17 +1,17 @@
1include include/asm-generic/Kbuild.asm
1 2
2header-y += ucontext.h 3header-y += spr_defs.h
3 4
4generic-y += atomic.h 5generic-y += atomic.h
5generic-y += auxvec.h 6generic-y += auxvec.h
6generic-y += barrier.h
7generic-y += bitsperlong.h 7generic-y += bitsperlong.h
8generic-y += bug.h 8generic-y += bug.h
9generic-y += bugs.h 9generic-y += bugs.h
10generic-y += cacheflush.h 10generic-y += cacheflush.h
11generic-y += checksum.h 11generic-y += checksum.h
12generic-y += clkdev.h
13generic-y += cmpxchg.h 12generic-y += cmpxchg.h
14generic-y += cmpxchg-local.h 13generic-y += cmpxchg-local.h
14generic-y += cpumask.h
15generic-y += cputime.h 15generic-y += cputime.h
16generic-y += current.h 16generic-y += current.h
17generic-y += device.h 17generic-y += device.h
@@ -19,7 +19,6 @@ generic-y += div64.h
19generic-y += dma.h 19generic-y += dma.h
20generic-y += emergency-restart.h 20generic-y += emergency-restart.h
21generic-y += errno.h 21generic-y += errno.h
22generic-y += exec.h
23generic-y += fb.h 22generic-y += fb.h
24generic-y += fcntl.h 23generic-y += fcntl.h
25generic-y += ftrace.h 24generic-y += ftrace.h
@@ -32,7 +31,6 @@ generic-y += ipcbuf.h
32generic-y += irq_regs.h 31generic-y += irq_regs.h
33generic-y += kdebug.h 32generic-y += kdebug.h
34generic-y += kmap_types.h 33generic-y += kmap_types.h
35generic-y += kvm_para.h
36generic-y += local.h 34generic-y += local.h
37generic-y += mman.h 35generic-y += mman.h
38generic-y += module.h 36generic-y += module.h
@@ -42,6 +40,7 @@ generic-y += percpu.h
42generic-y += poll.h 40generic-y += poll.h
43generic-y += posix_types.h 41generic-y += posix_types.h
44generic-y += resource.h 42generic-y += resource.h
43generic-y += rmap.h
45generic-y += scatterlist.h 44generic-y += scatterlist.h
46generic-y += sections.h 45generic-y += sections.h
47generic-y += segment.h 46generic-y += segment.h
@@ -56,13 +55,10 @@ generic-y += sockios.h
56generic-y += statfs.h 55generic-y += statfs.h
57generic-y += stat.h 56generic-y += stat.h
58generic-y += string.h 57generic-y += string.h
59generic-y += switch_to.h
60generic-y += swab.h 58generic-y += swab.h
61generic-y += termbits.h 59generic-y += termbits.h
62generic-y += termios.h 60generic-y += termios.h
63generic-y += topology.h 61generic-y += topology.h
64generic-y += trace_clock.h
65generic-y += types.h 62generic-y += types.h
66generic-y += ucontext.h 63generic-y += ucontext.h
67generic-y += user.h 64generic-y += user.h
68generic-y += word-at-a-time.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
index fab8628e1b6..60b47223390 100644
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ b/arch/openrisc/include/asm/dma-mapping.h
@@ -18,73 +18,152 @@
18#define __ASM_OPENRISC_DMA_MAPPING_H 18#define __ASM_OPENRISC_DMA_MAPPING_H
19 19
20/* 20/*
21 * See Documentation/DMA-API-HOWTO.txt and 21 * See Documentation/PCI/PCI-DMA-mapping.txt and
22 * Documentation/DMA-API.txt for documentation. 22 * Documentation/DMA-API.txt for documentation.
23 *
24 * This file is written with the intention of eventually moving over
25 * to largely using asm-generic/dma-mapping-common.h in its place.
23 */ 26 */
24 27
25#include <linux/dma-debug.h> 28#include <linux/dma-debug.h>
26#include <asm-generic/dma-coherent.h> 29#include <asm-generic/dma-coherent.h>
27#include <linux/kmemcheck.h> 30#include <linux/kmemcheck.h>
28#include <linux/dma-mapping.h>
29 31
30#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 32#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
31 33
32extern struct dma_map_ops or1k_dma_map_ops;
33
34static inline struct dma_map_ops *get_dma_ops(struct device *dev)
35{
36 return &or1k_dma_map_ops;
37}
38
39#include <asm-generic/dma-mapping-common.h>
40
41#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
42 34
43static inline void *dma_alloc_attrs(struct device *dev, size_t size, 35#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
44 dma_addr_t *dma_handle, gfp_t gfp, 36#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
45 struct dma_attrs *attrs) 37
38void *or1k_dma_alloc_coherent(struct device *dev, size_t size,
39 dma_addr_t *dma_handle, gfp_t flag);
40void or1k_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
41 dma_addr_t dma_handle);
42dma_addr_t or1k_map_page(struct device *dev, struct page *page,
43 unsigned long offset, size_t size,
44 enum dma_data_direction dir,
45 struct dma_attrs *attrs);
46void or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
47 size_t size, enum dma_data_direction dir,
48 struct dma_attrs *attrs);
49int or1k_map_sg(struct device *dev, struct scatterlist *sg,
50 int nents, enum dma_data_direction dir,
51 struct dma_attrs *attrs);
52void or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
53 int nents, enum dma_data_direction dir,
54 struct dma_attrs *attrs);
55void or1k_sync_single_for_cpu(struct device *dev,
56 dma_addr_t dma_handle, size_t size,
57 enum dma_data_direction dir);
58void or1k_sync_single_for_device(struct device *dev,
59 dma_addr_t dma_handle, size_t size,
60 enum dma_data_direction dir);
61
62static inline void *dma_alloc_coherent(struct device *dev, size_t size,
63 dma_addr_t *dma_handle, gfp_t flag)
46{ 64{
47 struct dma_map_ops *ops = get_dma_ops(dev);
48 void *memory; 65 void *memory;
49 66
50 memory = ops->alloc(dev, size, dma_handle, gfp, attrs); 67 memory = or1k_dma_alloc_coherent(dev, size, dma_handle, flag);
51 68
52 debug_dma_alloc_coherent(dev, size, *dma_handle, memory); 69 debug_dma_alloc_coherent(dev, size, *dma_handle, memory);
53
54 return memory; 70 return memory;
55} 71}
56 72
57#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) 73static inline void dma_free_coherent(struct device *dev, size_t size,
74 void *cpu_addr, dma_addr_t dma_handle)
75{
76 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
77 or1k_dma_free_coherent(dev, size, cpu_addr, dma_handle);
78}
58 79
59static inline void dma_free_attrs(struct device *dev, size_t size, 80static inline dma_addr_t dma_map_single(struct device *dev, void *ptr,
60 void *cpu_addr, dma_addr_t dma_handle, 81 size_t size,
61 struct dma_attrs *attrs) 82 enum dma_data_direction dir)
62{ 83{
63 struct dma_map_ops *ops = get_dma_ops(dev); 84 dma_addr_t addr;
85
86 kmemcheck_mark_initialized(ptr, size);
87 BUG_ON(!valid_dma_direction(dir));
88 addr = or1k_map_page(dev, virt_to_page(ptr),
89 (unsigned long)ptr & ~PAGE_MASK, size,
90 dir, NULL);
91 debug_dma_map_page(dev, virt_to_page(ptr),
92 (unsigned long)ptr & ~PAGE_MASK, size,
93 dir, addr, true);
94 return addr;
95}
64 96
65 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); 97static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
98 size_t size,
99 enum dma_data_direction dir)
100{
101 BUG_ON(!valid_dma_direction(dir));
102 or1k_unmap_page(dev, addr, size, dir, NULL);
103 debug_dma_unmap_page(dev, addr, size, dir, true);
104}
105
106static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
107 int nents, enum dma_data_direction dir)
108{
109 int i, ents;
110 struct scatterlist *s;
111
112 for_each_sg(sg, s, nents, i)
113 kmemcheck_mark_initialized(sg_virt(s), s->length);
114 BUG_ON(!valid_dma_direction(dir));
115 ents = or1k_map_sg(dev, sg, nents, dir, NULL);
116 debug_dma_map_sg(dev, sg, nents, ents, dir);
117
118 return ents;
119}
66 120
67 ops->free(dev, size, cpu_addr, dma_handle, attrs); 121static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
122 int nents, enum dma_data_direction dir)
123{
124 BUG_ON(!valid_dma_direction(dir));
125 debug_dma_unmap_sg(dev, sg, nents, dir);
126 or1k_unmap_sg(dev, sg, nents, dir, NULL);
68} 127}
69 128
70static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, 129static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
71 dma_addr_t *dma_handle, gfp_t gfp) 130 size_t offset, size_t size,
131 enum dma_data_direction dir)
72{ 132{
73 struct dma_attrs attrs; 133 dma_addr_t addr;
74 134
75 dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs); 135 kmemcheck_mark_initialized(page_address(page) + offset, size);
136 BUG_ON(!valid_dma_direction(dir));
137 addr = or1k_map_page(dev, page, offset, size, dir, NULL);
138 debug_dma_map_page(dev, page, offset, size, dir, addr, false);
76 139
77 return dma_alloc_attrs(dev, size, dma_handle, gfp, &attrs); 140 return addr;
78} 141}
79 142
80static inline void dma_free_noncoherent(struct device *dev, size_t size, 143static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
81 void *cpu_addr, dma_addr_t dma_handle) 144 size_t size, enum dma_data_direction dir)
82{ 145{
83 struct dma_attrs attrs; 146 BUG_ON(!valid_dma_direction(dir));
147 or1k_unmap_page(dev, addr, size, dir, NULL);
148 debug_dma_unmap_page(dev, addr, size, dir, true);
149}
84 150
85 dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs); 151static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
152 size_t size,
153 enum dma_data_direction dir)
154{
155 BUG_ON(!valid_dma_direction(dir));
156 or1k_sync_single_for_cpu(dev, addr, size, dir);
157 debug_dma_sync_single_for_cpu(dev, addr, size, dir);
158}
86 159
87 dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs); 160static inline void dma_sync_single_for_device(struct device *dev,
161 dma_addr_t addr, size_t size,
162 enum dma_data_direction dir)
163{
164 BUG_ON(!valid_dma_direction(dir));
165 or1k_sync_single_for_device(dev, addr, size, dir);
166 debug_dma_sync_single_for_device(dev, addr, size, dir);
88} 167}
89 168
90static inline int dma_supported(struct device *dev, u64 dma_mask) 169static inline int dma_supported(struct device *dev, u64 dma_mask)
diff --git a/arch/openrisc/include/asm/elf.h b/arch/openrisc/include/asm/elf.h
index f4aa8a542a2..2ce603bbfdd 100644
--- a/arch/openrisc/include/asm/elf.h
+++ b/arch/openrisc/include/asm/elf.h
@@ -15,12 +15,52 @@
15 * the Free Software Foundation; either version 2 of the License, or 15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version. 16 * (at your option) any later version.
17 */ 17 */
18
18#ifndef __ASM_OPENRISC_ELF_H 19#ifndef __ASM_OPENRISC_ELF_H
19#define __ASM_OPENRISC_ELF_H 20#define __ASM_OPENRISC_ELF_H
20 21
21 22/*
23 * ELF register definitions..
24 */
22#include <linux/types.h> 25#include <linux/types.h>
23#include <uapi/asm/elf.h> 26#include <linux/ptrace.h>
27
28
29/* The OR1K relocation types... not all relevant for module loader */
30#define R_OR32_NONE 0
31#define R_OR32_32 1
32#define R_OR32_16 2
33#define R_OR32_8 3
34#define R_OR32_CONST 4
35#define R_OR32_CONSTH 5
36#define R_OR32_JUMPTARG 6
37#define R_OR32_VTINHERIT 7
38#define R_OR32_VTENTRY 8
39
40typedef unsigned long elf_greg_t;
41
42/*
43 * Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
44 * thus exposed to user-space.
45 */
46#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
47typedef elf_greg_t elf_gregset_t[ELF_NGREG];
48
49/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */
50typedef unsigned long elf_fpregset_t;
51
52/* This should be moved to include/linux/elf.h */
53#define EM_OR32 0x8472
54#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
55
56/*
57 * These are used to set parameters in the core dumps.
58 */
59#define ELF_ARCH EM_OR32
60#define ELF_CLASS ELFCLASS32
61#define ELF_DATA ELFDATA2MSB
62
63#ifdef __KERNEL__
24 64
25/* 65/*
26 * This is used to ensure we don't load something for the wrong architecture. 66 * This is used to ensure we don't load something for the wrong architecture.
@@ -62,7 +102,7 @@ extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt);
62 102
63#define ELF_PLATFORM (NULL) 103#define ELF_PLATFORM (NULL)
64 104
65#define SET_PERSONALITY(ex) \ 105#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
66 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
67 106
107#endif /* __KERNEL__ */
68#endif 108#endif
diff --git a/arch/openrisc/include/asm/gpio.h b/arch/openrisc/include/asm/gpio.h
index b3799d88ffc..0b0d174f47c 100644
--- a/arch/openrisc/include/asm/gpio.h
+++ b/arch/openrisc/include/asm/gpio.h
@@ -1,4 +1,65 @@
1#ifndef __LINUX_GPIO_H 1/*
2#warning Include linux/gpio.h instead of asm/gpio.h 2 * OpenRISC Linux
3#include <linux/gpio.h> 3 *
4#endif 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) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#ifndef __ASM_OPENRISC_GPIO_H
20#define __ASM_OPENRISC_GPIO_H
21
22#include <linux/errno.h>
23#include <asm-generic/gpio.h>
24
25#ifdef CONFIG_GPIOLIB
26
27/*
28 * OpenRISC (or1k) does not have on-chip GPIO's so there is not really
29 * any standardized implementation that makes sense here. If passing
30 * through gpiolib becomes a bottleneck then it may make sense, on a
31 * case-by-case basis, to implement these inlined/rapid versions.
32 *
33 * Just call gpiolib.
34 */
35static inline int gpio_get_value(unsigned int gpio)
36{
37 return __gpio_get_value(gpio);
38}
39
40static inline void gpio_set_value(unsigned int gpio, int value)
41{
42 __gpio_set_value(gpio, value);
43}
44
45static inline int gpio_cansleep(unsigned int gpio)
46{
47 return __gpio_cansleep(gpio);
48}
49
50/*
51 * Not implemented, yet.
52 */
53static inline int gpio_to_irq(unsigned int gpio)
54{
55 return -ENOSYS;
56}
57
58static inline int irq_to_gpio(unsigned int irq)
59{
60 return -EINVAL;
61}
62
63#endif /* CONFIG_GPIOLIB */
64
65#endif /* __ASM_OPENRISC_GPIO_H */
diff --git a/arch/openrisc/include/asm/io.h b/arch/openrisc/include/asm/io.h
index 7c691399da3..07f5299d6c2 100644
--- a/arch/openrisc/include/asm/io.h
+++ b/arch/openrisc/include/asm/io.h
@@ -30,7 +30,6 @@
30#define PIO_MASK 0 30#define PIO_MASK 0
31 31
32#include <asm-generic/io.h> 32#include <asm-generic/io.h>
33#include <asm/pgtable.h>
34 33
35extern void __iomem *__ioremap(phys_addr_t offset, unsigned long size, 34extern void __iomem *__ioremap(phys_addr_t offset, unsigned long size,
36 pgprot_t prot); 35 pgprot_t prot);
diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h
index 108906f991d..b041b344b22 100644
--- a/arch/openrisc/include/asm/page.h
+++ b/arch/openrisc/include/asm/page.h
@@ -71,6 +71,9 @@ typedef struct page *pgtable_t;
71#define __pgd(x) ((pgd_t) { (x) }) 71#define __pgd(x) ((pgd_t) { (x) })
72#define __pgprot(x) ((pgprot_t) { (x) }) 72#define __pgprot(x) ((pgprot_t) { (x) })
73 73
74extern unsigned long memory_start;
75extern unsigned long memory_end;
76
74#endif /* !__ASSEMBLY__ */ 77#endif /* !__ASSEMBLY__ */
75 78
76 79
@@ -91,7 +94,8 @@ typedef struct page *pgtable_t;
91 94
92#define pfn_valid(pfn) ((pfn) < max_mapnr) 95#define pfn_valid(pfn) ((pfn) < max_mapnr)
93 96
94#define virt_addr_valid(kaddr) (pfn_valid(virt_to_pfn(kaddr))) 97#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
98 ((void *)(kaddr) < (void *)memory_end))
95 99
96#endif /* __ASSEMBLY__ */ 100#endif /* __ASSEMBLY__ */
97 101
diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h
index 14c900cfd30..043505d7f68 100644
--- a/arch/openrisc/include/asm/pgtable.h
+++ b/arch/openrisc/include/asm/pgtable.h
@@ -455,6 +455,7 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
455 * No page table caches to initialise 455 * No page table caches to initialise
456 */ 456 */
457#define pgtable_cache_init() do { } while (0) 457#define pgtable_cache_init() do { } while (0)
458#define io_remap_page_range remap_page_range
458 459
459typedef pte_t *pte_addr_t; 460typedef pte_t *pte_addr_t;
460 461
diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h
index 33691380608..bb54c97b978 100644
--- a/arch/openrisc/include/asm/processor.h
+++ b/arch/openrisc/include/asm/processor.h
@@ -72,14 +72,20 @@ struct thread_struct {
72#define task_pt_regs(task) user_regs(task_thread_info(task)) 72#define task_pt_regs(task) user_regs(task_thread_info(task))
73#define current_regs() user_regs(current_thread_info()) 73#define current_regs() user_regs(current_thread_info())
74 74
75extern inline void prepare_to_copy(struct task_struct *tsk)
76{
77}
78
75#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) 79#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
76 80
77#define INIT_THREAD { } 81#define INIT_THREAD { }
78 82
79 83
80#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) 84#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc);
81#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp) 85#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp);
86
82 87
88extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
83 89
84void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp); 90void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
85void release_thread(struct task_struct *); 91void release_thread(struct task_struct *);
@@ -101,7 +107,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
101 107
102#define init_stack (init_thread_union.stack) 108#define init_stack (init_thread_union.stack)
103 109
104#define cpu_relax() barrier() 110#define cpu_relax() do { } while (0)
105 111
106#endif /* __ASSEMBLY__ */ 112#endif /* __ASSEMBLY__ */
107#endif /* __ASM_OPENRISC_PROCESSOR_H */ 113#endif /* __ASM_OPENRISC_PROCESSOR_H */
diff --git a/arch/openrisc/include/asm/prom.h b/arch/openrisc/include/asm/prom.h
index bbb34e5343a..e1f3fe26606 100644
--- a/arch/openrisc/include/asm/prom.h
+++ b/arch/openrisc/include/asm/prom.h
@@ -24,7 +24,6 @@
24 24
25#include <linux/types.h> 25#include <linux/types.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <linux/irqdomain.h>
28#include <linux/atomic.h> 27#include <linux/atomic.h>
29#include <linux/of_irq.h> 28#include <linux/of_irq.h>
30#include <linux/of_fdt.h> 29#include <linux/of_fdt.h>
@@ -64,6 +63,15 @@ extern const void *of_get_mac_address(struct device_node *np);
64struct pci_dev; 63struct pci_dev;
65extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); 64extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
66 65
66/* This routine is here to provide compatibility with how powerpc
67 * handles IRQ mapping for OF device nodes. We precompute and permanently
68 * register them in the platform_device objects, whereas powerpc computes them
69 * on request.
70 */
71static inline void irq_dispose_mapping(unsigned int virq)
72{
73}
74
67#endif /* __ASSEMBLY__ */ 75#endif /* __ASSEMBLY__ */
68#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */
69#endif /* _ASM_OPENRISC_PROM_H */ 77#endif /* _ASM_OPENRISC_PROM_H */
diff --git a/arch/openrisc/include/asm/ptrace.h b/arch/openrisc/include/asm/ptrace.h
index 6ca17264c39..054537c5f9c 100644
--- a/arch/openrisc/include/asm/ptrace.h
+++ b/arch/openrisc/include/asm/ptrace.h
@@ -15,12 +15,27 @@
15 * the Free Software Foundation; either version 2 of the License, or 15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version. 16 * (at your option) any later version.
17 */ 17 */
18
18#ifndef __ASM_OPENRISC_PTRACE_H 19#ifndef __ASM_OPENRISC_PTRACE_H
19#define __ASM_OPENRISC_PTRACE_H 20#define __ASM_OPENRISC_PTRACE_H
20 21
21
22#include <asm/spr_defs.h> 22#include <asm/spr_defs.h>
23#include <uapi/asm/ptrace.h> 23
24#ifndef __ASSEMBLY__
25/*
26 * This is the layout of the regset returned by the GETREGSET ptrace call
27 */
28struct user_regs_struct {
29 /* GPR R0-R31... */
30 unsigned long gpr[32];
31 unsigned long pc;
32 unsigned long sr;
33 unsigned long pad1;
34 unsigned long pad2;
35};
36#endif
37
38#ifdef __KERNEL__
24 39
25/* 40/*
26 * Make kernel PTrace/register structures opaque to userspace... userspace can 41 * Make kernel PTrace/register structures opaque to userspace... userspace can
@@ -58,14 +73,11 @@ struct pt_regs {
58 }; 73 };
59 }; 74 };
60 long pc; 75 long pc;
61 /* For restarting system calls:
62 * Set to syscall number for syscall exceptions,
63 * -1 for all other exceptions.
64 */
65 long orig_gpr11; /* For restarting system calls */ 76 long orig_gpr11; /* For restarting system calls */
77 long syscallno; /* Syscall number (used by strace) */
66 long dummy; /* Cheap alignment fix */ 78 long dummy; /* Cheap alignment fix */
67 long dummy2; /* Cheap alignment fix */
68}; 79};
80#endif /* __ASSEMBLY__ */
69 81
70/* TODO: Rename this to REDZONE because that's what it is */ 82/* TODO: Rename this to REDZONE because that's what it is */
71#define STACK_FRAME_OVERHEAD 128 /* size of minimum stack frame */ 83#define STACK_FRAME_OVERHEAD 128 /* size of minimum stack frame */
@@ -75,13 +87,6 @@ struct pt_regs {
75#define user_stack_pointer(regs) ((unsigned long)(regs)->sp) 87#define user_stack_pointer(regs) ((unsigned long)(regs)->sp)
76#define profile_pc(regs) instruction_pointer(regs) 88#define profile_pc(regs) instruction_pointer(regs)
77 89
78static inline long regs_return_value(struct pt_regs *regs)
79{
80 return regs->gpr[11];
81}
82
83#endif /* __ASSEMBLY__ */
84
85/* 90/*
86 * Offsets used by 'ptrace' system call interface. 91 * Offsets used by 'ptrace' system call interface.
87 */ 92 */
@@ -121,4 +126,6 @@ static inline long regs_return_value(struct pt_regs *regs)
121#define PT_ORIG_GPR11 132 126#define PT_ORIG_GPR11 132
122#define PT_SYSCALLNO 136 127#define PT_SYSCALLNO 136
123 128
129#endif /* __KERNEL__ */
130
124#endif /* __ASM_OPENRISC_PTRACE_H */ 131#endif /* __ASM_OPENRISC_PTRACE_H */
diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h
index b752bb67891..9f0337055d2 100644
--- a/arch/openrisc/include/asm/syscall.h
+++ b/arch/openrisc/include/asm/syscall.h
@@ -25,7 +25,7 @@
25static inline int 25static inline int
26syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 26syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
27{ 27{
28 return regs->orig_gpr11; 28 return regs->syscallno ? regs->syscallno : -1;
29} 29}
30 30
31static inline void 31static inline void
@@ -50,7 +50,10 @@ static inline void
50syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, 50syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
51 int error, long val) 51 int error, long val)
52{ 52{
53 regs->gpr[11] = (long) error ?: val; 53 if (error)
54 regs->gpr[11] = -error;
55 else
56 regs->gpr[11] = val;
54} 57}
55 58
56static inline void 59static inline void
diff --git a/arch/openrisc/include/asm/syscalls.h b/arch/openrisc/include/asm/syscalls.h
index 8ee816812a9..84a978af44d 100644
--- a/arch/openrisc/include/asm/syscalls.h
+++ b/arch/openrisc/include/asm/syscalls.h
@@ -24,11 +24,4 @@ asmlinkage long sys_or1k_atomic(unsigned long type, unsigned long *v1,
24 24
25#include <asm-generic/syscalls.h> 25#include <asm-generic/syscalls.h>
26 26
27asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
28 void __user *parent_tid, void __user *child_tid, int tls);
29asmlinkage long __sys_fork(void);
30
31#define sys_clone __sys_clone
32#define sys_fork __sys_fork
33
34#endif /* __ASM_OPENRISC_SYSCALLS_H */ 27#endif /* __ASM_OPENRISC_SYSCALLS_H */
diff --git a/arch/openrisc/include/asm/thread_info.h b/arch/openrisc/include/asm/thread_info.h
index 07f3212422a..07a8bc080ef 100644
--- a/arch/openrisc/include/asm/thread_info.h
+++ b/arch/openrisc/include/asm/thread_info.h
@@ -121,6 +121,7 @@ register struct thread_info *current_thread_info_reg asm("r10");
121#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 121#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
122#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 122#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
123#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 123#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
124#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
124#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 125#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
125 126
126 127
@@ -128,8 +129,6 @@ register struct thread_info *current_thread_info_reg asm("r10");
128/* For OpenRISC, this is anything in the LSW other than syscall trace */ 129/* For OpenRISC, this is anything in the LSW other than syscall trace */
129#define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP)) 130#define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP))
130 131
131#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
132
133#endif /* __KERNEL__ */ 132#endif /* __KERNEL__ */
134 133
135#endif /* _ASM_THREAD_INFO_H */ 134#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h
index ab2e7a198a4..c310e45b538 100644
--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
@@ -26,6 +26,7 @@
26#include <linux/thread_info.h> 26#include <linux/thread_info.h>
27#include <linux/prefetch.h> 27#include <linux/prefetch.h>
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/thread_info.h>
29#include <asm/page.h> 30#include <asm/page.h>
30 31
31#define VERIFY_READ 0 32#define VERIFY_READ 0
@@ -313,12 +314,42 @@ clear_user(void *addr, unsigned long size)
313 return size; 314 return size;
314} 315}
315 316
316#define user_addr_max() \ 317extern int __strncpy_from_user(char *dst, const char *src, long count);
317 (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) 318
319static inline long strncpy_from_user(char *dst, const char *src, long count)
320{
321 if (access_ok(VERIFY_READ, src, 1))
322 return __strncpy_from_user(dst, src, count);
323 return -EFAULT;
324}
325
326/*
327 * Return the size of a string (including the ending 0)
328 *
329 * Return 0 for error
330 */
331
332extern int __strnlen_user(const char *str, long len, unsigned long top);
333
334/*
335 * Returns the length of the string at str (including the null byte),
336 * or 0 if we hit a page we can't access,
337 * or something > len if we didn't find a null byte.
338 *
339 * The `top' parameter to __strnlen_user is to make sure that
340 * we can never overflow from the user area into kernel space.
341 */
342static inline long strnlen_user(const char __user *str, long len)
343{
344 unsigned long top = (unsigned long)get_fs();
345 unsigned long res = 0;
346
347 if (__addr_ok(str))
348 res = __strnlen_user(str, len, top);
318 349
319extern long strncpy_from_user(char *dest, const char __user *src, long count); 350 return res;
351}
320 352
321extern __must_check long strlen_user(const char __user *str); 353#define strlen_user(str) strnlen_user(str, TASK_SIZE-1)
322extern __must_check long strnlen_user(const char __user *str, long n);
323 354
324#endif /* __ASM_OPENRISC_UACCESS_H */ 355#endif /* __ASM_OPENRISC_UACCESS_H */
diff --git a/arch/openrisc/include/uapi/asm/Kbuild b/arch/openrisc/include/uapi/asm/Kbuild
deleted file mode 100644
index 80761eb82b5..00000000000
--- a/arch/openrisc/include/uapi/asm/Kbuild
+++ /dev/null
@@ -1,10 +0,0 @@
1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm
3
4header-y += byteorder.h
5header-y += elf.h
6header-y += kvm_para.h
7header-y += param.h
8header-y += ptrace.h
9header-y += sigcontext.h
10header-y += unistd.h
diff --git a/arch/openrisc/include/uapi/asm/byteorder.h b/arch/openrisc/include/uapi/asm/byteorder.h
deleted file mode 100644
index 60d14f7e14e..00000000000
--- a/arch/openrisc/include/uapi/asm/byteorder.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <linux/byteorder/big_endian.h>
diff --git a/arch/openrisc/include/uapi/asm/elf.h b/arch/openrisc/include/uapi/asm/elf.h
deleted file mode 100644
index f02ea583042..00000000000
--- a/arch/openrisc/include/uapi/asm/elf.h
+++ /dev/null
@@ -1,69 +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) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#ifndef _UAPI__ASM_OPENRISC_ELF_H
20#define _UAPI__ASM_OPENRISC_ELF_H
21
22/*
23 * This files is partially exported to userspace. This allows us to keep
24 * the ELF bits in one place which should assist in keeping the kernel and
25 * userspace in sync.
26 */
27
28/*
29 * ELF register definitions..
30 */
31
32/* for struct user_regs_struct definition */
33#include <asm/ptrace.h>
34
35/* The OR1K relocation types... not all relevant for module loader */
36#define R_OR32_NONE 0
37#define R_OR32_32 1
38#define R_OR32_16 2
39#define R_OR32_8 3
40#define R_OR32_CONST 4
41#define R_OR32_CONSTH 5
42#define R_OR32_JUMPTARG 6
43#define R_OR32_VTINHERIT 7
44#define R_OR32_VTENTRY 8
45
46typedef unsigned long elf_greg_t;
47
48/*
49 * Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
50 * thus exposed to user-space.
51 */
52#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
53typedef elf_greg_t elf_gregset_t[ELF_NGREG];
54
55/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */
56typedef unsigned long elf_fpregset_t;
57
58/* This should be moved to include/linux/elf.h */
59#define EM_OR32 0x8472
60#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
61
62/*
63 * These are used to set parameters in the core dumps.
64 */
65#define ELF_ARCH EM_OR32
66#define ELF_CLASS ELFCLASS32
67#define ELF_DATA ELFDATA2MSB
68
69#endif /* _UAPI__ASM_OPENRISC_ELF_H */
diff --git a/arch/openrisc/include/uapi/asm/param.h b/arch/openrisc/include/uapi/asm/param.h
deleted file mode 100644
index c39a336610e..00000000000
--- a/arch/openrisc/include/uapi/asm/param.h
+++ /dev/null
@@ -1,26 +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) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#ifndef __ASM_OPENRISC_PARAM_H
20#define __ASM_OPENRISC_PARAM_H
21
22#define EXEC_PAGESIZE 8192
23
24#include <asm-generic/param.h>
25
26#endif /* __ASM_OPENRISC_PARAM_H */
diff --git a/arch/openrisc/include/uapi/asm/ptrace.h b/arch/openrisc/include/uapi/asm/ptrace.h
deleted file mode 100644
index 9760bd17fbc..00000000000
--- a/arch/openrisc/include/uapi/asm/ptrace.h
+++ /dev/null
@@ -1,35 +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) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#ifndef _UAPI__ASM_OPENRISC_PTRACE_H
20#define _UAPI__ASM_OPENRISC_PTRACE_H
21
22#ifndef __ASSEMBLY__
23/*
24 * This is the layout of the regset returned by the GETREGSET ptrace call
25 */
26struct user_regs_struct {
27 /* GPR R0-R31... */
28 unsigned long gpr[32];
29 unsigned long pc;
30 unsigned long sr;
31};
32#endif
33
34
35#endif /* _UAPI__ASM_OPENRISC_PTRACE_H */
diff --git a/arch/openrisc/include/uapi/asm/sigcontext.h b/arch/openrisc/include/uapi/asm/sigcontext.h
deleted file mode 100644
index b79c2b19afb..00000000000
--- a/arch/openrisc/include/uapi/asm/sigcontext.h
+++ /dev/null
@@ -1,33 +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) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#ifndef __ASM_OPENRISC_SIGCONTEXT_H
20#define __ASM_OPENRISC_SIGCONTEXT_H
21
22#include <asm/ptrace.h>
23
24/* This struct is saved by setup_frame in signal.c, to keep the current
25 context while a signal handler is executed. It's restored by sys_sigreturn.
26*/
27
28struct sigcontext {
29 struct user_regs_struct regs; /* needs to be first */
30 unsigned long oldmask;
31};
32
33#endif /* __ASM_OPENRISC_SIGCONTEXT_H */
diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
deleted file mode 100644
index ce40b71df00..00000000000
--- a/arch/openrisc/include/uapi/asm/unistd.h
+++ /dev/null
@@ -1,29 +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) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#define __ARCH_HAVE_MMU
20
21#define sys_mmap2 sys_mmap_pgoff
22
23#define __ARCH_WANT_SYS_FORK
24#define __ARCH_WANT_SYS_CLONE
25
26#include <asm-generic/unistd.h>
27
28#define __NR_or1k_atomic __NR_arch_specific_syscall
29__SYSCALL(__NR_or1k_atomic, sys_or1k_atomic)