aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-08-31 03:45:21 -0400
committerIngo Molnar <mingo@elte.hu>2010-08-31 03:45:46 -0400
commitdaab7fc734a53fdeaf844b7c03053118ad1769da (patch)
tree575deb3cdcc6dda562acaed6f7c29bc81ae01cf2 /arch/sparc/include/asm
parent774ea0bcb27f57b6fd521b3b6c43237782fed4b9 (diff)
parent2bfc96a127bc1cc94d26bfaa40159966064f9c8c (diff)
Merge commit 'v2.6.36-rc3' into x86/memblock
Conflicts: arch/x86/kernel/trampoline.c mm/memblock.c Merge reason: Resolve the conflicts, update to latest upstream. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/sparc/include/asm')
-rw-r--r--arch/sparc/include/asm/atomic_64.h10
-rw-r--r--arch/sparc/include/asm/backoff.h11
-rw-r--r--arch/sparc/include/asm/device.h11
-rw-r--r--arch/sparc/include/asm/dma-mapping.h10
-rw-r--r--arch/sparc/include/asm/fb.h4
-rw-r--r--arch/sparc/include/asm/floppy_64.h10
-rw-r--r--arch/sparc/include/asm/highmem.h2
-rw-r--r--arch/sparc/include/asm/ioctls.h2
-rw-r--r--arch/sparc/include/asm/local64.h1
-rw-r--r--arch/sparc/include/asm/of_device.h38
-rw-r--r--arch/sparc/include/asm/of_platform.h18
-rw-r--r--arch/sparc/include/asm/oplib_64.h27
-rw-r--r--arch/sparc/include/asm/parport.h16
-rw-r--r--arch/sparc/include/asm/perf_event.h23
-rw-r--r--arch/sparc/include/asm/prom.h10
-rw-r--r--arch/sparc/include/asm/rwsem-const.h12
-rw-r--r--arch/sparc/include/asm/rwsem.h120
-rw-r--r--arch/sparc/include/asm/scatterlist.h1
-rw-r--r--arch/sparc/include/asm/system_64.h1
-rw-r--r--arch/sparc/include/asm/termbits.h1
-rw-r--r--arch/sparc/include/asm/uaccess_32.h15
-rw-r--r--arch/sparc/include/asm/uaccess_64.h23
-rw-r--r--arch/sparc/include/asm/unistd.h5
23 files changed, 190 insertions, 181 deletions
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index 2050ca02c423..bdb2ff880bdd 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -20,14 +20,14 @@
20#define atomic64_set(v, i) (((v)->counter) = i) 20#define atomic64_set(v, i) (((v)->counter) = i)
21 21
22extern void atomic_add(int, atomic_t *); 22extern void atomic_add(int, atomic_t *);
23extern void atomic64_add(int, atomic64_t *); 23extern void atomic64_add(long, atomic64_t *);
24extern void atomic_sub(int, atomic_t *); 24extern void atomic_sub(int, atomic_t *);
25extern void atomic64_sub(int, atomic64_t *); 25extern void atomic64_sub(long, atomic64_t *);
26 26
27extern int atomic_add_ret(int, atomic_t *); 27extern int atomic_add_ret(int, atomic_t *);
28extern int atomic64_add_ret(int, atomic64_t *); 28extern long atomic64_add_ret(long, atomic64_t *);
29extern int atomic_sub_ret(int, atomic_t *); 29extern int atomic_sub_ret(int, atomic_t *);
30extern int atomic64_sub_ret(int, atomic64_t *); 30extern long atomic64_sub_ret(long, atomic64_t *);
31 31
32#define atomic_dec_return(v) atomic_sub_ret(1, v) 32#define atomic_dec_return(v) atomic_sub_ret(1, v)
33#define atomic64_dec_return(v) atomic64_sub_ret(1, v) 33#define atomic64_dec_return(v) atomic64_sub_ret(1, v)
@@ -91,7 +91,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
91 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n))) 91 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
92#define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) 92#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
93 93
94static inline int atomic64_add_unless(atomic64_t *v, long a, long u) 94static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
95{ 95{
96 long c, old; 96 long c, old;
97 c = atomic64_read(v); 97 c = atomic64_read(v);
diff --git a/arch/sparc/include/asm/backoff.h b/arch/sparc/include/asm/backoff.h
index fa1fdf67e350..db3af0d30fb1 100644
--- a/arch/sparc/include/asm/backoff.h
+++ b/arch/sparc/include/asm/backoff.h
@@ -8,6 +8,9 @@
8#define BACKOFF_SETUP(reg) \ 8#define BACKOFF_SETUP(reg) \
9 mov 1, reg 9 mov 1, reg
10 10
11#define BACKOFF_LABEL(spin_label, continue_label) \
12 spin_label
13
11#define BACKOFF_SPIN(reg, tmp, label) \ 14#define BACKOFF_SPIN(reg, tmp, label) \
12 mov reg, tmp; \ 15 mov reg, tmp; \
1388: brnz,pt tmp, 88b; \ 1688: brnz,pt tmp, 88b; \
@@ -22,9 +25,11 @@
22#else 25#else
23 26
24#define BACKOFF_SETUP(reg) 27#define BACKOFF_SETUP(reg)
25#define BACKOFF_SPIN(reg, tmp, label) \ 28
26 ba,pt %xcc, label; \ 29#define BACKOFF_LABEL(spin_label, continue_label) \
27 nop; 30 continue_label
31
32#define BACKOFF_SPIN(reg, tmp, label)
28 33
29#endif 34#endif
30 35
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index d4c452147412..daa6a8a5e9cd 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -6,18 +6,25 @@
6#ifndef _ASM_SPARC_DEVICE_H 6#ifndef _ASM_SPARC_DEVICE_H
7#define _ASM_SPARC_DEVICE_H 7#define _ASM_SPARC_DEVICE_H
8 8
9#include <asm/openprom.h>
10
9struct device_node; 11struct device_node;
10struct of_device; 12struct platform_device;
11 13
12struct dev_archdata { 14struct dev_archdata {
13 void *iommu; 15 void *iommu;
14 void *stc; 16 void *stc;
15 void *host_controller; 17 void *host_controller;
16 struct of_device *op; 18 struct platform_device *op;
17 int numa_node; 19 int numa_node;
18}; 20};
19 21
22extern void of_propagate_archdata(struct platform_device *bus);
23
20struct pdev_archdata { 24struct pdev_archdata {
25 struct resource resource[PROMREG_MAX];
26 unsigned int irqs[PROMINTR_MAX];
27 int num_irqs;
21}; 28};
22 29
23#endif /* _ASM_SPARC_DEVICE_H */ 30#endif /* _ASM_SPARC_DEVICE_H */
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 4b4a0c0b0ccd..8c0e4f7bb204 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -11,7 +11,6 @@ extern int dma_supported(struct device *dev, u64 mask);
11 11
12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
14#define dma_is_consistent(d, h) (1)
15 14
16extern struct dma_map_ops *dma_ops, pci32_dma_ops; 15extern struct dma_map_ops *dma_ops, pci32_dma_ops;
17extern struct bus_type pci_bus_type; 16extern struct bus_type pci_bus_type;
@@ -52,15 +51,6 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
52 return (dma_addr == DMA_ERROR_CODE); 51 return (dma_addr == DMA_ERROR_CODE);
53} 52}
54 53
55static inline int dma_get_cache_alignment(void)
56{
57 /*
58 * no easy way to get cache size on all processors, so return
59 * the maximum possible, to be safe
60 */
61 return (1 << INTERNODE_CACHE_SHIFT);
62}
63
64static inline int dma_set_mask(struct device *dev, u64 mask) 54static inline int dma_set_mask(struct device *dev, u64 mask)
65{ 55{
66#ifdef CONFIG_PCI 56#ifdef CONFIG_PCI
diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
index e834880be204..2173432ad7f7 100644
--- a/arch/sparc/include/asm/fb.h
+++ b/arch/sparc/include/asm/fb.h
@@ -1,5 +1,6 @@
1#ifndef _SPARC_FB_H_ 1#ifndef _SPARC_FB_H_
2#define _SPARC_FB_H_ 2#define _SPARC_FB_H_
3#include <linux/console.h>
3#include <linux/fb.h> 4#include <linux/fb.h>
4#include <linux/fs.h> 5#include <linux/fs.h>
5#include <asm/page.h> 6#include <asm/page.h>
@@ -18,6 +19,9 @@ static inline int fb_is_primary_device(struct fb_info *info)
18 struct device *dev = info->device; 19 struct device *dev = info->device;
19 struct device_node *node; 20 struct device_node *node;
20 21
22 if (console_set_on_cmdline)
23 return 0;
24
21 node = dev->of_node; 25 node = dev->of_node;
22 if (node && 26 if (node &&
23 node == of_console_device) 27 node == of_console_device)
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index 8fac3ab22f36..6597ce874d78 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -43,7 +43,7 @@ struct sun_flpy_controller {
43/* You'll only ever find one controller on an Ultra anyways. */ 43/* You'll only ever find one controller on an Ultra anyways. */
44static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1; 44static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1;
45unsigned long fdc_status; 45unsigned long fdc_status;
46static struct of_device *floppy_op = NULL; 46static struct platform_device *floppy_op = NULL;
47 47
48struct sun_floppy_ops { 48struct sun_floppy_ops {
49 unsigned char (*fd_inb) (unsigned long port); 49 unsigned char (*fd_inb) (unsigned long port);
@@ -548,7 +548,7 @@ static unsigned long __init sun_floppy_init(void)
548{ 548{
549 static int initialized = 0; 549 static int initialized = 0;
550 struct device_node *dp; 550 struct device_node *dp;
551 struct of_device *op; 551 struct platform_device *op;
552 const char *prop; 552 const char *prop;
553 char state[128]; 553 char state[128];
554 554
@@ -567,7 +567,7 @@ static unsigned long __init sun_floppy_init(void)
567 } 567 }
568 if (op) { 568 if (op) {
569 floppy_op = op; 569 floppy_op = op;
570 FLOPPY_IRQ = op->irqs[0]; 570 FLOPPY_IRQ = op->archdata.irqs[0];
571 } else { 571 } else {
572 struct device_node *ebus_dp; 572 struct device_node *ebus_dp;
573 void __iomem *auxio_reg; 573 void __iomem *auxio_reg;
@@ -593,7 +593,7 @@ static unsigned long __init sun_floppy_init(void)
593 if (state_prop && !strncmp(state_prop, "disabled", 8)) 593 if (state_prop && !strncmp(state_prop, "disabled", 8))
594 return 0; 594 return 0;
595 595
596 FLOPPY_IRQ = op->irqs[0]; 596 FLOPPY_IRQ = op->archdata.irqs[0];
597 597
598 /* Make sure the high density bit is set, some systems 598 /* Make sure the high density bit is set, some systems
599 * (most notably Ultra5/Ultra10) come up with it clear. 599 * (most notably Ultra5/Ultra10) come up with it clear.
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
661 config = 0; 661 config = 0;
662 for (dp = ebus_dp->child; dp; dp = dp->sibling) { 662 for (dp = ebus_dp->child; dp; dp = dp->sibling) {
663 if (!strcmp(dp->name, "ecpp")) { 663 if (!strcmp(dp->name, "ecpp")) {
664 struct of_device *ecpp_op; 664 struct platform_device *ecpp_op;
665 665
666 ecpp_op = of_find_device_by_node(dp); 666 ecpp_op = of_find_device_by_node(dp);
667 if (ecpp_op) 667 if (ecpp_op)
diff --git a/arch/sparc/include/asm/highmem.h b/arch/sparc/include/asm/highmem.h
index 3de42e776274..ec23b0a87b98 100644
--- a/arch/sparc/include/asm/highmem.h
+++ b/arch/sparc/include/asm/highmem.h
@@ -71,7 +71,7 @@ static inline void kunmap(struct page *page)
71} 71}
72 72
73extern void *kmap_atomic(struct page *page, enum km_type type); 73extern void *kmap_atomic(struct page *page, enum km_type type);
74extern void kunmap_atomic(void *kvaddr, enum km_type type); 74extern void kunmap_atomic_notypecheck(void *kvaddr, enum km_type type);
75extern struct page *kmap_atomic_to_page(void *vaddr); 75extern struct page *kmap_atomic_to_page(void *vaddr);
76 76
77#define flush_cache_kmaps() flush_cache_all() 77#define flush_cache_kmaps() flush_cache_all()
diff --git a/arch/sparc/include/asm/ioctls.h b/arch/sparc/include/asm/ioctls.h
index 1fe6855c5c18..53f4ee009bdd 100644
--- a/arch/sparc/include/asm/ioctls.h
+++ b/arch/sparc/include/asm/ioctls.h
@@ -80,6 +80,7 @@
80/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ 80/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
81#define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ 81#define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */
82#define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ 82#define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */
83#define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */
83 84
84/* Little f */ 85/* Little f */
85#define FIOCLEX _IO('f', 1) 86#define FIOCLEX _IO('f', 1)
@@ -132,5 +133,6 @@
132#define TIOCPKT_START 8 133#define TIOCPKT_START 8
133#define TIOCPKT_NOSTOP 16 134#define TIOCPKT_NOSTOP 16
134#define TIOCPKT_DOSTOP 32 135#define TIOCPKT_DOSTOP 32
136#define TIOCPKT_IOCTL 64
135 137
136#endif /* !(_ASM_SPARC_IOCTLS_H) */ 138#endif /* !(_ASM_SPARC_IOCTLS_H) */
diff --git a/arch/sparc/include/asm/local64.h b/arch/sparc/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/sparc/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h
deleted file mode 100644
index f320246a0586..000000000000
--- a/arch/sparc/include/asm/of_device.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _ASM_SPARC_OF_DEVICE_H
2#define _ASM_SPARC_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/of.h>
7#include <linux/mod_devicetable.h>
8#include <asm/openprom.h>
9
10/*
11 * The of_device is a kind of "base class" that is a superset of
12 * struct device for use by devices attached to an OF node and
13 * probed using OF properties.
14 */
15struct of_device
16{
17 struct device dev;
18 struct resource resource[PROMREG_MAX];
19 unsigned int irqs[PROMINTR_MAX];
20 int num_irqs;
21
22 void *sysdata;
23
24 int slot;
25 int portid;
26 int clock_freq;
27};
28
29extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
30extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
31
32extern void of_propagate_archdata(struct of_device *bus);
33
34/* This is just here during the transition */
35#include <linux/of_platform.h>
36
37#endif /* __KERNEL__ */
38#endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/arch/sparc/include/asm/of_platform.h b/arch/sparc/include/asm/of_platform.h
deleted file mode 100644
index 90da99059f83..000000000000
--- a/arch/sparc/include/asm/of_platform.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef ___ASM_SPARC_OF_PLATFORM_H
2#define ___ASM_SPARC_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm/of_device.h
7 * by Stephen Rothwell
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16#define of_bus_type of_platform_bus_type /* for compatibility */
17
18#endif
diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h
index a5db0317b5fb..3e0b2d62303d 100644
--- a/arch/sparc/include/asm/oplib_64.h
+++ b/arch/sparc/include/asm/oplib_64.h
@@ -185,9 +185,8 @@ extern int prom_getunumber(int syndrome_code,
185 char *buf, int buflen); 185 char *buf, int buflen);
186 186
187/* Retain physical memory to the caller across soft resets. */ 187/* Retain physical memory to the caller across soft resets. */
188extern unsigned long prom_retain(const char *name, 188extern int prom_retain(const char *name, unsigned long size,
189 unsigned long pa_low, unsigned long pa_high, 189 unsigned long align, unsigned long *paddr);
190 long size, long align);
191 190
192/* Load explicit I/D TLB entries into the calling processor. */ 191/* Load explicit I/D TLB entries into the calling processor. */
193extern long prom_itlb_load(unsigned long index, 192extern long prom_itlb_load(unsigned long index,
@@ -287,26 +286,6 @@ extern void prom_sun4v_guest_soft_state(void);
287extern int prom_ihandle2path(int handle, char *buffer, int bufsize); 286extern int prom_ihandle2path(int handle, char *buffer, int bufsize);
288 287
289/* Client interface level routines. */ 288/* Client interface level routines. */
290extern long p1275_cmd(const char *, long, ...); 289extern void p1275_cmd_direct(unsigned long *);
291
292#if 0
293#define P1275_SIZE(x) ((((long)((x) / 32)) << 32) | (x))
294#else
295#define P1275_SIZE(x) x
296#endif
297
298/* We support at most 16 input and 1 output argument */
299#define P1275_ARG_NUMBER 0
300#define P1275_ARG_IN_STRING 1
301#define P1275_ARG_OUT_BUF 2
302#define P1275_ARG_OUT_32B 3
303#define P1275_ARG_IN_FUNCTION 4
304#define P1275_ARG_IN_BUF 5
305#define P1275_ARG_IN_64B 6
306
307#define P1275_IN(x) ((x) & 0xf)
308#define P1275_OUT(x) (((x) << 4) & 0xf0)
309#define P1275_INOUT(i,o) (P1275_IN(i)|P1275_OUT(o))
310#define P1275_ARG(n,x) ((x) << ((n)*3 + 8))
311 290
312#endif /* !(__SPARC64_OPLIB_H) */ 291#endif /* !(__SPARC64_OPLIB_H) */
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index c333b8d0949b..aa4c82648d88 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int dmanr)
103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
104} 104}
105 105
106static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match) 106static int __devinit ecpp_probe(struct platform_device *op, const struct of_device_id *match)
107{ 107{
108 unsigned long base = op->resource[0].start; 108 unsigned long base = op->resource[0].start;
109 unsigned long config = op->resource[1].start; 109 unsigned long config = op->resource[1].start;
@@ -116,7 +116,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
116 parent = op->dev.of_node->parent; 116 parent = op->dev.of_node->parent;
117 if (!strcmp(parent->name, "dma")) { 117 if (!strcmp(parent->name, "dma")) {
118 p = parport_pc_probe_port(base, base + 0x400, 118 p = parport_pc_probe_port(base, base + 0x400,
119 op->irqs[0], PARPORT_DMA_NOFIFO, 119 op->archdata.irqs[0], PARPORT_DMA_NOFIFO,
120 op->dev.parent->parent, 0); 120 op->dev.parent->parent, 0);
121 if (!p) 121 if (!p)
122 return -ENOMEM; 122 return -ENOMEM;
@@ -166,7 +166,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
166 0, PTR_LPT_REG_DIR); 166 0, PTR_LPT_REG_DIR);
167 167
168 p = parport_pc_probe_port(base, base + 0x400, 168 p = parport_pc_probe_port(base, base + 0x400,
169 op->irqs[0], 169 op->archdata.irqs[0],
170 slot, 170 slot,
171 op->dev.parent, 171 op->dev.parent,
172 0); 172 0);
@@ -192,7 +192,7 @@ out_err:
192 return err; 192 return err;
193} 193}
194 194
195static int __devexit ecpp_remove(struct of_device *op) 195static int __devexit ecpp_remove(struct platform_device *op)
196{ 196{
197 struct parport *p = dev_get_drvdata(&op->dev); 197 struct parport *p = dev_get_drvdata(&op->dev);
198 int slot = p->dma; 198 int slot = p->dma;
@@ -228,6 +228,10 @@ static const struct of_device_id ecpp_match[] = {
228 .name = "parallel", 228 .name = "parallel",
229 .compatible = "ns87317-ecpp", 229 .compatible = "ns87317-ecpp",
230 }, 230 },
231 {
232 .name = "parallel",
233 .compatible = "pnpALI,1533,3",
234 },
231 {}, 235 {},
232}; 236};
233 237
@@ -243,9 +247,7 @@ static struct of_platform_driver ecpp_driver = {
243 247
244static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 248static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
245{ 249{
246 of_register_driver(&ecpp_driver, &of_bus_type); 250 return of_register_platform_driver(&ecpp_driver);
247
248 return 0;
249} 251}
250 252
251#endif /* !(_ASM_SPARC64_PARPORT_H */ 253#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/arch/sparc/include/asm/perf_event.h b/arch/sparc/include/asm/perf_event.h
index 7e2669894ce8..727af70646cb 100644
--- a/arch/sparc/include/asm/perf_event.h
+++ b/arch/sparc/include/asm/perf_event.h
@@ -6,7 +6,30 @@ extern void set_perf_event_pending(void);
6#define PERF_EVENT_INDEX_OFFSET 0 6#define PERF_EVENT_INDEX_OFFSET 0
7 7
8#ifdef CONFIG_PERF_EVENTS 8#ifdef CONFIG_PERF_EVENTS
9#include <asm/ptrace.h>
10
9extern void init_hw_perf_events(void); 11extern void init_hw_perf_events(void);
12
13#define perf_arch_fetch_caller_regs(regs, ip) \
14do { \
15 unsigned long _pstate, _asi, _pil, _i7, _fp; \
16 __asm__ __volatile__("rdpr %%pstate, %0\n\t" \
17 "rd %%asi, %1\n\t" \
18 "rdpr %%pil, %2\n\t" \
19 "mov %%i7, %3\n\t" \
20 "mov %%i6, %4\n\t" \
21 : "=r" (_pstate), \
22 "=r" (_asi), \
23 "=r" (_pil), \
24 "=r" (_i7), \
25 "=r" (_fp)); \
26 (regs)->tstate = (_pstate << 8) | \
27 (_asi << 24) | (_pil << 20); \
28 (regs)->tpc = (ip); \
29 (regs)->tnpc = (regs)->tpc + 4; \
30 (regs)->u_regs[UREG_I6] = _fp; \
31 (regs)->u_regs[UREG_I7] = _i7; \
32} while (0)
10#else 33#else
11static inline void init_hw_perf_events(void) { } 34static inline void init_hw_perf_events(void) { }
12#endif 35#endif
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index f845828ca4c6..291f12575edd 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -43,20 +43,22 @@ extern int of_getintprop_default(struct device_node *np,
43extern int of_find_in_proplist(const char *list, const char *match, int len); 43extern int of_find_in_proplist(const char *list, const char *match, int len);
44#ifdef CONFIG_NUMA 44#ifdef CONFIG_NUMA
45extern int of_node_to_nid(struct device_node *dp); 45extern int of_node_to_nid(struct device_node *dp);
46#else 46#define of_node_to_nid of_node_to_nid
47#define of_node_to_nid(dp) (-1)
48#endif 47#endif
49 48
50extern void prom_build_devicetree(void); 49extern void prom_build_devicetree(void);
51extern void of_populate_present_mask(void); 50extern void of_populate_present_mask(void);
52extern void of_fill_in_cpu_data(void); 51extern void of_fill_in_cpu_data(void);
53 52
53struct resource;
54extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
55extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
56
54/* These routines are here to provide compatibility with how powerpc 57/* These routines are here to provide compatibility with how powerpc
55 * handles IRQ mapping for OF device nodes. We precompute and permanently 58 * handles IRQ mapping for OF device nodes. We precompute and permanently
56 * register them in the of_device objects, whereas powerpc computes them 59 * register them in the platform_device objects, whereas powerpc computes them
57 * on request. 60 * on request.
58 */ 61 */
59extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
60static inline void irq_dispose_mapping(unsigned int virq) 62static inline void irq_dispose_mapping(unsigned int virq)
61{ 63{
62} 64}
diff --git a/arch/sparc/include/asm/rwsem-const.h b/arch/sparc/include/asm/rwsem-const.h
deleted file mode 100644
index a303c9d64d84..000000000000
--- a/arch/sparc/include/asm/rwsem-const.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/* rwsem-const.h: RW semaphore counter constants. */
2#ifndef _SPARC64_RWSEM_CONST_H
3#define _SPARC64_RWSEM_CONST_H
4
5#define RWSEM_UNLOCKED_VALUE 0x00000000
6#define RWSEM_ACTIVE_BIAS 0x00000001
7#define RWSEM_ACTIVE_MASK 0x0000ffff
8#define RWSEM_WAITING_BIAS 0xffff0000
9#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
10#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
11
12#endif /* _SPARC64_RWSEM_CONST_H */
diff --git a/arch/sparc/include/asm/rwsem.h b/arch/sparc/include/asm/rwsem.h
index 6e5621006f85..a2b4302869bc 100644
--- a/arch/sparc/include/asm/rwsem.h
+++ b/arch/sparc/include/asm/rwsem.h
@@ -15,16 +15,21 @@
15 15
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <asm/rwsem-const.h>
19 18
20struct rwsem_waiter; 19struct rwsem_waiter;
21 20
22struct rw_semaphore { 21struct rw_semaphore {
23 signed int count; 22 signed long count;
24 spinlock_t wait_lock; 23#define RWSEM_UNLOCKED_VALUE 0x00000000L
25 struct list_head wait_list; 24#define RWSEM_ACTIVE_BIAS 0x00000001L
25#define RWSEM_ACTIVE_MASK 0xffffffffL
26#define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1)
27#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
28#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
29 spinlock_t wait_lock;
30 struct list_head wait_list;
26#ifdef CONFIG_DEBUG_LOCK_ALLOC 31#ifdef CONFIG_DEBUG_LOCK_ALLOC
27 struct lockdep_map dep_map; 32 struct lockdep_map dep_map;
28#endif 33#endif
29}; 34};
30 35
@@ -41,6 +46,11 @@ struct rw_semaphore {
41#define DECLARE_RWSEM(name) \ 46#define DECLARE_RWSEM(name) \
42 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 47 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
43 48
49extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
50extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
51extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
52extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
53
44extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 54extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
45 struct lock_class_key *key); 55 struct lock_class_key *key);
46 56
@@ -51,27 +61,103 @@ do { \
51 __init_rwsem((sem), #sem, &__key); \ 61 __init_rwsem((sem), #sem, &__key); \
52} while (0) 62} while (0)
53 63
54extern void __down_read(struct rw_semaphore *sem); 64/*
55extern int __down_read_trylock(struct rw_semaphore *sem); 65 * lock for reading
56extern void __down_write(struct rw_semaphore *sem); 66 */
57extern int __down_write_trylock(struct rw_semaphore *sem); 67static inline void __down_read(struct rw_semaphore *sem)
58extern void __up_read(struct rw_semaphore *sem); 68{
59extern void __up_write(struct rw_semaphore *sem); 69 if (unlikely(atomic64_inc_return((atomic64_t *)(&sem->count)) <= 0L))
60extern void __downgrade_write(struct rw_semaphore *sem); 70 rwsem_down_read_failed(sem);
71}
72
73static inline int __down_read_trylock(struct rw_semaphore *sem)
74{
75 long tmp;
76
77 while ((tmp = sem->count) >= 0L) {
78 if (tmp == cmpxchg(&sem->count, tmp,
79 tmp + RWSEM_ACTIVE_READ_BIAS)) {
80 return 1;
81 }
82 }
83 return 0;
84}
61 85
86/*
87 * lock for writing
88 */
62static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) 89static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
63{ 90{
64 __down_write(sem); 91 long tmp;
92
93 tmp = atomic64_add_return(RWSEM_ACTIVE_WRITE_BIAS,
94 (atomic64_t *)(&sem->count));
95 if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS))
96 rwsem_down_write_failed(sem);
65} 97}
66 98
67static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) 99static inline void __down_write(struct rw_semaphore *sem)
68{ 100{
69 return atomic_add_return(delta, (atomic_t *)(&sem->count)); 101 __down_write_nested(sem, 0);
102}
103
104static inline int __down_write_trylock(struct rw_semaphore *sem)
105{
106 long tmp;
107
108 tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE,
109 RWSEM_ACTIVE_WRITE_BIAS);
110 return tmp == RWSEM_UNLOCKED_VALUE;
70} 111}
71 112
72static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem) 113/*
114 * unlock after reading
115 */
116static inline void __up_read(struct rw_semaphore *sem)
117{
118 long tmp;
119
120 tmp = atomic64_dec_return((atomic64_t *)(&sem->count));
121 if (unlikely(tmp < -1L && (tmp & RWSEM_ACTIVE_MASK) == 0L))
122 rwsem_wake(sem);
123}
124
125/*
126 * unlock after writing
127 */
128static inline void __up_write(struct rw_semaphore *sem)
129{
130 if (unlikely(atomic64_sub_return(RWSEM_ACTIVE_WRITE_BIAS,
131 (atomic64_t *)(&sem->count)) < 0L))
132 rwsem_wake(sem);
133}
134
135/*
136 * implement atomic add functionality
137 */
138static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
139{
140 atomic64_add(delta, (atomic64_t *)(&sem->count));
141}
142
143/*
144 * downgrade write lock to read lock
145 */
146static inline void __downgrade_write(struct rw_semaphore *sem)
147{
148 long tmp;
149
150 tmp = atomic64_add_return(-RWSEM_WAITING_BIAS, (atomic64_t *)(&sem->count));
151 if (tmp < 0L)
152 rwsem_downgrade_wake(sem);
153}
154
155/*
156 * implement exchange and add functionality
157 */
158static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
73{ 159{
74 atomic_add(delta, (atomic_t *)(&sem->count)); 160 return atomic64_add_return(delta, (atomic64_t *)(&sem->count));
75} 161}
76 162
77static inline int rwsem_is_locked(struct rw_semaphore *sem) 163static inline int rwsem_is_locked(struct rw_semaphore *sem)
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
index 433e45f05fd4..92bb638313f8 100644
--- a/arch/sparc/include/asm/scatterlist.h
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -3,7 +3,6 @@
3 3
4#include <asm-generic/scatterlist.h> 4#include <asm-generic/scatterlist.h>
5 5
6#define ISA_DMA_THRESHOLD (~0UL)
7#define ARCH_HAS_SG_CHAIN 6#define ARCH_HAS_SG_CHAIN
8 7
9#endif /* !(_SPARC_SCATTERLIST_H) */ 8#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h
index d24cfe16afc1..e3b65d8cf41b 100644
--- a/arch/sparc/include/asm/system_64.h
+++ b/arch/sparc/include/asm/system_64.h
@@ -106,6 +106,7 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
106 */ 106 */
107#define write_pic(__p) \ 107#define write_pic(__p) \
108 __asm__ __volatile__("ba,pt %%xcc, 99f\n\t" \ 108 __asm__ __volatile__("ba,pt %%xcc, 99f\n\t" \
109 " nop\n\t" \
109 ".align 64\n" \ 110 ".align 64\n" \
110 "99:wr %0, 0x0, %%pic\n\t" \ 111 "99:wr %0, 0x0, %%pic\n\t" \
111 "rd %%pic, %%g0" : : "r" (__p)) 112 "rd %%pic, %%g0" : : "r" (__p))
diff --git a/arch/sparc/include/asm/termbits.h b/arch/sparc/include/asm/termbits.h
index d72dfed1f9d7..23b10ff08df2 100644
--- a/arch/sparc/include/asm/termbits.h
+++ b/arch/sparc/include/asm/termbits.h
@@ -225,6 +225,7 @@ struct ktermios {
225#define FLUSHO 0x00002000 225#define FLUSHO 0x00002000
226#define PENDIN 0x00004000 226#define PENDIN 0x00004000
227#define IEXTEN 0x00008000 227#define IEXTEN 0x00008000
228#define EXTPROC 0x00010000
228 229
229/* modem lines */ 230/* modem lines */
230#define TIOCM_LE 0x001 231#define TIOCM_LE 0x001
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h
index 25f1d10155e8..8303ac481034 100644
--- a/arch/sparc/include/asm/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
@@ -260,23 +260,8 @@ static inline unsigned long __copy_to_user(void __user *to, const void *from, un
260 return __copy_user(to, (__force void __user *) from, n); 260 return __copy_user(to, (__force void __user *) from, n);
261} 261}
262 262
263extern void copy_from_user_overflow(void)
264#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
265 __compiletime_error("copy_from_user() buffer size is not provably correct")
266#else
267 __compiletime_warning("copy_from_user() buffer size is not provably correct")
268#endif
269;
270
271static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) 263static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
272{ 264{
273 int sz = __compiletime_object_size(to);
274
275 if (unlikely(sz != -1 && sz < n)) {
276 copy_from_user_overflow();
277 return n;
278 }
279
280 if (n && __access_ok((unsigned long) from, n)) 265 if (n && __access_ok((unsigned long) from, n))
281 return __copy_user((__force void __user *) to, from, n); 266 return __copy_user((__force void __user *) to, from, n);
282 else 267 else
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index 2406788bfe5f..3e1449f07798 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -205,14 +205,6 @@ __asm__ __volatile__( \
205 205
206extern int __get_user_bad(void); 206extern int __get_user_bad(void);
207 207
208extern void copy_from_user_overflow(void)
209#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
210 __compiletime_error("copy_from_user() buffer size is not provably correct")
211#else
212 __compiletime_warning("copy_from_user() buffer size is not provably correct")
213#endif
214;
215
216extern unsigned long __must_check ___copy_from_user(void *to, 208extern unsigned long __must_check ___copy_from_user(void *to,
217 const void __user *from, 209 const void __user *from,
218 unsigned long size); 210 unsigned long size);
@@ -221,16 +213,11 @@ extern unsigned long copy_from_user_fixup(void *to, const void __user *from,
221static inline unsigned long __must_check 213static inline unsigned long __must_check
222copy_from_user(void *to, const void __user *from, unsigned long size) 214copy_from_user(void *to, const void __user *from, unsigned long size)
223{ 215{
224 int sz = __compiletime_object_size(to); 216 unsigned long ret = ___copy_from_user(to, from, size);
225 unsigned long ret = size; 217
226 218 if (unlikely(ret))
227 if (likely(sz == -1 || sz >= size)) { 219 ret = copy_from_user_fixup(to, from, size);
228 ret = ___copy_from_user(to, from, size); 220
229 if (unlikely(ret))
230 ret = copy_from_user_fixup(to, from, size);
231 } else {
232 copy_from_user_overflow();
233 }
234 return ret; 221 return ret;
235} 222}
236#define __copy_from_user copy_from_user 223#define __copy_from_user copy_from_user
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index d0b3b01ac9d4..03eb5a8f6f93 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -397,8 +397,11 @@
397#define __NR_rt_tgsigqueueinfo 326 397#define __NR_rt_tgsigqueueinfo 326
398#define __NR_perf_event_open 327 398#define __NR_perf_event_open 327
399#define __NR_recvmmsg 328 399#define __NR_recvmmsg 328
400#define __NR_fanotify_init 329
401#define __NR_fanotify_mark 330
402#define __NR_prlimit64 331
400 403
401#define NR_syscalls 329 404#define NR_syscalls 332
402 405
403#ifdef __32bit_syscall_numbers__ 406#ifdef __32bit_syscall_numbers__
404/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, 407/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,