diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-09-14 14:26:05 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-09-14 14:26:05 -0400 |
commit | ac8d513a6801c8636922ccf4f30211810c9a56ce (patch) | |
tree | 83ba584487a6a612c8fcf2563c28c0263df35ba2 /arch/sparc/include | |
parent | bf992fa2bc1ad1bb2aeb0bdfadb43f236b9297fd (diff) | |
parent | 99bc47067910f7070e65ee318a6dd79a2371f1e5 (diff) |
Merge branch 'master' into for-linus
Diffstat (limited to 'arch/sparc/include')
-rw-r--r-- | arch/sparc/include/asm/asi.h | 4 | ||||
-rw-r--r-- | arch/sparc/include/asm/dma-mapping.h | 145 | ||||
-rw-r--r-- | arch/sparc/include/asm/irq_64.h | 4 | ||||
-rw-r--r-- | arch/sparc/include/asm/leon.h | 362 | ||||
-rw-r--r-- | arch/sparc/include/asm/leon_amba.h | 263 | ||||
-rw-r--r-- | arch/sparc/include/asm/machines.h | 6 | ||||
-rw-r--r-- | arch/sparc/include/asm/nmi.h | 5 | ||||
-rw-r--r-- | arch/sparc/include/asm/pci.h | 3 | ||||
-rw-r--r-- | arch/sparc/include/asm/pci_32.h | 105 | ||||
-rw-r--r-- | arch/sparc/include/asm/pci_64.h | 88 | ||||
-rw-r--r-- | arch/sparc/include/asm/perf_counter.h | 14 | ||||
-rw-r--r-- | arch/sparc/include/asm/pgtsrmmu.h | 4 | ||||
-rw-r--r-- | arch/sparc/include/asm/prom.h | 3 | ||||
-rw-r--r-- | arch/sparc/include/asm/socket.h | 3 | ||||
-rw-r--r-- | arch/sparc/include/asm/spinlock_32.h | 12 | ||||
-rw-r--r-- | arch/sparc/include/asm/spinlock_64.h | 28 | ||||
-rw-r--r-- | arch/sparc/include/asm/system_32.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/system_64.h | 4 | ||||
-rw-r--r-- | arch/sparc/include/asm/types.h | 27 | ||||
-rw-r--r-- | arch/sparc/include/asm/uaccess_64.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/unistd.h | 3 |
21 files changed, 724 insertions, 362 deletions
diff --git a/arch/sparc/include/asm/asi.h b/arch/sparc/include/asm/asi.h index 74703c5ef985..b2e3db63a64b 100644 --- a/arch/sparc/include/asm/asi.h +++ b/arch/sparc/include/asm/asi.h | |||
@@ -40,7 +40,11 @@ | |||
40 | #define ASI_M_UNA01 0x01 /* Same here... */ | 40 | #define ASI_M_UNA01 0x01 /* Same here... */ |
41 | #define ASI_M_MXCC 0x02 /* Access to TI VIKING MXCC registers */ | 41 | #define ASI_M_MXCC 0x02 /* Access to TI VIKING MXCC registers */ |
42 | #define ASI_M_FLUSH_PROBE 0x03 /* Reference MMU Flush/Probe; rw, ss */ | 42 | #define ASI_M_FLUSH_PROBE 0x03 /* Reference MMU Flush/Probe; rw, ss */ |
43 | #ifndef CONFIG_SPARC_LEON | ||
43 | #define ASI_M_MMUREGS 0x04 /* MMU Registers; rw, ss */ | 44 | #define ASI_M_MMUREGS 0x04 /* MMU Registers; rw, ss */ |
45 | #else | ||
46 | #define ASI_M_MMUREGS 0x19 | ||
47 | #endif /* CONFIG_SPARC_LEON */ | ||
44 | #define ASI_M_TLBDIAG 0x05 /* MMU TLB only Diagnostics */ | 48 | #define ASI_M_TLBDIAG 0x05 /* MMU TLB only Diagnostics */ |
45 | #define ASI_M_DIAGS 0x06 /* Reference MMU Diagnostics */ | 49 | #define ASI_M_DIAGS 0x06 /* Reference MMU Diagnostics */ |
46 | #define ASI_M_IODIAG 0x07 /* MMU I/O TLB only Diagnostics */ | 50 | #define ASI_M_IODIAG 0x07 /* MMU I/O TLB only Diagnostics */ |
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 204e4bf64438..5a8c308e2b5c 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/scatterlist.h> | 4 | #include <linux/scatterlist.h> |
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <linux/dma-debug.h> | ||
6 | 7 | ||
7 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) | 8 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) |
8 | 9 | ||
@@ -13,142 +14,40 @@ extern int dma_set_mask(struct device *dev, u64 dma_mask); | |||
13 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 14 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
14 | #define dma_is_consistent(d, h) (1) | 15 | #define dma_is_consistent(d, h) (1) |
15 | 16 | ||
16 | struct dma_ops { | 17 | extern struct dma_map_ops *dma_ops, pci32_dma_ops; |
17 | void *(*alloc_coherent)(struct device *dev, size_t size, | 18 | extern struct bus_type pci_bus_type; |
18 | dma_addr_t *dma_handle, gfp_t flag); | ||
19 | void (*free_coherent)(struct device *dev, size_t size, | ||
20 | void *cpu_addr, dma_addr_t dma_handle); | ||
21 | dma_addr_t (*map_page)(struct device *dev, struct page *page, | ||
22 | unsigned long offset, size_t size, | ||
23 | enum dma_data_direction direction); | ||
24 | void (*unmap_page)(struct device *dev, dma_addr_t dma_addr, | ||
25 | size_t size, | ||
26 | enum dma_data_direction direction); | ||
27 | int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents, | ||
28 | enum dma_data_direction direction); | ||
29 | void (*unmap_sg)(struct device *dev, struct scatterlist *sg, | ||
30 | int nhwentries, | ||
31 | enum dma_data_direction direction); | ||
32 | void (*sync_single_for_cpu)(struct device *dev, | ||
33 | dma_addr_t dma_handle, size_t size, | ||
34 | enum dma_data_direction direction); | ||
35 | void (*sync_single_for_device)(struct device *dev, | ||
36 | dma_addr_t dma_handle, size_t size, | ||
37 | enum dma_data_direction direction); | ||
38 | void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg, | ||
39 | int nelems, | ||
40 | enum dma_data_direction direction); | ||
41 | void (*sync_sg_for_device)(struct device *dev, | ||
42 | struct scatterlist *sg, int nents, | ||
43 | enum dma_data_direction dir); | ||
44 | }; | ||
45 | extern const struct dma_ops *dma_ops; | ||
46 | 19 | ||
47 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 20 | static inline struct dma_map_ops *get_dma_ops(struct device *dev) |
48 | dma_addr_t *dma_handle, gfp_t flag) | ||
49 | { | ||
50 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); | ||
51 | } | ||
52 | |||
53 | static inline void dma_free_coherent(struct device *dev, size_t size, | ||
54 | void *cpu_addr, dma_addr_t dma_handle) | ||
55 | { | ||
56 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | ||
57 | } | ||
58 | |||
59 | static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, | ||
60 | size_t size, | ||
61 | enum dma_data_direction direction) | ||
62 | { | ||
63 | return dma_ops->map_page(dev, virt_to_page(cpu_addr), | ||
64 | (unsigned long)cpu_addr & ~PAGE_MASK, size, | ||
65 | direction); | ||
66 | } | ||
67 | |||
68 | static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, | ||
69 | size_t size, | ||
70 | enum dma_data_direction direction) | ||
71 | { | ||
72 | dma_ops->unmap_page(dev, dma_addr, size, direction); | ||
73 | } | ||
74 | |||
75 | static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, | ||
76 | unsigned long offset, size_t size, | ||
77 | enum dma_data_direction direction) | ||
78 | { | ||
79 | return dma_ops->map_page(dev, page, offset, size, direction); | ||
80 | } | ||
81 | |||
82 | static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, | ||
83 | size_t size, | ||
84 | enum dma_data_direction direction) | ||
85 | { | ||
86 | dma_ops->unmap_page(dev, dma_address, size, direction); | ||
87 | } | ||
88 | |||
89 | static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, | ||
90 | int nents, enum dma_data_direction direction) | ||
91 | { | ||
92 | return dma_ops->map_sg(dev, sg, nents, direction); | ||
93 | } | ||
94 | |||
95 | static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
96 | int nents, enum dma_data_direction direction) | ||
97 | { | 21 | { |
98 | dma_ops->unmap_sg(dev, sg, nents, direction); | 22 | #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI) |
99 | } | 23 | if (dev->bus == &pci_bus_type) |
100 | 24 | return &pci32_dma_ops; | |
101 | static inline void dma_sync_single_for_cpu(struct device *dev, | 25 | #endif |
102 | dma_addr_t dma_handle, size_t size, | 26 | return dma_ops; |
103 | enum dma_data_direction direction) | ||
104 | { | ||
105 | dma_ops->sync_single_for_cpu(dev, dma_handle, size, direction); | ||
106 | } | 27 | } |
107 | 28 | ||
108 | static inline void dma_sync_single_for_device(struct device *dev, | 29 | #include <asm-generic/dma-mapping-common.h> |
109 | dma_addr_t dma_handle, | ||
110 | size_t size, | ||
111 | enum dma_data_direction direction) | ||
112 | { | ||
113 | if (dma_ops->sync_single_for_device) | ||
114 | dma_ops->sync_single_for_device(dev, dma_handle, size, | ||
115 | direction); | ||
116 | } | ||
117 | 30 | ||
118 | static inline void dma_sync_sg_for_cpu(struct device *dev, | 31 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, |
119 | struct scatterlist *sg, int nelems, | 32 | dma_addr_t *dma_handle, gfp_t flag) |
120 | enum dma_data_direction direction) | ||
121 | { | 33 | { |
122 | dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction); | 34 | struct dma_map_ops *ops = get_dma_ops(dev); |
123 | } | 35 | void *cpu_addr; |
124 | 36 | ||
125 | static inline void dma_sync_sg_for_device(struct device *dev, | 37 | cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag); |
126 | struct scatterlist *sg, int nelems, | 38 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); |
127 | enum dma_data_direction direction) | 39 | return cpu_addr; |
128 | { | ||
129 | if (dma_ops->sync_sg_for_device) | ||
130 | dma_ops->sync_sg_for_device(dev, sg, nelems, direction); | ||
131 | } | 40 | } |
132 | 41 | ||
133 | static inline void dma_sync_single_range_for_cpu(struct device *dev, | 42 | static inline void dma_free_coherent(struct device *dev, size_t size, |
134 | dma_addr_t dma_handle, | 43 | void *cpu_addr, dma_addr_t dma_handle) |
135 | unsigned long offset, | ||
136 | size_t size, | ||
137 | enum dma_data_direction dir) | ||
138 | { | 44 | { |
139 | dma_sync_single_for_cpu(dev, dma_handle+offset, size, dir); | 45 | struct dma_map_ops *ops = get_dma_ops(dev); |
140 | } | ||
141 | 46 | ||
142 | static inline void dma_sync_single_range_for_device(struct device *dev, | 47 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
143 | dma_addr_t dma_handle, | 48 | ops->free_coherent(dev, size, cpu_addr, dma_handle); |
144 | unsigned long offset, | ||
145 | size_t size, | ||
146 | enum dma_data_direction dir) | ||
147 | { | ||
148 | dma_sync_single_for_device(dev, dma_handle+offset, size, dir); | ||
149 | } | 49 | } |
150 | 50 | ||
151 | |||
152 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 51 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
153 | { | 52 | { |
154 | return (dma_addr == DMA_ERROR_CODE); | 53 | return (dma_addr == DMA_ERROR_CODE); |
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index 1934f2cbf513..a0b443cb3c1f 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h | |||
@@ -89,8 +89,8 @@ static inline unsigned long get_softint(void) | |||
89 | return retval; | 89 | return retval; |
90 | } | 90 | } |
91 | 91 | ||
92 | void __trigger_all_cpu_backtrace(void); | 92 | void arch_trigger_all_cpu_backtrace(void); |
93 | #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() | 93 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace |
94 | 94 | ||
95 | extern void *hardirq_stack[NR_CPUS]; | 95 | extern void *hardirq_stack[NR_CPUS]; |
96 | extern void *softirq_stack[NR_CPUS]; | 96 | extern void *softirq_stack[NR_CPUS]; |
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h new file mode 100644 index 000000000000..28a42b73f64f --- /dev/null +++ b/arch/sparc/include/asm/leon.h | |||
@@ -0,0 +1,362 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Konrad Eisele (eiselekd@web.de,konrad@gaisler.com) Gaisler Research | ||
3 | * Copyright (C) 2004 Stefan Holst (mail@s-holst.de) Uni-Stuttgart | ||
4 | * Copyright (C) 2009 Daniel Hellstrom (daniel@gaisler.com) Aeroflex Gaisler AB | ||
5 | * Copyright (C) 2009 Konrad Eisele (konrad@gaisler.com) Aeroflex Gaisler AB | ||
6 | */ | ||
7 | |||
8 | #ifndef LEON_H_INCLUDE | ||
9 | #define LEON_H_INCLUDE | ||
10 | |||
11 | #ifdef CONFIG_SPARC_LEON | ||
12 | |||
13 | #define ASI_LEON_NOCACHE 0x01 | ||
14 | |||
15 | #define ASI_LEON_DCACHE_MISS 0x1 | ||
16 | |||
17 | #define ASI_LEON_CACHEREGS 0x02 | ||
18 | #define ASI_LEON_IFLUSH 0x10 | ||
19 | #define ASI_LEON_DFLUSH 0x11 | ||
20 | |||
21 | #define ASI_LEON_MMUFLUSH 0x18 | ||
22 | #define ASI_LEON_MMUREGS 0x19 | ||
23 | #define ASI_LEON_BYPASS 0x1c | ||
24 | #define ASI_LEON_FLUSH_PAGE 0x10 | ||
25 | |||
26 | /* mmu register access, ASI_LEON_MMUREGS */ | ||
27 | #define LEON_CNR_CTRL 0x000 | ||
28 | #define LEON_CNR_CTXP 0x100 | ||
29 | #define LEON_CNR_CTX 0x200 | ||
30 | #define LEON_CNR_F 0x300 | ||
31 | #define LEON_CNR_FADDR 0x400 | ||
32 | |||
33 | #define LEON_CNR_CTX_NCTX 256 /*number of MMU ctx */ | ||
34 | |||
35 | #define LEON_CNR_CTRL_TLBDIS 0x80000000 | ||
36 | |||
37 | #define LEON_MMUTLB_ENT_MAX 64 | ||
38 | |||
39 | /* | ||
40 | * diagnostic access from mmutlb.vhd: | ||
41 | * 0: pte address | ||
42 | * 4: pte | ||
43 | * 8: additional flags | ||
44 | */ | ||
45 | #define LEON_DIAGF_LVL 0x3 | ||
46 | #define LEON_DIAGF_WR 0x8 | ||
47 | #define LEON_DIAGF_WR_SHIFT 3 | ||
48 | #define LEON_DIAGF_HIT 0x10 | ||
49 | #define LEON_DIAGF_HIT_SHIFT 4 | ||
50 | #define LEON_DIAGF_CTX 0x1fe0 | ||
51 | #define LEON_DIAGF_CTX_SHIFT 5 | ||
52 | #define LEON_DIAGF_VALID 0x2000 | ||
53 | #define LEON_DIAGF_VALID_SHIFT 13 | ||
54 | |||
55 | /* | ||
56 | * Interrupt Sources | ||
57 | * | ||
58 | * The interrupt source numbers directly map to the trap type and to | ||
59 | * the bits used in the Interrupt Clear, Interrupt Force, Interrupt Mask, | ||
60 | * and the Interrupt Pending Registers. | ||
61 | */ | ||
62 | #define LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR 1 | ||
63 | #define LEON_INTERRUPT_UART_1_RX_TX 2 | ||
64 | #define LEON_INTERRUPT_UART_0_RX_TX 3 | ||
65 | #define LEON_INTERRUPT_EXTERNAL_0 4 | ||
66 | #define LEON_INTERRUPT_EXTERNAL_1 5 | ||
67 | #define LEON_INTERRUPT_EXTERNAL_2 6 | ||
68 | #define LEON_INTERRUPT_EXTERNAL_3 7 | ||
69 | #define LEON_INTERRUPT_TIMER1 8 | ||
70 | #define LEON_INTERRUPT_TIMER2 9 | ||
71 | #define LEON_INTERRUPT_EMPTY1 10 | ||
72 | #define LEON_INTERRUPT_EMPTY2 11 | ||
73 | #define LEON_INTERRUPT_OPEN_ETH 12 | ||
74 | #define LEON_INTERRUPT_EMPTY4 13 | ||
75 | #define LEON_INTERRUPT_EMPTY5 14 | ||
76 | #define LEON_INTERRUPT_EMPTY6 15 | ||
77 | |||
78 | /* irq masks */ | ||
79 | #define LEON_HARD_INT(x) (1 << (x)) /* irq 0-15 */ | ||
80 | #define LEON_IRQMASK_R 0x0000fffe /* bit 15- 1 of lregs.irqmask */ | ||
81 | #define LEON_IRQPRIO_R 0xfffe0000 /* bit 31-17 of lregs.irqmask */ | ||
82 | |||
83 | /* leon uart register definitions */ | ||
84 | #define LEON_OFF_UDATA 0x0 | ||
85 | #define LEON_OFF_USTAT 0x4 | ||
86 | #define LEON_OFF_UCTRL 0x8 | ||
87 | #define LEON_OFF_USCAL 0xc | ||
88 | |||
89 | #define LEON_UCTRL_RE 0x01 | ||
90 | #define LEON_UCTRL_TE 0x02 | ||
91 | #define LEON_UCTRL_RI 0x04 | ||
92 | #define LEON_UCTRL_TI 0x08 | ||
93 | #define LEON_UCTRL_PS 0x10 | ||
94 | #define LEON_UCTRL_PE 0x20 | ||
95 | #define LEON_UCTRL_FL 0x40 | ||
96 | #define LEON_UCTRL_LB 0x80 | ||
97 | |||
98 | #define LEON_USTAT_DR 0x01 | ||
99 | #define LEON_USTAT_TS 0x02 | ||
100 | #define LEON_USTAT_TH 0x04 | ||
101 | #define LEON_USTAT_BR 0x08 | ||
102 | #define LEON_USTAT_OV 0x10 | ||
103 | #define LEON_USTAT_PE 0x20 | ||
104 | #define LEON_USTAT_FE 0x40 | ||
105 | |||
106 | #define LEON_MCFG2_SRAMDIS 0x00002000 | ||
107 | #define LEON_MCFG2_SDRAMEN 0x00004000 | ||
108 | #define LEON_MCFG2_SRAMBANKSZ 0x00001e00 /* [12-9] */ | ||
109 | #define LEON_MCFG2_SRAMBANKSZ_SHIFT 9 | ||
110 | #define LEON_MCFG2_SDRAMBANKSZ 0x03800000 /* [25-23] */ | ||
111 | #define LEON_MCFG2_SDRAMBANKSZ_SHIFT 23 | ||
112 | |||
113 | #define LEON_TCNT0_MASK 0x7fffff | ||
114 | |||
115 | #define LEON_USTAT_ERROR (LEON_USTAT_OV | LEON_USTAT_PE | LEON_USTAT_FE) | ||
116 | /* no break yet */ | ||
117 | |||
118 | #define ASI_LEON3_SYSCTRL 0x02 | ||
119 | #define ASI_LEON3_SYSCTRL_ICFG 0x08 | ||
120 | #define ASI_LEON3_SYSCTRL_DCFG 0x0c | ||
121 | #define ASI_LEON3_SYSCTRL_CFG_SNOOPING (1 << 27) | ||
122 | #define ASI_LEON3_SYSCTRL_CFG_SSIZE(c) (1 << ((c >> 20) & 0xf)) | ||
123 | |||
124 | #ifndef __ASSEMBLY__ | ||
125 | |||
126 | /* do a virtual address read without cache */ | ||
127 | static inline unsigned long leon_readnobuffer_reg(unsigned long paddr) | ||
128 | { | ||
129 | unsigned long retval; | ||
130 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
131 | "=r"(retval) : "r"(paddr), "i"(ASI_LEON_NOCACHE)); | ||
132 | return retval; | ||
133 | } | ||
134 | |||
135 | /* do a physical address bypass write, i.e. for 0x80000000 */ | ||
136 | static inline void leon_store_reg(unsigned long paddr, unsigned long value) | ||
137 | { | ||
138 | __asm__ __volatile__("sta %0, [%1] %2\n\t" : : "r"(value), "r"(paddr), | ||
139 | "i"(ASI_LEON_BYPASS) : "memory"); | ||
140 | } | ||
141 | |||
142 | /* do a physical address bypass load, i.e. for 0x80000000 */ | ||
143 | static inline unsigned long leon_load_reg(unsigned long paddr) | ||
144 | { | ||
145 | unsigned long retval; | ||
146 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
147 | "=r"(retval) : "r"(paddr), "i"(ASI_LEON_BYPASS)); | ||
148 | return retval; | ||
149 | } | ||
150 | |||
151 | extern inline void leon_srmmu_disabletlb(void) | ||
152 | { | ||
153 | unsigned int retval; | ||
154 | __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), | ||
155 | "i"(ASI_LEON_MMUREGS)); | ||
156 | retval |= LEON_CNR_CTRL_TLBDIS; | ||
157 | __asm__ __volatile__("sta %0, [%%g0] %2\n\t" : : "r"(retval), "r"(0), | ||
158 | "i"(ASI_LEON_MMUREGS) : "memory"); | ||
159 | } | ||
160 | |||
161 | extern inline void leon_srmmu_enabletlb(void) | ||
162 | { | ||
163 | unsigned int retval; | ||
164 | __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), | ||
165 | "i"(ASI_LEON_MMUREGS)); | ||
166 | retval = retval & ~LEON_CNR_CTRL_TLBDIS; | ||
167 | __asm__ __volatile__("sta %0, [%%g0] %2\n\t" : : "r"(retval), "r"(0), | ||
168 | "i"(ASI_LEON_MMUREGS) : "memory"); | ||
169 | } | ||
170 | |||
171 | /* macro access for leon_load_reg() and leon_store_reg() */ | ||
172 | #define LEON3_BYPASS_LOAD_PA(x) (leon_load_reg((unsigned long)(x))) | ||
173 | #define LEON3_BYPASS_STORE_PA(x, v) (leon_store_reg((unsigned long)(x), (unsigned long)(v))) | ||
174 | #define LEON3_BYPASS_ANDIN_PA(x, v) LEON3_BYPASS_STORE_PA(x, LEON3_BYPASS_LOAD_PA(x) & v) | ||
175 | #define LEON3_BYPASS_ORIN_PA(x, v) LEON3_BYPASS_STORE_PA(x, LEON3_BYPASS_LOAD_PA(x) | v) | ||
176 | #define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x)) | ||
177 | #define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v)) | ||
178 | #define LEON_REGLOAD_PA(x) leon_load_reg((unsigned long)(x)+LEON_PREGS) | ||
179 | #define LEON_REGSTORE_PA(x, v) leon_store_reg((unsigned long)(x)+LEON_PREGS, (unsigned long)(v)) | ||
180 | #define LEON_REGSTORE_OR_PA(x, v) LEON_REGSTORE_PA(x, LEON_REGLOAD_PA(x) | (unsigned long)(v)) | ||
181 | #define LEON_REGSTORE_AND_PA(x, v) LEON_REGSTORE_PA(x, LEON_REGLOAD_PA(x) & (unsigned long)(v)) | ||
182 | |||
183 | /* macro access for leon_readnobuffer_reg() */ | ||
184 | #define LEON_BYPASSCACHE_LOAD_VA(x) leon_readnobuffer_reg((unsigned long)(x)) | ||
185 | |||
186 | extern void sparc_leon_eirq_register(int eirq); | ||
187 | extern void leon_init(void); | ||
188 | extern void leon_switch_mm(void); | ||
189 | extern void leon_init_IRQ(void); | ||
190 | |||
191 | extern unsigned long last_valid_pfn; | ||
192 | |||
193 | extern inline unsigned long sparc_leon3_get_dcachecfg(void) | ||
194 | { | ||
195 | unsigned int retval; | ||
196 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
197 | "=r"(retval) : | ||
198 | "r"(ASI_LEON3_SYSCTRL_DCFG), | ||
199 | "i"(ASI_LEON3_SYSCTRL)); | ||
200 | return retval; | ||
201 | } | ||
202 | |||
203 | /* enable snooping */ | ||
204 | extern inline void sparc_leon3_enable_snooping(void) | ||
205 | { | ||
206 | __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" | ||
207 | "set 0x800000, %%l2\n\t" | ||
208 | "or %%l2, %%l1, %%l2\n\t" | ||
209 | "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2"); | ||
210 | }; | ||
211 | |||
212 | extern inline void sparc_leon3_disable_cache(void) | ||
213 | { | ||
214 | __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" | ||
215 | "set 0x00000f, %%l2\n\t" | ||
216 | "andn %%l2, %%l1, %%l2\n\t" | ||
217 | "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2"); | ||
218 | }; | ||
219 | |||
220 | #endif /*!__ASSEMBLY__*/ | ||
221 | |||
222 | #ifdef CONFIG_SMP | ||
223 | # define LEON3_IRQ_RESCHEDULE 13 | ||
224 | # define LEON3_IRQ_TICKER (leon_percpu_timer_dev[0].irq) | ||
225 | # define LEON3_IRQ_CROSS_CALL 15 | ||
226 | #endif | ||
227 | |||
228 | #if defined(PAGE_SIZE_LEON_8K) | ||
229 | #define LEON_PAGE_SIZE_LEON 1 | ||
230 | #elif defined(PAGE_SIZE_LEON_16K) | ||
231 | #define LEON_PAGE_SIZE_LEON 2) | ||
232 | #else | ||
233 | #define LEON_PAGE_SIZE_LEON 0 | ||
234 | #endif | ||
235 | |||
236 | #if LEON_PAGE_SIZE_LEON == 0 | ||
237 | /* [ 8, 6, 6 ] + 12 */ | ||
238 | #define LEON_PGD_SH 24 | ||
239 | #define LEON_PGD_M 0xff | ||
240 | #define LEON_PMD_SH 18 | ||
241 | #define LEON_PMD_SH_V (LEON_PGD_SH-2) | ||
242 | #define LEON_PMD_M 0x3f | ||
243 | #define LEON_PTE_SH 12 | ||
244 | #define LEON_PTE_M 0x3f | ||
245 | #elif LEON_PAGE_SIZE_LEON == 1 | ||
246 | /* [ 7, 6, 6 ] + 13 */ | ||
247 | #define LEON_PGD_SH 25 | ||
248 | #define LEON_PGD_M 0x7f | ||
249 | #define LEON_PMD_SH 19 | ||
250 | #define LEON_PMD_SH_V (LEON_PGD_SH-1) | ||
251 | #define LEON_PMD_M 0x3f | ||
252 | #define LEON_PTE_SH 13 | ||
253 | #define LEON_PTE_M 0x3f | ||
254 | #elif LEON_PAGE_SIZE_LEON == 2 | ||
255 | /* [ 6, 6, 6 ] + 14 */ | ||
256 | #define LEON_PGD_SH 26 | ||
257 | #define LEON_PGD_M 0x3f | ||
258 | #define LEON_PMD_SH 20 | ||
259 | #define LEON_PMD_SH_V (LEON_PGD_SH-0) | ||
260 | #define LEON_PMD_M 0x3f | ||
261 | #define LEON_PTE_SH 14 | ||
262 | #define LEON_PTE_M 0x3f | ||
263 | #elif LEON_PAGE_SIZE_LEON == 3 | ||
264 | /* [ 4, 7, 6 ] + 15 */ | ||
265 | #define LEON_PGD_SH 28 | ||
266 | #define LEON_PGD_M 0x0f | ||
267 | #define LEON_PMD_SH 21 | ||
268 | #define LEON_PMD_SH_V (LEON_PGD_SH-0) | ||
269 | #define LEON_PMD_M 0x7f | ||
270 | #define LEON_PTE_SH 15 | ||
271 | #define LEON_PTE_M 0x3f | ||
272 | #else | ||
273 | #error cannot determine LEON_PAGE_SIZE_LEON | ||
274 | #endif | ||
275 | |||
276 | #define PAGE_MIN_SHIFT (12) | ||
277 | #define PAGE_MIN_SIZE (1UL << PAGE_MIN_SHIFT) | ||
278 | |||
279 | #define LEON3_XCCR_SETS_MASK 0x07000000UL | ||
280 | #define LEON3_XCCR_SSIZE_MASK 0x00f00000UL | ||
281 | |||
282 | #define LEON2_CCR_DSETS_MASK 0x03000000UL | ||
283 | #define LEON2_CFG_SSIZE_MASK 0x00007000UL | ||
284 | |||
285 | #ifndef __ASSEMBLY__ | ||
286 | extern unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr); | ||
287 | extern void leon_flush_icache_all(void); | ||
288 | extern void leon_flush_dcache_all(void); | ||
289 | extern void leon_flush_cache_all(void); | ||
290 | extern void leon_flush_tlb_all(void); | ||
291 | extern int leon_flush_during_switch; | ||
292 | extern int leon_flush_needed(void); | ||
293 | |||
294 | struct vm_area_struct; | ||
295 | extern void leon_flush_icache_all(void); | ||
296 | extern void leon_flush_dcache_all(void); | ||
297 | extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); | ||
298 | extern void leon_flush_cache_all(void); | ||
299 | extern void leon_flush_tlb_all(void); | ||
300 | extern int leon_flush_during_switch; | ||
301 | extern int leon_flush_needed(void); | ||
302 | extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); | ||
303 | |||
304 | /* struct that hold LEON3 cache configuration registers */ | ||
305 | struct leon3_cacheregs { | ||
306 | unsigned long ccr; /* 0x00 - Cache Control Register */ | ||
307 | unsigned long iccr; /* 0x08 - Instruction Cache Configuration Register */ | ||
308 | unsigned long dccr; /* 0x0c - Data Cache Configuration Register */ | ||
309 | }; | ||
310 | |||
311 | /* struct that hold LEON2 cache configuration register | ||
312 | * & configuration register | ||
313 | */ | ||
314 | struct leon2_cacheregs { | ||
315 | unsigned long ccr, cfg; | ||
316 | }; | ||
317 | |||
318 | #ifdef __KERNEL__ | ||
319 | |||
320 | #include <linux/interrupt.h> | ||
321 | |||
322 | struct device_node; | ||
323 | extern int sparc_leon_eirq_get(int eirq, int cpu); | ||
324 | extern irqreturn_t sparc_leon_eirq_isr(int dummy, void *dev_id); | ||
325 | extern void sparc_leon_eirq_register(int eirq); | ||
326 | extern void leon_clear_clock_irq(void); | ||
327 | extern void leon_load_profile_irq(int cpu, unsigned int limit); | ||
328 | extern void leon_init_timers(irq_handler_t counter_fn); | ||
329 | extern void leon_clear_clock_irq(void); | ||
330 | extern void leon_load_profile_irq(int cpu, unsigned int limit); | ||
331 | extern void leon_trans_init(struct device_node *dp); | ||
332 | extern void leon_node_init(struct device_node *dp, struct device_node ***nextp); | ||
333 | extern void leon_init_IRQ(void); | ||
334 | extern void leon_init(void); | ||
335 | extern unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr); | ||
336 | extern void init_leon(void); | ||
337 | extern void poke_leonsparc(void); | ||
338 | extern void leon3_getCacheRegs(struct leon3_cacheregs *regs); | ||
339 | extern int leon_flush_needed(void); | ||
340 | extern void leon_switch_mm(void); | ||
341 | extern int srmmu_swprobe_trace; | ||
342 | |||
343 | #endif /* __KERNEL__ */ | ||
344 | |||
345 | #endif /* __ASSEMBLY__ */ | ||
346 | |||
347 | /* macros used in leon_mm.c */ | ||
348 | #define PFN(x) ((x) >> PAGE_SHIFT) | ||
349 | #define _pfn_valid(pfn) ((pfn < last_valid_pfn) && (pfn >= PFN(phys_base))) | ||
350 | #define _SRMMU_PTE_PMASK_LEON 0xffffffff | ||
351 | |||
352 | #else /* defined(CONFIG_SPARC_LEON) */ | ||
353 | |||
354 | /* nop definitions for !LEON case */ | ||
355 | #define leon_init() do {} while (0) | ||
356 | #define leon_switch_mm() do {} while (0) | ||
357 | #define leon_init_IRQ() do {} while (0) | ||
358 | #define init_leon() do {} while (0) | ||
359 | |||
360 | #endif /* !defined(CONFIG_SPARC_LEON) */ | ||
361 | |||
362 | #endif | ||
diff --git a/arch/sparc/include/asm/leon_amba.h b/arch/sparc/include/asm/leon_amba.h new file mode 100644 index 000000000000..618e88821795 --- /dev/null +++ b/arch/sparc/include/asm/leon_amba.h | |||
@@ -0,0 +1,263 @@ | |||
1 | /* | ||
2 | *Copyright (C) 2004 Konrad Eisele (eiselekd@web.de,konrad@gaisler.com), Gaisler Research | ||
3 | *Copyright (C) 2004 Stefan Holst (mail@s-holst.de), Uni-Stuttgart | ||
4 | *Copyright (C) 2009 Daniel Hellstrom (daniel@gaisler.com),Konrad Eisele (konrad@gaisler.com) Aeroflex Gaisler AB | ||
5 | */ | ||
6 | |||
7 | #ifndef LEON_AMBA_H_INCLUDE | ||
8 | #define LEON_AMBA_H_INCLUDE | ||
9 | |||
10 | #ifndef __ASSEMBLY__ | ||
11 | |||
12 | struct amba_prom_registers { | ||
13 | unsigned int phys_addr; /* The physical address of this register */ | ||
14 | unsigned int reg_size; /* How many bytes does this register take up? */ | ||
15 | }; | ||
16 | |||
17 | #endif | ||
18 | |||
19 | /* | ||
20 | * The following defines the bits in the LEON UART Status Registers. | ||
21 | */ | ||
22 | |||
23 | #define LEON_REG_UART_STATUS_DR 0x00000001 /* Data Ready */ | ||
24 | #define LEON_REG_UART_STATUS_TSE 0x00000002 /* TX Send Register Empty */ | ||
25 | #define LEON_REG_UART_STATUS_THE 0x00000004 /* TX Hold Register Empty */ | ||
26 | #define LEON_REG_UART_STATUS_BR 0x00000008 /* Break Error */ | ||
27 | #define LEON_REG_UART_STATUS_OE 0x00000010 /* RX Overrun Error */ | ||
28 | #define LEON_REG_UART_STATUS_PE 0x00000020 /* RX Parity Error */ | ||
29 | #define LEON_REG_UART_STATUS_FE 0x00000040 /* RX Framing Error */ | ||
30 | #define LEON_REG_UART_STATUS_ERR 0x00000078 /* Error Mask */ | ||
31 | |||
32 | /* | ||
33 | * The following defines the bits in the LEON UART Ctrl Registers. | ||
34 | */ | ||
35 | |||
36 | #define LEON_REG_UART_CTRL_RE 0x00000001 /* Receiver enable */ | ||
37 | #define LEON_REG_UART_CTRL_TE 0x00000002 /* Transmitter enable */ | ||
38 | #define LEON_REG_UART_CTRL_RI 0x00000004 /* Receiver interrupt enable */ | ||
39 | #define LEON_REG_UART_CTRL_TI 0x00000008 /* Transmitter irq */ | ||
40 | #define LEON_REG_UART_CTRL_PS 0x00000010 /* Parity select */ | ||
41 | #define LEON_REG_UART_CTRL_PE 0x00000020 /* Parity enable */ | ||
42 | #define LEON_REG_UART_CTRL_FL 0x00000040 /* Flow control enable */ | ||
43 | #define LEON_REG_UART_CTRL_LB 0x00000080 /* Loop Back enable */ | ||
44 | |||
45 | #define LEON3_GPTIMER_EN 1 | ||
46 | #define LEON3_GPTIMER_RL 2 | ||
47 | #define LEON3_GPTIMER_LD 4 | ||
48 | #define LEON3_GPTIMER_IRQEN 8 | ||
49 | #define LEON3_GPTIMER_SEPIRQ 8 | ||
50 | |||
51 | #define LEON23_REG_TIMER_CONTROL_EN 0x00000001 /* 1 = enable counting */ | ||
52 | /* 0 = hold scalar and counter */ | ||
53 | #define LEON23_REG_TIMER_CONTROL_RL 0x00000002 /* 1 = reload at 0 */ | ||
54 | /* 0 = stop at 0 */ | ||
55 | #define LEON23_REG_TIMER_CONTROL_LD 0x00000004 /* 1 = load counter */ | ||
56 | /* 0 = no function */ | ||
57 | #define LEON23_REG_TIMER_CONTROL_IQ 0x00000008 /* 1 = irq enable */ | ||
58 | /* 0 = no function */ | ||
59 | |||
60 | /* | ||
61 | * The following defines the bits in the LEON PS/2 Status Registers. | ||
62 | */ | ||
63 | |||
64 | #define LEON_REG_PS2_STATUS_DR 0x00000001 /* Data Ready */ | ||
65 | #define LEON_REG_PS2_STATUS_PE 0x00000002 /* Parity error */ | ||
66 | #define LEON_REG_PS2_STATUS_FE 0x00000004 /* Framing error */ | ||
67 | #define LEON_REG_PS2_STATUS_KI 0x00000008 /* Keyboard inhibit */ | ||
68 | #define LEON_REG_PS2_STATUS_RF 0x00000010 /* RX buffer full */ | ||
69 | #define LEON_REG_PS2_STATUS_TF 0x00000020 /* TX buffer full */ | ||
70 | |||
71 | /* | ||
72 | * The following defines the bits in the LEON PS/2 Ctrl Registers. | ||
73 | */ | ||
74 | |||
75 | #define LEON_REG_PS2_CTRL_RE 0x00000001 /* Receiver enable */ | ||
76 | #define LEON_REG_PS2_CTRL_TE 0x00000002 /* Transmitter enable */ | ||
77 | #define LEON_REG_PS2_CTRL_RI 0x00000004 /* Keyboard receive irq */ | ||
78 | #define LEON_REG_PS2_CTRL_TI 0x00000008 /* Keyboard transmit irq */ | ||
79 | |||
80 | #define LEON3_IRQMPSTATUS_CPUNR 28 | ||
81 | #define LEON3_IRQMPSTATUS_BROADCAST 27 | ||
82 | |||
83 | #define GPTIMER_CONFIG_IRQNT(a) (((a) >> 3) & 0x1f) | ||
84 | #define GPTIMER_CONFIG_ISSEP(a) ((a) & (1 << 8)) | ||
85 | #define GPTIMER_CONFIG_NTIMERS(a) ((a) & (0x7)) | ||
86 | #define LEON3_GPTIMER_CTRL_PENDING 0x10 | ||
87 | #define LEON3_GPTIMER_CONFIG_NRTIMERS(c) ((c)->config & 0x7) | ||
88 | #define LEON3_GPTIMER_CTRL_ISPENDING(r) (((r)&LEON3_GPTIMER_CTRL_PENDING) ? 1 : 0) | ||
89 | |||
90 | #ifdef CONFIG_SPARC_LEON | ||
91 | |||
92 | #ifndef __ASSEMBLY__ | ||
93 | |||
94 | struct leon3_irqctrl_regs_map { | ||
95 | u32 ilevel; | ||
96 | u32 ipend; | ||
97 | u32 iforce; | ||
98 | u32 iclear; | ||
99 | u32 mpstatus; | ||
100 | u32 mpbroadcast; | ||
101 | u32 notused02; | ||
102 | u32 notused03; | ||
103 | u32 notused10; | ||
104 | u32 notused11; | ||
105 | u32 notused12; | ||
106 | u32 notused13; | ||
107 | u32 notused20; | ||
108 | u32 notused21; | ||
109 | u32 notused22; | ||
110 | u32 notused23; | ||
111 | u32 mask[16]; | ||
112 | u32 force[16]; | ||
113 | /* Extended IRQ registers */ | ||
114 | u32 intid[16]; /* 0xc0 */ | ||
115 | }; | ||
116 | |||
117 | struct leon3_apbuart_regs_map { | ||
118 | u32 data; | ||
119 | u32 status; | ||
120 | u32 ctrl; | ||
121 | u32 scaler; | ||
122 | }; | ||
123 | |||
124 | struct leon3_gptimerelem_regs_map { | ||
125 | u32 val; | ||
126 | u32 rld; | ||
127 | u32 ctrl; | ||
128 | u32 unused; | ||
129 | }; | ||
130 | |||
131 | struct leon3_gptimer_regs_map { | ||
132 | u32 scalar; | ||
133 | u32 scalar_reload; | ||
134 | u32 config; | ||
135 | u32 unused; | ||
136 | struct leon3_gptimerelem_regs_map e[8]; | ||
137 | }; | ||
138 | |||
139 | /* | ||
140 | * Types and structure used for AMBA Plug & Play bus scanning | ||
141 | */ | ||
142 | |||
143 | #define AMBA_MAXAPB_DEVS 64 | ||
144 | #define AMBA_MAXAPB_DEVS_PERBUS 16 | ||
145 | |||
146 | struct amba_device_table { | ||
147 | int devnr; /* number of devices on AHB or APB bus */ | ||
148 | unsigned int *addr[16]; /* addresses to the devices configuration tables */ | ||
149 | unsigned int allocbits[1]; /* 0=unallocated, 1=allocated driver */ | ||
150 | }; | ||
151 | |||
152 | struct amba_apbslv_device_table { | ||
153 | int devnr; /* number of devices on AHB or APB bus */ | ||
154 | unsigned int *addr[AMBA_MAXAPB_DEVS]; /* addresses to the devices configuration tables */ | ||
155 | unsigned int apbmst[AMBA_MAXAPB_DEVS]; /* apb master if a entry is a apb slave */ | ||
156 | unsigned int apbmstidx[AMBA_MAXAPB_DEVS]; /* apb master idx if a entry is a apb slave */ | ||
157 | unsigned int allocbits[4]; /* 0=unallocated, 1=allocated driver */ | ||
158 | }; | ||
159 | |||
160 | struct amba_confarea_type { | ||
161 | struct amba_confarea_type *next;/* next bus in chain */ | ||
162 | struct amba_device_table ahbmst; | ||
163 | struct amba_device_table ahbslv; | ||
164 | struct amba_apbslv_device_table apbslv; | ||
165 | unsigned int apbmst; | ||
166 | }; | ||
167 | |||
168 | /* collect apb slaves */ | ||
169 | struct amba_apb_device { | ||
170 | unsigned int start, irq, bus_id; | ||
171 | struct amba_confarea_type *bus; | ||
172 | }; | ||
173 | |||
174 | /* collect ahb slaves */ | ||
175 | struct amba_ahb_device { | ||
176 | unsigned int start[4], irq, bus_id; | ||
177 | struct amba_confarea_type *bus; | ||
178 | }; | ||
179 | |||
180 | struct device_node; | ||
181 | void _amba_init(struct device_node *dp, struct device_node ***nextp); | ||
182 | |||
183 | extern struct leon3_irqctrl_regs_map *leon3_irqctrl_regs; | ||
184 | extern struct leon3_gptimer_regs_map *leon3_gptimer_regs; | ||
185 | extern struct amba_apb_device leon_percpu_timer_dev[16]; | ||
186 | extern int leondebug_irq_disable; | ||
187 | extern int leon_debug_irqout; | ||
188 | extern unsigned long leon3_gptimer_irq; | ||
189 | extern unsigned int sparc_leon_eirq; | ||
190 | |||
191 | #endif /* __ASSEMBLY__ */ | ||
192 | |||
193 | #define LEON3_IO_AREA 0xfff00000 | ||
194 | #define LEON3_CONF_AREA 0xff000 | ||
195 | #define LEON3_AHB_SLAVE_CONF_AREA (1 << 11) | ||
196 | |||
197 | #define LEON3_AHB_CONF_WORDS 8 | ||
198 | #define LEON3_APB_CONF_WORDS 2 | ||
199 | #define LEON3_AHB_MASTERS 16 | ||
200 | #define LEON3_AHB_SLAVES 16 | ||
201 | #define LEON3_APB_SLAVES 16 | ||
202 | #define LEON3_APBUARTS 8 | ||
203 | |||
204 | /* Vendor codes */ | ||
205 | #define VENDOR_GAISLER 1 | ||
206 | #define VENDOR_PENDER 2 | ||
207 | #define VENDOR_ESA 4 | ||
208 | #define VENDOR_OPENCORES 8 | ||
209 | |||
210 | /* Gaisler Research device id's */ | ||
211 | #define GAISLER_LEON3 0x003 | ||
212 | #define GAISLER_LEON3DSU 0x004 | ||
213 | #define GAISLER_ETHAHB 0x005 | ||
214 | #define GAISLER_APBMST 0x006 | ||
215 | #define GAISLER_AHBUART 0x007 | ||
216 | #define GAISLER_SRCTRL 0x008 | ||
217 | #define GAISLER_SDCTRL 0x009 | ||
218 | #define GAISLER_APBUART 0x00C | ||
219 | #define GAISLER_IRQMP 0x00D | ||
220 | #define GAISLER_AHBRAM 0x00E | ||
221 | #define GAISLER_GPTIMER 0x011 | ||
222 | #define GAISLER_PCITRG 0x012 | ||
223 | #define GAISLER_PCISBRG 0x013 | ||
224 | #define GAISLER_PCIFBRG 0x014 | ||
225 | #define GAISLER_PCITRACE 0x015 | ||
226 | #define GAISLER_PCIDMA 0x016 | ||
227 | #define GAISLER_AHBTRACE 0x017 | ||
228 | #define GAISLER_ETHDSU 0x018 | ||
229 | #define GAISLER_PIOPORT 0x01A | ||
230 | #define GAISLER_GRGPIO 0x01A | ||
231 | #define GAISLER_AHBJTAG 0x01c | ||
232 | #define GAISLER_ETHMAC 0x01D | ||
233 | #define GAISLER_AHB2AHB 0x020 | ||
234 | #define GAISLER_USBDC 0x021 | ||
235 | #define GAISLER_ATACTRL 0x024 | ||
236 | #define GAISLER_DDRSPA 0x025 | ||
237 | #define GAISLER_USBEHC 0x026 | ||
238 | #define GAISLER_USBUHC 0x027 | ||
239 | #define GAISLER_I2CMST 0x028 | ||
240 | #define GAISLER_SPICTRL 0x02D | ||
241 | #define GAISLER_DDR2SPA 0x02E | ||
242 | #define GAISLER_SPIMCTRL 0x045 | ||
243 | #define GAISLER_LEON4 0x048 | ||
244 | #define GAISLER_LEON4DSU 0x049 | ||
245 | #define GAISLER_AHBSTAT 0x052 | ||
246 | #define GAISLER_FTMCTRL 0x054 | ||
247 | #define GAISLER_KBD 0x060 | ||
248 | #define GAISLER_VGA 0x061 | ||
249 | #define GAISLER_SVGA 0x063 | ||
250 | #define GAISLER_GRSYSMON 0x066 | ||
251 | #define GAISLER_GRACECTRL 0x067 | ||
252 | |||
253 | #define GAISLER_L2TIME 0xffd /* internal device: leon2 timer */ | ||
254 | #define GAISLER_L2C 0xffe /* internal device: leon2compat */ | ||
255 | #define GAISLER_PLUGPLAY 0xfff /* internal device: plug & play configarea */ | ||
256 | |||
257 | #define amba_vendor(x) (((x) >> 24) & 0xff) | ||
258 | |||
259 | #define amba_device(x) (((x) >> 12) & 0xfff) | ||
260 | |||
261 | #endif /* !defined(CONFIG_SPARC_LEON) */ | ||
262 | |||
263 | #endif | ||
diff --git a/arch/sparc/include/asm/machines.h b/arch/sparc/include/asm/machines.h index c28c2f248794..cd9c099567e4 100644 --- a/arch/sparc/include/asm/machines.h +++ b/arch/sparc/include/asm/machines.h | |||
@@ -15,7 +15,7 @@ struct Sun_Machine_Models { | |||
15 | /* Current number of machines we know about that has an IDPROM | 15 | /* Current number of machines we know about that has an IDPROM |
16 | * machtype entry including one entry for the 0x80 OBP machines. | 16 | * machtype entry including one entry for the 0x80 OBP machines. |
17 | */ | 17 | */ |
18 | #define NUM_SUN_MACHINES 15 | 18 | #define NUM_SUN_MACHINES 16 |
19 | 19 | ||
20 | /* The machine type in the idprom area looks like this: | 20 | /* The machine type in the idprom area looks like this: |
21 | * | 21 | * |
@@ -30,6 +30,7 @@ struct Sun_Machine_Models { | |||
30 | 30 | ||
31 | #define SM_ARCH_MASK 0xf0 | 31 | #define SM_ARCH_MASK 0xf0 |
32 | #define SM_SUN4 0x20 | 32 | #define SM_SUN4 0x20 |
33 | #define M_LEON 0x30 | ||
33 | #define SM_SUN4C 0x50 | 34 | #define SM_SUN4C 0x50 |
34 | #define SM_SUN4M 0x70 | 35 | #define SM_SUN4M 0x70 |
35 | #define SM_SUN4M_OBP 0x80 | 36 | #define SM_SUN4M_OBP 0x80 |
@@ -41,6 +42,9 @@ struct Sun_Machine_Models { | |||
41 | #define SM_4_330 0x03 /* Sun 4/300 series */ | 42 | #define SM_4_330 0x03 /* Sun 4/300 series */ |
42 | #define SM_4_470 0x04 /* Sun 4/400 series */ | 43 | #define SM_4_470 0x04 /* Sun 4/400 series */ |
43 | 44 | ||
45 | /* Leon machines */ | ||
46 | #define M_LEON3_SOC 0x02 /* Leon3 SoC */ | ||
47 | |||
44 | /* Sun4c machines Full Name - PROM NAME */ | 48 | /* Sun4c machines Full Name - PROM NAME */ |
45 | #define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */ | 49 | #define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */ |
46 | #define SM_4C_IPC 0x02 /* Sun4c SparcStation IPC - Sun 4/40 */ | 50 | #define SM_4C_IPC 0x02 /* Sun4c SparcStation IPC - Sun 4/40 */ |
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h index fbd546dd4feb..72e6500e7ab0 100644 --- a/arch/sparc/include/asm/nmi.h +++ b/arch/sparc/include/asm/nmi.h | |||
@@ -5,6 +5,9 @@ extern int __init nmi_init(void); | |||
5 | extern void perfctr_irq(int irq, struct pt_regs *regs); | 5 | extern void perfctr_irq(int irq, struct pt_regs *regs); |
6 | extern void nmi_adjust_hz(unsigned int new_hz); | 6 | extern void nmi_adjust_hz(unsigned int new_hz); |
7 | 7 | ||
8 | extern int nmi_usable; | 8 | extern atomic_t nmi_active; |
9 | |||
10 | extern void start_nmi_watchdog(void *unused); | ||
11 | extern void stop_nmi_watchdog(void *unused); | ||
9 | 12 | ||
10 | #endif /* __NMI_H */ | 13 | #endif /* __NMI_H */ |
diff --git a/arch/sparc/include/asm/pci.h b/arch/sparc/include/asm/pci.h index 6e14fd179335..d9c031f9910f 100644 --- a/arch/sparc/include/asm/pci.h +++ b/arch/sparc/include/asm/pci.h | |||
@@ -5,4 +5,7 @@ | |||
5 | #else | 5 | #else |
6 | #include <asm/pci_32.h> | 6 | #include <asm/pci_32.h> |
7 | #endif | 7 | #endif |
8 | |||
9 | #include <asm-generic/pci-dma-compat.h> | ||
10 | |||
8 | #endif | 11 | #endif |
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h index b41c4c198159..ac0e8369fd97 100644 --- a/arch/sparc/include/asm/pci_32.h +++ b/arch/sparc/include/asm/pci_32.h | |||
@@ -31,42 +31,8 @@ static inline void pcibios_penalize_isa_irq(int irq, int active) | |||
31 | */ | 31 | */ |
32 | #define PCI_DMA_BUS_IS_PHYS (0) | 32 | #define PCI_DMA_BUS_IS_PHYS (0) |
33 | 33 | ||
34 | #include <asm/scatterlist.h> | ||
35 | |||
36 | struct pci_dev; | 34 | struct pci_dev; |
37 | 35 | ||
38 | /* Allocate and map kernel buffer using consistent mode DMA for a device. | ||
39 | * hwdev should be valid struct pci_dev pointer for PCI devices. | ||
40 | */ | ||
41 | extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle); | ||
42 | |||
43 | /* Free and unmap a consistent DMA buffer. | ||
44 | * cpu_addr is what was returned from pci_alloc_consistent, | ||
45 | * size must be the same as what as passed into pci_alloc_consistent, | ||
46 | * and likewise dma_addr must be the same as what *dma_addrp was set to. | ||
47 | * | ||
48 | * References to the memory and mappings assosciated with cpu_addr/dma_addr | ||
49 | * past this call are illegal. | ||
50 | */ | ||
51 | extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); | ||
52 | |||
53 | /* Map a single buffer of the indicated size for DMA in streaming mode. | ||
54 | * The 32-bit bus address to use is returned. | ||
55 | * | ||
56 | * Once the device is given the dma address, the device owns this memory | ||
57 | * until either pci_unmap_single or pci_dma_sync_single_for_cpu is performed. | ||
58 | */ | ||
59 | extern dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction); | ||
60 | |||
61 | /* Unmap a single streaming mode DMA translation. The dma_addr and size | ||
62 | * must match what was provided for in a previous pci_map_single call. All | ||
63 | * other usages are undefined. | ||
64 | * | ||
65 | * After this call, reads by the cpu to the buffer are guaranteed to see | ||
66 | * whatever the device wrote there. | ||
67 | */ | ||
68 | extern void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction); | ||
69 | |||
70 | /* pci_unmap_{single,page} is not a nop, thus... */ | 36 | /* pci_unmap_{single,page} is not a nop, thus... */ |
71 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ | 37 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ |
72 | dma_addr_t ADDR_NAME; | 38 | dma_addr_t ADDR_NAME; |
@@ -81,69 +47,6 @@ extern void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t | |||
81 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ | 47 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ |
82 | (((PTR)->LEN_NAME) = (VAL)) | 48 | (((PTR)->LEN_NAME) = (VAL)) |
83 | 49 | ||
84 | /* | ||
85 | * Same as above, only with pages instead of mapped addresses. | ||
86 | */ | ||
87 | extern dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page, | ||
88 | unsigned long offset, size_t size, int direction); | ||
89 | extern void pci_unmap_page(struct pci_dev *hwdev, | ||
90 | dma_addr_t dma_address, size_t size, int direction); | ||
91 | |||
92 | /* Map a set of buffers described by scatterlist in streaming | ||
93 | * mode for DMA. This is the scather-gather version of the | ||
94 | * above pci_map_single interface. Here the scatter gather list | ||
95 | * elements are each tagged with the appropriate dma address | ||
96 | * and length. They are obtained via sg_dma_{address,length}(SG). | ||
97 | * | ||
98 | * NOTE: An implementation may be able to use a smaller number of | ||
99 | * DMA address/length pairs than there are SG table elements. | ||
100 | * (for example via virtual mapping capabilities) | ||
101 | * The routine returns the number of addr/length pairs actually | ||
102 | * used, at most nents. | ||
103 | * | ||
104 | * Device ownership issues as mentioned above for pci_map_single are | ||
105 | * the same here. | ||
106 | */ | ||
107 | extern int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction); | ||
108 | |||
109 | /* Unmap a set of streaming mode DMA translations. | ||
110 | * Again, cpu read rules concerning calls here are the same as for | ||
111 | * pci_unmap_single() above. | ||
112 | */ | ||
113 | extern void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nhwents, int direction); | ||
114 | |||
115 | /* Make physical memory consistent for a single | ||
116 | * streaming mode DMA translation after a transfer. | ||
117 | * | ||
118 | * If you perform a pci_map_single() but wish to interrogate the | ||
119 | * buffer using the cpu, yet do not wish to teardown the PCI dma | ||
120 | * mapping, you must call this function before doing so. At the | ||
121 | * next point you give the PCI dma address back to the card, you | ||
122 | * must first perform a pci_dma_sync_for_device, and then the device | ||
123 | * again owns the buffer. | ||
124 | */ | ||
125 | extern void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction); | ||
126 | extern void pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction); | ||
127 | |||
128 | /* Make physical memory consistent for a set of streaming | ||
129 | * mode DMA translations after a transfer. | ||
130 | * | ||
131 | * The same as pci_dma_sync_single_* but for a scatter-gather list, | ||
132 | * same rules and usage. | ||
133 | */ | ||
134 | extern void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction); | ||
135 | extern void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction); | ||
136 | |||
137 | /* Return whether the given PCI device DMA address mask can | ||
138 | * be supported properly. For example, if your device can | ||
139 | * only drive the low 24-bits during PCI bus mastering, then | ||
140 | * you would pass 0x00ffffff as the mask to this function. | ||
141 | */ | ||
142 | static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) | ||
143 | { | ||
144 | return 1; | ||
145 | } | ||
146 | |||
147 | #ifdef CONFIG_PCI | 50 | #ifdef CONFIG_PCI |
148 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | 51 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
149 | enum pci_dma_burst_strategy *strat, | 52 | enum pci_dma_burst_strategy *strat, |
@@ -154,14 +57,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
154 | } | 57 | } |
155 | #endif | 58 | #endif |
156 | 59 | ||
157 | #define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0) | ||
158 | |||
159 | static inline int pci_dma_mapping_error(struct pci_dev *pdev, | ||
160 | dma_addr_t dma_addr) | ||
161 | { | ||
162 | return (dma_addr == PCI_DMA_ERROR_CODE); | ||
163 | } | ||
164 | |||
165 | struct device_node; | 60 | struct device_node; |
166 | extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); | 61 | extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); |
167 | 62 | ||
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h index 7a1e3566e59c..5cc9f6aa5494 100644 --- a/arch/sparc/include/asm/pci_64.h +++ b/arch/sparc/include/asm/pci_64.h | |||
@@ -35,37 +35,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active) | |||
35 | */ | 35 | */ |
36 | #define PCI_DMA_BUS_IS_PHYS (0) | 36 | #define PCI_DMA_BUS_IS_PHYS (0) |
37 | 37 | ||
38 | static inline void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, | ||
39 | dma_addr_t *dma_handle) | ||
40 | { | ||
41 | return dma_alloc_coherent(&pdev->dev, size, dma_handle, GFP_ATOMIC); | ||
42 | } | ||
43 | |||
44 | static inline void pci_free_consistent(struct pci_dev *pdev, size_t size, | ||
45 | void *vaddr, dma_addr_t dma_handle) | ||
46 | { | ||
47 | return dma_free_coherent(&pdev->dev, size, vaddr, dma_handle); | ||
48 | } | ||
49 | |||
50 | static inline dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, | ||
51 | size_t size, int direction) | ||
52 | { | ||
53 | return dma_map_single(&pdev->dev, ptr, size, | ||
54 | (enum dma_data_direction) direction); | ||
55 | } | ||
56 | |||
57 | static inline void pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, | ||
58 | size_t size, int direction) | ||
59 | { | ||
60 | dma_unmap_single(&pdev->dev, dma_addr, size, | ||
61 | (enum dma_data_direction) direction); | ||
62 | } | ||
63 | |||
64 | #define pci_map_page(dev, page, off, size, dir) \ | ||
65 | pci_map_single(dev, (page_address(page) + (off)), size, dir) | ||
66 | #define pci_unmap_page(dev,addr,sz,dir) \ | ||
67 | pci_unmap_single(dev,addr,sz,dir) | ||
68 | |||
69 | /* pci_unmap_{single,page} is not a nop, thus... */ | 38 | /* pci_unmap_{single,page} is not a nop, thus... */ |
70 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ | 39 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ |
71 | dma_addr_t ADDR_NAME; | 40 | dma_addr_t ADDR_NAME; |
@@ -80,57 +49,6 @@ static inline void pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, | |||
80 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ | 49 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ |
81 | (((PTR)->LEN_NAME) = (VAL)) | 50 | (((PTR)->LEN_NAME) = (VAL)) |
82 | 51 | ||
83 | static inline int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, | ||
84 | int nents, int direction) | ||
85 | { | ||
86 | return dma_map_sg(&pdev->dev, sg, nents, | ||
87 | (enum dma_data_direction) direction); | ||
88 | } | ||
89 | |||
90 | static inline void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, | ||
91 | int nents, int direction) | ||
92 | { | ||
93 | dma_unmap_sg(&pdev->dev, sg, nents, | ||
94 | (enum dma_data_direction) direction); | ||
95 | } | ||
96 | |||
97 | static inline void pci_dma_sync_single_for_cpu(struct pci_dev *pdev, | ||
98 | dma_addr_t dma_handle, | ||
99 | size_t size, int direction) | ||
100 | { | ||
101 | dma_sync_single_for_cpu(&pdev->dev, dma_handle, size, | ||
102 | (enum dma_data_direction) direction); | ||
103 | } | ||
104 | |||
105 | static inline void pci_dma_sync_single_for_device(struct pci_dev *pdev, | ||
106 | dma_addr_t dma_handle, | ||
107 | size_t size, int direction) | ||
108 | { | ||
109 | /* No flushing needed to sync cpu writes to the device. */ | ||
110 | } | ||
111 | |||
112 | static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *pdev, | ||
113 | struct scatterlist *sg, | ||
114 | int nents, int direction) | ||
115 | { | ||
116 | dma_sync_sg_for_cpu(&pdev->dev, sg, nents, | ||
117 | (enum dma_data_direction) direction); | ||
118 | } | ||
119 | |||
120 | static inline void pci_dma_sync_sg_for_device(struct pci_dev *pdev, | ||
121 | struct scatterlist *sg, | ||
122 | int nelems, int direction) | ||
123 | { | ||
124 | /* No flushing needed to sync cpu writes to the device. */ | ||
125 | } | ||
126 | |||
127 | /* Return whether the given PCI device DMA address mask can | ||
128 | * be supported properly. For example, if your device can | ||
129 | * only drive the low 24-bits during PCI bus mastering, then | ||
130 | * you would pass 0x00ffffff as the mask to this function. | ||
131 | */ | ||
132 | extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask); | ||
133 | |||
134 | /* PCI IOMMU mapping bypass support. */ | 52 | /* PCI IOMMU mapping bypass support. */ |
135 | 53 | ||
136 | /* PCI 64-bit addressing works for all slots on all controller | 54 | /* PCI 64-bit addressing works for all slots on all controller |
@@ -140,12 +58,6 @@ extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask); | |||
140 | #define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) | 58 | #define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) |
141 | #define PCI64_ADDR_BASE 0xfffc000000000000UL | 59 | #define PCI64_ADDR_BASE 0xfffc000000000000UL |
142 | 60 | ||
143 | static inline int pci_dma_mapping_error(struct pci_dev *pdev, | ||
144 | dma_addr_t dma_addr) | ||
145 | { | ||
146 | return dma_mapping_error(&pdev->dev, dma_addr); | ||
147 | } | ||
148 | |||
149 | #ifdef CONFIG_PCI | 61 | #ifdef CONFIG_PCI |
150 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | 62 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
151 | enum pci_dma_burst_strategy *strat, | 63 | enum pci_dma_burst_strategy *strat, |
diff --git a/arch/sparc/include/asm/perf_counter.h b/arch/sparc/include/asm/perf_counter.h new file mode 100644 index 000000000000..5d7a8ca0e491 --- /dev/null +++ b/arch/sparc/include/asm/perf_counter.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef __ASM_SPARC_PERF_COUNTER_H | ||
2 | #define __ASM_SPARC_PERF_COUNTER_H | ||
3 | |||
4 | extern void set_perf_counter_pending(void); | ||
5 | |||
6 | #define PERF_COUNTER_INDEX_OFFSET 0 | ||
7 | |||
8 | #ifdef CONFIG_PERF_COUNTERS | ||
9 | extern void init_hw_perf_counters(void); | ||
10 | #else | ||
11 | static inline void init_hw_perf_counters(void) { } | ||
12 | #endif | ||
13 | |||
14 | #endif | ||
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h index 808555fc1d58..1407c07bdade 100644 --- a/arch/sparc/include/asm/pgtsrmmu.h +++ b/arch/sparc/include/asm/pgtsrmmu.h | |||
@@ -267,6 +267,7 @@ static inline void srmmu_flush_tlb_page(unsigned long page) | |||
267 | 267 | ||
268 | } | 268 | } |
269 | 269 | ||
270 | #ifndef CONFIG_SPARC_LEON | ||
270 | static inline unsigned long srmmu_hwprobe(unsigned long vaddr) | 271 | static inline unsigned long srmmu_hwprobe(unsigned long vaddr) |
271 | { | 272 | { |
272 | unsigned long retval; | 273 | unsigned long retval; |
@@ -278,6 +279,9 @@ static inline unsigned long srmmu_hwprobe(unsigned long vaddr) | |||
278 | 279 | ||
279 | return retval; | 280 | return retval; |
280 | } | 281 | } |
282 | #else | ||
283 | #define srmmu_hwprobe(addr) (srmmu_swprobe(addr, 0) & SRMMU_PTE_PMASK) | ||
284 | #endif | ||
281 | 285 | ||
282 | static inline int | 286 | static inline int |
283 | srmmu_get_pte (unsigned long addr) | 287 | srmmu_get_pte (unsigned long addr) |
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index be8d7aaeb60d..82a190d7efc1 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h | |||
@@ -118,5 +118,8 @@ extern struct device_node *of_console_device; | |||
118 | extern char *of_console_path; | 118 | extern char *of_console_path; |
119 | extern char *of_console_options; | 119 | extern char *of_console_options; |
120 | 120 | ||
121 | extern void (*prom_build_more)(struct device_node *dp, struct device_node ***nextp); | ||
122 | extern char *build_full_name(struct device_node *dp); | ||
123 | |||
121 | #endif /* __KERNEL__ */ | 124 | #endif /* __KERNEL__ */ |
122 | #endif /* _SPARC_PROM_H */ | 125 | #endif /* _SPARC_PROM_H */ |
diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h index 982a12f959f4..3a5ae3d12088 100644 --- a/arch/sparc/include/asm/socket.h +++ b/arch/sparc/include/asm/socket.h | |||
@@ -29,6 +29,9 @@ | |||
29 | #define SO_RCVBUFFORCE 0x100b | 29 | #define SO_RCVBUFFORCE 0x100b |
30 | #define SO_ERROR 0x1007 | 30 | #define SO_ERROR 0x1007 |
31 | #define SO_TYPE 0x1008 | 31 | #define SO_TYPE 0x1008 |
32 | #define SO_PROTOCOL 0x1028 | ||
33 | #define SO_DOMAIN 0x1029 | ||
34 | |||
32 | 35 | ||
33 | /* Linux specific, keep the same. */ | 36 | /* Linux specific, keep the same. */ |
34 | #define SO_NO_CHECK 0x000b | 37 | #define SO_NO_CHECK 0x000b |
diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h index 46f91ab66a50..857630cff636 100644 --- a/arch/sparc/include/asm/spinlock_32.h +++ b/arch/sparc/include/asm/spinlock_32.h | |||
@@ -76,7 +76,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
76 | * | 76 | * |
77 | * Unfortunately this scheme limits us to ~16,000,000 cpus. | 77 | * Unfortunately this scheme limits us to ~16,000,000 cpus. |
78 | */ | 78 | */ |
79 | static inline void __read_lock(raw_rwlock_t *rw) | 79 | static inline void arch_read_lock(raw_rwlock_t *rw) |
80 | { | 80 | { |
81 | register raw_rwlock_t *lp asm("g1"); | 81 | register raw_rwlock_t *lp asm("g1"); |
82 | lp = rw; | 82 | lp = rw; |
@@ -92,11 +92,11 @@ static inline void __read_lock(raw_rwlock_t *rw) | |||
92 | #define __raw_read_lock(lock) \ | 92 | #define __raw_read_lock(lock) \ |
93 | do { unsigned long flags; \ | 93 | do { unsigned long flags; \ |
94 | local_irq_save(flags); \ | 94 | local_irq_save(flags); \ |
95 | __read_lock(lock); \ | 95 | arch_read_lock(lock); \ |
96 | local_irq_restore(flags); \ | 96 | local_irq_restore(flags); \ |
97 | } while(0) | 97 | } while(0) |
98 | 98 | ||
99 | static inline void __read_unlock(raw_rwlock_t *rw) | 99 | static inline void arch_read_unlock(raw_rwlock_t *rw) |
100 | { | 100 | { |
101 | register raw_rwlock_t *lp asm("g1"); | 101 | register raw_rwlock_t *lp asm("g1"); |
102 | lp = rw; | 102 | lp = rw; |
@@ -112,7 +112,7 @@ static inline void __read_unlock(raw_rwlock_t *rw) | |||
112 | #define __raw_read_unlock(lock) \ | 112 | #define __raw_read_unlock(lock) \ |
113 | do { unsigned long flags; \ | 113 | do { unsigned long flags; \ |
114 | local_irq_save(flags); \ | 114 | local_irq_save(flags); \ |
115 | __read_unlock(lock); \ | 115 | arch_read_unlock(lock); \ |
116 | local_irq_restore(flags); \ | 116 | local_irq_restore(flags); \ |
117 | } while(0) | 117 | } while(0) |
118 | 118 | ||
@@ -150,7 +150,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw) | |||
150 | return (val == 0); | 150 | return (val == 0); |
151 | } | 151 | } |
152 | 152 | ||
153 | static inline int __read_trylock(raw_rwlock_t *rw) | 153 | static inline int arch_read_trylock(raw_rwlock_t *rw) |
154 | { | 154 | { |
155 | register raw_rwlock_t *lp asm("g1"); | 155 | register raw_rwlock_t *lp asm("g1"); |
156 | register int res asm("o0"); | 156 | register int res asm("o0"); |
@@ -169,7 +169,7 @@ static inline int __read_trylock(raw_rwlock_t *rw) | |||
169 | ({ unsigned long flags; \ | 169 | ({ unsigned long flags; \ |
170 | int res; \ | 170 | int res; \ |
171 | local_irq_save(flags); \ | 171 | local_irq_save(flags); \ |
172 | res = __read_trylock(lock); \ | 172 | res = arch_read_trylock(lock); \ |
173 | local_irq_restore(flags); \ | 173 | local_irq_restore(flags); \ |
174 | res; \ | 174 | res; \ |
175 | }) | 175 | }) |
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h index f6b2b92ad8d2..43e514783582 100644 --- a/arch/sparc/include/asm/spinlock_64.h +++ b/arch/sparc/include/asm/spinlock_64.h | |||
@@ -92,7 +92,7 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla | |||
92 | 92 | ||
93 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ | 93 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ |
94 | 94 | ||
95 | static void inline __read_lock(raw_rwlock_t *lock) | 95 | static void inline arch_read_lock(raw_rwlock_t *lock) |
96 | { | 96 | { |
97 | unsigned long tmp1, tmp2; | 97 | unsigned long tmp1, tmp2; |
98 | 98 | ||
@@ -115,7 +115,7 @@ static void inline __read_lock(raw_rwlock_t *lock) | |||
115 | : "memory"); | 115 | : "memory"); |
116 | } | 116 | } |
117 | 117 | ||
118 | static int inline __read_trylock(raw_rwlock_t *lock) | 118 | static int inline arch_read_trylock(raw_rwlock_t *lock) |
119 | { | 119 | { |
120 | int tmp1, tmp2; | 120 | int tmp1, tmp2; |
121 | 121 | ||
@@ -136,7 +136,7 @@ static int inline __read_trylock(raw_rwlock_t *lock) | |||
136 | return tmp1; | 136 | return tmp1; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void inline __read_unlock(raw_rwlock_t *lock) | 139 | static void inline arch_read_unlock(raw_rwlock_t *lock) |
140 | { | 140 | { |
141 | unsigned long tmp1, tmp2; | 141 | unsigned long tmp1, tmp2; |
142 | 142 | ||
@@ -152,7 +152,7 @@ static void inline __read_unlock(raw_rwlock_t *lock) | |||
152 | : "memory"); | 152 | : "memory"); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void inline __write_lock(raw_rwlock_t *lock) | 155 | static void inline arch_write_lock(raw_rwlock_t *lock) |
156 | { | 156 | { |
157 | unsigned long mask, tmp1, tmp2; | 157 | unsigned long mask, tmp1, tmp2; |
158 | 158 | ||
@@ -177,7 +177,7 @@ static void inline __write_lock(raw_rwlock_t *lock) | |||
177 | : "memory"); | 177 | : "memory"); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void inline __write_unlock(raw_rwlock_t *lock) | 180 | static void inline arch_write_unlock(raw_rwlock_t *lock) |
181 | { | 181 | { |
182 | __asm__ __volatile__( | 182 | __asm__ __volatile__( |
183 | " stw %%g0, [%0]" | 183 | " stw %%g0, [%0]" |
@@ -186,7 +186,7 @@ static void inline __write_unlock(raw_rwlock_t *lock) | |||
186 | : "memory"); | 186 | : "memory"); |
187 | } | 187 | } |
188 | 188 | ||
189 | static int inline __write_trylock(raw_rwlock_t *lock) | 189 | static int inline arch_write_trylock(raw_rwlock_t *lock) |
190 | { | 190 | { |
191 | unsigned long mask, tmp1, tmp2, result; | 191 | unsigned long mask, tmp1, tmp2, result; |
192 | 192 | ||
@@ -210,14 +210,14 @@ static int inline __write_trylock(raw_rwlock_t *lock) | |||
210 | return result; | 210 | return result; |
211 | } | 211 | } |
212 | 212 | ||
213 | #define __raw_read_lock(p) __read_lock(p) | 213 | #define __raw_read_lock(p) arch_read_lock(p) |
214 | #define __raw_read_lock_flags(p, f) __read_lock(p) | 214 | #define __raw_read_lock_flags(p, f) arch_read_lock(p) |
215 | #define __raw_read_trylock(p) __read_trylock(p) | 215 | #define __raw_read_trylock(p) arch_read_trylock(p) |
216 | #define __raw_read_unlock(p) __read_unlock(p) | 216 | #define __raw_read_unlock(p) arch_read_unlock(p) |
217 | #define __raw_write_lock(p) __write_lock(p) | 217 | #define __raw_write_lock(p) arch_write_lock(p) |
218 | #define __raw_write_lock_flags(p, f) __write_lock(p) | 218 | #define __raw_write_lock_flags(p, f) arch_write_lock(p) |
219 | #define __raw_write_unlock(p) __write_unlock(p) | 219 | #define __raw_write_unlock(p) arch_write_unlock(p) |
220 | #define __raw_write_trylock(p) __write_trylock(p) | 220 | #define __raw_write_trylock(p) arch_write_trylock(p) |
221 | 221 | ||
222 | #define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) | 222 | #define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) |
223 | #define __raw_write_can_lock(rw) (!(rw)->lock) | 223 | #define __raw_write_can_lock(rw) (!(rw)->lock) |
diff --git a/arch/sparc/include/asm/system_32.h b/arch/sparc/include/asm/system_32.h index 751c8c17f5a0..890036b3689a 100644 --- a/arch/sparc/include/asm/system_32.h +++ b/arch/sparc/include/asm/system_32.h | |||
@@ -32,6 +32,7 @@ enum sparc_cpu { | |||
32 | sun4u = 0x05, /* V8 ploos ploos */ | 32 | sun4u = 0x05, /* V8 ploos ploos */ |
33 | sun_unknown = 0x06, | 33 | sun_unknown = 0x06, |
34 | ap1000 = 0x07, /* almost a sun4m */ | 34 | ap1000 = 0x07, /* almost a sun4m */ |
35 | sparc_leon = 0x08, /* Leon SoC */ | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | /* Really, userland should not be looking at any of this... */ | 38 | /* Really, userland should not be looking at any of this... */ |
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h index 6c077816ab28..25e848f0cad7 100644 --- a/arch/sparc/include/asm/system_64.h +++ b/arch/sparc/include/asm/system_64.h | |||
@@ -29,6 +29,10 @@ enum sparc_cpu { | |||
29 | /* This cannot ever be a sun4c :) That's just history. */ | 29 | /* This cannot ever be a sun4c :) That's just history. */ |
30 | #define ARCH_SUN4C 0 | 30 | #define ARCH_SUN4C 0 |
31 | 31 | ||
32 | extern const char *sparc_cpu_type; | ||
33 | extern const char *sparc_fpu_type; | ||
34 | extern const char *sparc_pmu_type; | ||
35 | |||
32 | extern char reboot_command[]; | 36 | extern char reboot_command[]; |
33 | 37 | ||
34 | /* These are here in an effort to more fully work around Spitfire Errata | 38 | /* These are here in an effort to more fully work around Spitfire Errata |
diff --git a/arch/sparc/include/asm/types.h b/arch/sparc/include/asm/types.h index de671d73baed..09c79a9c8516 100644 --- a/arch/sparc/include/asm/types.h +++ b/arch/sparc/include/asm/types.h | |||
@@ -8,9 +8,8 @@ | |||
8 | * need to be careful to avoid a name clashes. | 8 | * need to be careful to avoid a name clashes. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #if defined(__sparc__) && defined(__arch64__) | 11 | #if defined(__sparc__) |
12 | 12 | ||
13 | /*** SPARC 64 bit ***/ | ||
14 | #include <asm-generic/int-ll64.h> | 13 | #include <asm-generic/int-ll64.h> |
15 | 14 | ||
16 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
@@ -26,33 +25,21 @@ typedef unsigned short umode_t; | |||
26 | /* Dma addresses come in generic and 64-bit flavours. */ | 25 | /* Dma addresses come in generic and 64-bit flavours. */ |
27 | 26 | ||
28 | typedef u32 dma_addr_t; | 27 | typedef u32 dma_addr_t; |
29 | typedef u64 dma64_addr_t; | ||
30 | 28 | ||
31 | #endif /* __ASSEMBLY__ */ | 29 | #if defined(__arch64__) |
32 | 30 | ||
33 | #endif /* __KERNEL__ */ | 31 | /*** SPARC 64 bit ***/ |
32 | typedef u64 dma64_addr_t; | ||
34 | #else | 33 | #else |
35 | |||
36 | /*** SPARC 32 bit ***/ | 34 | /*** SPARC 32 bit ***/ |
37 | #include <asm-generic/int-ll64.h> | ||
38 | |||
39 | #ifndef __ASSEMBLY__ | ||
40 | |||
41 | typedef unsigned short umode_t; | ||
42 | |||
43 | #endif /* __ASSEMBLY__ */ | ||
44 | |||
45 | #ifdef __KERNEL__ | ||
46 | |||
47 | #ifndef __ASSEMBLY__ | ||
48 | |||
49 | typedef u32 dma_addr_t; | ||
50 | typedef u32 dma64_addr_t; | 35 | typedef u32 dma64_addr_t; |
51 | 36 | ||
37 | #endif /* defined(__arch64__) */ | ||
38 | |||
52 | #endif /* __ASSEMBLY__ */ | 39 | #endif /* __ASSEMBLY__ */ |
53 | 40 | ||
54 | #endif /* __KERNEL__ */ | 41 | #endif /* __KERNEL__ */ |
55 | 42 | ||
56 | #endif /* defined(__sparc__) && defined(__arch64__) */ | 43 | #endif /* defined(__sparc__) */ |
57 | 44 | ||
58 | #endif /* defined(_SPARC_TYPES_H) */ | 45 | #endif /* defined(_SPARC_TYPES_H) */ |
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index a38c03238918..9ea271e19c70 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h | |||
@@ -7,8 +7,8 @@ | |||
7 | 7 | ||
8 | #ifdef __KERNEL__ | 8 | #ifdef __KERNEL__ |
9 | #include <linux/compiler.h> | 9 | #include <linux/compiler.h> |
10 | #include <linux/sched.h> | ||
11 | #include <linux/string.h> | 10 | #include <linux/string.h> |
11 | #include <linux/thread_info.h> | ||
12 | #include <asm/asi.h> | 12 | #include <asm/asi.h> |
13 | #include <asm/system.h> | 13 | #include <asm/system.h> |
14 | #include <asm/spitfire.h> | 14 | #include <asm/spitfire.h> |
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index b2c406de7d4f..706df669f3b8 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h | |||
@@ -395,8 +395,9 @@ | |||
395 | #define __NR_preadv 324 | 395 | #define __NR_preadv 324 |
396 | #define __NR_pwritev 325 | 396 | #define __NR_pwritev 325 |
397 | #define __NR_rt_tgsigqueueinfo 326 | 397 | #define __NR_rt_tgsigqueueinfo 326 |
398 | #define __NR_perf_counter_open 327 | ||
398 | 399 | ||
399 | #define NR_SYSCALLS 327 | 400 | #define NR_SYSCALLS 328 |
400 | 401 | ||
401 | #ifdef __32bit_syscall_numbers__ | 402 | #ifdef __32bit_syscall_numbers__ |
402 | /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, | 403 | /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, |