diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2011-05-02 16:06:42 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2011-05-04 14:40:54 -0400 |
commit | 28d717411badb78df71ecf087a07b93caf418f59 (patch) | |
tree | 9ad835c19009726acecfa4c114e8a70ca10d5cd0 /arch/tile | |
parent | dbb434214e34014dc7acb0e7811c37471df26a72 (diff) |
arch/tile: various header improvements for building drivers
This change adds a number of missing headers in asm (fb.h, parport.h,
serial.h, and vga.h) using the minimal generic versions.
It also adds a number of missing interfaces that showed up as build
failures when trying to build various drivers not normally included in the
"tile" distribution: ioremap_wc(), memset_io(), io{read,write}{16,32}be(),
virt_to_bus(), bus_to_virt(), irq_canonicalize(), __pte(), __pgd(),
and __pmd(). I also added a cast in virt_to_page() since not all callers
pass a pointer.
I fixed <asm/stat.h> to properly include a __KERNEL__ guard for the
__ARCH_WANT_STAT64 symbol, and <asm/swab.h> to use __builtin_bswap32()
even for our 64-bit architecture, since the same code is produced.
I added an export for get_cycles(), since it's used in some modules.
And I made <arch/spr_def.h> properly include the __KERNEL__ guard,
even though it's not yet exported, since it likely will be soon.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/include/arch/spr_def.h | 13 | ||||
-rw-r--r-- | arch/tile/include/asm/fb.h | 1 | ||||
-rw-r--r-- | arch/tile/include/asm/io.h | 18 | ||||
-rw-r--r-- | arch/tile/include/asm/irq.h | 2 | ||||
-rw-r--r-- | arch/tile/include/asm/page.h | 8 | ||||
-rw-r--r-- | arch/tile/include/asm/parport.h | 1 | ||||
-rw-r--r-- | arch/tile/include/asm/serial.h | 1 | ||||
-rw-r--r-- | arch/tile/include/asm/stat.h | 2 | ||||
-rw-r--r-- | arch/tile/include/asm/swab.h | 6 | ||||
-rw-r--r-- | arch/tile/include/asm/vga.h | 39 | ||||
-rw-r--r-- | arch/tile/kernel/time.c | 2 |
11 files changed, 83 insertions, 10 deletions
diff --git a/arch/tile/include/arch/spr_def.h b/arch/tile/include/arch/spr_def.h index 442fcba0d122..f548efeb2de3 100644 --- a/arch/tile/include/arch/spr_def.h +++ b/arch/tile/include/arch/spr_def.h | |||
@@ -12,6 +12,15 @@ | |||
12 | * more details. | 12 | * more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* Include the proper base SPR definition file. */ | ||
16 | #ifdef __tilegx__ | ||
17 | #include <arch/spr_def_64.h> | ||
18 | #else | ||
19 | #include <arch/spr_def_32.h> | ||
20 | #endif | ||
21 | |||
22 | #ifdef __KERNEL__ | ||
23 | |||
15 | /* | 24 | /* |
16 | * In addition to including the proper base SPR definition file, depending | 25 | * In addition to including the proper base SPR definition file, depending |
17 | * on machine architecture, this file defines several macros which allow | 26 | * on machine architecture, this file defines several macros which allow |
@@ -29,7 +38,6 @@ | |||
29 | #define _concat4(a, b, c, d) __concat4(a, b, c, d) | 38 | #define _concat4(a, b, c, d) __concat4(a, b, c, d) |
30 | 39 | ||
31 | #ifdef __tilegx__ | 40 | #ifdef __tilegx__ |
32 | #include <arch/spr_def_64.h> | ||
33 | 41 | ||
34 | /* TILE-Gx dependent, protection-level dependent SPRs. */ | 42 | /* TILE-Gx dependent, protection-level dependent SPRs. */ |
35 | 43 | ||
@@ -65,7 +73,6 @@ | |||
65 | _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,) | 73 | _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,) |
66 | 74 | ||
67 | #else | 75 | #else |
68 | #include <arch/spr_def_32.h> | ||
69 | 76 | ||
70 | /* TILEPro dependent, protection-level dependent SPRs. */ | 77 | /* TILEPro dependent, protection-level dependent SPRs. */ |
71 | 78 | ||
@@ -102,3 +109,5 @@ | |||
102 | _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,) | 109 | _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,) |
103 | #define INT_INTCTRL_K \ | 110 | #define INT_INTCTRL_K \ |
104 | _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,) | 111 | _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,) |
112 | |||
113 | #endif /* __KERNEL__ */ | ||
diff --git a/arch/tile/include/asm/fb.h b/arch/tile/include/asm/fb.h new file mode 100644 index 000000000000..3a4988e8df45 --- /dev/null +++ b/arch/tile/include/asm/fb.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/fb.h> | |||
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h index d3cbb9b14cbe..c9ea1652af03 100644 --- a/arch/tile/include/asm/io.h +++ b/arch/tile/include/asm/io.h | |||
@@ -52,6 +52,7 @@ extern void iounmap(volatile void __iomem *addr); | |||
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #define ioremap_nocache(physaddr, size) ioremap(physaddr, size) | 54 | #define ioremap_nocache(physaddr, size) ioremap(physaddr, size) |
55 | #define ioremap_wc(physaddr, size) ioremap(physaddr, size) | ||
55 | #define ioremap_writethrough(physaddr, size) ioremap(physaddr, size) | 56 | #define ioremap_writethrough(physaddr, size) ioremap(physaddr, size) |
56 | #define ioremap_fullcache(physaddr, size) ioremap(physaddr, size) | 57 | #define ioremap_fullcache(physaddr, size) ioremap(physaddr, size) |
57 | 58 | ||
@@ -161,6 +162,15 @@ static inline void _tile_writeq(u64 val, unsigned long addr) | |||
161 | #define iowrite32 writel | 162 | #define iowrite32 writel |
162 | #define iowrite64 writeq | 163 | #define iowrite64 writeq |
163 | 164 | ||
165 | static inline void memset_io(void *dst, int val, size_t len) | ||
166 | { | ||
167 | int x; | ||
168 | BUG_ON((unsigned long)dst & 0x3); | ||
169 | val = (val & 0xff) * 0x01010101; | ||
170 | for (x = 0; x < len; x += 4) | ||
171 | writel(val, dst + x); | ||
172 | } | ||
173 | |||
164 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, | 174 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, |
165 | size_t len) | 175 | size_t len) |
166 | { | 176 | { |
@@ -269,6 +279,11 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
269 | ioport_panic(); | 279 | ioport_panic(); |
270 | } | 280 | } |
271 | 281 | ||
282 | #define ioread16be(addr) be16_to_cpu(ioread16(addr)) | ||
283 | #define ioread32be(addr) be32_to_cpu(ioread32(addr)) | ||
284 | #define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr)) | ||
285 | #define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr)) | ||
286 | |||
272 | #define ioread8_rep(p, dst, count) \ | 287 | #define ioread8_rep(p, dst, count) \ |
273 | insb((unsigned long) (p), (dst), (count)) | 288 | insb((unsigned long) (p), (dst), (count)) |
274 | #define ioread16_rep(p, dst, count) \ | 289 | #define ioread16_rep(p, dst, count) \ |
@@ -283,4 +298,7 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
283 | #define iowrite32_rep(p, src, count) \ | 298 | #define iowrite32_rep(p, src, count) \ |
284 | outsl((unsigned long) (p), (src), (count)) | 299 | outsl((unsigned long) (p), (src), (count)) |
285 | 300 | ||
301 | #define virt_to_bus virt_to_phys | ||
302 | #define bus_to_virt phys_to_virt | ||
303 | |||
286 | #endif /* _ASM_TILE_IO_H */ | 304 | #endif /* _ASM_TILE_IO_H */ |
diff --git a/arch/tile/include/asm/irq.h b/arch/tile/include/asm/irq.h index 572fd3ef1d73..94e9a511de84 100644 --- a/arch/tile/include/asm/irq.h +++ b/arch/tile/include/asm/irq.h | |||
@@ -23,6 +23,8 @@ | |||
23 | /* IRQ numbers used for linux IPIs. */ | 23 | /* IRQ numbers used for linux IPIs. */ |
24 | #define IRQ_RESCHEDULE 1 | 24 | #define IRQ_RESCHEDULE 1 |
25 | 25 | ||
26 | #define irq_canonicalize(irq) (irq) | ||
27 | |||
26 | void ack_bad_irq(unsigned int irq); | 28 | void ack_bad_irq(unsigned int irq); |
27 | 29 | ||
28 | /* | 30 | /* |
diff --git a/arch/tile/include/asm/page.h b/arch/tile/include/asm/page.h index 3eb53525bf9d..7105629afa1d 100644 --- a/arch/tile/include/asm/page.h +++ b/arch/tile/include/asm/page.h | |||
@@ -91,6 +91,10 @@ typedef struct page *pgtable_t; | |||
91 | /* Must be a macro since it is used to create constants. */ | 91 | /* Must be a macro since it is used to create constants. */ |
92 | #define __pgprot(val) hv_pte(val) | 92 | #define __pgprot(val) hv_pte(val) |
93 | 93 | ||
94 | /* Rarely-used initializers, typically with a "zero" value. */ | ||
95 | #define __pte(x) hv_pte(x) | ||
96 | #define __pgd(x) hv_pte(x) | ||
97 | |||
94 | static inline u64 pgprot_val(pgprot_t pgprot) | 98 | static inline u64 pgprot_val(pgprot_t pgprot) |
95 | { | 99 | { |
96 | return hv_pte_val(pgprot); | 100 | return hv_pte_val(pgprot); |
@@ -110,6 +114,8 @@ static inline u64 pgd_val(pgd_t pgd) | |||
110 | 114 | ||
111 | typedef HV_PTE pmd_t; | 115 | typedef HV_PTE pmd_t; |
112 | 116 | ||
117 | #define __pmd(x) hv_pte(x) | ||
118 | |||
113 | static inline u64 pmd_val(pmd_t pmd) | 119 | static inline u64 pmd_val(pmd_t pmd) |
114 | { | 120 | { |
115 | return hv_pte_val(pmd); | 121 | return hv_pte_val(pmd); |
@@ -318,7 +324,7 @@ static inline int pfn_valid(unsigned long pfn) | |||
318 | 324 | ||
319 | /* Provide as macros since these require some other headers included. */ | 325 | /* Provide as macros since these require some other headers included. */ |
320 | #define page_to_pa(page) ((phys_addr_t)(page_to_pfn(page)) << PAGE_SHIFT) | 326 | #define page_to_pa(page) ((phys_addr_t)(page_to_pfn(page)) << PAGE_SHIFT) |
321 | #define virt_to_page(kaddr) pfn_to_page(kaddr_to_pfn(kaddr)) | 327 | #define virt_to_page(kaddr) pfn_to_page(kaddr_to_pfn((void *)(kaddr))) |
322 | #define page_to_virt(page) pfn_to_kaddr(page_to_pfn(page)) | 328 | #define page_to_virt(page) pfn_to_kaddr(page_to_pfn(page)) |
323 | 329 | ||
324 | struct mm_struct; | 330 | struct mm_struct; |
diff --git a/arch/tile/include/asm/parport.h b/arch/tile/include/asm/parport.h new file mode 100644 index 000000000000..cf252af64590 --- /dev/null +++ b/arch/tile/include/asm/parport.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/parport.h> | |||
diff --git a/arch/tile/include/asm/serial.h b/arch/tile/include/asm/serial.h new file mode 100644 index 000000000000..a0cb0caff152 --- /dev/null +++ b/arch/tile/include/asm/serial.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/serial.h> | |||
diff --git a/arch/tile/include/asm/stat.h b/arch/tile/include/asm/stat.h index b16e5db8f0e7..c0db34d56be3 100644 --- a/arch/tile/include/asm/stat.h +++ b/arch/tile/include/asm/stat.h | |||
@@ -1,4 +1,4 @@ | |||
1 | #ifdef CONFIG_COMPAT | 1 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) |
2 | #define __ARCH_WANT_STAT64 /* Used for compat_sys_stat64() etc. */ | 2 | #define __ARCH_WANT_STAT64 /* Used for compat_sys_stat64() etc. */ |
3 | #endif | 3 | #endif |
4 | #include <asm-generic/stat.h> | 4 | #include <asm-generic/stat.h> |
diff --git a/arch/tile/include/asm/swab.h b/arch/tile/include/asm/swab.h index 25c686a00f1d..7c37b38f6c8d 100644 --- a/arch/tile/include/asm/swab.h +++ b/arch/tile/include/asm/swab.h | |||
@@ -18,12 +18,6 @@ | |||
18 | /* Tile gcc is always >= 4.3.0, so we use __builtin_bswap. */ | 18 | /* Tile gcc is always >= 4.3.0, so we use __builtin_bswap. */ |
19 | #define __arch_swab32(x) __builtin_bswap32(x) | 19 | #define __arch_swab32(x) __builtin_bswap32(x) |
20 | #define __arch_swab64(x) __builtin_bswap64(x) | 20 | #define __arch_swab64(x) __builtin_bswap64(x) |
21 | |||
22 | /* Use the variant that is natural for the wordsize. */ | ||
23 | #ifdef CONFIG_64BIT | ||
24 | #define __arch_swab16(x) (__builtin_bswap64(x) >> 48) | ||
25 | #else | ||
26 | #define __arch_swab16(x) (__builtin_bswap32(x) >> 16) | 21 | #define __arch_swab16(x) (__builtin_bswap32(x) >> 16) |
27 | #endif | ||
28 | 22 | ||
29 | #endif /* _ASM_TILE_SWAB_H */ | 23 | #endif /* _ASM_TILE_SWAB_H */ |
diff --git a/arch/tile/include/asm/vga.h b/arch/tile/include/asm/vga.h new file mode 100644 index 000000000000..7b46e754d611 --- /dev/null +++ b/arch/tile/include/asm/vga.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * Access to VGA videoram. | ||
15 | */ | ||
16 | |||
17 | #ifndef _ASM_TILE_VGA_H | ||
18 | #define _ASM_TILE_VGA_H | ||
19 | |||
20 | #include <asm/io.h> | ||
21 | |||
22 | #define VT_BUF_HAVE_RW | ||
23 | |||
24 | static inline void scr_writew(u16 val, volatile u16 *addr) | ||
25 | { | ||
26 | __raw_writew(val, (volatile u16 __iomem *) addr); | ||
27 | } | ||
28 | |||
29 | static inline u16 scr_readw(volatile const u16 *addr) | ||
30 | { | ||
31 | return __raw_readw((volatile const u16 __iomem *) addr); | ||
32 | } | ||
33 | |||
34 | #define vga_readb(a) readb((u8 __iomem *)(a)) | ||
35 | #define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) | ||
36 | |||
37 | #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s)) | ||
38 | |||
39 | #endif | ||
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c index 49a605be94c5..c4be58cc5d50 100644 --- a/arch/tile/kernel/time.c +++ b/arch/tile/kernel/time.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/module.h> | ||
25 | #include <asm/irq_regs.h> | 26 | #include <asm/irq_regs.h> |
26 | #include <asm/traps.h> | 27 | #include <asm/traps.h> |
27 | #include <hv/hypervisor.h> | 28 | #include <hv/hypervisor.h> |
@@ -56,6 +57,7 @@ cycles_t get_cycles(void) | |||
56 | 57 | ||
57 | return (((cycles_t)high) << 32) | low; | 58 | return (((cycles_t)high) << 32) | low; |
58 | } | 59 | } |
60 | EXPORT_SYMBOL(get_cycles); | ||
59 | #endif | 61 | #endif |
60 | 62 | ||
61 | /* | 63 | /* |