aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc')
-rw-r--r--include/asm-sparc/ebus.h17
-rw-r--r--include/asm-sparc/floppy.h3
-rw-r--r--include/asm-sparc/io.h16
-rw-r--r--include/asm-sparc/irq.h6
-rw-r--r--include/asm-sparc/of_device.h79
-rw-r--r--include/asm-sparc/pbm.h3
-rw-r--r--include/asm-sparc/prom.h104
-rw-r--r--include/asm-sparc/sbus.h28
-rw-r--r--include/asm-sparc/signal.h3
-rw-r--r--include/asm-sparc/smp.h8
-rw-r--r--include/asm-sparc/socket.h1
-rw-r--r--include/asm-sparc/spinlock.h3
12 files changed, 243 insertions, 28 deletions
diff --git a/include/asm-sparc/ebus.h b/include/asm-sparc/ebus.h
index 2d6a997c5b0c..54652887c127 100644
--- a/include/asm-sparc/ebus.h
+++ b/include/asm-sparc/ebus.h
@@ -13,13 +13,14 @@
13#include <linux/ioport.h> 13#include <linux/ioport.h>
14#endif 14#endif
15#include <asm/oplib.h> 15#include <asm/oplib.h>
16#include <asm/prom.h>
17#include <asm/of_device.h>
16 18
17struct linux_ebus_child { 19struct linux_ebus_child {
18 struct linux_ebus_child *next; 20 struct linux_ebus_child *next;
19 struct linux_ebus_device *parent; 21 struct linux_ebus_device *parent;
20 struct linux_ebus *bus; 22 struct linux_ebus *bus;
21 int prom_node; 23 struct device_node *prom_node;
22 char prom_name[64];
23 struct resource resource[PROMREG_MAX]; 24 struct resource resource[PROMREG_MAX];
24 int num_addrs; 25 int num_addrs;
25 unsigned int irqs[PROMINTR_MAX]; 26 unsigned int irqs[PROMINTR_MAX];
@@ -27,27 +28,27 @@ struct linux_ebus_child {
27}; 28};
28 29
29struct linux_ebus_device { 30struct linux_ebus_device {
31 struct of_device ofdev;
30 struct linux_ebus_device *next; 32 struct linux_ebus_device *next;
31 struct linux_ebus_child *children; 33 struct linux_ebus_child *children;
32 struct linux_ebus *bus; 34 struct linux_ebus *bus;
33 int prom_node; 35 struct device_node *prom_node;
34 char prom_name[64];
35 struct resource resource[PROMREG_MAX]; 36 struct resource resource[PROMREG_MAX];
36 int num_addrs; 37 int num_addrs;
37 unsigned int irqs[PROMINTR_MAX]; 38 unsigned int irqs[PROMINTR_MAX];
38 int num_irqs; 39 int num_irqs;
39}; 40};
41#define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
40 42
41struct linux_ebus { 43struct linux_ebus {
44 struct of_device ofdev;
42 struct linux_ebus *next; 45 struct linux_ebus *next;
43 struct linux_ebus_device *devices; 46 struct linux_ebus_device *devices;
44 struct linux_pbm_info *parent; 47 struct linux_pbm_info *parent;
45 struct pci_dev *self; 48 struct pci_dev *self;
46 int prom_node; 49 struct device_node *prom_node;
47 char prom_name[64];
48 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
49 int num_ebus_ranges;
50}; 50};
51#define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
51 52
52struct linux_ebus_dma { 53struct linux_ebus_dma {
53 unsigned int dcsr; 54 unsigned int dcsr;
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h
index 7a941b800b6b..c53b332c850a 100644
--- a/include/asm-sparc/floppy.h
+++ b/include/asm-sparc/floppy.h
@@ -271,7 +271,8 @@ static int sun_fd_request_irq(void)
271 271
272 if(!once) { 272 if(!once) {
273 once = 1; 273 once = 1;
274 error = request_fast_irq(FLOPPY_IRQ, floppy_hardint, SA_INTERRUPT, "floppy"); 274 error = request_fast_irq(FLOPPY_IRQ, floppy_hardint,
275 IRQF_DISABLED, "floppy");
275 return ((error == 0) ? 0 : -1); 276 return ((error == 0) ? 0 : -1);
276 } else return 0; 277 } else return 0;
277} 278}
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index a42df208d590..cab0b851b8b1 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -249,6 +249,22 @@ extern void __iomem *ioremap(unsigned long offset, unsigned long size);
249#define ioremap_nocache(X,Y) ioremap((X),(Y)) 249#define ioremap_nocache(X,Y) ioremap((X),(Y))
250extern void iounmap(volatile void __iomem *addr); 250extern void iounmap(volatile void __iomem *addr);
251 251
252#define ioread8(X) readb(X)
253#define ioread16(X) readw(X)
254#define ioread32(X) readl(X)
255#define iowrite8(val,X) writeb(val,X)
256#define iowrite16(val,X) writew(val,X)
257#define iowrite32(val,X) writel(val,X)
258
259/* Create a virtual mapping cookie for an IO port range */
260extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
261extern void ioport_unmap(void __iomem *);
262
263/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
264struct pci_dev;
265extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
266extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
267
252/* 268/*
253 * Bus number may be in res->flags... somewhere. 269 * Bus number may be in res->flags... somewhere.
254 */ 270 */
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index dbc687403208..3141ddfea97d 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -16,8 +16,6 @@
16 16
17#define __irq_ino(irq) irq 17#define __irq_ino(irq) irq
18#define __irq_pil(irq) irq 18#define __irq_pil(irq) irq
19BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int)
20#define __irq_itoa(irq) BTFIXUP_CALL(__irq_itoa)(irq)
21 19
22#define NR_IRQS 16 20#define NR_IRQS 16
23 21
@@ -183,8 +181,4 @@ extern struct sun4m_intregs *sun4m_interrupts;
183#define SUN4M_INT_SBUS(x) (1 << (x+7)) 181#define SUN4M_INT_SBUS(x) (1 << (x+7))
184#define SUN4M_INT_VME(x) (1 << (x)) 182#define SUN4M_INT_VME(x) (1 << (x))
185 183
186struct irqaction;
187struct pt_regs;
188int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
189
190#endif 184#endif
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
new file mode 100644
index 000000000000..80ea31f6e17f
--- /dev/null
+++ b/include/asm-sparc/of_device.h
@@ -0,0 +1,79 @@
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/mod_devicetable.h>
7#include <asm/openprom.h>
8#include <asm/prom.h>
9
10extern struct bus_type ebus_bus_type;
11extern struct bus_type sbus_bus_type;
12extern struct bus_type of_bus_type;
13
14/*
15 * The of_device is a kind of "base class" that is a superset of
16 * struct device for use by devices attached to an OF node and
17 * probed using OF properties.
18 */
19struct of_device
20{
21 struct device_node *node;
22 struct device dev;
23 struct resource resource[PROMREG_MAX];
24 unsigned int irqs[PROMINTR_MAX];
25 int num_irqs;
26
27 void *sysdata;
28
29 int slot;
30 int portid;
31 int clock_freq;
32};
33#define to_of_device(d) container_of(d, struct of_device, dev)
34
35extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
36extern void of_iounmap(void __iomem *base, unsigned long size);
37
38extern struct of_device *of_find_device_by_node(struct device_node *);
39
40extern const struct of_device_id *of_match_device(
41 const struct of_device_id *matches, const struct of_device *dev);
42
43extern struct of_device *of_dev_get(struct of_device *dev);
44extern void of_dev_put(struct of_device *dev);
45
46/*
47 * An of_platform_driver driver is attached to a basic of_device on
48 * the ISA, EBUS, and SBUS busses on sparc64.
49 */
50struct of_platform_driver
51{
52 char *name;
53 struct of_device_id *match_table;
54 struct module *owner;
55
56 int (*probe)(struct of_device* dev, const struct of_device_id *match);
57 int (*remove)(struct of_device* dev);
58
59 int (*suspend)(struct of_device* dev, pm_message_t state);
60 int (*resume)(struct of_device* dev);
61 int (*shutdown)(struct of_device* dev);
62
63 struct device_driver driver;
64};
65#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
66
67extern int of_register_driver(struct of_platform_driver *drv,
68 struct bus_type *bus);
69extern void of_unregister_driver(struct of_platform_driver *drv);
70extern int of_device_register(struct of_device *ofdev);
71extern void of_device_unregister(struct of_device *ofdev);
72extern struct of_device *of_platform_device_create(struct device_node *np,
73 const char *bus_id,
74 struct device *parent,
75 struct bus_type *bus);
76extern void of_release_dev(struct device *dev);
77
78#endif /* __KERNEL__ */
79#endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/include/asm-sparc/pbm.h b/include/asm-sparc/pbm.h
index 0aba3a82c2eb..fedd9c6e875c 100644
--- a/include/asm-sparc/pbm.h
+++ b/include/asm-sparc/pbm.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <asm/oplib.h> 24#include <asm/oplib.h>
25#include <asm/prom.h>
25 26
26struct linux_pbm_info { 27struct linux_pbm_info {
27 int prom_node; 28 int prom_node;
@@ -40,7 +41,7 @@ struct linux_pbm_info {
40 */ 41 */
41struct pcidev_cookie { 42struct pcidev_cookie {
42 struct linux_pbm_info *pbm; 43 struct linux_pbm_info *pbm;
43 int prom_node; 44 struct device_node *prom_node;
44}; 45};
45 46
46#endif /* !(__SPARC_PBM_H) */ 47#endif /* !(__SPARC_PBM_H) */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
new file mode 100644
index 000000000000..86c13dccea3d
--- /dev/null
+++ b/include/asm-sparc/prom.h
@@ -0,0 +1,104 @@
1#ifndef _SPARC_PROM_H
2#define _SPARC_PROM_H
3#ifdef __KERNEL__
4
5
6/*
7 * Definitions for talking to the Open Firmware PROM on
8 * Power Macintosh computers.
9 *
10 * Copyright (C) 1996-2005 Paul Mackerras.
11 *
12 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
13 * Updates for SPARC32 by David S. Miller
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <linux/types.h>
22#include <linux/proc_fs.h>
23#include <asm/atomic.h>
24
25typedef u32 phandle;
26typedef u32 ihandle;
27
28struct property {
29 char *name;
30 int length;
31 void *value;
32 struct property *next;
33 unsigned long _flags;
34 unsigned int unique_id;
35};
36
37struct device_node {
38 char *name;
39 char *type;
40 phandle node;
41 char *path_component_name;
42 char *full_name;
43
44 struct property *properties;
45 struct property *deadprops; /* removed properties */
46 struct device_node *parent;
47 struct device_node *child;
48 struct device_node *sibling;
49 struct device_node *next; /* next device of same type */
50 struct device_node *allnext; /* next in list of all nodes */
51 struct proc_dir_entry *pde; /* this node's proc directory */
52 struct kref kref;
53 unsigned long _flags;
54 void *data;
55 unsigned int unique_id;
56};
57
58/* flag descriptions */
59#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
60
61#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
62#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
63
64#define OF_BAD_ADDR ((u64)-1)
65
66static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
67{
68 dn->pde = de;
69}
70
71extern struct device_node *of_find_node_by_name(struct device_node *from,
72 const char *name);
73#define for_each_node_by_name(dn, name) \
74 for (dn = of_find_node_by_name(NULL, name); dn; \
75 dn = of_find_node_by_name(dn, name))
76extern struct device_node *of_find_node_by_type(struct device_node *from,
77 const char *type);
78#define for_each_node_by_type(dn, type) \
79 for (dn = of_find_node_by_type(NULL, type); dn; \
80 dn = of_find_node_by_type(dn, type))
81extern struct device_node *of_find_compatible_node(struct device_node *from,
82 const char *type, const char *compat);
83extern struct device_node *of_find_node_by_path(const char *path);
84extern struct device_node *of_find_node_by_phandle(phandle handle);
85extern struct device_node *of_get_parent(const struct device_node *node);
86extern struct device_node *of_get_next_child(const struct device_node *node,
87 struct device_node *prev);
88extern struct property *of_find_property(struct device_node *np,
89 const char *name,
90 int *lenp);
91extern int of_device_is_compatible(struct device_node *device, const char *);
92extern void *of_get_property(struct device_node *node, const char *name,
93 int *lenp);
94extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
95extern int of_getintprop_default(struct device_node *np,
96 const char *name,
97 int def);
98extern int of_n_addr_cells(struct device_node *np);
99extern int of_n_size_cells(struct device_node *np);
100
101extern void prom_build_devicetree(void);
102
103#endif /* __KERNEL__ */
104#endif /* _SPARC_PROM_H */
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index a13cddcecec5..d036e4419d79 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -11,7 +11,8 @@
11#include <linux/ioport.h> 11#include <linux/ioport.h>
12 12
13#include <asm/oplib.h> 13#include <asm/oplib.h>
14/* #include <asm/iommu.h> */ /* Unused since we use opaque iommu (|io-unit) */ 14#include <asm/prom.h>
15#include <asm/of_device.h>
15#include <asm/scatterlist.h> 16#include <asm/scatterlist.h>
16 17
17/* We scan which devices are on the SBus using the PROM node device 18/* We scan which devices are on the SBus using the PROM node device
@@ -42,18 +43,19 @@ struct sbus_bus;
42 43
43/* Linux SBUS device tables */ 44/* Linux SBUS device tables */
44struct sbus_dev { 45struct sbus_dev {
45 struct sbus_bus *bus; /* Back ptr to sbus */ 46 struct of_device ofdev;
46 struct sbus_dev *next; /* next device on this SBus or null */ 47 struct sbus_bus *bus;
47 struct sbus_dev *child; /* For ledma and espdma on sun4m */ 48 struct sbus_dev *next;
48 struct sbus_dev *parent; /* Parent device if not toplevel */ 49 struct sbus_dev *child;
49 int prom_node; /* PROM device tree node for this device */ 50 struct sbus_dev *parent;
50 char prom_name[64]; /* PROM device name */ 51 int prom_node;
52 char prom_name[64];
51 int slot; 53 int slot;
52 54
53 struct resource resource[PROMREG_MAX]; 55 struct resource resource[PROMREG_MAX];
54 56
55 struct linux_prom_registers reg_addrs[PROMREG_MAX]; 57 struct linux_prom_registers reg_addrs[PROMREG_MAX];
56 int num_registers, ranges_applied; 58 int num_registers;
57 59
58 struct linux_prom_ranges device_ranges[PROMREG_MAX]; 60 struct linux_prom_ranges device_ranges[PROMREG_MAX];
59 int num_device_ranges; 61 int num_device_ranges;
@@ -61,9 +63,11 @@ struct sbus_dev {
61 unsigned int irqs[4]; 63 unsigned int irqs[4];
62 int num_irqs; 64 int num_irqs;
63}; 65};
66#define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev)
64 67
65/* This struct describes the SBus(s) found on this machine. */ 68/* This struct describes the SBus(s) found on this machine. */
66struct sbus_bus { 69struct sbus_bus {
70 struct of_device ofdev;
67 void *iommu; /* Opaque IOMMU cookie */ 71 void *iommu; /* Opaque IOMMU cookie */
68 struct sbus_dev *devices; /* Link to devices on this SBus */ 72 struct sbus_dev *devices; /* Link to devices on this SBus */
69 struct sbus_bus *next; /* next SBus, if more than one SBus */ 73 struct sbus_bus *next; /* next SBus, if more than one SBus */
@@ -77,6 +81,7 @@ struct sbus_bus {
77 int devid; 81 int devid;
78 int board; 82 int board;
79}; 83};
84#define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev)
80 85
81extern struct sbus_bus *sbus_root; 86extern struct sbus_bus *sbus_root;
82 87
@@ -102,6 +107,7 @@ sbus_is_slave(struct sbus_dev *dev)
102#define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */ 107#define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */
103#define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */ 108#define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */
104extern void sbus_set_sbus64(struct sbus_dev *, int); 109extern void sbus_set_sbus64(struct sbus_dev *, int);
110extern void sbus_fill_device_irq(struct sbus_dev *);
105 111
106/* These yield IOMMU mappings in consistent mode. */ 112/* These yield IOMMU mappings in consistent mode. */
107extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); 113extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
@@ -139,4 +145,10 @@ extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *,
139BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) 145BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int)
140#define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) 146#define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint)
141 147
148extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
149extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
150extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);
151extern int sbus_arch_preinit(void);
152extern void sbus_arch_postinit(void);
153
142#endif /* !(_SPARC_SBUS_H) */ 154#endif /* !(_SPARC_SBUS_H) */
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
index aa9960ad0ca9..0ae5084c427b 100644
--- a/include/asm-sparc/signal.h
+++ b/include/asm-sparc/signal.h
@@ -132,16 +132,13 @@ struct sigstack {
132 * usage of signal stacks by using the (now obsolete) sa_restorer field in 132 * usage of signal stacks by using the (now obsolete) sa_restorer field in
133 * the sigaction structure as a stack pointer. This is now possible due to 133 * the sigaction structure as a stack pointer. This is now possible due to
134 * the changes in signal handling. LBT 010493. 134 * the changes in signal handling. LBT 010493.
135 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
136 * SA_RESTART flag to get restarting signals (which were the default long ago) 135 * SA_RESTART flag to get restarting signals (which were the default long ago)
137 * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
138 */ 136 */
139#define SA_NOCLDSTOP _SV_IGNCHILD 137#define SA_NOCLDSTOP _SV_IGNCHILD
140#define SA_STACK _SV_SSTACK 138#define SA_STACK _SV_SSTACK
141#define SA_ONSTACK _SV_SSTACK 139#define SA_ONSTACK _SV_SSTACK
142#define SA_RESTART _SV_INTR 140#define SA_RESTART _SV_INTR
143#define SA_ONESHOT _SV_RESET 141#define SA_ONESHOT _SV_RESET
144#define SA_INTERRUPT 0x10u
145#define SA_NOMASK 0x20u 142#define SA_NOMASK 0x20u
146#define SA_NOCLDWAIT 0x100u 143#define SA_NOCLDWAIT 0x100u
147#define SA_SIGINFO 0x200u 144#define SA_SIGINFO 0x200u
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index 5a1b7e4e7cc9..b9da9a600e35 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -145,6 +145,8 @@ static inline int hard_smp_processor_id(void)
145#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier 145#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
146#define prof_counter(__cpu) cpu_data(__cpu).counter 146#define prof_counter(__cpu) cpu_data(__cpu).counter
147 147
148void smp_setup_cpu_possible_map(void);
149
148#endif /* !(__ASSEMBLY__) */ 150#endif /* !(__ASSEMBLY__) */
149 151
150/* Sparc specific messages. */ 152/* Sparc specific messages. */
@@ -161,7 +163,11 @@ static inline int hard_smp_processor_id(void)
161#define MBOX_IDLECPU2 0xFD 163#define MBOX_IDLECPU2 0xFD
162#define MBOX_STOPCPU2 0xFE 164#define MBOX_STOPCPU2 0xFE
163 165
164#endif /* SMP */ 166#else /* SMP */
167
168#define smp_setup_cpu_possible_map() do { } while (0)
169
170#endif /* !(SMP) */
165 171
166#define NO_PROC_ID 0xFF 172#define NO_PROC_ID 0xFF
167 173
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index 4e0ce3a35ea9..f6c4e5baf3f7 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -48,6 +48,7 @@
48#define SCM_TIMESTAMP SO_TIMESTAMP 48#define SCM_TIMESTAMP SO_TIMESTAMP
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f
51 52
52/* Security levels - as per NRL IPv6 - don't actually do anything */ 53/* Security levels - as per NRL IPv6 - don't actually do anything */
53#define SO_SECURITY_AUTHENTICATION 0x5001 54#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 3350c90c7869..1c75474ba1df 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -154,6 +154,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
154#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 154#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
155#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 155#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
156 156
157#define __raw_read_can_lock(rw) (!((rw)->lock & 0xff))
158#define __raw_write_can_lock(rw) (!(rw)->lock)
159
157#endif /* !(__ASSEMBLY__) */ 160#endif /* !(__ASSEMBLY__) */
158 161
159#endif /* __SPARC_SPINLOCK_H */ 162#endif /* __SPARC_SPINLOCK_H */