diff options
Diffstat (limited to 'include')
271 files changed, 16496 insertions, 874 deletions
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h index 726c150dcbe4..a011ef4cf3d3 100644 --- a/include/asm-alpha/mmzone.h +++ b/include/asm-alpha/mmzone.h | |||
@@ -57,7 +57,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
57 | * Given a kernel address, find the home node of the underlying memory. | 57 | * Given a kernel address, find the home node of the underlying memory. |
58 | */ | 58 | */ |
59 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | 59 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) |
60 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
61 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 60 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
62 | 61 | ||
63 | #define local_mapnr(kvaddr) \ | 62 | #define local_mapnr(kvaddr) \ |
@@ -108,7 +107,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
108 | #define pfn_to_page(pfn) \ | 107 | #define pfn_to_page(pfn) \ |
109 | ({ \ | 108 | ({ \ |
110 | unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \ | 109 | unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \ |
111 | (node_mem_map(kvaddr_to_nid(kaddr)) + local_mapnr(kaddr)); \ | 110 | (NODE_DATA(kvaddr_to_nid(kaddr))->node_mem_map + local_mapnr(kaddr)); \ |
112 | }) | 111 | }) |
113 | 112 | ||
114 | #define page_to_pfn(page) \ | 113 | #define page_to_pfn(page) \ |
diff --git a/include/asm-arm/arch-ixp2000/gpio.h b/include/asm-arm/arch-ixp2000/gpio.h index 84634af5cc64..03cbbe1fd9d8 100644 --- a/include/asm-arm/arch-ixp2000/gpio.h +++ b/include/asm-arm/arch-ixp2000/gpio.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * include/asm-arm/arch-ixp2000/ixp2000-gpio.h | 2 | * include/asm-arm/arch-ixp2000/gpio.h |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Intel Corporation. | 4 | * Copyright (C) 2002 Intel Corporation. |
5 | * | 5 | * |
@@ -16,26 +16,18 @@ | |||
16 | * Use this instead of directly setting the GPIO registers. | 16 | * Use this instead of directly setting the GPIO registers. |
17 | * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb) | 17 | * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb) |
18 | */ | 18 | */ |
19 | #ifndef _ASM_ARCH_IXP2000_GPIO_H_ | 19 | #ifndef __ASM_ARCH_GPIO_H |
20 | #define _ASM_ARCH_IXP2000_GPIO_H_ | 20 | #define __ASM_ARCH_GPIO_H |
21 | 21 | ||
22 | #ifndef __ASSEMBLY__ | 22 | #ifndef __ASSEMBLY__ |
23 | #define GPIO_OUT 0x0 | 23 | |
24 | #define GPIO_IN 0x80 | 24 | #define GPIO_IN 0 |
25 | #define GPIO_OUT 1 | ||
25 | 26 | ||
26 | #define IXP2000_GPIO_LOW 0 | 27 | #define IXP2000_GPIO_LOW 0 |
27 | #define IXP2000_GPIO_HIGH 1 | 28 | #define IXP2000_GPIO_HIGH 1 |
28 | 29 | ||
29 | #define GPIO_NO_EDGES 0 | 30 | extern void gpio_line_config(int line, int direction); |
30 | #define GPIO_FALLING_EDGE 1 | ||
31 | #define GPIO_RISING_EDGE 2 | ||
32 | #define GPIO_BOTH_EDGES 3 | ||
33 | #define GPIO_LEVEL_LOW 4 | ||
34 | #define GPIO_LEVEL_HIGH 8 | ||
35 | |||
36 | extern void set_GPIO_IRQ_edge(int gpio_nr, int edge); | ||
37 | extern void set_GPIO_IRQ_level(int gpio_nr, int level); | ||
38 | extern void gpio_line_config(int line, int style); | ||
39 | 31 | ||
40 | static inline int gpio_line_get(int line) | 32 | static inline int gpio_line_get(int line) |
41 | { | 33 | { |
@@ -45,11 +37,12 @@ static inline int gpio_line_get(int line) | |||
45 | static inline void gpio_line_set(int line, int value) | 37 | static inline void gpio_line_set(int line, int value) |
46 | { | 38 | { |
47 | if (value == IXP2000_GPIO_HIGH) { | 39 | if (value == IXP2000_GPIO_HIGH) { |
48 | ixp_reg_write(IXP2000_GPIO_POSR, BIT(line)); | 40 | ixp2000_reg_write(IXP2000_GPIO_POSR, 1 << line); |
49 | } else if (value == IXP2000_GPIO_LOW) | 41 | } else if (value == IXP2000_GPIO_LOW) { |
50 | ixp_reg_write(IXP2000_GPIO_POCR, BIT(line)); | 42 | ixp2000_reg_write(IXP2000_GPIO_POCR, 1 << line); |
43 | } | ||
51 | } | 44 | } |
52 | 45 | ||
53 | #endif /* !__ASSEMBLY__ */ | 46 | #endif /* !__ASSEMBLY__ */ |
54 | #endif /* ASM_ARCH_IXP2000_GPIO_H_ */ | ||
55 | 47 | ||
48 | #endif /* ASM_ARCH_IXP2000_GPIO_H_ */ | ||
diff --git a/include/asm-arm/arch-ixp2000/io.h b/include/asm-arm/arch-ixp2000/io.h index 083462668e18..5e56b47446e0 100644 --- a/include/asm-arm/arch-ixp2000/io.h +++ b/include/asm-arm/arch-ixp2000/io.h | |||
@@ -27,8 +27,8 @@ | |||
27 | * since that isn't available on the A? revisions we just keep doing | 27 | * since that isn't available on the A? revisions we just keep doing |
28 | * things manually. | 28 | * things manually. |
29 | */ | 29 | */ |
30 | #define alignb(addr) (void __iomem *)((unsigned long)addr ^ 3) | 30 | #define alignb(addr) (void __iomem *)((unsigned long)(addr) ^ 3) |
31 | #define alignw(addr) (void __iomem *)((unsigned long)addr ^ 2) | 31 | #define alignw(addr) (void __iomem *)((unsigned long)(addr) ^ 2) |
32 | 32 | ||
33 | #define outb(v,p) __raw_writeb((v),alignb(___io(p))) | 33 | #define outb(v,p) __raw_writeb((v),alignb(___io(p))) |
34 | #define outw(v,p) __raw_writew((v),alignw(___io(p))) | 34 | #define outw(v,p) __raw_writew((v),alignw(___io(p))) |
@@ -48,6 +48,78 @@ | |||
48 | #define insw(p,d,l) __raw_readsw(alignw(___io(p)),d,l) | 48 | #define insw(p,d,l) __raw_readsw(alignw(___io(p)),d,l) |
49 | #define insl(p,d,l) __raw_readsl(___io(p),d,l) | 49 | #define insl(p,d,l) __raw_readsl(___io(p),d,l) |
50 | 50 | ||
51 | #define __is_io_address(p) ((((unsigned long)(p)) & ~(IXP2000_PCI_IO_SIZE - 1)) == IXP2000_PCI_IO_VIRT_BASE) | ||
52 | |||
53 | #define ioread8(p) \ | ||
54 | ({ \ | ||
55 | unsigned int __v; \ | ||
56 | \ | ||
57 | if (__is_io_address(p)) { \ | ||
58 | __v = __raw_readb(alignb(p)); \ | ||
59 | } else { \ | ||
60 | __v = __raw_readb(p); \ | ||
61 | } \ | ||
62 | \ | ||
63 | __v; \ | ||
64 | }) \ | ||
65 | |||
66 | #define ioread16(p) \ | ||
67 | ({ \ | ||
68 | unsigned int __v; \ | ||
69 | \ | ||
70 | if (__is_io_address(p)) { \ | ||
71 | __v = __raw_readw(alignw(p)); \ | ||
72 | } else { \ | ||
73 | __v = le16_to_cpu(__raw_readw(p)); \ | ||
74 | } \ | ||
75 | \ | ||
76 | __v; \ | ||
77 | }) | ||
78 | |||
79 | #define ioread32(p) \ | ||
80 | ({ \ | ||
81 | unsigned int __v; \ | ||
82 | \ | ||
83 | if (__is_io_address(p)) { \ | ||
84 | __v = __raw_readl(p); \ | ||
85 | } else { \ | ||
86 | __v = le32_to_cpu(__raw_readl(p)); \ | ||
87 | } \ | ||
88 | \ | ||
89 | __v; \ | ||
90 | }) | ||
91 | |||
92 | #define iowrite8(v,p) \ | ||
93 | ({ \ | ||
94 | if (__is_io_address(p)) { \ | ||
95 | __raw_writeb((v), alignb(p)); \ | ||
96 | } else { \ | ||
97 | __raw_writeb((v), p); \ | ||
98 | } \ | ||
99 | }) | ||
100 | |||
101 | #define iowrite16(v,p) \ | ||
102 | ({ \ | ||
103 | if (__is_io_address(p)) { \ | ||
104 | __raw_writew((v), alignw(p)); \ | ||
105 | } else { \ | ||
106 | __raw_writew(cpu_to_le16(v), p); \ | ||
107 | } \ | ||
108 | }) | ||
109 | |||
110 | #define iowrite32(v,p) \ | ||
111 | ({ \ | ||
112 | if (__is_io_address(p)) { \ | ||
113 | __raw_writel((v), p); \ | ||
114 | } else { \ | ||
115 | __raw_writel(cpu_to_le32(v), p); \ | ||
116 | } \ | ||
117 | }) | ||
118 | |||
119 | #define ioport_map(port, nr) ___io(port) | ||
120 | |||
121 | #define ioport_unmap(addr) | ||
122 | |||
51 | 123 | ||
52 | #ifdef CONFIG_ARCH_IXDP2X01 | 124 | #ifdef CONFIG_ARCH_IXDP2X01 |
53 | /* | 125 | /* |
diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h index 901bba6d02b4..52ded516ea5c 100644 --- a/include/asm-arm/arch-ixp2000/platform.h +++ b/include/asm-arm/arch-ixp2000/platform.h | |||
@@ -138,30 +138,10 @@ struct ixp2000_flash_data { | |||
138 | unsigned long (*bank_setup)(unsigned long); | 138 | unsigned long (*bank_setup)(unsigned long); |
139 | }; | 139 | }; |
140 | 140 | ||
141 | /* | ||
142 | * GPIO helper functions | ||
143 | */ | ||
144 | #define GPIO_IN 0 | ||
145 | #define GPIO_OUT 1 | ||
146 | |||
147 | extern void gpio_line_config(int line, int style); | ||
148 | |||
149 | static inline int gpio_line_get(int line) | ||
150 | { | ||
151 | return (((*IXP2000_GPIO_PLR) >> line) & 1); | ||
152 | } | ||
153 | |||
154 | static inline void gpio_line_set(int line, int value) | ||
155 | { | ||
156 | if (value) | ||
157 | ixp2000_reg_write(IXP2000_GPIO_POSR, (1 << line)); | ||
158 | else | ||
159 | ixp2000_reg_write(IXP2000_GPIO_POCR, (1 << line)); | ||
160 | } | ||
161 | |||
162 | struct ixp2000_i2c_pins { | 141 | struct ixp2000_i2c_pins { |
163 | unsigned long sda_pin; | 142 | unsigned long sda_pin; |
164 | unsigned long scl_pin; | 143 | unsigned long scl_pin; |
165 | }; | 144 | }; |
166 | 145 | ||
146 | |||
167 | #endif /* !__ASSEMBLY__ */ | 147 | #endif /* !__ASSEMBLY__ */ |
diff --git a/include/asm-arm/arch-ixp4xx/debug-macro.S b/include/asm-arm/arch-ixp4xx/debug-macro.S index 4499ae8e4b44..45a6c6cc29d5 100644 --- a/include/asm-arm/arch-ixp4xx/debug-macro.S +++ b/include/asm-arm/arch-ixp4xx/debug-macro.S | |||
@@ -14,6 +14,7 @@ | |||
14 | mrc p15, 0, \rx, c1, c0 | 14 | mrc p15, 0, \rx, c1, c0 |
15 | tst \rx, #1 @ MMU enabled? | 15 | tst \rx, #1 @ MMU enabled? |
16 | moveq \rx, #0xc8000000 | 16 | moveq \rx, #0xc8000000 |
17 | orrne \rx, \rx, #0x00b00000 | ||
17 | movne \rx, #0xff000000 | 18 | movne \rx, #0xff000000 |
18 | add \rx,\rx,#3 @ Uart regs are at off set of 3 if | 19 | add \rx,\rx,#3 @ Uart regs are at off set of 3 if |
19 | @ byte writes used - Big Endian. | 20 | @ byte writes used - Big Endian. |
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h index 8eeb1db6309d..004696a95bdb 100644 --- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h +++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h | |||
@@ -69,6 +69,16 @@ | |||
69 | #define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBF2000) | 69 | #define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBF2000) |
70 | #define IXP4XX_PERIPHERAL_REGION_SIZE (0x0000C000) | 70 | #define IXP4XX_PERIPHERAL_REGION_SIZE (0x0000C000) |
71 | 71 | ||
72 | /* | ||
73 | * Debug UART | ||
74 | * | ||
75 | * This is basically a remap of UART1 into a region that is section | ||
76 | * aligned so that it * can be used with the low-level debug code. | ||
77 | */ | ||
78 | #define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000) | ||
79 | #define IXP4XX_DEBUG_UART_BASE_VIRT (0xffb00000) | ||
80 | #define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000) | ||
81 | |||
72 | #define IXP4XX_EXP_CS0_OFFSET 0x00 | 82 | #define IXP4XX_EXP_CS0_OFFSET 0x00 |
73 | #define IXP4XX_EXP_CS1_OFFSET 0x04 | 83 | #define IXP4XX_EXP_CS1_OFFSET 0x04 |
74 | #define IXP4XX_EXP_CS2_OFFSET 0x08 | 84 | #define IXP4XX_EXP_CS2_OFFSET 0x08 |
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 08a46302d265..cc4b5f5dbfcf 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h | |||
@@ -275,6 +275,7 @@ extern void __iounmap(void __iomem *addr); | |||
275 | /* | 275 | /* |
276 | * io{read,write}{8,16,32} macros | 276 | * io{read,write}{8,16,32} macros |
277 | */ | 277 | */ |
278 | #ifndef ioread8 | ||
278 | #define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) | 279 | #define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) |
279 | #define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) | 280 | #define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) |
280 | #define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) | 281 | #define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) |
@@ -293,6 +294,7 @@ extern void __iounmap(void __iomem *addr); | |||
293 | 294 | ||
294 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | 295 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); |
295 | extern void ioport_unmap(void __iomem *addr); | 296 | extern void ioport_unmap(void __iomem *addr); |
297 | #endif | ||
296 | 298 | ||
297 | struct pci_dev; | 299 | struct pci_dev; |
298 | 300 | ||
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h index 66c585c50cf9..8252a4cd860f 100644 --- a/include/asm-arm/thread_info.h +++ b/include/asm-arm/thread_info.h | |||
@@ -49,7 +49,7 @@ struct cpu_context_save { | |||
49 | */ | 49 | */ |
50 | struct thread_info { | 50 | struct thread_info { |
51 | unsigned long flags; /* low level flags */ | 51 | unsigned long flags; /* low level flags */ |
52 | __s32 preempt_count; /* 0 => preemptable, <0 => bug */ | 52 | int preempt_count; /* 0 => preemptable, <0 => bug */ |
53 | mm_segment_t addr_limit; /* address limit */ | 53 | mm_segment_t addr_limit; /* address limit */ |
54 | struct task_struct *task; /* main task structure */ | 54 | struct task_struct *task; /* main task structure */ |
55 | struct exec_domain *exec_domain; /* execution domain */ | 55 | struct exec_domain *exec_domain; /* execution domain */ |
diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h index 50f41b50268a..aff3e5699c64 100644 --- a/include/asm-arm26/thread_info.h +++ b/include/asm-arm26/thread_info.h | |||
@@ -44,7 +44,7 @@ struct cpu_context_save { | |||
44 | */ | 44 | */ |
45 | struct thread_info { | 45 | struct thread_info { |
46 | unsigned long flags; /* low level flags */ | 46 | unsigned long flags; /* low level flags */ |
47 | __s32 preempt_count; /* 0 => preemptable, <0 => bug */ | 47 | int preempt_count; /* 0 => preemptable, <0 => bug */ |
48 | mm_segment_t addr_limit; /* address limit */ | 48 | mm_segment_t addr_limit; /* address limit */ |
49 | struct task_struct *task; /* main task structure */ | 49 | struct task_struct *task; /* main task structure */ |
50 | struct exec_domain *exec_domain; /* execution domain */ | 50 | struct exec_domain *exec_domain; /* execution domain */ |
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h index 53193feb0826..5ba4b7865cc5 100644 --- a/include/asm-cris/thread_info.h +++ b/include/asm-cris/thread_info.h | |||
@@ -31,7 +31,7 @@ struct thread_info { | |||
31 | struct exec_domain *exec_domain; /* execution domain */ | 31 | struct exec_domain *exec_domain; /* execution domain */ |
32 | unsigned long flags; /* low level flags */ | 32 | unsigned long flags; /* low level flags */ |
33 | __u32 cpu; /* current CPU */ | 33 | __u32 cpu; /* current CPU */ |
34 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 34 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
35 | 35 | ||
36 | mm_segment_t addr_limit; /* thread address space: | 36 | mm_segment_t addr_limit; /* thread address space: |
37 | 0-0xBFFFFFFF for user-thead | 37 | 0-0xBFFFFFFF for user-thead |
diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h index b80a97f50af6..c8cba7836f0d 100644 --- a/include/asm-frv/thread_info.h +++ b/include/asm-frv/thread_info.h | |||
@@ -33,7 +33,7 @@ struct thread_info { | |||
33 | unsigned long flags; /* low level flags */ | 33 | unsigned long flags; /* low level flags */ |
34 | unsigned long status; /* thread-synchronous flags */ | 34 | unsigned long status; /* thread-synchronous flags */ |
35 | __u32 cpu; /* current CPU */ | 35 | __u32 cpu; /* current CPU */ |
36 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 36 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
37 | 37 | ||
38 | mm_segment_t addr_limit; /* thread address space: | 38 | mm_segment_t addr_limit; /* thread address space: |
39 | 0-0xBFFFFFFF for user-thead | 39 | 0-0xBFFFFFFF for user-thead |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 3b709b84934f..9044aeb37828 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -29,7 +29,7 @@ do { \ | |||
29 | #define DEFINE_PER_CPU(type, name) \ | 29 | #define DEFINE_PER_CPU(type, name) \ |
30 | __typeof__(type) per_cpu__##name | 30 | __typeof__(type) per_cpu__##name |
31 | 31 | ||
32 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) | 32 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) |
33 | #define __get_cpu_var(var) per_cpu__##var | 33 | #define __get_cpu_var(var) per_cpu__##var |
34 | 34 | ||
35 | #endif /* SMP */ | 35 | #endif /* SMP */ |
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h index ec96e8b0f190..5d9d70cd17fc 100644 --- a/include/asm-generic/topology.h +++ b/include/asm-generic/topology.h | |||
@@ -41,8 +41,15 @@ | |||
41 | #ifndef node_to_first_cpu | 41 | #ifndef node_to_first_cpu |
42 | #define node_to_first_cpu(node) (0) | 42 | #define node_to_first_cpu(node) (0) |
43 | #endif | 43 | #endif |
44 | #ifndef pcibus_to_node | ||
45 | #define pcibus_to_node(node) (-1) | ||
46 | #endif | ||
47 | |||
44 | #ifndef pcibus_to_cpumask | 48 | #ifndef pcibus_to_cpumask |
45 | #define pcibus_to_cpumask(bus) (cpu_online_map) | 49 | #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ |
50 | CPU_MASK_ALL : \ | ||
51 | node_to_cpumask(pcibus_to_node(bus)) \ | ||
52 | ) | ||
46 | #endif | 53 | #endif |
47 | 54 | ||
48 | #endif /* _ASM_GENERIC_TOPOLOGY_H */ | 55 | #endif /* _ASM_GENERIC_TOPOLOGY_H */ |
diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h index b07c9344776f..bfcc755c3bb1 100644 --- a/include/asm-h8300/thread_info.h +++ b/include/asm-h8300/thread_info.h | |||
@@ -23,7 +23,7 @@ struct thread_info { | |||
23 | struct exec_domain *exec_domain; /* execution domain */ | 23 | struct exec_domain *exec_domain; /* execution domain */ |
24 | unsigned long flags; /* low level flags */ | 24 | unsigned long flags; /* low level flags */ |
25 | int cpu; /* cpu we're on */ | 25 | int cpu; /* cpu we're on */ |
26 | int preempt_count; /* 0 => preemptable, <0 => BUG*/ | 26 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
27 | struct restart_block restart_block; | 27 | struct restart_block restart_block; |
28 | }; | 28 | }; |
29 | 29 | ||
diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h index 641342002bcd..f949e44c2a35 100644 --- a/include/asm-i386/checksum.h +++ b/include/asm-i386/checksum.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/in6.h> | 4 | #include <linux/in6.h> |
5 | 5 | ||
6 | #include <asm/uaccess.h> | ||
7 | |||
6 | /* | 8 | /* |
7 | * computes the checksum of a memory block at buff, length len, | 9 | * computes the checksum of a memory block at buff, length len, |
8 | * and adds in "sum" (32-bit) | 10 | * and adds in "sum" (32-bit) |
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h index fc813b2e8274..b3783a32abee 100644 --- a/include/asm-i386/genapic.h +++ b/include/asm-i386/genapic.h | |||
@@ -78,7 +78,6 @@ struct genapic { | |||
78 | .int_delivery_mode = INT_DELIVERY_MODE, \ | 78 | .int_delivery_mode = INT_DELIVERY_MODE, \ |
79 | .int_dest_mode = INT_DEST_MODE, \ | 79 | .int_dest_mode = INT_DEST_MODE, \ |
80 | .no_balance_irq = NO_BALANCE_IRQ, \ | 80 | .no_balance_irq = NO_BALANCE_IRQ, \ |
81 | .no_ioapic_check = NO_IOAPIC_CHECK, \ | ||
82 | .ESR_DISABLE = esr_disable, \ | 81 | .ESR_DISABLE = esr_disable, \ |
83 | .apic_destination_logical = APIC_DEST_LOGICAL, \ | 82 | .apic_destination_logical = APIC_DEST_LOGICAL, \ |
84 | APICFUNC(apic_id_registered), \ | 83 | APICFUNC(apic_id_registered), \ |
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h index 4092f68d123a..8b6d3a90cd78 100644 --- a/include/asm-i386/kprobes.h +++ b/include/asm-i386/kprobes.h | |||
@@ -39,6 +39,9 @@ typedef u8 kprobe_opcode_t; | |||
39 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) | 39 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) |
40 | 40 | ||
41 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 41 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
42 | #define ARCH_SUPPORTS_KRETPROBES | ||
43 | |||
44 | void kretprobe_trampoline(void); | ||
42 | 45 | ||
43 | /* Architecture specific copy of original instruction*/ | 46 | /* Architecture specific copy of original instruction*/ |
44 | struct arch_specific_insn { | 47 | struct arch_specific_insn { |
diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h index 2339868270ef..ba936d4daedb 100644 --- a/include/asm-i386/mach-bigsmp/mach_apic.h +++ b/include/asm-i386/mach-bigsmp/mach_apic.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #define NO_BALANCE_IRQ (1) | 14 | #define NO_BALANCE_IRQ (1) |
15 | #define esr_disable (1) | 15 | #define esr_disable (1) |
16 | 16 | ||
17 | #define NO_IOAPIC_CHECK (0) | ||
18 | |||
19 | static inline int apic_id_registered(void) | 17 | static inline int apic_id_registered(void) |
20 | { | 18 | { |
21 | return (1); | 19 | return (1); |
diff --git a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h index 627f1cd084ba..3ef6292db780 100644 --- a/include/asm-i386/mach-default/mach_apic.h +++ b/include/asm-i386/mach-default/mach_apic.h | |||
@@ -19,8 +19,6 @@ static inline cpumask_t target_cpus(void) | |||
19 | #define NO_BALANCE_IRQ (0) | 19 | #define NO_BALANCE_IRQ (0) |
20 | #define esr_disable (0) | 20 | #define esr_disable (0) |
21 | 21 | ||
22 | #define NO_IOAPIC_CHECK (0) | ||
23 | |||
24 | #define INT_DELIVERY_MODE dest_LowestPrio | 22 | #define INT_DELIVERY_MODE dest_LowestPrio |
25 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | 23 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ |
26 | 24 | ||
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h index ceab2c464b13..b5f3f0d0b2bc 100644 --- a/include/asm-i386/mach-es7000/mach_apic.h +++ b/include/asm-i386/mach-es7000/mach_apic.h | |||
@@ -38,8 +38,6 @@ static inline cpumask_t target_cpus(void) | |||
38 | #define WAKE_SECONDARY_VIA_INIT | 38 | #define WAKE_SECONDARY_VIA_INIT |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #define NO_IOAPIC_CHECK (1) | ||
42 | |||
43 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | 41 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) |
44 | { | 42 | { |
45 | return 0; | 43 | return 0; |
diff --git a/include/asm-i386/mach-generic/mach_apic.h b/include/asm-i386/mach-generic/mach_apic.h index ab36d02ebede..b13767a4e934 100644 --- a/include/asm-i386/mach-generic/mach_apic.h +++ b/include/asm-i386/mach-generic/mach_apic.h | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | #define esr_disable (genapic->ESR_DISABLE) | 6 | #define esr_disable (genapic->ESR_DISABLE) |
7 | #define NO_BALANCE_IRQ (genapic->no_balance_irq) | 7 | #define NO_BALANCE_IRQ (genapic->no_balance_irq) |
8 | #define NO_IOAPIC_CHECK (genapic->no_ioapic_check) | ||
9 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | 8 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) |
10 | #define INT_DEST_MODE (genapic->int_dest_mode) | 9 | #define INT_DEST_MODE (genapic->int_dest_mode) |
11 | #undef APIC_DEST_LOGICAL | 10 | #undef APIC_DEST_LOGICAL |
diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h index e1a04494764a..9d158095da82 100644 --- a/include/asm-i386/mach-numaq/mach_apic.h +++ b/include/asm-i386/mach-numaq/mach_apic.h | |||
@@ -17,8 +17,6 @@ static inline cpumask_t target_cpus(void) | |||
17 | #define NO_BALANCE_IRQ (1) | 17 | #define NO_BALANCE_IRQ (1) |
18 | #define esr_disable (1) | 18 | #define esr_disable (1) |
19 | 19 | ||
20 | #define NO_IOAPIC_CHECK (0) | ||
21 | |||
22 | #define INT_DELIVERY_MODE dest_LowestPrio | 20 | #define INT_DELIVERY_MODE dest_LowestPrio |
23 | #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */ | 21 | #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */ |
24 | 22 | ||
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h index 74e9cbc8c01b..3d6d12937e1f 100644 --- a/include/asm-i386/mach-summit/mach_apic.h +++ b/include/asm-i386/mach-summit/mach_apic.h | |||
@@ -7,8 +7,6 @@ | |||
7 | #define esr_disable (1) | 7 | #define esr_disable (1) |
8 | #define NO_BALANCE_IRQ (0) | 8 | #define NO_BALANCE_IRQ (0) |
9 | 9 | ||
10 | #define NO_IOAPIC_CHECK (1) /* Don't check I/O APIC ID for xAPIC */ | ||
11 | |||
12 | /* In clustered mode, the high nibble of APIC ID is a cluster number. | 10 | /* In clustered mode, the high nibble of APIC ID is a cluster number. |
13 | * The low nibble is a 4-bit bitmap. */ | 11 | * The low nibble is a 4-bit bitmap. */ |
14 | #define XAPIC_DEST_CPUS_SHIFT 4 | 12 | #define XAPIC_DEST_CPUS_SHIFT 4 |
diff --git a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h index 4e6cdfb8b091..de438c7147a8 100644 --- a/include/asm-i386/mach-visws/mach_apic.h +++ b/include/asm-i386/mach-visws/mach_apic.h | |||
@@ -9,8 +9,6 @@ | |||
9 | #define no_balance_irq (0) | 9 | #define no_balance_irq (0) |
10 | #define esr_disable (0) | 10 | #define esr_disable (0) |
11 | 11 | ||
12 | #define NO_IOAPIC_CHECK (0) | ||
13 | |||
14 | #define INT_DELIVERY_MODE dest_LowestPrio | 12 | #define INT_DELIVERY_MODE dest_LowestPrio |
15 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | 13 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ |
16 | 14 | ||
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 13830ae67cac..33ce5d37e894 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h | |||
@@ -8,7 +8,9 @@ | |||
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | 10 | ||
11 | #ifdef CONFIG_DISCONTIGMEM | 11 | #if CONFIG_NUMA |
12 | extern struct pglist_data *node_data[]; | ||
13 | #define NODE_DATA(nid) (node_data[nid]) | ||
12 | 14 | ||
13 | #ifdef CONFIG_NUMA | 15 | #ifdef CONFIG_NUMA |
14 | #ifdef CONFIG_X86_NUMAQ | 16 | #ifdef CONFIG_X86_NUMAQ |
@@ -21,8 +23,28 @@ | |||
21 | #define get_zholes_size(n) (0) | 23 | #define get_zholes_size(n) (0) |
22 | #endif /* CONFIG_NUMA */ | 24 | #endif /* CONFIG_NUMA */ |
23 | 25 | ||
24 | extern struct pglist_data *node_data[]; | 26 | extern int get_memcfg_numa_flat(void ); |
25 | #define NODE_DATA(nid) (node_data[nid]) | 27 | /* |
28 | * This allows any one NUMA architecture to be compiled | ||
29 | * for, and still fall back to the flat function if it | ||
30 | * fails. | ||
31 | */ | ||
32 | static inline void get_memcfg_numa(void) | ||
33 | { | ||
34 | #ifdef CONFIG_X86_NUMAQ | ||
35 | if (get_memcfg_numaq()) | ||
36 | return; | ||
37 | #elif CONFIG_ACPI_SRAT | ||
38 | if (get_memcfg_from_srat()) | ||
39 | return; | ||
40 | #endif | ||
41 | |||
42 | get_memcfg_numa_flat(); | ||
43 | } | ||
44 | |||
45 | #endif /* CONFIG_NUMA */ | ||
46 | |||
47 | #ifdef CONFIG_DISCONTIGMEM | ||
26 | 48 | ||
27 | /* | 49 | /* |
28 | * generic node memory support, the following assumptions apply: | 50 | * generic node memory support, the following assumptions apply: |
@@ -48,26 +70,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
48 | #endif | 70 | #endif |
49 | } | 71 | } |
50 | 72 | ||
51 | /* | ||
52 | * Following are macros that are specific to this numa platform. | ||
53 | */ | ||
54 | #define reserve_bootmem(addr, size) \ | ||
55 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) | ||
56 | #define alloc_bootmem(x) \ | ||
57 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
58 | #define alloc_bootmem_low(x) \ | ||
59 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) | ||
60 | #define alloc_bootmem_pages(x) \ | ||
61 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
62 | #define alloc_bootmem_low_pages(x) \ | ||
63 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
64 | #define alloc_bootmem_node(ignore, x) \ | ||
65 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
66 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
67 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
68 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
69 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
70 | |||
71 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) | 73 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) |
72 | 74 | ||
73 | /* | 75 | /* |
@@ -79,7 +81,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
79 | */ | 81 | */ |
80 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) | 82 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) |
81 | 83 | ||
82 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
83 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 84 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
84 | #define node_end_pfn(nid) \ | 85 | #define node_end_pfn(nid) \ |
85 | ({ \ | 86 | ({ \ |
@@ -100,7 +101,7 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
100 | ({ \ | 101 | ({ \ |
101 | unsigned long __pfn = pfn; \ | 102 | unsigned long __pfn = pfn; \ |
102 | int __node = pfn_to_nid(__pfn); \ | 103 | int __node = pfn_to_nid(__pfn); \ |
103 | &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ | 104 | &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ |
104 | }) | 105 | }) |
105 | 106 | ||
106 | #define page_to_pfn(pg) \ | 107 | #define page_to_pfn(pg) \ |
@@ -122,26 +123,34 @@ static inline int pfn_valid(int pfn) | |||
122 | return (pfn < node_end_pfn(nid)); | 123 | return (pfn < node_end_pfn(nid)); |
123 | return 0; | 124 | return 0; |
124 | } | 125 | } |
125 | #endif | 126 | #endif /* CONFIG_X86_NUMAQ */ |
127 | |||
128 | #endif /* CONFIG_DISCONTIGMEM */ | ||
129 | |||
130 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
126 | 131 | ||
127 | extern int get_memcfg_numa_flat(void ); | ||
128 | /* | 132 | /* |
129 | * This allows any one NUMA architecture to be compiled | 133 | * Following are macros that are specific to this numa platform. |
130 | * for, and still fall back to the flat function if it | ||
131 | * fails. | ||
132 | */ | 134 | */ |
133 | static inline void get_memcfg_numa(void) | 135 | #define reserve_bootmem(addr, size) \ |
134 | { | 136 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) |
135 | #ifdef CONFIG_X86_NUMAQ | 137 | #define alloc_bootmem(x) \ |
136 | if (get_memcfg_numaq()) | 138 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
137 | return; | 139 | #define alloc_bootmem_low(x) \ |
138 | #elif CONFIG_ACPI_SRAT | 140 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) |
139 | if (get_memcfg_from_srat()) | 141 | #define alloc_bootmem_pages(x) \ |
140 | return; | 142 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
141 | #endif | 143 | #define alloc_bootmem_low_pages(x) \ |
144 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
145 | #define alloc_bootmem_node(ignore, x) \ | ||
146 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
147 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
148 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
149 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
150 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
142 | 151 | ||
143 | get_memcfg_numa_flat(); | 152 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ |
144 | } | 153 | |
154 | extern int early_pfn_to_nid(unsigned long pfn); | ||
145 | 155 | ||
146 | #endif /* CONFIG_DISCONTIGMEM */ | ||
147 | #endif /* _ASM_MMZONE_H_ */ | 156 | #endif /* _ASM_MMZONE_H_ */ |
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 41400d342d44..dea8f8e6d86e 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h | |||
@@ -120,6 +120,8 @@ static __inline__ int get_order(unsigned long size) | |||
120 | 120 | ||
121 | extern int sysctl_legacy_va_layout; | 121 | extern int sysctl_legacy_va_layout; |
122 | 122 | ||
123 | extern int page_is_ram(unsigned long pagenr); | ||
124 | |||
123 | #endif /* __ASSEMBLY__ */ | 125 | #endif /* __ASSEMBLY__ */ |
124 | 126 | ||
125 | #ifdef __ASSEMBLY__ | 127 | #ifdef __ASSEMBLY__ |
@@ -135,11 +137,11 @@ extern int sysctl_legacy_va_layout; | |||
135 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | 137 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) |
136 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 138 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
137 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 139 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
138 | #ifndef CONFIG_DISCONTIGMEM | 140 | #ifdef CONFIG_FLATMEM |
139 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 141 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
140 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 142 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
141 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 143 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
142 | #endif /* !CONFIG_DISCONTIGMEM */ | 144 | #endif /* CONFIG_FLATMEM */ |
143 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 145 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
144 | 146 | ||
145 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 147 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/include/asm-i386/param.h b/include/asm-i386/param.h index b6440526e42a..fa02e67ea86b 100644 --- a/include/asm-i386/param.h +++ b/include/asm-i386/param.h | |||
@@ -1,8 +1,10 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
1 | #ifndef _ASMi386_PARAM_H | 3 | #ifndef _ASMi386_PARAM_H |
2 | #define _ASMi386_PARAM_H | 4 | #define _ASMi386_PARAM_H |
3 | 5 | ||
4 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
5 | # define HZ 1000 /* Internal kernel timer frequency */ | 7 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ |
6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | 8 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ |
7 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | 9 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ |
8 | #endif | 10 | #endif |
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index e9efe148fdf7..77c6497f416e 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h | |||
@@ -398,9 +398,9 @@ extern void noexec_setup(const char *str); | |||
398 | 398 | ||
399 | #endif /* !__ASSEMBLY__ */ | 399 | #endif /* !__ASSEMBLY__ */ |
400 | 400 | ||
401 | #ifndef CONFIG_DISCONTIGMEM | 401 | #ifdef CONFIG_FLATMEM |
402 | #define kern_addr_valid(addr) (1) | 402 | #define kern_addr_valid(addr) (1) |
403 | #endif /* !CONFIG_DISCONTIGMEM */ | 403 | #endif /* CONFIG_FLATMEM */ |
404 | 404 | ||
405 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ | 405 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ |
406 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) | 406 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) |
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 359bb0151742..c76c50e96225 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
@@ -501,12 +501,16 @@ static inline void load_esp0(struct tss_struct *tss, struct thread_struct *threa | |||
501 | } while (0) | 501 | } while (0) |
502 | 502 | ||
503 | /* | 503 | /* |
504 | * This special macro can be used to load a debugging register | 504 | * These special macros can be used to get or set a debugging register |
505 | */ | 505 | */ |
506 | #define loaddebug(thread,register) \ | 506 | #define get_debugreg(var, register) \ |
507 | __asm__("movl %0,%%db" #register \ | 507 | __asm__("movl %%db" #register ", %0" \ |
508 | : /* no output */ \ | 508 | :"=r" (var)) |
509 | :"r" ((thread)->debugreg[register])) | 509 | #define set_debugreg(value, register) \ |
510 | __asm__("movl %0,%%db" #register \ | ||
511 | : /* no output */ \ | ||
512 | :"r" (value)) | ||
513 | |||
510 | 514 | ||
511 | /* Forward declaration, a strange C thing */ | 515 | /* Forward declaration, a strange C thing */ |
512 | struct task_struct; | 516 | struct task_struct; |
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h index 8618914b3521..eef9f93870d4 100644 --- a/include/asm-i386/ptrace.h +++ b/include/asm-i386/ptrace.h | |||
@@ -57,7 +57,8 @@ struct pt_regs { | |||
57 | #ifdef __KERNEL__ | 57 | #ifdef __KERNEL__ |
58 | struct task_struct; | 58 | struct task_struct; |
59 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); | 59 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); |
60 | #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs)) | 60 | #define user_mode(regs) (3 & (regs)->xcs) |
61 | #define user_mode_vm(regs) ((VM_MASK & (regs)->eflags) || user_mode(regs)) | ||
61 | #define instruction_pointer(regs) ((regs)->eip) | 62 | #define instruction_pointer(regs) ((regs)->eip) |
62 | #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) | 63 | #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) |
63 | extern unsigned long profile_pc(struct pt_regs *regs); | 64 | extern unsigned long profile_pc(struct pt_regs *regs); |
diff --git a/include/asm-i386/sparsemem.h b/include/asm-i386/sparsemem.h new file mode 100644 index 000000000000..cfeed990585f --- /dev/null +++ b/include/asm-i386/sparsemem.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _I386_SPARSEMEM_H | ||
2 | #define _I386_SPARSEMEM_H | ||
3 | #ifdef CONFIG_SPARSEMEM | ||
4 | |||
5 | /* | ||
6 | * generic non-linear memory support: | ||
7 | * | ||
8 | * 1) we will not split memory into more chunks than will fit into the | ||
9 | * flags field of the struct page | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * SECTION_SIZE_BITS 2^N: how big each section will be | ||
14 | * MAX_PHYSADDR_BITS 2^N: how much physical address space we have | ||
15 | * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space | ||
16 | */ | ||
17 | #ifdef CONFIG_X86_PAE | ||
18 | #define SECTION_SIZE_BITS 30 | ||
19 | #define MAX_PHYSADDR_BITS 36 | ||
20 | #define MAX_PHYSMEM_BITS 36 | ||
21 | #else | ||
22 | #define SECTION_SIZE_BITS 26 | ||
23 | #define MAX_PHYSADDR_BITS 32 | ||
24 | #define MAX_PHYSMEM_BITS 32 | ||
25 | #endif | ||
26 | |||
27 | /* XXX: FIXME -- wli */ | ||
28 | #define kern_addr_valid(kaddr) (0) | ||
29 | |||
30 | #endif /* CONFIG_SPARSEMEM */ | ||
31 | #endif /* _I386_SPARSEMEM_H */ | ||
diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index 6a78ac58c194..02c8f5d22065 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h | |||
@@ -116,7 +116,8 @@ __asm__ __volatile__( | |||
116 | "orb $1,%%al\n" | 116 | "orb $1,%%al\n" |
117 | "3:" | 117 | "3:" |
118 | :"=a" (__res), "=&S" (d0), "=&D" (d1) | 118 | :"=a" (__res), "=&S" (d0), "=&D" (d1) |
119 | :"1" (cs),"2" (ct)); | 119 | :"1" (cs),"2" (ct) |
120 | :"memory"); | ||
120 | return __res; | 121 | return __res; |
121 | } | 122 | } |
122 | 123 | ||
@@ -138,8 +139,9 @@ __asm__ __volatile__( | |||
138 | "3:\tsbbl %%eax,%%eax\n\t" | 139 | "3:\tsbbl %%eax,%%eax\n\t" |
139 | "orb $1,%%al\n" | 140 | "orb $1,%%al\n" |
140 | "4:" | 141 | "4:" |
141 | :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) | 142 | :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) |
142 | :"1" (cs),"2" (ct),"3" (count)); | 143 | :"1" (cs),"2" (ct),"3" (count) |
144 | :"memory"); | ||
143 | return __res; | 145 | return __res; |
144 | } | 146 | } |
145 | 147 | ||
@@ -158,7 +160,9 @@ __asm__ __volatile__( | |||
158 | "movl $1,%1\n" | 160 | "movl $1,%1\n" |
159 | "2:\tmovl %1,%0\n\t" | 161 | "2:\tmovl %1,%0\n\t" |
160 | "decl %0" | 162 | "decl %0" |
161 | :"=a" (__res), "=&S" (d0) : "1" (s),"0" (c)); | 163 | :"=a" (__res), "=&S" (d0) |
164 | :"1" (s),"0" (c) | ||
165 | :"memory"); | ||
162 | return __res; | 166 | return __res; |
163 | } | 167 | } |
164 | 168 | ||
@@ -175,7 +179,9 @@ __asm__ __volatile__( | |||
175 | "leal -1(%%esi),%0\n" | 179 | "leal -1(%%esi),%0\n" |
176 | "2:\ttestb %%al,%%al\n\t" | 180 | "2:\ttestb %%al,%%al\n\t" |
177 | "jne 1b" | 181 | "jne 1b" |
178 | :"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c)); | 182 | :"=g" (__res), "=&S" (d0), "=&a" (d1) |
183 | :"0" (0),"1" (s),"2" (c) | ||
184 | :"memory"); | ||
179 | return __res; | 185 | return __res; |
180 | } | 186 | } |
181 | 187 | ||
@@ -189,7 +195,9 @@ __asm__ __volatile__( | |||
189 | "scasb\n\t" | 195 | "scasb\n\t" |
190 | "notl %0\n\t" | 196 | "notl %0\n\t" |
191 | "decl %0" | 197 | "decl %0" |
192 | :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffffu)); | 198 | :"=c" (__res), "=&D" (d0) |
199 | :"1" (s),"a" (0), "0" (0xffffffffu) | ||
200 | :"memory"); | ||
193 | return __res; | 201 | return __res; |
194 | } | 202 | } |
195 | 203 | ||
@@ -333,7 +341,9 @@ __asm__ __volatile__( | |||
333 | "je 1f\n\t" | 341 | "je 1f\n\t" |
334 | "movl $1,%0\n" | 342 | "movl $1,%0\n" |
335 | "1:\tdecl %0" | 343 | "1:\tdecl %0" |
336 | :"=D" (__res), "=&c" (d0) : "a" (c),"0" (cs),"1" (count)); | 344 | :"=D" (__res), "=&c" (d0) |
345 | :"a" (c),"0" (cs),"1" (count) | ||
346 | :"memory"); | ||
337 | return __res; | 347 | return __res; |
338 | } | 348 | } |
339 | 349 | ||
@@ -369,7 +379,7 @@ __asm__ __volatile__( | |||
369 | "je 2f\n\t" | 379 | "je 2f\n\t" |
370 | "stosb\n" | 380 | "stosb\n" |
371 | "2:" | 381 | "2:" |
372 | : "=&c" (d0), "=&D" (d1) | 382 | :"=&c" (d0), "=&D" (d1) |
373 | :"a" (c), "q" (count), "0" (count/4), "1" ((long) s) | 383 | :"a" (c), "q" (count), "0" (count/4), "1" ((long) s) |
374 | :"memory"); | 384 | :"memory"); |
375 | return (s); | 385 | return (s); |
@@ -392,7 +402,8 @@ __asm__ __volatile__( | |||
392 | "jne 1b\n" | 402 | "jne 1b\n" |
393 | "3:\tsubl %2,%0" | 403 | "3:\tsubl %2,%0" |
394 | :"=a" (__res), "=&d" (d0) | 404 | :"=a" (__res), "=&d" (d0) |
395 | :"c" (s),"1" (count)); | 405 | :"c" (s),"1" (count) |
406 | :"memory"); | ||
396 | return __res; | 407 | return __res; |
397 | } | 408 | } |
398 | /* end of additional stuff */ | 409 | /* end of additional stuff */ |
@@ -473,7 +484,8 @@ static inline void * memscan(void * addr, int c, size_t size) | |||
473 | "dec %%edi\n" | 484 | "dec %%edi\n" |
474 | "1:" | 485 | "1:" |
475 | : "=D" (addr), "=c" (size) | 486 | : "=D" (addr), "=c" (size) |
476 | : "0" (addr), "1" (size), "a" (c)); | 487 | : "0" (addr), "1" (size), "a" (c) |
488 | : "memory"); | ||
477 | return addr; | 489 | return addr; |
478 | } | 490 | } |
479 | 491 | ||
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h index 2cd57271801d..95add81237ea 100644 --- a/include/asm-i386/thread_info.h +++ b/include/asm-i386/thread_info.h | |||
@@ -31,7 +31,7 @@ struct thread_info { | |||
31 | unsigned long flags; /* low level flags */ | 31 | unsigned long flags; /* low level flags */ |
32 | unsigned long status; /* thread-synchronous flags */ | 32 | unsigned long status; /* thread-synchronous flags */ |
33 | __u32 cpu; /* current CPU */ | 33 | __u32 cpu; /* current CPU */ |
34 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 34 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
35 | 35 | ||
36 | 36 | ||
37 | mm_segment_t addr_limit; /* thread address space: | 37 | mm_segment_t addr_limit; /* thread address space: |
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h index c34709849839..dcf1e07db08a 100644 --- a/include/asm-i386/timer.h +++ b/include/asm-i386/timer.h | |||
@@ -22,6 +22,7 @@ struct timer_opts { | |||
22 | unsigned long (*get_offset)(void); | 22 | unsigned long (*get_offset)(void); |
23 | unsigned long long (*monotonic_clock)(void); | 23 | unsigned long long (*monotonic_clock)(void); |
24 | void (*delay)(unsigned long); | 24 | void (*delay)(unsigned long); |
25 | unsigned long (*read_timer)(void); | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | struct init_timer_opts { | 28 | struct init_timer_opts { |
@@ -52,6 +53,7 @@ extern struct init_timer_opts timer_cyclone_init; | |||
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | extern unsigned long calibrate_tsc(void); | 55 | extern unsigned long calibrate_tsc(void); |
56 | extern unsigned long read_timer_tsc(void); | ||
55 | extern void init_cpu_khz(void); | 57 | extern void init_cpu_khz(void); |
56 | extern int recalibrate_cpu_khz(void); | 58 | extern int recalibrate_cpu_khz(void); |
57 | #ifdef CONFIG_HPET_TIMER | 59 | #ifdef CONFIG_HPET_TIMER |
diff --git a/include/asm-i386/timex.h b/include/asm-i386/timex.h index b41e484c3445..292b5a68f627 100644 --- a/include/asm-i386/timex.h +++ b/include/asm-i386/timex.h | |||
@@ -47,6 +47,9 @@ static inline cycles_t get_cycles (void) | |||
47 | return ret; | 47 | return ret; |
48 | } | 48 | } |
49 | 49 | ||
50 | extern unsigned long cpu_khz; | 50 | extern unsigned int cpu_khz; |
51 | |||
52 | extern int read_current_timer(unsigned long *timer_value); | ||
53 | #define ARCH_HAS_READ_CURRENT_TIMER 1 | ||
51 | 54 | ||
52 | #endif | 55 | #endif |
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index 98f9e6850cba..6d0f67507b21 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h | |||
@@ -60,12 +60,8 @@ static inline int node_to_first_cpu(int node) | |||
60 | return first_cpu(mask); | 60 | return first_cpu(mask); |
61 | } | 61 | } |
62 | 62 | ||
63 | /* Returns the number of the node containing PCI bus number 'busnr' */ | 63 | #define pcibus_to_node(bus) mp_bus_id_to_node[(bus)->number] |
64 | static inline cpumask_t __pcibus_to_cpumask(int busnr) | 64 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) |
65 | { | ||
66 | return node_to_cpumask(mp_bus_id_to_node[busnr]); | ||
67 | } | ||
68 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number) | ||
69 | 65 | ||
70 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ | 66 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ |
71 | #define SD_NODE_INIT (struct sched_domain) { \ | 67 | #define SD_NODE_INIT (struct sched_domain) { \ |
diff --git a/include/asm-ia64/break.h b/include/asm-ia64/break.h index 97c7b2d79600..8167828edc4b 100644 --- a/include/asm-ia64/break.h +++ b/include/asm-ia64/break.h | |||
@@ -12,6 +12,8 @@ | |||
12 | * OS-specific debug break numbers: | 12 | * OS-specific debug break numbers: |
13 | */ | 13 | */ |
14 | #define __IA64_BREAK_KDB 0x80100 | 14 | #define __IA64_BREAK_KDB 0x80100 |
15 | #define __IA64_BREAK_KPROBE 0x80200 | ||
16 | #define __IA64_BREAK_JPROBE 0x80300 | ||
15 | 17 | ||
16 | /* | 18 | /* |
17 | * OS-specific break numbers: | 19 | * OS-specific break numbers: |
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h index cc0ff0a4bdd0..0c05e5bad8a0 100644 --- a/include/asm-ia64/compat.h +++ b/include/asm-ia64/compat.h | |||
@@ -27,6 +27,7 @@ typedef u16 compat_ipc_pid_t; | |||
27 | typedef s32 compat_daddr_t; | 27 | typedef s32 compat_daddr_t; |
28 | typedef u32 compat_caddr_t; | 28 | typedef u32 compat_caddr_t; |
29 | typedef __kernel_fsid_t compat_fsid_t; | 29 | typedef __kernel_fsid_t compat_fsid_t; |
30 | typedef s32 compat_timer_t; | ||
30 | 31 | ||
31 | typedef s32 compat_int_t; | 32 | typedef s32 compat_int_t; |
32 | typedef s32 compat_long_t; | 33 | typedef s32 compat_long_t; |
diff --git a/include/asm-ia64/fcntl.h b/include/asm-ia64/fcntl.h index d193981bb1d8..c9f8d835d0cc 100644 --- a/include/asm-ia64/fcntl.h +++ b/include/asm-ia64/fcntl.h | |||
@@ -81,4 +81,6 @@ struct flock { | |||
81 | 81 | ||
82 | #define F_LINUX_SPECIFIC_BASE 1024 | 82 | #define F_LINUX_SPECIFIC_BASE 1024 |
83 | 83 | ||
84 | #define force_o_largefile() ( ! (current->personality & PER_LINUX32) ) | ||
85 | |||
84 | #endif /* _ASM_IA64_FCNTL_H */ | 86 | #endif /* _ASM_IA64_FCNTL_H */ |
diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h new file mode 100644 index 000000000000..4d376e1663f7 --- /dev/null +++ b/include/asm-ia64/kdebug.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _IA64_KDEBUG_H | ||
2 | #define _IA64_KDEBUG_H 1 | ||
3 | /* | ||
4 | * include/asm-ia64/kdebug.h | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | * | ||
20 | * Copyright (C) Intel Corporation, 2005 | ||
21 | * | ||
22 | * 2005-Apr Rusty Lynch <rusty.lynch@intel.com> and Anil S Keshavamurthy | ||
23 | * <anil.s.keshavamurthy@intel.com> adopted from | ||
24 | * include/asm-x86_64/kdebug.h | ||
25 | */ | ||
26 | #include <linux/notifier.h> | ||
27 | |||
28 | struct pt_regs; | ||
29 | |||
30 | struct die_args { | ||
31 | struct pt_regs *regs; | ||
32 | const char *str; | ||
33 | long err; | ||
34 | int trapnr; | ||
35 | int signr; | ||
36 | }; | ||
37 | |||
38 | int register_die_notifier(struct notifier_block *nb); | ||
39 | extern struct notifier_block *ia64die_chain; | ||
40 | |||
41 | enum die_val { | ||
42 | DIE_BREAK = 1, | ||
43 | DIE_SS, | ||
44 | DIE_PAGE_FAULT, | ||
45 | }; | ||
46 | |||
47 | static inline int notify_die(enum die_val val, char *str, struct pt_regs *regs, | ||
48 | long err, int trap, int sig) | ||
49 | { | ||
50 | struct die_args args = { | ||
51 | .regs = regs, | ||
52 | .str = str, | ||
53 | .err = err, | ||
54 | .trapnr = trap, | ||
55 | .signr = sig | ||
56 | }; | ||
57 | |||
58 | return notifier_call_chain(&ia64die_chain, val, &args); | ||
59 | } | ||
60 | |||
61 | #endif | ||
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h new file mode 100644 index 000000000000..7b700035e36d --- /dev/null +++ b/include/asm-ia64/kprobes.h | |||
@@ -0,0 +1,116 @@ | |||
1 | #ifndef _ASM_KPROBES_H | ||
2 | #define _ASM_KPROBES_H | ||
3 | /* | ||
4 | * Kernel Probes (KProbes) | ||
5 | * include/asm-ia64/kprobes.h | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | * | ||
21 | * Copyright (C) IBM Corporation, 2002, 2004 | ||
22 | * Copyright (C) Intel Corporation, 2005 | ||
23 | * | ||
24 | * 2005-Apr Rusty Lynch <rusty.lynch@intel.com> and Anil S Keshavamurthy | ||
25 | * <anil.s.keshavamurthy@intel.com> adapted from i386 | ||
26 | */ | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/ptrace.h> | ||
29 | #include <asm/break.h> | ||
30 | |||
31 | #define BREAK_INST (long)(__IA64_BREAK_KPROBE << 6) | ||
32 | |||
33 | typedef union cmp_inst { | ||
34 | struct { | ||
35 | unsigned long long qp : 6; | ||
36 | unsigned long long p1 : 6; | ||
37 | unsigned long long c : 1; | ||
38 | unsigned long long r2 : 7; | ||
39 | unsigned long long r3 : 7; | ||
40 | unsigned long long p2 : 6; | ||
41 | unsigned long long ta : 1; | ||
42 | unsigned long long x2 : 2; | ||
43 | unsigned long long tb : 1; | ||
44 | unsigned long long opcode : 4; | ||
45 | unsigned long long reserved : 23; | ||
46 | }f; | ||
47 | unsigned long long l; | ||
48 | } cmp_inst_t; | ||
49 | |||
50 | struct kprobe; | ||
51 | |||
52 | typedef struct _bundle { | ||
53 | struct { | ||
54 | unsigned long long template : 5; | ||
55 | unsigned long long slot0 : 41; | ||
56 | unsigned long long slot1_p0 : 64-46; | ||
57 | } quad0; | ||
58 | struct { | ||
59 | unsigned long long slot1_p1 : 41 - (64-46); | ||
60 | unsigned long long slot2 : 41; | ||
61 | } quad1; | ||
62 | } __attribute__((__aligned__(16))) bundle_t; | ||
63 | |||
64 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | ||
65 | |||
66 | #define SLOT0_OPCODE_SHIFT (37) | ||
67 | #define SLOT1_p1_OPCODE_SHIFT (37 - (64-46)) | ||
68 | #define SLOT2_OPCODE_SHIFT (37) | ||
69 | |||
70 | #define INDIRECT_CALL_OPCODE (1) | ||
71 | #define IP_RELATIVE_CALL_OPCODE (5) | ||
72 | #define IP_RELATIVE_BRANCH_OPCODE (4) | ||
73 | #define IP_RELATIVE_PREDICT_OPCODE (7) | ||
74 | #define LONG_BRANCH_OPCODE (0xC) | ||
75 | #define LONG_CALL_OPCODE (0xD) | ||
76 | |||
77 | typedef struct kprobe_opcode { | ||
78 | bundle_t bundle; | ||
79 | } kprobe_opcode_t; | ||
80 | |||
81 | struct fnptr { | ||
82 | unsigned long ip; | ||
83 | unsigned long gp; | ||
84 | }; | ||
85 | |||
86 | /* Architecture specific copy of original instruction*/ | ||
87 | struct arch_specific_insn { | ||
88 | /* copy of the instruction to be emulated */ | ||
89 | kprobe_opcode_t insn; | ||
90 | #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1 | ||
91 | #define INST_FLAG_FIX_BRANCH_REG 2 | ||
92 | unsigned long inst_flag; | ||
93 | unsigned short target_br_reg; | ||
94 | }; | ||
95 | |||
96 | /* ia64 does not need this */ | ||
97 | static inline void jprobe_return(void) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | /* ia64 does not need this */ | ||
102 | static inline void arch_copy_kprobe(struct kprobe *p) | ||
103 | { | ||
104 | } | ||
105 | |||
106 | #ifdef CONFIG_KPROBES | ||
107 | extern int kprobe_exceptions_notify(struct notifier_block *self, | ||
108 | unsigned long val, void *data); | ||
109 | #else /* !CONFIG_KPROBES */ | ||
110 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
111 | unsigned long val, void *data) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | #endif | ||
116 | #endif /* _ASM_KPROBES_H */ | ||
diff --git a/include/asm-ia64/mmzone.h b/include/asm-ia64/mmzone.h index 83ca4043fc11..d32f51e3d6c2 100644 --- a/include/asm-ia64/mmzone.h +++ b/include/asm-ia64/mmzone.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <asm/page.h> | 15 | #include <asm/page.h> |
16 | #include <asm/meminit.h> | 16 | #include <asm/meminit.h> |
17 | 17 | ||
18 | #ifdef CONFIG_DISCONTIGMEM | ||
19 | |||
18 | static inline int pfn_to_nid(unsigned long pfn) | 20 | static inline int pfn_to_nid(unsigned long pfn) |
19 | { | 21 | { |
20 | #ifdef CONFIG_NUMA | 22 | #ifdef CONFIG_NUMA |
@@ -29,8 +31,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
29 | #endif | 31 | #endif |
30 | } | 32 | } |
31 | 33 | ||
32 | #ifdef CONFIG_DISCONTIGMEM | ||
33 | |||
34 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ | 34 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ |
35 | # define MAX_PHYSNODE_ID 8 | 35 | # define MAX_PHYSNODE_ID 8 |
36 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) | 36 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) |
diff --git a/include/asm-ia64/param.h b/include/asm-ia64/param.h index 6c6b679b7a9e..5e1e0d2d7baf 100644 --- a/include/asm-ia64/param.h +++ b/include/asm-ia64/param.h | |||
@@ -27,7 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | # define HZ 32 | 28 | # define HZ 32 |
29 | # else | 29 | # else |
30 | # define HZ 1024 | 30 | # define HZ CONFIG_HZ |
31 | # endif | 31 | # endif |
32 | # define USER_HZ HZ | 32 | # define USER_HZ HZ |
33 | # define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ | 33 | # define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ |
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h index 1e87f19dad56..2b14dee29ce7 100644 --- a/include/asm-ia64/percpu.h +++ b/include/asm-ia64/percpu.h | |||
@@ -50,7 +50,7 @@ extern void *per_cpu_init(void); | |||
50 | 50 | ||
51 | #else /* ! SMP */ | 51 | #else /* ! SMP */ |
52 | 52 | ||
53 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) | 53 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) |
54 | #define __get_cpu_var(var) per_cpu__##var | 54 | #define __get_cpu_var(var) per_cpu__##var |
55 | #define per_cpu_init() (__phys_per_cpu_start) | 55 | #define per_cpu_init() (__phys_per_cpu_start) |
56 | 56 | ||
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 8d5b7e77028c..7dc8951708a3 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h | |||
@@ -25,7 +25,7 @@ struct thread_info { | |||
25 | __u32 flags; /* thread_info flags (see TIF_*) */ | 25 | __u32 flags; /* thread_info flags (see TIF_*) */ |
26 | __u32 cpu; /* current CPU */ | 26 | __u32 cpu; /* current CPU */ |
27 | mm_segment_t addr_limit; /* user-level address space limit */ | 27 | mm_segment_t addr_limit; /* user-level address space limit */ |
28 | __s32 preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ | 28 | int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ |
29 | struct restart_block restart_block; | 29 | struct restart_block restart_block; |
30 | struct { | 30 | struct { |
31 | int signo; | 31 | int signo; |
diff --git a/include/asm-m32r/mmzone.h b/include/asm-m32r/mmzone.h index ebf0228fec42..d58878ec899e 100644 --- a/include/asm-m32r/mmzone.h +++ b/include/asm-m32r/mmzone.h | |||
@@ -14,7 +14,6 @@ extern struct pglist_data *node_data[]; | |||
14 | #define NODE_DATA(nid) (node_data[nid]) | 14 | #define NODE_DATA(nid) (node_data[nid]) |
15 | 15 | ||
16 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) | 16 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) |
17 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
18 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 17 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
19 | #define node_end_pfn(nid) \ | 18 | #define node_end_pfn(nid) \ |
20 | ({ \ | 19 | ({ \ |
@@ -32,7 +31,7 @@ extern struct pglist_data *node_data[]; | |||
32 | ({ \ | 31 | ({ \ |
33 | unsigned long __pfn = pfn; \ | 32 | unsigned long __pfn = pfn; \ |
34 | int __node = pfn_to_nid(__pfn); \ | 33 | int __node = pfn_to_nid(__pfn); \ |
35 | &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ | 34 | &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ |
36 | }) | 35 | }) |
37 | 36 | ||
38 | #define page_to_pfn(pg) \ | 37 | #define page_to_pfn(pg) \ |
diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h index 9f3a0fcf6e2b..7a6be7727a92 100644 --- a/include/asm-m32r/thread_info.h +++ b/include/asm-m32r/thread_info.h | |||
@@ -28,7 +28,7 @@ struct thread_info { | |||
28 | unsigned long flags; /* low level flags */ | 28 | unsigned long flags; /* low level flags */ |
29 | unsigned long status; /* thread-synchronous flags */ | 29 | unsigned long status; /* thread-synchronous flags */ |
30 | __u32 cpu; /* current CPU */ | 30 | __u32 cpu; /* current CPU */ |
31 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 31 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
32 | 32 | ||
33 | mm_segment_t addr_limit; /* thread address space: | 33 | mm_segment_t addr_limit; /* thread address space: |
34 | 0-0xBFFFFFFF for user-thread | 34 | 0-0xBFFFFFFF for user-thread |
diff --git a/include/asm-m32r/topology.h b/include/asm-m32r/topology.h index 299a89d91bde..d607eb32bd7e 100644 --- a/include/asm-m32r/topology.h +++ b/include/asm-m32r/topology.h | |||
@@ -1,48 +1,6 @@ | |||
1 | /* | ||
2 | * linux/include/asm-generic/topology.h | ||
3 | * | ||
4 | * Written by: Matthew Dobson, IBM Corporation | ||
5 | * | ||
6 | * Copyright (C) 2002, IBM Corp. | ||
7 | * | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, but | ||
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
18 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
19 | * details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | * | ||
25 | * Send feedback to <colpatch@us.ibm.com> | ||
26 | */ | ||
27 | #ifndef _ASM_M32R_TOPOLOGY_H | 1 | #ifndef _ASM_M32R_TOPOLOGY_H |
28 | #define _ASM_M32R_TOPOLOGY_H | 2 | #define _ASM_M32R_TOPOLOGY_H |
29 | 3 | ||
30 | /* Other architectures wishing to use this simple topology API should fill | 4 | #include <asm-generic/topology.h> |
31 | in the below functions as appropriate in their own <asm/topology.h> file. */ | ||
32 | |||
33 | #define cpu_to_node(cpu) (0) | ||
34 | |||
35 | #ifndef parent_node | ||
36 | #define parent_node(node) (0) | ||
37 | #endif | ||
38 | #ifndef node_to_cpumask | ||
39 | #define node_to_cpumask(node) (cpu_online_map) | ||
40 | #endif | ||
41 | #ifndef node_to_first_cpu | ||
42 | #define node_to_first_cpu(node) (0) | ||
43 | #endif | ||
44 | #ifndef pcibus_to_cpumask | ||
45 | #define pcibus_to_cpumask(bus) (cpu_online_map) | ||
46 | #endif | ||
47 | 5 | ||
48 | #endif /* _ASM_M32R_TOPOLOGY_H */ | 6 | #endif /* _ASM_M32R_TOPOLOGY_H */ |
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h index 5f58939c59db..2aed24f6fd2e 100644 --- a/include/asm-m68k/thread_info.h +++ b/include/asm-m68k/thread_info.h | |||
@@ -8,7 +8,7 @@ | |||
8 | struct thread_info { | 8 | struct thread_info { |
9 | struct task_struct *task; /* main task structure */ | 9 | struct task_struct *task; /* main task structure */ |
10 | struct exec_domain *exec_domain; /* execution domain */ | 10 | struct exec_domain *exec_domain; /* execution domain */ |
11 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 11 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
12 | __u32 cpu; /* should always be 0 on m68k */ | 12 | __u32 cpu; /* should always be 0 on m68k */ |
13 | struct restart_block restart_block; | 13 | struct restart_block restart_block; |
14 | 14 | ||
diff --git a/include/asm-m68knommu/thread_info.h b/include/asm-m68knommu/thread_info.h index c8153b7c1f5c..7b9a3fa3af5d 100644 --- a/include/asm-m68knommu/thread_info.h +++ b/include/asm-m68knommu/thread_info.h | |||
@@ -36,7 +36,7 @@ struct thread_info { | |||
36 | struct exec_domain *exec_domain; /* execution domain */ | 36 | struct exec_domain *exec_domain; /* execution domain */ |
37 | unsigned long flags; /* low level flags */ | 37 | unsigned long flags; /* low level flags */ |
38 | int cpu; /* cpu we're on */ | 38 | int cpu; /* cpu we're on */ |
39 | int preempt_count; /* 0 => preemptable, <0 => BUG*/ | 39 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
40 | struct restart_block restart_block; | 40 | struct restart_block restart_block; |
41 | }; | 41 | }; |
42 | 42 | ||
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h index dce92079e7fc..d78002afb1e1 100644 --- a/include/asm-mips/compat.h +++ b/include/asm-mips/compat.h | |||
@@ -29,6 +29,7 @@ typedef s32 compat_caddr_t; | |||
29 | typedef struct { | 29 | typedef struct { |
30 | s32 val[2]; | 30 | s32 val[2]; |
31 | } compat_fsid_t; | 31 | } compat_fsid_t; |
32 | typedef s32 compat_timer_t; | ||
32 | 33 | ||
33 | typedef s32 compat_int_t; | 34 | typedef s32 compat_int_t; |
34 | typedef s32 compat_long_t; | 35 | typedef s32 compat_long_t; |
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h index 768900305e2f..42fcd6f2c206 100644 --- a/include/asm-mips/thread_info.h +++ b/include/asm-mips/thread_info.h | |||
@@ -27,7 +27,7 @@ struct thread_info { | |||
27 | struct exec_domain *exec_domain; /* execution domain */ | 27 | struct exec_domain *exec_domain; /* execution domain */ |
28 | unsigned long flags; /* low level flags */ | 28 | unsigned long flags; /* low level flags */ |
29 | __u32 cpu; /* current CPU */ | 29 | __u32 cpu; /* current CPU */ |
30 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 30 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
31 | 31 | ||
32 | mm_segment_t addr_limit; /* thread address space: | 32 | mm_segment_t addr_limit; /* thread address space: |
33 | 0-0xBFFFFFFF for user-thead | 33 | 0-0xBFFFFFFF for user-thead |
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h index ca0eac647a05..7630d1ad2391 100644 --- a/include/asm-parisc/compat.h +++ b/include/asm-parisc/compat.h | |||
@@ -24,7 +24,7 @@ typedef u16 compat_nlink_t; | |||
24 | typedef u16 compat_ipc_pid_t; | 24 | typedef u16 compat_ipc_pid_t; |
25 | typedef s32 compat_daddr_t; | 25 | typedef s32 compat_daddr_t; |
26 | typedef u32 compat_caddr_t; | 26 | typedef u32 compat_caddr_t; |
27 | typedef u32 compat_timer_t; | 27 | typedef s32 compat_timer_t; |
28 | 28 | ||
29 | typedef s32 compat_int_t; | 29 | typedef s32 compat_int_t; |
30 | typedef s32 compat_long_t; | 30 | typedef s32 compat_long_t; |
diff --git a/include/asm-parisc/mmzone.h b/include/asm-parisc/mmzone.h index 928bf50c4693..595d3dce120a 100644 --- a/include/asm-parisc/mmzone.h +++ b/include/asm-parisc/mmzone.h | |||
@@ -19,7 +19,6 @@ extern struct node_map_data node_data[]; | |||
19 | */ | 19 | */ |
20 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) | 20 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) |
21 | 21 | ||
22 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
23 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 22 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
24 | #define node_end_pfn(nid) \ | 23 | #define node_end_pfn(nid) \ |
25 | ({ \ | 24 | ({ \ |
@@ -38,7 +37,7 @@ extern struct node_map_data node_data[]; | |||
38 | ({ \ | 37 | ({ \ |
39 | unsigned long __pfn = (pfn); \ | 38 | unsigned long __pfn = (pfn); \ |
40 | int __node = pfn_to_nid(__pfn); \ | 39 | int __node = pfn_to_nid(__pfn); \ |
41 | &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ | 40 | &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ |
42 | }) | 41 | }) |
43 | 42 | ||
44 | #define page_to_pfn(pg) \ | 43 | #define page_to_pfn(pg) \ |
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h index fe9b7f8ae4c6..57bbb76cb6c1 100644 --- a/include/asm-parisc/thread_info.h +++ b/include/asm-parisc/thread_info.h | |||
@@ -12,7 +12,7 @@ struct thread_info { | |||
12 | unsigned long flags; /* thread_info flags (see TIF_*) */ | 12 | unsigned long flags; /* thread_info flags (see TIF_*) */ |
13 | mm_segment_t addr_limit; /* user-level address space limit */ | 13 | mm_segment_t addr_limit; /* user-level address space limit */ |
14 | __u32 cpu; /* current CPU */ | 14 | __u32 cpu; /* current CPU */ |
15 | __s32 preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ | 15 | int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ |
16 | struct restart_block restart_block; | 16 | struct restart_block restart_block; |
17 | }; | 17 | }; |
18 | 18 | ||
diff --git a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h index e3b5284a6f91..27903db42efc 100644 --- a/include/asm-ppc/thread_info.h +++ b/include/asm-ppc/thread_info.h | |||
@@ -20,7 +20,8 @@ struct thread_info { | |||
20 | unsigned long flags; /* low level flags */ | 20 | unsigned long flags; /* low level flags */ |
21 | unsigned long local_flags; /* non-racy flags */ | 21 | unsigned long local_flags; /* non-racy flags */ |
22 | int cpu; /* cpu we're on */ | 22 | int cpu; /* cpu we're on */ |
23 | int preempt_count; | 23 | int preempt_count; /* 0 => preemptable, |
24 | <0 => BUG */ | ||
24 | struct restart_block restart_block; | 25 | struct restart_block restart_block; |
25 | }; | 26 | }; |
26 | 27 | ||
diff --git a/include/asm-ppc64/compat.h b/include/asm-ppc64/compat.h index 09c28d28ce6c..12414f5fc666 100644 --- a/include/asm-ppc64/compat.h +++ b/include/asm-ppc64/compat.h | |||
@@ -26,6 +26,7 @@ typedef s32 compat_daddr_t; | |||
26 | typedef u32 compat_caddr_t; | 26 | typedef u32 compat_caddr_t; |
27 | typedef __kernel_fsid_t compat_fsid_t; | 27 | typedef __kernel_fsid_t compat_fsid_t; |
28 | typedef s32 compat_key_t; | 28 | typedef s32 compat_key_t; |
29 | typedef s32 compat_timer_t; | ||
29 | 30 | ||
30 | typedef s32 compat_int_t; | 31 | typedef s32 compat_int_t; |
31 | typedef s32 compat_long_t; | 32 | typedef s32 compat_long_t; |
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 5d3cd9d042e2..553b2ea23bed 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h | |||
@@ -76,6 +76,7 @@ struct machdep_calls { | |||
76 | void (*tce_flush)(struct iommu_table *tbl); | 76 | void (*tce_flush)(struct iommu_table *tbl); |
77 | void (*iommu_dev_setup)(struct pci_dev *dev); | 77 | void (*iommu_dev_setup)(struct pci_dev *dev); |
78 | void (*iommu_bus_setup)(struct pci_bus *bus); | 78 | void (*iommu_bus_setup)(struct pci_bus *bus); |
79 | void (*irq_bus_setup)(struct pci_bus *bus); | ||
79 | 80 | ||
80 | int (*probe)(int platform); | 81 | int (*probe)(int platform); |
81 | void (*setup_arch)(void); | 82 | void (*setup_arch)(void); |
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index c78282a67d8e..9d03a98a4fa3 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h | |||
@@ -47,9 +47,10 @@ | |||
47 | #define SLB_VSID_KS ASM_CONST(0x0000000000000800) | 47 | #define SLB_VSID_KS ASM_CONST(0x0000000000000800) |
48 | #define SLB_VSID_KP ASM_CONST(0x0000000000000400) | 48 | #define SLB_VSID_KP ASM_CONST(0x0000000000000400) |
49 | #define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ | 49 | #define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ |
50 | #define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage 16M */ | 50 | #define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage */ |
51 | #define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ | 51 | #define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ |
52 | 52 | #define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */ | |
53 | |||
53 | #define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) | 54 | #define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) |
54 | #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) | 55 | #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) |
55 | 56 | ||
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h index 0619a41a3c9d..ed473f4b0152 100644 --- a/include/asm-ppc64/mmzone.h +++ b/include/asm-ppc64/mmzone.h | |||
@@ -10,9 +10,20 @@ | |||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <asm/smp.h> | 11 | #include <asm/smp.h> |
12 | 12 | ||
13 | #ifdef CONFIG_DISCONTIGMEM | 13 | /* generic non-linear memory support: |
14 | * | ||
15 | * 1) we will not split memory into more chunks than will fit into the | ||
16 | * flags field of the struct page | ||
17 | */ | ||
18 | |||
19 | |||
20 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
14 | 21 | ||
15 | extern struct pglist_data *node_data[]; | 22 | extern struct pglist_data *node_data[]; |
23 | /* | ||
24 | * Return a pointer to the node data for node n. | ||
25 | */ | ||
26 | #define NODE_DATA(nid) (node_data[nid]) | ||
16 | 27 | ||
17 | /* | 28 | /* |
18 | * Following are specific to this numa platform. | 29 | * Following are specific to this numa platform. |
@@ -47,36 +58,32 @@ static inline int pa_to_nid(unsigned long pa) | |||
47 | return nid; | 58 | return nid; |
48 | } | 59 | } |
49 | 60 | ||
50 | #define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) | ||
51 | |||
52 | /* | ||
53 | * Return a pointer to the node data for node n. | ||
54 | */ | ||
55 | #define NODE_DATA(nid) (node_data[nid]) | ||
56 | |||
57 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) | 61 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) |
58 | 62 | ||
59 | /* | 63 | /* |
60 | * Following are macros that each numa implmentation must define. | 64 | * Following are macros that each numa implmentation must define. |
61 | */ | 65 | */ |
62 | 66 | ||
63 | /* | ||
64 | * Given a kernel address, find the home node of the underlying memory. | ||
65 | */ | ||
66 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | ||
67 | |||
68 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
69 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 67 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
70 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) | 68 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) |
71 | 69 | ||
72 | #define local_mapnr(kvaddr) \ | 70 | #define local_mapnr(kvaddr) \ |
73 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) | 71 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) |
74 | 72 | ||
73 | #ifdef CONFIG_DISCONTIGMEM | ||
74 | |||
75 | /* | ||
76 | * Given a kernel address, find the home node of the underlying memory. | ||
77 | */ | ||
78 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | ||
79 | |||
80 | #define pfn_to_nid(pfn) pa_to_nid((unsigned long)(pfn) << PAGE_SHIFT) | ||
81 | |||
75 | /* Written this way to avoid evaluating arguments twice */ | 82 | /* Written this way to avoid evaluating arguments twice */ |
76 | #define discontigmem_pfn_to_page(pfn) \ | 83 | #define discontigmem_pfn_to_page(pfn) \ |
77 | ({ \ | 84 | ({ \ |
78 | unsigned long __tmp = pfn; \ | 85 | unsigned long __tmp = pfn; \ |
79 | (node_mem_map(pfn_to_nid(__tmp)) + \ | 86 | (NODE_DATA(pfn_to_nid(__tmp))->node_mem_map + \ |
80 | node_localnr(__tmp, pfn_to_nid(__tmp))); \ | 87 | node_localnr(__tmp, pfn_to_nid(__tmp))); \ |
81 | }) | 88 | }) |
82 | 89 | ||
@@ -91,4 +98,11 @@ static inline int pa_to_nid(unsigned long pa) | |||
91 | #define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) | 98 | #define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) |
92 | 99 | ||
93 | #endif /* CONFIG_DISCONTIGMEM */ | 100 | #endif /* CONFIG_DISCONTIGMEM */ |
101 | |||
102 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ | ||
103 | |||
104 | #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
105 | #define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT) | ||
106 | #endif | ||
107 | |||
94 | #endif /* _ASM_MMZONE_H_ */ | 108 | #endif /* _ASM_MMZONE_H_ */ |
diff --git a/include/asm-ppc64/nvram.h b/include/asm-ppc64/nvram.h index 4e6dd370d936..dfaa21566c9a 100644 --- a/include/asm-ppc64/nvram.h +++ b/include/asm-ppc64/nvram.h | |||
@@ -70,6 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | |||
70 | 70 | ||
71 | extern int pSeries_nvram_init(void); | 71 | extern int pSeries_nvram_init(void); |
72 | extern int pmac_nvram_init(void); | 72 | extern int pmac_nvram_init(void); |
73 | extern int bpa_nvram_init(void); | ||
73 | 74 | ||
74 | /* PowerMac specific nvram stuffs */ | 75 | /* PowerMac specific nvram stuffs */ |
75 | 76 | ||
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index 257d87eb7c34..a5893a305a09 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h | |||
@@ -217,7 +217,8 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */ | |||
217 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) | 217 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) |
218 | #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) | 218 | #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) |
219 | #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) | 219 | #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) |
220 | #else | 220 | #endif |
221 | #ifdef CONFIG_FLATMEM | ||
221 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 222 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
222 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 223 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
223 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 224 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
diff --git a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h index 1d0404897550..6b44a8caf395 100644 --- a/include/asm-ppc64/ppc32.h +++ b/include/asm-ppc64/ppc32.h | |||
@@ -32,7 +32,7 @@ typedef struct compat_siginfo { | |||
32 | 32 | ||
33 | /* POSIX.1b timers */ | 33 | /* POSIX.1b timers */ |
34 | struct { | 34 | struct { |
35 | timer_t _tid; /* timer id */ | 35 | compat_timer_t _tid; /* timer id */ |
36 | int _overrun; /* overrun count */ | 36 | int _overrun; /* overrun count */ |
37 | compat_sigval_t _sigval; /* same as below */ | 37 | compat_sigval_t _sigval; /* same as below */ |
38 | int _sys_private; /* not to be passed to user */ | 38 | int _sys_private; /* not to be passed to user */ |
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index 3084099086a8..af28aa55d8c1 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h | |||
@@ -138,8 +138,16 @@ | |||
138 | #define SPRN_NIADORM 0x3F3 /* Hardware Implementation Register 2 */ | 138 | #define SPRN_NIADORM 0x3F3 /* Hardware Implementation Register 2 */ |
139 | #define SPRN_HID4 0x3F4 /* 970 HID4 */ | 139 | #define SPRN_HID4 0x3F4 /* 970 HID4 */ |
140 | #define SPRN_HID5 0x3F6 /* 970 HID5 */ | 140 | #define SPRN_HID5 0x3F6 /* 970 HID5 */ |
141 | #define SPRN_TSC 0x3FD /* Thread switch control */ | 141 | #define SPRN_HID6 0x3F9 /* BE HID 6 */ |
142 | #define SPRN_TST 0x3FC /* Thread switch timeout */ | 142 | #define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */ |
143 | #define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */ | ||
144 | #define SPRN_TSCR 0x399 /* Thread switch control on BE */ | ||
145 | #define SPRN_TTR 0x39A /* Thread switch timeout on BE */ | ||
146 | #define TSCR_DEC_ENABLE 0x200000 /* Decrementer Interrupt */ | ||
147 | #define TSCR_EE_ENABLE 0x100000 /* External Interrupt */ | ||
148 | #define TSCR_EE_BOOST 0x080000 /* External Interrupt Boost */ | ||
149 | #define SPRN_TSC 0x3FD /* Thread switch control on others */ | ||
150 | #define SPRN_TST 0x3FC /* Thread switch timeout on others */ | ||
143 | #define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */ | 151 | #define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */ |
144 | #define SPRN_LR 0x008 /* Link Register */ | 152 | #define SPRN_LR 0x008 /* Link Register */ |
145 | #define SPRN_PIR 0x3FF /* Processor Identification Register */ | 153 | #define SPRN_PIR 0x3FF /* Processor Identification Register */ |
@@ -259,6 +267,7 @@ | |||
259 | #define PV_970FX 0x003C | 267 | #define PV_970FX 0x003C |
260 | #define PV_630 0x0040 | 268 | #define PV_630 0x0040 |
261 | #define PV_630p 0x0041 | 269 | #define PV_630p 0x0041 |
270 | #define PV_BE 0x0070 | ||
262 | 271 | ||
263 | /* Platforms supported by PPC64 */ | 272 | /* Platforms supported by PPC64 */ |
264 | #define PLATFORM_PSERIES 0x0100 | 273 | #define PLATFORM_PSERIES 0x0100 |
@@ -267,6 +276,7 @@ | |||
267 | #define PLATFORM_LPAR 0x0001 | 276 | #define PLATFORM_LPAR 0x0001 |
268 | #define PLATFORM_POWERMAC 0x0400 | 277 | #define PLATFORM_POWERMAC 0x0400 |
269 | #define PLATFORM_MAPLE 0x0500 | 278 | #define PLATFORM_MAPLE 0x0500 |
279 | #define PLATFORM_BPA 0x1000 | ||
270 | 280 | ||
271 | /* Compatibility with drivers coming from PPC32 world */ | 281 | /* Compatibility with drivers coming from PPC32 world */ |
272 | #define _machine (systemcfg->platform) | 282 | #define _machine (systemcfg->platform) |
@@ -278,6 +288,7 @@ | |||
278 | #define IC_INVALID 0 | 288 | #define IC_INVALID 0 |
279 | #define IC_OPEN_PIC 1 | 289 | #define IC_OPEN_PIC 1 |
280 | #define IC_PPC_XIC 2 | 290 | #define IC_PPC_XIC 2 |
291 | #define IC_BPA_IIC 3 | ||
281 | 292 | ||
282 | #define XGLUE(a,b) a##b | 293 | #define XGLUE(a,b) a##b |
283 | #define GLUE(a,b) XGLUE(a,b) | 294 | #define GLUE(a,b) XGLUE(a,b) |
diff --git a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h index a8ab0e9db84a..e7d1b5222802 100644 --- a/include/asm-ppc64/rtas.h +++ b/include/asm-ppc64/rtas.h | |||
@@ -186,8 +186,14 @@ extern int rtas_get_sensor(int sensor, int index, int *state); | |||
186 | extern int rtas_get_power_level(int powerdomain, int *level); | 186 | extern int rtas_get_power_level(int powerdomain, int *level); |
187 | extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); | 187 | extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); |
188 | extern int rtas_set_indicator(int indicator, int index, int new_value); | 188 | extern int rtas_set_indicator(int indicator, int index, int new_value); |
189 | extern void rtas_progress(char *s, unsigned short hex); | ||
189 | extern void rtas_initialize(void); | 190 | extern void rtas_initialize(void); |
190 | 191 | ||
192 | struct rtc_time; | ||
193 | extern void rtas_get_boot_time(struct rtc_time *rtc_time); | ||
194 | extern void rtas_get_rtc_time(struct rtc_time *rtc_time); | ||
195 | extern int rtas_set_rtc_time(struct rtc_time *rtc_time); | ||
196 | |||
191 | /* Given an RTAS status code of 9900..9905 compute the hinted delay */ | 197 | /* Given an RTAS status code of 9900..9905 compute the hinted delay */ |
192 | unsigned int rtas_extended_busy_delay_time(int status); | 198 | unsigned int rtas_extended_busy_delay_time(int status); |
193 | static inline int rtas_is_extended_busy(int status) | 199 | static inline int rtas_is_extended_busy(int status) |
diff --git a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h index 8115ecb8feee..d86f742e9a21 100644 --- a/include/asm-ppc64/smp.h +++ b/include/asm-ppc64/smp.h | |||
@@ -85,6 +85,14 @@ extern void smp_generic_take_timebase(void); | |||
85 | 85 | ||
86 | extern struct smp_ops_t *smp_ops; | 86 | extern struct smp_ops_t *smp_ops; |
87 | 87 | ||
88 | #ifdef CONFIG_PPC_PSERIES | ||
89 | void vpa_init(int cpu); | ||
90 | #else | ||
91 | static inline void vpa_init(int cpu) | ||
92 | { | ||
93 | } | ||
94 | #endif /* CONFIG_PPC_PSERIES */ | ||
95 | |||
88 | #endif /* __ASSEMBLY__ */ | 96 | #endif /* __ASSEMBLY__ */ |
89 | 97 | ||
90 | #endif /* !(_PPC64_SMP_H) */ | 98 | #endif /* !(_PPC64_SMP_H) */ |
diff --git a/include/asm-ppc64/sparsemem.h b/include/asm-ppc64/sparsemem.h new file mode 100644 index 000000000000..c5bd47e57f17 --- /dev/null +++ b/include/asm-ppc64/sparsemem.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _ASM_PPC64_SPARSEMEM_H | ||
2 | #define _ASM_PPC64_SPARSEMEM_H 1 | ||
3 | |||
4 | #ifdef CONFIG_SPARSEMEM | ||
5 | /* | ||
6 | * SECTION_SIZE_BITS 2^N: how big each section will be | ||
7 | * MAX_PHYSADDR_BITS 2^N: how much physical address space we have | ||
8 | * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space | ||
9 | */ | ||
10 | #define SECTION_SIZE_BITS 24 | ||
11 | #define MAX_PHYSADDR_BITS 38 | ||
12 | #define MAX_PHYSMEM_BITS 36 | ||
13 | |||
14 | #endif /* CONFIG_SPARSEMEM */ | ||
15 | |||
16 | #endif /* _ASM_PPC64_SPARSEMEM_H */ | ||
diff --git a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h index 48b7900e90ec..0494df6fca74 100644 --- a/include/asm-ppc64/thread_info.h +++ b/include/asm-ppc64/thread_info.h | |||
@@ -24,7 +24,7 @@ struct thread_info { | |||
24 | struct task_struct *task; /* main task structure */ | 24 | struct task_struct *task; /* main task structure */ |
25 | struct exec_domain *exec_domain; /* execution domain */ | 25 | struct exec_domain *exec_domain; /* execution domain */ |
26 | int cpu; /* cpu we're on */ | 26 | int cpu; /* cpu we're on */ |
27 | int preempt_count; | 27 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
28 | struct restart_block restart_block; | 28 | struct restart_block restart_block; |
29 | /* set by force_successful_syscall_return */ | 29 | /* set by force_successful_syscall_return */ |
30 | unsigned char syscall_noerror; | 30 | unsigned char syscall_noerror; |
diff --git a/include/asm-ppc64/time.h b/include/asm-ppc64/time.h index 8d6e3760ee10..c6c762cad8b0 100644 --- a/include/asm-ppc64/time.h +++ b/include/asm-ppc64/time.h | |||
@@ -34,6 +34,15 @@ struct rtc_time; | |||
34 | extern void to_tm(int tim, struct rtc_time * tm); | 34 | extern void to_tm(int tim, struct rtc_time * tm); |
35 | extern time_t last_rtc_update; | 35 | extern time_t last_rtc_update; |
36 | 36 | ||
37 | void generic_calibrate_decr(void); | ||
38 | void setup_default_decr(void); | ||
39 | |||
40 | /* Some sane defaults: 125 MHz timebase, 1GHz processor */ | ||
41 | extern unsigned long ppc_proc_freq; | ||
42 | #define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) | ||
43 | extern unsigned long ppc_tb_freq; | ||
44 | #define DEFAULT_TB_FREQ 125000000UL | ||
45 | |||
37 | /* | 46 | /* |
38 | * By putting all of this stuff into a single struct we | 47 | * By putting all of this stuff into a single struct we |
39 | * reduce the number of cache lines touched by do_gettimeofday. | 48 | * reduce the number of cache lines touched by do_gettimeofday. |
diff --git a/include/asm-ppc64/topology.h b/include/asm-ppc64/topology.h index d58d9dd79998..fcdcfd26a26b 100644 --- a/include/asm-ppc64/topology.h +++ b/include/asm-ppc64/topology.h | |||
@@ -59,10 +59,8 @@ static inline int node_to_first_cpu(int node) | |||
59 | .nr_balance_failed = 0, \ | 59 | .nr_balance_failed = 0, \ |
60 | } | 60 | } |
61 | 61 | ||
62 | #else /* !CONFIG_NUMA */ | 62 | #endif /* CONFIG_NUMA */ |
63 | 63 | ||
64 | #include <asm-generic/topology.h> | 64 | #include <asm-generic/topology.h> |
65 | 65 | ||
66 | #endif /* CONFIG_NUMA */ | ||
67 | |||
68 | #endif /* _ASM_PPC64_TOPOLOGY_H */ | 66 | #endif /* _ASM_PPC64_TOPOLOGY_H */ |
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h index aade85c53a63..fe101d41e849 100644 --- a/include/asm-s390/thread_info.h +++ b/include/asm-s390/thread_info.h | |||
@@ -50,7 +50,7 @@ struct thread_info { | |||
50 | struct exec_domain *exec_domain; /* execution domain */ | 50 | struct exec_domain *exec_domain; /* execution domain */ |
51 | unsigned long flags; /* low level flags */ | 51 | unsigned long flags; /* low level flags */ |
52 | unsigned int cpu; /* current CPU */ | 52 | unsigned int cpu; /* current CPU */ |
53 | unsigned int preempt_count; /* 0 => preemptable */ | 53 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
54 | struct restart_block restart_block; | 54 | struct restart_block restart_block; |
55 | }; | 55 | }; |
56 | 56 | ||
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h index 4bbbd9f3c37e..46080cefaff8 100644 --- a/include/asm-sh/thread_info.h +++ b/include/asm-sh/thread_info.h | |||
@@ -20,7 +20,7 @@ struct thread_info { | |||
20 | struct exec_domain *exec_domain; /* execution domain */ | 20 | struct exec_domain *exec_domain; /* execution domain */ |
21 | __u32 flags; /* low level flags */ | 21 | __u32 flags; /* low level flags */ |
22 | __u32 cpu; | 22 | __u32 cpu; |
23 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 23 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
24 | struct restart_block restart_block; | 24 | struct restart_block restart_block; |
25 | __u8 supervisor_stack[0]; | 25 | __u8 supervisor_stack[0]; |
26 | }; | 26 | }; |
diff --git a/include/asm-sh64/thread_info.h b/include/asm-sh64/thread_info.h index 8a32d6bd0b79..10f024c6a2e3 100644 --- a/include/asm-sh64/thread_info.h +++ b/include/asm-sh64/thread_info.h | |||
@@ -22,7 +22,7 @@ struct thread_info { | |||
22 | struct exec_domain *exec_domain; /* execution domain */ | 22 | struct exec_domain *exec_domain; /* execution domain */ |
23 | unsigned long flags; /* low level flags */ | 23 | unsigned long flags; /* low level flags */ |
24 | /* Put the 4 32-bit fields together to make asm offsetting easier. */ | 24 | /* Put the 4 32-bit fields together to make asm offsetting easier. */ |
25 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 25 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
26 | __u16 cpu; | 26 | __u16 cpu; |
27 | 27 | ||
28 | mm_segment_t addr_limit; | 28 | mm_segment_t addr_limit; |
diff --git a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h index 104f03c55416..ff6ccb3d24c6 100644 --- a/include/asm-sparc/thread_info.h +++ b/include/asm-sparc/thread_info.h | |||
@@ -30,9 +30,9 @@ struct thread_info { | |||
30 | struct task_struct *task; /* main task structure */ | 30 | struct task_struct *task; /* main task structure */ |
31 | struct exec_domain *exec_domain; /* execution domain */ | 31 | struct exec_domain *exec_domain; /* execution domain */ |
32 | unsigned long flags; /* low level flags */ | 32 | unsigned long flags; /* low level flags */ |
33 | |||
34 | int cpu; /* cpu we're on */ | 33 | int cpu; /* cpu we're on */ |
35 | int preempt_count; | 34 | int preempt_count; /* 0 => preemptable, |
35 | <0 => BUG */ | ||
36 | int softirq_count; | 36 | int softirq_count; |
37 | int hardirq_count; | 37 | int hardirq_count; |
38 | 38 | ||
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h index 22f58055b8ab..b59122dd176d 100644 --- a/include/asm-sparc64/compat.h +++ b/include/asm-sparc64/compat.h | |||
@@ -25,6 +25,7 @@ typedef s32 compat_daddr_t; | |||
25 | typedef u32 compat_caddr_t; | 25 | typedef u32 compat_caddr_t; |
26 | typedef __kernel_fsid_t compat_fsid_t; | 26 | typedef __kernel_fsid_t compat_fsid_t; |
27 | typedef s32 compat_key_t; | 27 | typedef s32 compat_key_t; |
28 | typedef s32 compat_timer_t; | ||
28 | 29 | ||
29 | typedef s32 compat_int_t; | 30 | typedef s32 compat_int_t; |
30 | typedef s32 compat_long_t; | 31 | typedef s32 compat_long_t; |
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h index 517caaba1c87..0cd652956929 100644 --- a/include/asm-sparc64/thread_info.h +++ b/include/asm-sparc64/thread_info.h | |||
@@ -46,7 +46,7 @@ struct thread_info { | |||
46 | unsigned long fault_address; | 46 | unsigned long fault_address; |
47 | struct pt_regs *kregs; | 47 | struct pt_regs *kregs; |
48 | struct exec_domain *exec_domain; | 48 | struct exec_domain *exec_domain; |
49 | int preempt_count; | 49 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
50 | int __pad; | 50 | int __pad; |
51 | 51 | ||
52 | unsigned long *utraps; | 52 | unsigned long *utraps; |
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h index 1feaaf148ef1..97267f059ef5 100644 --- a/include/asm-um/thread_info.h +++ b/include/asm-um/thread_info.h | |||
@@ -17,7 +17,7 @@ struct thread_info { | |||
17 | struct exec_domain *exec_domain; /* execution domain */ | 17 | struct exec_domain *exec_domain; /* execution domain */ |
18 | unsigned long flags; /* low level flags */ | 18 | unsigned long flags; /* low level flags */ |
19 | __u32 cpu; /* current CPU */ | 19 | __u32 cpu; /* current CPU */ |
20 | __s32 preempt_count; /* 0 => preemptable, | 20 | int preempt_count; /* 0 => preemptable, |
21 | <0 => BUG */ | 21 | <0 => BUG */ |
22 | mm_segment_t addr_limit; /* thread address space: | 22 | mm_segment_t addr_limit; /* thread address space: |
23 | 0-0xBFFFFFFF for user | 23 | 0-0xBFFFFFFF for user |
diff --git a/include/asm-v850/thread_info.h b/include/asm-v850/thread_info.h index e2ef44593752..e4cfad94a553 100644 --- a/include/asm-v850/thread_info.h +++ b/include/asm-v850/thread_info.h | |||
@@ -30,7 +30,8 @@ struct thread_info { | |||
30 | struct exec_domain *exec_domain; /* execution domain */ | 30 | struct exec_domain *exec_domain; /* execution domain */ |
31 | unsigned long flags; /* low level flags */ | 31 | unsigned long flags; /* low level flags */ |
32 | int cpu; /* cpu we're on */ | 32 | int cpu; /* cpu we're on */ |
33 | int preempt_count; | 33 | int preempt_count; /* 0 => preemptable, |
34 | <0 => BUG */ | ||
34 | struct restart_block restart_block; | 35 | struct restart_block restart_block; |
35 | }; | 36 | }; |
36 | 37 | ||
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index 5dd7727c756b..a31bb99be53f 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -411,8 +411,6 @@ static __inline__ int ffs(int x) | |||
411 | /* find last set bit */ | 411 | /* find last set bit */ |
412 | #define fls(x) generic_fls(x) | 412 | #define fls(x) generic_fls(x) |
413 | 413 | ||
414 | #define ARCH_HAS_ATOMIC_UNSIGNED 1 | ||
415 | |||
416 | #endif /* __KERNEL__ */ | 414 | #endif /* __KERNEL__ */ |
417 | 415 | ||
418 | #endif /* _X86_64_BITOPS_H */ | 416 | #endif /* _X86_64_BITOPS_H */ |
diff --git a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h index c0a7717923ed..6efa00fe4e7b 100644 --- a/include/asm-x86_64/ia32.h +++ b/include/asm-x86_64/ia32.h | |||
@@ -94,7 +94,7 @@ typedef struct compat_siginfo{ | |||
94 | 94 | ||
95 | /* POSIX.1b timers */ | 95 | /* POSIX.1b timers */ |
96 | struct { | 96 | struct { |
97 | int _tid; /* timer id */ | 97 | compat_timer_t _tid; /* timer id */ |
98 | int _overrun; /* overrun count */ | 98 | int _overrun; /* overrun count */ |
99 | compat_sigval_t _sigval; /* same as below */ | 99 | compat_sigval_t _sigval; /* same as below */ |
100 | int _sys_private; /* not to be passed to user */ | 100 | int _sys_private; /* not to be passed to user */ |
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h index 94202703fae2..37fc3f149a5a 100644 --- a/include/asm-x86_64/io.h +++ b/include/asm-x86_64/io.h | |||
@@ -124,12 +124,7 @@ extern inline void * phys_to_virt(unsigned long address) | |||
124 | /* | 124 | /* |
125 | * Change "struct page" to physical address. | 125 | * Change "struct page" to physical address. |
126 | */ | 126 | */ |
127 | #ifdef CONFIG_DISCONTIGMEM | ||
128 | #include <asm/mmzone.h> | ||
129 | #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) | 127 | #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) |
130 | #else | ||
131 | #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) | ||
132 | #endif | ||
133 | 128 | ||
134 | #include <asm-generic/iomap.h> | 129 | #include <asm-generic/iomap.h> |
135 | 130 | ||
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h index bfea52d516f8..6d6d883fdf6d 100644 --- a/include/asm-x86_64/kprobes.h +++ b/include/asm-x86_64/kprobes.h | |||
@@ -38,6 +38,9 @@ typedef u8 kprobe_opcode_t; | |||
38 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) | 38 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) |
39 | 39 | ||
40 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 40 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
41 | #define ARCH_SUPPORTS_KRETPROBES | ||
42 | |||
43 | void kretprobe_trampoline(void); | ||
41 | 44 | ||
42 | /* Architecture specific copy of original instruction*/ | 45 | /* Architecture specific copy of original instruction*/ |
43 | struct arch_specific_insn { | 46 | struct arch_specific_insn { |
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h index d95b7c240831..768413751b34 100644 --- a/include/asm-x86_64/mmzone.h +++ b/include/asm-x86_64/mmzone.h | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | 8 | ||
9 | #ifdef CONFIG_DISCONTIGMEM | 9 | #ifdef CONFIG_NUMA |
10 | 10 | ||
11 | #define VIRTUAL_BUG_ON(x) | 11 | #define VIRTUAL_BUG_ON(x) |
12 | 12 | ||
@@ -30,27 +30,23 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
30 | return nid; | 30 | return nid; |
31 | } | 31 | } |
32 | 32 | ||
33 | #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) | ||
34 | |||
35 | #define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) | ||
36 | #define NODE_DATA(nid) (node_data[nid]) | 33 | #define NODE_DATA(nid) (node_data[nid]) |
37 | 34 | ||
38 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
39 | |||
40 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
41 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 35 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
42 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ | 36 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ |
43 | NODE_DATA(nid)->node_spanned_pages) | 37 | NODE_DATA(nid)->node_spanned_pages) |
44 | 38 | ||
45 | #define local_mapnr(kvaddr) \ | 39 | #ifdef CONFIG_DISCONTIGMEM |
46 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) ) | 40 | |
41 | #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) | ||
42 | #define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) | ||
47 | 43 | ||
48 | /* AK: this currently doesn't deal with invalid addresses. We'll see | 44 | /* AK: this currently doesn't deal with invalid addresses. We'll see |
49 | if the 2.5 kernel doesn't pass them | 45 | if the 2.5 kernel doesn't pass them |
50 | (2.4 used to). */ | 46 | (2.4 used to). */ |
51 | #define pfn_to_page(pfn) ({ \ | 47 | #define pfn_to_page(pfn) ({ \ |
52 | int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); \ | 48 | int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); \ |
53 | ((pfn) - node_start_pfn(nid)) + node_mem_map(nid); \ | 49 | ((pfn) - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map; \ |
54 | }) | 50 | }) |
55 | 51 | ||
56 | #define page_to_pfn(page) \ | 52 | #define page_to_pfn(page) \ |
@@ -60,4 +56,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
60 | ({ u8 nid__ = pfn_to_nid(pfn); \ | 56 | ({ u8 nid__ = pfn_to_nid(pfn); \ |
61 | nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) | 57 | nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) |
62 | #endif | 58 | #endif |
59 | |||
60 | #define local_mapnr(kvaddr) \ | ||
61 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) ) | ||
62 | #endif | ||
63 | #endif | 63 | #endif |
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index 513e52c71821..bc700232728d 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h | |||
@@ -57,11 +57,6 @@ | |||
57 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ | 57 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ |
58 | } while(0) | 58 | } while(0) |
59 | 59 | ||
60 | #define rdpmc(counter,low,high) \ | ||
61 | __asm__ __volatile__("rdpmc" \ | ||
62 | : "=a" (low), "=d" (high) \ | ||
63 | : "c" (counter)) | ||
64 | |||
65 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) | 60 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) |
66 | 61 | ||
67 | #define rdpmc(counter,low,high) \ | 62 | #define rdpmc(counter,low,high) \ |
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 9ce338c3a71e..60130f4ca986 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h | |||
@@ -119,7 +119,9 @@ extern __inline__ int get_order(unsigned long size) | |||
119 | __pa(v); }) | 119 | __pa(v); }) |
120 | 120 | ||
121 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 121 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
122 | #ifndef CONFIG_DISCONTIGMEM | 122 | #define __boot_va(x) __va(x) |
123 | #define __boot_pa(x) __pa(x) | ||
124 | #ifdef CONFIG_FLATMEM | ||
123 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 125 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
124 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 126 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
125 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 127 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
diff --git a/include/asm-x86_64/param.h b/include/asm-x86_64/param.h index b707f0568c9e..40b11937180d 100644 --- a/include/asm-x86_64/param.h +++ b/include/asm-x86_64/param.h | |||
@@ -1,9 +1,11 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
1 | #ifndef _ASMx86_64_PARAM_H | 3 | #ifndef _ASMx86_64_PARAM_H |
2 | #define _ASMx86_64_PARAM_H | 4 | #define _ASMx86_64_PARAM_H |
3 | 5 | ||
4 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
5 | # define HZ 1000 /* Internal kernel timer frequency */ | 7 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ |
6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks */ | 8 | # define USER_HZ 100 /* .. some user interfaces are in "ticks */ |
7 | #define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | 9 | #define CLOCKS_PER_SEC (USER_HZ) /* like times() */ |
8 | #endif | 10 | #endif |
9 | 11 | ||
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h index 415d73f3c8ef..9c71855736fb 100644 --- a/include/asm-x86_64/percpu.h +++ b/include/asm-x86_64/percpu.h | |||
@@ -39,7 +39,7 @@ extern void setup_per_cpu_areas(void); | |||
39 | #define DEFINE_PER_CPU(type, name) \ | 39 | #define DEFINE_PER_CPU(type, name) \ |
40 | __typeof__(type) per_cpu__##name | 40 | __typeof__(type) per_cpu__##name |
41 | 41 | ||
42 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) | 42 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) |
43 | #define __get_cpu_var(var) per_cpu__##var | 43 | #define __get_cpu_var(var) per_cpu__##var |
44 | 44 | ||
45 | #endif /* SMP */ | 45 | #endif /* SMP */ |
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 8b55f139968f..106f666517bb 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -280,6 +280,14 @@ struct thread_struct { | |||
280 | set_fs(USER_DS); \ | 280 | set_fs(USER_DS); \ |
281 | } while(0) | 281 | } while(0) |
282 | 282 | ||
283 | #define get_debugreg(var, register) \ | ||
284 | __asm__("movq %%db" #register ", %0" \ | ||
285 | :"=r" (var)) | ||
286 | #define set_debugreg(value, register) \ | ||
287 | __asm__("movq %0,%%db" #register \ | ||
288 | : /* no output */ \ | ||
289 | :"r" (value)) | ||
290 | |||
283 | struct task_struct; | 291 | struct task_struct; |
284 | struct mm_struct; | 292 | struct mm_struct; |
285 | 293 | ||
diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h index 5bbc8d3141c8..ca6f15ff61d4 100644 --- a/include/asm-x86_64/ptrace.h +++ b/include/asm-x86_64/ptrace.h | |||
@@ -82,6 +82,7 @@ struct pt_regs { | |||
82 | 82 | ||
83 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 83 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
84 | #define user_mode(regs) (!!((regs)->cs & 3)) | 84 | #define user_mode(regs) (!!((regs)->cs & 3)) |
85 | #define user_mode_vm(regs) user_mode(regs) | ||
85 | #define instruction_pointer(regs) ((regs)->rip) | 86 | #define instruction_pointer(regs) ((regs)->rip) |
86 | extern unsigned long profile_pc(struct pt_regs *regs); | 87 | extern unsigned long profile_pc(struct pt_regs *regs); |
87 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); | 88 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); |
diff --git a/include/asm-x86_64/sparsemem.h b/include/asm-x86_64/sparsemem.h new file mode 100644 index 000000000000..dabb16714a71 --- /dev/null +++ b/include/asm-x86_64/sparsemem.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _ASM_X86_64_SPARSEMEM_H | ||
2 | #define _ASM_X86_64_SPARSEMEM_H 1 | ||
3 | |||
4 | #ifdef CONFIG_SPARSEMEM | ||
5 | |||
6 | /* | ||
7 | * generic non-linear memory support: | ||
8 | * | ||
9 | * 1) we will not split memory into more chunks than will fit into the flags | ||
10 | * field of the struct page | ||
11 | * | ||
12 | * SECTION_SIZE_BITS 2^n: size of each section | ||
13 | * MAX_PHYSADDR_BITS 2^n: max size of physical address space | ||
14 | * MAX_PHYSMEM_BITS 2^n: how much memory we can have in that space | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */ | ||
19 | #define MAX_PHYSADDR_BITS 40 | ||
20 | #define MAX_PHYSMEM_BITS 40 | ||
21 | |||
22 | extern int early_pfn_to_nid(unsigned long pfn); | ||
23 | |||
24 | #endif /* CONFIG_SPARSEMEM */ | ||
25 | |||
26 | #endif /* _ASM_X86_64_SPARSEMEM_H */ | ||
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index f4b3b249639c..08eb6e4f3737 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h | |||
@@ -29,7 +29,7 @@ struct thread_info { | |||
29 | __u32 flags; /* low level flags */ | 29 | __u32 flags; /* low level flags */ |
30 | __u32 status; /* thread synchronous flags */ | 30 | __u32 status; /* thread synchronous flags */ |
31 | __u32 cpu; /* current CPU */ | 31 | __u32 cpu; /* current CPU */ |
32 | int preempt_count; | 32 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
33 | 33 | ||
34 | mm_segment_t addr_limit; | 34 | mm_segment_t addr_limit; |
35 | struct restart_block restart_block; | 35 | struct restart_block restart_block; |
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h index 34f31a18f90b..24ecf6a637cb 100644 --- a/include/asm-x86_64/timex.h +++ b/include/asm-x86_64/timex.h | |||
@@ -26,6 +26,9 @@ static inline cycles_t get_cycles (void) | |||
26 | 26 | ||
27 | extern unsigned int cpu_khz; | 27 | extern unsigned int cpu_khz; |
28 | 28 | ||
29 | extern int read_current_timer(unsigned long *timer_value); | ||
30 | #define ARCH_HAS_READ_CURRENT_TIMER 1 | ||
31 | |||
29 | extern struct vxtime_data vxtime; | 32 | extern struct vxtime_data vxtime; |
30 | 33 | ||
31 | #endif | 34 | #endif |
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h index 67f24e0ea819..8f77e9f6bc23 100644 --- a/include/asm-x86_64/topology.h +++ b/include/asm-x86_64/topology.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | #ifdef CONFIG_DISCONTIGMEM | 6 | #ifdef CONFIG_NUMA |
7 | 7 | ||
8 | #include <asm/mpspec.h> | 8 | #include <asm/mpspec.h> |
9 | #include <asm/bitops.h> | 9 | #include <asm/bitops.h> |
@@ -13,8 +13,8 @@ | |||
13 | extern cpumask_t cpu_online_map; | 13 | extern cpumask_t cpu_online_map; |
14 | 14 | ||
15 | extern unsigned char cpu_to_node[]; | 15 | extern unsigned char cpu_to_node[]; |
16 | extern unsigned char pci_bus_to_node[]; | ||
16 | extern cpumask_t node_to_cpumask[]; | 17 | extern cpumask_t node_to_cpumask[]; |
17 | extern cpumask_t pci_bus_to_cpumask[]; | ||
18 | 18 | ||
19 | #ifdef CONFIG_ACPI_NUMA | 19 | #ifdef CONFIG_ACPI_NUMA |
20 | extern int __node_distance(int, int); | 20 | extern int __node_distance(int, int); |
@@ -26,18 +26,9 @@ extern int __node_distance(int, int); | |||
26 | #define parent_node(node) (node) | 26 | #define parent_node(node) (node) |
27 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) | 27 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) |
28 | #define node_to_cpumask(node) (node_to_cpumask[node]) | 28 | #define node_to_cpumask(node) (node_to_cpumask[node]) |
29 | #define pcibus_to_node(bus) pci_bus_to_node[(bus)->number] | ||
30 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); | ||
29 | 31 | ||
30 | static inline cpumask_t __pcibus_to_cpumask(int bus) | ||
31 | { | ||
32 | cpumask_t busmask = pci_bus_to_cpumask[bus]; | ||
33 | cpumask_t online = cpu_online_map; | ||
34 | cpumask_t res; | ||
35 | cpus_and(res, busmask, online); | ||
36 | return res; | ||
37 | } | ||
38 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number) | ||
39 | |||
40 | #ifdef CONFIG_NUMA | ||
41 | /* sched_domains SD_NODE_INIT for x86_64 machines */ | 32 | /* sched_domains SD_NODE_INIT for x86_64 machines */ |
42 | #define SD_NODE_INIT (struct sched_domain) { \ | 33 | #define SD_NODE_INIT (struct sched_domain) { \ |
43 | .span = CPU_MASK_NONE, \ | 34 | .span = CPU_MASK_NONE, \ |
@@ -59,7 +50,6 @@ static inline cpumask_t __pcibus_to_cpumask(int bus) | |||
59 | .balance_interval = 1, \ | 50 | .balance_interval = 1, \ |
60 | .nr_balance_failed = 0, \ | 51 | .nr_balance_failed = 0, \ |
61 | } | 52 | } |
62 | #endif | ||
63 | 53 | ||
64 | #endif | 54 | #endif |
65 | 55 | ||
diff --git a/include/asm-xtensa/a.out.h b/include/asm-xtensa/a.out.h new file mode 100644 index 000000000000..3be701dfe098 --- /dev/null +++ b/include/asm-xtensa/a.out.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/addrspace.h | ||
3 | * | ||
4 | * Dummy a.out file. Xtensa does not support the a.out format, but the kernel | ||
5 | * seems to depend on it. | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | * | ||
11 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
12 | */ | ||
13 | |||
14 | #ifndef _XTENSA_A_OUT_H | ||
15 | #define _XTENSA_A_OUT_H | ||
16 | |||
17 | /* Note: the kernel needs the a.out definitions, even if only ELF is used. */ | ||
18 | |||
19 | #define STACK_TOP TASK_SIZE | ||
20 | |||
21 | struct exec | ||
22 | { | ||
23 | unsigned long a_info; | ||
24 | unsigned a_text; | ||
25 | unsigned a_data; | ||
26 | unsigned a_bss; | ||
27 | unsigned a_syms; | ||
28 | unsigned a_entry; | ||
29 | unsigned a_trsize; | ||
30 | unsigned a_drsize; | ||
31 | }; | ||
32 | |||
33 | #endif /* _XTENSA_A_OUT_H */ | ||
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h new file mode 100644 index 000000000000..d72bcb32ba4f --- /dev/null +++ b/include/asm-xtensa/atomic.h | |||
@@ -0,0 +1,272 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/atomic.h | ||
3 | * | ||
4 | * Atomic operations that C can't guarantee us. Useful for resource counting.. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_ATOMIC_H | ||
14 | #define _XTENSA_ATOMIC_H | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/stringify.h> | ||
18 | |||
19 | typedef struct { volatile int counter; } atomic_t; | ||
20 | |||
21 | #ifdef __KERNEL__ | ||
22 | #include <asm/processor.h> | ||
23 | #include <asm/system.h> | ||
24 | |||
25 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | ||
26 | |||
27 | /* | ||
28 | * This Xtensa implementation assumes that the right mechanism | ||
29 | * for exclusion is for locking interrupts to level 1. | ||
30 | * | ||
31 | * Locking interrupts looks like this: | ||
32 | * | ||
33 | * rsil a15, 1 | ||
34 | * <code> | ||
35 | * wsr a15, PS | ||
36 | * rsync | ||
37 | * | ||
38 | * Note that a15 is used here because the register allocation | ||
39 | * done by the compiler is not guaranteed and a window overflow | ||
40 | * may not occur between the rsil and wsr instructions. By using | ||
41 | * a15 in the rsil, the machine is guaranteed to be in a state | ||
42 | * where no register reference will cause an overflow. | ||
43 | */ | ||
44 | |||
45 | /** | ||
46 | * atomic_read - read atomic variable | ||
47 | * @v: pointer of type atomic_t | ||
48 | * | ||
49 | * Atomically reads the value of @v. | ||
50 | */ | ||
51 | #define atomic_read(v) ((v)->counter) | ||
52 | |||
53 | /** | ||
54 | * atomic_set - set atomic variable | ||
55 | * @v: pointer of type atomic_t | ||
56 | * @i: required value | ||
57 | * | ||
58 | * Atomically sets the value of @v to @i. | ||
59 | */ | ||
60 | #define atomic_set(v,i) ((v)->counter = (i)) | ||
61 | |||
62 | /** | ||
63 | * atomic_add - add integer to atomic variable | ||
64 | * @i: integer value to add | ||
65 | * @v: pointer of type atomic_t | ||
66 | * | ||
67 | * Atomically adds @i to @v. | ||
68 | */ | ||
69 | extern __inline__ void atomic_add(int i, atomic_t * v) | ||
70 | { | ||
71 | unsigned int vval; | ||
72 | |||
73 | __asm__ __volatile__( | ||
74 | "rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
75 | "l32i %0, %2, 0 \n\t" | ||
76 | "add %0, %0, %1 \n\t" | ||
77 | "s32i %0, %2, 0 \n\t" | ||
78 | "wsr a15, "__stringify(PS)" \n\t" | ||
79 | "rsync \n" | ||
80 | : "=&a" (vval) | ||
81 | : "a" (i), "a" (v) | ||
82 | : "a15", "memory" | ||
83 | ); | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * atomic_sub - subtract the atomic variable | ||
88 | * @i: integer value to subtract | ||
89 | * @v: pointer of type atomic_t | ||
90 | * | ||
91 | * Atomically subtracts @i from @v. | ||
92 | */ | ||
93 | extern __inline__ void atomic_sub(int i, atomic_t *v) | ||
94 | { | ||
95 | unsigned int vval; | ||
96 | |||
97 | __asm__ __volatile__( | ||
98 | "rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
99 | "l32i %0, %2, 0 \n\t" | ||
100 | "sub %0, %0, %1 \n\t" | ||
101 | "s32i %0, %2, 0 \n\t" | ||
102 | "wsr a15, "__stringify(PS)" \n\t" | ||
103 | "rsync \n" | ||
104 | : "=&a" (vval) | ||
105 | : "a" (i), "a" (v) | ||
106 | : "a15", "memory" | ||
107 | ); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * We use atomic_{add|sub}_return to define other functions. | ||
112 | */ | ||
113 | |||
114 | extern __inline__ int atomic_add_return(int i, atomic_t * v) | ||
115 | { | ||
116 | unsigned int vval; | ||
117 | |||
118 | __asm__ __volatile__( | ||
119 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
120 | "l32i %0, %2, 0 \n\t" | ||
121 | "add %0, %0, %1 \n\t" | ||
122 | "s32i %0, %2, 0 \n\t" | ||
123 | "wsr a15, "__stringify(PS)" \n\t" | ||
124 | "rsync \n" | ||
125 | : "=&a" (vval) | ||
126 | : "a" (i), "a" (v) | ||
127 | : "a15", "memory" | ||
128 | ); | ||
129 | |||
130 | return vval; | ||
131 | } | ||
132 | |||
133 | extern __inline__ int atomic_sub_return(int i, atomic_t * v) | ||
134 | { | ||
135 | unsigned int vval; | ||
136 | |||
137 | __asm__ __volatile__( | ||
138 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
139 | "l32i %0, %2, 0 \n\t" | ||
140 | "sub %0, %0, %1 \n\t" | ||
141 | "s32i %0, %2, 0 \n\t" | ||
142 | "wsr a15, "__stringify(PS)" \n\t" | ||
143 | "rsync \n" | ||
144 | : "=&a" (vval) | ||
145 | : "a" (i), "a" (v) | ||
146 | : "a15", "memory" | ||
147 | ); | ||
148 | |||
149 | return vval; | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * atomic_sub_and_test - subtract value from variable and test result | ||
154 | * @i: integer value to subtract | ||
155 | * @v: pointer of type atomic_t | ||
156 | * | ||
157 | * Atomically subtracts @i from @v and returns | ||
158 | * true if the result is zero, or false for all | ||
159 | * other cases. | ||
160 | */ | ||
161 | #define atomic_sub_and_test(i,v) (atomic_sub_return((i),(v)) == 0) | ||
162 | |||
163 | /** | ||
164 | * atomic_inc - increment atomic variable | ||
165 | * @v: pointer of type atomic_t | ||
166 | * | ||
167 | * Atomically increments @v by 1. | ||
168 | */ | ||
169 | #define atomic_inc(v) atomic_add(1,(v)) | ||
170 | |||
171 | /** | ||
172 | * atomic_inc - increment atomic variable | ||
173 | * @v: pointer of type atomic_t | ||
174 | * | ||
175 | * Atomically increments @v by 1. | ||
176 | */ | ||
177 | #define atomic_inc_return(v) atomic_add_return(1,(v)) | ||
178 | |||
179 | /** | ||
180 | * atomic_dec - decrement atomic variable | ||
181 | * @v: pointer of type atomic_t | ||
182 | * | ||
183 | * Atomically decrements @v by 1. | ||
184 | */ | ||
185 | #define atomic_dec(v) atomic_sub(1,(v)) | ||
186 | |||
187 | /** | ||
188 | * atomic_dec_return - decrement atomic variable | ||
189 | * @v: pointer of type atomic_t | ||
190 | * | ||
191 | * Atomically decrements @v by 1. | ||
192 | */ | ||
193 | #define atomic_dec_return(v) atomic_sub_return(1,(v)) | ||
194 | |||
195 | /** | ||
196 | * atomic_dec_and_test - decrement and test | ||
197 | * @v: pointer of type atomic_t | ||
198 | * | ||
199 | * Atomically decrements @v by 1 and | ||
200 | * returns true if the result is 0, or false for all other | ||
201 | * cases. | ||
202 | */ | ||
203 | #define atomic_dec_and_test(v) (atomic_sub_return(1,(v)) == 0) | ||
204 | |||
205 | /** | ||
206 | * atomic_inc_and_test - increment and test | ||
207 | * @v: pointer of type atomic_t | ||
208 | * | ||
209 | * Atomically increments @v by 1 | ||
210 | * and returns true if the result is zero, or false for all | ||
211 | * other cases. | ||
212 | */ | ||
213 | #define atomic_inc_and_test(v) (atomic_add_return(1,(v)) == 0) | ||
214 | |||
215 | /** | ||
216 | * atomic_add_negative - add and test if negative | ||
217 | * @v: pointer of type atomic_t | ||
218 | * @i: integer value to add | ||
219 | * | ||
220 | * Atomically adds @i to @v and returns true | ||
221 | * if the result is negative, or false when | ||
222 | * result is greater than or equal to zero. | ||
223 | */ | ||
224 | #define atomic_add_negative(i,v) (atomic_add_return((i),(v)) < 0) | ||
225 | |||
226 | |||
227 | extern __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) | ||
228 | { | ||
229 | unsigned int all_f = -1; | ||
230 | unsigned int vval; | ||
231 | |||
232 | __asm__ __volatile__( | ||
233 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
234 | "l32i %0, %2, 0 \n\t" | ||
235 | "xor %1, %4, %3 \n\t" | ||
236 | "and %0, %0, %4 \n\t" | ||
237 | "s32i %0, %2, 0 \n\t" | ||
238 | "wsr a15, "__stringify(PS)" \n\t" | ||
239 | "rsync \n" | ||
240 | : "=&a" (vval), "=a" (mask) | ||
241 | : "a" (v), "a" (all_f), "1" (mask) | ||
242 | : "a15", "memory" | ||
243 | ); | ||
244 | } | ||
245 | |||
246 | extern __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
247 | { | ||
248 | unsigned int vval; | ||
249 | |||
250 | __asm__ __volatile__( | ||
251 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
252 | "l32i %0, %2, 0 \n\t" | ||
253 | "or %0, %0, %1 \n\t" | ||
254 | "s32i %0, %2, 0 \n\t" | ||
255 | "wsr a15, "__stringify(PS)" \n\t" | ||
256 | "rsync \n" | ||
257 | : "=&a" (vval) | ||
258 | : "a" (mask), "a" (v) | ||
259 | : "a15", "memory" | ||
260 | ); | ||
261 | } | ||
262 | |||
263 | /* Atomic operations are already serializing */ | ||
264 | #define smp_mb__before_atomic_dec() barrier() | ||
265 | #define smp_mb__after_atomic_dec() barrier() | ||
266 | #define smp_mb__before_atomic_inc() barrier() | ||
267 | #define smp_mb__after_atomic_inc() barrier() | ||
268 | |||
269 | #endif /* __KERNEL__ */ | ||
270 | |||
271 | #endif /* _XTENSA_ATOMIC_H */ | ||
272 | |||
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h new file mode 100644 index 000000000000..d395ef226c32 --- /dev/null +++ b/include/asm-xtensa/bitops.h | |||
@@ -0,0 +1,446 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bitops.h | ||
3 | * | ||
4 | * Atomic operations that C can't guarantee us.Useful for resource counting etc. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_BITOPS_H | ||
14 | #define _XTENSA_BITOPS_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <asm/processor.h> | ||
19 | #include <asm/byteorder.h> | ||
20 | #include <asm/system.h> | ||
21 | |||
22 | #ifdef CONFIG_SMP | ||
23 | # error SMP not supported on this architecture | ||
24 | #endif | ||
25 | |||
26 | static __inline__ void set_bit(int nr, volatile void * addr) | ||
27 | { | ||
28 | unsigned long mask = 1 << (nr & 0x1f); | ||
29 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
30 | unsigned long flags; | ||
31 | |||
32 | local_irq_save(flags); | ||
33 | *a |= mask; | ||
34 | local_irq_restore(flags); | ||
35 | } | ||
36 | |||
37 | static __inline__ void __set_bit(int nr, volatile unsigned long * addr) | ||
38 | { | ||
39 | unsigned long mask = 1 << (nr & 0x1f); | ||
40 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
41 | |||
42 | *a |= mask; | ||
43 | } | ||
44 | |||
45 | static __inline__ void clear_bit(int nr, volatile void * addr) | ||
46 | { | ||
47 | unsigned long mask = 1 << (nr & 0x1f); | ||
48 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
49 | unsigned long flags; | ||
50 | |||
51 | local_irq_save(flags); | ||
52 | *a &= ~mask; | ||
53 | local_irq_restore(flags); | ||
54 | } | ||
55 | |||
56 | static __inline__ void __clear_bit(int nr, volatile unsigned long *addr) | ||
57 | { | ||
58 | unsigned long mask = 1 << (nr & 0x1f); | ||
59 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
60 | |||
61 | *a &= ~mask; | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * clear_bit() doesn't provide any barrier for the compiler. | ||
66 | */ | ||
67 | |||
68 | #define smp_mb__before_clear_bit() barrier() | ||
69 | #define smp_mb__after_clear_bit() barrier() | ||
70 | |||
71 | static __inline__ void change_bit(int nr, volatile void * addr) | ||
72 | { | ||
73 | unsigned long mask = 1 << (nr & 0x1f); | ||
74 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
75 | unsigned long flags; | ||
76 | |||
77 | local_irq_save(flags); | ||
78 | *a ^= mask; | ||
79 | local_irq_restore(flags); | ||
80 | } | ||
81 | |||
82 | static __inline__ void __change_bit(int nr, volatile void * addr) | ||
83 | { | ||
84 | unsigned long mask = 1 << (nr & 0x1f); | ||
85 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
86 | |||
87 | *a ^= mask; | ||
88 | } | ||
89 | |||
90 | static __inline__ int test_and_set_bit(int nr, volatile void * addr) | ||
91 | { | ||
92 | unsigned long retval; | ||
93 | unsigned long mask = 1 << (nr & 0x1f); | ||
94 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
95 | unsigned long flags; | ||
96 | |||
97 | local_irq_save(flags); | ||
98 | retval = (mask & *a) != 0; | ||
99 | *a |= mask; | ||
100 | local_irq_restore(flags); | ||
101 | |||
102 | return retval; | ||
103 | } | ||
104 | |||
105 | static __inline__ int __test_and_set_bit(int nr, volatile void * addr) | ||
106 | { | ||
107 | unsigned long retval; | ||
108 | unsigned long mask = 1 << (nr & 0x1f); | ||
109 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
110 | |||
111 | retval = (mask & *a) != 0; | ||
112 | *a |= mask; | ||
113 | |||
114 | return retval; | ||
115 | } | ||
116 | |||
117 | static __inline__ int test_and_clear_bit(int nr, volatile void * addr) | ||
118 | { | ||
119 | unsigned long retval; | ||
120 | unsigned long mask = 1 << (nr & 0x1f); | ||
121 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
122 | unsigned long flags; | ||
123 | |||
124 | local_irq_save(flags); | ||
125 | retval = (mask & *a) != 0; | ||
126 | *a &= ~mask; | ||
127 | local_irq_restore(flags); | ||
128 | |||
129 | return retval; | ||
130 | } | ||
131 | |||
132 | static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) | ||
133 | { | ||
134 | unsigned long mask = 1 << (nr & 0x1f); | ||
135 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
136 | unsigned long old = *a; | ||
137 | |||
138 | *a = old & ~mask; | ||
139 | return (old & mask) != 0; | ||
140 | } | ||
141 | |||
142 | static __inline__ int test_and_change_bit(int nr, volatile void * addr) | ||
143 | { | ||
144 | unsigned long retval; | ||
145 | unsigned long mask = 1 << (nr & 0x1f); | ||
146 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
147 | unsigned long flags; | ||
148 | |||
149 | local_irq_save(flags); | ||
150 | |||
151 | retval = (mask & *a) != 0; | ||
152 | *a ^= mask; | ||
153 | local_irq_restore(flags); | ||
154 | |||
155 | return retval; | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * non-atomic version; can be reordered | ||
160 | */ | ||
161 | |||
162 | static __inline__ int __test_and_change_bit(int nr, volatile void *addr) | ||
163 | { | ||
164 | unsigned long mask = 1 << (nr & 0x1f); | ||
165 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
166 | unsigned long old = *a; | ||
167 | |||
168 | *a = old ^ mask; | ||
169 | return (old & mask) != 0; | ||
170 | } | ||
171 | |||
172 | static __inline__ int test_bit(int nr, const volatile void *addr) | ||
173 | { | ||
174 | return 1UL & (((const volatile unsigned int *)addr)[nr>>5] >> (nr&31)); | ||
175 | } | ||
176 | |||
177 | #if XCHAL_HAVE_NSAU | ||
178 | |||
179 | static __inline__ int __cntlz (unsigned long x) | ||
180 | { | ||
181 | int lz; | ||
182 | asm ("nsau %0, %1" : "=r" (lz) : "r" (x)); | ||
183 | return 31 - lz; | ||
184 | } | ||
185 | |||
186 | #else | ||
187 | |||
188 | static __inline__ int __cntlz (unsigned long x) | ||
189 | { | ||
190 | unsigned long sum, x1, x2, x4, x8, x16; | ||
191 | x1 = x & 0xAAAAAAAA; | ||
192 | x2 = x & 0xCCCCCCCC; | ||
193 | x4 = x & 0xF0F0F0F0; | ||
194 | x8 = x & 0xFF00FF00; | ||
195 | x16 = x & 0xFFFF0000; | ||
196 | sum = x2 ? 2 : 0; | ||
197 | sum += (x16 != 0) * 16; | ||
198 | sum += (x8 != 0) * 8; | ||
199 | sum += (x4 != 0) * 4; | ||
200 | sum += (x1 != 0); | ||
201 | |||
202 | return sum; | ||
203 | } | ||
204 | |||
205 | #endif | ||
206 | |||
207 | /* | ||
208 | * ffz: Find first zero in word. Undefined if no zero exists. | ||
209 | * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). | ||
210 | */ | ||
211 | |||
212 | static __inline__ int ffz(unsigned long x) | ||
213 | { | ||
214 | if ((x = ~x) == 0) | ||
215 | return 32; | ||
216 | return __cntlz(x & -x); | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * __ffs: Find first bit set in word. Return 0 for bit 0 | ||
221 | */ | ||
222 | |||
223 | static __inline__ int __ffs(unsigned long x) | ||
224 | { | ||
225 | return __cntlz(x & -x); | ||
226 | } | ||
227 | |||
228 | /* | ||
229 | * ffs: Find first bit set in word. This is defined the same way as | ||
230 | * the libc and compiler builtin ffs routines, therefore | ||
231 | * differs in spirit from the above ffz (man ffs). | ||
232 | */ | ||
233 | |||
234 | static __inline__ int ffs(unsigned long x) | ||
235 | { | ||
236 | return __cntlz(x & -x) + 1; | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | * fls: Find last (most-significant) bit set in word. | ||
241 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. | ||
242 | */ | ||
243 | |||
244 | static __inline__ int fls (unsigned int x) | ||
245 | { | ||
246 | return __cntlz(x); | ||
247 | } | ||
248 | |||
249 | static __inline__ int | ||
250 | find_next_bit(const unsigned long *addr, int size, int offset) | ||
251 | { | ||
252 | const unsigned long *p = addr + (offset >> 5); | ||
253 | unsigned long result = offset & ~31UL; | ||
254 | unsigned long tmp; | ||
255 | |||
256 | if (offset >= size) | ||
257 | return size; | ||
258 | size -= result; | ||
259 | offset &= 31UL; | ||
260 | if (offset) { | ||
261 | tmp = *p++; | ||
262 | tmp &= ~0UL << offset; | ||
263 | if (size < 32) | ||
264 | goto found_first; | ||
265 | if (tmp) | ||
266 | goto found_middle; | ||
267 | size -= 32; | ||
268 | result += 32; | ||
269 | } | ||
270 | while (size >= 32) { | ||
271 | if ((tmp = *p++) != 0) | ||
272 | goto found_middle; | ||
273 | result += 32; | ||
274 | size -= 32; | ||
275 | } | ||
276 | if (!size) | ||
277 | return result; | ||
278 | tmp = *p; | ||
279 | |||
280 | found_first: | ||
281 | tmp &= ~0UL >> (32 - size); | ||
282 | if (tmp == 0UL) /* Are any bits set? */ | ||
283 | return result + size; /* Nope. */ | ||
284 | found_middle: | ||
285 | return result + __ffs(tmp); | ||
286 | } | ||
287 | |||
288 | /** | ||
289 | * find_first_bit - find the first set bit in a memory region | ||
290 | * @addr: The address to start the search at | ||
291 | * @size: The maximum size to search | ||
292 | * | ||
293 | * Returns the bit-number of the first set bit, not the number of the byte | ||
294 | * containing a bit. | ||
295 | */ | ||
296 | |||
297 | #define find_first_bit(addr, size) \ | ||
298 | find_next_bit((addr), (size), 0) | ||
299 | |||
300 | static __inline__ int | ||
301 | find_next_zero_bit(const unsigned long *addr, int size, int offset) | ||
302 | { | ||
303 | const unsigned long *p = addr + (offset >> 5); | ||
304 | unsigned long result = offset & ~31UL; | ||
305 | unsigned long tmp; | ||
306 | |||
307 | if (offset >= size) | ||
308 | return size; | ||
309 | size -= result; | ||
310 | offset &= 31UL; | ||
311 | if (offset) { | ||
312 | tmp = *p++; | ||
313 | tmp |= ~0UL >> (32-offset); | ||
314 | if (size < 32) | ||
315 | goto found_first; | ||
316 | if (~tmp) | ||
317 | goto found_middle; | ||
318 | size -= 32; | ||
319 | result += 32; | ||
320 | } | ||
321 | while (size & ~31UL) { | ||
322 | if (~(tmp = *p++)) | ||
323 | goto found_middle; | ||
324 | result += 32; | ||
325 | size -= 32; | ||
326 | } | ||
327 | if (!size) | ||
328 | return result; | ||
329 | tmp = *p; | ||
330 | |||
331 | found_first: | ||
332 | tmp |= ~0UL << size; | ||
333 | found_middle: | ||
334 | return result + ffz(tmp); | ||
335 | } | ||
336 | |||
337 | #define find_first_zero_bit(addr, size) \ | ||
338 | find_next_zero_bit((addr), (size), 0) | ||
339 | |||
340 | #ifdef __XTENSA_EL__ | ||
341 | # define ext2_set_bit(nr,addr) __test_and_set_bit((nr), (addr)) | ||
342 | # define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr),(addr)) | ||
343 | # define ext2_clear_bit(nr,addr) __test_and_clear_bit((nr), (addr)) | ||
344 | # define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr),(addr)) | ||
345 | # define ext2_test_bit(nr,addr) test_bit((nr), (addr)) | ||
346 | # define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr),(size)) | ||
347 | # define ext2_find_next_zero_bit(addr, size, offset) \ | ||
348 | find_next_zero_bit((addr), (size), (offset)) | ||
349 | #elif defined(__XTENSA_EB__) | ||
350 | # define ext2_set_bit(nr,addr) __test_and_set_bit((nr) ^ 0x18, (addr)) | ||
351 | # define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr) ^ 0x18, (addr)) | ||
352 | # define ext2_clear_bit(nr,addr) __test_and_clear_bit((nr) ^ 18, (addr)) | ||
353 | # define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr)^0x18,(addr)) | ||
354 | # define ext2_test_bit(nr,addr) test_bit((nr) ^ 0x18, (addr)) | ||
355 | # define ext2_find_first_zero_bit(addr, size) \ | ||
356 | ext2_find_next_zero_bit((addr), (size), 0) | ||
357 | |||
358 | static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) | ||
359 | { | ||
360 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); | ||
361 | unsigned long result = offset & ~31UL; | ||
362 | unsigned long tmp; | ||
363 | |||
364 | if (offset >= size) | ||
365 | return size; | ||
366 | size -= result; | ||
367 | offset &= 31UL; | ||
368 | if(offset) { | ||
369 | /* We hold the little endian value in tmp, but then the | ||
370 | * shift is illegal. So we could keep a big endian value | ||
371 | * in tmp, like this: | ||
372 | * | ||
373 | * tmp = __swab32(*(p++)); | ||
374 | * tmp |= ~0UL >> (32-offset); | ||
375 | * | ||
376 | * but this would decrease preformance, so we change the | ||
377 | * shift: | ||
378 | */ | ||
379 | tmp = *(p++); | ||
380 | tmp |= __swab32(~0UL >> (32-offset)); | ||
381 | if(size < 32) | ||
382 | goto found_first; | ||
383 | if(~tmp) | ||
384 | goto found_middle; | ||
385 | size -= 32; | ||
386 | result += 32; | ||
387 | } | ||
388 | while(size & ~31UL) { | ||
389 | if(~(tmp = *(p++))) | ||
390 | goto found_middle; | ||
391 | result += 32; | ||
392 | size -= 32; | ||
393 | } | ||
394 | if(!size) | ||
395 | return result; | ||
396 | tmp = *p; | ||
397 | |||
398 | found_first: | ||
399 | /* tmp is little endian, so we would have to swab the shift, | ||
400 | * see above. But then we have to swab tmp below for ffz, so | ||
401 | * we might as well do this here. | ||
402 | */ | ||
403 | return result + ffz(__swab32(tmp) | (~0UL << size)); | ||
404 | found_middle: | ||
405 | return result + ffz(__swab32(tmp)); | ||
406 | } | ||
407 | |||
408 | #else | ||
409 | # error processor byte order undefined! | ||
410 | #endif | ||
411 | |||
412 | |||
413 | #define hweight32(x) generic_hweight32(x) | ||
414 | #define hweight16(x) generic_hweight16(x) | ||
415 | #define hweight8(x) generic_hweight8(x) | ||
416 | |||
417 | /* | ||
418 | * Find the first bit set in a 140-bit bitmap. | ||
419 | * The first 100 bits are unlikely to be set. | ||
420 | */ | ||
421 | |||
422 | static inline int sched_find_first_bit(const unsigned long *b) | ||
423 | { | ||
424 | if (unlikely(b[0])) | ||
425 | return __ffs(b[0]); | ||
426 | if (unlikely(b[1])) | ||
427 | return __ffs(b[1]) + 32; | ||
428 | if (unlikely(b[2])) | ||
429 | return __ffs(b[2]) + 64; | ||
430 | if (b[3]) | ||
431 | return __ffs(b[3]) + 96; | ||
432 | return __ffs(b[4]) + 128; | ||
433 | } | ||
434 | |||
435 | |||
436 | /* Bitmap functions for the minix filesystem. */ | ||
437 | |||
438 | #define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) | ||
439 | #define minix_set_bit(nr,addr) set_bit(nr,addr) | ||
440 | #define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) | ||
441 | #define minix_test_bit(nr,addr) test_bit(nr,addr) | ||
442 | #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) | ||
443 | |||
444 | #endif /* __KERNEL__ */ | ||
445 | |||
446 | #endif /* _XTENSA_BITOPS_H */ | ||
diff --git a/include/asm-xtensa/bootparam.h b/include/asm-xtensa/bootparam.h new file mode 100644 index 000000000000..9983f2c1b7ee --- /dev/null +++ b/include/asm-xtensa/bootparam.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bootparam.h | ||
3 | * | ||
4 | * Definition of the Linux/Xtensa boot parameter structure | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | * | ||
12 | * (Concept borrowed from the 68K port) | ||
13 | */ | ||
14 | |||
15 | #ifndef _XTENSA_BOOTPARAM_H | ||
16 | #define _XTENSA_BOOTPARAM_H | ||
17 | |||
18 | #define BP_VERSION 0x0001 | ||
19 | |||
20 | #define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/ | ||
21 | #define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */ | ||
22 | #define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */ | ||
23 | #define BP_TAG_SERIAL_BAUSRATE 0x1004 /* baud rate of current console. */ | ||
24 | #define BP_TAG_SERIAL_PORT 0x1005 /* serial device of current console */ | ||
25 | |||
26 | #define BP_TAG_FIRST 0x7B0B /* first tag with a version number */ | ||
27 | #define BP_TAG_LAST 0x7E0B /* last tag */ | ||
28 | |||
29 | #ifndef __ASSEMBLY__ | ||
30 | |||
31 | /* All records are aligned to 4 bytes */ | ||
32 | |||
33 | typedef struct bp_tag { | ||
34 | unsigned short id; /* tag id */ | ||
35 | unsigned short size; /* size of this record excluding the structure*/ | ||
36 | unsigned long data[0]; /* data */ | ||
37 | } bp_tag_t; | ||
38 | |||
39 | typedef struct meminfo { | ||
40 | unsigned long type; | ||
41 | unsigned long start; | ||
42 | unsigned long end; | ||
43 | } meminfo_t; | ||
44 | |||
45 | #define SYSMEM_BANKS_MAX 5 | ||
46 | |||
47 | #define MEMORY_TYPE_CONVENTIONAL 0x1000 | ||
48 | #define MEMORY_TYPE_NONE 0x2000 | ||
49 | |||
50 | typedef struct sysmem_info { | ||
51 | int nr_banks; | ||
52 | meminfo_t bank[SYSMEM_BANKS_MAX]; | ||
53 | } sysmem_info_t; | ||
54 | |||
55 | extern sysmem_info_t sysmem; | ||
56 | |||
57 | #endif | ||
58 | #endif | ||
59 | |||
60 | |||
61 | |||
diff --git a/include/asm-xtensa/bug.h b/include/asm-xtensa/bug.h new file mode 100644 index 000000000000..56703659b204 --- /dev/null +++ b/include/asm-xtensa/bug.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bug.h | ||
3 | * | ||
4 | * Macros to cause a 'bug' message. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_BUG_H | ||
14 | #define _XTENSA_BUG_H | ||
15 | |||
16 | #include <linux/stringify.h> | ||
17 | |||
18 | #define ILL __asm__ __volatile__ (".byte 0,0,0\n") | ||
19 | |||
20 | #ifdef CONFIG_KALLSYMS | ||
21 | # define BUG() do { \ | ||
22 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | ||
23 | ILL; \ | ||
24 | } while (0) | ||
25 | #else | ||
26 | # define BUG() do { \ | ||
27 | printk("kernel BUG!\n"); \ | ||
28 | ILL; \ | ||
29 | } while (0) | ||
30 | #endif | ||
31 | |||
32 | #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) | ||
33 | #define PAGE_BUG(page) do { BUG(); } while (0) | ||
34 | #define WARN_ON(condition) do { \ | ||
35 | if (unlikely((condition)!=0)) { \ | ||
36 | printk ("Warning in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ | ||
37 | dump_stack(); \ | ||
38 | } \ | ||
39 | } while (0) | ||
40 | |||
41 | #endif /* _XTENSA_BUG_H */ | ||
diff --git a/include/asm-xtensa/bugs.h b/include/asm-xtensa/bugs.h new file mode 100644 index 000000000000..c42285320133 --- /dev/null +++ b/include/asm-xtensa/bugs.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bugs.h | ||
3 | * | ||
4 | * This is included by init/main.c to check for architecture-dependent bugs. | ||
5 | * | ||
6 | * Xtensa processors don't have any bugs. :) | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General | ||
9 | * Public License. See the file "COPYING" in the main directory of | ||
10 | * this archive for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_BUGS_H | ||
14 | #define _XTENSA_BUGS_H | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | |||
18 | static void __init check_bugs(void) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | #endif /* _XTENSA_BUGS_H */ | ||
diff --git a/include/asm-xtensa/byteorder.h b/include/asm-xtensa/byteorder.h new file mode 100644 index 000000000000..0b1552569aae --- /dev/null +++ b/include/asm-xtensa/byteorder.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/byteorder.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_BYTEORDER_H | ||
12 | #define _XTENSA_BYTEORDER_H | ||
13 | |||
14 | #include <asm/processor.h> | ||
15 | #include <asm/types.h> | ||
16 | |||
17 | static __inline__ __const__ __u32 ___arch__swab32(__u32 x) | ||
18 | { | ||
19 | __u32 res; | ||
20 | /* instruction sequence from Xtensa ISA release 2/2000 */ | ||
21 | __asm__("ssai 8 \n\t" | ||
22 | "srli %0, %1, 16 \n\t" | ||
23 | "src %0, %0, %1 \n\t" | ||
24 | "src %0, %0, %0 \n\t" | ||
25 | "src %0, %1, %0 \n" | ||
26 | : "=&a" (res) | ||
27 | : "a" (x) | ||
28 | ); | ||
29 | return res; | ||
30 | } | ||
31 | |||
32 | static __inline__ __const__ __u16 ___arch__swab16(__u16 x) | ||
33 | { | ||
34 | /* Given that 'short' values are signed (i.e., can be negative), | ||
35 | * we cannot assume that the upper 16-bits of the register are | ||
36 | * zero. We are careful to mask values after shifting. | ||
37 | */ | ||
38 | |||
39 | /* There exists an anomaly between xt-gcc and xt-xcc. xt-gcc | ||
40 | * inserts an extui instruction after putting this function inline | ||
41 | * to ensure that it uses only the least-significant 16 bits of | ||
42 | * the result. xt-xcc doesn't use an extui, but assumes the | ||
43 | * __asm__ macro follows convention that the upper 16 bits of an | ||
44 | * 'unsigned short' result are still zero. This macro doesn't | ||
45 | * follow convention; indeed, it leaves garbage in the upport 16 | ||
46 | * bits of the register. | ||
47 | |||
48 | * Declaring the temporary variables 'res' and 'tmp' to be 32-bit | ||
49 | * types while the return type of the function is a 16-bit type | ||
50 | * forces both compilers to insert exactly one extui instruction | ||
51 | * (or equivalent) to mask off the upper 16 bits. */ | ||
52 | |||
53 | __u32 res; | ||
54 | __u32 tmp; | ||
55 | |||
56 | __asm__("extui %1, %2, 8, 8\n\t" | ||
57 | "slli %0, %2, 8 \n\t" | ||
58 | "or %0, %0, %1 \n" | ||
59 | : "=&a" (res), "=&a" (tmp) | ||
60 | : "a" (x) | ||
61 | ); | ||
62 | |||
63 | return res; | ||
64 | } | ||
65 | |||
66 | #define __arch__swab32(x) ___arch__swab32(x) | ||
67 | #define __arch__swab16(x) ___arch__swab16(x) | ||
68 | |||
69 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
70 | # define __BYTEORDER_HAS_U64__ | ||
71 | # define __SWAB_64_THRU_32__ | ||
72 | #endif | ||
73 | |||
74 | #ifdef __XTENSA_EL__ | ||
75 | # include <linux/byteorder/little_endian.h> | ||
76 | #elif defined(__XTENSA_EB__) | ||
77 | # include <linux/byteorder/big_endian.h> | ||
78 | #else | ||
79 | # error processor byte order undefined! | ||
80 | #endif | ||
81 | |||
82 | #endif /* __ASM_XTENSA_BYTEORDER_H */ | ||
diff --git a/include/asm-xtensa/cache.h b/include/asm-xtensa/cache.h new file mode 100644 index 000000000000..5aae3f12407c --- /dev/null +++ b/include/asm-xtensa/cache.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cacheflush.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * (C) 2001 - 2005 Tensilica Inc. | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_CACHE_H | ||
13 | #define _XTENSA_CACHE_H | ||
14 | |||
15 | #include <xtensa/config/core.h> | ||
16 | |||
17 | #if XCHAL_ICACHE_SIZE > 0 | ||
18 | # if (XCHAL_ICACHE_SIZE % (XCHAL_ICACHE_LINESIZE*XCHAL_ICACHE_WAYS*4)) != 0 | ||
19 | # error cache configuration outside expected/supported range! | ||
20 | # endif | ||
21 | #endif | ||
22 | |||
23 | #if XCHAL_DCACHE_SIZE > 0 | ||
24 | # if (XCHAL_DCACHE_SIZE % (XCHAL_DCACHE_LINESIZE*XCHAL_DCACHE_WAYS*4)) != 0 | ||
25 | # error cache configuration outside expected/supported range! | ||
26 | # endif | ||
27 | #endif | ||
28 | |||
29 | #define L1_CACHE_SHIFT XCHAL_CACHE_LINEWIDTH_MAX | ||
30 | #define L1_CACHE_BYTES XCHAL_CACHE_LINESIZE_MAX | ||
31 | |||
32 | #endif /* _XTENSA_CACHE_H */ | ||
diff --git a/include/asm-xtensa/cacheflush.h b/include/asm-xtensa/cacheflush.h new file mode 100644 index 000000000000..44a36e087844 --- /dev/null +++ b/include/asm-xtensa/cacheflush.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cacheflush.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CACHEFLUSH_H | ||
12 | #define _XTENSA_CACHEFLUSH_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <linux/mm.h> | ||
17 | #include <asm/processor.h> | ||
18 | #include <asm/page.h> | ||
19 | |||
20 | /* | ||
21 | * flush and invalidate data cache, invalidate instruction cache: | ||
22 | * | ||
23 | * __flush_invalidate_cache_all() | ||
24 | * __flush_invalidate_cache_range(from,sze) | ||
25 | * | ||
26 | * invalidate data or instruction cache: | ||
27 | * | ||
28 | * __invalidate_icache_all() | ||
29 | * __invalidate_icache_page(adr) | ||
30 | * __invalidate_dcache_page(adr) | ||
31 | * __invalidate_icache_range(from,size) | ||
32 | * __invalidate_dcache_range(from,size) | ||
33 | * | ||
34 | * flush data cache: | ||
35 | * | ||
36 | * __flush_dcache_page(adr) | ||
37 | * | ||
38 | * flush and invalidate data cache: | ||
39 | * | ||
40 | * __flush_invalidate_dcache_all() | ||
41 | * __flush_invalidate_dcache_page(adr) | ||
42 | * __flush_invalidate_dcache_range(from,size) | ||
43 | */ | ||
44 | |||
45 | extern void __flush_invalidate_cache_all(void); | ||
46 | extern void __flush_invalidate_cache_range(unsigned long, unsigned long); | ||
47 | extern void __flush_invalidate_dcache_all(void); | ||
48 | extern void __invalidate_icache_all(void); | ||
49 | |||
50 | extern void __invalidate_dcache_page(unsigned long); | ||
51 | extern void __invalidate_icache_page(unsigned long); | ||
52 | extern void __invalidate_icache_range(unsigned long, unsigned long); | ||
53 | extern void __invalidate_dcache_range(unsigned long, unsigned long); | ||
54 | |||
55 | #if XCHAL_DCACHE_IS_WRITEBACK | ||
56 | extern void __flush_dcache_page(unsigned long); | ||
57 | extern void __flush_invalidate_dcache_page(unsigned long); | ||
58 | extern void __flush_invalidate_dcache_range(unsigned long, unsigned long); | ||
59 | #else | ||
60 | # define __flush_dcache_page(p) do { } while(0) | ||
61 | # define __flush_invalidate_dcache_page(p) do { } while(0) | ||
62 | # define __flush_invalidate_dcache_range(p,s) do { } while(0) | ||
63 | #endif | ||
64 | |||
65 | /* | ||
66 | * We have physically tagged caches - nothing to do here - | ||
67 | * unless we have cache aliasing. | ||
68 | * | ||
69 | * Pages can get remapped. Because this might change the 'color' of that page, | ||
70 | * we have to flush the cache before the PTE is changed. | ||
71 | * (see also Documentation/cachetlb.txt) | ||
72 | */ | ||
73 | |||
74 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
75 | |||
76 | #define flush_cache_all() __flush_invalidate_cache_all(); | ||
77 | #define flush_cache_mm(mm) __flush_invalidate_cache_all(); | ||
78 | |||
79 | #define flush_cache_vmap(start,end) __flush_invalidate_cache_all(); | ||
80 | #define flush_cache_vunmap(start,end) __flush_invalidate_cache_all(); | ||
81 | |||
82 | extern void flush_dcache_page(struct page*); | ||
83 | |||
84 | extern void flush_cache_range(struct vm_area_struct*, ulong, ulong); | ||
85 | extern void flush_cache_page(struct vm_area_struct*, unsigned long, unsigned long); | ||
86 | |||
87 | #else | ||
88 | |||
89 | #define flush_cache_all() do { } while (0) | ||
90 | #define flush_cache_mm(mm) do { } while (0) | ||
91 | |||
92 | #define flush_cache_vmap(start,end) do { } while (0) | ||
93 | #define flush_cache_vunmap(start,end) do { } while (0) | ||
94 | |||
95 | #define flush_dcache_page(page) do { } while (0) | ||
96 | |||
97 | #define flush_cache_page(vma,addr,pfn) do { } while (0) | ||
98 | #define flush_cache_range(vma,start,end) do { } while (0) | ||
99 | |||
100 | #endif | ||
101 | |||
102 | #define flush_icache_range(start,end) \ | ||
103 | __invalidate_icache_range(start,(end)-(start)) | ||
104 | |||
105 | /* This is not required, see Documentation/cachetlb.txt */ | ||
106 | |||
107 | #define flush_icache_page(vma,page) do { } while(0) | ||
108 | |||
109 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
110 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
111 | |||
112 | |||
113 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
114 | memcpy(dst, src, len) | ||
115 | |||
116 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
117 | memcpy(dst, src, len) | ||
118 | |||
119 | #endif /* __KERNEL__ */ | ||
120 | |||
121 | #endif /* _XTENSA_CACHEFLUSH_H */ | ||
122 | |||
diff --git a/include/asm-xtensa/checksum.h b/include/asm-xtensa/checksum.h new file mode 100644 index 000000000000..1a00fad19929 --- /dev/null +++ b/include/asm-xtensa/checksum.h | |||
@@ -0,0 +1,264 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/checksum.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CHECKSUM_H | ||
12 | #define _XTENSA_CHECKSUM_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/in6.h> | ||
16 | #include <xtensa/config/core.h> | ||
17 | |||
18 | /* | ||
19 | * computes the checksum of a memory block at buff, length len, | ||
20 | * and adds in "sum" (32-bit) | ||
21 | * | ||
22 | * returns a 32-bit number suitable for feeding into itself | ||
23 | * or csum_tcpudp_magic | ||
24 | * | ||
25 | * this function must be called with even lengths, except | ||
26 | * for the last fragment, which may be odd | ||
27 | * | ||
28 | * it's best to have buff aligned on a 32-bit boundary | ||
29 | */ | ||
30 | asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); | ||
31 | |||
32 | /* | ||
33 | * the same as csum_partial, but copies from src while it | ||
34 | * checksums, and handles user-space pointer exceptions correctly, when needed. | ||
35 | * | ||
36 | * here even more important to align src and dst on a 32-bit (or even | ||
37 | * better 64-bit) boundary | ||
38 | */ | ||
39 | |||
40 | asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, | ||
41 | int *src_err_ptr, int *dst_err_ptr); | ||
42 | |||
43 | /* | ||
44 | * Note: when you get a NULL pointer exception here this means someone | ||
45 | * passed in an incorrect kernel address to one of these functions. | ||
46 | * | ||
47 | * If you use these functions directly please don't forget the | ||
48 | * verify_area(). | ||
49 | */ | ||
50 | extern __inline__ | ||
51 | unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, | ||
52 | int len, int sum) | ||
53 | { | ||
54 | return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); | ||
55 | } | ||
56 | |||
57 | extern __inline__ | ||
58 | unsigned int csum_partial_copy_from_user ( const char *src, char *dst, | ||
59 | int len, int sum, int *err_ptr) | ||
60 | { | ||
61 | return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * These are the old (and unsafe) way of doing checksums, a warning message will be | ||
66 | * printed if they are used and an exeption occurs. | ||
67 | * | ||
68 | * these functions should go away after some time. | ||
69 | */ | ||
70 | |||
71 | #define csum_partial_copy_fromuser csum_partial_copy | ||
72 | unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum); | ||
73 | |||
74 | /* | ||
75 | * Fold a partial checksum | ||
76 | */ | ||
77 | |||
78 | static __inline__ unsigned int csum_fold(unsigned int sum) | ||
79 | { | ||
80 | unsigned int __dummy; | ||
81 | __asm__("extui %1, %0, 16, 16\n\t" | ||
82 | "extui %0 ,%0, 0, 16\n\t" | ||
83 | "add %0, %0, %1\n\t" | ||
84 | "slli %1, %0, 16\n\t" | ||
85 | "add %0, %0, %1\n\t" | ||
86 | "extui %0, %0, 16, 16\n\t" | ||
87 | "neg %0, %0\n\t" | ||
88 | "addi %0, %0, -1\n\t" | ||
89 | "extui %0, %0, 0, 16\n\t" | ||
90 | : "=r" (sum), "=&r" (__dummy) | ||
91 | : "0" (sum)); | ||
92 | return sum; | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
97 | * which always checksum on 4 octet boundaries. | ||
98 | */ | ||
99 | static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) | ||
100 | { | ||
101 | unsigned int sum, tmp, endaddr; | ||
102 | |||
103 | __asm__ __volatile__( | ||
104 | "sub %0, %0, %0\n\t" | ||
105 | #if XCHAL_HAVE_LOOPS | ||
106 | "loopgtz %2, 2f\n\t" | ||
107 | #else | ||
108 | "beqz %2, 2f\n\t" | ||
109 | "slli %4, %2, 2\n\t" | ||
110 | "add %4, %4, %1\n\t" | ||
111 | "0:\t" | ||
112 | #endif | ||
113 | "l32i %3, %1, 0\n\t" | ||
114 | "add %0, %0, %3\n\t" | ||
115 | "bgeu %0, %3, 1f\n\t" | ||
116 | "addi %0, %0, 1\n\t" | ||
117 | "1:\t" | ||
118 | "addi %1, %1, 4\n\t" | ||
119 | #if !XCHAL_HAVE_LOOPS | ||
120 | "blt %1, %4, 0b\n\t" | ||
121 | #endif | ||
122 | "2:\t" | ||
123 | /* Since the input registers which are loaded with iph and ihl | ||
124 | are modified, we must also specify them as outputs, or gcc | ||
125 | will assume they contain their original values. */ | ||
126 | : "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmp), "=&r" (endaddr) | ||
127 | : "1" (iph), "2" (ihl)); | ||
128 | |||
129 | return csum_fold(sum); | ||
130 | } | ||
131 | |||
132 | static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, | ||
133 | unsigned long daddr, | ||
134 | unsigned short len, | ||
135 | unsigned short proto, | ||
136 | unsigned int sum) | ||
137 | { | ||
138 | |||
139 | #ifdef __XTENSA_EL__ | ||
140 | unsigned long len_proto = (ntohs(len)<<16)+proto*256; | ||
141 | #elif defined(__XTENSA_EB__) | ||
142 | unsigned long len_proto = (proto<<16)+len; | ||
143 | #else | ||
144 | # error processor byte order undefined! | ||
145 | #endif | ||
146 | __asm__("add %0, %0, %1\n\t" | ||
147 | "bgeu %0, %1, 1f\n\t" | ||
148 | "addi %0, %0, 1\n\t" | ||
149 | "1:\t" | ||
150 | "add %0, %0, %2\n\t" | ||
151 | "bgeu %0, %2, 1f\n\t" | ||
152 | "addi %0, %0, 1\n\t" | ||
153 | "1:\t" | ||
154 | "add %0, %0, %3\n\t" | ||
155 | "bgeu %0, %3, 1f\n\t" | ||
156 | "addi %0, %0, 1\n\t" | ||
157 | "1:\t" | ||
158 | : "=r" (sum), "=r" (len_proto) | ||
159 | : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum)); | ||
160 | return sum; | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | * computes the checksum of the TCP/UDP pseudo-header | ||
165 | * returns a 16-bit checksum, already complemented | ||
166 | */ | ||
167 | static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr, | ||
168 | unsigned long daddr, | ||
169 | unsigned short len, | ||
170 | unsigned short proto, | ||
171 | unsigned int sum) | ||
172 | { | ||
173 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
178 | * in icmp.c | ||
179 | */ | ||
180 | |||
181 | static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) | ||
182 | { | ||
183 | return csum_fold (csum_partial(buff, len, 0)); | ||
184 | } | ||
185 | |||
186 | #define _HAVE_ARCH_IPV6_CSUM | ||
187 | static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, | ||
188 | struct in6_addr *daddr, | ||
189 | __u32 len, | ||
190 | unsigned short proto, | ||
191 | unsigned int sum) | ||
192 | { | ||
193 | unsigned int __dummy; | ||
194 | __asm__("l32i %1, %2, 0\n\t" | ||
195 | "add %0, %0, %1\n\t" | ||
196 | "bgeu %0, %1, 1f\n\t" | ||
197 | "addi %0, %0, 1\n\t" | ||
198 | "1:\t" | ||
199 | "l32i %1, %2, 4\n\t" | ||
200 | "add %0, %0, %1\n\t" | ||
201 | "bgeu %0, %1, 1f\n\t" | ||
202 | "addi %0, %0, 1\n\t" | ||
203 | "1:\t" | ||
204 | "l32i %1, %2, 8\n\t" | ||
205 | "add %0, %0, %1\n\t" | ||
206 | "bgeu %0, %1, 1f\n\t" | ||
207 | "addi %0, %0, 1\n\t" | ||
208 | "1:\t" | ||
209 | "l32i %1, %2, 12\n\t" | ||
210 | "add %0, %0, %1\n\t" | ||
211 | "bgeu %0, %1, 1f\n\t" | ||
212 | "addi %0, %0, 1\n\t" | ||
213 | "1:\t" | ||
214 | "l32i %1, %3, 0\n\t" | ||
215 | "add %0, %0, %1\n\t" | ||
216 | "bgeu %0, %1, 1f\n\t" | ||
217 | "addi %0, %0, 1\n\t" | ||
218 | "1:\t" | ||
219 | "l32i %1, %3, 4\n\t" | ||
220 | "add %0, %0, %1\n\t" | ||
221 | "bgeu %0, %1, 1f\n\t" | ||
222 | "addi %0, %0, 1\n\t" | ||
223 | "1:\t" | ||
224 | "l32i %1, %3, 8\n\t" | ||
225 | "add %0, %0, %1\n\t" | ||
226 | "bgeu %0, %1, 1f\n\t" | ||
227 | "addi %0, %0, 1\n\t" | ||
228 | "1:\t" | ||
229 | "l32i %1, %3, 12\n\t" | ||
230 | "add %0, %0, %1\n\t" | ||
231 | "bgeu %0, %1, 1f\n\t" | ||
232 | "addi %0, %0, 1\n\t" | ||
233 | "1:\t" | ||
234 | "add %0, %0, %4\n\t" | ||
235 | "bgeu %0, %4, 1f\n\t" | ||
236 | "addi %0, %0, 1\n\t" | ||
237 | "1:\t" | ||
238 | "add %0, %0, %5\n\t" | ||
239 | "bgeu %0, %5, 1f\n\t" | ||
240 | "addi %0, %0, 1\n\t" | ||
241 | "1:\t" | ||
242 | : "=r" (sum), "=&r" (__dummy) | ||
243 | : "r" (saddr), "r" (daddr), | ||
244 | "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)); | ||
245 | |||
246 | return csum_fold(sum); | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * Copy and checksum to user | ||
251 | */ | ||
252 | #define HAVE_CSUM_COPY_USER | ||
253 | static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst, | ||
254 | int len, int sum, int *err_ptr) | ||
255 | { | ||
256 | if (access_ok(VERIFY_WRITE, dst, len)) | ||
257 | return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); | ||
258 | |||
259 | if (len) | ||
260 | *err_ptr = -EFAULT; | ||
261 | |||
262 | return -1; /* invalid checksum */ | ||
263 | } | ||
264 | #endif | ||
diff --git a/include/asm-xtensa/coprocessor.h b/include/asm-xtensa/coprocessor.h new file mode 100644 index 000000000000..a91b96dc0efe --- /dev/null +++ b/include/asm-xtensa/coprocessor.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cpextra.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_COPROCESSOR_H | ||
12 | #define _XTENSA_COPROCESSOR_H | ||
13 | |||
14 | #include <xtensa/config/core.h> | ||
15 | |||
16 | #define XTOFS(last_start,last_size,align) \ | ||
17 | ((last_start+last_size+align-1) & -align) | ||
18 | |||
19 | #define XTENSA_CP_EXTRA_OFFSET 0 | ||
20 | #define XTENSA_CP_EXTRA_ALIGN XCHAL_EXTRA_SA_ALIGN | ||
21 | |||
22 | #define XTENSA_CPE_CP0_OFFSET \ | ||
23 | XTOFS(XTENSA_CP_EXTRA_OFFSET, XCHAL_EXTRA_SA_SIZE, XCHAL_CP0_SA_ALIGN) | ||
24 | #define XTENSA_CPE_CP1_OFFSET \ | ||
25 | XTOFS(XTENSA_CPE_CP0_OFFSET, XCHAL_CP0_SA_SIZE, XCHAL_CP1_SA_ALIGN) | ||
26 | #define XTENSA_CPE_CP2_OFFSET \ | ||
27 | XTOFS(XTENSA_CPE_CP1_OFFSET, XCHAL_CP1_SA_SIZE, XCHAL_CP2_SA_ALIGN) | ||
28 | #define XTENSA_CPE_CP3_OFFSET \ | ||
29 | XTOFS(XTENSA_CPE_CP2_OFFSET, XCHAL_CP2_SA_SIZE, XCHAL_CP3_SA_ALIGN) | ||
30 | #define XTENSA_CPE_CP4_OFFSET \ | ||
31 | XTOFS(XTENSA_CPE_CP3_OFFSET, XCHAL_CP3_SA_SIZE, XCHAL_CP4_SA_ALIGN) | ||
32 | #define XTENSA_CPE_CP5_OFFSET \ | ||
33 | XTOFS(XTENSA_CPE_CP4_OFFSET, XCHAL_CP4_SA_SIZE, XCHAL_CP5_SA_ALIGN) | ||
34 | #define XTENSA_CPE_CP6_OFFSET \ | ||
35 | XTOFS(XTENSA_CPE_CP5_OFFSET, XCHAL_CP5_SA_SIZE, XCHAL_CP6_SA_ALIGN) | ||
36 | #define XTENSA_CPE_CP7_OFFSET \ | ||
37 | XTOFS(XTENSA_CPE_CP6_OFFSET, XCHAL_CP6_SA_SIZE, XCHAL_CP7_SA_ALIGN) | ||
38 | #define XTENSA_CP_EXTRA_SIZE \ | ||
39 | XTOFS(XTENSA_CPE_CP7_OFFSET, XCHAL_CP7_SA_SIZE, 16) | ||
40 | |||
41 | #if XCHAL_CP_NUM > 0 | ||
42 | # ifndef __ASSEMBLY__ | ||
43 | /* | ||
44 | * Tasks that own contents of (last user) each coprocessor. | ||
45 | * Entries are 0 for not-owned or non-existent coprocessors. | ||
46 | * Note: The size of this structure is fixed to 8 bytes in entry.S | ||
47 | */ | ||
48 | typedef struct { | ||
49 | struct task_struct *owner; /* owner */ | ||
50 | int offset; /* offset in cpextra space. */ | ||
51 | } coprocessor_info_t; | ||
52 | # else | ||
53 | # define COPROCESSOR_INFO_OWNER 0 | ||
54 | # define COPROCESSOR_INFO_OFFSET 4 | ||
55 | # define COPROCESSOR_INFO_SIZE 8 | ||
56 | # endif | ||
57 | #endif | ||
58 | |||
59 | |||
60 | #ifndef __ASSEMBLY__ | ||
61 | # if XCHAL_CP_NUM > 0 | ||
62 | struct task_struct; | ||
63 | extern void release_coprocessors (struct task_struct*); | ||
64 | extern void save_coprocessor_registers(void*, int); | ||
65 | # else | ||
66 | # define release_coprocessors(task) | ||
67 | # endif | ||
68 | #endif | ||
69 | |||
70 | #endif /* _XTENSA_COPROCESSOR_H */ | ||
diff --git a/include/asm-xtensa/cpumask.h b/include/asm-xtensa/cpumask.h new file mode 100644 index 000000000000..ebeede397db3 --- /dev/null +++ b/include/asm-xtensa/cpumask.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cpumask.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CPUMASK_H | ||
12 | #define _XTENSA_CPUMASK_H | ||
13 | |||
14 | #include <asm-generic/cpumask.h> | ||
15 | |||
16 | #endif /* _XTENSA_CPUMASK_H */ | ||
diff --git a/include/asm-xtensa/cputime.h b/include/asm-xtensa/cputime.h new file mode 100644 index 000000000000..a7fb864a50ae --- /dev/null +++ b/include/asm-xtensa/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _XTENSA_CPUTIME_H | ||
2 | #define _XTENSA_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* _XTENSA_CPUTIME_H */ | ||
diff --git a/include/asm-xtensa/current.h b/include/asm-xtensa/current.h new file mode 100644 index 000000000000..8d1eb5d78649 --- /dev/null +++ b/include/asm-xtensa/current.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/current.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CURRENT_H | ||
12 | #define _XTENSA_CURRENT_H | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | #include <linux/thread_info.h> | ||
17 | |||
18 | struct task_struct; | ||
19 | |||
20 | static inline struct task_struct *get_current(void) | ||
21 | { | ||
22 | return current_thread_info()->task; | ||
23 | } | ||
24 | |||
25 | #define current get_current() | ||
26 | |||
27 | #else | ||
28 | |||
29 | #define CURRENT_SHIFT 13 | ||
30 | |||
31 | #define GET_CURRENT(reg,sp) \ | ||
32 | GET_THREAD_INFO(reg,sp); \ | ||
33 | l32i reg, reg, TI_TASK \ | ||
34 | |||
35 | #endif | ||
36 | |||
37 | |||
38 | #endif /* XTENSA_CURRENT_H */ | ||
diff --git a/include/asm-xtensa/delay.h b/include/asm-xtensa/delay.h new file mode 100644 index 000000000000..6359c55e77a8 --- /dev/null +++ b/include/asm-xtensa/delay.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/delay.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_DELAY_H | ||
13 | #define _XTENSA_DELAY_H | ||
14 | |||
15 | #include <linux/config.h> | ||
16 | #include <asm/processor.h> | ||
17 | #include <asm/param.h> | ||
18 | |||
19 | extern unsigned long loops_per_jiffy; | ||
20 | |||
21 | extern __inline__ void __delay(unsigned long loops) | ||
22 | { | ||
23 | /* 2 cycles per loop. */ | ||
24 | __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 1, 1b" | ||
25 | : "=r" (loops) : "0" (loops)); | ||
26 | } | ||
27 | |||
28 | static __inline__ u32 xtensa_get_ccount(void) | ||
29 | { | ||
30 | u32 ccount; | ||
31 | asm volatile ("rsr %0, 234; # CCOUNT\n" : "=r" (ccount)); | ||
32 | return ccount; | ||
33 | } | ||
34 | |||
35 | /* For SMP/NUMA systems, change boot_cpu_data to something like | ||
36 | * local_cpu_data->... where local_cpu_data points to the current | ||
37 | * cpu. */ | ||
38 | |||
39 | static __inline__ void udelay (unsigned long usecs) | ||
40 | { | ||
41 | unsigned long start = xtensa_get_ccount(); | ||
42 | unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ)); | ||
43 | |||
44 | /* Note: all variables are unsigned (can wrap around)! */ | ||
45 | while (((unsigned long)xtensa_get_ccount()) - start < cycles) | ||
46 | ; | ||
47 | } | ||
48 | |||
49 | #endif | ||
50 | |||
diff --git a/include/asm-xtensa/div64.h b/include/asm-xtensa/div64.h new file mode 100644 index 000000000000..c4a105776383 --- /dev/null +++ b/include/asm-xtensa/div64.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/div64.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_DIV64_H | ||
12 | #define _XTENSA_DIV64_H | ||
13 | |||
14 | #define do_div(n,base) ({ \ | ||
15 | int __res = n % ((unsigned int) base); \ | ||
16 | n /= (unsigned int) base; \ | ||
17 | __res; }) | ||
18 | |||
19 | #endif | ||
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h new file mode 100644 index 000000000000..e86a206f1209 --- /dev/null +++ b/include/asm-xtensa/dma-mapping.h | |||
@@ -0,0 +1,182 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/dma_mapping.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_DMA_MAPPING_H | ||
12 | #define _XTENSA_DMA_MAPPING_H | ||
13 | |||
14 | #include <asm/scatterlist.h> | ||
15 | #include <asm/cache.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <linux/mm.h> | ||
18 | |||
19 | /* | ||
20 | * DMA-consistent mapping functions. | ||
21 | */ | ||
22 | |||
23 | extern void *consistent_alloc(int, size_t, dma_addr_t, unsigned long); | ||
24 | extern void consistent_free(void*, size_t, dma_addr_t); | ||
25 | extern void consistent_sync(void*, size_t, int); | ||
26 | |||
27 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
28 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
29 | |||
30 | void *dma_alloc_coherent(struct device *dev, size_t size, | ||
31 | dma_addr_t *dma_handle, int flag); | ||
32 | |||
33 | void dma_free_coherent(struct device *dev, size_t size, | ||
34 | void *vaddr, dma_addr_t dma_handle); | ||
35 | |||
36 | static inline dma_addr_t | ||
37 | dma_map_single(struct device *dev, void *ptr, size_t size, | ||
38 | enum dma_data_direction direction) | ||
39 | { | ||
40 | BUG_ON(direction == DMA_NONE); | ||
41 | consistent_sync(ptr, size, direction); | ||
42 | return virt_to_phys(ptr); | ||
43 | } | ||
44 | |||
45 | static inline void | ||
46 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
47 | enum dma_data_direction direction) | ||
48 | { | ||
49 | BUG_ON(direction == DMA_NONE); | ||
50 | } | ||
51 | |||
52 | static inline int | ||
53 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
54 | enum dma_data_direction direction) | ||
55 | { | ||
56 | int i; | ||
57 | |||
58 | BUG_ON(direction == DMA_NONE); | ||
59 | |||
60 | for (i = 0; i < nents; i++, sg++ ) { | ||
61 | BUG_ON(!sg->page); | ||
62 | |||
63 | sg->dma_address = page_to_phys(sg->page) + sg->offset; | ||
64 | consistent_sync(page_address(sg->page) + sg->offset, | ||
65 | sg->length, direction); | ||
66 | } | ||
67 | |||
68 | return nents; | ||
69 | } | ||
70 | |||
71 | static inline dma_addr_t | ||
72 | dma_map_page(struct device *dev, struct page *page, unsigned long offset, | ||
73 | size_t size, enum dma_data_direction direction) | ||
74 | { | ||
75 | BUG_ON(direction == DMA_NONE); | ||
76 | return (dma_addr_t)(page_to_pfn(page)) * PAGE_SIZE + offset; | ||
77 | } | ||
78 | |||
79 | static inline void | ||
80 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
81 | enum dma_data_direction direction) | ||
82 | { | ||
83 | BUG_ON(direction == DMA_NONE); | ||
84 | } | ||
85 | |||
86 | |||
87 | static inline void | ||
88 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
89 | enum dma_data_direction direction) | ||
90 | { | ||
91 | BUG_ON(direction == DMA_NONE); | ||
92 | } | ||
93 | |||
94 | static inline void | ||
95 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
96 | enum dma_data_direction direction) | ||
97 | { | ||
98 | consistent_sync((void *)bus_to_virt(dma_handle), size, direction); | ||
99 | } | ||
100 | |||
101 | static inline void | ||
102 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
103 | enum dma_data_direction direction) | ||
104 | { | ||
105 | consistent_sync((void *)bus_to_virt(dma_handle), size, direction); | ||
106 | } | ||
107 | |||
108 | static inline void | ||
109 | dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
110 | unsigned long offset, size_t size, | ||
111 | enum dma_data_direction direction) | ||
112 | { | ||
113 | |||
114 | consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction); | ||
115 | } | ||
116 | |||
117 | static inline void | ||
118 | dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, | ||
119 | unsigned long offset, size_t size, | ||
120 | enum dma_data_direction direction) | ||
121 | { | ||
122 | |||
123 | consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction); | ||
124 | } | ||
125 | static inline void | ||
126 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
127 | enum dma_data_direction dir) | ||
128 | { | ||
129 | int i; | ||
130 | for (i = 0; i < nelems; i++, sg++) | ||
131 | consistent_sync(page_address(sg->page) + sg->offset, | ||
132 | sg->length, dir); | ||
133 | } | ||
134 | |||
135 | static inline void | ||
136 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | ||
137 | enum dma_data_direction dir) | ||
138 | { | ||
139 | int i; | ||
140 | for (i = 0; i < nelems; i++, sg++) | ||
141 | consistent_sync(page_address(sg->page) + sg->offset, | ||
142 | sg->length, dir); | ||
143 | } | ||
144 | static inline int | ||
145 | dma_mapping_error(dma_addr_t dma_addr) | ||
146 | { | ||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static inline int | ||
151 | dma_supported(struct device *dev, u64 mask) | ||
152 | { | ||
153 | return 1; | ||
154 | } | ||
155 | |||
156 | static inline int | ||
157 | dma_set_mask(struct device *dev, u64 mask) | ||
158 | { | ||
159 | if(!dev->dma_mask || !dma_supported(dev, mask)) | ||
160 | return -EIO; | ||
161 | |||
162 | *dev->dma_mask = mask; | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static inline int | ||
168 | dma_get_cache_alignment(void) | ||
169 | { | ||
170 | return L1_CACHE_BYTES; | ||
171 | } | ||
172 | |||
173 | #define dma_is_consistent(d) (1) | ||
174 | |||
175 | static inline void | ||
176 | dma_cache_sync(void *vaddr, size_t size, | ||
177 | enum dma_data_direction direction) | ||
178 | { | ||
179 | consistent_sync(vaddr, size, direction); | ||
180 | } | ||
181 | |||
182 | #endif /* _XTENSA_DMA_MAPPING_H */ | ||
diff --git a/include/asm-xtensa/dma.h b/include/asm-xtensa/dma.h new file mode 100644 index 000000000000..1c22b0234586 --- /dev/null +++ b/include/asm-xtensa/dma.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/dma.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_DMA_H | ||
12 | #define _XTENSA_DMA_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <asm/io.h> /* need byte IO */ | ||
16 | #include <xtensa/config/core.h> | ||
17 | |||
18 | /* | ||
19 | * This is only to be defined if we have PC-like DMA. | ||
20 | * By default this is not true on an Xtensa processor, | ||
21 | * however on boards with a PCI bus, such functionality | ||
22 | * might be emulated externally. | ||
23 | * | ||
24 | * NOTE: there still exists driver code that assumes | ||
25 | * this is defined, eg. drivers/sound/soundcard.c (as of 2.4). | ||
26 | */ | ||
27 | #define MAX_DMA_CHANNELS 8 | ||
28 | |||
29 | /* | ||
30 | * The maximum virtual address to which DMA transfers | ||
31 | * can be performed on this platform. | ||
32 | * | ||
33 | * NOTE: This is board (platform) specific, not processor-specific! | ||
34 | * | ||
35 | * NOTE: This assumes DMA transfers can only be performed on | ||
36 | * the section of physical memory contiguously mapped in virtual | ||
37 | * space for the kernel. For the Xtensa architecture, this | ||
38 | * means the maximum possible size of this DMA area is | ||
39 | * the size of the statically mapped kernel segment | ||
40 | * (XCHAL_KSEG_{CACHED,BYPASS}_SIZE), ie. 128 MB. | ||
41 | * | ||
42 | * NOTE: When the entire KSEG area is DMA capable, we substract | ||
43 | * one from the max address so that the virt_to_phys() macro | ||
44 | * works correctly on the address (otherwise the address | ||
45 | * enters another area, and virt_to_phys() may not return | ||
46 | * the value desired). | ||
47 | */ | ||
48 | #define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KSEG_CACHED_SIZE - 1) | ||
49 | |||
50 | /* Reserve and release a DMA channel */ | ||
51 | extern int request_dma(unsigned int dmanr, const char * device_id); | ||
52 | extern void free_dma(unsigned int dmanr); | ||
53 | |||
54 | #ifdef CONFIG_PCI | ||
55 | extern int isa_dma_bridge_buggy; | ||
56 | #else | ||
57 | #define isa_dma_bridge_buggy (0) | ||
58 | #endif | ||
59 | |||
60 | |||
61 | #endif | ||
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h new file mode 100644 index 000000000000..64f1f53874fe --- /dev/null +++ b/include/asm-xtensa/elf.h | |||
@@ -0,0 +1,222 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/elf.h | ||
3 | * | ||
4 | * ELF register definitions | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_ELF_H | ||
14 | #define _XTENSA_ELF_H | ||
15 | |||
16 | #include <asm/ptrace.h> | ||
17 | #include <asm/coprocessor.h> | ||
18 | #include <xtensa/config/core.h> | ||
19 | |||
20 | /* Xtensa processor ELF architecture-magic number */ | ||
21 | |||
22 | #define EM_XTENSA 94 | ||
23 | #define EM_XTENSA_OLD 0xABC7 | ||
24 | |||
25 | /* ELF register definitions. This is needed for core dump support. */ | ||
26 | |||
27 | /* | ||
28 | * elf_gregset_t contains the application-level state in the following order: | ||
29 | * Processor info: config_version, cpuxy | ||
30 | * Processor state: pc, ps, exccause, excvaddr, wb, ws, | ||
31 | * lbeg, lend, lcount, sar | ||
32 | * GP regs: ar0 - arXX | ||
33 | */ | ||
34 | |||
35 | typedef unsigned long elf_greg_t; | ||
36 | |||
37 | typedef struct { | ||
38 | elf_greg_t xchal_config_id0; | ||
39 | elf_greg_t xchal_config_id1; | ||
40 | elf_greg_t cpux; | ||
41 | elf_greg_t cpuy; | ||
42 | elf_greg_t pc; | ||
43 | elf_greg_t ps; | ||
44 | elf_greg_t exccause; | ||
45 | elf_greg_t excvaddr; | ||
46 | elf_greg_t windowbase; | ||
47 | elf_greg_t windowstart; | ||
48 | elf_greg_t lbeg; | ||
49 | elf_greg_t lend; | ||
50 | elf_greg_t lcount; | ||
51 | elf_greg_t sar; | ||
52 | elf_greg_t syscall; | ||
53 | elf_greg_t ar[XCHAL_NUM_AREGS]; | ||
54 | } xtensa_gregset_t; | ||
55 | |||
56 | #define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t)) | ||
57 | |||
58 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
59 | |||
60 | /* | ||
61 | * Compute the size of the coprocessor and extra state layout (register info) | ||
62 | * table (in bytes). | ||
63 | * This is actually the maximum size of the table, as opposed to the size, | ||
64 | * which is available from the _xtensa_reginfo_table_size global variable. | ||
65 | * | ||
66 | * (See also arch/xtensa/kernel/coprocessor.S) | ||
67 | * | ||
68 | */ | ||
69 | |||
70 | #ifndef XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM | ||
71 | # define XTENSA_CPE_LTABLE_SIZE 0 | ||
72 | #else | ||
73 | # define XTENSA_CPE_SEGMENT(num) (num ? (1+num) : 0) | ||
74 | # define XTENSA_CPE_LTABLE_ENTRIES \ | ||
75 | ( XTENSA_CPE_SEGMENT(XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM) \ | ||
76 | + XTENSA_CPE_SEGMENT(XCHAL_CP0_SA_CONTENTS_LIBDB_NUM) \ | ||
77 | + XTENSA_CPE_SEGMENT(XCHAL_CP1_SA_CONTENTS_LIBDB_NUM) \ | ||
78 | + XTENSA_CPE_SEGMENT(XCHAL_CP2_SA_CONTENTS_LIBDB_NUM) \ | ||
79 | + XTENSA_CPE_SEGMENT(XCHAL_CP3_SA_CONTENTS_LIBDB_NUM) \ | ||
80 | + XTENSA_CPE_SEGMENT(XCHAL_CP4_SA_CONTENTS_LIBDB_NUM) \ | ||
81 | + XTENSA_CPE_SEGMENT(XCHAL_CP5_SA_CONTENTS_LIBDB_NUM) \ | ||
82 | + XTENSA_CPE_SEGMENT(XCHAL_CP6_SA_CONTENTS_LIBDB_NUM) \ | ||
83 | + XTENSA_CPE_SEGMENT(XCHAL_CP7_SA_CONTENTS_LIBDB_NUM) \ | ||
84 | + 1 /* final entry */ \ | ||
85 | ) | ||
86 | # define XTENSA_CPE_LTABLE_SIZE (XTENSA_CPE_LTABLE_ENTRIES * 8) | ||
87 | #endif | ||
88 | |||
89 | |||
90 | /* | ||
91 | * Instantiations of the elf_fpregset_t type contain, in most | ||
92 | * architectures, the floating point (FPU) register set. | ||
93 | * For Xtensa, this type is extended to contain all custom state, | ||
94 | * ie. coprocessor and "extra" (non-coprocessor) state (including, | ||
95 | * for example, TIE-defined states and register files; as well | ||
96 | * as other optional processor state). | ||
97 | * This includes FPU state if a floating-point coprocessor happens | ||
98 | * to have been configured within the Xtensa processor. | ||
99 | * | ||
100 | * TOTAL_FPREGS_SIZE is the required size (without rounding) | ||
101 | * of elf_fpregset_t. It provides space for the following: | ||
102 | * | ||
103 | * a) 32-bit mask of active coprocessors for this task (similar | ||
104 | * to CPENABLE in single-threaded Xtensa processor systems) | ||
105 | * | ||
106 | * b) table describing the layout of custom states (ie. of | ||
107 | * individual registers, etc) within the save areas | ||
108 | * | ||
109 | * c) save areas for each coprocessor and for non-coprocessor | ||
110 | * ("extra") state | ||
111 | * | ||
112 | * Note that save areas may require up to 16-byte alignment when | ||
113 | * accessed by save/restore sequences. We do not need to ensure | ||
114 | * such alignment in an elf_fpregset_t structure because custom | ||
115 | * state is not directly loaded/stored into it; rather, save area | ||
116 | * contents are copied to elf_fpregset_t from the active save areas | ||
117 | * (see 'struct task_struct' definition in processor.h for that) | ||
118 | * using memcpy(). But we do allow space for such alignment, | ||
119 | * to allow optimizations of layout and copying. | ||
120 | */ | ||
121 | |||
122 | #define TOTAL_FPREGS_SIZE \ | ||
123 | (4 + XTENSA_CPE_LTABLE_SIZE + XTENSA_CP_EXTRA_SIZE) | ||
124 | #define ELF_NFPREG \ | ||
125 | ((TOTAL_FPREGS_SIZE + sizeof(elf_fpreg_t) - 1) / sizeof(elf_fpreg_t)) | ||
126 | |||
127 | typedef unsigned int elf_fpreg_t; | ||
128 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | ||
129 | |||
130 | #define ELF_CORE_COPY_REGS(_eregs, _pregs) \ | ||
131 | xtensa_elf_core_copy_regs (&_eregs, _pregs); | ||
132 | |||
133 | extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *); | ||
134 | |||
135 | /* | ||
136 | * This is used to ensure we don't load something for the wrong architecture. | ||
137 | */ | ||
138 | |||
139 | #define elf_check_arch(x) ( ( (x)->e_machine == EM_XTENSA ) || \ | ||
140 | ( (x)->e_machine == EM_XTENSA_OLD ) ) | ||
141 | |||
142 | /* | ||
143 | * These are used to set parameters in the core dumps. | ||
144 | */ | ||
145 | |||
146 | #ifdef __XTENSA_EL__ | ||
147 | # define ELF_DATA ELFDATA2LSB | ||
148 | #elif defined(__XTENSA_EB__) | ||
149 | # define ELF_DATA ELFDATA2MSB | ||
150 | #else | ||
151 | # error processor byte order undefined! | ||
152 | #endif | ||
153 | |||
154 | #define ELF_CLASS ELFCLASS32 | ||
155 | #define ELF_ARCH EM_XTENSA | ||
156 | |||
157 | #define USE_ELF_CORE_DUMP | ||
158 | #define ELF_EXEC_PAGESIZE PAGE_SIZE | ||
159 | |||
160 | /* | ||
161 | * This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
162 | * use of this is to invoke "./ld.so someprog" to test out a new version of | ||
163 | * the loader. We need to make sure that it is out of the way of the program | ||
164 | * that it will "exec", and that there is sufficient room for the brk. | ||
165 | */ | ||
166 | |||
167 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
168 | |||
169 | /* | ||
170 | * This yields a mask that user programs can use to figure out what | ||
171 | * instruction set this CPU supports. This could be done in user space, | ||
172 | * but it's not easy, and we've already done it here. | ||
173 | */ | ||
174 | |||
175 | #define ELF_HWCAP (0) | ||
176 | |||
177 | /* | ||
178 | * This yields a string that ld.so will use to load implementation | ||
179 | * specific libraries for optimization. This is more specific in | ||
180 | * intent than poking at uname or /proc/cpuinfo. | ||
181 | * For the moment, we have only optimizations for the Intel generations, | ||
182 | * but that could change... | ||
183 | */ | ||
184 | |||
185 | #define ELF_PLATFORM (NULL) | ||
186 | |||
187 | /* | ||
188 | * The Xtensa processor ABI says that when the program starts, a2 | ||
189 | * contains a pointer to a function which might be registered using | ||
190 | * `atexit'. This provides a mean for the dynamic linker to call | ||
191 | * DT_FINI functions for shared libraries that have been loaded before | ||
192 | * the code runs. | ||
193 | * | ||
194 | * A value of 0 tells we have no such handler. | ||
195 | * | ||
196 | * We might as well make sure everything else is cleared too (except | ||
197 | * for the stack pointer in a1), just to make things more | ||
198 | * deterministic. Also, clearing a0 terminates debugger backtraces. | ||
199 | */ | ||
200 | |||
201 | #define ELF_PLAT_INIT(_r, load_addr) \ | ||
202 | do { _r->areg[0]=0; /*_r->areg[1]=0;*/ _r->areg[2]=0; _r->areg[3]=0; \ | ||
203 | _r->areg[4]=0; _r->areg[5]=0; _r->areg[6]=0; _r->areg[7]=0; \ | ||
204 | _r->areg[8]=0; _r->areg[9]=0; _r->areg[10]=0; _r->areg[11]=0; \ | ||
205 | _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \ | ||
206 | } while (0) | ||
207 | |||
208 | #ifdef __KERNEL__ | ||
209 | |||
210 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) | ||
211 | |||
212 | extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*, | ||
213 | struct task_struct*); | ||
214 | extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*, | ||
215 | struct task_struct*); | ||
216 | extern void do_save_fpregs (elf_fpregset_t*, struct pt_regs*, | ||
217 | struct task_struct*); | ||
218 | extern int do_restore_fpregs (elf_fpregset_t*, struct pt_regs*, | ||
219 | struct task_struct*); | ||
220 | |||
221 | #endif /* __KERNEL__ */ | ||
222 | #endif /* _XTENSA_ELF_H */ | ||
diff --git a/include/asm-xtensa/errno.h b/include/asm-xtensa/errno.h new file mode 100644 index 000000000000..ced5194d2750 --- /dev/null +++ b/include/asm-xtensa/errno.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/errno.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_ERRNO_H | ||
12 | #define _XTENSA_ERRNO_H | ||
13 | |||
14 | #define EPERM 1 /* Operation not permitted */ | ||
15 | #define ENOENT 2 /* No such file or directory */ | ||
16 | #define ESRCH 3 /* No such process */ | ||
17 | #define EINTR 4 /* Interrupted system call */ | ||
18 | #define EIO 5 /* I/O error */ | ||
19 | #define ENXIO 6 /* No such device or address */ | ||
20 | #define E2BIG 7 /* Arg list too long */ | ||
21 | #define ENOEXEC 8 /* Exec format error */ | ||
22 | #define EBADF 9 /* Bad file number */ | ||
23 | #define ECHILD 10 /* No child processes */ | ||
24 | #define EAGAIN 11 /* Try again */ | ||
25 | #define ENOMEM 12 /* Out of memory */ | ||
26 | #define EACCES 13 /* Permission denied */ | ||
27 | #define EFAULT 14 /* Bad address */ | ||
28 | #define ENOTBLK 15 /* Block device required */ | ||
29 | #define EBUSY 16 /* Device or resource busy */ | ||
30 | #define EEXIST 17 /* File exists */ | ||
31 | #define EXDEV 18 /* Cross-device link */ | ||
32 | #define ENODEV 19 /* No such device */ | ||
33 | #define ENOTDIR 20 /* Not a directory */ | ||
34 | #define EISDIR 21 /* Is a directory */ | ||
35 | #define EINVAL 22 /* Invalid argument */ | ||
36 | #define ENFILE 23 /* File table overflow */ | ||
37 | #define EMFILE 24 /* Too many open files */ | ||
38 | #define ENOTTY 25 /* Not a typewriter */ | ||
39 | #define ETXTBSY 26 /* Text file busy */ | ||
40 | #define EFBIG 27 /* File too large */ | ||
41 | #define ENOSPC 28 /* No space left on device */ | ||
42 | #define ESPIPE 29 /* Illegal seek */ | ||
43 | #define EROFS 30 /* Read-only file system */ | ||
44 | #define EMLINK 31 /* Too many links */ | ||
45 | #define EPIPE 32 /* Broken pipe */ | ||
46 | #define EDOM 33 /* Math argument out of domain of func */ | ||
47 | #define ERANGE 34 /* Math result not representable */ | ||
48 | #define EDEADLK 35 /* Resource deadlock would occur */ | ||
49 | #define ENAMETOOLONG 36 /* File name too long */ | ||
50 | #define ENOLCK 37 /* No record locks available */ | ||
51 | #define ENOSYS 38 /* Function not implemented */ | ||
52 | #define ENOTEMPTY 39 /* Directory not empty */ | ||
53 | #define ELOOP 40 /* Too many symbolic links encountered */ | ||
54 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
55 | #define ENOMSG 42 /* No message of desired type */ | ||
56 | #define EIDRM 43 /* Identifier removed */ | ||
57 | #define ECHRNG 44 /* Channel number out of range */ | ||
58 | #define EL2NSYNC 45 /* Level 2 not synchronized */ | ||
59 | #define EL3HLT 46 /* Level 3 halted */ | ||
60 | #define EL3RST 47 /* Level 3 reset */ | ||
61 | #define ELNRNG 48 /* Link number out of range */ | ||
62 | #define EUNATCH 49 /* Protocol driver not attached */ | ||
63 | #define ENOCSI 50 /* No CSI structure available */ | ||
64 | #define EL2HLT 51 /* Level 2 halted */ | ||
65 | #define EBADE 52 /* Invalid exchange */ | ||
66 | #define EBADR 53 /* Invalid request descriptor */ | ||
67 | #define EXFULL 54 /* Exchange full */ | ||
68 | #define ENOANO 55 /* No anode */ | ||
69 | #define EBADRQC 56 /* Invalid request code */ | ||
70 | #define EBADSLT 57 /* Invalid slot */ | ||
71 | |||
72 | #define EDEADLOCK EDEADLK | ||
73 | |||
74 | #define EBFONT 59 /* Bad font file format */ | ||
75 | #define ENOSTR 60 /* Device not a stream */ | ||
76 | #define ENODATA 61 /* No data available */ | ||
77 | #define ETIME 62 /* Timer expired */ | ||
78 | #define ENOSR 63 /* Out of streams resources */ | ||
79 | #define ENONET 64 /* Machine is not on the network */ | ||
80 | #define ENOPKG 65 /* Package not installed */ | ||
81 | #define EREMOTE 66 /* Object is remote */ | ||
82 | #define ENOLINK 67 /* Link has been severed */ | ||
83 | #define EADV 68 /* Advertise error */ | ||
84 | #define ESRMNT 69 /* Srmount error */ | ||
85 | #define ECOMM 70 /* Communication error on send */ | ||
86 | #define EPROTO 71 /* Protocol error */ | ||
87 | #define EMULTIHOP 72 /* Multihop attempted */ | ||
88 | #define EDOTDOT 73 /* RFS specific error */ | ||
89 | #define EBADMSG 74 /* Not a data message */ | ||
90 | #define EOVERFLOW 75 /* Value too large for defined data type */ | ||
91 | #define ENOTUNIQ 76 /* Name not unique on network */ | ||
92 | #define EBADFD 77 /* File descriptor in bad state */ | ||
93 | #define EREMCHG 78 /* Remote address changed */ | ||
94 | #define ELIBACC 79 /* Can not access a needed shared library */ | ||
95 | #define ELIBBAD 80 /* Accessing a corrupted shared library */ | ||
96 | #define ELIBSCN 81 /* .lib section in a.out corrupted */ | ||
97 | #define ELIBMAX 82 /* Attempting to link in too many shared libraries */ | ||
98 | #define ELIBEXEC 83 /* Cannot exec a shared library directly */ | ||
99 | #define EILSEQ 84 /* Illegal byte sequence */ | ||
100 | #define ERESTART 85 /* Interrupted system call should be restarted */ | ||
101 | #define ESTRPIPE 86 /* Streams pipe error */ | ||
102 | #define EUSERS 87 /* Too many users */ | ||
103 | #define ENOTSOCK 88 /* Socket operation on non-socket */ | ||
104 | #define EDESTADDRREQ 89 /* Destination address required */ | ||
105 | #define EMSGSIZE 90 /* Message too long */ | ||
106 | #define EPROTOTYPE 91 /* Protocol wrong type for socket */ | ||
107 | #define ENOPROTOOPT 92 /* Protocol not available */ | ||
108 | #define EPROTONOSUPPORT 93 /* Protocol not supported */ | ||
109 | #define ESOCKTNOSUPPORT 94 /* Socket type not supported */ | ||
110 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | ||
111 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | ||
112 | #define EAFNOSUPPORT 97 /* Address family not supported by protocol */ | ||
113 | #define EADDRINUSE 98 /* Address already in use */ | ||
114 | #define EADDRNOTAVAIL 99 /* Cannot assign requested address */ | ||
115 | #define ENETDOWN 100 /* Network is down */ | ||
116 | #define ENETUNREACH 101 /* Network is unreachable */ | ||
117 | #define ENETRESET 102 /* Network dropped connection because of reset */ | ||
118 | #define ECONNABORTED 103 /* Software caused connection abort */ | ||
119 | #define ECONNRESET 104 /* Connection reset by peer */ | ||
120 | #define ENOBUFS 105 /* No buffer space available */ | ||
121 | #define EISCONN 106 /* Transport endpoint is already connected */ | ||
122 | #define ENOTCONN 107 /* Transport endpoint is not connected */ | ||
123 | #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ | ||
124 | #define ETOOMANYREFS 109 /* Too many references: cannot splice */ | ||
125 | #define ETIMEDOUT 110 /* Connection timed out */ | ||
126 | #define ECONNREFUSED 111 /* Connection refused */ | ||
127 | #define EHOSTDOWN 112 /* Host is down */ | ||
128 | #define EHOSTUNREACH 113 /* No route to host */ | ||
129 | #define EALREADY 114 /* Operation already in progress */ | ||
130 | #define EINPROGRESS 115 /* Operation now in progress */ | ||
131 | #define ESTALE 116 /* Stale NFS file handle */ | ||
132 | #define EUCLEAN 117 /* Structure needs cleaning */ | ||
133 | #define ENOTNAM 118 /* Not a XENIX named type file */ | ||
134 | #define ENAVAIL 119 /* No XENIX semaphores available */ | ||
135 | #define EISNAM 120 /* Is a named type file */ | ||
136 | #define EREMOTEIO 121 /* Remote I/O error */ | ||
137 | #define EDQUOT 122 /* Quota exceeded */ | ||
138 | |||
139 | #define ENOMEDIUM 123 /* No medium found */ | ||
140 | #define EMEDIUMTYPE 124 /* Wrong medium type */ | ||
141 | |||
142 | #endif /* _XTENSA_ERRNO_H */ | ||
diff --git a/include/asm-xtensa/fcntl.h b/include/asm-xtensa/fcntl.h new file mode 100644 index 000000000000..48876bb727d2 --- /dev/null +++ b/include/asm-xtensa/fcntl.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/fcntl.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle | ||
9 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_FCNTL_H | ||
13 | #define _XTENSA_FCNTL_H | ||
14 | |||
15 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
16 | located on an ext2 file system */ | ||
17 | #define O_ACCMODE 0x0003 | ||
18 | #define O_RDONLY 0x0000 | ||
19 | #define O_WRONLY 0x0001 | ||
20 | #define O_RDWR 0x0002 | ||
21 | #define O_APPEND 0x0008 | ||
22 | #define O_SYNC 0x0010 | ||
23 | #define O_NONBLOCK 0x0080 | ||
24 | #define O_CREAT 0x0100 /* not fcntl */ | ||
25 | #define O_TRUNC 0x0200 /* not fcntl */ | ||
26 | #define O_EXCL 0x0400 /* not fcntl */ | ||
27 | #define O_NOCTTY 0x0800 /* not fcntl */ | ||
28 | #define FASYNC 0x1000 /* fcntl, for BSD compatibility */ | ||
29 | #define O_LARGEFILE 0x2000 /* allow large file opens - currently ignored */ | ||
30 | #define O_DIRECT 0x8000 /* direct disk access hint - currently ignored*/ | ||
31 | #define O_DIRECTORY 0x10000 /* must be a directory */ | ||
32 | #define O_NOFOLLOW 0x20000 /* don't follow links */ | ||
33 | #define O_NOATIME 0x100000 | ||
34 | |||
35 | #define O_NDELAY O_NONBLOCK | ||
36 | |||
37 | #define F_DUPFD 0 /* dup */ | ||
38 | #define F_GETFD 1 /* get close_on_exec */ | ||
39 | #define F_SETFD 2 /* set/clear close_on_exec */ | ||
40 | #define F_GETFL 3 /* get file->f_flags */ | ||
41 | #define F_SETFL 4 /* set file->f_flags */ | ||
42 | #define F_GETLK 14 | ||
43 | #define F_GETLK64 15 | ||
44 | #define F_SETLK 6 | ||
45 | #define F_SETLKW 7 | ||
46 | #define F_SETLK64 16 | ||
47 | #define F_SETLKW64 17 | ||
48 | |||
49 | #define F_SETOWN 24 /* for sockets. */ | ||
50 | #define F_GETOWN 23 /* for sockets. */ | ||
51 | #define F_SETSIG 10 /* for sockets. */ | ||
52 | #define F_GETSIG 11 /* for sockets. */ | ||
53 | |||
54 | /* for F_[GET|SET]FL */ | ||
55 | #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ | ||
56 | |||
57 | /* for posix fcntl() and lockf() */ | ||
58 | #define F_RDLCK 0 | ||
59 | #define F_WRLCK 1 | ||
60 | #define F_UNLCK 2 | ||
61 | |||
62 | /* for old implementation of bsd flock () */ | ||
63 | #define F_EXLCK 4 /* or 3 */ | ||
64 | #define F_SHLCK 8 /* or 4 */ | ||
65 | |||
66 | /* for leases */ | ||
67 | #define F_INPROGRESS 16 | ||
68 | |||
69 | /* operations for bsd flock(), also used by the kernel implementation */ | ||
70 | #define LOCK_SH 1 /* shared lock */ | ||
71 | #define LOCK_EX 2 /* exclusive lock */ | ||
72 | #define LOCK_NB 4 /* or'd with one of the above to prevent | ||
73 | blocking */ | ||
74 | #define LOCK_UN 8 /* remove lock */ | ||
75 | |||
76 | #define LOCK_MAND 32 /* This is a mandatory flock ... */ | ||
77 | #define LOCK_READ 64 /* which allows concurrent read operations */ | ||
78 | #define LOCK_WRITE 128 /* which allows concurrent write operations */ | ||
79 | #define LOCK_RW 192 /* which allows concurrent read & write ops */ | ||
80 | |||
81 | typedef struct flock { | ||
82 | short l_type; | ||
83 | short l_whence; | ||
84 | __kernel_off_t l_start; | ||
85 | __kernel_off_t l_len; | ||
86 | long l_sysid; | ||
87 | __kernel_pid_t l_pid; | ||
88 | long pad[4]; | ||
89 | } flock_t; | ||
90 | |||
91 | struct flock64 { | ||
92 | short l_type; | ||
93 | short l_whence; | ||
94 | __kernel_off_t l_start; | ||
95 | __kernel_off_t l_len; | ||
96 | pid_t l_pid; | ||
97 | }; | ||
98 | |||
99 | #define F_LINUX_SPECIFIC_BASE 1024 | ||
100 | |||
101 | #endif /* _XTENSA_FCNTL_H */ | ||
diff --git a/include/asm-xtensa/fixmap.h b/include/asm-xtensa/fixmap.h new file mode 100644 index 000000000000..4423b8ad4954 --- /dev/null +++ b/include/asm-xtensa/fixmap.h | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/fixmap.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_FIXMAP_H | ||
12 | #define _XTENSA_FIXMAP_H | ||
13 | |||
14 | #include <asm/processor.h> | ||
15 | |||
16 | #ifdef CONFIG_MMU | ||
17 | |||
18 | /* | ||
19 | * Here we define all the compile-time virtual addresses. | ||
20 | */ | ||
21 | |||
22 | #if XCHAL_SEG_MAPPABLE_VADDR != 0 | ||
23 | # error "Current port requires virtual user space starting at 0" | ||
24 | #endif | ||
25 | #if XCHAL_SEG_MAPPABLE_SIZE < 0x80000000 | ||
26 | # error "Current port requires at least 0x8000000 bytes for user space" | ||
27 | #endif | ||
28 | |||
29 | /* Verify instruction/data ram/rom and xlmi don't overlay vmalloc space. */ | ||
30 | |||
31 | #define __IN_VMALLOC(addr) \ | ||
32 | (((addr) >= VMALLOC_START) && ((addr) < VMALLOC_END)) | ||
33 | #define __SPAN_VMALLOC(start,end) \ | ||
34 | (((start) < VMALLOC_START) && ((end) >= VMALLOC_END)) | ||
35 | #define INSIDE_VMALLOC(start,end) \ | ||
36 | (__IN_VMALLOC((start)) || __IN_VMALLOC(end) || __SPAN_VMALLOC((start),(end))) | ||
37 | |||
38 | #if XCHAL_NUM_INSTROM | ||
39 | # if XCHAL_NUM_INSTROM == 1 | ||
40 | # if INSIDE_VMALLOC(XCHAL_INSTROM0_VADDR,XCHAL_INSTROM0_VADDR+XCHAL_INSTROM0_SIZE) | ||
41 | # error vmalloc range conflicts with instrom0 | ||
42 | # endif | ||
43 | # endif | ||
44 | # if XCHAL_NUM_INSTROM == 2 | ||
45 | # if INSIDE_VMALLOC(XCHAL_INSTROM1_VADDR,XCHAL_INSTROM1_VADDR+XCHAL_INSTROM1_SIZE) | ||
46 | # error vmalloc range conflicts with instrom1 | ||
47 | # endif | ||
48 | # endif | ||
49 | #endif | ||
50 | |||
51 | #if XCHAL_NUM_INSTRAM | ||
52 | # if XCHAL_NUM_INSTRAM == 1 | ||
53 | # if INSIDE_VMALLOC(XCHAL_INSTRAM0_VADDR,XCHAL_INSTRAM0_VADDR+XCHAL_INSTRAM0_SIZE) | ||
54 | # error vmalloc range conflicts with instram0 | ||
55 | # endif | ||
56 | # endif | ||
57 | # if XCHAL_NUM_INSTRAM == 2 | ||
58 | # if INSIDE_VMALLOC(XCHAL_INSTRAM1_VADDR,XCHAL_INSTRAM1_VADDR+XCHAL_INSTRAM1_SIZE) | ||
59 | # error vmalloc range conflicts with instram1 | ||
60 | # endif | ||
61 | # endif | ||
62 | #endif | ||
63 | |||
64 | #if XCHAL_NUM_DATAROM | ||
65 | # if XCHAL_NUM_DATAROM == 1 | ||
66 | # if INSIDE_VMALLOC(XCHAL_DATAROM0_VADDR,XCHAL_DATAROM0_VADDR+XCHAL_DATAROM0_SIZE) | ||
67 | # error vmalloc range conflicts with datarom0 | ||
68 | # endif | ||
69 | # endif | ||
70 | # if XCHAL_NUM_DATAROM == 2 | ||
71 | # if INSIDE_VMALLOC(XCHAL_DATAROM1_VADDR,XCHAL_DATAROM1_VADDR+XCHAL_DATAROM1_SIZE) | ||
72 | # error vmalloc range conflicts with datarom1 | ||
73 | # endif | ||
74 | # endif | ||
75 | #endif | ||
76 | |||
77 | #if XCHAL_NUM_DATARAM | ||
78 | # if XCHAL_NUM_DATARAM == 1 | ||
79 | # if INSIDE_VMALLOC(XCHAL_DATARAM0_VADDR,XCHAL_DATARAM0_VADDR+XCHAL_DATARAM0_SIZE) | ||
80 | # error vmalloc range conflicts with dataram0 | ||
81 | # endif | ||
82 | # endif | ||
83 | # if XCHAL_NUM_DATARAM == 2 | ||
84 | # if INSIDE_VMALLOC(XCHAL_DATARAM1_VADDR,XCHAL_DATARAM1_VADDR+XCHAL_DATARAM1_SIZE) | ||
85 | # error vmalloc range conflicts with dataram1 | ||
86 | # endif | ||
87 | # endif | ||
88 | #endif | ||
89 | |||
90 | #if XCHAL_NUM_XLMI | ||
91 | # if XCHAL_NUM_XLMI == 1 | ||
92 | # if INSIDE_VMALLOC(XCHAL_XLMI0_VADDR,XCHAL_XLMI0_VADDR+XCHAL_XLMI0_SIZE) | ||
93 | # error vmalloc range conflicts with xlmi0 | ||
94 | # endif | ||
95 | # endif | ||
96 | # if XCHAL_NUM_XLMI == 2 | ||
97 | # if INSIDE_VMALLOC(XCHAL_XLMI1_VADDR,XCHAL_XLMI1_VADDR+XCHAL_XLMI1_SIZE) | ||
98 | # error vmalloc range conflicts with xlmi1 | ||
99 | # endif | ||
100 | # endif | ||
101 | #endif | ||
102 | |||
103 | #if (XCHAL_NUM_INSTROM > 2) || \ | ||
104 | (XCHAL_NUM_INSTRAM > 2) || \ | ||
105 | (XCHAL_NUM_DATARAM > 2) || \ | ||
106 | (XCHAL_NUM_DATAROM > 2) || \ | ||
107 | (XCHAL_NUM_XLMI > 2) | ||
108 | # error Insufficient checks on vmalloc above for more than 2 devices | ||
109 | #endif | ||
110 | |||
111 | /* | ||
112 | * USER_VM_SIZE does not necessarily equal TASK_SIZE. We bumped | ||
113 | * TASK_SIZE down to 0x4000000 to simplify the handling of windowed | ||
114 | * call instructions (currently limited to a range of 1 GByte). User | ||
115 | * tasks may very well reclaim the VM space from 0x40000000 to | ||
116 | * 0x7fffffff in the future, so we do not want the kernel becoming | ||
117 | * accustomed to having any of its stuff (e.g., page tables) in this | ||
118 | * region. This VM region is no-man's land for now. | ||
119 | */ | ||
120 | |||
121 | #define USER_VM_START XCHAL_SEG_MAPPABLE_VADDR | ||
122 | #define USER_VM_SIZE 0x80000000 | ||
123 | |||
124 | /* Size of page table: */ | ||
125 | |||
126 | #define PGTABLE_SIZE_BITS (32 - XCHAL_MMU_MIN_PTE_PAGE_SIZE + 2) | ||
127 | #define PGTABLE_SIZE (1L << PGTABLE_SIZE_BITS) | ||
128 | |||
129 | /* All kernel-mappable space: */ | ||
130 | |||
131 | #define KERNEL_ALLMAP_START (USER_VM_START + USER_VM_SIZE) | ||
132 | #define KERNEL_ALLMAP_SIZE (XCHAL_SEG_MAPPABLE_SIZE - KERNEL_ALLMAP_START) | ||
133 | |||
134 | /* Carve out page table at start of kernel-mappable area: */ | ||
135 | |||
136 | #if KERNEL_ALLMAP_SIZE < PGTABLE_SIZE | ||
137 | #error "Gimme some space for page table!" | ||
138 | #endif | ||
139 | #define PGTABLE_START KERNEL_ALLMAP_START | ||
140 | |||
141 | /* Remaining kernel-mappable space: */ | ||
142 | |||
143 | #define KERNEL_MAPPED_START (KERNEL_ALLMAP_START + PGTABLE_SIZE) | ||
144 | #define KERNEL_MAPPED_SIZE (KERNEL_ALLMAP_SIZE - PGTABLE_SIZE) | ||
145 | |||
146 | #if KERNEL_MAPPED_SIZE < 0x01000000 /* 16 MB is arbitrary for now */ | ||
147 | # error "Shouldn't the kernel have at least *some* mappable space?" | ||
148 | #endif | ||
149 | |||
150 | #define MAX_LOW_MEMORY XCHAL_KSEG_CACHED_SIZE | ||
151 | |||
152 | #endif | ||
153 | |||
154 | /* | ||
155 | * Some constants used elsewhere, but perhaps only in Xtensa header | ||
156 | * files, so maybe we can get rid of some and access compile-time HAL | ||
157 | * directly... | ||
158 | * | ||
159 | * Note: We assume that system RAM is located at the very start of the | ||
160 | * kernel segments !! | ||
161 | */ | ||
162 | #define KERNEL_VM_LOW XCHAL_KSEG_CACHED_VADDR | ||
163 | #define KERNEL_VM_HIGH XCHAL_KSEG_BYPASS_VADDR | ||
164 | #define KERNEL_SPACE XCHAL_KSEG_CACHED_VADDR | ||
165 | |||
166 | /* | ||
167 | * Returns the physical/virtual addresses of the kernel space | ||
168 | * (works with the cached kernel segment only, which is the | ||
169 | * one normally used for kernel operation). | ||
170 | */ | ||
171 | |||
172 | /* PHYSICAL BYPASS CACHED | ||
173 | * | ||
174 | * bypass vaddr bypass paddr * cached vaddr | ||
175 | * cached vaddr cached paddr bypass vaddr * | ||
176 | * bypass paddr * bypass vaddr cached vaddr | ||
177 | * cached paddr * bypass vaddr cached vaddr | ||
178 | * other * * * | ||
179 | */ | ||
180 | |||
181 | #define PHYSADDR(a) \ | ||
182 | (((unsigned)(a) >= XCHAL_KSEG_BYPASS_VADDR \ | ||
183 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_VADDR + XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
184 | (unsigned)(a) - XCHAL_KSEG_BYPASS_VADDR + XCHAL_KSEG_BYPASS_PADDR : \ | ||
185 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_VADDR \ | ||
186 | && (unsigned)(a) < XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_CACHED_SIZE) ? \ | ||
187 | (unsigned)(a) - XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_CACHED_PADDR : \ | ||
188 | (unsigned)(a)) | ||
189 | |||
190 | #define BYPASS_ADDR(a) \ | ||
191 | (((unsigned)(a) >= XCHAL_KSEG_BYPASS_PADDR \ | ||
192 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
193 | (unsigned)(a) - XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_BYPASS_VADDR : \ | ||
194 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_PADDR \ | ||
195 | && (unsigned)(a) < XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_CACHED_SIZE) ? \ | ||
196 | (unsigned)(a) - XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_BYPASS_VADDR : \ | ||
197 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_VADDR \ | ||
198 | && (unsigned)(a) < XCHAL_KSEG_CACHED_VADDR+XCHAL_KSEG_CACHED_SIZE)? \ | ||
199 | (unsigned)(a) - XCHAL_KSEG_CACHED_VADDR+XCHAL_KSEG_BYPASS_VADDR: \ | ||
200 | (unsigned)(a)) | ||
201 | |||
202 | #define CACHED_ADDR(a) \ | ||
203 | (((unsigned)(a) >= XCHAL_KSEG_BYPASS_PADDR \ | ||
204 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
205 | (unsigned)(a) - XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_CACHED_VADDR : \ | ||
206 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_PADDR \ | ||
207 | && (unsigned)(a) < XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_CACHED_SIZE) ? \ | ||
208 | (unsigned)(a) - XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_CACHED_VADDR : \ | ||
209 | ((unsigned)(a) >= XCHAL_KSEG_BYPASS_VADDR \ | ||
210 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_VADDR+XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
211 | (unsigned)(a) - XCHAL_KSEG_BYPASS_VADDR+XCHAL_KSEG_CACHED_VADDR : \ | ||
212 | (unsigned)(a)) | ||
213 | |||
214 | #define PHYSADDR_IO(a) \ | ||
215 | (((unsigned)(a) >= XCHAL_KIO_BYPASS_VADDR \ | ||
216 | && (unsigned)(a) < XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
217 | (unsigned)(a) - XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_BYPASS_PADDR : \ | ||
218 | ((unsigned)(a) >= XCHAL_KIO_CACHED_VADDR \ | ||
219 | && (unsigned)(a) < XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
220 | (unsigned)(a) - XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_CACHED_PADDR : \ | ||
221 | (unsigned)(a)) | ||
222 | |||
223 | #define BYPASS_ADDR_IO(a) \ | ||
224 | (((unsigned)(a) >= XCHAL_KIO_BYPASS_PADDR \ | ||
225 | && (unsigned)(a) < XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
226 | (unsigned)(a) - XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_BYPASS_VADDR : \ | ||
227 | ((unsigned)(a) >= XCHAL_KIO_CACHED_PADDR \ | ||
228 | && (unsigned)(a) < XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
229 | (unsigned)(a) - XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_BYPASS_VADDR : \ | ||
230 | ((unsigned)(a) >= XCHAL_KIO_CACHED_VADDR \ | ||
231 | && (unsigned)(a) < XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
232 | (unsigned)(a) - XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_BYPASS_VADDR : \ | ||
233 | (unsigned)(a)) | ||
234 | |||
235 | #define CACHED_ADDR_IO(a) \ | ||
236 | (((unsigned)(a) >= XCHAL_KIO_BYPASS_PADDR \ | ||
237 | && (unsigned)(a) < XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
238 | (unsigned)(a) - XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_CACHED_VADDR : \ | ||
239 | ((unsigned)(a) >= XCHAL_KIO_CACHED_PADDR \ | ||
240 | && (unsigned)(a) < XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
241 | (unsigned)(a) - XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_CACHED_VADDR : \ | ||
242 | ((unsigned)(a) >= XCHAL_KIO_BYPASS_VADDR \ | ||
243 | && (unsigned)(a) < XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
244 | (unsigned)(a) - XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_CACHED_VADDR : \ | ||
245 | (unsigned)(a)) | ||
246 | |||
247 | #endif /* _XTENSA_ADDRSPACE_H */ | ||
248 | |||
249 | |||
250 | |||
251 | |||
252 | |||
diff --git a/include/asm-xtensa/hardirq.h b/include/asm-xtensa/hardirq.h new file mode 100644 index 000000000000..e07c76c36b95 --- /dev/null +++ b/include/asm-xtensa/hardirq.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/hardirq.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_HARDIRQ_H | ||
12 | #define _XTENSA_HARDIRQ_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/cache.h> | ||
16 | #include <asm/irq.h> | ||
17 | |||
18 | /* headers.S is sensitive to the offsets of these fields */ | ||
19 | typedef struct { | ||
20 | unsigned int __softirq_pending; | ||
21 | unsigned int __syscall_count; | ||
22 | struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ | ||
23 | unsigned int __nmi_count; /* arch dependent */ | ||
24 | } ____cacheline_aligned irq_cpustat_t; | ||
25 | |||
26 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
27 | |||
28 | #endif /* _XTENSA_HARDIRQ_H */ | ||
diff --git a/include/asm-xtensa/hdreg.h b/include/asm-xtensa/hdreg.h new file mode 100644 index 000000000000..64b80607b80d --- /dev/null +++ b/include/asm-xtensa/hdreg.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/hdreg.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | * Copyright (C) 1994-1996 Linus Torvalds & authors | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_HDREG_H | ||
13 | #define _XTENSA_HDREG_H | ||
14 | |||
15 | typedef unsigned int ide_ioreg_t; | ||
16 | |||
17 | #endif | ||
diff --git a/include/asm-xtensa/highmem.h b/include/asm-xtensa/highmem.h new file mode 100644 index 000000000000..0a046ca5a687 --- /dev/null +++ b/include/asm-xtensa/highmem.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/highmem.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_HIGHMEM_H | ||
12 | #define _XTENSA_HIGHMEM_H | ||
13 | |||
14 | extern void flush_cache_kmaps(void); | ||
15 | |||
16 | #endif | ||
17 | |||
diff --git a/include/asm-xtensa/hw_irq.h b/include/asm-xtensa/hw_irq.h new file mode 100644 index 000000000000..ccf436249eaa --- /dev/null +++ b/include/asm-xtensa/hw_irq.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/hw_irq.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_HW_IRQ_H | ||
12 | #define _XTENSA_HW_IRQ_H | ||
13 | |||
14 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) | ||
15 | { | ||
16 | } | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-xtensa/ide.h b/include/asm-xtensa/ide.h new file mode 100644 index 000000000000..b523cd4a486e --- /dev/null +++ b/include/asm-xtensa/ide.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ide.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 1994 - 1996 Linus Torvalds & authors | ||
9 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_IDE_H | ||
13 | #define _XTENSA_IDE_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/config.h> | ||
18 | |||
19 | #ifndef MAX_HWIFS | ||
20 | # define MAX_HWIFS 1 | ||
21 | #endif | ||
22 | |||
23 | static __inline__ int ide_default_irq(unsigned long base) | ||
24 | { | ||
25 | /* Unsupported! */ | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | static __inline__ unsigned long ide_default_io_base(int index) | ||
30 | { | ||
31 | /* Unsupported! */ | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | #endif /* __KERNEL__ */ | ||
36 | #endif /* _XTENSA_IDE_H */ | ||
diff --git a/include/asm-xtensa/io.h b/include/asm-xtensa/io.h new file mode 100644 index 000000000000..2c471c42ecfc --- /dev/null +++ b/include/asm-xtensa/io.h | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/io.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IO_H | ||
12 | #define _XTENSA_IO_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | #include <linux/config.h> | ||
16 | #include <asm/byteorder.h> | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | #include <asm/fixmap.h> | ||
20 | |||
21 | #define _IO_BASE 0 | ||
22 | |||
23 | |||
24 | /* | ||
25 | * swap functions to change byte order from little-endian to big-endian and | ||
26 | * vice versa. | ||
27 | */ | ||
28 | |||
29 | static inline unsigned short _swapw (unsigned short v) | ||
30 | { | ||
31 | return (v << 8) | (v >> 8); | ||
32 | } | ||
33 | |||
34 | static inline unsigned int _swapl (unsigned int v) | ||
35 | { | ||
36 | return (v << 24) | ((v & 0xff00) << 8) | ((v >> 8) & 0xff00) | (v >> 24); | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Change virtual addresses to physical addresses and vv. | ||
41 | * These are trivial on the 1:1 Linux/Xtensa mapping | ||
42 | */ | ||
43 | |||
44 | extern inline unsigned long virt_to_phys(volatile void * address) | ||
45 | { | ||
46 | return PHYSADDR((unsigned long)address); | ||
47 | } | ||
48 | |||
49 | extern inline void * phys_to_virt(unsigned long address) | ||
50 | { | ||
51 | return (void*) CACHED_ADDR(address); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * IO bus memory addresses are also 1:1 with the physical address | ||
56 | */ | ||
57 | |||
58 | extern inline unsigned long virt_to_bus(volatile void * address) | ||
59 | { | ||
60 | return PHYSADDR((unsigned long)address); | ||
61 | } | ||
62 | |||
63 | extern inline void * bus_to_virt (unsigned long address) | ||
64 | { | ||
65 | return (void *) CACHED_ADDR(address); | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * Change "struct page" to physical address. | ||
70 | */ | ||
71 | |||
72 | extern inline void *ioremap(unsigned long offset, unsigned long size) | ||
73 | { | ||
74 | return (void *) CACHED_ADDR_IO(offset); | ||
75 | } | ||
76 | |||
77 | extern inline void *ioremap_nocache(unsigned long offset, unsigned long size) | ||
78 | { | ||
79 | return (void *) BYPASS_ADDR_IO(offset); | ||
80 | } | ||
81 | |||
82 | extern inline void iounmap(void *addr) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * Generic I/O | ||
88 | */ | ||
89 | |||
90 | #define readb(addr) \ | ||
91 | ({ unsigned char __v = (*(volatile unsigned char *)(addr)); __v; }) | ||
92 | #define readw(addr) \ | ||
93 | ({ unsigned short __v = (*(volatile unsigned short *)(addr)); __v; }) | ||
94 | #define readl(addr) \ | ||
95 | ({ unsigned int __v = (*(volatile unsigned int *)(addr)); __v; }) | ||
96 | #define writeb(b, addr) (void)((*(volatile unsigned char *)(addr)) = (b)) | ||
97 | #define writew(b, addr) (void)((*(volatile unsigned short *)(addr)) = (b)) | ||
98 | #define writel(b, addr) (void)((*(volatile unsigned int *)(addr)) = (b)) | ||
99 | |||
100 | static inline __u8 __raw_readb(const volatile void __iomem *addr) | ||
101 | { | ||
102 | return *(__force volatile __u8 *)(addr); | ||
103 | } | ||
104 | static inline __u16 __raw_readw(const volatile void __iomem *addr) | ||
105 | { | ||
106 | return *(__force volatile __u16 *)(addr); | ||
107 | } | ||
108 | static inline __u32 __raw_readl(const volatile void __iomem *addr) | ||
109 | { | ||
110 | return *(__force volatile __u32 *)(addr); | ||
111 | } | ||
112 | static inline void __raw_writeb(__u8 b, volatile void __iomem *addr) | ||
113 | { | ||
114 | *(__force volatile __u8 *)(addr) = b; | ||
115 | } | ||
116 | static inline void __raw_writew(__u16 b, volatile void __iomem *addr) | ||
117 | { | ||
118 | *(__force volatile __u16 *)(addr) = b; | ||
119 | } | ||
120 | static inline void __raw_writel(__u32 b, volatile void __iomem *addr) | ||
121 | { | ||
122 | *(__force volatile __u32 *)(addr) = b; | ||
123 | } | ||
124 | |||
125 | |||
126 | |||
127 | |||
128 | /* These are the definitions for the x86 IO instructions | ||
129 | * inb/inw/inl/outb/outw/outl, the "string" versions | ||
130 | * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions | ||
131 | * inb_p/inw_p/... | ||
132 | * The macros don't do byte-swapping. | ||
133 | */ | ||
134 | |||
135 | #define inb(port) readb((u8 *)((port)+_IO_BASE)) | ||
136 | #define outb(val, port) writeb((val),(u8 *)((unsigned long)(port)+_IO_BASE)) | ||
137 | #define inw(port) readw((u16 *)((port)+_IO_BASE)) | ||
138 | #define outw(val, port) writew((val),(u16 *)((unsigned long)(port)+_IO_BASE)) | ||
139 | #define inl(port) readl((u32 *)((port)+_IO_BASE)) | ||
140 | #define outl(val, port) writel((val),(u32 *)((unsigned long)(port))) | ||
141 | |||
142 | #define inb_p(port) inb((port)) | ||
143 | #define outb_p(val, port) outb((val), (port)) | ||
144 | #define inw_p(port) inw((port)) | ||
145 | #define outw_p(val, port) outw((val), (port)) | ||
146 | #define inl_p(port) inl((port)) | ||
147 | #define outl_p(val, port) outl((val), (port)) | ||
148 | |||
149 | extern void insb (unsigned long port, void *dst, unsigned long count); | ||
150 | extern void insw (unsigned long port, void *dst, unsigned long count); | ||
151 | extern void insl (unsigned long port, void *dst, unsigned long count); | ||
152 | extern void outsb (unsigned long port, const void *src, unsigned long count); | ||
153 | extern void outsw (unsigned long port, const void *src, unsigned long count); | ||
154 | extern void outsl (unsigned long port, const void *src, unsigned long count); | ||
155 | |||
156 | #define IO_SPACE_LIMIT ~0 | ||
157 | |||
158 | #define memset_io(a,b,c) memset((void *)(a),(b),(c)) | ||
159 | #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) | ||
160 | #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) | ||
161 | |||
162 | /* At this point the Xtensa doesn't provide byte swap instructions */ | ||
163 | |||
164 | #ifdef __XTENSA_EB__ | ||
165 | # define in_8(addr) (*(u8*)(addr)) | ||
166 | # define in_le16(addr) _swapw(*(u16*)(addr)) | ||
167 | # define in_le32(addr) _swapl(*(u32*)(addr)) | ||
168 | # define out_8(b, addr) *(u8*)(addr) = (b) | ||
169 | # define out_le16(b, addr) *(u16*)(addr) = _swapw(b) | ||
170 | # define out_le32(b, addr) *(u32*)(addr) = _swapl(b) | ||
171 | #elif defined(__XTENSA_EL__) | ||
172 | # define in_8(addr) (*(u8*)(addr)) | ||
173 | # define in_le16(addr) (*(u16*)(addr)) | ||
174 | # define in_le32(addr) (*(u32*)(addr)) | ||
175 | # define out_8(b, addr) *(u8*)(addr) = (b) | ||
176 | # define out_le16(b, addr) *(u16*)(addr) = (b) | ||
177 | # define out_le32(b, addr) *(u32*)(addr) = (b) | ||
178 | #else | ||
179 | # error processor byte order undefined! | ||
180 | #endif | ||
181 | |||
182 | |||
183 | /* | ||
184 | * * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
185 | * * access | ||
186 | * */ | ||
187 | #define xlate_dev_mem_ptr(p) __va(p) | ||
188 | |||
189 | /* | ||
190 | * * Convert a virtual cached pointer to an uncached pointer | ||
191 | * */ | ||
192 | #define xlate_dev_kmem_ptr(p) p | ||
193 | |||
194 | |||
195 | #endif /* __KERNEL__ */ | ||
196 | |||
197 | #endif /* _XTENSA_IO_H */ | ||
diff --git a/include/asm-xtensa/ioctl.h b/include/asm-xtensa/ioctl.h new file mode 100644 index 000000000000..856c605d62b1 --- /dev/null +++ b/include/asm-xtensa/ioctl.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ioctl.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Derived from "include/asm-i386/ioctl.h" | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_IOCTL_H | ||
14 | #define _XTENSA_IOCTL_H | ||
15 | |||
16 | |||
17 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
18 | * size of the parameter structure in the lower 14 bits of the | ||
19 | * upper 16 bits. | ||
20 | * Encoding the size of the parameter structure in the ioctl request | ||
21 | * is useful for catching programs compiled with old versions | ||
22 | * and to avoid overwriting user space outside the user buffer area. | ||
23 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
24 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * The following is for compatibility across the various Linux | ||
29 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
30 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
31 | * bits are indeed used as a type field, so we might just as well make | ||
32 | * this explicit here. Please be sure to use the decoding macros | ||
33 | * below from now on. | ||
34 | */ | ||
35 | #define _IOC_NRBITS 8 | ||
36 | #define _IOC_TYPEBITS 8 | ||
37 | #define _IOC_SIZEBITS 14 | ||
38 | #define _IOC_DIRBITS 2 | ||
39 | |||
40 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
41 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
42 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
43 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
44 | |||
45 | #define _IOC_NRSHIFT 0 | ||
46 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
47 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
48 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
49 | |||
50 | /* | ||
51 | * Direction bits. | ||
52 | */ | ||
53 | #define _IOC_NONE 0U | ||
54 | #define _IOC_WRITE 1U | ||
55 | #define _IOC_READ 2U | ||
56 | |||
57 | #define _IOC(dir,type,nr,size) \ | ||
58 | (((dir) << _IOC_DIRSHIFT) | \ | ||
59 | ((type) << _IOC_TYPESHIFT) | \ | ||
60 | ((nr) << _IOC_NRSHIFT) | \ | ||
61 | ((size) << _IOC_SIZESHIFT)) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif | ||
diff --git a/include/asm-xtensa/ioctls.h b/include/asm-xtensa/ioctls.h new file mode 100644 index 000000000000..10c443435c11 --- /dev/null +++ b/include/asm-xtensa/ioctls.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ioctl.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Derived from "include/asm-i386/ioctls.h" | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_IOCTLS_H | ||
14 | #define _XTENSA_IOCTLS_H | ||
15 | |||
16 | #include <asm/ioctl.h> | ||
17 | |||
18 | #define FIOCLEX _IO('f', 1) | ||
19 | #define FIONCLEX _IO('f', 2) | ||
20 | #define FIOASYNC _IOW('f', 125, int) | ||
21 | #define FIONBIO _IOW('f', 126, int) | ||
22 | #define FIONREAD _IOR('f', 127, int) | ||
23 | #define TIOCINQ FIONREAD | ||
24 | #define FIOQSIZE _IOR('f', 128, loff_t) | ||
25 | |||
26 | #define TCGETS 0x5401 | ||
27 | #define TCSETS 0x5402 | ||
28 | #define TCSETSW 0x5403 | ||
29 | #define TCSETSF 0x5404 | ||
30 | |||
31 | #define TCGETA _IOR('t', 23, struct termio) | ||
32 | #define TCSETA _IOW('t', 24, struct termio) | ||
33 | #define TCSETAW _IOW('t', 25, struct termio) | ||
34 | #define TCSETAF _IOW('t', 28, struct termio) | ||
35 | |||
36 | #define TCSBRK _IO('t', 29) | ||
37 | #define TCXONC _IO('t', 30) | ||
38 | #define TCFLSH _IO('t', 31) | ||
39 | |||
40 | #define TIOCSWINSZ _IOW('t', 103, struct winsize) | ||
41 | #define TIOCGWINSZ _IOR('t', 104, struct winsize) | ||
42 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ | ||
43 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ | ||
44 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ | ||
45 | |||
46 | #define TIOCSPGRP _IOW('t', 118, int) | ||
47 | #define TIOCGPGRP _IOR('t', 119, int) | ||
48 | |||
49 | #define TIOCEXCL _IO('T', 12) | ||
50 | #define TIOCNXCL _IO('T', 13) | ||
51 | #define TIOCSCTTY _IO('T', 14) | ||
52 | |||
53 | #define TIOCSTI _IOW('T', 18, char) | ||
54 | #define TIOCMGET _IOR('T', 21, unsigned int) | ||
55 | #define TIOCMBIS _IOW('T', 22, unsigned int) | ||
56 | #define TIOCMBIC _IOW('T', 23, unsigned int) | ||
57 | #define TIOCMSET _IOW('T', 24, unsigned int) | ||
58 | # define TIOCM_LE 0x001 | ||
59 | # define TIOCM_DTR 0x002 | ||
60 | # define TIOCM_RTS 0x004 | ||
61 | # define TIOCM_ST 0x008 | ||
62 | # define TIOCM_SR 0x010 | ||
63 | # define TIOCM_CTS 0x020 | ||
64 | # define TIOCM_CAR 0x040 | ||
65 | # define TIOCM_RNG 0x080 | ||
66 | # define TIOCM_DSR 0x100 | ||
67 | # define TIOCM_CD TIOCM_CAR | ||
68 | # define TIOCM_RI TIOCM_RNG | ||
69 | |||
70 | #define TIOCGSOFTCAR _IOR('T', 25, unsigned int) | ||
71 | #define TIOCSSOFTCAR _IOW('T', 26, unsigned int) | ||
72 | #define TIOCLINUX _IOW('T', 28, char) | ||
73 | #define TIOCCONS _IO('T', 29) | ||
74 | #define TIOCGSERIAL _IOR('T', 30, struct serial_struct) | ||
75 | #define TIOCSSERIAL _IOW('T', 31, struct serial_struct) | ||
76 | #define TIOCPKT _IOW('T', 32, int) | ||
77 | # define TIOCPKT_DATA 0 | ||
78 | # define TIOCPKT_FLUSHREAD 1 | ||
79 | # define TIOCPKT_FLUSHWRITE 2 | ||
80 | # define TIOCPKT_STOP 4 | ||
81 | # define TIOCPKT_START 8 | ||
82 | # define TIOCPKT_NOSTOP 16 | ||
83 | # define TIOCPKT_DOSTOP 32 | ||
84 | |||
85 | |||
86 | #define TIOCNOTTY _IO('T', 34) | ||
87 | #define TIOCSETD _IOW('T', 35, int) | ||
88 | #define TIOCGETD _IOR('T', 36, int) | ||
89 | #define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/ | ||
90 | #define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/ | ||
91 | #define TIOCSBRK _IO('T', 39) /* BSD compatibility */ | ||
92 | #define TIOCCBRK _IO('T', 40) /* BSD compatibility */ | ||
93 | #define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/ | ||
94 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | ||
95 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | ||
96 | |||
97 | #define TIOCSERCONFIG _IO('T', 83) | ||
98 | #define TIOCSERGWILD _IOR('T', 84, int) | ||
99 | #define TIOCSERSWILD _IOW('T', 85, int) | ||
100 | #define TIOCGLCKTRMIOS 0x5456 | ||
101 | #define TIOCSLCKTRMIOS 0x5457 | ||
102 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
103 | #define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */ | ||
104 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
105 | # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
106 | #define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */ | ||
107 | #define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ | ||
108 | |||
109 | #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ | ||
110 | #define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* read serial port inline interrupt counts */ | ||
111 | |||
112 | #endif /* _XTENSA_IOCTLS_H */ | ||
diff --git a/include/asm-xtensa/ipc.h b/include/asm-xtensa/ipc.h new file mode 100644 index 000000000000..d37bdb4d4c9c --- /dev/null +++ b/include/asm-xtensa/ipc.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ipc.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IPC_H | ||
12 | #define _XTENSA_IPC_H | ||
13 | |||
14 | struct ipc_kludge { | ||
15 | struct msgbuf __user *msgp; | ||
16 | long msgtyp; | ||
17 | }; | ||
18 | |||
19 | #define SEMOP 1 | ||
20 | #define SEMGET 2 | ||
21 | #define SEMCTL 3 | ||
22 | #define SEMTIMEDOP 4 | ||
23 | #define MSGSND 11 | ||
24 | #define MSGRCV 12 | ||
25 | #define MSGGET 13 | ||
26 | #define MSGCTL 14 | ||
27 | #define SHMAT 21 | ||
28 | #define SHMDT 22 | ||
29 | #define SHMGET 23 | ||
30 | #define SHMCTL 24 | ||
31 | |||
32 | #define IPCCALL(version,op) ((version)<<16 | (op)) | ||
33 | |||
34 | #endif /* _XTENSA_IPC_H */ | ||
diff --git a/include/asm-xtensa/ipcbuf.h b/include/asm-xtensa/ipcbuf.h new file mode 100644 index 000000000000..c33aa6a42145 --- /dev/null +++ b/include/asm-xtensa/ipcbuf.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ipcbuf.h | ||
3 | * | ||
4 | * The ipc64_perm structure for the Xtensa architecture. | ||
5 | * Note extra padding because this structure is passed back and forth | ||
6 | * between kernel and user space. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IPCBUF_H | ||
12 | #define _XTENSA_IPCBUF_H | ||
13 | |||
14 | /* | ||
15 | * Pad space is left for: | ||
16 | * - 32-bit mode_t and seq | ||
17 | * - 2 miscellaneous 32-bit values | ||
18 | * | ||
19 | * This file is subject to the terms and conditions of the GNU General | ||
20 | * Public License. See the file "COPYING" in the main directory of | ||
21 | * this archive for more details. | ||
22 | */ | ||
23 | |||
24 | struct ipc64_perm | ||
25 | { | ||
26 | __kernel_key_t key; | ||
27 | __kernel_uid32_t uid; | ||
28 | __kernel_gid32_t gid; | ||
29 | __kernel_uid32_t cuid; | ||
30 | __kernel_gid32_t cgid; | ||
31 | __kernel_mode_t mode; | ||
32 | unsigned long seq; | ||
33 | unsigned long __unused1; | ||
34 | unsigned long __unused2; | ||
35 | }; | ||
36 | |||
37 | #endif /* _XTENSA_IPCBUF_H */ | ||
diff --git a/include/asm-xtensa/irq.h b/include/asm-xtensa/irq.h new file mode 100644 index 000000000000..d984e955938f --- /dev/null +++ b/include/asm-xtensa/irq.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/irq.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IRQ_H | ||
12 | #define _XTENSA_IRQ_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <asm/platform/hardware.h> | ||
16 | |||
17 | #include <xtensa/config/core.h> | ||
18 | |||
19 | #ifndef PLATFORM_NR_IRQS | ||
20 | # define PLATFORM_NR_IRQS 0 | ||
21 | #endif | ||
22 | #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS | ||
23 | #define NR_IRQS (XTENSA_NR_IRQS + PLATFORM_NR_IRQS) | ||
24 | |||
25 | static __inline__ int irq_canonicalize(int irq) | ||
26 | { | ||
27 | return (irq); | ||
28 | } | ||
29 | |||
30 | struct irqaction; | ||
31 | #if 0 // FIXME | ||
32 | extern void disable_irq_nosync(unsigned int); | ||
33 | extern void disable_irq(unsigned int); | ||
34 | extern void enable_irq(unsigned int); | ||
35 | #endif | ||
36 | |||
37 | #endif /* _XTENSA_IRQ_H */ | ||
diff --git a/include/asm-xtensa/kmap_types.h b/include/asm-xtensa/kmap_types.h new file mode 100644 index 000000000000..9e822d2e3bce --- /dev/null +++ b/include/asm-xtensa/kmap_types.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/kmap_types.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_KMAP_TYPES_H | ||
12 | #define _XTENSA_KMAP_TYPES_H | ||
13 | |||
14 | enum km_type { | ||
15 | KM_BOUNCE_READ, | ||
16 | KM_SKB_SUNRPC_DATA, | ||
17 | KM_SKB_DATA_SOFTIRQ, | ||
18 | KM_USER0, | ||
19 | KM_USER1, | ||
20 | KM_BIO_SRC_IRQ, | ||
21 | KM_BIO_DST_IRQ, | ||
22 | KM_PTE0, | ||
23 | KM_PTE1, | ||
24 | KM_IRQ0, | ||
25 | KM_IRQ1, | ||
26 | KM_SOFTIRQ0, | ||
27 | KM_SOFTIRQ1, | ||
28 | KM_TYPE_NR | ||
29 | }; | ||
30 | |||
31 | #endif /* _XTENSA_KMAP_TYPES_H */ | ||
diff --git a/include/asm-xtensa/linkage.h b/include/asm-xtensa/linkage.h new file mode 100644 index 000000000000..bf2128a99d79 --- /dev/null +++ b/include/asm-xtensa/linkage.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/linkage.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_LINKAGE_H | ||
12 | #define _XTENSA_LINKAGE_H | ||
13 | |||
14 | /* Nothing to do here ... */ | ||
15 | |||
16 | #endif /* _XTENSA_LINKAGE_H */ | ||
diff --git a/include/asm-xtensa/local.h b/include/asm-xtensa/local.h new file mode 100644 index 000000000000..48723e550d14 --- /dev/null +++ b/include/asm-xtensa/local.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/local.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_LOCAL_H | ||
12 | #define _XTENSA_LOCAL_H | ||
13 | |||
14 | #include <asm-generic/local.h> | ||
15 | |||
16 | #endif /* _XTENSA_LOCAL_H */ | ||
diff --git a/include/asm-xtensa/mman.h b/include/asm-xtensa/mman.h new file mode 100644 index 000000000000..9a95a45df996 --- /dev/null +++ b/include/asm-xtensa/mman.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/mman.h | ||
3 | * | ||
4 | * Xtensa Processor memory-manager definitions | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 1995 by Ralf Baechle | ||
11 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
12 | */ | ||
13 | |||
14 | #ifndef _XTENSA_MMAN_H | ||
15 | #define _XTENSA_MMAN_H | ||
16 | |||
17 | /* | ||
18 | * Protections are chosen from these bits, OR'd together. The | ||
19 | * implementation does not necessarily support PROT_EXEC or PROT_WRITE | ||
20 | * without PROT_READ. The only guarantees are that no writing will be | ||
21 | * allowed without PROT_WRITE and no access will be allowed for PROT_NONE. | ||
22 | */ | ||
23 | |||
24 | #define PROT_NONE 0x0 /* page can not be accessed */ | ||
25 | #define PROT_READ 0x1 /* page can be read */ | ||
26 | #define PROT_WRITE 0x2 /* page can be written */ | ||
27 | #define PROT_EXEC 0x4 /* page can be executed */ | ||
28 | |||
29 | #define PROT_SEM 0x10 /* page may be used for atomic ops */ | ||
30 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ | ||
31 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end fo growsup vma */ | ||
32 | |||
33 | /* | ||
34 | * Flags for mmap | ||
35 | */ | ||
36 | #define MAP_SHARED 0x001 /* Share changes */ | ||
37 | #define MAP_PRIVATE 0x002 /* Changes are private */ | ||
38 | #define MAP_TYPE 0x00f /* Mask for type of mapping */ | ||
39 | #define MAP_FIXED 0x010 /* Interpret addr exactly */ | ||
40 | |||
41 | /* not used by linux, but here to make sure we don't clash with ABI defines */ | ||
42 | #define MAP_RENAME 0x020 /* Assign page to file */ | ||
43 | #define MAP_AUTOGROW 0x040 /* File may grow by writing */ | ||
44 | #define MAP_LOCAL 0x080 /* Copy on fork/sproc */ | ||
45 | #define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */ | ||
46 | |||
47 | /* These are linux-specific */ | ||
48 | #define MAP_NORESERVE 0x0400 /* don't check for reservations */ | ||
49 | #define MAP_ANONYMOUS 0x0800 /* don't use a file */ | ||
50 | #define MAP_GROWSDOWN 0x1000 /* stack-like segment */ | ||
51 | #define MAP_DENYWRITE 0x2000 /* ETXTBSY */ | ||
52 | #define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ | ||
53 | #define MAP_LOCKED 0x8000 /* pages are locked */ | ||
54 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ | ||
55 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ | ||
56 | |||
57 | /* | ||
58 | * Flags for msync | ||
59 | */ | ||
60 | #define MS_ASYNC 0x0001 /* sync memory asynchronously */ | ||
61 | #define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */ | ||
62 | #define MS_SYNC 0x0004 /* synchronous memory sync */ | ||
63 | |||
64 | /* | ||
65 | * Flags for mlockall | ||
66 | */ | ||
67 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
68 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
69 | |||
70 | #define MADV_NORMAL 0x0 /* default page-in behavior */ | ||
71 | #define MADV_RANDOM 0x1 /* page-in minimum required */ | ||
72 | #define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ | ||
73 | #define MADV_WILLNEED 0x3 /* pre-fault pages */ | ||
74 | #define MADV_DONTNEED 0x4 /* discard these pages */ | ||
75 | |||
76 | /* compatibility flags */ | ||
77 | #define MAP_ANON MAP_ANONYMOUS | ||
78 | #define MAP_FILE 0 | ||
79 | |||
80 | #endif /* _XTENSA_MMAN_H */ | ||
diff --git a/include/asm-xtensa/mmu.h b/include/asm-xtensa/mmu.h new file mode 100644 index 000000000000..44c5bb04c55c --- /dev/null +++ b/include/asm-xtensa/mmu.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/mmu.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_MMU_H | ||
12 | #define _XTENSA_MMU_H | ||
13 | |||
14 | /* Default "unsigned long" context */ | ||
15 | typedef unsigned long mm_context_t; | ||
16 | |||
17 | #endif /* _XTENSA_MMU_H */ | ||
diff --git a/include/asm-xtensa/mmu_context.h b/include/asm-xtensa/mmu_context.h new file mode 100644 index 000000000000..1b0801548cd9 --- /dev/null +++ b/include/asm-xtensa/mmu_context.h | |||
@@ -0,0 +1,330 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/mmu_context.h | ||
3 | * | ||
4 | * Switch an MMU context. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_MMU_CONTEXT_H | ||
14 | #define _XTENSA_MMU_CONTEXT_H | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/stringify.h> | ||
18 | |||
19 | #include <asm/pgtable.h> | ||
20 | #include <asm/mmu_context.h> | ||
21 | #include <asm/cacheflush.h> | ||
22 | #include <asm/tlbflush.h> | ||
23 | |||
24 | /* | ||
25 | * Linux was ported to Xtensa assuming all auto-refill ways in set 0 | ||
26 | * had the same properties (a very likely assumption). Multiple sets | ||
27 | * of auto-refill ways will still work properly, but not as optimally | ||
28 | * as the Xtensa designer may have assumed. | ||
29 | * | ||
30 | * We make this case a hard #error, killing the kernel build, to alert | ||
31 | * the developer to this condition (which is more likely an error). | ||
32 | * You super-duper clever developers can change it to a warning or | ||
33 | * remove it altogether if you think you know what you're doing. :) | ||
34 | */ | ||
35 | |||
36 | #if (XCHAL_HAVE_TLBS != 1) | ||
37 | # error "Linux must have an MMU!" | ||
38 | #endif | ||
39 | |||
40 | #if ((XCHAL_ITLB_ARF_WAYS == 0) || (XCHAL_DTLB_ARF_WAYS == 0)) | ||
41 | # error "MMU must have auto-refill ways" | ||
42 | #endif | ||
43 | |||
44 | #if ((XCHAL_ITLB_ARF_SETS != 1) || (XCHAL_DTLB_ARF_SETS != 1)) | ||
45 | # error Linux may not use all auto-refill ways as efficiently as you think | ||
46 | #endif | ||
47 | |||
48 | #if (XCHAL_MMU_MAX_PTE_PAGE_SIZE != XCHAL_MMU_MIN_PTE_PAGE_SIZE) | ||
49 | # error Only one page size allowed! | ||
50 | #endif | ||
51 | |||
52 | extern unsigned long asid_cache; | ||
53 | extern pgd_t *current_pgd; | ||
54 | |||
55 | /* | ||
56 | * Define the number of entries per auto-refill way in set 0 of both I and D | ||
57 | * TLBs. We deal only with set 0 here (an assumption further explained in | ||
58 | * assertions.h). Also, define the total number of ARF entries in both TLBs. | ||
59 | */ | ||
60 | |||
61 | #define ITLB_ENTRIES_PER_ARF_WAY (XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,ENTRIES)) | ||
62 | #define DTLB_ENTRIES_PER_ARF_WAY (XCHAL_DTLB_SET(XCHAL_DTLB_ARF_SET0,ENTRIES)) | ||
63 | |||
64 | #define ITLB_ENTRIES \ | ||
65 | (ITLB_ENTRIES_PER_ARF_WAY * (XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,WAYS))) | ||
66 | #define DTLB_ENTRIES \ | ||
67 | (DTLB_ENTRIES_PER_ARF_WAY * (XCHAL_DTLB_SET(XCHAL_DTLB_ARF_SET0,WAYS))) | ||
68 | |||
69 | |||
70 | /* | ||
71 | * SMALLEST_NTLB_ENTRIES is the smaller of ITLB_ENTRIES and DTLB_ENTRIES. | ||
72 | * In practice, they are probably equal. This macro simplifies function | ||
73 | * flush_tlb_range(). | ||
74 | */ | ||
75 | |||
76 | #if (DTLB_ENTRIES < ITLB_ENTRIES) | ||
77 | # define SMALLEST_NTLB_ENTRIES DTLB_ENTRIES | ||
78 | #else | ||
79 | # define SMALLEST_NTLB_ENTRIES ITLB_ENTRIES | ||
80 | #endif | ||
81 | |||
82 | |||
83 | /* | ||
84 | * asid_cache tracks only the ASID[USER_RING] field of the RASID special | ||
85 | * register, which is the current user-task asid allocation value. | ||
86 | * mm->context has the same meaning. When it comes time to write the | ||
87 | * asid_cache or mm->context values to the RASID special register, we first | ||
88 | * shift the value left by 8, then insert the value. | ||
89 | * ASID[0] always contains the kernel's asid value, and we reserve three | ||
90 | * other asid values that we never assign to user tasks. | ||
91 | */ | ||
92 | |||
93 | #define ASID_INC 0x1 | ||
94 | #define ASID_MASK ((1 << XCHAL_MMU_ASID_BITS) - 1) | ||
95 | |||
96 | /* | ||
97 | * XCHAL_MMU_ASID_INVALID is a configurable Xtensa processor constant | ||
98 | * indicating invalid address space. XCHAL_MMU_ASID_KERNEL is a configurable | ||
99 | * Xtensa processor constant indicating the kernel address space. They can | ||
100 | * be arbitrary values. | ||
101 | * | ||
102 | * We identify three more unique, reserved ASID values to use in the unused | ||
103 | * ring positions. No other user process will be assigned these reserved | ||
104 | * ASID values. | ||
105 | * | ||
106 | * For example, given that | ||
107 | * | ||
108 | * XCHAL_MMU_ASID_INVALID == 0 | ||
109 | * XCHAL_MMU_ASID_KERNEL == 1 | ||
110 | * | ||
111 | * the following maze of #if statements would generate | ||
112 | * | ||
113 | * ASID_RESERVED_1 == 2 | ||
114 | * ASID_RESERVED_2 == 3 | ||
115 | * ASID_RESERVED_3 == 4 | ||
116 | * ASID_FIRST_NONRESERVED == 5 | ||
117 | */ | ||
118 | |||
119 | #if (XCHAL_MMU_ASID_INVALID != XCHAL_MMU_ASID_KERNEL + 1) | ||
120 | # define ASID_RESERVED_1 ((XCHAL_MMU_ASID_KERNEL + 1) & ASID_MASK) | ||
121 | #else | ||
122 | # define ASID_RESERVED_1 ((XCHAL_MMU_ASID_KERNEL + 2) & ASID_MASK) | ||
123 | #endif | ||
124 | |||
125 | #if (XCHAL_MMU_ASID_INVALID != ASID_RESERVED_1 + 1) | ||
126 | # define ASID_RESERVED_2 ((ASID_RESERVED_1 + 1) & ASID_MASK) | ||
127 | #else | ||
128 | # define ASID_RESERVED_2 ((ASID_RESERVED_1 + 2) & ASID_MASK) | ||
129 | #endif | ||
130 | |||
131 | #if (XCHAL_MMU_ASID_INVALID != ASID_RESERVED_2 + 1) | ||
132 | # define ASID_RESERVED_3 ((ASID_RESERVED_2 + 1) & ASID_MASK) | ||
133 | #else | ||
134 | # define ASID_RESERVED_3 ((ASID_RESERVED_2 + 2) & ASID_MASK) | ||
135 | #endif | ||
136 | |||
137 | #if (XCHAL_MMU_ASID_INVALID != ASID_RESERVED_3 + 1) | ||
138 | # define ASID_FIRST_NONRESERVED ((ASID_RESERVED_3 + 1) & ASID_MASK) | ||
139 | #else | ||
140 | # define ASID_FIRST_NONRESERVED ((ASID_RESERVED_3 + 2) & ASID_MASK) | ||
141 | #endif | ||
142 | |||
143 | #define ASID_ALL_RESERVED ( ((ASID_RESERVED_1) << 24) + \ | ||
144 | ((ASID_RESERVED_2) << 16) + \ | ||
145 | ((ASID_RESERVED_3) << 8) + \ | ||
146 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
147 | |||
148 | |||
149 | /* | ||
150 | * NO_CONTEXT is the invalid ASID value that we don't ever assign to | ||
151 | * any user or kernel context. NO_CONTEXT is a better mnemonic than | ||
152 | * XCHAL_MMU_ASID_INVALID, so we use it in code instead. | ||
153 | */ | ||
154 | |||
155 | #define NO_CONTEXT XCHAL_MMU_ASID_INVALID | ||
156 | |||
157 | #if (KERNEL_RING != 0) | ||
158 | # error The KERNEL_RING really should be zero. | ||
159 | #endif | ||
160 | |||
161 | #if (USER_RING >= XCHAL_MMU_RINGS) | ||
162 | # error USER_RING cannot be greater than the highest numbered ring. | ||
163 | #endif | ||
164 | |||
165 | #if (USER_RING == KERNEL_RING) | ||
166 | # error The user and kernel rings really should not be equal. | ||
167 | #endif | ||
168 | |||
169 | #if (USER_RING == 1) | ||
170 | #define ASID_INSERT(x) ( ((ASID_RESERVED_1) << 24) + \ | ||
171 | ((ASID_RESERVED_2) << 16) + \ | ||
172 | (((x) & (ASID_MASK)) << 8) + \ | ||
173 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
174 | |||
175 | #elif (USER_RING == 2) | ||
176 | #define ASID_INSERT(x) ( ((ASID_RESERVED_1) << 24) + \ | ||
177 | (((x) & (ASID_MASK)) << 16) + \ | ||
178 | ((ASID_RESERVED_2) << 8) + \ | ||
179 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
180 | |||
181 | #elif (USER_RING == 3) | ||
182 | #define ASID_INSERT(x) ( (((x) & (ASID_MASK)) << 24) + \ | ||
183 | ((ASID_RESERVED_1) << 16) + \ | ||
184 | ((ASID_RESERVED_2) << 8) + \ | ||
185 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
186 | |||
187 | #else | ||
188 | #error Goofy value for USER_RING | ||
189 | |||
190 | #endif /* USER_RING == 1 */ | ||
191 | |||
192 | |||
193 | /* | ||
194 | * All unused by hardware upper bits will be considered | ||
195 | * as a software asid extension. | ||
196 | */ | ||
197 | |||
198 | #define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1))) | ||
199 | #define ASID_FIRST_VERSION \ | ||
200 | ((unsigned long)(~ASID_VERSION_MASK) + 1 + ASID_FIRST_NONRESERVED) | ||
201 | |||
202 | extern inline void set_rasid_register (unsigned long val) | ||
203 | { | ||
204 | __asm__ __volatile__ (" wsr %0, "__stringify(RASID)"\n\t" | ||
205 | " isync\n" : : "a" (val)); | ||
206 | } | ||
207 | |||
208 | extern inline unsigned long get_rasid_register (void) | ||
209 | { | ||
210 | unsigned long tmp; | ||
211 | __asm__ __volatile__ (" rsr %0, "__stringify(RASID)"\n\t" : "=a" (tmp)); | ||
212 | return tmp; | ||
213 | } | ||
214 | |||
215 | |||
216 | #if ((XCHAL_MMU_ASID_INVALID == 0) && (XCHAL_MMU_ASID_KERNEL == 1)) | ||
217 | |||
218 | extern inline void | ||
219 | get_new_mmu_context(struct mm_struct *mm, unsigned long asid) | ||
220 | { | ||
221 | extern void flush_tlb_all(void); | ||
222 | if (! ((asid += ASID_INC) & ASID_MASK) ) { | ||
223 | flush_tlb_all(); /* start new asid cycle */ | ||
224 | if (!asid) /* fix version if needed */ | ||
225 | asid = ASID_FIRST_VERSION - ASID_FIRST_NONRESERVED; | ||
226 | asid += ASID_FIRST_NONRESERVED; | ||
227 | } | ||
228 | mm->context = asid_cache = asid; | ||
229 | } | ||
230 | |||
231 | #else | ||
232 | #warning ASID_{INVALID,KERNEL} values impose non-optimal get_new_mmu_context implementation | ||
233 | |||
234 | /* XCHAL_MMU_ASID_INVALID == 0 and XCHAL_MMU_ASID_KERNEL ==1 are | ||
235 | really the best, but if you insist... */ | ||
236 | |||
237 | extern inline int validate_asid (unsigned long asid) | ||
238 | { | ||
239 | switch (asid) { | ||
240 | case XCHAL_MMU_ASID_INVALID: | ||
241 | case XCHAL_MMU_ASID_KERNEL: | ||
242 | case ASID_RESERVED_1: | ||
243 | case ASID_RESERVED_2: | ||
244 | case ASID_RESERVED_3: | ||
245 | return 0; /* can't use these values as ASIDs */ | ||
246 | } | ||
247 | return 1; /* valid */ | ||
248 | } | ||
249 | |||
250 | extern inline void | ||
251 | get_new_mmu_context(struct mm_struct *mm, unsigned long asid) | ||
252 | { | ||
253 | extern void flush_tlb_all(void); | ||
254 | while (1) { | ||
255 | asid += ASID_INC; | ||
256 | if ( ! (asid & ASID_MASK) ) { | ||
257 | flush_tlb_all(); /* start new asid cycle */ | ||
258 | if (!asid) /* fix version if needed */ | ||
259 | asid = ASID_FIRST_VERSION - ASID_FIRST_NONRESERVED; | ||
260 | asid += ASID_FIRST_NONRESERVED; | ||
261 | break; /* no need to validate here */ | ||
262 | } | ||
263 | if (validate_asid (asid & ASID_MASK)) | ||
264 | break; | ||
265 | } | ||
266 | mm->context = asid_cache = asid; | ||
267 | } | ||
268 | |||
269 | #endif | ||
270 | |||
271 | |||
272 | /* | ||
273 | * Initialize the context related info for a new mm_struct | ||
274 | * instance. | ||
275 | */ | ||
276 | |||
277 | extern inline int | ||
278 | init_new_context(struct task_struct *tsk, struct mm_struct *mm) | ||
279 | { | ||
280 | mm->context = NO_CONTEXT; | ||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
285 | struct task_struct *tsk) | ||
286 | { | ||
287 | unsigned long asid = asid_cache; | ||
288 | |||
289 | /* Check if our ASID is of an older version and thus invalid */ | ||
290 | |||
291 | if ((next->context ^ asid) & ASID_VERSION_MASK) | ||
292 | get_new_mmu_context(next, asid); | ||
293 | |||
294 | set_rasid_register (ASID_INSERT(next->context)); | ||
295 | invalidate_page_directory(); | ||
296 | } | ||
297 | |||
298 | #define deactivate_mm(tsk, mm) do { } while(0) | ||
299 | |||
300 | /* | ||
301 | * Destroy context related info for an mm_struct that is about | ||
302 | * to be put to rest. | ||
303 | */ | ||
304 | extern inline void destroy_context(struct mm_struct *mm) | ||
305 | { | ||
306 | /* Nothing to do. */ | ||
307 | } | ||
308 | |||
309 | /* | ||
310 | * After we have set current->mm to a new value, this activates | ||
311 | * the context for the new mm so we see the new mappings. | ||
312 | */ | ||
313 | extern inline void | ||
314 | activate_mm(struct mm_struct *prev, struct mm_struct *next) | ||
315 | { | ||
316 | /* Unconditionally get a new ASID. */ | ||
317 | |||
318 | get_new_mmu_context(next, asid_cache); | ||
319 | set_rasid_register (ASID_INSERT(next->context)); | ||
320 | invalidate_page_directory(); | ||
321 | } | ||
322 | |||
323 | |||
324 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
325 | { | ||
326 | /* Nothing to do. */ | ||
327 | |||
328 | } | ||
329 | |||
330 | #endif /* _XTENSA_MMU_CONTEXT_H */ | ||
diff --git a/include/asm-xtensa/module.h b/include/asm-xtensa/module.h new file mode 100644 index 000000000000..ffb25bfdf6a1 --- /dev/null +++ b/include/asm-xtensa/module.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/module.h | ||
3 | * | ||
4 | * This file contains the module code specific to the Xtensa architecture. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_MODULE_H | ||
14 | #define _XTENSA_MODULE_H | ||
15 | |||
16 | struct mod_arch_specific | ||
17 | { | ||
18 | /* Module support is not completely implemented. */ | ||
19 | }; | ||
20 | |||
21 | #define Elf_Shdr Elf32_Shdr | ||
22 | #define Elf_Sym Elf32_Sym | ||
23 | #define Elf_Ehdr Elf32_Ehdr | ||
24 | |||
25 | #endif /* _XTENSA_MODULE_H */ | ||
diff --git a/include/asm-xtensa/msgbuf.h b/include/asm-xtensa/msgbuf.h new file mode 100644 index 000000000000..693c96755280 --- /dev/null +++ b/include/asm-xtensa/msgbuf.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/msgbuf.h | ||
3 | * | ||
4 | * The msqid64_ds structure for the Xtensa architecture. | ||
5 | * Note extra padding because this structure is passed back and forth | ||
6 | * between kernel and user space. | ||
7 | * | ||
8 | * Pad space is left for: | ||
9 | * - 64-bit time_t to solve y2038 problem | ||
10 | * - 2 miscellaneous 32-bit values | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General | ||
13 | * Public License. See the file "COPYING" in the main directory of | ||
14 | * this archive for more details. | ||
15 | */ | ||
16 | |||
17 | #ifndef _XTENSA_MSGBUF_H | ||
18 | #define _XTENSA_MSGBUF_H | ||
19 | |||
20 | struct msqid64_ds { | ||
21 | struct ipc64_perm msg_perm; | ||
22 | #ifdef __XTENSA_EB__ | ||
23 | unsigned int __unused1; | ||
24 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
25 | unsigned int __unused2; | ||
26 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
27 | unsigned int __unused3; | ||
28 | __kernel_time_t msg_ctime; /* last change time */ | ||
29 | #elif defined(__XTENSA_EL__) | ||
30 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
31 | unsigned int __unused1; | ||
32 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
33 | unsigned int __unused2; | ||
34 | __kernel_time_t msg_ctime; /* last change time */ | ||
35 | unsigned int __unused3; | ||
36 | #else | ||
37 | # error processor byte order undefined! | ||
38 | #endif | ||
39 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
40 | unsigned long msg_qnum; /* number of messages in queue */ | ||
41 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
42 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
43 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
44 | unsigned long __unused4; | ||
45 | unsigned long __unused5; | ||
46 | }; | ||
47 | |||
48 | #endif /* _XTENSA_MSGBUF_H */ | ||
diff --git a/include/asm-xtensa/namei.h b/include/asm-xtensa/namei.h new file mode 100644 index 000000000000..3fdff039d27d --- /dev/null +++ b/include/asm-xtensa/namei.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/namei.h | ||
3 | * | ||
4 | * Included from linux/fs/namei.c | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_NAMEI_H | ||
14 | #define _XTENSA_NAMEI_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | /* This dummy routine maybe changed to something useful | ||
19 | * for /usr/gnemul/ emulation stuff. | ||
20 | * Look at asm-sparc/namei.h for details. | ||
21 | */ | ||
22 | |||
23 | #define __emul_prefix() NULL | ||
24 | |||
25 | #endif /* __KERNEL__ */ | ||
26 | #endif /* _XTENSA_NAMEI_H */ | ||
diff --git a/include/asm-xtensa/page.h b/include/asm-xtensa/page.h new file mode 100644 index 000000000000..b495e5b5a942 --- /dev/null +++ b/include/asm-xtensa/page.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/page.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PAGE_H | ||
12 | #define _XTENSA_PAGE_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | #include <linux/config.h> | ||
18 | |||
19 | /* | ||
20 | * PAGE_SHIFT determines the page size | ||
21 | * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary | ||
22 | */ | ||
23 | |||
24 | #define PAGE_SHIFT XCHAL_MMU_MIN_PTE_PAGE_SIZE | ||
25 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
26 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
27 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE - 1) & PAGE_MASK) | ||
28 | |||
29 | #define DCACHE_WAY_SIZE (XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS) | ||
30 | #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR | ||
31 | |||
32 | #ifdef __ASSEMBLY__ | ||
33 | |||
34 | #define __pgprot(x) (x) | ||
35 | |||
36 | #else | ||
37 | |||
38 | /* | ||
39 | * These are used to make use of C type-checking.. | ||
40 | */ | ||
41 | |||
42 | typedef struct { unsigned long pte; } pte_t; /* page table entry */ | ||
43 | typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */ | ||
44 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
45 | |||
46 | #define pte_val(x) ((x).pte) | ||
47 | #define pgd_val(x) ((x).pgd) | ||
48 | #define pgprot_val(x) ((x).pgprot) | ||
49 | |||
50 | #define __pte(x) ((pte_t) { (x) } ) | ||
51 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
52 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
53 | |||
54 | /* | ||
55 | * Pure 2^n version of get_order | ||
56 | */ | ||
57 | |||
58 | extern __inline__ int get_order(unsigned long size) | ||
59 | { | ||
60 | int order; | ||
61 | #ifndef XCHAL_HAVE_NSU | ||
62 | unsigned long x1, x2, x4, x8, x16; | ||
63 | |||
64 | size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
65 | x1 = size & 0xAAAAAAAA; | ||
66 | x2 = size & 0xCCCCCCCC; | ||
67 | x4 = size & 0xF0F0F0F0; | ||
68 | x8 = size & 0xFF00FF00; | ||
69 | x16 = size & 0xFFFF0000; | ||
70 | order = x2 ? 2 : 0; | ||
71 | order += (x16 != 0) * 16; | ||
72 | order += (x8 != 0) * 8; | ||
73 | order += (x4 != 0) * 4; | ||
74 | order += (x1 != 0); | ||
75 | |||
76 | return order; | ||
77 | #else | ||
78 | size = (size - 1) >> PAGE_SHIFT; | ||
79 | asm ("nsau %0, %1" : "=r" (order) : "r" (size)); | ||
80 | return 32 - order; | ||
81 | #endif | ||
82 | } | ||
83 | |||
84 | |||
85 | struct page; | ||
86 | extern void clear_page(void *page); | ||
87 | extern void copy_page(void *to, void *from); | ||
88 | |||
89 | /* | ||
90 | * If we have cache aliasing and writeback caches, we might have to do | ||
91 | * some extra work | ||
92 | */ | ||
93 | |||
94 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) | ||
95 | void clear_user_page(void *addr, unsigned long vaddr, struct page* page); | ||
96 | void copy_user_page(void *to,void* from,unsigned long vaddr,struct page* page); | ||
97 | #else | ||
98 | # define clear_user_page(page,vaddr,pg) clear_page(page) | ||
99 | # define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
100 | #endif | ||
101 | |||
102 | /* | ||
103 | * This handles the memory map. We handle pages at | ||
104 | * XCHAL_KSEG_CACHED_VADDR for kernels with 32 bit address space. | ||
105 | * These macros are for conversion of kernel address, not user | ||
106 | * addresses. | ||
107 | */ | ||
108 | |||
109 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) | ||
110 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | ||
111 | #define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) | ||
112 | #ifndef CONFIG_DISCONTIGMEM | ||
113 | # define pfn_to_page(pfn) (mem_map + (pfn)) | ||
114 | # define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
115 | #else | ||
116 | # error CONFIG_DISCONTIGMEM not supported | ||
117 | #endif | ||
118 | |||
119 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
120 | #define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) | ||
121 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
122 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
123 | |||
124 | #define WANT_PAGE_VIRTUAL | ||
125 | |||
126 | |||
127 | #endif /* __ASSEMBLY__ */ | ||
128 | |||
129 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
130 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
131 | |||
132 | #endif /* __KERNEL__ */ | ||
133 | #endif /* _XTENSA_PAGE_H */ | ||
diff --git a/include/asm-xtensa/page.h.n b/include/asm-xtensa/page.h.n new file mode 100644 index 000000000000..546cc6624f24 --- /dev/null +++ b/include/asm-xtensa/page.h.n | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/page.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PAGE_H | ||
12 | #define _XTENSA_PAGE_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | #include <linux/config.h> | ||
18 | |||
19 | /* | ||
20 | * PAGE_SHIFT determines the page size | ||
21 | * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary | ||
22 | */ | ||
23 | #define PAGE_SHIFT XCHAL_MMU_MIN_PTE_PAGE_SIZE | ||
24 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
25 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
26 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE - 1) & PAGE_MASK) | ||
27 | |||
28 | #define DCACHE_WAY_SIZE (XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS) | ||
29 | #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR | ||
30 | |||
31 | #ifdef __ASSEMBLY__ | ||
32 | |||
33 | #define __pgprot(x) (x) | ||
34 | |||
35 | #else | ||
36 | |||
37 | |||
38 | /* | ||
39 | * These are used to make use of C type-checking.. | ||
40 | */ | ||
41 | typedef struct { unsigned long pte; } pte_t; /* page table entry */ | ||
42 | typedef struct { unsigned long pmd; } pmd_t; /* PMD table entry */ | ||
43 | typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */ | ||
44 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
45 | |||
46 | #define pte_val(x) ((x).pte) | ||
47 | #define pmd_val(x) ((x).pmd) | ||
48 | #define pgd_val(x) ((x).pgd) | ||
49 | #define pgprot_val(x) ((x).pgprot) | ||
50 | |||
51 | #define __pte(x) ((pte_t) { (x) } ) | ||
52 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
53 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
54 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
55 | |||
56 | /* | ||
57 | * Pure 2^n version of get_order | ||
58 | */ | ||
59 | extern __inline__ int get_order(unsigned long size) | ||
60 | { | ||
61 | int order; | ||
62 | #ifndef XCHAL_HAVE_NSU | ||
63 | unsigned long x1, x2, x4, x8, x16; | ||
64 | |||
65 | size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
66 | x1 = size & 0xAAAAAAAA; | ||
67 | x2 = size & 0xCCCCCCCC; | ||
68 | x4 = size & 0xF0F0F0F0; | ||
69 | x8 = size & 0xFF00FF00; | ||
70 | x16 = size & 0xFFFF0000; | ||
71 | order = x2 ? 2 : 0; | ||
72 | order += (x16 != 0) * 16; | ||
73 | order += (x8 != 0) * 8; | ||
74 | order += (x4 != 0) * 4; | ||
75 | order += (x1 != 0); | ||
76 | |||
77 | return order; | ||
78 | #else | ||
79 | size = (size - 1) >> PAGE_SHIFT; | ||
80 | asm ("nsau %0, %1" : "=r" (order) : "r" (size)); | ||
81 | return 32 - order; | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | |||
86 | struct page; | ||
87 | extern void clear_page(void *page); | ||
88 | extern void copy_page(void *to, void *from); | ||
89 | |||
90 | /* | ||
91 | * If we have cache aliasing and writeback caches, we might have to do | ||
92 | * some extra work | ||
93 | */ | ||
94 | |||
95 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
96 | void clear_user_page(void *addr, unsigned long vaddr, struct page* page); | ||
97 | void copy_user_page(void *to, void* from, unsigned long vaddr, struct page* page); | ||
98 | #else | ||
99 | # define clear_user_page(page,vaddr,pg) clear_page(page) | ||
100 | # define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
101 | #endif | ||
102 | |||
103 | |||
104 | /* | ||
105 | * This handles the memory map. We handle pages at | ||
106 | * XCHAL_KSEG_CACHED_VADDR for kernels with 32 bit address space. | ||
107 | * These macros are for conversion of kernel address, not user | ||
108 | * addresses. | ||
109 | */ | ||
110 | |||
111 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) | ||
112 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | ||
113 | #define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) | ||
114 | #ifndef CONFIG_DISCONTIGMEM | ||
115 | # define pfn_to_page(pfn) (mem_map + (pfn)) | ||
116 | # define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
117 | #else | ||
118 | # error CONFIG_DISCONTIGMEM not supported | ||
119 | #endif | ||
120 | |||
121 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
122 | #define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) | ||
123 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
124 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
125 | |||
126 | #define WANT_PAGE_VIRTUAL | ||
127 | |||
128 | |||
129 | #endif /* __ASSEMBLY__ */ | ||
130 | |||
131 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
132 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
133 | |||
134 | #endif /* __KERNEL__ */ | ||
135 | #endif /* _XTENSA_PAGE_H */ | ||
diff --git a/include/asm-xtensa/param.h b/include/asm-xtensa/param.h new file mode 100644 index 000000000000..c0eec8260b0e --- /dev/null +++ b/include/asm-xtensa/param.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/param.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PARAM_H | ||
12 | #define _XTENSA_PARAM_H | ||
13 | |||
14 | #include <xtensa/config/core.h> | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | # define HZ 100 /* internal timer frequency */ | ||
18 | # define USER_HZ 100 /* for user interfaces in "ticks" */ | ||
19 | # define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */ | ||
20 | #endif | ||
21 | |||
22 | #define EXEC_PAGESIZE (1 << XCHAL_MMU_MIN_PTE_PAGE_SIZE) | ||
23 | |||
24 | #ifndef NGROUPS | ||
25 | #define NGROUPS 32 | ||
26 | #endif | ||
27 | |||
28 | #ifndef NOGROUP | ||
29 | #define NOGROUP (-1) | ||
30 | #endif | ||
31 | |||
32 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
33 | |||
34 | #endif /* _XTENSA_PARAM_H */ | ||
diff --git a/include/asm-xtensa/pci-bridge.h b/include/asm-xtensa/pci-bridge.h new file mode 100644 index 000000000000..00fcbd7c534a --- /dev/null +++ b/include/asm-xtensa/pci-bridge.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/pci-bridge.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PCI_BRIDGE_H | ||
12 | #define _XTENSA_PCI_BRIDGE_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | struct device_node; | ||
17 | struct pci_controller; | ||
18 | |||
19 | /* | ||
20 | * pciauto_bus_scan() enumerates the pci space. | ||
21 | */ | ||
22 | |||
23 | extern int pciauto_bus_scan(struct pci_controller *, int); | ||
24 | |||
25 | struct pci_space { | ||
26 | unsigned long start; | ||
27 | unsigned long end; | ||
28 | unsigned long base; | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * Structure of a PCI controller (host bridge) | ||
33 | */ | ||
34 | |||
35 | struct pci_controller { | ||
36 | int index; /* used for pci_controller_num */ | ||
37 | struct pci_controller *next; | ||
38 | struct pci_bus *bus; | ||
39 | void *arch_data; | ||
40 | |||
41 | int first_busno; | ||
42 | int last_busno; | ||
43 | |||
44 | struct pci_ops *ops; | ||
45 | volatile unsigned int *cfg_addr; | ||
46 | volatile unsigned char *cfg_data; | ||
47 | |||
48 | /* Currently, we limit ourselves to 1 IO range and 3 mem | ||
49 | * ranges since the common pci_bus structure can't handle more | ||
50 | */ | ||
51 | struct resource io_resource; | ||
52 | struct resource mem_resources[3]; | ||
53 | int mem_resource_count; | ||
54 | |||
55 | /* Host bridge I/O and Memory space | ||
56 | * Used for BAR placement algorithms | ||
57 | */ | ||
58 | struct pci_space io_space; | ||
59 | struct pci_space mem_space; | ||
60 | |||
61 | /* Return the interrupt number fo a device. */ | ||
62 | int (*map_irq)(struct pci_dev*, u8, u8); | ||
63 | |||
64 | }; | ||
65 | |||
66 | static inline void pcibios_init_resource(struct resource *res, | ||
67 | unsigned long start, unsigned long end, int flags, char *name) | ||
68 | { | ||
69 | res->start = start; | ||
70 | res->end = end; | ||
71 | res->flags = flags; | ||
72 | res->name = name; | ||
73 | res->parent = NULL; | ||
74 | res->sibling = NULL; | ||
75 | res->child = NULL; | ||
76 | } | ||
77 | |||
78 | |||
79 | /* These are used for config access before all the PCI probing has been done. */ | ||
80 | int early_read_config_byte(struct pci_controller*, int, int, int, u8*); | ||
81 | int early_read_config_word(struct pci_controller*, int, int, int, u16*); | ||
82 | int early_read_config_dword(struct pci_controller*, int, int, int, u32*); | ||
83 | int early_write_config_byte(struct pci_controller*, int, int, int, u8); | ||
84 | int early_write_config_word(struct pci_controller*, int, int, int, u16); | ||
85 | int early_write_config_dword(struct pci_controller*, int, int, int, u32); | ||
86 | |||
87 | #endif /* __KERNEL__ */ | ||
88 | #endif /* _XTENSA_PCI_BRIDGE_H */ | ||
diff --git a/include/asm-xtensa/pci.h b/include/asm-xtensa/pci.h new file mode 100644 index 000000000000..6817742301c2 --- /dev/null +++ b/include/asm-xtensa/pci.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/pci.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PCI_H | ||
12 | #define _XTENSA_PCI_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | /* Can be used to override the logic in pci_scan_bus for skipping | ||
17 | * already-configured bus numbers - to be used for buggy BIOSes | ||
18 | * or architectures with incomplete PCI setup by the loader | ||
19 | */ | ||
20 | |||
21 | #define pcibios_assign_all_busses() 0 | ||
22 | |||
23 | extern struct pci_controller* pcibios_alloc_controller(void); | ||
24 | |||
25 | extern inline void pcibios_set_master(struct pci_dev *dev) | ||
26 | { | ||
27 | /* No special bus mastering setup handling */ | ||
28 | } | ||
29 | |||
30 | extern inline void pcibios_penalize_isa_irq(int irq) | ||
31 | { | ||
32 | /* We don't do dynamic PCI IRQ allocation */ | ||
33 | } | ||
34 | |||
35 | /* Assume some values. (We should revise them, if necessary) */ | ||
36 | |||
37 | #define PCIBIOS_MIN_IO 0x2000 | ||
38 | #define PCIBIOS_MIN_MEM 0x10000000 | ||
39 | |||
40 | /* Dynamic DMA mapping stuff. | ||
41 | * Xtensa has everything mapped statically like x86. | ||
42 | */ | ||
43 | |||
44 | #include <linux/types.h> | ||
45 | #include <linux/slab.h> | ||
46 | #include <asm/scatterlist.h> | ||
47 | #include <linux/string.h> | ||
48 | #include <asm/io.h> | ||
49 | |||
50 | struct pci_dev; | ||
51 | |||
52 | /* The PCI address space does equal the physical memory address space. | ||
53 | * The networking and block device layers use this boolean for bounce buffer | ||
54 | * decisions. | ||
55 | */ | ||
56 | |||
57 | #define PCI_DMA_BUS_IS_PHYS (1) | ||
58 | |||
59 | /* pci_unmap_{page,single} is a no-op, so */ | ||
60 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | ||
61 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | ||
62 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) | ||
63 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
64 | #define pci_ubnmap_len(PTR, LEN_NAME) (0) | ||
65 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
66 | |||
67 | /* We cannot access memory above 4GB */ | ||
68 | #define pci_dac_dma_supported(pci_dev, mask) (0) | ||
69 | |||
70 | /* Map a range of PCI memory or I/O space for a device into user space */ | ||
71 | int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, | ||
72 | enum pci_mmap_state mmap_state, int write_combine); | ||
73 | |||
74 | /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ | ||
75 | #define HAVE_PCI_MMAP 1 | ||
76 | |||
77 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | #endif /* __KERNEL__ */ | ||
82 | |||
83 | /* Implement the pci_ DMA API in terms of the generic device dma_ one */ | ||
84 | #include <asm-generic/pci-dma-compat.h> | ||
85 | |||
86 | /* Generic PCI */ | ||
87 | #include <asm-generic/pci.h> | ||
88 | |||
89 | #endif /* _XTENSA_PCI_H */ | ||
diff --git a/include/asm-xtensa/percpu.h b/include/asm-xtensa/percpu.h new file mode 100644 index 000000000000..6d2bc2ada9d1 --- /dev/null +++ b/include/asm-xtensa/percpu.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/percpu.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PERCPU__ | ||
12 | #define _XTENSA_PERCPU__ | ||
13 | |||
14 | #include <asm-generic/percpu.h> | ||
15 | |||
16 | #endif /* _XTENSA_PERCPU__ */ | ||
diff --git a/include/asm-xtensa/pgalloc.h b/include/asm-xtensa/pgalloc.h new file mode 100644 index 000000000000..734a8d060395 --- /dev/null +++ b/include/asm-xtensa/pgalloc.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/pgalloc.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Copyright (C) 2001-2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PGALLOC_H | ||
12 | #define _XTENSA_PGALLOC_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/threads.h> | ||
18 | #include <linux/highmem.h> | ||
19 | #include <asm/processor.h> | ||
20 | #include <asm/cacheflush.h> | ||
21 | |||
22 | |||
23 | /* Cache aliasing: | ||
24 | * | ||
25 | * If the cache size for one way is greater than the page size, we have to | ||
26 | * deal with cache aliasing. The cache index is wider than the page size: | ||
27 | * | ||
28 | * |cache | | ||
29 | * |pgnum |page| virtual address | ||
30 | * |xxxxxX|zzzz| | ||
31 | * | | | | ||
32 | * \ / | | | ||
33 | * trans.| | | ||
34 | * / \ | | | ||
35 | * |yyyyyY|zzzz| physical address | ||
36 | * | ||
37 | * When the page number is translated to the physical page address, the lowest | ||
38 | * bit(s) (X) that are also part of the cache index are also translated (Y). | ||
39 | * If this translation changes this bit (X), the cache index is also afected, | ||
40 | * thus resulting in a different cache line than before. | ||
41 | * The kernel does not provide a mechanism to ensure that the page color | ||
42 | * (represented by this bit) remains the same when allocated or when pages | ||
43 | * are remapped. When user pages are mapped into kernel space, the color of | ||
44 | * the page might also change. | ||
45 | * | ||
46 | * We use the address space VMALLOC_END ... VMALLOC_END + DCACHE_WAY_SIZE * 2 | ||
47 | * to temporarily map a patch so we can match the color. | ||
48 | */ | ||
49 | |||
50 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) | ||
51 | # define PAGE_COLOR_MASK (PAGE_MASK & (DCACHE_WAY_SIZE-1)) | ||
52 | # define PAGE_COLOR(a) \ | ||
53 | (((unsigned long)(a)&PAGE_COLOR_MASK) >> PAGE_SHIFT) | ||
54 | # define PAGE_COLOR_EQ(a,b) \ | ||
55 | ((((unsigned long)(a) ^ (unsigned long)(b)) & PAGE_COLOR_MASK) == 0) | ||
56 | # define PAGE_COLOR_MAP0(v) \ | ||
57 | (VMALLOC_END + ((unsigned long)(v) & PAGE_COLOR_MASK)) | ||
58 | # define PAGE_COLOR_MAP1(v) \ | ||
59 | (VMALLOC_END + ((unsigned long)(v) & PAGE_COLOR_MASK) + DCACHE_WAY_SIZE) | ||
60 | #endif | ||
61 | |||
62 | /* | ||
63 | * Allocating and freeing a pmd is trivial: the 1-entry pmd is | ||
64 | * inside the pgd, so has no extra memory associated with it. | ||
65 | */ | ||
66 | |||
67 | #define pgd_free(pgd) free_page((unsigned long)(pgd)) | ||
68 | |||
69 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
70 | |||
71 | static inline void | ||
72 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *pte) | ||
73 | { | ||
74 | pmd_val(*(pmdp)) = (unsigned long)(pte); | ||
75 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (pmdp)); | ||
76 | } | ||
77 | |||
78 | static inline void | ||
79 | pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *page) | ||
80 | { | ||
81 | pmd_val(*(pmdp)) = (unsigned long)page_to_virt(page); | ||
82 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (pmdp)); | ||
83 | } | ||
84 | |||
85 | |||
86 | |||
87 | #else | ||
88 | |||
89 | # define pmd_populate_kernel(mm, pmdp, pte) \ | ||
90 | (pmd_val(*(pmdp)) = (unsigned long)(pte)) | ||
91 | # define pmd_populate(mm, pmdp, page) \ | ||
92 | (pmd_val(*(pmdp)) = (unsigned long)page_to_virt(page)) | ||
93 | |||
94 | #endif | ||
95 | |||
96 | static inline pgd_t* | ||
97 | pgd_alloc(struct mm_struct *mm) | ||
98 | { | ||
99 | pgd_t *pgd; | ||
100 | |||
101 | pgd = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, PGD_ORDER); | ||
102 | |||
103 | if (likely(pgd != NULL)) | ||
104 | __flush_dcache_page((unsigned long)pgd); | ||
105 | |||
106 | return pgd; | ||
107 | } | ||
108 | |||
109 | extern pte_t* pte_alloc_one_kernel(struct mm_struct* mm, unsigned long addr); | ||
110 | extern struct page* pte_alloc_one(struct mm_struct* mm, unsigned long addr); | ||
111 | |||
112 | #define pte_free_kernel(pte) free_page((unsigned long)pte) | ||
113 | #define pte_free(pte) __free_page(pte) | ||
114 | |||
115 | #endif /* __KERNEL__ */ | ||
116 | #endif /* _XTENSA_PGALLOC_H */ | ||
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h new file mode 100644 index 000000000000..0bb6416ae266 --- /dev/null +++ b/include/asm-xtensa/pgtable.h | |||
@@ -0,0 +1,468 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/page.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PGTABLE_H | ||
12 | #define _XTENSA_PGTABLE_H | ||
13 | |||
14 | #include <asm-generic/pgtable-nopmd.h> | ||
15 | #include <asm/page.h> | ||
16 | |||
17 | /* Assertions. */ | ||
18 | |||
19 | #ifdef CONFIG_MMU | ||
20 | |||
21 | |||
22 | #if (XCHAL_MMU_RINGS < 2) | ||
23 | # error Linux build assumes at least 2 ring levels. | ||
24 | #endif | ||
25 | |||
26 | #if (XCHAL_MMU_CA_BITS != 4) | ||
27 | # error We assume exactly four bits for CA. | ||
28 | #endif | ||
29 | |||
30 | #if (XCHAL_MMU_SR_BITS != 0) | ||
31 | # error We have no room for SR bits. | ||
32 | #endif | ||
33 | |||
34 | /* | ||
35 | * Use the first min-wired way for mapping page-table pages. | ||
36 | * Page coloring requires a second min-wired way. | ||
37 | */ | ||
38 | |||
39 | #if (XCHAL_DTLB_MINWIRED_SETS == 0) | ||
40 | # error Need a min-wired way for mapping page-table pages | ||
41 | #endif | ||
42 | |||
43 | #define DTLB_WAY_PGTABLE XCHAL_DTLB_SET(XCHAL_DTLB_MINWIRED_SET0, WAY) | ||
44 | |||
45 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
46 | # if XCHAL_DTLB_SET(XCHAL_DTLB_MINWIRED_SET0, WAYS) >= 2 | ||
47 | # define DTLB_WAY_DCACHE_ALIAS0 (DTLB_WAY_PGTABLE + 1) | ||
48 | # define DTLB_WAY_DCACHE_ALIAS1 (DTLB_WAY_PGTABLE + 2) | ||
49 | # else | ||
50 | # error Page coloring requires its own wired dtlb way! | ||
51 | # endif | ||
52 | #endif | ||
53 | |||
54 | #endif /* CONFIG_MMU */ | ||
55 | |||
56 | /* | ||
57 | * We only use two ring levels, user and kernel space. | ||
58 | */ | ||
59 | |||
60 | #define USER_RING 1 /* user ring level */ | ||
61 | #define KERNEL_RING 0 /* kernel ring level */ | ||
62 | |||
63 | /* | ||
64 | * The Xtensa architecture port of Linux has a two-level page table system, | ||
65 | * i.e. the logical three-level Linux page table layout are folded. | ||
66 | * Each task has the following memory page tables: | ||
67 | * | ||
68 | * PGD table (page directory), ie. 3rd-level page table: | ||
69 | * One page (4 kB) of 1024 (PTRS_PER_PGD) pointers to PTE tables | ||
70 | * (Architectures that don't have the PMD folded point to the PMD tables) | ||
71 | * | ||
72 | * The pointer to the PGD table for a given task can be retrieved from | ||
73 | * the task structure (struct task_struct*) t, e.g. current(): | ||
74 | * (t->mm ? t->mm : t->active_mm)->pgd | ||
75 | * | ||
76 | * PMD tables (page middle-directory), ie. 2nd-level page tables: | ||
77 | * Absent for the Xtensa architecture (folded, PTRS_PER_PMD == 1). | ||
78 | * | ||
79 | * PTE tables (page table entry), ie. 1st-level page tables: | ||
80 | * One page (4 kB) of 1024 (PTRS_PER_PTE) PTEs with a special PTE | ||
81 | * invalid_pte_table for absent mappings. | ||
82 | * | ||
83 | * The individual pages are 4 kB big with special pages for the empty_zero_page. | ||
84 | */ | ||
85 | #define PGDIR_SHIFT 22 | ||
86 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
87 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
88 | |||
89 | /* | ||
90 | * Entries per page directory level: we use two-level, so | ||
91 | * we don't really have any PMD directory physically. | ||
92 | */ | ||
93 | #define PTRS_PER_PTE 1024 | ||
94 | #define PTRS_PER_PTE_SHIFT 10 | ||
95 | #define PTRS_PER_PMD 1 | ||
96 | #define PTRS_PER_PGD 1024 | ||
97 | #define PGD_ORDER 0 | ||
98 | #define PMD_ORDER 0 | ||
99 | #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) | ||
100 | #define FIRST_USER_ADDRESS XCHAL_SEG_MAPPABLE_VADDR | ||
101 | #define FIRST_USER_PGD_NR (FIRST_USER_ADDRESS >> PGDIR_SHIFT) | ||
102 | |||
103 | /* virtual memory area. We keep a distance to other memory regions to be | ||
104 | * on the safe side. We also use this area for cache aliasing. | ||
105 | */ | ||
106 | |||
107 | // FIXME: virtual memory area must be configuration-dependent | ||
108 | |||
109 | #define VMALLOC_START 0xC0000000 | ||
110 | #define VMALLOC_END 0xC7FF0000 | ||
111 | |||
112 | /* Xtensa Linux config PTE layout (when present): | ||
113 | * 31-12: PPN | ||
114 | * 11-6: Software | ||
115 | * 5-4: RING | ||
116 | * 3-0: CA | ||
117 | * | ||
118 | * Similar to the Alpha and MIPS ports, we need to keep track of the ref | ||
119 | * and mod bits in software. We have a software "you can read | ||
120 | * from this page" bit, and a hardware one which actually lets the | ||
121 | * process read from the page. On the same token we have a software | ||
122 | * writable bit and the real hardware one which actually lets the | ||
123 | * process write to the page. | ||
124 | * | ||
125 | * See further below for PTE layout for swapped-out pages. | ||
126 | */ | ||
127 | |||
128 | #define _PAGE_VALID (1<<0) /* hardware: page is accessible */ | ||
129 | #define _PAGE_WRENABLE (1<<1) /* hardware: page is writable */ | ||
130 | |||
131 | /* None of these cache modes include MP coherency: */ | ||
132 | #define _PAGE_NO_CACHE (0<<2) /* bypass, non-speculative */ | ||
133 | #if XCHAL_DCACHE_IS_WRITEBACK | ||
134 | # define _PAGE_WRITEBACK (1<<2) /* write back */ | ||
135 | # define _PAGE_WRITETHRU (2<<2) /* write through */ | ||
136 | #else | ||
137 | # define _PAGE_WRITEBACK (1<<2) /* assume write through */ | ||
138 | # define _PAGE_WRITETHRU (1<<2) | ||
139 | #endif | ||
140 | #define _PAGE_NOALLOC (3<<2) /* don't allocate cache,if not cached */ | ||
141 | #define _CACHE_MASK (3<<2) | ||
142 | |||
143 | #define _PAGE_USER (1<<4) /* user access (ring=1) */ | ||
144 | #define _PAGE_KERNEL (0<<4) /* kernel access (ring=0) */ | ||
145 | |||
146 | /* Software */ | ||
147 | #define _PAGE_RW (1<<6) /* software: page writable */ | ||
148 | #define _PAGE_DIRTY (1<<7) /* software: page dirty */ | ||
149 | #define _PAGE_ACCESSED (1<<8) /* software: page accessed (read) */ | ||
150 | #define _PAGE_FILE (1<<9) /* nonlinear file mapping*/ | ||
151 | |||
152 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _CACHE_MASK | _PAGE_DIRTY) | ||
153 | #define _PAGE_PRESENT ( _PAGE_VALID | _PAGE_WRITEBACK | _PAGE_ACCESSED) | ||
154 | |||
155 | #ifdef CONFIG_MMU | ||
156 | |||
157 | # define PAGE_NONE __pgprot(_PAGE_PRESENT) | ||
158 | # define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_RW) | ||
159 | # define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER) | ||
160 | # define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER) | ||
161 | # define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_KERNEL | _PAGE_WRENABLE) | ||
162 | # define PAGE_INVALID __pgprot(_PAGE_USER) | ||
163 | |||
164 | # if (DCACHE_WAY_SIZE > PAGE_SIZE) | ||
165 | # define PAGE_DIRECTORY __pgprot(_PAGE_VALID | _PAGE_ACCESSED | _PAGE_KERNEL) | ||
166 | # else | ||
167 | # define PAGE_DIRECTORY __pgprot(_PAGE_PRESENT | _PAGE_KERNEL) | ||
168 | # endif | ||
169 | |||
170 | #else /* no mmu */ | ||
171 | |||
172 | # define PAGE_NONE __pgprot(0) | ||
173 | # define PAGE_SHARED __pgprot(0) | ||
174 | # define PAGE_COPY __pgprot(0) | ||
175 | # define PAGE_READONLY __pgprot(0) | ||
176 | # define PAGE_KERNEL __pgprot(0) | ||
177 | |||
178 | #endif | ||
179 | |||
180 | /* | ||
181 | * On certain configurations of Xtensa MMUs (eg. the initial Linux config), | ||
182 | * the MMU can't do page protection for execute, and considers that the same as | ||
183 | * read. Also, write permissions may imply read permissions. | ||
184 | * What follows is the closest we can get by reasonable means.. | ||
185 | * See linux/mm/mmap.c for protection_map[] array that uses these definitions. | ||
186 | */ | ||
187 | #define __P000 PAGE_NONE /* private --- */ | ||
188 | #define __P001 PAGE_READONLY /* private --r */ | ||
189 | #define __P010 PAGE_COPY /* private -w- */ | ||
190 | #define __P011 PAGE_COPY /* private -wr */ | ||
191 | #define __P100 PAGE_READONLY /* private x-- */ | ||
192 | #define __P101 PAGE_READONLY /* private x-r */ | ||
193 | #define __P110 PAGE_COPY /* private xw- */ | ||
194 | #define __P111 PAGE_COPY /* private xwr */ | ||
195 | |||
196 | #define __S000 PAGE_NONE /* shared --- */ | ||
197 | #define __S001 PAGE_READONLY /* shared --r */ | ||
198 | #define __S010 PAGE_SHARED /* shared -w- */ | ||
199 | #define __S011 PAGE_SHARED /* shared -wr */ | ||
200 | #define __S100 PAGE_READONLY /* shared x-- */ | ||
201 | #define __S101 PAGE_READONLY /* shared x-r */ | ||
202 | #define __S110 PAGE_SHARED /* shared xw- */ | ||
203 | #define __S111 PAGE_SHARED /* shared xwr */ | ||
204 | |||
205 | #ifndef __ASSEMBLY__ | ||
206 | |||
207 | #define pte_ERROR(e) \ | ||
208 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
209 | #define pgd_ERROR(e) \ | ||
210 | printk("%s:%d: bad pgd entry %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | ||
211 | |||
212 | extern unsigned long empty_zero_page[1024]; | ||
213 | |||
214 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | ||
215 | |||
216 | extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; | ||
217 | |||
218 | /* | ||
219 | * The pmd contains the kernel virtual address of the pte page. | ||
220 | */ | ||
221 | #define pmd_page_kernel(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK)) | ||
222 | #define pmd_page(pmd) virt_to_page(pmd_val(pmd)) | ||
223 | |||
224 | /* | ||
225 | * The following only work if pte_present() is true. | ||
226 | */ | ||
227 | #define pte_none(pte) (!(pte_val(pte) ^ _PAGE_USER)) | ||
228 | #define pte_present(pte) (pte_val(pte) & _PAGE_VALID) | ||
229 | #define pte_clear(mm,addr,ptep) \ | ||
230 | do { update_pte(ptep, __pte(_PAGE_USER)); } while(0) | ||
231 | |||
232 | #define pmd_none(pmd) (!pmd_val(pmd)) | ||
233 | #define pmd_present(pmd) (pmd_val(pmd) & PAGE_MASK) | ||
234 | #define pmd_clear(pmdp) do { set_pmd(pmdp, __pmd(0)); } while (0) | ||
235 | #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) | ||
236 | |||
237 | /* Note: We use the _PAGE_USER bit to indicate write-protect kernel memory */ | ||
238 | |||
239 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
240 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | ||
241 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | ||
242 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | ||
243 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | ||
244 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; } | ||
245 | static inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } | ||
246 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } | ||
247 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | ||
248 | static inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } | ||
249 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } | ||
250 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } | ||
251 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } | ||
252 | |||
253 | /* | ||
254 | * Conversion functions: convert a page and protection to a page entry, | ||
255 | * and a page entry and page directory to the page they refer to. | ||
256 | */ | ||
257 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) | ||
258 | #define pte_same(a,b) (pte_val(a) == pte_val(b)) | ||
259 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
260 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
261 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) | ||
262 | |||
263 | extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
264 | { | ||
265 | return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)); | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * Certain architectures need to do special things when pte's | ||
270 | * within a page table are directly modified. Thus, the following | ||
271 | * hook is made available. | ||
272 | */ | ||
273 | static inline void update_pte(pte_t *ptep, pte_t pteval) | ||
274 | { | ||
275 | *ptep = pteval; | ||
276 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
277 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (ptep)); | ||
278 | #endif | ||
279 | } | ||
280 | |||
281 | extern inline void | ||
282 | set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) | ||
283 | { | ||
284 | update_pte(ptep, pteval); | ||
285 | } | ||
286 | |||
287 | |||
288 | extern inline void | ||
289 | set_pmd(pmd_t *pmdp, pmd_t pmdval) | ||
290 | { | ||
291 | *pmdp = pmdval; | ||
292 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
293 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (pmdp)); | ||
294 | #endif | ||
295 | } | ||
296 | |||
297 | |||
298 | static inline int | ||
299 | ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, | ||
300 | pte_t *ptep) | ||
301 | { | ||
302 | pte_t pte = *ptep; | ||
303 | if (!pte_young(pte)) | ||
304 | return 0; | ||
305 | update_pte(ptep, pte_mkold(pte)); | ||
306 | return 1; | ||
307 | } | ||
308 | |||
309 | static inline int | ||
310 | ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, | ||
311 | pte_t *ptep) | ||
312 | { | ||
313 | pte_t pte = *ptep; | ||
314 | if (!pte_dirty(pte)) | ||
315 | return 0; | ||
316 | update_pte(ptep, pte_mkclean(pte)); | ||
317 | return 1; | ||
318 | } | ||
319 | |||
320 | static inline pte_t | ||
321 | ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
322 | { | ||
323 | pte_t pte = *ptep; | ||
324 | pte_clear(mm, addr, ptep); | ||
325 | return pte; | ||
326 | } | ||
327 | |||
328 | static inline void | ||
329 | ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
330 | { | ||
331 | pte_t pte = *ptep; | ||
332 | update_pte(ptep, pte_wrprotect(pte)); | ||
333 | } | ||
334 | |||
335 | /* to find an entry in a kernel page-table-directory */ | ||
336 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
337 | |||
338 | /* to find an entry in a page-table-directory */ | ||
339 | #define pgd_offset(mm,address) ((mm)->pgd + pgd_index(address)) | ||
340 | |||
341 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | ||
342 | |||
343 | /* Find an entry in the second-level page table.. */ | ||
344 | #define pmd_offset(dir,address) ((pmd_t*)(dir)) | ||
345 | |||
346 | /* Find an entry in the third-level page table.. */ | ||
347 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
348 | #define pte_offset_kernel(dir,addr) \ | ||
349 | ((pte_t*) pmd_page_kernel(*(dir)) + pte_index(addr)) | ||
350 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) | ||
351 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr)) | ||
352 | |||
353 | #define pte_unmap(pte) do { } while (0) | ||
354 | #define pte_unmap_nested(pte) do { } while (0) | ||
355 | |||
356 | |||
357 | /* | ||
358 | * Encode and decode a swap entry. | ||
359 | * Each PTE in a process VM's page table is either: | ||
360 | * "present" -- valid and not swapped out, protection bits are meaningful; | ||
361 | * "not present" -- which further subdivides in these two cases: | ||
362 | * "none" -- no mapping at all; identified by pte_none(), set by pte_clear( | ||
363 | * "swapped out" -- the page is swapped out, and the SWP macros below | ||
364 | * are used to store swap file info in the PTE itself. | ||
365 | * | ||
366 | * In the Xtensa processor MMU, any PTE entries in user space (or anywhere | ||
367 | * in virtual memory that can map differently across address spaces) | ||
368 | * must have a correct ring value that represents the RASID field that | ||
369 | * is changed when switching address spaces. Eg. such PTE entries cannot | ||
370 | * be set to ring zero, because that can cause a (global) kernel ASID | ||
371 | * entry to be created in the TLBs (even with invalid cache attribute), | ||
372 | * potentially causing a multihit exception when going back to another | ||
373 | * address space that mapped the same virtual address at another ring. | ||
374 | * | ||
375 | * SO: we avoid using ring bits (_PAGE_RING_MASK) in "not present" PTEs. | ||
376 | * We also avoid using the _PAGE_VALID bit which must be zero for non-present | ||
377 | * pages. | ||
378 | * | ||
379 | * We end up with the following available bits: 1..3 and 7..31. | ||
380 | * We don't bother with 1..3 for now (we can use them later if needed), | ||
381 | * and chose to allocate 6 bits for SWP_TYPE and the remaining 19 bits | ||
382 | * for SWP_OFFSET. At least 5 bits are needed for SWP_TYPE, because it | ||
383 | * is currently implemented as an index into swap_info[MAX_SWAPFILES] | ||
384 | * and MAX_SWAPFILES is currently defined as 32 in <linux/swap.h>. | ||
385 | * However, for some reason all other architectures in the 2.4 kernel | ||
386 | * reserve either 6, 7, or 8 bits so I'll not detract from that for now. :) | ||
387 | * SWP_OFFSET is an offset into the swap file in page-size units, so | ||
388 | * with 4 kB pages, 19 bits supports a maximum swap file size of 2 GB. | ||
389 | * | ||
390 | * FIXME: 2 GB isn't very big. Other bits can be used to allow | ||
391 | * larger swap sizes. In the meantime, it appears relatively easy to get | ||
392 | * around the 2 GB limitation by simply using multiple swap files. | ||
393 | */ | ||
394 | |||
395 | #define __swp_type(entry) (((entry).val >> 7) & 0x3f) | ||
396 | #define __swp_offset(entry) ((entry).val >> 13) | ||
397 | #define __swp_entry(type,offs) ((swp_entry_t) {((type) << 7) | ((offs) << 13)}) | ||
398 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
399 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
400 | |||
401 | #define PTE_FILE_MAX_BITS 29 | ||
402 | #define pte_to_pgoff(pte) (pte_val(pte) >> 3) | ||
403 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE }) | ||
404 | |||
405 | |||
406 | #endif /* !defined (__ASSEMBLY__) */ | ||
407 | |||
408 | |||
409 | #ifdef __ASSEMBLY__ | ||
410 | |||
411 | /* Assembly macro _PGD_INDEX is the same as C pgd_index(unsigned long), | ||
412 | * _PGD_OFFSET as C pgd_offset(struct mm_struct*, unsigned long), | ||
413 | * _PMD_OFFSET as C pmd_offset(pgd_t*, unsigned long) | ||
414 | * _PTE_OFFSET as C pte_offset(pmd_t*, unsigned long) | ||
415 | * | ||
416 | * Note: We require an additional temporary register which can be the same as | ||
417 | * the register that holds the address. | ||
418 | * | ||
419 | * ((pte_t*) ((unsigned long)(pmd_val(*pmd) & PAGE_MASK)) + pte_index(addr)) | ||
420 | * | ||
421 | */ | ||
422 | #define _PGD_INDEX(rt,rs) extui rt, rs, PGDIR_SHIFT, 32-PGDIR_SHIFT | ||
423 | #define _PTE_INDEX(rt,rs) extui rt, rs, PAGE_SHIFT, PTRS_PER_PTE_SHIFT | ||
424 | |||
425 | #define _PGD_OFFSET(mm,adr,tmp) l32i mm, mm, MM_PGD; \ | ||
426 | _PGD_INDEX(tmp, adr); \ | ||
427 | addx4 mm, tmp, mm | ||
428 | |||
429 | #define _PTE_OFFSET(pmd,adr,tmp) _PTE_INDEX(tmp, adr); \ | ||
430 | srli pmd, pmd, PAGE_SHIFT; \ | ||
431 | slli pmd, pmd, PAGE_SHIFT; \ | ||
432 | addx4 pmd, tmp, pmd | ||
433 | |||
434 | #else | ||
435 | |||
436 | extern void paging_init(void); | ||
437 | |||
438 | #define kern_addr_valid(addr) (1) | ||
439 | |||
440 | extern void update_mmu_cache(struct vm_area_struct * vma, | ||
441 | unsigned long address, pte_t pte); | ||
442 | |||
443 | /* | ||
444 | * remap a physical address `phys' of size `size' with page protection `prot' | ||
445 | * into virtual address `from' | ||
446 | */ | ||
447 | #define io_remap_page_range(vma,from,phys,size,prot) \ | ||
448 | remap_pfn_range(vma, from, (phys) >> PAGE_SHIFT, size, prot) | ||
449 | |||
450 | |||
451 | /* No page table caches to init */ | ||
452 | |||
453 | #define pgtable_cache_init() do { } while (0) | ||
454 | |||
455 | typedef pte_t *pte_addr_t; | ||
456 | |||
457 | #endif /* !defined (__ASSEMBLY__) */ | ||
458 | |||
459 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | ||
460 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | ||
461 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | ||
462 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | ||
463 | #define __HAVE_ARCH_PTEP_MKDIRTY | ||
464 | #define __HAVE_ARCH_PTE_SAME | ||
465 | |||
466 | #include <asm-generic/pgtable.h> | ||
467 | |||
468 | #endif /* _XTENSA_PGTABLE_H */ | ||
diff --git a/include/asm-xtensa/platform-iss/hardware.h b/include/asm-xtensa/platform-iss/hardware.h new file mode 100644 index 000000000000..22240f001803 --- /dev/null +++ b/include/asm-xtensa/platform-iss/hardware.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/platform-iss/hardware.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * This file contains the default configuration of ISS. | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_XTENSA_ISS_HARDWARE | ||
16 | #define __ASM_XTENSA_ISS_HARDWARE | ||
17 | |||
18 | /* | ||
19 | * Memory configuration. | ||
20 | */ | ||
21 | |||
22 | #define PLATFORM_DEFAULT_MEM_START XSHAL_RAM_PADDR | ||
23 | #define PLATFORM_DEFAULT_MEM_SIZE XSHAL_RAM_VSIZE | ||
24 | |||
25 | /* | ||
26 | * Interrupt configuration. | ||
27 | */ | ||
28 | |||
29 | #endif /* __ASM_XTENSA_ISS_HARDWARE */ | ||
diff --git a/include/asm-xtensa/platform.h b/include/asm-xtensa/platform.h new file mode 100644 index 000000000000..36163894bc20 --- /dev/null +++ b/include/asm-xtensa/platform.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/platform.h | ||
3 | * | ||
4 | * Platform specific functions | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General | ||
7 | * Public License. See the file "COPYING" in the main directory of | ||
8 | * this archive for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_PLATFORM_H | ||
14 | #define _XTENSA_PLATFORM_H | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/pci.h> | ||
19 | |||
20 | #include <asm/bootparam.h> | ||
21 | |||
22 | /* | ||
23 | * platform_init is called before the mmu is initialized to give the | ||
24 | * platform a early hook-up. bp_tag_t is a list of configuration tags | ||
25 | * passed from the boot-loader. | ||
26 | */ | ||
27 | extern void platform_init(bp_tag_t*); | ||
28 | |||
29 | /* | ||
30 | * platform_setup is called from setup_arch with a pointer to the command-line | ||
31 | * string. | ||
32 | */ | ||
33 | extern void platform_setup (char **); | ||
34 | |||
35 | /* | ||
36 | * platform_init_irq is called from init_IRQ. | ||
37 | */ | ||
38 | extern void platform_init_irq (void); | ||
39 | |||
40 | /* | ||
41 | * platform_restart is called to restart the system. | ||
42 | */ | ||
43 | extern void platform_restart (void); | ||
44 | |||
45 | /* | ||
46 | * platform_halt is called to stop the system and halt. | ||
47 | */ | ||
48 | extern void platform_halt (void); | ||
49 | |||
50 | /* | ||
51 | * platform_power_off is called to stop the system and power it off. | ||
52 | */ | ||
53 | extern void platform_power_off (void); | ||
54 | |||
55 | /* | ||
56 | * platform_idle is called from the idle function. | ||
57 | */ | ||
58 | extern void platform_idle (void); | ||
59 | |||
60 | /* | ||
61 | * platform_heartbeat is called every HZ | ||
62 | */ | ||
63 | extern void platform_heartbeat (void); | ||
64 | |||
65 | /* | ||
66 | * platform_pcibios_init is called to allow the platform to setup the pci bus. | ||
67 | */ | ||
68 | extern void platform_pcibios_init (void); | ||
69 | |||
70 | /* | ||
71 | * platform_pcibios_fixup allows to modify the PCI configuration. | ||
72 | */ | ||
73 | extern int platform_pcibios_fixup (void); | ||
74 | |||
75 | /* | ||
76 | * platform_calibrate_ccount calibrates cpu clock freq (CONFIG_XTENSA_CALIBRATE) | ||
77 | */ | ||
78 | extern void platform_calibrate_ccount (void); | ||
79 | |||
80 | /* | ||
81 | * platform_get_rtc_time returns RTC seconds (returns 0 for no error) | ||
82 | */ | ||
83 | extern int platform_get_rtc_time(time_t*); | ||
84 | |||
85 | /* | ||
86 | * platform_set_rtc_time set RTC seconds (returns 0 for no error) | ||
87 | */ | ||
88 | extern int platform_set_rtc_time(time_t); | ||
89 | |||
90 | |||
91 | #endif /* _XTENSA_PLATFORM_H */ | ||
92 | |||
diff --git a/include/asm-xtensa/poll.h b/include/asm-xtensa/poll.h new file mode 100644 index 000000000000..dffe447534e0 --- /dev/null +++ b/include/asm-xtensa/poll.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/poll.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_POLL_H | ||
12 | #define _XTENSA_POLL_H | ||
13 | |||
14 | |||
15 | #define POLLIN 0x0001 | ||
16 | #define POLLPRI 0x0002 | ||
17 | #define POLLOUT 0x0004 | ||
18 | |||
19 | #define POLLERR 0x0008 | ||
20 | #define POLLHUP 0x0010 | ||
21 | #define POLLNVAL 0x0020 | ||
22 | |||
23 | #define POLLRDNORM 0x0040 | ||
24 | #define POLLRDBAND 0x0080 | ||
25 | #define POLLWRNORM POLLOUT | ||
26 | #define POLLWRBAND 0x0100 | ||
27 | |||
28 | #define POLLMSG 0x0400 | ||
29 | #define POLLREMOVE 0x0800 | ||
30 | |||
31 | struct pollfd { | ||
32 | int fd; | ||
33 | short events; | ||
34 | short revents; | ||
35 | }; | ||
36 | |||
37 | #endif /* _XTENSA_POLL_H */ | ||
diff --git a/include/asm-xtensa/posix_types.h b/include/asm-xtensa/posix_types.h new file mode 100644 index 000000000000..2c816b0e7762 --- /dev/null +++ b/include/asm-xtensa/posix_types.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/posix_types.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Largely copied from include/asm-ppc/posix_types.h | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_POSIX_TYPES_H | ||
14 | #define _XTENSA_POSIX_TYPES_H | ||
15 | |||
16 | /* | ||
17 | * This file is generally used by user-level software, so you need to | ||
18 | * be a little careful about namespace pollution etc. Also, we cannot | ||
19 | * assume GCC is being used. | ||
20 | */ | ||
21 | |||
22 | typedef unsigned long __kernel_ino_t; | ||
23 | typedef unsigned int __kernel_mode_t; | ||
24 | typedef unsigned short __kernel_nlink_t; | ||
25 | typedef long __kernel_off_t; | ||
26 | typedef int __kernel_pid_t; | ||
27 | typedef unsigned short __kernel_ipc_pid_t; | ||
28 | typedef unsigned int __kernel_uid_t; | ||
29 | typedef unsigned int __kernel_gid_t; | ||
30 | typedef unsigned int __kernel_size_t; | ||
31 | typedef int __kernel_ssize_t; | ||
32 | typedef long __kernel_ptrdiff_t; | ||
33 | typedef long __kernel_time_t; | ||
34 | typedef long __kernel_suseconds_t; | ||
35 | typedef long __kernel_clock_t; | ||
36 | typedef int __kernel_timer_t; | ||
37 | typedef int __kernel_clockid_t; | ||
38 | typedef int __kernel_daddr_t; | ||
39 | typedef char * __kernel_caddr_t; | ||
40 | typedef unsigned short __kernel_uid16_t; | ||
41 | typedef unsigned short __kernel_gid16_t; | ||
42 | typedef unsigned int __kernel_uid32_t; | ||
43 | typedef unsigned int __kernel_gid32_t; | ||
44 | |||
45 | typedef unsigned short __kernel_old_uid_t; | ||
46 | typedef unsigned short __kernel_old_gid_t; | ||
47 | typedef unsigned short __kernel_old_dev_t; | ||
48 | |||
49 | #ifdef __GNUC__ | ||
50 | typedef long long __kernel_loff_t; | ||
51 | #endif | ||
52 | |||
53 | typedef struct { | ||
54 | int val[2]; | ||
55 | } __kernel_fsid_t; | ||
56 | |||
57 | #ifndef __GNUC__ | ||
58 | |||
59 | #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) | ||
60 | #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) | ||
61 | #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) | ||
62 | #define __FD_ZERO(set) \ | ||
63 | ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set))) | ||
64 | |||
65 | #else /* __GNUC__ */ | ||
66 | |||
67 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \ | ||
68 | || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0) | ||
69 | /* With GNU C, use inline functions instead so args are evaluated only once: */ | ||
70 | |||
71 | #undef __FD_SET | ||
72 | static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) | ||
73 | { | ||
74 | unsigned long _tmp = fd / __NFDBITS; | ||
75 | unsigned long _rem = fd % __NFDBITS; | ||
76 | fdsetp->fds_bits[_tmp] |= (1UL<<_rem); | ||
77 | } | ||
78 | |||
79 | #undef __FD_CLR | ||
80 | static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) | ||
81 | { | ||
82 | unsigned long _tmp = fd / __NFDBITS; | ||
83 | unsigned long _rem = fd % __NFDBITS; | ||
84 | fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); | ||
85 | } | ||
86 | |||
87 | #undef __FD_ISSET | ||
88 | static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p) | ||
89 | { | ||
90 | unsigned long _tmp = fd / __NFDBITS; | ||
91 | unsigned long _rem = fd % __NFDBITS; | ||
92 | return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * This will unroll the loop for the normal constant case (8 ints, | ||
97 | * for a 256-bit fd_set) | ||
98 | */ | ||
99 | #undef __FD_ZERO | ||
100 | static __inline__ void __FD_ZERO(__kernel_fd_set *p) | ||
101 | { | ||
102 | unsigned int *tmp = (unsigned int *)p->fds_bits; | ||
103 | int i; | ||
104 | |||
105 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
106 | switch (__FDSET_LONGS) { | ||
107 | case 8: | ||
108 | tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0; | ||
109 | tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; | ||
110 | return; | ||
111 | } | ||
112 | } | ||
113 | i = __FDSET_LONGS; | ||
114 | while (i) { | ||
115 | i--; | ||
116 | *tmp = 0; | ||
117 | tmp++; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | ||
122 | #endif /* __GNUC__ */ | ||
123 | #endif /* _XTENSA_POSIX_TYPES_H */ | ||
diff --git a/include/asm-xtensa/processor.h b/include/asm-xtensa/processor.h new file mode 100644 index 000000000000..9cab5e4298b9 --- /dev/null +++ b/include/asm-xtensa/processor.h | |||
@@ -0,0 +1,205 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/processor.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PROCESSOR_H | ||
12 | #define _XTENSA_PROCESSOR_H | ||
13 | |||
14 | #ifdef __ASSEMBLY__ | ||
15 | #define _ASMLANGUAGE | ||
16 | #endif | ||
17 | |||
18 | #include <xtensa/config/core.h> | ||
19 | #include <xtensa/config/specreg.h> | ||
20 | #include <xtensa/config/tie.h> | ||
21 | #include <xtensa/config/system.h> | ||
22 | |||
23 | #include <asm/ptrace.h> | ||
24 | #include <asm/types.h> | ||
25 | #include <asm/coprocessor.h> | ||
26 | |||
27 | /* Assertions. */ | ||
28 | |||
29 | #if (XCHAL_HAVE_WINDOWED != 1) | ||
30 | #error Linux requires the Xtensa Windowed Registers Option. | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * User space process size: 1 GB. | ||
35 | * Windowed call ABI requires caller and callee to be located within the same | ||
36 | * 1 GB region. The C compiler places trampoline code on the stack for sources | ||
37 | * that take the address of a nested C function (a feature used by glibc), so | ||
38 | * the 1 GB requirement applies to the stack as well. | ||
39 | */ | ||
40 | |||
41 | #define TASK_SIZE 0x40000000 | ||
42 | |||
43 | /* | ||
44 | * General exception cause assigned to debug exceptions. Debug exceptions go | ||
45 | * to their own vector, rather than the general exception vectors (user, | ||
46 | * kernel, double); and their specific causes are reported via DEBUGCAUSE | ||
47 | * rather than EXCCAUSE. However it is sometimes convenient to redirect debug | ||
48 | * exceptions to the general exception mechanism. To do this, an otherwise | ||
49 | * unused EXCCAUSE value was assigned to debug exceptions for this purpose. | ||
50 | */ | ||
51 | |||
52 | #define EXCCAUSE_MAPPED_DEBUG 63 | ||
53 | |||
54 | /* | ||
55 | * We use DEPC also as a flag to distinguish between double and regular | ||
56 | * exceptions. For performance reasons, DEPC might contain the value of | ||
57 | * EXCCAUSE for regular exceptions, so we use this definition to mark a | ||
58 | * valid double exception address. | ||
59 | * (Note: We use it in bgeui, so it should be 64, 128, or 256) | ||
60 | */ | ||
61 | |||
62 | #define VALID_DOUBLE_EXCEPTION_ADDRESS 64 | ||
63 | |||
64 | /* LOCKLEVEL defines the interrupt level that masks all | ||
65 | * general-purpose interrupts. | ||
66 | */ | ||
67 | #define LOCKLEVEL 1 | ||
68 | |||
69 | /* WSBITS and WBBITS are the width of the WINDOWSTART and WINDOWBASE | ||
70 | * registers | ||
71 | */ | ||
72 | #define WSBITS (XCHAL_NUM_AREGS / 4) /* width of WINDOWSTART in bits */ | ||
73 | #define WBBITS (XCHAL_NUM_AREGS_LOG2 - 2) /* width of WINDOWBASE in bits */ | ||
74 | |||
75 | #ifndef __ASSEMBLY__ | ||
76 | |||
77 | /* Build a valid return address for the specified call winsize. | ||
78 | * winsize must be 1 (call4), 2 (call8), or 3 (call12) | ||
79 | */ | ||
80 | #define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30) | ||
81 | |||
82 | /* Convert return address to a valid pc | ||
83 | * Note: We assume that the stack pointer is in the same 1GB ranges as the ra | ||
84 | */ | ||
85 | #define MAKE_PC_FROM_RA(ra,sp) (((ra) & 0x3fffffff) | ((sp) & 0xc0000000)) | ||
86 | |||
87 | typedef struct { | ||
88 | unsigned long seg; | ||
89 | } mm_segment_t; | ||
90 | |||
91 | struct thread_struct { | ||
92 | |||
93 | /* kernel's return address and stack pointer for context switching */ | ||
94 | unsigned long ra; /* kernel's a0: return address and window call size */ | ||
95 | unsigned long sp; /* kernel's a1: stack pointer */ | ||
96 | |||
97 | mm_segment_t current_ds; /* see uaccess.h for example uses */ | ||
98 | |||
99 | /* struct xtensa_cpuinfo info; */ | ||
100 | |||
101 | unsigned long bad_vaddr; /* last user fault */ | ||
102 | unsigned long bad_uaddr; /* last kernel fault accessing user space */ | ||
103 | unsigned long error_code; | ||
104 | |||
105 | unsigned long ibreak[XCHAL_NUM_IBREAK]; | ||
106 | unsigned long dbreaka[XCHAL_NUM_DBREAK]; | ||
107 | unsigned long dbreakc[XCHAL_NUM_DBREAK]; | ||
108 | |||
109 | /* Allocate storage for extra state and coprocessor state. */ | ||
110 | unsigned char cp_save[XTENSA_CP_EXTRA_SIZE] | ||
111 | __attribute__ ((aligned(XTENSA_CP_EXTRA_ALIGN))); | ||
112 | |||
113 | /* Make structure 16 bytes aligned. */ | ||
114 | int align[0] __attribute__ ((aligned(16))); | ||
115 | }; | ||
116 | |||
117 | |||
118 | /* | ||
119 | * Default implementation of macro that returns current | ||
120 | * instruction pointer ("program counter"). | ||
121 | */ | ||
122 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | ||
123 | |||
124 | |||
125 | /* This decides where the kernel will search for a free chunk of vm | ||
126 | * space during mmap's. | ||
127 | */ | ||
128 | #define TASK_UNMAPPED_BASE (TASK_SIZE / 2) | ||
129 | |||
130 | #define INIT_THREAD \ | ||
131 | { \ | ||
132 | ra: 0, \ | ||
133 | sp: sizeof(init_stack) + (long) &init_stack, \ | ||
134 | current_ds: {0}, \ | ||
135 | /*info: {0}, */ \ | ||
136 | bad_vaddr: 0, \ | ||
137 | bad_uaddr: 0, \ | ||
138 | error_code: 0, \ | ||
139 | } | ||
140 | |||
141 | |||
142 | /* | ||
143 | * Do necessary setup to start up a newly executed thread. | ||
144 | * Note: We set-up ps as if we did a call4 to the new pc. | ||
145 | * set_thread_state in signal.c depends on it. | ||
146 | */ | ||
147 | #define USER_PS_VALUE ( (1 << XCHAL_PS_WOE_SHIFT) + \ | ||
148 | (1 << XCHAL_PS_CALLINC_SHIFT) + \ | ||
149 | (USER_RING << XCHAL_PS_RING_SHIFT) + \ | ||
150 | (1 << XCHAL_PS_PROGSTACK_SHIFT) + \ | ||
151 | (1 << XCHAL_PS_EXCM_SHIFT) ) | ||
152 | |||
153 | /* Clearing a0 terminates the backtrace. */ | ||
154 | #define start_thread(regs, new_pc, new_sp) \ | ||
155 | regs->pc = new_pc; \ | ||
156 | regs->ps = USER_PS_VALUE; \ | ||
157 | regs->areg[1] = new_sp; \ | ||
158 | regs->areg[0] = 0; \ | ||
159 | regs->wmask = 1; \ | ||
160 | regs->depc = 0; \ | ||
161 | regs->windowbase = 0; \ | ||
162 | regs->windowstart = 1; | ||
163 | |||
164 | /* Forward declaration */ | ||
165 | struct task_struct; | ||
166 | struct mm_struct; | ||
167 | |||
168 | // FIXME: do we need release_thread for CP?? | ||
169 | /* Free all resources held by a thread. */ | ||
170 | #define release_thread(thread) do { } while(0) | ||
171 | |||
172 | // FIXME: do we need prepare_to_copy (lazy status) for CP?? | ||
173 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
174 | #define prepare_to_copy(tsk) do { } while (0) | ||
175 | |||
176 | /* | ||
177 | * create a kernel thread without removing it from tasklists | ||
178 | */ | ||
179 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
180 | |||
181 | /* Copy and release all segment info associated with a VM */ | ||
182 | |||
183 | #define copy_segments(p, mm) do { } while(0) | ||
184 | #define release_segments(mm) do { } while(0) | ||
185 | #define forget_segments() do { } while (0) | ||
186 | |||
187 | #define thread_saved_pc(tsk) (xtensa_pt_regs(tsk)->pc) | ||
188 | |||
189 | extern unsigned long get_wchan(struct task_struct *p); | ||
190 | |||
191 | #define KSTK_EIP(tsk) (xtensa_pt_regs(tsk)->pc) | ||
192 | #define KSTK_ESP(tsk) (xtensa_pt_regs(tsk)->areg[1]) | ||
193 | |||
194 | #define cpu_relax() do { } while (0) | ||
195 | |||
196 | /* Special register access. */ | ||
197 | |||
198 | #define WSR(v,sr) __asm__ __volatile__ ("wsr %0,"__stringify(sr) :: "a"(v)); | ||
199 | #define RSR(v,sr) __asm__ __volatile__ ("rsr %0,"__stringify(sr) : "=a"(v)); | ||
200 | |||
201 | #define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);}) | ||
202 | #define get_sr(sr) ({unsigned int v; RSR(v,sr); v; }) | ||
203 | |||
204 | #endif /* __ASSEMBLY__ */ | ||
205 | #endif /* _XTENSA_PROCESSOR_H */ | ||
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h new file mode 100644 index 000000000000..2848a5ff8349 --- /dev/null +++ b/include/asm-xtensa/ptrace.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ptrace.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PTRACE_H | ||
12 | #define _XTENSA_PTRACE_H | ||
13 | |||
14 | #include <xtensa/config/core.h> | ||
15 | |||
16 | /* | ||
17 | * Kernel stack | ||
18 | * | ||
19 | * +-----------------------+ -------- STACK_SIZE | ||
20 | * | register file | | | ||
21 | * +-----------------------+ | | ||
22 | * | struct pt_regs | | | ||
23 | * +-----------------------+ | ------ PT_REGS_OFFSET | ||
24 | * double : 16 bytes spill area : | ^ | ||
25 | * excetion :- - - - - - - - - - - -: | | | ||
26 | * frame : struct pt_regs : | | | ||
27 | * :- - - - - - - - - - - -: | | | ||
28 | * | | | | | ||
29 | * | memory stack | | | | ||
30 | * | | | | | ||
31 | * ~ ~ ~ ~ | ||
32 | * ~ ~ ~ ~ | ||
33 | * | | | | | ||
34 | * | | | | | ||
35 | * +-----------------------+ | | --- STACK_BIAS | ||
36 | * | struct task_struct | | | ^ | ||
37 | * current --> +-----------------------+ | | | | ||
38 | * | struct thread_info | | | | | ||
39 | * +-----------------------+ -------- | ||
40 | */ | ||
41 | |||
42 | #define KERNEL_STACK_SIZE (2 * PAGE_SIZE) | ||
43 | |||
44 | /* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */ | ||
45 | |||
46 | #define EXC_TABLE_KSTK 0x004 /* Kernel Stack */ | ||
47 | #define EXC_TABLE_DOUBLE_SAVE 0x008 /* Double exception save area for a0 */ | ||
48 | #define EXC_TABLE_FIXUP 0x00c /* Fixup handler */ | ||
49 | #define EXC_TABLE_PARAM 0x010 /* For passing a parameter to fixup */ | ||
50 | #define EXC_TABLE_SYSCALL_SAVE 0x014 /* For fast syscall handler */ | ||
51 | #define EXC_TABLE_FAST_USER 0x100 /* Fast user exception handler */ | ||
52 | #define EXC_TABLE_FAST_KERNEL 0x200 /* Fast kernel exception handler */ | ||
53 | #define EXC_TABLE_DEFAULT 0x300 /* Default C-Handler */ | ||
54 | #define EXC_TABLE_SIZE 0x400 | ||
55 | |||
56 | /* Registers used by strace */ | ||
57 | |||
58 | #define REG_A_BASE 0xfc000000 | ||
59 | #define REG_AR_BASE 0x04000000 | ||
60 | #define REG_PC 0x14000000 | ||
61 | #define REG_PS 0x080000e6 | ||
62 | #define REG_WB 0x08000048 | ||
63 | #define REG_WS 0x08000049 | ||
64 | #define REG_LBEG 0x08000000 | ||
65 | #define REG_LEND 0x08000001 | ||
66 | #define REG_LCOUNT 0x08000002 | ||
67 | #define REG_SAR 0x08000003 | ||
68 | #define REG_DEPC 0x080000c0 | ||
69 | #define REG_EXCCAUSE 0x080000e8 | ||
70 | #define REG_EXCVADDR 0x080000ee | ||
71 | #define SYSCALL_NR 0x1 | ||
72 | |||
73 | #define AR_REGNO_TO_A_REGNO(ar, wb) (ar - wb*4) & ~(XCHAL_NUM_AREGS - 1) | ||
74 | |||
75 | /* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */ | ||
76 | |||
77 | #define PTRACE_GETREGS 12 | ||
78 | #define PTRACE_SETREGS 13 | ||
79 | #define PTRACE_GETFPREGS 14 | ||
80 | #define PTRACE_SETFPREGS 15 | ||
81 | #define PTRACE_GETFPREGSIZE 18 | ||
82 | |||
83 | #ifndef __ASSEMBLY__ | ||
84 | |||
85 | /* | ||
86 | * This struct defines the way the registers are stored on the | ||
87 | * kernel stack during a system call or other kernel entry. | ||
88 | */ | ||
89 | struct pt_regs { | ||
90 | unsigned long pc; /* 4 */ | ||
91 | unsigned long ps; /* 8 */ | ||
92 | unsigned long depc; /* 12 */ | ||
93 | unsigned long exccause; /* 16 */ | ||
94 | unsigned long excvaddr; /* 20 */ | ||
95 | unsigned long debugcause; /* 24 */ | ||
96 | unsigned long wmask; /* 28 */ | ||
97 | unsigned long lbeg; /* 32 */ | ||
98 | unsigned long lend; /* 36 */ | ||
99 | unsigned long lcount; /* 40 */ | ||
100 | unsigned long sar; /* 44 */ | ||
101 | unsigned long windowbase; /* 48 */ | ||
102 | unsigned long windowstart; /* 52 */ | ||
103 | unsigned long syscall; /* 56 */ | ||
104 | int reserved[2]; /* 64 */ | ||
105 | |||
106 | /* Make sure the areg field is 16 bytes aligned. */ | ||
107 | int align[0] __attribute__ ((aligned(16))); | ||
108 | |||
109 | /* current register frame. | ||
110 | * Note: The ESF for kernel exceptions ends after 16 registers! | ||
111 | */ | ||
112 | unsigned long areg[16]; /* 128 (64) */ | ||
113 | }; | ||
114 | |||
115 | #ifdef __KERNEL__ | ||
116 | # define xtensa_pt_regs(tsk) ((struct pt_regs*) \ | ||
117 | (((long)(tsk)->thread_info + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4)) - 1) | ||
118 | # define user_mode(regs) (((regs)->ps & 0x00000020)!=0) | ||
119 | # define instruction_pointer(regs) ((regs)->pc) | ||
120 | extern void show_regs(struct pt_regs *); | ||
121 | |||
122 | # ifndef CONFIG_SMP | ||
123 | # define profile_pc(regs) instruction_pointer(regs) | ||
124 | # endif | ||
125 | #endif /* __KERNEL__ */ | ||
126 | |||
127 | #else /* __ASSEMBLY__ */ | ||
128 | |||
129 | #ifdef __KERNEL__ | ||
130 | # include <asm/offsets.h> | ||
131 | #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) | ||
132 | #endif | ||
133 | |||
134 | #endif /* !__ASSEMBLY__ */ | ||
135 | #endif /* _XTENSA_PTRACE_H */ | ||
diff --git a/include/asm-xtensa/resource.h b/include/asm-xtensa/resource.h new file mode 100644 index 000000000000..17b5ab311771 --- /dev/null +++ b/include/asm-xtensa/resource.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/resource.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_RESOURCE_H | ||
12 | #define _XTENSA_RESOURCE_H | ||
13 | |||
14 | #include <asm-generic/resource.h> | ||
15 | |||
16 | #endif /* _XTENSA_RESOURCE_H */ | ||
diff --git a/include/asm-xtensa/rmap.h b/include/asm-xtensa/rmap.h new file mode 100644 index 000000000000..649588b7e9ad --- /dev/null +++ b/include/asm-xtensa/rmap.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/rmap.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_RMAP_H | ||
12 | #define _XTENSA_RMAP_H | ||
13 | |||
14 | #include <asm-generic/rmap.h> | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-xtensa/rwsem.h b/include/asm-xtensa/rwsem.h new file mode 100644 index 000000000000..3c02b0e033f0 --- /dev/null +++ b/include/asm-xtensa/rwsem.h | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/rwsem.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Largely copied from include/asm-ppc/rwsem.h | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_RWSEM_H | ||
14 | #define _XTENSA_RWSEM_H | ||
15 | |||
16 | #include <linux/list.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | #include <asm/atomic.h> | ||
19 | #include <asm/system.h> | ||
20 | |||
21 | /* | ||
22 | * the semaphore definition | ||
23 | */ | ||
24 | struct rw_semaphore { | ||
25 | signed long count; | ||
26 | #define RWSEM_UNLOCKED_VALUE 0x00000000 | ||
27 | #define RWSEM_ACTIVE_BIAS 0x00000001 | ||
28 | #define RWSEM_ACTIVE_MASK 0x0000ffff | ||
29 | #define RWSEM_WAITING_BIAS (-0x00010000) | ||
30 | #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS | ||
31 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) | ||
32 | spinlock_t wait_lock; | ||
33 | struct list_head wait_list; | ||
34 | #if RWSEM_DEBUG | ||
35 | int debug; | ||
36 | #endif | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * initialisation | ||
41 | */ | ||
42 | #if RWSEM_DEBUG | ||
43 | #define __RWSEM_DEBUG_INIT , 0 | ||
44 | #else | ||
45 | #define __RWSEM_DEBUG_INIT /* */ | ||
46 | #endif | ||
47 | |||
48 | #define __RWSEM_INITIALIZER(name) \ | ||
49 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ | ||
50 | LIST_HEAD_INIT((name).wait_list) \ | ||
51 | __RWSEM_DEBUG_INIT } | ||
52 | |||
53 | #define DECLARE_RWSEM(name) \ | ||
54 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | ||
55 | |||
56 | extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); | ||
57 | extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | ||
58 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); | ||
59 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | ||
60 | |||
61 | static inline void init_rwsem(struct rw_semaphore *sem) | ||
62 | { | ||
63 | sem->count = RWSEM_UNLOCKED_VALUE; | ||
64 | spin_lock_init(&sem->wait_lock); | ||
65 | INIT_LIST_HEAD(&sem->wait_list); | ||
66 | #if RWSEM_DEBUG | ||
67 | sem->debug = 0; | ||
68 | #endif | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * lock for reading | ||
73 | */ | ||
74 | static inline void __down_read(struct rw_semaphore *sem) | ||
75 | { | ||
76 | if (atomic_add_return(1,(atomic_t *)(&sem->count)) > 0) | ||
77 | smp_wmb(); | ||
78 | else | ||
79 | rwsem_down_read_failed(sem); | ||
80 | } | ||
81 | |||
82 | static inline int __down_read_trylock(struct rw_semaphore *sem) | ||
83 | { | ||
84 | int tmp; | ||
85 | |||
86 | while ((tmp = sem->count) >= 0) { | ||
87 | if (tmp == cmpxchg(&sem->count, tmp, | ||
88 | tmp + RWSEM_ACTIVE_READ_BIAS)) { | ||
89 | smp_wmb(); | ||
90 | return 1; | ||
91 | } | ||
92 | } | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * lock for writing | ||
98 | */ | ||
99 | static inline void __down_write(struct rw_semaphore *sem) | ||
100 | { | ||
101 | int tmp; | ||
102 | |||
103 | tmp = atomic_add_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
104 | (atomic_t *)(&sem->count)); | ||
105 | if (tmp == RWSEM_ACTIVE_WRITE_BIAS) | ||
106 | smp_wmb(); | ||
107 | else | ||
108 | rwsem_down_write_failed(sem); | ||
109 | } | ||
110 | |||
111 | static inline int __down_write_trylock(struct rw_semaphore *sem) | ||
112 | { | ||
113 | int tmp; | ||
114 | |||
115 | tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE, | ||
116 | RWSEM_ACTIVE_WRITE_BIAS); | ||
117 | smp_wmb(); | ||
118 | return tmp == RWSEM_UNLOCKED_VALUE; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * unlock after reading | ||
123 | */ | ||
124 | static inline void __up_read(struct rw_semaphore *sem) | ||
125 | { | ||
126 | int tmp; | ||
127 | |||
128 | smp_wmb(); | ||
129 | tmp = atomic_sub_return(1,(atomic_t *)(&sem->count)); | ||
130 | if (tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0) | ||
131 | rwsem_wake(sem); | ||
132 | } | ||
133 | |||
134 | /* | ||
135 | * unlock after writing | ||
136 | */ | ||
137 | static inline void __up_write(struct rw_semaphore *sem) | ||
138 | { | ||
139 | smp_wmb(); | ||
140 | if (atomic_sub_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
141 | (atomic_t *)(&sem->count)) < 0) | ||
142 | rwsem_wake(sem); | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | * implement atomic add functionality | ||
147 | */ | ||
148 | static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem) | ||
149 | { | ||
150 | atomic_add(delta, (atomic_t *)(&sem->count)); | ||
151 | } | ||
152 | |||
153 | /* | ||
154 | * downgrade write lock to read lock | ||
155 | */ | ||
156 | static inline void __downgrade_write(struct rw_semaphore *sem) | ||
157 | { | ||
158 | int tmp; | ||
159 | |||
160 | smp_wmb(); | ||
161 | tmp = atomic_add_return(-RWSEM_WAITING_BIAS, (atomic_t *)(&sem->count)); | ||
162 | if (tmp < 0) | ||
163 | rwsem_downgrade_wake(sem); | ||
164 | } | ||
165 | |||
166 | /* | ||
167 | * implement exchange and add functionality | ||
168 | */ | ||
169 | static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) | ||
170 | { | ||
171 | smp_mb(); | ||
172 | return atomic_add_return(delta, (atomic_t *)(&sem->count)); | ||
173 | } | ||
174 | |||
175 | #endif /* _XTENSA_RWSEM_XADD_H */ | ||
diff --git a/include/asm-xtensa/scatterlist.h b/include/asm-xtensa/scatterlist.h new file mode 100644 index 000000000000..38a2b9acd658 --- /dev/null +++ b/include/asm-xtensa/scatterlist.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/scatterlist.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SCATTERLIST_H | ||
12 | #define _XTENSA_SCATTERLIST_H | ||
13 | |||
14 | struct scatterlist { | ||
15 | struct page *page; | ||
16 | unsigned int offset; | ||
17 | dma_addr_t dma_address; | ||
18 | unsigned int length; | ||
19 | }; | ||
20 | |||
21 | /* | ||
22 | * These macros should be used after a pci_map_sg call has been done | ||
23 | * to get bus addresses of each of the SG entries and their lengths. | ||
24 | * You should only work with the number of sg entries pci_map_sg | ||
25 | * returns, or alternatively stop on the first sg_dma_len(sg) which | ||
26 | * is 0. | ||
27 | */ | ||
28 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
29 | #define sg_dma_len(sg) ((sg)->length) | ||
30 | |||
31 | |||
32 | #define ISA_DMA_THRESHOLD (~0UL) | ||
33 | |||
34 | #endif /* _XTENSA_SCATTERLIST_H */ | ||
diff --git a/include/asm-xtensa/sections.h b/include/asm-xtensa/sections.h new file mode 100644 index 000000000000..40b5191b55a2 --- /dev/null +++ b/include/asm-xtensa/sections.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sections.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SECTIONS_H | ||
12 | #define _XTENSA_SECTIONS_H | ||
13 | |||
14 | #include <asm-generic/sections.h> | ||
15 | |||
16 | #endif /* _XTENSA_SECTIONS_H */ | ||
diff --git a/include/asm-xtensa/segment.h b/include/asm-xtensa/segment.h new file mode 100644 index 000000000000..a2eb547a1a75 --- /dev/null +++ b/include/asm-xtensa/segment.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/segment.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SEGMENT_H | ||
12 | #define _XTENSA_SEGMENT_H | ||
13 | |||
14 | #include <asm/uaccess.h> | ||
15 | |||
16 | #endif /* _XTENSA_SEGEMENT_H */ | ||
diff --git a/include/asm-xtensa/semaphore.h b/include/asm-xtensa/semaphore.h new file mode 100644 index 000000000000..c8a7574a9a57 --- /dev/null +++ b/include/asm-xtensa/semaphore.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/semaphore.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SEMAPHORE_H | ||
12 | #define _XTENSA_SEMAPHORE_H | ||
13 | |||
14 | #include <asm/atomic.h> | ||
15 | #include <asm/system.h> | ||
16 | #include <linux/wait.h> | ||
17 | #include <linux/rwsem.h> | ||
18 | |||
19 | struct semaphore { | ||
20 | atomic_t count; | ||
21 | int sleepers; | ||
22 | wait_queue_head_t wait; | ||
23 | #if WAITQUEUE_DEBUG | ||
24 | long __magic; | ||
25 | #endif | ||
26 | }; | ||
27 | |||
28 | #if WAITQUEUE_DEBUG | ||
29 | # define __SEM_DEBUG_INIT(name) \ | ||
30 | , (int)&(name).__magic | ||
31 | #else | ||
32 | # define __SEM_DEBUG_INIT(name) | ||
33 | #endif | ||
34 | |||
35 | #define __SEMAPHORE_INITIALIZER(name,count) \ | ||
36 | { ATOMIC_INIT(count), \ | ||
37 | 0, \ | ||
38 | __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ | ||
39 | __SEM_DEBUG_INIT(name) } | ||
40 | |||
41 | #define __MUTEX_INITIALIZER(name) \ | ||
42 | __SEMAPHORE_INITIALIZER(name, 1) | ||
43 | |||
44 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ | ||
45 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | ||
46 | |||
47 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) | ||
48 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) | ||
49 | |||
50 | extern inline void sema_init (struct semaphore *sem, int val) | ||
51 | { | ||
52 | /* | ||
53 | * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); | ||
54 | * | ||
55 | * i'd rather use the more flexible initialization above, but sadly | ||
56 | * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well. | ||
57 | */ | ||
58 | atomic_set(&sem->count, val); | ||
59 | init_waitqueue_head(&sem->wait); | ||
60 | #if WAITQUEUE_DEBUG | ||
61 | sem->__magic = (int)&sem->__magic; | ||
62 | #endif | ||
63 | } | ||
64 | |||
65 | static inline void init_MUTEX (struct semaphore *sem) | ||
66 | { | ||
67 | sema_init(sem, 1); | ||
68 | } | ||
69 | |||
70 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) | ||
71 | { | ||
72 | sema_init(sem, 0); | ||
73 | } | ||
74 | |||
75 | asmlinkage void __down(struct semaphore * sem); | ||
76 | asmlinkage int __down_interruptible(struct semaphore * sem); | ||
77 | asmlinkage int __down_trylock(struct semaphore * sem); | ||
78 | asmlinkage void __up(struct semaphore * sem); | ||
79 | |||
80 | extern spinlock_t semaphore_wake_lock; | ||
81 | |||
82 | extern __inline__ void down(struct semaphore * sem) | ||
83 | { | ||
84 | #if WAITQUEUE_DEBUG | ||
85 | CHECK_MAGIC(sem->__magic); | ||
86 | #endif | ||
87 | |||
88 | if (atomic_sub_return(1, &sem->count) < 0) | ||
89 | __down(sem); | ||
90 | } | ||
91 | |||
92 | extern __inline__ int down_interruptible(struct semaphore * sem) | ||
93 | { | ||
94 | int ret = 0; | ||
95 | #if WAITQUEUE_DEBUG | ||
96 | CHECK_MAGIC(sem->__magic); | ||
97 | #endif | ||
98 | |||
99 | if (atomic_sub_return(1, &sem->count) < 0) | ||
100 | ret = __down_interruptible(sem); | ||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | extern __inline__ int down_trylock(struct semaphore * sem) | ||
105 | { | ||
106 | int ret = 0; | ||
107 | #if WAITQUEUE_DEBUG | ||
108 | CHECK_MAGIC(sem->__magic); | ||
109 | #endif | ||
110 | |||
111 | if (atomic_sub_return(1, &sem->count) < 0) | ||
112 | ret = __down_trylock(sem); | ||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * Note! This is subtle. We jump to wake people up only if | ||
118 | * the semaphore was negative (== somebody was waiting on it). | ||
119 | */ | ||
120 | extern __inline__ void up(struct semaphore * sem) | ||
121 | { | ||
122 | #if WAITQUEUE_DEBUG | ||
123 | CHECK_MAGIC(sem->__magic); | ||
124 | #endif | ||
125 | if (atomic_add_return(1, &sem->count) <= 0) | ||
126 | __up(sem); | ||
127 | } | ||
128 | |||
129 | #endif /* _XTENSA_SEMAPHORE_H */ | ||
diff --git a/include/asm-xtensa/sembuf.h b/include/asm-xtensa/sembuf.h new file mode 100644 index 000000000000..2d26c47666fe --- /dev/null +++ b/include/asm-xtensa/sembuf.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sembuf.h | ||
3 | * | ||
4 | * The semid64_ds structure for Xtensa architecture. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | * | ||
12 | * Note extra padding because this structure is passed back and forth | ||
13 | * between kernel and user space. | ||
14 | * | ||
15 | * Pad space is left for: | ||
16 | * - 64-bit time_t to solve y2038 problem | ||
17 | * - 2 miscellaneous 32-bit values | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #ifndef _XTENSA_SEMBUF_H | ||
22 | #define _XTENSA_SEMBUF_H | ||
23 | |||
24 | #include <asm/byteorder.h> | ||
25 | |||
26 | struct semid64_ds { | ||
27 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
28 | #if XCHAL_HAVE_LE | ||
29 | __kernel_time_t sem_otime; /* last semop time */ | ||
30 | unsigned long __unused1; | ||
31 | __kernel_time_t sem_ctime; /* last change time */ | ||
32 | unsigned long __unused2; | ||
33 | #else | ||
34 | unsigned long __unused1; | ||
35 | __kernel_time_t sem_otime; /* last semop time */ | ||
36 | unsigned long __unused2; | ||
37 | __kernel_time_t sem_ctime; /* last change time */ | ||
38 | #endif | ||
39 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
40 | unsigned long __unused3; | ||
41 | unsigned long __unused4; | ||
42 | }; | ||
43 | |||
44 | #endif /* __ASM_XTENSA_SEMBUF_H */ | ||
diff --git a/include/asm-xtensa/serial.h b/include/asm-xtensa/serial.h new file mode 100644 index 000000000000..ec04114fcf0b --- /dev/null +++ b/include/asm-xtensa/serial.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/serial.h | ||
3 | * | ||
4 | * Configuration details for 8250, 16450, 16550, etc. serial ports | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_SERIAL_H | ||
14 | #define _XTENSA_SERIAL_H | ||
15 | |||
16 | #include <asm/platform/serial.h> | ||
17 | |||
18 | #endif /* _XTENSA_SERIAL_H */ | ||
diff --git a/include/asm-xtensa/setup.h b/include/asm-xtensa/setup.h new file mode 100644 index 000000000000..e3636520d8cc --- /dev/null +++ b/include/asm-xtensa/setup.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/setup.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SETUP_H | ||
12 | #define _XTENSA_SETUP_H | ||
13 | |||
14 | #define COMMAND_LINE_SIZE 256 | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-xtensa/shmbuf.h b/include/asm-xtensa/shmbuf.h new file mode 100644 index 000000000000..a30b81a4b933 --- /dev/null +++ b/include/asm-xtensa/shmbuf.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/shmbuf.h | ||
3 | * | ||
4 | * The shmid64_ds structure for Xtensa architecture. | ||
5 | * Note extra padding because this structure is passed back and forth | ||
6 | * between kernel and user space. | ||
7 | * | ||
8 | * Pad space is left for: | ||
9 | * - 64-bit time_t to solve y2038 problem | ||
10 | * - 2 miscellaneous 32-bit values | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General Public | ||
13 | * License. See the file "COPYING" in the main directory of this archive | ||
14 | * for more details. | ||
15 | * | ||
16 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
17 | */ | ||
18 | |||
19 | #ifndef _XTENSA_SHMBUF_H | ||
20 | #define _XTENSA_SHMBUF_H | ||
21 | |||
22 | struct shmid64_ds { | ||
23 | struct ipc64_perm shm_perm; /* operation perms */ | ||
24 | size_t shm_segsz; /* size of segment (bytes) */ | ||
25 | __kernel_time_t shm_atime; /* last attach time */ | ||
26 | unsigned long __unused1; | ||
27 | __kernel_time_t shm_dtime; /* last detach time */ | ||
28 | unsigned long __unused2; | ||
29 | __kernel_time_t shm_ctime; /* last change time */ | ||
30 | unsigned long __unused3; | ||
31 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
32 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
33 | unsigned long shm_nattch; /* no. of current attaches */ | ||
34 | unsigned long __unused4; | ||
35 | unsigned long __unused5; | ||
36 | }; | ||
37 | |||
38 | struct shminfo64 { | ||
39 | unsigned long shmmax; | ||
40 | unsigned long shmmin; | ||
41 | unsigned long shmmni; | ||
42 | unsigned long shmseg; | ||
43 | unsigned long shmall; | ||
44 | unsigned long __unused1; | ||
45 | unsigned long __unused2; | ||
46 | unsigned long __unused3; | ||
47 | unsigned long __unused4; | ||
48 | }; | ||
49 | |||
50 | #endif /* _XTENSA_SHMBUF_H */ | ||
diff --git a/include/asm-xtensa/shmparam.h b/include/asm-xtensa/shmparam.h new file mode 100644 index 000000000000..d3b65bfa71c3 --- /dev/null +++ b/include/asm-xtensa/shmparam.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/shmparam.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _XTENSA_SHMPARAM_H | ||
10 | #define _XTENSA_SHMPARAM_H | ||
11 | |||
12 | #include <asm/processor.h> | ||
13 | |||
14 | /* | ||
15 | * Xtensa can have variable size caches, and if | ||
16 | * the size of single way is larger than the page size, | ||
17 | * then we have to start worrying about cache aliasing | ||
18 | * problems. | ||
19 | */ | ||
20 | |||
21 | #define SHMLBA ((PAGE_SIZE > DCACHE_WAY_SIZE)? PAGE_SIZE : DCACHE_WAY_SIZE) | ||
22 | |||
23 | #endif /* _XTENSA_SHMPARAM_H */ | ||
diff --git a/include/asm-xtensa/sigcontext.h b/include/asm-xtensa/sigcontext.h new file mode 100644 index 000000000000..a75177291418 --- /dev/null +++ b/include/asm-xtensa/sigcontext.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sigcontext.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2003 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SIGCONTEXT_H | ||
12 | #define _XTENSA_SIGCONTEXT_H | ||
13 | |||
14 | #define _ASMLANGUAGE | ||
15 | #include <asm/processor.h> | ||
16 | #include <asm/coprocessor.h> | ||
17 | |||
18 | |||
19 | struct _cpstate { | ||
20 | unsigned char _cpstate[XTENSA_CP_EXTRA_SIZE]; | ||
21 | } __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN))); | ||
22 | |||
23 | |||
24 | struct sigcontext { | ||
25 | unsigned long oldmask; | ||
26 | |||
27 | /* CPU registers */ | ||
28 | unsigned long sc_pc; | ||
29 | unsigned long sc_ps; | ||
30 | unsigned long sc_wmask; | ||
31 | unsigned long sc_windowbase; | ||
32 | unsigned long sc_windowstart; | ||
33 | unsigned long sc_lbeg; | ||
34 | unsigned long sc_lend; | ||
35 | unsigned long sc_lcount; | ||
36 | unsigned long sc_sar; | ||
37 | unsigned long sc_depc; | ||
38 | unsigned long sc_dareg0; | ||
39 | unsigned long sc_treg[4]; | ||
40 | unsigned long sc_areg[XCHAL_NUM_AREGS]; | ||
41 | struct _cpstate *sc_cpstate; | ||
42 | }; | ||
43 | |||
44 | #endif /* __ASM_XTENSA_SIGCONTEXT_H */ | ||
diff --git a/include/asm-xtensa/siginfo.h b/include/asm-xtensa/siginfo.h new file mode 100644 index 000000000000..44f0ae77b539 --- /dev/null +++ b/include/asm-xtensa/siginfo.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/processor.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SIGINFO_H | ||
12 | #define _XTENSA_SIGINFO_H | ||
13 | |||
14 | #include <asm-generic/siginfo.h> | ||
15 | |||
16 | #endif /* _XTENSA_SIGINFO_H */ | ||
diff --git a/include/asm-xtensa/signal.h b/include/asm-xtensa/signal.h new file mode 100644 index 000000000000..5d6fc9cdf58d --- /dev/null +++ b/include/asm-xtensa/signal.h | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/signal.h | ||
3 | * | ||
4 | * Swiped from SH. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_SIGNAL_H | ||
14 | #define _XTENSA_SIGNAL_H | ||
15 | |||
16 | |||
17 | #define _NSIG 64 | ||
18 | #define _NSIG_BPW 32 | ||
19 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
20 | |||
21 | #ifndef __ASSEMBLY__ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | /* Avoid too many header ordering problems. */ | ||
26 | struct siginfo; | ||
27 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
28 | typedef struct { | ||
29 | unsigned long sig[_NSIG_WORDS]; | ||
30 | } sigset_t; | ||
31 | |||
32 | #endif | ||
33 | |||
34 | #define SIGHUP 1 | ||
35 | #define SIGINT 2 | ||
36 | #define SIGQUIT 3 | ||
37 | #define SIGILL 4 | ||
38 | #define SIGTRAP 5 | ||
39 | #define SIGABRT 6 | ||
40 | #define SIGIOT 6 | ||
41 | #define SIGBUS 7 | ||
42 | #define SIGFPE 8 | ||
43 | #define SIGKILL 9 | ||
44 | #define SIGUSR1 10 | ||
45 | #define SIGSEGV 11 | ||
46 | #define SIGUSR2 12 | ||
47 | #define SIGPIPE 13 | ||
48 | #define SIGALRM 14 | ||
49 | #define SIGTERM 15 | ||
50 | #define SIGSTKFLT 16 | ||
51 | #define SIGCHLD 17 | ||
52 | #define SIGCONT 18 | ||
53 | #define SIGSTOP 19 | ||
54 | #define SIGTSTP 20 | ||
55 | #define SIGTTIN 21 | ||
56 | #define SIGTTOU 22 | ||
57 | #define SIGURG 23 | ||
58 | #define SIGXCPU 24 | ||
59 | #define SIGXFSZ 25 | ||
60 | #define SIGVTALRM 26 | ||
61 | #define SIGPROF 27 | ||
62 | #define SIGWINCH 28 | ||
63 | #define SIGIO 29 | ||
64 | #define SIGPOLL SIGIO | ||
65 | /* #define SIGLOST 29 */ | ||
66 | #define SIGPWR 30 | ||
67 | #define SIGSYS 31 | ||
68 | #define SIGUNUSED 31 | ||
69 | |||
70 | /* These should not be considered constants from userland. */ | ||
71 | #define SIGRTMIN 32 | ||
72 | #define SIGRTMAX (_NSIG-1) | ||
73 | |||
74 | /* | ||
75 | * SA_FLAGS values: | ||
76 | * | ||
77 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
78 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
79 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
80 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
81 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
82 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
83 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
84 | * | ||
85 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
86 | * Unix names RESETHAND and NODEFER respectively. | ||
87 | */ | ||
88 | #define SA_NOCLDSTOP 0x00000001 | ||
89 | #define SA_NOCLDWAIT 0x00000002 /* not supported yet */ | ||
90 | #define SA_SIGINFO 0x00000004 | ||
91 | #define SA_ONSTACK 0x08000000 | ||
92 | #define SA_RESTART 0x10000000 | ||
93 | #define SA_NODEFER 0x40000000 | ||
94 | #define SA_RESETHAND 0x80000000 | ||
95 | |||
96 | #define SA_NOMASK SA_NODEFER | ||
97 | #define SA_ONESHOT SA_RESETHAND | ||
98 | #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ | ||
99 | |||
100 | #define SA_RESTORER 0x04000000 | ||
101 | |||
102 | /* | ||
103 | * sigaltstack controls | ||
104 | */ | ||
105 | #define SS_ONSTACK 1 | ||
106 | #define SS_DISABLE 2 | ||
107 | |||
108 | #define MINSIGSTKSZ 2048 | ||
109 | #define SIGSTKSZ 8192 | ||
110 | |||
111 | #ifndef __ASSEMBLY__ | ||
112 | #ifdef __KERNEL__ | ||
113 | |||
114 | /* | ||
115 | * These values of sa_flags are used only by the kernel as part of the | ||
116 | * irq handling routines. | ||
117 | * | ||
118 | * SA_INTERRUPT is also used by the irq handling routines. | ||
119 | * SA_SHIRQ is for shared interrupt support on PCI and EISA. | ||
120 | */ | ||
121 | #define SA_PROBE SA_ONESHOT | ||
122 | #define SA_SAMPLE_RANDOM SA_RESTART | ||
123 | #define SA_SHIRQ 0x04000000 | ||
124 | #endif | ||
125 | |||
126 | #define SIG_BLOCK 0 /* for blocking signals */ | ||
127 | #define SIG_UNBLOCK 1 /* for unblocking signals */ | ||
128 | #define SIG_SETMASK 2 /* for setting the signal mask */ | ||
129 | |||
130 | /* Type of a signal handler. */ | ||
131 | typedef void (*__sighandler_t)(int); | ||
132 | |||
133 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ | ||
134 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ | ||
135 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ | ||
136 | |||
137 | #ifdef __KERNEL__ | ||
138 | struct old_sigaction { | ||
139 | __sighandler_t sa_handler; | ||
140 | old_sigset_t sa_mask; | ||
141 | unsigned long sa_flags; | ||
142 | void (*sa_restorer)(void); | ||
143 | }; | ||
144 | |||
145 | struct sigaction { | ||
146 | __sighandler_t sa_handler; | ||
147 | unsigned long sa_flags; | ||
148 | void (*sa_restorer)(void); | ||
149 | sigset_t sa_mask; /* mask last for extensibility */ | ||
150 | }; | ||
151 | |||
152 | struct k_sigaction { | ||
153 | struct sigaction sa; | ||
154 | }; | ||
155 | |||
156 | #else | ||
157 | |||
158 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
159 | |||
160 | struct sigaction { | ||
161 | union { | ||
162 | __sighandler_t _sa_handler; | ||
163 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
164 | } _u; | ||
165 | sigset_t sa_mask; | ||
166 | unsigned long sa_flags; | ||
167 | void (*sa_restorer)(void); | ||
168 | }; | ||
169 | |||
170 | #define sa_handler _u._sa_handler | ||
171 | #define sa_sigaction _u._sa_sigaction | ||
172 | |||
173 | #endif /* __KERNEL__ */ | ||
174 | |||
175 | typedef struct sigaltstack { | ||
176 | void *ss_sp; | ||
177 | int ss_flags; | ||
178 | size_t ss_size; | ||
179 | } stack_t; | ||
180 | |||
181 | #ifdef __KERNEL__ | ||
182 | #include <asm/sigcontext.h> | ||
183 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
184 | |||
185 | #endif /* __KERNEL__ */ | ||
186 | #endif /* __ASSEMBLY__ */ | ||
187 | #endif /* _XTENSA_SIGNAL_H */ | ||
diff --git a/include/asm-xtensa/smp.h b/include/asm-xtensa/smp.h new file mode 100644 index 000000000000..83c569e3bdbd --- /dev/null +++ b/include/asm-xtensa/smp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/smp.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SMP_H | ||
12 | #define _XTENSA_SMP_H | ||
13 | |||
14 | extern struct xtensa_cpuinfo boot_cpu_data; | ||
15 | |||
16 | #define cpu_data (&boot_cpu_data) | ||
17 | #define current_cpu_data boot_cpu_data | ||
18 | |||
19 | struct xtensa_cpuinfo { | ||
20 | unsigned long *pgd_cache; | ||
21 | unsigned long *pte_cache; | ||
22 | unsigned long pgtable_cache_sz; | ||
23 | }; | ||
24 | |||
25 | #define cpu_logical_map(cpu) (cpu) | ||
26 | |||
27 | #endif /* _XTENSA_SMP_H */ | ||
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h new file mode 100644 index 000000000000..daccd05a14cd --- /dev/null +++ b/include/asm-xtensa/socket.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/socket.h | ||
3 | * | ||
4 | * Copied from i386. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SOCKET_H | ||
12 | #define _XTENSA_SOCKET_H | ||
13 | |||
14 | #include <asm/sockios.h> | ||
15 | |||
16 | /* For setsockoptions(2) */ | ||
17 | #define SOL_SOCKET 1 | ||
18 | |||
19 | #define SO_DEBUG 1 | ||
20 | #define SO_REUSEADDR 2 | ||
21 | #define SO_TYPE 3 | ||
22 | #define SO_ERROR 4 | ||
23 | #define SO_DONTROUTE 5 | ||
24 | #define SO_BROADCAST 6 | ||
25 | #define SO_SNDBUF 7 | ||
26 | #define SO_RCVBUF 8 | ||
27 | #define SO_KEEPALIVE 9 | ||
28 | #define SO_OOBINLINE 10 | ||
29 | #define SO_NO_CHECK 11 | ||
30 | #define SO_PRIORITY 12 | ||
31 | #define SO_LINGER 13 | ||
32 | #define SO_BSDCOMPAT 14 | ||
33 | /* To add :#define SO_REUSEPORT 15 */ | ||
34 | #define SO_PASSCRED 16 | ||
35 | #define SO_PEERCRED 17 | ||
36 | #define SO_RCVLOWAT 18 | ||
37 | #define SO_SNDLOWAT 19 | ||
38 | #define SO_RCVTIMEO 20 | ||
39 | #define SO_SNDTIMEO 21 | ||
40 | |||
41 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
42 | |||
43 | #define SO_SECURITY_AUTHENTICATION 22 | ||
44 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
45 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
46 | |||
47 | #define SO_BINDTODEVICE 25 | ||
48 | |||
49 | /* Socket filtering */ | ||
50 | |||
51 | #define SO_ATTACH_FILTER 26 | ||
52 | #define SO_DETACH_FILTER 27 | ||
53 | |||
54 | #define SO_PEERNAME 28 | ||
55 | #define SO_TIMESTAMP 29 | ||
56 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
57 | |||
58 | #define SO_ACCEPTCONN 30 | ||
59 | #define SO_PEERSEC 31 | ||
60 | |||
61 | #endif /* _XTENSA_SOCKET_H */ | ||
diff --git a/include/asm-xtensa/sockios.h b/include/asm-xtensa/sockios.h new file mode 100644 index 000000000000..20d2ba10ecd1 --- /dev/null +++ b/include/asm-xtensa/sockios.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sockios.h | ||
3 | * | ||
4 | * Socket-level I/O control calls. Copied from MIPS. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 1995 by Ralf Baechle | ||
11 | * Copyright (C) 2001 Tensilica Inc. | ||
12 | */ | ||
13 | |||
14 | #ifndef _XTENSA_SOCKIOS_H | ||
15 | #define _XTENSA_SOCKIOS_H | ||
16 | |||
17 | #include <asm/ioctl.h> | ||
18 | |||
19 | /* Socket-level I/O control calls. */ | ||
20 | |||
21 | #define FIOGETOWN _IOR('f', 123, int) | ||
22 | #define FIOSETOWN _IOW('f', 124, int) | ||
23 | |||
24 | #define SIOCATMARK _IOR('s', 7, int) | ||
25 | #define SIOCSPGRP _IOW('s', 8, pid_t) | ||
26 | #define SIOCGPGRP _IOR('s', 9, pid_t) | ||
27 | |||
28 | #define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ | ||
29 | |||
30 | #endif /* _XTENSA_SOCKIOS_H */ | ||
diff --git a/include/asm-xtensa/spinlock.h b/include/asm-xtensa/spinlock.h new file mode 100644 index 000000000000..8ff23649581b --- /dev/null +++ b/include/asm-xtensa/spinlock.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/spinlock.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SPINLOCK_H | ||
12 | #define _XTENSA_SPINLOCK_H | ||
13 | |||
14 | #include <linux/spinlock.h> | ||
15 | |||
16 | #endif /* _XTENSA_SPINLOCK_H */ | ||
diff --git a/include/asm-xtensa/stat.h b/include/asm-xtensa/stat.h new file mode 100644 index 000000000000..2f4662ff6c3a --- /dev/null +++ b/include/asm-xtensa/stat.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/stat.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_STAT_H | ||
12 | #define _XTENSA_STAT_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | |||
16 | struct __old_kernel_stat { | ||
17 | unsigned short st_dev; | ||
18 | unsigned short st_ino; | ||
19 | unsigned short st_mode; | ||
20 | unsigned short st_nlink; | ||
21 | unsigned short st_uid; | ||
22 | unsigned short st_gid; | ||
23 | unsigned short st_rdev; | ||
24 | unsigned long st_size; | ||
25 | unsigned long st_atime; | ||
26 | unsigned long st_mtime; | ||
27 | unsigned long st_ctime; | ||
28 | }; | ||
29 | |||
30 | #define STAT_HAVE_NSEC 1 | ||
31 | |||
32 | struct stat { | ||
33 | unsigned short st_dev; | ||
34 | unsigned short __pad1; | ||
35 | unsigned long st_ino; | ||
36 | unsigned short st_mode; | ||
37 | unsigned short st_nlink; | ||
38 | unsigned short st_uid; | ||
39 | unsigned short st_gid; | ||
40 | unsigned short st_rdev; | ||
41 | unsigned short __pad2; | ||
42 | unsigned long st_size; | ||
43 | unsigned long st_blksize; | ||
44 | unsigned long st_blocks; | ||
45 | unsigned long st_atime; | ||
46 | unsigned long st_atime_nsec; | ||
47 | unsigned long st_mtime; | ||
48 | unsigned long st_mtime_nsec; | ||
49 | unsigned long st_ctime; | ||
50 | unsigned long st_ctime_nsec; | ||
51 | unsigned long __unused4; | ||
52 | unsigned long __unused5; | ||
53 | }; | ||
54 | |||
55 | /* This matches struct stat64 in glibc-2.2.3. */ | ||
56 | |||
57 | struct stat64 { | ||
58 | #ifdef __XTENSA_EL__ | ||
59 | unsigned short st_dev; /* Device */ | ||
60 | unsigned char __pad0[10]; | ||
61 | #else | ||
62 | unsigned char __pad0[6]; | ||
63 | unsigned short st_dev; | ||
64 | unsigned char __pad1[2]; | ||
65 | #endif | ||
66 | |||
67 | #define STAT64_HAS_BROKEN_ST_INO 1 | ||
68 | unsigned long __st_ino; /* 32bit file serial number. */ | ||
69 | |||
70 | unsigned int st_mode; /* File mode. */ | ||
71 | unsigned int st_nlink; /* Link count. */ | ||
72 | unsigned int st_uid; /* User ID of the file's owner. */ | ||
73 | unsigned int st_gid; /* Group ID of the file's group. */ | ||
74 | |||
75 | #ifdef __XTENSA_EL__ | ||
76 | unsigned short st_rdev; /* Device number, if device. */ | ||
77 | unsigned char __pad3[10]; | ||
78 | #else | ||
79 | unsigned char __pad2[6]; | ||
80 | unsigned short st_rdev; | ||
81 | unsigned char __pad3[2]; | ||
82 | #endif | ||
83 | |||
84 | long long int st_size; /* Size of file, in bytes. */ | ||
85 | long int st_blksize; /* Optimal block size for I/O. */ | ||
86 | |||
87 | #ifdef __XTENSA_EL__ | ||
88 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
89 | unsigned long __pad4; | ||
90 | #else | ||
91 | unsigned long __pad4; | ||
92 | unsigned long st_blocks; | ||
93 | #endif | ||
94 | |||
95 | unsigned long __pad5; | ||
96 | long int st_atime; /* Time of last access. */ | ||
97 | unsigned long st_atime_nsec; | ||
98 | long int st_mtime; /* Time of last modification. */ | ||
99 | unsigned long st_mtime_nsec; | ||
100 | long int st_ctime; /* Time of last status change. */ | ||
101 | unsigned long st_ctime_nsec; | ||
102 | unsigned long long int st_ino; /* File serial number. */ | ||
103 | }; | ||
104 | |||
105 | #endif /* _XTENSA_STAT_H */ | ||
diff --git a/include/asm-xtensa/statfs.h b/include/asm-xtensa/statfs.h new file mode 100644 index 000000000000..9c3d1a213136 --- /dev/null +++ b/include/asm-xtensa/statfs.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/statfs.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_STATFS_H | ||
12 | #define _XTENSA_STATFS_H | ||
13 | |||
14 | #include <asm-generic/statfs.h> | ||
15 | |||
16 | #endif /* _XTENSA_STATFS_H */ | ||
17 | |||
diff --git a/include/asm-xtensa/string.h b/include/asm-xtensa/string.h new file mode 100644 index 000000000000..3f81b27d9809 --- /dev/null +++ b/include/asm-xtensa/string.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/string.h | ||
3 | * | ||
4 | * These trivial string functions are considered part of the public domain. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | /* We should optimize these. See arch/xtensa/lib/strncpy_user.S */ | ||
14 | |||
15 | #ifndef _XTENSA_STRING_H | ||
16 | #define _XTENSA_STRING_H | ||
17 | |||
18 | #define __HAVE_ARCH_STRCPY | ||
19 | extern __inline__ char *strcpy(char *__dest, const char *__src) | ||
20 | { | ||
21 | register char *__xdest = __dest; | ||
22 | unsigned long __dummy; | ||
23 | |||
24 | __asm__ __volatile__("1:\n\t" | ||
25 | "l8ui %2, %1, 0\n\t" | ||
26 | "s8i %2, %0, 0\n\t" | ||
27 | "addi %1, %1, 1\n\t" | ||
28 | "addi %0, %0, 1\n\t" | ||
29 | "bnez %2, 1b\n\t" | ||
30 | : "=r" (__dest), "=r" (__src), "=&r" (__dummy) | ||
31 | : "0" (__dest), "1" (__src) | ||
32 | : "memory"); | ||
33 | |||
34 | return __xdest; | ||
35 | } | ||
36 | |||
37 | #define __HAVE_ARCH_STRNCPY | ||
38 | extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n) | ||
39 | { | ||
40 | register char *__xdest = __dest; | ||
41 | unsigned long __dummy; | ||
42 | |||
43 | if (__n == 0) | ||
44 | return __xdest; | ||
45 | |||
46 | __asm__ __volatile__( | ||
47 | "1:\n\t" | ||
48 | "l8ui %2, %1, 0\n\t" | ||
49 | "s8i %2, %0, 0\n\t" | ||
50 | "addi %1, %1, 1\n\t" | ||
51 | "addi %0, %0, 1\n\t" | ||
52 | "beqz %2, 2f\n\t" | ||
53 | "bne %1, %5, 1b\n" | ||
54 | "2:" | ||
55 | : "=r" (__dest), "=r" (__src), "=&r" (__dummy) | ||
56 | : "0" (__dest), "1" (__src), "r" (__src+__n) | ||
57 | : "memory"); | ||
58 | |||
59 | return __xdest; | ||
60 | } | ||
61 | |||
62 | #define __HAVE_ARCH_STRCMP | ||
63 | extern __inline__ int strcmp(const char *__cs, const char *__ct) | ||
64 | { | ||
65 | register int __res; | ||
66 | unsigned long __dummy; | ||
67 | |||
68 | __asm__ __volatile__( | ||
69 | "1:\n\t" | ||
70 | "l8ui %3, %1, 0\n\t" | ||
71 | "addi %1, %1, 1\n\t" | ||
72 | "l8ui %2, %0, 0\n\t" | ||
73 | "addi %0, %0, 1\n\t" | ||
74 | "beqz %2, 2f\n\t" | ||
75 | "beq %2, %3, 1b\n" | ||
76 | "2:\n\t" | ||
77 | "sub %2, %3, %2" | ||
78 | : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy) | ||
79 | : "0" (__cs), "1" (__ct)); | ||
80 | |||
81 | return __res; | ||
82 | } | ||
83 | |||
84 | #define __HAVE_ARCH_STRNCMP | ||
85 | extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n) | ||
86 | { | ||
87 | register int __res; | ||
88 | unsigned long __dummy; | ||
89 | |||
90 | __asm__ __volatile__( | ||
91 | "mov %2, %3\n" | ||
92 | "1:\n\t" | ||
93 | "beq %0, %6, 2f\n\t" | ||
94 | "l8ui %3, %1, 0\n\t" | ||
95 | "addi %1, %1, 1\n\t" | ||
96 | "l8ui %2, %0, 0\n\t" | ||
97 | "addi %0, %0, 1\n\t" | ||
98 | "beqz %2, 2f\n\t" | ||
99 | "beqz %3, 2f\n\t" | ||
100 | "beq %2, %3, 1b\n" | ||
101 | "2:\n\t" | ||
102 | "sub %2, %3, %2" | ||
103 | : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy) | ||
104 | : "0" (__cs), "1" (__ct), "r" (__cs+__n)); | ||
105 | |||
106 | return __res; | ||
107 | } | ||
108 | |||
109 | #define __HAVE_ARCH_MEMSET | ||
110 | extern void *memset(void *__s, int __c, size_t __count); | ||
111 | |||
112 | #define __HAVE_ARCH_MEMCPY | ||
113 | extern void *memcpy(void *__to, __const__ void *__from, size_t __n); | ||
114 | |||
115 | #define __HAVE_ARCH_MEMMOVE | ||
116 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); | ||
117 | |||
118 | /* Don't build bcopy at all ... */ | ||
119 | #define __HAVE_ARCH_BCOPY | ||
120 | |||
121 | #define __HAVE_ARCH_MEMSCAN | ||
122 | #define memscan memchr | ||
123 | |||
124 | #endif /* _XTENSA_STRING_H */ | ||
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h new file mode 100644 index 000000000000..690fe325e671 --- /dev/null +++ b/include/asm-xtensa/system.h | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/system.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SYSTEM_H | ||
12 | #define _XTENSA_SYSTEM_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/stringify.h> | ||
16 | |||
17 | #include <asm/processor.h> | ||
18 | |||
19 | /* interrupt control */ | ||
20 | |||
21 | #define local_save_flags(x) \ | ||
22 | __asm__ __volatile__ ("rsr %0,"__stringify(PS) : "=a" (x)); | ||
23 | #define local_irq_restore(x) do { \ | ||
24 | __asm__ __volatile__ ("wsr %0, "__stringify(PS)" ; rsync" \ | ||
25 | :: "a" (x) : "memory"); } while(0); | ||
26 | #define local_irq_save(x) do { \ | ||
27 | __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL) \ | ||
28 | : "=a" (x) :: "memory");} while(0); | ||
29 | |||
30 | static inline void local_irq_disable(void) | ||
31 | { | ||
32 | unsigned long flags; | ||
33 | __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL) | ||
34 | : "=a" (flags) :: "memory"); | ||
35 | } | ||
36 | static inline void local_irq_enable(void) | ||
37 | { | ||
38 | unsigned long flags; | ||
39 | __asm__ __volatile__ ("rsil %0, 0" : "=a" (flags) :: "memory"); | ||
40 | |||
41 | } | ||
42 | |||
43 | static inline int irqs_disabled(void) | ||
44 | { | ||
45 | unsigned long flags; | ||
46 | local_save_flags(flags); | ||
47 | return flags & 0xf; | ||
48 | } | ||
49 | |||
50 | #define RSR_CPENABLE(x) do { \ | ||
51 | __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \ | ||
52 | } while(0); | ||
53 | #define WSR_CPENABLE(x) do { \ | ||
54 | __asm__ __volatile__("wsr %0," __stringify(CPENABLE)";rsync" \ | ||
55 | :: "a" (x));} while(0); | ||
56 | |||
57 | #define clear_cpenable() __clear_cpenable() | ||
58 | |||
59 | extern __inline__ void __clear_cpenable(void) | ||
60 | { | ||
61 | #if XCHAL_HAVE_CP | ||
62 | unsigned long i = 0; | ||
63 | WSR_CPENABLE(i); | ||
64 | #endif | ||
65 | } | ||
66 | |||
67 | extern __inline__ void enable_coprocessor(int i) | ||
68 | { | ||
69 | #if XCHAL_HAVE_CP | ||
70 | int cp; | ||
71 | RSR_CPENABLE(cp); | ||
72 | cp |= 1 << i; | ||
73 | WSR_CPENABLE(cp); | ||
74 | #endif | ||
75 | } | ||
76 | |||
77 | extern __inline__ void disable_coprocessor(int i) | ||
78 | { | ||
79 | #if XCHAL_HAVE_CP | ||
80 | int cp; | ||
81 | RSR_CPENABLE(cp); | ||
82 | cp &= ~(1 << i); | ||
83 | WSR_CPENABLE(cp); | ||
84 | #endif | ||
85 | } | ||
86 | |||
87 | #define smp_read_barrier_depends() do { } while(0) | ||
88 | #define read_barrier_depends() do { } while(0) | ||
89 | |||
90 | #define mb() barrier() | ||
91 | #define rmb() mb() | ||
92 | #define wmb() mb() | ||
93 | |||
94 | #ifdef CONFIG_SMP | ||
95 | #error smp_* not defined | ||
96 | #else | ||
97 | #define smp_mb() barrier() | ||
98 | #define smp_rmb() barrier() | ||
99 | #define smp_wmb() barrier() | ||
100 | #endif | ||
101 | |||
102 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
103 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
104 | |||
105 | #if !defined (__ASSEMBLY__) | ||
106 | |||
107 | /* * switch_to(n) should switch tasks to task nr n, first | ||
108 | * checking that n isn't the current task, in which case it does nothing. | ||
109 | */ | ||
110 | extern void *_switch_to(void *last, void *next); | ||
111 | |||
112 | #endif /* __ASSEMBLY__ */ | ||
113 | |||
114 | #define prepare_to_switch() do { } while(0) | ||
115 | |||
116 | #define switch_to(prev,next,last) \ | ||
117 | do { \ | ||
118 | clear_cpenable(); \ | ||
119 | (last) = _switch_to(prev, next); \ | ||
120 | } while(0) | ||
121 | |||
122 | /* | ||
123 | * cmpxchg | ||
124 | */ | ||
125 | |||
126 | extern __inline__ unsigned long | ||
127 | __cmpxchg_u32(volatile int *p, int old, int new) | ||
128 | { | ||
129 | __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
130 | "l32i %0, %1, 0 \n\t" | ||
131 | "bne %0, %2, 1f \n\t" | ||
132 | "s32i %3, %1, 0 \n\t" | ||
133 | "1: \n\t" | ||
134 | "wsr a15, "__stringify(PS)" \n\t" | ||
135 | "rsync \n\t" | ||
136 | : "=&a" (old) | ||
137 | : "a" (p), "a" (old), "r" (new) | ||
138 | : "a15", "memory"); | ||
139 | return old; | ||
140 | } | ||
141 | /* This function doesn't exist, so you'll get a linker error | ||
142 | * if something tries to do an invalid cmpxchg(). */ | ||
143 | |||
144 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
145 | |||
146 | static __inline__ unsigned long | ||
147 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | ||
148 | { | ||
149 | switch (size) { | ||
150 | case 4: return __cmpxchg_u32(ptr, old, new); | ||
151 | default: __cmpxchg_called_with_bad_pointer(); | ||
152 | return old; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | #define cmpxchg(ptr,o,n) \ | ||
157 | ({ __typeof__(*(ptr)) _o_ = (o); \ | ||
158 | __typeof__(*(ptr)) _n_ = (n); \ | ||
159 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
160 | (unsigned long)_n_, sizeof (*(ptr))); \ | ||
161 | }) | ||
162 | |||
163 | |||
164 | |||
165 | |||
166 | /* | ||
167 | * xchg_u32 | ||
168 | * | ||
169 | * Note that a15 is used here because the register allocation | ||
170 | * done by the compiler is not guaranteed and a window overflow | ||
171 | * may not occur between the rsil and wsr instructions. By using | ||
172 | * a15 in the rsil, the machine is guaranteed to be in a state | ||
173 | * where no register reference will cause an overflow. | ||
174 | */ | ||
175 | |||
176 | extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) | ||
177 | { | ||
178 | unsigned long tmp; | ||
179 | __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
180 | "l32i %0, %1, 0 \n\t" | ||
181 | "s32i %2, %1, 0 \n\t" | ||
182 | "wsr a15, "__stringify(PS)" \n\t" | ||
183 | "rsync \n\t" | ||
184 | : "=&a" (tmp) | ||
185 | : "a" (m), "a" (val) | ||
186 | : "a15", "memory"); | ||
187 | return tmp; | ||
188 | } | ||
189 | |||
190 | #define tas(ptr) (xchg((ptr),1)) | ||
191 | |||
192 | #if ( __XCC__ == 1 ) | ||
193 | |||
194 | /* xt-xcc processes __inline__ differently than xt-gcc and decides to | ||
195 | * insert an out-of-line copy of function __xchg. This presents the | ||
196 | * unresolved symbol at link time of __xchg_called_with_bad_pointer, | ||
197 | * even though such a function would never be called at run-time. | ||
198 | * xt-gcc always inlines __xchg, and optimizes away the undefined | ||
199 | * bad_pointer function. | ||
200 | */ | ||
201 | |||
202 | #define xchg(ptr,x) xchg_u32(ptr,x) | ||
203 | |||
204 | #else /* assume xt-gcc */ | ||
205 | |||
206 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
207 | |||
208 | /* | ||
209 | * This only works if the compiler isn't horribly bad at optimizing. | ||
210 | * gcc-2.5.8 reportedly can't handle this, but I define that one to | ||
211 | * be dead anyway. | ||
212 | */ | ||
213 | |||
214 | extern void __xchg_called_with_bad_pointer(void); | ||
215 | |||
216 | static __inline__ unsigned long | ||
217 | __xchg(unsigned long x, volatile void * ptr, int size) | ||
218 | { | ||
219 | switch (size) { | ||
220 | case 4: | ||
221 | return xchg_u32(ptr, x); | ||
222 | } | ||
223 | __xchg_called_with_bad_pointer(); | ||
224 | return x; | ||
225 | } | ||
226 | |||
227 | #endif | ||
228 | |||
229 | extern void set_except_vector(int n, void *addr); | ||
230 | |||
231 | static inline void spill_registers(void) | ||
232 | { | ||
233 | unsigned int a0, ps; | ||
234 | |||
235 | __asm__ __volatile__ ( | ||
236 | "movi a14," __stringify (PS_EXCM_MASK) " | 1\n\t" | ||
237 | "mov a12, a0\n\t" | ||
238 | "rsr a13," __stringify(SAR) "\n\t" | ||
239 | "xsr a14," __stringify(PS) "\n\t" | ||
240 | "movi a0, _spill_registers\n\t" | ||
241 | "rsync\n\t" | ||
242 | "callx0 a0\n\t" | ||
243 | "mov a0, a12\n\t" | ||
244 | "wsr a13," __stringify(SAR) "\n\t" | ||
245 | "wsr a14," __stringify(PS) "\n\t" | ||
246 | :: "a" (&a0), "a" (&ps) | ||
247 | : "a2", "a3", "a12", "a13", "a14", "a15", "memory"); | ||
248 | } | ||
249 | |||
250 | #define arch_align_stack(x) (x) | ||
251 | |||
252 | #endif /* _XTENSA_SYSTEM_H */ | ||
diff --git a/include/asm-xtensa/termbits.h b/include/asm-xtensa/termbits.h new file mode 100644 index 000000000000..c780593ff5f9 --- /dev/null +++ b/include/asm-xtensa/termbits.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/termbits.h | ||
3 | * | ||
4 | * Copied from SH. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_TERMBITS_H | ||
14 | #define _XTENSA_TERMBITS_H | ||
15 | |||
16 | |||
17 | #include <linux/posix_types.h> | ||
18 | |||
19 | typedef unsigned char cc_t; | ||
20 | typedef unsigned int speed_t; | ||
21 | typedef unsigned int tcflag_t; | ||
22 | |||
23 | #define NCCS 19 | ||
24 | struct termios { | ||
25 | tcflag_t c_iflag; /* input mode flags */ | ||
26 | tcflag_t c_oflag; /* output mode flags */ | ||
27 | tcflag_t c_cflag; /* control mode flags */ | ||
28 | tcflag_t c_lflag; /* local mode flags */ | ||
29 | cc_t c_line; /* line discipline */ | ||
30 | cc_t c_cc[NCCS]; /* control characters */ | ||
31 | }; | ||
32 | |||
33 | /* c_cc characters */ | ||
34 | |||
35 | #define VINTR 0 | ||
36 | #define VQUIT 1 | ||
37 | #define VERASE 2 | ||
38 | #define VKILL 3 | ||
39 | #define VEOF 4 | ||
40 | #define VTIME 5 | ||
41 | #define VMIN 6 | ||
42 | #define VSWTC 7 | ||
43 | #define VSTART 8 | ||
44 | #define VSTOP 9 | ||
45 | #define VSUSP 10 | ||
46 | #define VEOL 11 | ||
47 | #define VREPRINT 12 | ||
48 | #define VDISCARD 13 | ||
49 | #define VWERASE 14 | ||
50 | #define VLNEXT 15 | ||
51 | #define VEOL2 16 | ||
52 | |||
53 | /* c_iflag bits */ | ||
54 | |||
55 | #define IGNBRK 0000001 | ||
56 | #define BRKINT 0000002 | ||
57 | #define IGNPAR 0000004 | ||
58 | #define PARMRK 0000010 | ||
59 | #define INPCK 0000020 | ||
60 | #define ISTRIP 0000040 | ||
61 | #define INLCR 0000100 | ||
62 | #define IGNCR 0000200 | ||
63 | #define ICRNL 0000400 | ||
64 | #define IUCLC 0001000 | ||
65 | #define IXON 0002000 | ||
66 | #define IXANY 0004000 | ||
67 | #define IXOFF 0010000 | ||
68 | #define IMAXBEL 0020000 | ||
69 | #define IUTF8 0040000 | ||
70 | |||
71 | /* c_oflag bits */ | ||
72 | |||
73 | #define OPOST 0000001 | ||
74 | #define OLCUC 0000002 | ||
75 | #define ONLCR 0000004 | ||
76 | #define OCRNL 0000010 | ||
77 | #define ONOCR 0000020 | ||
78 | #define ONLRET 0000040 | ||
79 | #define OFILL 0000100 | ||
80 | #define OFDEL 0000200 | ||
81 | #define NLDLY 0000400 | ||
82 | #define NL0 0000000 | ||
83 | #define NL1 0000400 | ||
84 | #define CRDLY 0003000 | ||
85 | #define CR0 0000000 | ||
86 | #define CR1 0001000 | ||
87 | #define CR2 0002000 | ||
88 | #define CR3 0003000 | ||
89 | #define TABDLY 0014000 | ||
90 | #define TAB0 0000000 | ||
91 | #define TAB1 0004000 | ||
92 | #define TAB2 0010000 | ||
93 | #define TAB3 0014000 | ||
94 | #define XTABS 0014000 | ||
95 | #define BSDLY 0020000 | ||
96 | #define BS0 0000000 | ||
97 | #define BS1 0020000 | ||
98 | #define VTDLY 0040000 | ||
99 | #define VT0 0000000 | ||
100 | #define VT1 0040000 | ||
101 | #define FFDLY 0100000 | ||
102 | #define FF0 0000000 | ||
103 | #define FF1 0100000 | ||
104 | |||
105 | /* c_cflag bit meaning */ | ||
106 | |||
107 | #define CBAUD 0010017 | ||
108 | #define B0 0000000 /* hang up */ | ||
109 | #define B50 0000001 | ||
110 | #define B75 0000002 | ||
111 | #define B110 0000003 | ||
112 | #define B134 0000004 | ||
113 | #define B150 0000005 | ||
114 | #define B200 0000006 | ||
115 | #define B300 0000007 | ||
116 | #define B600 0000010 | ||
117 | #define B1200 0000011 | ||
118 | #define B1800 0000012 | ||
119 | #define B2400 0000013 | ||
120 | #define B4800 0000014 | ||
121 | #define B9600 0000015 | ||
122 | #define B19200 0000016 | ||
123 | #define B38400 0000017 | ||
124 | #define EXTA B19200 | ||
125 | #define EXTB B38400 | ||
126 | #define CSIZE 0000060 | ||
127 | #define CS5 0000000 | ||
128 | #define CS6 0000020 | ||
129 | #define CS7 0000040 | ||
130 | #define CS8 0000060 | ||
131 | #define CSTOPB 0000100 | ||
132 | #define CREAD 0000200 | ||
133 | #define PARENB 0000400 | ||
134 | #define PARODD 0001000 | ||
135 | #define HUPCL 0002000 | ||
136 | #define CLOCAL 0004000 | ||
137 | #define CBAUDEX 0010000 | ||
138 | #define B57600 0010001 | ||
139 | #define B115200 0010002 | ||
140 | #define B230400 0010003 | ||
141 | #define B460800 0010004 | ||
142 | #define B500000 0010005 | ||
143 | #define B576000 0010006 | ||
144 | #define B921600 0010007 | ||
145 | #define B1000000 0010010 | ||
146 | #define B1152000 0010011 | ||
147 | #define B1500000 0010012 | ||
148 | #define B2000000 0010013 | ||
149 | #define B2500000 0010014 | ||
150 | #define B3000000 0010015 | ||
151 | #define B3500000 0010016 | ||
152 | #define B4000000 0010017 | ||
153 | #define CIBAUD 002003600000 /* input baud rate (not used) */ | ||
154 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
155 | #define CRTSCTS 020000000000 /* flow control */ | ||
156 | |||
157 | /* c_lflag bits */ | ||
158 | |||
159 | #define ISIG 0000001 | ||
160 | #define ICANON 0000002 | ||
161 | #define XCASE 0000004 | ||
162 | #define ECHO 0000010 | ||
163 | #define ECHOE 0000020 | ||
164 | #define ECHOK 0000040 | ||
165 | #define ECHONL 0000100 | ||
166 | #define NOFLSH 0000200 | ||
167 | #define TOSTOP 0000400 | ||
168 | #define ECHOCTL 0001000 | ||
169 | #define ECHOPRT 0002000 | ||
170 | #define ECHOKE 0004000 | ||
171 | #define FLUSHO 0010000 | ||
172 | #define PENDIN 0040000 | ||
173 | #define IEXTEN 0100000 | ||
174 | |||
175 | /* tcflow() and TCXONC use these */ | ||
176 | |||
177 | #define TCOOFF 0 | ||
178 | #define TCOON 1 | ||
179 | #define TCIOFF 2 | ||
180 | #define TCION 3 | ||
181 | |||
182 | /* tcflush() and TCFLSH use these */ | ||
183 | |||
184 | #define TCIFLUSH 0 | ||
185 | #define TCOFLUSH 1 | ||
186 | #define TCIOFLUSH 2 | ||
187 | |||
188 | /* tcsetattr uses these */ | ||
189 | |||
190 | #define TCSANOW 0 | ||
191 | #define TCSADRAIN 1 | ||
192 | #define TCSAFLUSH 2 | ||
193 | |||
194 | #endif /* _XTENSA_TERMBITS_H */ | ||
diff --git a/include/asm-xtensa/termios.h b/include/asm-xtensa/termios.h new file mode 100644 index 000000000000..83c6aed1d115 --- /dev/null +++ b/include/asm-xtensa/termios.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/termios.h | ||
3 | * | ||
4 | * Copied from SH. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_TERMIOS_H | ||
14 | #define _XTENSA_TERMIOS_H | ||
15 | |||
16 | #include <asm/termbits.h> | ||
17 | #include <asm/ioctls.h> | ||
18 | |||
19 | struct winsize { | ||
20 | unsigned short ws_row; | ||
21 | unsigned short ws_col; | ||
22 | unsigned short ws_xpixel; | ||
23 | unsigned short ws_ypixel; | ||
24 | }; | ||
25 | |||
26 | #define NCC 8 | ||
27 | struct termio { | ||
28 | unsigned short c_iflag; /* input mode flags */ | ||
29 | unsigned short c_oflag; /* output mode flags */ | ||
30 | unsigned short c_cflag; /* control mode flags */ | ||
31 | unsigned short c_lflag; /* local mode flags */ | ||
32 | unsigned char c_line; /* line discipline */ | ||
33 | unsigned char c_cc[NCC]; /* control characters */ | ||
34 | }; | ||
35 | |||
36 | /* Modem lines */ | ||
37 | |||
38 | #define TIOCM_LE 0x001 | ||
39 | #define TIOCM_DTR 0x002 | ||
40 | #define TIOCM_RTS 0x004 | ||
41 | #define TIOCM_ST 0x008 | ||
42 | #define TIOCM_SR 0x010 | ||
43 | #define TIOCM_CTS 0x020 | ||
44 | #define TIOCM_CAR 0x040 | ||
45 | #define TIOCM_RNG 0x080 | ||
46 | #define TIOCM_DSR 0x100 | ||
47 | #define TIOCM_CD TIOCM_CAR | ||
48 | #define TIOCM_RI TIOCM_RNG | ||
49 | #define TIOCM_OUT1 0x2000 | ||
50 | #define TIOCM_OUT2 0x4000 | ||
51 | #define TIOCM_LOOP 0x8000 | ||
52 | |||
53 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
54 | |||
55 | /* Line disciplines */ | ||
56 | |||
57 | #define N_TTY 0 | ||
58 | #define N_SLIP 1 | ||
59 | #define N_MOUSE 2 | ||
60 | #define N_PPP 3 | ||
61 | #define N_STRIP 4 | ||
62 | #define N_AX25 5 | ||
63 | #define N_X25 6 /* X.25 async */ | ||
64 | #define N_6PACK 7 | ||
65 | #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ | ||
66 | #define N_R3964 9 /* Reserved for Simatic R3964 module */ | ||
67 | #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ | ||
68 | #define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */ | ||
69 | #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ | ||
70 | #define N_HDLC 13 /* synchronous HDLC */ | ||
71 | #define N_SYNC_PPP 14 | ||
72 | #define N_HCI 15 /* Bluetooth HCI UART */ | ||
73 | |||
74 | #ifdef __KERNEL__ | ||
75 | |||
76 | /* intr=^C quit=^\ erase=del kill=^U | ||
77 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | ||
78 | start=^Q stop=^S susp=^Z eol=\0 | ||
79 | reprint=^R discard=^U werase=^W lnext=^V | ||
80 | eol2=\0 | ||
81 | */ | ||
82 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | ||
83 | |||
84 | /* | ||
85 | * Translate a "termio" structure into a "termios". Ugh. | ||
86 | */ | ||
87 | |||
88 | #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ | ||
89 | unsigned short __tmp; \ | ||
90 | get_user(__tmp,&(termio)->x); \ | ||
91 | *(unsigned short *) &(termios)->x = __tmp; \ | ||
92 | } | ||
93 | |||
94 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
95 | ({ \ | ||
96 | SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ | ||
97 | SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ | ||
98 | SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ | ||
99 | SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ | ||
100 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
101 | }) | ||
102 | |||
103 | /* | ||
104 | * Translate a "termios" structure into a "termio". Ugh. | ||
105 | */ | ||
106 | |||
107 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
108 | ({ \ | ||
109 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
110 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
111 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
112 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
113 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
114 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
115 | }) | ||
116 | |||
117 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) | ||
118 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) | ||
119 | |||
120 | #endif /* __KERNEL__ */ | ||
121 | |||
122 | #endif /* _XTENSA_TERMIOS_H */ | ||
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h new file mode 100644 index 000000000000..af208d41fd82 --- /dev/null +++ b/include/asm-xtensa/thread_info.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/thread_info.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_THREAD_INFO_H | ||
12 | #define _XTENSA_THREAD_INFO_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | # include <asm/processor.h> | ||
18 | #endif | ||
19 | |||
20 | /* | ||
21 | * low level task data that entry.S needs immediate access to | ||
22 | * - this struct should fit entirely inside of one cache line | ||
23 | * - this struct shares the supervisor stack pages | ||
24 | * - if the contents of this structure are changed, the assembly constants | ||
25 | * must also be changed | ||
26 | */ | ||
27 | |||
28 | #ifndef __ASSEMBLY__ | ||
29 | |||
30 | struct thread_info { | ||
31 | struct task_struct *task; /* main task structure */ | ||
32 | struct exec_domain *exec_domain; /* execution domain */ | ||
33 | unsigned long flags; /* low level flags */ | ||
34 | unsigned long status; /* thread-synchronous flags */ | ||
35 | __u32 cpu; /* current CPU */ | ||
36 | __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/ | ||
37 | |||
38 | mm_segment_t addr_limit; /* thread address space */ | ||
39 | struct restart_block restart_block; | ||
40 | |||
41 | |||
42 | }; | ||
43 | |||
44 | #else /* !__ASSEMBLY__ */ | ||
45 | |||
46 | /* offsets into the thread_info struct for assembly code access */ | ||
47 | #define TI_TASK 0x00000000 | ||
48 | #define TI_EXEC_DOMAIN 0x00000004 | ||
49 | #define TI_FLAGS 0x00000008 | ||
50 | #define TI_STATUS 0x0000000C | ||
51 | #define TI_CPU 0x00000010 | ||
52 | #define TI_PRE_COUNT 0x00000014 | ||
53 | #define TI_ADDR_LIMIT 0x00000018 | ||
54 | #define TI_RESTART_BLOCK 0x000001C | ||
55 | |||
56 | #endif | ||
57 | |||
58 | #define PREEMPT_ACTIVE 0x10000000 | ||
59 | |||
60 | /* | ||
61 | * macros/functions for gaining access to the thread information structure | ||
62 | * | ||
63 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
64 | */ | ||
65 | |||
66 | #ifndef __ASSEMBLY__ | ||
67 | |||
68 | #define INIT_THREAD_INFO(tsk) \ | ||
69 | { \ | ||
70 | .task = &tsk, \ | ||
71 | .exec_domain = &default_exec_domain, \ | ||
72 | .flags = 0, \ | ||
73 | .cpu = 0, \ | ||
74 | .preempt_count = 1, \ | ||
75 | .addr_limit = KERNEL_DS, \ | ||
76 | .restart_block = { \ | ||
77 | .fn = do_no_restart_syscall, \ | ||
78 | }, \ | ||
79 | } | ||
80 | |||
81 | #define init_thread_info (init_thread_union.thread_info) | ||
82 | #define init_stack (init_thread_union.stack) | ||
83 | |||
84 | /* how to get the thread information struct from C */ | ||
85 | static inline struct thread_info *current_thread_info(void) | ||
86 | { | ||
87 | struct thread_info *ti; | ||
88 | __asm__("extui %0,a1,0,13\n\t" | ||
89 | "xor %0, a1, %0" : "=&r" (ti) : ); | ||
90 | return ti; | ||
91 | } | ||
92 | |||
93 | /* thread information allocation */ | ||
94 | #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) | ||
95 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
96 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
97 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
98 | |||
99 | #else /* !__ASSEMBLY__ */ | ||
100 | |||
101 | /* how to get the thread information struct from ASM */ | ||
102 | #define GET_THREAD_INFO(reg,sp) \ | ||
103 | extui reg, sp, 0, 13; \ | ||
104 | xor reg, sp, reg | ||
105 | #endif | ||
106 | |||
107 | |||
108 | /* | ||
109 | * thread information flags | ||
110 | * - these are process state flags that various assembly files may need to access | ||
111 | * - pending work-to-be-done flags are in LSW | ||
112 | * - other flags in MSW | ||
113 | */ | ||
114 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
115 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
116 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
117 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
118 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ | ||
119 | #define TIF_IRET 5 /* return with iret */ | ||
120 | #define TIF_MEMDIE 6 | ||
121 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
122 | |||
123 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
124 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
125 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
126 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
127 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | ||
128 | #define _TIF_IRET (1<<TIF_IRET) | ||
129 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
130 | |||
131 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | ||
132 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | ||
133 | |||
134 | /* | ||
135 | * Thread-synchronous status. | ||
136 | * | ||
137 | * This is different from the flags in that nobody else | ||
138 | * ever touches our thread-synchronous status, so we don't | ||
139 | * have to worry about atomic accesses. | ||
140 | */ | ||
141 | #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ | ||
142 | |||
143 | #define THREAD_SIZE 8192 //(2*PAGE_SIZE) | ||
144 | |||
145 | #endif /* __KERNEL__ */ | ||
146 | #endif /* _XTENSA_THREAD_INFO */ | ||
diff --git a/include/asm-xtensa/timex.h b/include/asm-xtensa/timex.h new file mode 100644 index 000000000000..d14a3755a12b --- /dev/null +++ b/include/asm-xtensa/timex.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/timex.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TIMEX_H | ||
12 | #define _XTENSA_TIMEX_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | #include <linux/stringify.h> | ||
18 | |||
19 | #if XCHAL_INT_LEVEL(XCHAL_TIMER0_INTERRUPT) == 1 | ||
20 | # define LINUX_TIMER 0 | ||
21 | #elif XCHAL_INT_LEVEL(XCHAL_TIMER1_INTERRUPT) == 1 | ||
22 | # define LINUX_TIMER 1 | ||
23 | #elif XCHAL_INT_LEVEL(XCHAL_TIMER2_INTERRUPT) == 1 | ||
24 | # define LINUX_TIMER 2 | ||
25 | #else | ||
26 | # error "Bad timer number for Linux configurations!" | ||
27 | #endif | ||
28 | |||
29 | #define LINUX_TIMER_INT XCHAL_TIMER_INTERRUPT(LINUX_TIMER) | ||
30 | #define LINUX_TIMER_MASK (1L << LINUX_TIMER_INT) | ||
31 | |||
32 | #define CLOCK_TICK_RATE 1193180 /* (everyone is using this value) */ | ||
33 | #define CLOCK_TICK_FACTOR 20 /* Factor of both 10^6 and CLOCK_TICK_RATE */ | ||
34 | #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ | ||
35 | (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ | ||
36 | << (SHIFT_SCALE-SHIFT_HZ)) / HZ) | ||
37 | |||
38 | #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT | ||
39 | extern unsigned long ccount_per_jiffy; | ||
40 | extern unsigned long ccount_nsec; | ||
41 | #define CCOUNT_PER_JIFFY ccount_per_jiffy | ||
42 | #define CCOUNT_NSEC ccount_nsec | ||
43 | #else | ||
44 | #define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ)) | ||
45 | #define CCOUNT_NSEC (1000000000UL / CONFIG_XTENSA_CPU_CLOCK) | ||
46 | #endif | ||
47 | |||
48 | |||
49 | typedef unsigned long long cycles_t; | ||
50 | |||
51 | /* | ||
52 | * Only used for SMP. | ||
53 | */ | ||
54 | |||
55 | extern cycles_t cacheflush_time; | ||
56 | |||
57 | #define get_cycles() (0) | ||
58 | |||
59 | |||
60 | /* | ||
61 | * Register access. | ||
62 | */ | ||
63 | |||
64 | #define WSR_CCOUNT(r) __asm__("wsr %0,"__stringify(CCOUNT) :: "a" (r)) | ||
65 | #define RSR_CCOUNT(r) __asm__("rsr %0,"__stringify(CCOUNT) : "=a" (r)) | ||
66 | #define WSR_CCOMPARE(x,r) __asm__("wsr %0,"__stringify(CCOMPARE_0)"+"__stringify(x) :: "a"(r)) | ||
67 | #define RSR_CCOMPARE(x,r) __asm__("rsr %0,"__stringify(CCOMPARE_0)"+"__stringify(x) : "=a"(r)) | ||
68 | |||
69 | static inline unsigned long get_ccount (void) | ||
70 | { | ||
71 | unsigned long ccount; | ||
72 | RSR_CCOUNT(ccount); | ||
73 | return ccount; | ||
74 | } | ||
75 | |||
76 | static inline void set_ccount (unsigned long ccount) | ||
77 | { | ||
78 | WSR_CCOUNT(ccount); | ||
79 | } | ||
80 | |||
81 | static inline unsigned long get_linux_timer (void) | ||
82 | { | ||
83 | unsigned ccompare; | ||
84 | RSR_CCOMPARE(LINUX_TIMER, ccompare); | ||
85 | return ccompare; | ||
86 | } | ||
87 | |||
88 | static inline void set_linux_timer (unsigned long ccompare) | ||
89 | { | ||
90 | WSR_CCOMPARE(LINUX_TIMER, ccompare); | ||
91 | } | ||
92 | |||
93 | #endif /* __KERNEL__ */ | ||
94 | #endif /* _XTENSA_TIMEX_H */ | ||
diff --git a/include/asm-xtensa/tlb.h b/include/asm-xtensa/tlb.h new file mode 100644 index 000000000000..4562b2dcfbc0 --- /dev/null +++ b/include/asm-xtensa/tlb.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/tlb.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TLB_H | ||
12 | #define _XTENSA_TLB_H | ||
13 | |||
14 | #define tlb_start_vma(tlb,vma) do { } while (0) | ||
15 | #define tlb_end_vma(tlb,vma) do { } while (0) | ||
16 | #define __tlb_remove_tlb_entry(tlb,pte,addr) do { } while (0) | ||
17 | |||
18 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
19 | |||
20 | #include <asm-generic/tlb.h> | ||
21 | #include <asm/page.h> | ||
22 | |||
23 | #define __pte_free_tlb(tlb,pte) pte_free(pte) | ||
24 | |||
25 | #endif /* _XTENSA_TLB_H */ | ||
diff --git a/include/asm-xtensa/tlbflush.h b/include/asm-xtensa/tlbflush.h new file mode 100644 index 000000000000..23bfe9db45f5 --- /dev/null +++ b/include/asm-xtensa/tlbflush.h | |||
@@ -0,0 +1,200 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/tlbflush.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TLBFLUSH_H | ||
12 | #define _XTENSA_TLBFLUSH_H | ||
13 | |||
14 | #define DEBUG_TLB | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <asm/processor.h> | ||
19 | #include <linux/stringify.h> | ||
20 | |||
21 | /* TLB flushing: | ||
22 | * | ||
23 | * - flush_tlb_all() flushes all processes TLB entries | ||
24 | * - flush_tlb_mm(mm) flushes the specified mm context TLB entries | ||
25 | * - flush_tlb_page(mm, vmaddr) flushes a single page | ||
26 | * - flush_tlb_range(mm, start, end) flushes a range of pages | ||
27 | */ | ||
28 | |||
29 | extern void flush_tlb_all(void); | ||
30 | extern void flush_tlb_mm(struct mm_struct*); | ||
31 | extern void flush_tlb_page(struct vm_area_struct*,unsigned long); | ||
32 | extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long); | ||
33 | |||
34 | #define flush_tlb_kernel_range(start,end) flush_tlb_all() | ||
35 | |||
36 | |||
37 | /* This is calld in munmap when we have freed up some page-table pages. | ||
38 | * We don't need to do anything here, there's nothing special about our | ||
39 | * page-table pages. | ||
40 | */ | ||
41 | |||
42 | extern inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
43 | unsigned long start, unsigned long end) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | /* TLB operations. */ | ||
48 | |||
49 | #define ITLB_WAYS_LOG2 XCHAL_ITLB_WAY_BITS | ||
50 | #define DTLB_WAYS_LOG2 XCHAL_DTLB_WAY_BITS | ||
51 | #define ITLB_PROBE_SUCCESS (1 << ITLB_WAYS_LOG2) | ||
52 | #define DTLB_PROBE_SUCCESS (1 << DTLB_WAYS_LOG2) | ||
53 | |||
54 | extern inline unsigned long itlb_probe(unsigned long addr) | ||
55 | { | ||
56 | unsigned long tmp; | ||
57 | __asm__ __volatile__("pitlb %0, %1\n\t" : "=a" (tmp) : "a" (addr)); | ||
58 | return tmp; | ||
59 | } | ||
60 | |||
61 | extern inline unsigned long dtlb_probe(unsigned long addr) | ||
62 | { | ||
63 | unsigned long tmp; | ||
64 | __asm__ __volatile__("pdtlb %0, %1\n\t" : "=a" (tmp) : "a" (addr)); | ||
65 | return tmp; | ||
66 | } | ||
67 | |||
68 | extern inline void invalidate_itlb_entry (unsigned long probe) | ||
69 | { | ||
70 | __asm__ __volatile__("iitlb %0; isync\n\t" : : "a" (probe)); | ||
71 | } | ||
72 | |||
73 | extern inline void invalidate_dtlb_entry (unsigned long probe) | ||
74 | { | ||
75 | __asm__ __volatile__("idtlb %0; dsync\n\t" : : "a" (probe)); | ||
76 | } | ||
77 | |||
78 | /* Use the .._no_isync functions with caution. Generally, these are | ||
79 | * handy for bulk invalidates followed by a single 'isync'. The | ||
80 | * caller must follow up with an 'isync', which can be relatively | ||
81 | * expensive on some Xtensa implementations. | ||
82 | */ | ||
83 | extern inline void invalidate_itlb_entry_no_isync (unsigned entry) | ||
84 | { | ||
85 | /* Caller must follow up with 'isync'. */ | ||
86 | __asm__ __volatile__ ("iitlb %0\n" : : "a" (entry) ); | ||
87 | } | ||
88 | |||
89 | extern inline void invalidate_dtlb_entry_no_isync (unsigned entry) | ||
90 | { | ||
91 | /* Caller must follow up with 'isync'. */ | ||
92 | __asm__ __volatile__ ("idtlb %0\n" : : "a" (entry) ); | ||
93 | } | ||
94 | |||
95 | extern inline void set_itlbcfg_register (unsigned long val) | ||
96 | { | ||
97 | __asm__ __volatile__("wsr %0, "__stringify(ITLBCFG)"\n\t" "isync\n\t" | ||
98 | : : "a" (val)); | ||
99 | } | ||
100 | |||
101 | extern inline void set_dtlbcfg_register (unsigned long val) | ||
102 | { | ||
103 | __asm__ __volatile__("wsr %0, "__stringify(DTLBCFG)"; dsync\n\t" | ||
104 | : : "a" (val)); | ||
105 | } | ||
106 | |||
107 | extern inline void set_ptevaddr_register (unsigned long val) | ||
108 | { | ||
109 | __asm__ __volatile__(" wsr %0, "__stringify(PTEVADDR)"; isync\n" | ||
110 | : : "a" (val)); | ||
111 | } | ||
112 | |||
113 | extern inline unsigned long read_ptevaddr_register (void) | ||
114 | { | ||
115 | unsigned long tmp; | ||
116 | __asm__ __volatile__("rsr %0, "__stringify(PTEVADDR)"\n\t" : "=a" (tmp)); | ||
117 | return tmp; | ||
118 | } | ||
119 | |||
120 | extern inline void write_dtlb_entry (pte_t entry, int way) | ||
121 | { | ||
122 | __asm__ __volatile__("wdtlb %1, %0; dsync\n\t" | ||
123 | : : "r" (way), "r" (entry) ); | ||
124 | } | ||
125 | |||
126 | extern inline void write_itlb_entry (pte_t entry, int way) | ||
127 | { | ||
128 | __asm__ __volatile__("witlb %1, %0; isync\n\t" | ||
129 | : : "r" (way), "r" (entry) ); | ||
130 | } | ||
131 | |||
132 | extern inline void invalidate_page_directory (void) | ||
133 | { | ||
134 | invalidate_dtlb_entry (DTLB_WAY_PGTABLE); | ||
135 | } | ||
136 | |||
137 | extern inline void invalidate_itlb_mapping (unsigned address) | ||
138 | { | ||
139 | unsigned long tlb_entry; | ||
140 | while ((tlb_entry = itlb_probe (address)) & ITLB_PROBE_SUCCESS) | ||
141 | invalidate_itlb_entry (tlb_entry); | ||
142 | } | ||
143 | |||
144 | extern inline void invalidate_dtlb_mapping (unsigned address) | ||
145 | { | ||
146 | unsigned long tlb_entry; | ||
147 | while ((tlb_entry = dtlb_probe (address)) & DTLB_PROBE_SUCCESS) | ||
148 | invalidate_dtlb_entry (tlb_entry); | ||
149 | } | ||
150 | |||
151 | #define check_pgt_cache() do { } while (0) | ||
152 | |||
153 | |||
154 | #ifdef DEBUG_TLB | ||
155 | |||
156 | /* DO NOT USE THESE FUNCTIONS. These instructions aren't part of the Xtensa | ||
157 | * ISA and exist only for test purposes.. | ||
158 | * You may find it helpful for MMU debugging, however. | ||
159 | * | ||
160 | * 'at' is the unmodified input register | ||
161 | * 'as' is the output register, as follows (specific to the Linux config): | ||
162 | * | ||
163 | * as[31..12] contain the virtual address | ||
164 | * as[11..08] are meaningless | ||
165 | * as[07..00] contain the asid | ||
166 | */ | ||
167 | |||
168 | extern inline unsigned long read_dtlb_virtual (int way) | ||
169 | { | ||
170 | unsigned long tmp; | ||
171 | __asm__ __volatile__("rdtlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
172 | return tmp; | ||
173 | } | ||
174 | |||
175 | extern inline unsigned long read_dtlb_translation (int way) | ||
176 | { | ||
177 | unsigned long tmp; | ||
178 | __asm__ __volatile__("rdtlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
179 | return tmp; | ||
180 | } | ||
181 | |||
182 | extern inline unsigned long read_itlb_virtual (int way) | ||
183 | { | ||
184 | unsigned long tmp; | ||
185 | __asm__ __volatile__("ritlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
186 | return tmp; | ||
187 | } | ||
188 | |||
189 | extern inline unsigned long read_itlb_translation (int way) | ||
190 | { | ||
191 | unsigned long tmp; | ||
192 | __asm__ __volatile__("ritlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
193 | return tmp; | ||
194 | } | ||
195 | |||
196 | #endif /* DEBUG_TLB */ | ||
197 | |||
198 | |||
199 | #endif /* __KERNEL__ */ | ||
200 | #endif /* _XTENSA_PGALLOC_H */ | ||
diff --git a/include/asm-xtensa/topology.h b/include/asm-xtensa/topology.h new file mode 100644 index 000000000000..7309e38a0ccb --- /dev/null +++ b/include/asm-xtensa/topology.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/topology.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TOPOLOGY_H | ||
12 | #define _XTENSA_TOPOLOGY_H | ||
13 | |||
14 | #include <asm-generic/topology.h> | ||
15 | |||
16 | #endif /* _XTENSA_TOPOLOGY_H */ | ||
diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h new file mode 100644 index 000000000000..ebac00469852 --- /dev/null +++ b/include/asm-xtensa/types.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/types.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TYPES_H | ||
12 | #define _XTENSA_TYPES_H | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | typedef unsigned short umode_t; | ||
17 | |||
18 | /* | ||
19 | * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the | ||
20 | * header files exported to user space | ||
21 | */ | ||
22 | |||
23 | typedef __signed__ char __s8; | ||
24 | typedef unsigned char __u8; | ||
25 | |||
26 | typedef __signed__ short __s16; | ||
27 | typedef unsigned short __u16; | ||
28 | |||
29 | typedef __signed__ int __s32; | ||
30 | typedef unsigned int __u32; | ||
31 | |||
32 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) | ||
33 | typedef __signed__ long long __s64; | ||
34 | typedef unsigned long long __u64; | ||
35 | #endif | ||
36 | |||
37 | /* | ||
38 | * These aren't exported outside the kernel to avoid name space clashes | ||
39 | */ | ||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | typedef __signed__ char s8; | ||
43 | typedef unsigned char u8; | ||
44 | |||
45 | typedef __signed__ short s16; | ||
46 | typedef unsigned short u16; | ||
47 | |||
48 | typedef __signed__ int s32; | ||
49 | typedef unsigned int u32; | ||
50 | |||
51 | typedef __signed__ long long s64; | ||
52 | typedef unsigned long long u64; | ||
53 | |||
54 | |||
55 | #define BITS_PER_LONG 32 | ||
56 | |||
57 | /* Dma addresses are 32-bits wide. */ | ||
58 | |||
59 | typedef u32 dma_addr_t; | ||
60 | |||
61 | typedef unsigned int kmem_bufctl_t; | ||
62 | |||
63 | #endif /* __KERNEL__ */ | ||
64 | #endif | ||
65 | |||
66 | #endif /* _XTENSA_TYPES_H */ | ||
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h new file mode 100644 index 000000000000..35576b25c7b2 --- /dev/null +++ b/include/asm-xtensa/uaccess.h | |||
@@ -0,0 +1,532 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/uaccess.h | ||
3 | * | ||
4 | * User space memory access functions | ||
5 | * | ||
6 | * These routines provide basic accessing functions to the user memory | ||
7 | * space for the kernel. This header file provides fuctions such as: | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file "COPYING" in the main directory of this archive | ||
11 | * for more details. | ||
12 | * | ||
13 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
14 | */ | ||
15 | |||
16 | #ifndef _XTENSA_UACCESS_H | ||
17 | #define _XTENSA_UACCESS_H | ||
18 | |||
19 | #include <linux/errno.h> | ||
20 | |||
21 | #define VERIFY_READ 0 | ||
22 | #define VERIFY_WRITE 1 | ||
23 | |||
24 | #ifdef __ASSEMBLY__ | ||
25 | |||
26 | #define _ASMLANGUAGE | ||
27 | #include <asm/current.h> | ||
28 | #include <asm/offsets.h> | ||
29 | #include <asm/processor.h> | ||
30 | |||
31 | /* | ||
32 | * These assembly macros mirror the C macros that follow below. They | ||
33 | * should always have identical functionality. See | ||
34 | * arch/xtensa/kernel/sys.S for usage. | ||
35 | */ | ||
36 | |||
37 | #define KERNEL_DS 0 | ||
38 | #define USER_DS 1 | ||
39 | |||
40 | #define get_ds (KERNEL_DS) | ||
41 | |||
42 | /* | ||
43 | * get_fs reads current->thread.current_ds into a register. | ||
44 | * On Entry: | ||
45 | * <ad> anything | ||
46 | * <sp> stack | ||
47 | * On Exit: | ||
48 | * <ad> contains current->thread.current_ds | ||
49 | */ | ||
50 | .macro get_fs ad, sp | ||
51 | GET_CURRENT(\ad,\sp) | ||
52 | l32i \ad, \ad, THREAD_CURRENT_DS | ||
53 | .endm | ||
54 | |||
55 | /* | ||
56 | * set_fs sets current->thread.current_ds to some value. | ||
57 | * On Entry: | ||
58 | * <at> anything (temp register) | ||
59 | * <av> value to write | ||
60 | * <sp> stack | ||
61 | * On Exit: | ||
62 | * <at> destroyed (actually, current) | ||
63 | * <av> preserved, value to write | ||
64 | */ | ||
65 | .macro set_fs at, av, sp | ||
66 | GET_CURRENT(\at,\sp) | ||
67 | s32i \av, \at, THREAD_CURRENT_DS | ||
68 | .endm | ||
69 | |||
70 | /* | ||
71 | * kernel_ok determines whether we should bypass addr/size checking. | ||
72 | * See the equivalent C-macro version below for clarity. | ||
73 | * On success, kernel_ok branches to a label indicated by parameter | ||
74 | * <success>. This implies that the macro falls through to the next | ||
75 | * insruction on an error. | ||
76 | * | ||
77 | * Note that while this macro can be used independently, we designed | ||
78 | * in for optimal use in the access_ok macro below (i.e., we fall | ||
79 | * through on error). | ||
80 | * | ||
81 | * On Entry: | ||
82 | * <at> anything (temp register) | ||
83 | * <success> label to branch to on success; implies | ||
84 | * fall-through macro on error | ||
85 | * <sp> stack pointer | ||
86 | * On Exit: | ||
87 | * <at> destroyed (actually, current->thread.current_ds) | ||
88 | */ | ||
89 | |||
90 | #if ((KERNEL_DS != 0) || (USER_DS == 0)) | ||
91 | # error Assembly macro kernel_ok fails | ||
92 | #endif | ||
93 | .macro kernel_ok at, sp, success | ||
94 | get_fs \at, \sp | ||
95 | beqz \at, \success | ||
96 | .endm | ||
97 | |||
98 | /* | ||
99 | * user_ok determines whether the access to user-space memory is allowed. | ||
100 | * See the equivalent C-macro version below for clarity. | ||
101 | * | ||
102 | * On error, user_ok branches to a label indicated by parameter | ||
103 | * <error>. This implies that the macro falls through to the next | ||
104 | * instruction on success. | ||
105 | * | ||
106 | * Note that while this macro can be used independently, we designed | ||
107 | * in for optimal use in the access_ok macro below (i.e., we fall | ||
108 | * through on success). | ||
109 | * | ||
110 | * On Entry: | ||
111 | * <aa> register containing memory address | ||
112 | * <as> register containing memory size | ||
113 | * <at> temp register | ||
114 | * <error> label to branch to on error; implies fall-through | ||
115 | * macro on success | ||
116 | * On Exit: | ||
117 | * <aa> preserved | ||
118 | * <as> preserved | ||
119 | * <at> destroyed (actually, (TASK_SIZE + 1 - size)) | ||
120 | */ | ||
121 | .macro user_ok aa, as, at, error | ||
122 | movi \at, (TASK_SIZE+1) | ||
123 | bgeu \as, \at, \error | ||
124 | sub \at, \at, \as | ||
125 | bgeu \aa, \at, \error | ||
126 | .endm | ||
127 | |||
128 | /* | ||
129 | * access_ok determines whether a memory access is allowed. See the | ||
130 | * equivalent C-macro version below for clarity. | ||
131 | * | ||
132 | * On error, access_ok branches to a label indicated by parameter | ||
133 | * <error>. This implies that the macro falls through to the next | ||
134 | * instruction on success. | ||
135 | * | ||
136 | * Note that we assume success is the common case, and we optimize the | ||
137 | * branch fall-through case on success. | ||
138 | * | ||
139 | * On Entry: | ||
140 | * <aa> register containing memory address | ||
141 | * <as> register containing memory size | ||
142 | * <at> temp register | ||
143 | * <sp> | ||
144 | * <error> label to branch to on error; implies fall-through | ||
145 | * macro on success | ||
146 | * On Exit: | ||
147 | * <aa> preserved | ||
148 | * <as> preserved | ||
149 | * <at> destroyed | ||
150 | */ | ||
151 | .macro access_ok aa, as, at, sp, error | ||
152 | kernel_ok \at, \sp, .Laccess_ok_\@ | ||
153 | user_ok \aa, \as, \at, \error | ||
154 | .Laccess_ok_\@: | ||
155 | .endm | ||
156 | |||
157 | /* | ||
158 | * verify_area determines whether a memory access is allowed. It's | ||
159 | * mostly an unnecessary wrapper for access_ok, but we provide it as a | ||
160 | * duplicate of the verify_area() C inline function below. See the | ||
161 | * equivalent C version below for clarity. | ||
162 | * | ||
163 | * On error, verify_area branches to a label indicated by parameter | ||
164 | * <error>. This implies that the macro falls through to the next | ||
165 | * instruction on success. | ||
166 | * | ||
167 | * Note that we assume success is the common case, and we optimize the | ||
168 | * branch fall-through case on success. | ||
169 | * | ||
170 | * On Entry: | ||
171 | * <aa> register containing memory address | ||
172 | * <as> register containing memory size | ||
173 | * <at> temp register | ||
174 | * <error> label to branch to on error; implies fall-through | ||
175 | * macro on success | ||
176 | * On Exit: | ||
177 | * <aa> preserved | ||
178 | * <as> preserved | ||
179 | * <at> destroyed | ||
180 | */ | ||
181 | .macro verify_area aa, as, at, sp, error | ||
182 | access_ok \at, \aa, \as, \sp, \error | ||
183 | .endm | ||
184 | |||
185 | |||
186 | #else /* __ASSEMBLY__ not defined */ | ||
187 | |||
188 | #include <linux/sched.h> | ||
189 | #include <asm/types.h> | ||
190 | |||
191 | /* | ||
192 | * The fs value determines whether argument validity checking should | ||
193 | * be performed or not. If get_fs() == USER_DS, checking is | ||
194 | * performed, with get_fs() == KERNEL_DS, checking is bypassed. | ||
195 | * | ||
196 | * For historical reasons (Data Segment Register?), these macros are | ||
197 | * grossly misnamed. | ||
198 | */ | ||
199 | |||
200 | #define KERNEL_DS ((mm_segment_t) { 0 }) | ||
201 | #define USER_DS ((mm_segment_t) { 1 }) | ||
202 | |||
203 | #define get_ds() (KERNEL_DS) | ||
204 | #define get_fs() (current->thread.current_ds) | ||
205 | #define set_fs(val) (current->thread.current_ds = (val)) | ||
206 | |||
207 | #define segment_eq(a,b) ((a).seg == (b).seg) | ||
208 | |||
209 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) | ||
210 | #define __user_ok(addr,size) (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) | ||
211 | #define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) | ||
212 | #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) | ||
213 | |||
214 | extern inline int verify_area(int type, const void * addr, unsigned long size) | ||
215 | { | ||
216 | return access_ok(type,addr,size) ? 0 : -EFAULT; | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * These are the main single-value transfer routines. They | ||
221 | * automatically use the right size if we just have the right pointer | ||
222 | * type. | ||
223 | * | ||
224 | * This gets kind of ugly. We want to return _two_ values in | ||
225 | * "get_user()" and yet we don't want to do any pointers, because that | ||
226 | * is too much of a performance impact. Thus we have a few rather ugly | ||
227 | * macros here, and hide all the uglyness from the user. | ||
228 | * | ||
229 | * Careful to not | ||
230 | * (a) re-use the arguments for side effects (sizeof is ok) | ||
231 | * (b) require any knowledge of processes at this stage | ||
232 | */ | ||
233 | #define put_user(x,ptr) __put_user_check((x),(ptr),sizeof(*(ptr))) | ||
234 | #define get_user(x,ptr) __get_user_check((x),(ptr),sizeof(*(ptr))) | ||
235 | |||
236 | /* | ||
237 | * The "__xxx" versions of the user access functions are versions that | ||
238 | * do not verify the address space, that must have been done previously | ||
239 | * with a separate "access_ok()" call (this is used when we do multiple | ||
240 | * accesses to the same area of user memory). | ||
241 | */ | ||
242 | #define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
243 | #define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
244 | |||
245 | |||
246 | extern long __put_user_bad(void); | ||
247 | |||
248 | #define __put_user_nocheck(x,ptr,size) \ | ||
249 | ({ \ | ||
250 | long __pu_err; \ | ||
251 | __put_user_size((x),(ptr),(size),__pu_err); \ | ||
252 | __pu_err; \ | ||
253 | }) | ||
254 | |||
255 | #define __put_user_check(x,ptr,size) \ | ||
256 | ({ \ | ||
257 | long __pu_err = -EFAULT; \ | ||
258 | __typeof__(*(ptr)) *__pu_addr = (ptr); \ | ||
259 | if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ | ||
260 | __put_user_size((x),__pu_addr,(size),__pu_err); \ | ||
261 | __pu_err; \ | ||
262 | }) | ||
263 | |||
264 | #define __put_user_size(x,ptr,size,retval) \ | ||
265 | do { \ | ||
266 | retval = 0; \ | ||
267 | switch (size) { \ | ||
268 | case 1: __put_user_asm(x,ptr,retval,1,"s8i"); break; \ | ||
269 | case 2: __put_user_asm(x,ptr,retval,2,"s16i"); break; \ | ||
270 | case 4: __put_user_asm(x,ptr,retval,4,"s32i"); break; \ | ||
271 | case 8: { \ | ||
272 | __typeof__(*ptr) __v64 = x; \ | ||
273 | retval = __copy_to_user(ptr,&__v64,8); \ | ||
274 | break; \ | ||
275 | } \ | ||
276 | default: __put_user_bad(); \ | ||
277 | } \ | ||
278 | } while (0) | ||
279 | |||
280 | |||
281 | /* | ||
282 | * Consider a case of a user single load/store would cause both an | ||
283 | * unaligned exception and an MMU-related exception (unaligned | ||
284 | * exceptions happen first): | ||
285 | * | ||
286 | * User code passes a bad variable ptr to a system call. | ||
287 | * Kernel tries to access the variable. | ||
288 | * Unaligned exception occurs. | ||
289 | * Unaligned exception handler tries to make aligned accesses. | ||
290 | * Double exception occurs for MMU-related cause (e.g., page not mapped). | ||
291 | * do_page_fault() thinks the fault address belongs to the kernel, not the | ||
292 | * user, and panics. | ||
293 | * | ||
294 | * The kernel currently prohibits user unaligned accesses. We use the | ||
295 | * __check_align_* macros to check for unaligned addresses before | ||
296 | * accessing user space so we don't crash the kernel. Both | ||
297 | * __put_user_asm and __get_user_asm use these alignment macros, so | ||
298 | * macro-specific labels such as 0f, 1f, %0, %2, and %3 must stay in | ||
299 | * sync. | ||
300 | */ | ||
301 | |||
302 | #define __check_align_1 "" | ||
303 | |||
304 | #define __check_align_2 \ | ||
305 | " _bbci.l %2, 0, 1f \n" \ | ||
306 | " movi %0, %3 \n" \ | ||
307 | " _j 2f \n" | ||
308 | |||
309 | #define __check_align_4 \ | ||
310 | " _bbsi.l %2, 0, 0f \n" \ | ||
311 | " _bbci.l %2, 1, 1f \n" \ | ||
312 | "0: movi %0, %3 \n" \ | ||
313 | " _j 2f \n" | ||
314 | |||
315 | |||
316 | /* | ||
317 | * We don't tell gcc that we are accessing memory, but this is OK | ||
318 | * because we do not write to any memory gcc knows about, so there | ||
319 | * are no aliasing issues. | ||
320 | * | ||
321 | * WARNING: If you modify this macro at all, verify that the | ||
322 | * __check_align_* macros still work. | ||
323 | */ | ||
324 | #define __put_user_asm(x, addr, err, align, insn) \ | ||
325 | __asm__ __volatile__( \ | ||
326 | __check_align_##align \ | ||
327 | "1: "insn" %1, %2, 0 \n" \ | ||
328 | "2: \n" \ | ||
329 | " .section .fixup,\"ax\" \n" \ | ||
330 | " .align 4 \n" \ | ||
331 | "4: \n" \ | ||
332 | " .long 2b \n" \ | ||
333 | "5: \n" \ | ||
334 | " l32r %2, 4b \n" \ | ||
335 | " movi %0, %3 \n" \ | ||
336 | " jx %2 \n" \ | ||
337 | " .previous \n" \ | ||
338 | " .section __ex_table,\"a\" \n" \ | ||
339 | " .long 1b, 5b \n" \ | ||
340 | " .previous" \ | ||
341 | :"=r" (err) \ | ||
342 | :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err)) | ||
343 | |||
344 | #define __get_user_nocheck(x,ptr,size) \ | ||
345 | ({ \ | ||
346 | long __gu_err, __gu_val; \ | ||
347 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ | ||
348 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
349 | __gu_err; \ | ||
350 | }) | ||
351 | |||
352 | #define __get_user_check(x,ptr,size) \ | ||
353 | ({ \ | ||
354 | long __gu_err = -EFAULT, __gu_val = 0; \ | ||
355 | const __typeof__(*(ptr)) *__gu_addr = (ptr); \ | ||
356 | if (access_ok(VERIFY_READ,__gu_addr,size)) \ | ||
357 | __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \ | ||
358 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
359 | __gu_err; \ | ||
360 | }) | ||
361 | |||
362 | extern long __get_user_bad(void); | ||
363 | |||
364 | #define __get_user_size(x,ptr,size,retval) \ | ||
365 | do { \ | ||
366 | retval = 0; \ | ||
367 | switch (size) { \ | ||
368 | case 1: __get_user_asm(x,ptr,retval,1,"l8ui"); break; \ | ||
369 | case 2: __get_user_asm(x,ptr,retval,2,"l16ui"); break; \ | ||
370 | case 4: __get_user_asm(x,ptr,retval,4,"l32i"); break; \ | ||
371 | case 8: retval = __copy_from_user(&x,ptr,8); break; \ | ||
372 | default: (x) = __get_user_bad(); \ | ||
373 | } \ | ||
374 | } while (0) | ||
375 | |||
376 | |||
377 | /* | ||
378 | * WARNING: If you modify this macro at all, verify that the | ||
379 | * __check_align_* macros still work. | ||
380 | */ | ||
381 | #define __get_user_asm(x, addr, err, align, insn) \ | ||
382 | __asm__ __volatile__( \ | ||
383 | __check_align_##align \ | ||
384 | "1: "insn" %1, %2, 0 \n" \ | ||
385 | "2: \n" \ | ||
386 | " .section .fixup,\"ax\" \n" \ | ||
387 | " .align 4 \n" \ | ||
388 | "4: \n" \ | ||
389 | " .long 2b \n" \ | ||
390 | "5: \n" \ | ||
391 | " l32r %2, 4b \n" \ | ||
392 | " movi %1, 0 \n" \ | ||
393 | " movi %0, %3 \n" \ | ||
394 | " jx %2 \n" \ | ||
395 | " .previous \n" \ | ||
396 | " .section __ex_table,\"a\" \n" \ | ||
397 | " .long 1b, 5b \n" \ | ||
398 | " .previous" \ | ||
399 | :"=r" (err), "=r" (x) \ | ||
400 | :"r" (addr), "i" (-EFAULT), "0" (err)) | ||
401 | |||
402 | |||
403 | /* | ||
404 | * Copy to/from user space | ||
405 | */ | ||
406 | |||
407 | /* | ||
408 | * We use a generic, arbitrary-sized copy subroutine. The Xtensa | ||
409 | * architecture would cause heavy code bloat if we tried to inline | ||
410 | * these functions and provide __constant_copy_* equivalents like the | ||
411 | * i386 versions. __xtensa_copy_user is quite efficient. See the | ||
412 | * .fixup section of __xtensa_copy_user for a discussion on the | ||
413 | * X_zeroing equivalents for Xtensa. | ||
414 | */ | ||
415 | |||
416 | extern unsigned __xtensa_copy_user(void *to, const void *from, unsigned n); | ||
417 | #define __copy_user(to,from,size) __xtensa_copy_user(to,from,size) | ||
418 | |||
419 | |||
420 | static inline unsigned long | ||
421 | __generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n) | ||
422 | { | ||
423 | return __copy_user(to,from,n); | ||
424 | } | ||
425 | |||
426 | static inline unsigned long | ||
427 | __generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n) | ||
428 | { | ||
429 | return __copy_user(to,from,n); | ||
430 | } | ||
431 | |||
432 | static inline unsigned long | ||
433 | __generic_copy_to_user(void *to, const void *from, unsigned long n) | ||
434 | { | ||
435 | prefetch(from); | ||
436 | if (access_ok(VERIFY_WRITE, to, n)) | ||
437 | return __copy_user(to,from,n); | ||
438 | return n; | ||
439 | } | ||
440 | |||
441 | static inline unsigned long | ||
442 | __generic_copy_from_user(void *to, const void *from, unsigned long n) | ||
443 | { | ||
444 | prefetchw(to); | ||
445 | if (access_ok(VERIFY_READ, from, n)) | ||
446 | return __copy_user(to,from,n); | ||
447 | else | ||
448 | memset(to, 0, n); | ||
449 | return n; | ||
450 | } | ||
451 | |||
452 | #define copy_to_user(to,from,n) __generic_copy_to_user((to),(from),(n)) | ||
453 | #define copy_from_user(to,from,n) __generic_copy_from_user((to),(from),(n)) | ||
454 | #define __copy_to_user(to,from,n) __generic_copy_to_user_nocheck((to),(from),(n)) | ||
455 | #define __copy_from_user(to,from,n) __generic_copy_from_user_nocheck((to),(from),(n)) | ||
456 | #define __copy_to_user_inatomic __copy_to_user | ||
457 | #define __copy_from_user_inatomic __copy_from_user | ||
458 | |||
459 | |||
460 | /* | ||
461 | * We need to return the number of bytes not cleared. Our memset() | ||
462 | * returns zero if a problem occurs while accessing user-space memory. | ||
463 | * In that event, return no memory cleared. Otherwise, zero for | ||
464 | * success. | ||
465 | */ | ||
466 | |||
467 | extern inline unsigned long | ||
468 | __xtensa_clear_user(void *addr, unsigned long size) | ||
469 | { | ||
470 | if ( ! memset(addr, 0, size) ) | ||
471 | return size; | ||
472 | return 0; | ||
473 | } | ||
474 | |||
475 | extern inline unsigned long | ||
476 | clear_user(void *addr, unsigned long size) | ||
477 | { | ||
478 | if (access_ok(VERIFY_WRITE, addr, size)) | ||
479 | return __xtensa_clear_user(addr, size); | ||
480 | return size ? -EFAULT : 0; | ||
481 | } | ||
482 | |||
483 | #define __clear_user __xtensa_clear_user | ||
484 | |||
485 | |||
486 | extern long __strncpy_user(char *, const char *, long); | ||
487 | #define __strncpy_from_user __strncpy_user | ||
488 | |||
489 | extern inline long | ||
490 | strncpy_from_user(char *dst, const char *src, long count) | ||
491 | { | ||
492 | if (access_ok(VERIFY_READ, src, 1)) | ||
493 | return __strncpy_from_user(dst, src, count); | ||
494 | return -EFAULT; | ||
495 | } | ||
496 | |||
497 | |||
498 | #define strlen_user(str) strnlen_user((str), TASK_SIZE - 1) | ||
499 | |||
500 | /* | ||
501 | * Return the size of a string (including the ending 0!) | ||
502 | */ | ||
503 | extern long __strnlen_user(const char *, long); | ||
504 | |||
505 | extern inline long strnlen_user(const char *str, long len) | ||
506 | { | ||
507 | unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1; | ||
508 | |||
509 | if ((unsigned long)str > top) | ||
510 | return 0; | ||
511 | return __strnlen_user(str, len); | ||
512 | } | ||
513 | |||
514 | |||
515 | struct exception_table_entry | ||
516 | { | ||
517 | unsigned long insn, fixup; | ||
518 | }; | ||
519 | |||
520 | /* Returns 0 if exception not found and fixup.unit otherwise. */ | ||
521 | |||
522 | extern unsigned long search_exception_table(unsigned long addr); | ||
523 | extern void sort_exception_table(void); | ||
524 | |||
525 | /* Returns the new pc */ | ||
526 | #define fixup_exception(map_reg, fixup_unit, pc) \ | ||
527 | ({ \ | ||
528 | fixup_unit; \ | ||
529 | }) | ||
530 | |||
531 | #endif /* __ASSEMBLY__ */ | ||
532 | #endif /* _XTENSA_UACCESS_H */ | ||
diff --git a/include/asm-xtensa/ucontext.h b/include/asm-xtensa/ucontext.h new file mode 100644 index 000000000000..94c94ed3e00a --- /dev/null +++ b/include/asm-xtensa/ucontext.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ucontext.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_UCONTEXT_H | ||
12 | #define _XTENSA_UCONTEXT_H | ||
13 | |||
14 | struct ucontext { | ||
15 | unsigned long uc_flags; | ||
16 | struct ucontext *uc_link; | ||
17 | stack_t uc_stack; | ||
18 | struct sigcontext uc_mcontext; | ||
19 | sigset_t uc_sigmask; /* mask last for extensibility */ | ||
20 | }; | ||
21 | |||
22 | #endif /* _XTENSA_UCONTEXT_H */ | ||
diff --git a/include/asm-xtensa/unaligned.h b/include/asm-xtensa/unaligned.h new file mode 100644 index 000000000000..28220890d0a6 --- /dev/null +++ b/include/asm-xtensa/unaligned.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/unaligned.h | ||
3 | * | ||
4 | * Xtensa doesn't handle unaligned accesses efficiently. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_UNALIGNED_H | ||
14 | #define _XTENSA_UNALIGNED_H | ||
15 | |||
16 | #include <linux/string.h> | ||
17 | |||
18 | /* Use memmove here, so gcc does not insert a __builtin_memcpy. */ | ||
19 | |||
20 | #define get_unaligned(ptr) \ | ||
21 | ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) | ||
22 | |||
23 | #define put_unaligned(val, ptr) \ | ||
24 | ({ __typeof__(*(ptr)) __tmp = (val); \ | ||
25 | memmove((ptr), &__tmp, sizeof(*(ptr))); \ | ||
26 | (void)0; }) | ||
27 | |||
28 | #endif /* _XTENSA_UNALIGNED_H */ | ||
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h new file mode 100644 index 000000000000..64c64dd83ba4 --- /dev/null +++ b/include/asm-xtensa/unistd.h | |||
@@ -0,0 +1,537 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/unistd.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_UNISTD_H | ||
12 | #define _XTENSA_UNISTD_H | ||
13 | |||
14 | #include <linux/linkage.h> | ||
15 | |||
16 | //#define __NR_setup 0 /* used only by init, to get system going */ | ||
17 | #define __NR_spill 0 | ||
18 | #define __NR_exit 1 | ||
19 | #define __NR_fork 2 | ||
20 | #define __NR_read 3 | ||
21 | #define __NR_write 4 | ||
22 | #define __NR_open 5 | ||
23 | #define __NR_close 6 | ||
24 | #define __NR_waitpid 7 | ||
25 | #define __NR_creat 8 | ||
26 | #define __NR_link 9 | ||
27 | #define __NR_unlink 10 | ||
28 | #define __NR_execve 11 | ||
29 | #define __NR_chdir 12 | ||
30 | #define __NR_time 13 | ||
31 | #define __NR_mknod 14 | ||
32 | #define __NR_chmod 15 | ||
33 | #define __NR_lchown 16 | ||
34 | #define __NR_break 17 | ||
35 | #define __NR_oldstat 18 | ||
36 | #define __NR_lseek 19 | ||
37 | #define __NR_getpid 20 | ||
38 | #define __NR_mount 21 | ||
39 | #define __NR_oldumount 22 | ||
40 | #define __NR_setuid 23 | ||
41 | #define __NR_getuid 24 | ||
42 | #define __NR_stime 25 | ||
43 | #define __NR_ptrace 26 | ||
44 | #define __NR_alarm 27 | ||
45 | #define __NR_oldfstat 28 | ||
46 | #define __NR_pause 29 | ||
47 | #define __NR_utime 30 | ||
48 | #define __NR_stty 31 | ||
49 | #define __NR_gtty 32 | ||
50 | #define __NR_access 33 | ||
51 | #define __NR_nice 34 | ||
52 | #define __NR_ftime 35 | ||
53 | #define __NR_sync 36 | ||
54 | #define __NR_kill 37 | ||
55 | #define __NR_rename 38 | ||
56 | #define __NR_mkdir 39 | ||
57 | #define __NR_rmdir 40 | ||
58 | #define __NR_dup 41 | ||
59 | #define __NR_pipe 42 | ||
60 | #define __NR_times 43 | ||
61 | #define __NR_prof 44 | ||
62 | #define __NR_brk 45 | ||
63 | #define __NR_setgid 46 | ||
64 | #define __NR_getgid 47 | ||
65 | #define __NR_signal 48 | ||
66 | #define __NR_geteuid 49 | ||
67 | #define __NR_getegid 50 | ||
68 | #define __NR_acct 51 | ||
69 | #define __NR_umount 52 | ||
70 | #define __NR_lock 53 | ||
71 | #define __NR_ioctl 54 | ||
72 | #define __NR_fcntl 55 | ||
73 | #define __NR_mpx 56 | ||
74 | #define __NR_setpgid 57 | ||
75 | #define __NR_ulimit 58 | ||
76 | #define __NR_oldolduname 59 | ||
77 | #define __NR_umask 60 | ||
78 | #define __NR_chroot 61 | ||
79 | #define __NR_ustat 62 | ||
80 | #define __NR_dup2 63 | ||
81 | #define __NR_getppid 64 | ||
82 | #define __NR_getpgrp 65 | ||
83 | #define __NR_setsid 66 | ||
84 | #define __NR_sigaction 67 | ||
85 | #define __NR_sgetmask 68 | ||
86 | #define __NR_ssetmask 69 | ||
87 | #define __NR_setreuid 70 | ||
88 | #define __NR_setregid 71 | ||
89 | #define __NR_sigsuspend 72 | ||
90 | #define __NR_sigpending 73 | ||
91 | #define __NR_sethostname 74 | ||
92 | #define __NR_setrlimit 75 | ||
93 | #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ | ||
94 | #define __NR_getrusage 77 | ||
95 | #define __NR_gettimeofday 78 | ||
96 | #define __NR_settimeofday 79 | ||
97 | #define __NR_getgroups 80 | ||
98 | #define __NR_setgroups 81 | ||
99 | #define __NR_select 82 | ||
100 | #define __NR_symlink 83 | ||
101 | #define __NR_oldlstat 84 | ||
102 | #define __NR_readlink 85 | ||
103 | #define __NR_uselib 86 | ||
104 | #define __NR_swapon 87 | ||
105 | #define __NR_reboot 88 | ||
106 | #define __NR_readdir 89 | ||
107 | #define __NR_mmap 90 | ||
108 | #define __NR_munmap 91 | ||
109 | #define __NR_truncate 92 | ||
110 | #define __NR_ftruncate 93 | ||
111 | #define __NR_fchmod 94 | ||
112 | #define __NR_fchown 95 | ||
113 | #define __NR_getpriority 96 | ||
114 | #define __NR_setpriority 97 | ||
115 | #define __NR_profil 98 | ||
116 | #define __NR_statfs 99 | ||
117 | #define __NR_fstatfs 100 | ||
118 | #define __NR_ioperm 101 | ||
119 | #define __NR_socketcall 102 | ||
120 | #define __NR_syslog 103 | ||
121 | #define __NR_setitimer 104 | ||
122 | #define __NR_getitimer 105 | ||
123 | #define __NR_stat 106 | ||
124 | #define __NR_lstat 107 | ||
125 | #define __NR_fstat 108 | ||
126 | #define __NR_olduname 109 | ||
127 | #define __NR_iopl 110 | ||
128 | #define __NR_vhangup 111 | ||
129 | #define __NR_idle 112 | ||
130 | #define __NR_vm86 113 | ||
131 | #define __NR_wait4 114 | ||
132 | #define __NR_swapoff 115 | ||
133 | #define __NR_sysinfo 116 | ||
134 | #define __NR_ipc 117 | ||
135 | #define __NR_fsync 118 | ||
136 | #define __NR_sigreturn 119 | ||
137 | #define __NR_clone 120 | ||
138 | #define __NR_setdomainname 121 | ||
139 | #define __NR_uname 122 | ||
140 | #define __NR_modify_ldt 123 | ||
141 | #define __NR_adjtimex 124 | ||
142 | #define __NR_mprotect 125 | ||
143 | #define __NR_sigprocmask 126 | ||
144 | #define __NR_create_module 127 | ||
145 | #define __NR_init_module 128 | ||
146 | #define __NR_delete_module 129 | ||
147 | #define __NR_get_kernel_syms 130 | ||
148 | #define __NR_quotactl 131 | ||
149 | #define __NR_getpgid 132 | ||
150 | #define __NR_fchdir 133 | ||
151 | #define __NR_bdflush 134 | ||
152 | #define __NR_sysfs 135 | ||
153 | #define __NR_personality 136 | ||
154 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
155 | #define __NR_setfsuid 138 | ||
156 | #define __NR_setfsgid 139 | ||
157 | #define __NR__llseek 140 | ||
158 | #define __NR_getdents 141 | ||
159 | #define __NR__newselect 142 | ||
160 | #define __NR_flock 143 | ||
161 | #define __NR_msync 144 | ||
162 | #define __NR_readv 145 | ||
163 | #define __NR_writev 146 | ||
164 | #define __NR_cacheflush 147 | ||
165 | #define __NR_cachectl 148 | ||
166 | #define __NR_sysxtensa 149 | ||
167 | #define __NR_sysdummy 150 | ||
168 | #define __NR_getsid 151 | ||
169 | #define __NR_fdatasync 152 | ||
170 | #define __NR__sysctl 153 | ||
171 | #define __NR_mlock 154 | ||
172 | #define __NR_munlock 155 | ||
173 | #define __NR_mlockall 156 | ||
174 | #define __NR_munlockall 157 | ||
175 | #define __NR_sched_setparam 158 | ||
176 | #define __NR_sched_getparam 159 | ||
177 | #define __NR_sched_setscheduler 160 | ||
178 | #define __NR_sched_getscheduler 161 | ||
179 | #define __NR_sched_yield 162 | ||
180 | #define __NR_sched_get_priority_max 163 | ||
181 | #define __NR_sched_get_priority_min 164 | ||
182 | #define __NR_sched_rr_get_interval 165 | ||
183 | #define __NR_nanosleep 166 | ||
184 | #define __NR_mremap 167 | ||
185 | #define __NR_accept 168 | ||
186 | #define __NR_bind 169 | ||
187 | #define __NR_connect 170 | ||
188 | #define __NR_getpeername 171 | ||
189 | #define __NR_getsockname 172 | ||
190 | #define __NR_getsockopt 173 | ||
191 | #define __NR_listen 174 | ||
192 | #define __NR_recv 175 | ||
193 | #define __NR_recvfrom 176 | ||
194 | #define __NR_recvmsg 177 | ||
195 | #define __NR_send 178 | ||
196 | #define __NR_sendmsg 179 | ||
197 | #define __NR_sendto 180 | ||
198 | #define __NR_setsockopt 181 | ||
199 | #define __NR_shutdown 182 | ||
200 | #define __NR_socket 183 | ||
201 | #define __NR_socketpair 184 | ||
202 | #define __NR_setresuid 185 | ||
203 | #define __NR_getresuid 186 | ||
204 | #define __NR_query_module 187 | ||
205 | #define __NR_poll 188 | ||
206 | #define __NR_nfsservctl 189 | ||
207 | #define __NR_setresgid 190 | ||
208 | #define __NR_getresgid 191 | ||
209 | #define __NR_prctl 192 | ||
210 | #define __NR_rt_sigreturn 193 | ||
211 | #define __NR_rt_sigaction 194 | ||
212 | #define __NR_rt_sigprocmask 195 | ||
213 | #define __NR_rt_sigpending 196 | ||
214 | #define __NR_rt_sigtimedwait 197 | ||
215 | #define __NR_rt_sigqueueinfo 198 | ||
216 | #define __NR_rt_sigsuspend 199 | ||
217 | #define __NR_pread 200 | ||
218 | #define __NR_pwrite 201 | ||
219 | #define __NR_chown 202 | ||
220 | #define __NR_getcwd 203 | ||
221 | #define __NR_capget 204 | ||
222 | #define __NR_capset 205 | ||
223 | #define __NR_sigaltstack 206 | ||
224 | #define __NR_sendfile 207 | ||
225 | #define __NR_streams1 208 /* some people actually want it */ | ||
226 | #define __NR_streams2 209 /* some people actually want it */ | ||
227 | #define __NR_mmap2 210 | ||
228 | #define __NR_truncate64 211 | ||
229 | #define __NR_ftruncate64 212 | ||
230 | #define __NR_stat64 213 | ||
231 | #define __NR_lstat64 214 | ||
232 | #define __NR_fstat64 215 | ||
233 | #define __NR_pivot_root 216 | ||
234 | #define __NR_mincore 217 | ||
235 | #define __NR_madvise 218 | ||
236 | #define __NR_getdents64 219 | ||
237 | #define __NR_vfork 220 | ||
238 | |||
239 | /* Keep this last; should always equal the last valid call number. */ | ||
240 | #define __NR_Linux_syscalls 220 | ||
241 | |||
242 | /* user-visible error numbers are in the range -1 - -125: see | ||
243 | * <asm-xtensa/errno.h> */ | ||
244 | |||
245 | #define SYSXTENSA_RESERVED 0 /* don't use this */ | ||
246 | #define SYSXTENSA_ATOMIC_SET 1 /* set variable */ | ||
247 | #define SYSXTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */ | ||
248 | #define SYSXTENSA_ATOMIC_ADD 3 /* add to memory */ | ||
249 | #define SYSXTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */ | ||
250 | |||
251 | #define SYSXTENSA_COUNT 5 /* count of syscall0 functions*/ | ||
252 | |||
253 | #ifdef __KERNEL__ | ||
254 | #define __syscall_return(type, res) return ((type)(res)) | ||
255 | #else | ||
256 | #define __syscall_return(type, res) \ | ||
257 | do { \ | ||
258 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | ||
259 | /* Avoid using "res" which is declared to be in register r2; \ | ||
260 | * errno might expand to a function call and clobber it. */ \ | ||
261 | int __err = -(res); \ | ||
262 | errno = __err; \ | ||
263 | res = -1; \ | ||
264 | } \ | ||
265 | return (type) (res); \ | ||
266 | } while (0) | ||
267 | #endif | ||
268 | |||
269 | |||
270 | /* Tensilica's xt-xcc compiler is much more agressive at code | ||
271 | * optimization than gcc. Multiple __asm__ statements are | ||
272 | * insufficient for xt-xcc because subsequent optimization passes | ||
273 | * (beyond the front-end that knows of __asm__ statements and other | ||
274 | * such GNU Extensions to C) can modify the register selection for | ||
275 | * containment of C variables. | ||
276 | * | ||
277 | * xt-xcc cannot modify the contents of a single __asm__ statement, so | ||
278 | * we create single-asm versions of the syscall macros that are | ||
279 | * suitable and optimal for both xt-xcc and gcc. | ||
280 | * | ||
281 | * Linux takes system-call arguments in registers. The following | ||
282 | * design is optimized for user-land apps (e.g., glibc) which | ||
283 | * typically have a function wrapper around the "syscall" assembly | ||
284 | * instruction. It satisfies the Xtensa ABI while minizing argument | ||
285 | * shifting. | ||
286 | * | ||
287 | * The Xtensa ABI and software conventions require the system-call | ||
288 | * number in a2. If an argument exists in a2, we move it to the next | ||
289 | * available register. Note that for improved efficiency, we do NOT | ||
290 | * shift all parameters down one register to maintain the original | ||
291 | * order. | ||
292 | * | ||
293 | * At best case (zero arguments), we just write the syscall number to | ||
294 | * a2. At worst case (1 to 6 arguments), we move the argument in a2 | ||
295 | * to the next available register, then write the syscall number to | ||
296 | * a2. | ||
297 | * | ||
298 | * For clarity, the following truth table enumerates all possibilities. | ||
299 | * | ||
300 | * arguments syscall number arg0, arg1, arg2, arg3, arg4, arg5 | ||
301 | * --------- -------------- ---------------------------------- | ||
302 | * 0 a2 | ||
303 | * 1 a2 a3 | ||
304 | * 2 a2 a4, a3 | ||
305 | * 3 a2 a5, a3, a4 | ||
306 | * 4 a2 a6, a3, a4, a5 | ||
307 | * 5 a2 a7, a3, a4, a5, a6 | ||
308 | * 6 a2 a8, a3, a4, a5, a6, a7 | ||
309 | */ | ||
310 | |||
311 | #define _syscall0(type,name) \ | ||
312 | type name(void) \ | ||
313 | { \ | ||
314 | long __res; \ | ||
315 | __asm__ __volatile__ ( \ | ||
316 | " movi a2, %1 \n" \ | ||
317 | " syscall \n" \ | ||
318 | " mov %0, a2 \n" \ | ||
319 | : "=a" (__res) \ | ||
320 | : "i" (__NR_##name) \ | ||
321 | : "a2" \ | ||
322 | ); \ | ||
323 | __syscall_return(type,__res); \ | ||
324 | } | ||
325 | |||
326 | #define _syscall1(type,name,type0,arg0) \ | ||
327 | type name(type0 arg0) \ | ||
328 | { \ | ||
329 | long __res; \ | ||
330 | __asm__ __volatile__ ( \ | ||
331 | " mov a3, %2 \n" \ | ||
332 | " movi a2, %1 \n" \ | ||
333 | " syscall \n" \ | ||
334 | " mov %0, a2 \n" \ | ||
335 | : "=a" (__res) \ | ||
336 | : "i" (__NR_##name), "a" (arg0) \ | ||
337 | : "a2", "a3" \ | ||
338 | ); \ | ||
339 | __syscall_return(type,__res); \ | ||
340 | } | ||
341 | |||
342 | #define _syscall2(type,name,type0,arg0,type1,arg1) \ | ||
343 | type name(type0 arg0,type1 arg1) \ | ||
344 | { \ | ||
345 | long __res; \ | ||
346 | __asm__ __volatile__ ( \ | ||
347 | " mov a4, %2 \n" \ | ||
348 | " mov a3, %3 \n" \ | ||
349 | " movi a2, %1 \n" \ | ||
350 | " syscall \n" \ | ||
351 | " mov %0, a2 \n" \ | ||
352 | : "=a" (__res) \ | ||
353 | : "i" (__NR_##name), "a" (arg0), "a" (arg1) \ | ||
354 | : "a2", "a3", "a4" \ | ||
355 | ); \ | ||
356 | __syscall_return(type,__res); \ | ||
357 | } | ||
358 | |||
359 | #define _syscall3(type,name,type0,arg0,type1,arg1,type2,arg2) \ | ||
360 | type name(type0 arg0,type1 arg1,type2 arg2) \ | ||
361 | { \ | ||
362 | long __res; \ | ||
363 | __asm__ __volatile__ ( \ | ||
364 | " mov a5, %2 \n" \ | ||
365 | " mov a4, %4 \n" \ | ||
366 | " mov a3, %3 \n" \ | ||
367 | " movi a2, %1 \n" \ | ||
368 | " syscall \n" \ | ||
369 | " mov %0, a2 \n" \ | ||
370 | : "=a" (__res) \ | ||
371 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2) \ | ||
372 | : "a2", "a3", "a4", "a5" \ | ||
373 | ); \ | ||
374 | __syscall_return(type,__res); \ | ||
375 | } | ||
376 | |||
377 | #define _syscall4(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3) \ | ||
378 | type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3) \ | ||
379 | { \ | ||
380 | long __res; \ | ||
381 | __asm__ __volatile__ ( \ | ||
382 | " mov a6, %2 \n" \ | ||
383 | " mov a5, %5 \n" \ | ||
384 | " mov a4, %4 \n" \ | ||
385 | " mov a3, %3 \n" \ | ||
386 | " movi a2, %1 \n" \ | ||
387 | " syscall \n" \ | ||
388 | " mov %0, a2 \n" \ | ||
389 | : "=a" (__res) \ | ||
390 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), "a" (arg3) \ | ||
391 | : "a2", "a3", "a4", "a5", "a6" \ | ||
392 | ); \ | ||
393 | __syscall_return(type,__res); \ | ||
394 | } | ||
395 | |||
396 | /* Note that we save and restore the a7 frame pointer. | ||
397 | * Including a7 in the clobber list doesn't do what you'd expect. | ||
398 | */ | ||
399 | #define _syscall5(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ | ||
400 | type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ | ||
401 | { \ | ||
402 | long __res; \ | ||
403 | __asm__ __volatile__ ( \ | ||
404 | " mov a9, a7 \n" \ | ||
405 | " mov a7, %2 \n" \ | ||
406 | " mov a6, %6 \n" \ | ||
407 | " mov a5, %5 \n" \ | ||
408 | " mov a4, %4 \n" \ | ||
409 | " mov a3, %3 \n" \ | ||
410 | " movi a2, %1 \n" \ | ||
411 | " syscall \n" \ | ||
412 | " mov a7, a9 \n" \ | ||
413 | " mov %0, a2 \n" \ | ||
414 | : "=a" (__res) \ | ||
415 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), \ | ||
416 | "a" (arg3), "a" (arg4) \ | ||
417 | : "a2", "a3", "a4", "a5", "a6", "a9" \ | ||
418 | ); \ | ||
419 | __syscall_return(type,__res); \ | ||
420 | } | ||
421 | |||
422 | /* Note that we save and restore the a7 frame pointer. | ||
423 | * Including a7 in the clobber list doesn't do what you'd expect. | ||
424 | */ | ||
425 | #define _syscall6(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ | ||
426 | type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ | ||
427 | { \ | ||
428 | long __res; \ | ||
429 | __asm__ __volatile__ ( \ | ||
430 | " mov a9, a7 \n" \ | ||
431 | " mov a8, %2 \n" \ | ||
432 | " mov a7, %7 \n" \ | ||
433 | " mov a6, %6 \n" \ | ||
434 | " mov a5, %5 \n" \ | ||
435 | " mov a4, %4 \n" \ | ||
436 | " mov a3, %3 \n" \ | ||
437 | " movi a2, %1 \n" \ | ||
438 | " syscall \n" \ | ||
439 | " mov a7, a9 \n" \ | ||
440 | " mov %0, a2 \n" \ | ||
441 | : "=a" (__res) \ | ||
442 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), \ | ||
443 | "a" (arg3), "a" (arg4), "a" (arg5) \ | ||
444 | : "a2", "a3", "a4", "a5", "a6", "a8", "a9" \ | ||
445 | ); \ | ||
446 | __syscall_return(type,__res); \ | ||
447 | } | ||
448 | |||
449 | |||
450 | #ifdef __KERNEL_SYSCALLS__ | ||
451 | |||
452 | #include <linux/compiler.h> | ||
453 | #include <linux/types.h> | ||
454 | #include <linux/syscalls.h> | ||
455 | |||
456 | /* | ||
457 | * we need this inline - forking from kernel space will result | ||
458 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
459 | * is no problem, but for the stack. This is handled by not letting | ||
460 | * main() use the stack at all after fork(). Thus, no function | ||
461 | * calls - which means inline code for fork too, as otherwise we | ||
462 | * would use the stack upon exit from 'fork()'. | ||
463 | * | ||
464 | * Actually only pause and fork are needed inline, so that there | ||
465 | * won't be any messing with the stack from main(), but we define | ||
466 | * some others too. | ||
467 | */ | ||
468 | |||
469 | #define __NR__exit __NR_exit | ||
470 | |||
471 | static __inline__ _syscall0(int,pause) | ||
472 | //static __inline__ _syscall1(int,setup,int,magic) FIXME | ||
473 | static __inline__ _syscall0(int,sync) | ||
474 | static __inline__ _syscall0(pid_t,setsid) | ||
475 | static __inline__ _syscall3(int,write,int,fd,const char *,buf,off_t,count) | ||
476 | static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) | ||
477 | static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) | ||
478 | static __inline__ _syscall1(int,dup,int,fd) | ||
479 | static __inline__ _syscall3(int,execve,const char*,file,char**,argv,char**,envp) | ||
480 | static __inline__ _syscall3(int,open,const char *,file,int,flag,int,mode) | ||
481 | static __inline__ _syscall1(int,close,int,fd) | ||
482 | static __inline__ _syscall1(int,_exit,int,exitcode) | ||
483 | static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) | ||
484 | static __inline__ _syscall1(int,delete_module,const char *,name) | ||
485 | |||
486 | struct stat; | ||
487 | static __inline__ _syscall2(int,fstat,int,fd,struct stat *,buf) | ||
488 | static __inline__ _syscall0(pid_t,getpid) | ||
489 | static __inline__ _syscall2(int,kill,int,pid,int,sig) | ||
490 | static __inline__ _syscall2(int,stat,const char *, path,struct stat *,buf) | ||
491 | static __inline__ _syscall1(int,unlink,char *,pathname) | ||
492 | |||
493 | |||
494 | |||
495 | extern pid_t waitpid(int, int*, int ); | ||
496 | static __inline__ pid_t wait(int * wait_stat) | ||
497 | { | ||
498 | return waitpid(-1,wait_stat,0); | ||
499 | } | ||
500 | #endif | ||
501 | |||
502 | /* | ||
503 | * "Conditional" syscalls | ||
504 | * | ||
505 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
506 | * but it doesn't work on all toolchains, so we just do it by hand | ||
507 | */ | ||
508 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); | ||
509 | |||
510 | #ifdef __KERNEL__ | ||
511 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
512 | #define __ARCH_WANT_OLD_READDIR | ||
513 | #define __ARCH_WANT_OLD_STAT | ||
514 | #define __ARCH_WANT_STAT64 | ||
515 | #define __ARCH_WANT_SYS_ALARM | ||
516 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
517 | #define __ARCH_WANT_SYS_PAUSE | ||
518 | #define __ARCH_WANT_SYS_SGETMASK | ||
519 | #define __ARCH_WANT_SYS_SIGNAL | ||
520 | #define __ARCH_WANT_SYS_TIME | ||
521 | #define __ARCH_WANT_SYS_UTIME | ||
522 | #define __ARCH_WANT_SYS_WAITPID | ||
523 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
524 | #define __ARCH_WANT_SYS_FADVISE64 | ||
525 | #define __ARCH_WANT_SYS_GETPGRP | ||
526 | #define __ARCH_WANT_SYS_LLSEEK | ||
527 | #define __ARCH_WANT_SYS_NICE | ||
528 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
529 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
530 | #define __ARCH_WANT_SYS_SIGPENDING | ||
531 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
532 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
533 | #endif | ||
534 | |||
535 | |||
536 | |||
537 | #endif /* _XTENSA_UNISTD_H */ | ||
diff --git a/include/asm-xtensa/user.h b/include/asm-xtensa/user.h new file mode 100644 index 000000000000..2c3ed23354a8 --- /dev/null +++ b/include/asm-xtensa/user.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/user.h | ||
3 | * | ||
4 | * Xtensa Processor version. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_USER_H | ||
14 | #define _XTENSA_USER_H | ||
15 | |||
16 | /* This file usually defines a 'struct user' structure. However, it it only | ||
17 | * used for a.out file, which are not supported on Xtensa. | ||
18 | */ | ||
19 | |||
20 | #endif /* _XTENSA_USER_H */ | ||
diff --git a/include/asm-xtensa/vga.h b/include/asm-xtensa/vga.h new file mode 100644 index 000000000000..23d82f6acb57 --- /dev/null +++ b/include/asm-xtensa/vga.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/vga.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_VGA_H | ||
12 | #define _XTENSA_VGA_H | ||
13 | |||
14 | #define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) | ||
15 | |||
16 | #define vga_readb(x) (*(x)) | ||
17 | #define vga_writeb(x,y) (*(y) = (x)) | ||
18 | |||
19 | #endif | ||
diff --git a/include/asm-xtensa/xor.h b/include/asm-xtensa/xor.h new file mode 100644 index 000000000000..e7b1f083991d --- /dev/null +++ b/include/asm-xtensa/xor.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/xor.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_XOR_H | ||
12 | #define _XTENSA_XOR_H | ||
13 | |||
14 | #include <asm-generic/xor.h> | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-xtensa/xtensa/cacheasm.h b/include/asm-xtensa/xtensa/cacheasm.h new file mode 100644 index 000000000000..0cdbb0bf180e --- /dev/null +++ b/include/asm-xtensa/xtensa/cacheasm.h | |||
@@ -0,0 +1,708 @@ | |||
1 | #ifndef XTENSA_CACHEASM_H | ||
2 | #define XTENSA_CACHEASM_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/cacheasm.h -- assembler-specific cache | ||
8 | * related definitions that depend on CORE configuration. | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | * | ||
14 | * Copyright (C) 2002 Tensilica Inc. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include <xtensa/coreasm.h> | ||
19 | |||
20 | |||
21 | /* | ||
22 | * This header file defines assembler macros of the form: | ||
23 | * <x>cache_<func> | ||
24 | * where <x> is 'i' or 'd' for instruction and data caches, | ||
25 | * and <func> indicates the function of the macro. | ||
26 | * | ||
27 | * The following functions <func> are defined, | ||
28 | * and apply only to the specified cache (I or D): | ||
29 | * | ||
30 | * reset | ||
31 | * Resets the cache. | ||
32 | * | ||
33 | * sync | ||
34 | * Makes sure any previous cache instructions have been completed; | ||
35 | * ie. makes sure any previous cache control operations | ||
36 | * have had full effect and been synchronized to memory. | ||
37 | * Eg. any invalidate completed [so as not to generate a hit], | ||
38 | * any writebacks or other pipelined writes written to memory, etc. | ||
39 | * | ||
40 | * invalidate_line (single cache line) | ||
41 | * invalidate_region (specified memory range) | ||
42 | * invalidate_all (entire cache) | ||
43 | * Invalidates all cache entries that cache | ||
44 | * data from the specified memory range. | ||
45 | * NOTE: locked entries are not invalidated. | ||
46 | * | ||
47 | * writeback_line (single cache line) | ||
48 | * writeback_region (specified memory range) | ||
49 | * writeback_all (entire cache) | ||
50 | * Writes back to memory all dirty cache entries | ||
51 | * that cache data from the specified memory range, | ||
52 | * and marks these entries as clean. | ||
53 | * NOTE: on some future implementations, this might | ||
54 | * also invalidate. | ||
55 | * NOTE: locked entries are written back, but never invalidated. | ||
56 | * NOTE: instruction caches never implement writeback. | ||
57 | * | ||
58 | * writeback_inv_line (single cache line) | ||
59 | * writeback_inv_region (specified memory range) | ||
60 | * writeback_inv_all (entire cache) | ||
61 | * Writes back to memory all dirty cache entries | ||
62 | * that cache data from the specified memory range, | ||
63 | * and invalidates these entries (including all clean | ||
64 | * cache entries that cache data from that range). | ||
65 | * NOTE: locked entries are written back but not invalidated. | ||
66 | * NOTE: instruction caches never implement writeback. | ||
67 | * | ||
68 | * lock_line (single cache line) | ||
69 | * lock_region (specified memory range) | ||
70 | * Prefetch and lock the specified memory range into cache. | ||
71 | * NOTE: if any part of the specified memory range cannot | ||
72 | * be locked, a ??? exception occurs. These macros don't | ||
73 | * do anything special (yet anyway) to handle this situation. | ||
74 | * | ||
75 | * unlock_line (single cache line) | ||
76 | * unlock_region (specified memory range) | ||
77 | * unlock_all (entire cache) | ||
78 | * Unlock cache entries that cache the specified memory range. | ||
79 | * Entries not already locked are unaffected. | ||
80 | */ | ||
81 | |||
82 | |||
83 | |||
84 | /*************************** GENERIC -- ALL CACHES ***************************/ | ||
85 | |||
86 | |||
87 | /* | ||
88 | * The following macros assume the following cache size/parameter limits | ||
89 | * in the current Xtensa core implementation: | ||
90 | * cache size: 1024 bytes minimum | ||
91 | * line size: 16 - 64 bytes | ||
92 | * way count: 1 - 4 | ||
93 | * | ||
94 | * Minimum entries per way (ie. per associativity) = 1024 / 64 / 4 = 4 | ||
95 | * Hence the assumption that each loop can execute four cache instructions. | ||
96 | * | ||
97 | * Correspondingly, the offset range of instructions is assumed able to cover | ||
98 | * four lines, ie. offsets {0,1,2,3} * line_size are assumed valid for | ||
99 | * both hit and indexed cache instructions. Ie. these offsets are all | ||
100 | * valid: 0, 16, 32, 48, 64, 96, 128, 192 (for line sizes 16, 32, 64). | ||
101 | * This is true of all original cache instructions | ||
102 | * (dhi, ihi, dhwb, dhwbi, dii, iii) which have offsets | ||
103 | * of 0 to 1020 in multiples of 4 (ie. 8 bits shifted by 2). | ||
104 | * This is also true of subsequent cache instructions | ||
105 | * (dhu, ihu, diu, iiu, diwb, diwbi, dpfl, ipfl) which have offsets | ||
106 | * of 0 to 240 in multiples of 16 (ie. 4 bits shifted by 4). | ||
107 | * | ||
108 | * (Maximum cache size, currently 32k, doesn't affect the following macros. | ||
109 | * Cache ways > MMU min page size cause aliasing but that's another matter.) | ||
110 | */ | ||
111 | |||
112 | |||
113 | |||
114 | /* | ||
115 | * Macro to apply an 'indexed' cache instruction to the entire cache. | ||
116 | * | ||
117 | * Parameters: | ||
118 | * cainst instruction/ that takes an address register parameter | ||
119 | * and an offset parameter (in range 0 .. 3*linesize). | ||
120 | * size size of cache in bytes | ||
121 | * linesize size of cache line in bytes | ||
122 | * assoc_or1 number of associativities (ways/sets) in cache | ||
123 | * if all sets affected by cainst, | ||
124 | * or 1 if only one set (or not all sets) of the cache | ||
125 | * is affected by cainst (eg. DIWB or DIWBI [not yet ISA defined]). | ||
126 | * aa, ab unique address registers (temporaries) | ||
127 | */ | ||
128 | |||
129 | .macro cache_index_all cainst, size, linesize, assoc_or1, aa, ab | ||
130 | |||
131 | // Sanity-check on cache parameters: | ||
132 | .ifne (\size % (\linesize * \assoc_or1 * 4)) | ||
133 | .err // cache configuration outside expected/supported range! | ||
134 | .endif | ||
135 | |||
136 | // \size byte cache, \linesize byte lines, \assoc_or1 way(s) affected by each \cainst. | ||
137 | movi \aa, (\size / (\linesize * \assoc_or1 * 4)) | ||
138 | // Possible improvement: need only loop if \aa > 1 ; | ||
139 | // however that particular condition is highly unlikely. | ||
140 | movi \ab, 0 // to iterate over cache | ||
141 | floop \aa, cachex\@ | ||
142 | \cainst \ab, 0*\linesize | ||
143 | \cainst \ab, 1*\linesize | ||
144 | \cainst \ab, 2*\linesize | ||
145 | \cainst \ab, 3*\linesize | ||
146 | addi \ab, \ab, 4*\linesize // move to next line | ||
147 | floopend \aa, cachex\@ | ||
148 | |||
149 | .endm | ||
150 | |||
151 | |||
152 | /* | ||
153 | * Macro to apply a 'hit' cache instruction to a memory region, | ||
154 | * ie. to any cache entries that cache a specified portion (region) of memory. | ||
155 | * Takes care of the unaligned cases, ie. may apply to one | ||
156 | * more cache line than $asize / lineSize if $aaddr is not aligned. | ||
157 | * | ||
158 | * | ||
159 | * Parameters are: | ||
160 | * cainst instruction/macro that takes an address register parameter | ||
161 | * and an offset parameter (currently always zero) | ||
162 | * and generates a cache instruction (eg. "dhi", "dhwb", "ihi", etc.) | ||
163 | * linesize_log2 log2(size of cache line in bytes) | ||
164 | * addr register containing start address of region (clobbered) | ||
165 | * asize register containing size of the region in bytes (clobbered) | ||
166 | * askew unique register used as temporary | ||
167 | * | ||
168 | * !?!?! 2DO: optimization: iterate max(cache_size and \asize) / linesize | ||
169 | */ | ||
170 | |||
171 | .macro cache_hit_region cainst, linesize_log2, addr, asize, askew | ||
172 | |||
173 | // Make \asize the number of iterations: | ||
174 | extui \askew, \addr, 0, \linesize_log2 // get unalignment amount of \addr | ||
175 | add \asize, \asize, \askew // ... and add it to \asize | ||
176 | addi \asize, \asize, (1 << \linesize_log2) - 1 // round up! | ||
177 | srli \asize, \asize, \linesize_log2 | ||
178 | |||
179 | // Iterate over region: | ||
180 | floopnez \asize, cacheh\@ | ||
181 | \cainst \addr, 0 | ||
182 | addi \addr, \addr, (1 << \linesize_log2) // move to next line | ||
183 | floopend \asize, cacheh\@ | ||
184 | |||
185 | .endm | ||
186 | |||
187 | |||
188 | |||
189 | |||
190 | |||
191 | /*************************** INSTRUCTION CACHE ***************************/ | ||
192 | |||
193 | |||
194 | /* | ||
195 | * Reset/initialize the instruction cache by simply invalidating it: | ||
196 | * (need to unlock first also, if cache locking implemented): | ||
197 | * | ||
198 | * Parameters: | ||
199 | * aa, ab unique address registers (temporaries) | ||
200 | */ | ||
201 | .macro icache_reset aa, ab | ||
202 | icache_unlock_all \aa, \ab | ||
203 | icache_invalidate_all \aa, \ab | ||
204 | .endm | ||
205 | |||
206 | |||
207 | /* | ||
208 | * Synchronize after an instruction cache operation, | ||
209 | * to be sure everything is in sync with memory as to be | ||
210 | * expected following any previous instruction cache control operations. | ||
211 | * | ||
212 | * Parameters are: | ||
213 | * ar an address register (temporary) (currently unused, but may be used in future) | ||
214 | */ | ||
215 | .macro icache_sync ar | ||
216 | #if XCHAL_ICACHE_SIZE > 0 | ||
217 | isync | ||
218 | #endif | ||
219 | .endm | ||
220 | |||
221 | |||
222 | |||
223 | /* | ||
224 | * Invalidate a single line of the instruction cache. | ||
225 | * Parameters are: | ||
226 | * ar address register that contains (virtual) address to invalidate | ||
227 | * (may get clobbered in a future implementation, but not currently) | ||
228 | * offset (optional) offset to add to \ar to compute effective address to invalidate | ||
229 | * (note: some number of lsbits are ignored) | ||
230 | */ | ||
231 | .macro icache_invalidate_line ar, offset | ||
232 | #if XCHAL_ICACHE_SIZE > 0 | ||
233 | ihi \ar, \offset // invalidate icache line | ||
234 | /* | ||
235 | * NOTE: in some version of the silicon [!!!SHOULD HAVE BEEN DOCUMENTED!!!] | ||
236 | * 'ihi' doesn't work, so it had been replaced with 'iii' | ||
237 | * (which would just invalidate more than it should, | ||
238 | * which should be okay other than the performance hit | ||
239 | * because cache locking did not exist in that version, | ||
240 | * unless user somehow relies on something being cached). | ||
241 | * [WHAT VERSION IS IT!!?!? | ||
242 | * IS THERE ANY WAY TO TEST FOR THAT HERE, TO OUTPUT 'III' ONLY IF NEEDED!?!?]. | ||
243 | * | ||
244 | * iii \ar, \offset | ||
245 | */ | ||
246 | icache_sync \ar | ||
247 | #endif | ||
248 | .endm | ||
249 | |||
250 | |||
251 | |||
252 | |||
253 | /* | ||
254 | * Invalidate instruction cache entries that cache a specified portion of memory. | ||
255 | * Parameters are: | ||
256 | * astart start address (register gets clobbered) | ||
257 | * asize size of the region in bytes (register gets clobbered) | ||
258 | * ac unique register used as temporary | ||
259 | */ | ||
260 | .macro icache_invalidate_region astart, asize, ac | ||
261 | #if XCHAL_ICACHE_SIZE > 0 | ||
262 | // Instruction cache region invalidation: | ||
263 | cache_hit_region ihi, XCHAL_ICACHE_LINEWIDTH, \astart, \asize, \ac | ||
264 | icache_sync \ac | ||
265 | // End of instruction cache region invalidation | ||
266 | #endif | ||
267 | .endm | ||
268 | |||
269 | |||
270 | |||
271 | /* | ||
272 | * Invalidate entire instruction cache. | ||
273 | * | ||
274 | * Parameters: | ||
275 | * aa, ab unique address registers (temporaries) | ||
276 | */ | ||
277 | .macro icache_invalidate_all aa, ab | ||
278 | #if XCHAL_ICACHE_SIZE > 0 | ||
279 | // Instruction cache invalidation: | ||
280 | cache_index_all iii, XCHAL_ICACHE_SIZE, XCHAL_ICACHE_LINESIZE, XCHAL_ICACHE_WAYS, \aa, \ab | ||
281 | icache_sync \aa | ||
282 | // End of instruction cache invalidation | ||
283 | #endif | ||
284 | .endm | ||
285 | |||
286 | |||
287 | |||
288 | /* | ||
289 | * Lock (prefetch & lock) a single line of the instruction cache. | ||
290 | * | ||
291 | * Parameters are: | ||
292 | * ar address register that contains (virtual) address to lock | ||
293 | * (may get clobbered in a future implementation, but not currently) | ||
294 | * offset offset to add to \ar to compute effective address to lock | ||
295 | * (note: some number of lsbits are ignored) | ||
296 | */ | ||
297 | .macro icache_lock_line ar, offset | ||
298 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
299 | ipfl \ar, \offset /* prefetch and lock icache line */ | ||
300 | icache_sync \ar | ||
301 | #endif | ||
302 | .endm | ||
303 | |||
304 | |||
305 | |||
306 | /* | ||
307 | * Lock (prefetch & lock) a specified portion of memory into the instruction cache. | ||
308 | * Parameters are: | ||
309 | * astart start address (register gets clobbered) | ||
310 | * asize size of the region in bytes (register gets clobbered) | ||
311 | * ac unique register used as temporary | ||
312 | */ | ||
313 | .macro icache_lock_region astart, asize, ac | ||
314 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
315 | // Instruction cache region lock: | ||
316 | cache_hit_region ipfl, XCHAL_ICACHE_LINEWIDTH, \astart, \asize, \ac | ||
317 | icache_sync \ac | ||
318 | // End of instruction cache region lock | ||
319 | #endif | ||
320 | .endm | ||
321 | |||
322 | |||
323 | |||
324 | /* | ||
325 | * Unlock a single line of the instruction cache. | ||
326 | * | ||
327 | * Parameters are: | ||
328 | * ar address register that contains (virtual) address to unlock | ||
329 | * (may get clobbered in a future implementation, but not currently) | ||
330 | * offset offset to add to \ar to compute effective address to unlock | ||
331 | * (note: some number of lsbits are ignored) | ||
332 | */ | ||
333 | .macro icache_unlock_line ar, offset | ||
334 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
335 | ihu \ar, \offset /* unlock icache line */ | ||
336 | icache_sync \ar | ||
337 | #endif | ||
338 | .endm | ||
339 | |||
340 | |||
341 | |||
342 | /* | ||
343 | * Unlock a specified portion of memory from the instruction cache. | ||
344 | * Parameters are: | ||
345 | * astart start address (register gets clobbered) | ||
346 | * asize size of the region in bytes (register gets clobbered) | ||
347 | * ac unique register used as temporary | ||
348 | */ | ||
349 | .macro icache_unlock_region astart, asize, ac | ||
350 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
351 | // Instruction cache region unlock: | ||
352 | cache_hit_region ihu, XCHAL_ICACHE_LINEWIDTH, \astart, \asize, \ac | ||
353 | icache_sync \ac | ||
354 | // End of instruction cache region unlock | ||
355 | #endif | ||
356 | .endm | ||
357 | |||
358 | |||
359 | |||
360 | /* | ||
361 | * Unlock entire instruction cache. | ||
362 | * | ||
363 | * Parameters: | ||
364 | * aa, ab unique address registers (temporaries) | ||
365 | */ | ||
366 | .macro icache_unlock_all aa, ab | ||
367 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
368 | // Instruction cache unlock: | ||
369 | cache_index_all iiu, XCHAL_ICACHE_SIZE, XCHAL_ICACHE_LINESIZE, 1, \aa, \ab | ||
370 | icache_sync \aa | ||
371 | // End of instruction cache unlock | ||
372 | #endif | ||
373 | .endm | ||
374 | |||
375 | |||
376 | |||
377 | |||
378 | |||
379 | /*************************** DATA CACHE ***************************/ | ||
380 | |||
381 | |||
382 | |||
383 | /* | ||
384 | * Reset/initialize the data cache by simply invalidating it | ||
385 | * (need to unlock first also, if cache locking implemented): | ||
386 | * | ||
387 | * Parameters: | ||
388 | * aa, ab unique address registers (temporaries) | ||
389 | */ | ||
390 | .macro dcache_reset aa, ab | ||
391 | dcache_unlock_all \aa, \ab | ||
392 | dcache_invalidate_all \aa, \ab | ||
393 | .endm | ||
394 | |||
395 | |||
396 | |||
397 | |||
398 | /* | ||
399 | * Synchronize after a data cache operation, | ||
400 | * to be sure everything is in sync with memory as to be | ||
401 | * expected following any previous data cache control operations. | ||
402 | * | ||
403 | * Parameters are: | ||
404 | * ar an address register (temporary) (currently unused, but may be used in future) | ||
405 | */ | ||
406 | .macro dcache_sync ar | ||
407 | #if XCHAL_DCACHE_SIZE > 0 | ||
408 | // This previous sequence errs on the conservative side (too much so); a DSYNC should be sufficient: | ||
409 | //memw // synchronize data cache changes relative to subsequent memory accesses | ||
410 | //isync // be conservative and ISYNC as well (just to be sure) | ||
411 | |||
412 | dsync | ||
413 | #endif | ||
414 | .endm | ||
415 | |||
416 | |||
417 | |||
418 | /* | ||
419 | * Synchronize after a data store operation, | ||
420 | * to be sure the stored data is completely off the processor | ||
421 | * (and assuming there is no buffering outside the processor, | ||
422 | * that the data is in memory). This may be required to | ||
423 | * ensure that the processor's write buffers are emptied. | ||
424 | * A MEMW followed by a read guarantees this, by definition. | ||
425 | * We also try to make sure the read itself completes. | ||
426 | * | ||
427 | * Parameters are: | ||
428 | * ar an address register (temporary) | ||
429 | */ | ||
430 | .macro write_sync ar | ||
431 | memw // ensure previous memory accesses are complete prior to subsequent memory accesses | ||
432 | l32i \ar, sp, 0 // completing this read ensures any previous write has completed, because of MEMW | ||
433 | //slot | ||
434 | add \ar, \ar, \ar // use the result of the read to help ensure the read completes (in future architectures) | ||
435 | .endm | ||
436 | |||
437 | |||
438 | /* | ||
439 | * Invalidate a single line of the data cache. | ||
440 | * Parameters are: | ||
441 | * ar address register that contains (virtual) address to invalidate | ||
442 | * (may get clobbered in a future implementation, but not currently) | ||
443 | * offset (optional) offset to add to \ar to compute effective address to invalidate | ||
444 | * (note: some number of lsbits are ignored) | ||
445 | */ | ||
446 | .macro dcache_invalidate_line ar, offset | ||
447 | #if XCHAL_DCACHE_SIZE > 0 | ||
448 | dhi \ar, \offset | ||
449 | dcache_sync \ar | ||
450 | #endif | ||
451 | .endm | ||
452 | |||
453 | |||
454 | |||
455 | |||
456 | |||
457 | /* | ||
458 | * Invalidate data cache entries that cache a specified portion of memory. | ||
459 | * Parameters are: | ||
460 | * astart start address (register gets clobbered) | ||
461 | * asize size of the region in bytes (register gets clobbered) | ||
462 | * ac unique register used as temporary | ||
463 | */ | ||
464 | .macro dcache_invalidate_region astart, asize, ac | ||
465 | #if XCHAL_DCACHE_SIZE > 0 | ||
466 | // Data cache region invalidation: | ||
467 | cache_hit_region dhi, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
468 | dcache_sync \ac | ||
469 | // End of data cache region invalidation | ||
470 | #endif | ||
471 | .endm | ||
472 | |||
473 | |||
474 | |||
475 | #if 0 | ||
476 | /* | ||
477 | * This is a work-around for a bug in SiChip1 (???). | ||
478 | * There should be a proper mechanism for not outputting | ||
479 | * these instructions when not needed. | ||
480 | * To enable work-around, uncomment this and replace 'dii' | ||
481 | * with 'dii_s1' everywhere, eg. in dcache_invalidate_all | ||
482 | * macro below. | ||
483 | */ | ||
484 | .macro dii_s1 ar, offset | ||
485 | dii \ar, \offset | ||
486 | or \ar, \ar, \ar | ||
487 | or \ar, \ar, \ar | ||
488 | or \ar, \ar, \ar | ||
489 | or \ar, \ar, \ar | ||
490 | .endm | ||
491 | #endif | ||
492 | |||
493 | |||
494 | /* | ||
495 | * Invalidate entire data cache. | ||
496 | * | ||
497 | * Parameters: | ||
498 | * aa, ab unique address registers (temporaries) | ||
499 | */ | ||
500 | .macro dcache_invalidate_all aa, ab | ||
501 | #if XCHAL_DCACHE_SIZE > 0 | ||
502 | // Data cache invalidation: | ||
503 | cache_index_all dii, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, XCHAL_DCACHE_WAYS, \aa, \ab | ||
504 | dcache_sync \aa | ||
505 | // End of data cache invalidation | ||
506 | #endif | ||
507 | .endm | ||
508 | |||
509 | |||
510 | |||
511 | /* | ||
512 | * Writeback a single line of the data cache. | ||
513 | * Parameters are: | ||
514 | * ar address register that contains (virtual) address to writeback | ||
515 | * (may get clobbered in a future implementation, but not currently) | ||
516 | * offset offset to add to \ar to compute effective address to writeback | ||
517 | * (note: some number of lsbits are ignored) | ||
518 | */ | ||
519 | .macro dcache_writeback_line ar, offset | ||
520 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_IS_WRITEBACK | ||
521 | dhwb \ar, \offset | ||
522 | dcache_sync \ar | ||
523 | #endif | ||
524 | .endm | ||
525 | |||
526 | |||
527 | |||
528 | /* | ||
529 | * Writeback dirty data cache entries that cache a specified portion of memory. | ||
530 | * Parameters are: | ||
531 | * astart start address (register gets clobbered) | ||
532 | * asize size of the region in bytes (register gets clobbered) | ||
533 | * ac unique register used as temporary | ||
534 | */ | ||
535 | .macro dcache_writeback_region astart, asize, ac | ||
536 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_IS_WRITEBACK | ||
537 | // Data cache region writeback: | ||
538 | cache_hit_region dhwb, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
539 | dcache_sync \ac | ||
540 | // End of data cache region writeback | ||
541 | #endif | ||
542 | .endm | ||
543 | |||
544 | |||
545 | |||
546 | /* | ||
547 | * Writeback entire data cache. | ||
548 | * Parameters: | ||
549 | * aa, ab unique address registers (temporaries) | ||
550 | */ | ||
551 | .macro dcache_writeback_all aa, ab | ||
552 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_IS_WRITEBACK | ||
553 | // Data cache writeback: | ||
554 | cache_index_all diwb, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, 1, \aa, \ab | ||
555 | dcache_sync \aa | ||
556 | // End of data cache writeback | ||
557 | #endif | ||
558 | .endm | ||
559 | |||
560 | |||
561 | |||
562 | /* | ||
563 | * Writeback and invalidate a single line of the data cache. | ||
564 | * Parameters are: | ||
565 | * ar address register that contains (virtual) address to writeback and invalidate | ||
566 | * (may get clobbered in a future implementation, but not currently) | ||
567 | * offset offset to add to \ar to compute effective address to writeback and invalidate | ||
568 | * (note: some number of lsbits are ignored) | ||
569 | */ | ||
570 | .macro dcache_writeback_inv_line ar, offset | ||
571 | #if XCHAL_DCACHE_SIZE > 0 | ||
572 | dhwbi \ar, \offset /* writeback and invalidate dcache line */ | ||
573 | dcache_sync \ar | ||
574 | #endif | ||
575 | .endm | ||
576 | |||
577 | |||
578 | |||
579 | /* | ||
580 | * Writeback and invalidate data cache entries that cache a specified portion of memory. | ||
581 | * Parameters are: | ||
582 | * astart start address (register gets clobbered) | ||
583 | * asize size of the region in bytes (register gets clobbered) | ||
584 | * ac unique register used as temporary | ||
585 | */ | ||
586 | .macro dcache_writeback_inv_region astart, asize, ac | ||
587 | #if XCHAL_DCACHE_SIZE > 0 | ||
588 | // Data cache region writeback and invalidate: | ||
589 | cache_hit_region dhwbi, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
590 | dcache_sync \ac | ||
591 | // End of data cache region writeback and invalidate | ||
592 | #endif | ||
593 | .endm | ||
594 | |||
595 | |||
596 | |||
597 | /* | ||
598 | * Writeback and invalidate entire data cache. | ||
599 | * Parameters: | ||
600 | * aa, ab unique address registers (temporaries) | ||
601 | */ | ||
602 | .macro dcache_writeback_inv_all aa, ab | ||
603 | #if XCHAL_DCACHE_SIZE > 0 | ||
604 | // Data cache writeback and invalidate: | ||
605 | #if XCHAL_DCACHE_IS_WRITEBACK | ||
606 | cache_index_all diwbi, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, 1, \aa, \ab | ||
607 | dcache_sync \aa | ||
608 | #else /*writeback*/ | ||
609 | // Data cache does not support writeback, so just invalidate: */ | ||
610 | dcache_invalidate_all \aa, \ab | ||
611 | #endif /*writeback*/ | ||
612 | // End of data cache writeback and invalidate | ||
613 | #endif | ||
614 | .endm | ||
615 | |||
616 | |||
617 | |||
618 | |||
619 | /* | ||
620 | * Lock (prefetch & lock) a single line of the data cache. | ||
621 | * | ||
622 | * Parameters are: | ||
623 | * ar address register that contains (virtual) address to lock | ||
624 | * (may get clobbered in a future implementation, but not currently) | ||
625 | * offset offset to add to \ar to compute effective address to lock | ||
626 | * (note: some number of lsbits are ignored) | ||
627 | */ | ||
628 | .macro dcache_lock_line ar, offset | ||
629 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
630 | dpfl \ar, \offset /* prefetch and lock dcache line */ | ||
631 | dcache_sync \ar | ||
632 | #endif | ||
633 | .endm | ||
634 | |||
635 | |||
636 | |||
637 | /* | ||
638 | * Lock (prefetch & lock) a specified portion of memory into the data cache. | ||
639 | * Parameters are: | ||
640 | * astart start address (register gets clobbered) | ||
641 | * asize size of the region in bytes (register gets clobbered) | ||
642 | * ac unique register used as temporary | ||
643 | */ | ||
644 | .macro dcache_lock_region astart, asize, ac | ||
645 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
646 | // Data cache region lock: | ||
647 | cache_hit_region dpfl, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
648 | dcache_sync \ac | ||
649 | // End of data cache region lock | ||
650 | #endif | ||
651 | .endm | ||
652 | |||
653 | |||
654 | |||
655 | /* | ||
656 | * Unlock a single line of the data cache. | ||
657 | * | ||
658 | * Parameters are: | ||
659 | * ar address register that contains (virtual) address to unlock | ||
660 | * (may get clobbered in a future implementation, but not currently) | ||
661 | * offset offset to add to \ar to compute effective address to unlock | ||
662 | * (note: some number of lsbits are ignored) | ||
663 | */ | ||
664 | .macro dcache_unlock_line ar, offset | ||
665 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
666 | dhu \ar, \offset /* unlock dcache line */ | ||
667 | dcache_sync \ar | ||
668 | #endif | ||
669 | .endm | ||
670 | |||
671 | |||
672 | |||
673 | /* | ||
674 | * Unlock a specified portion of memory from the data cache. | ||
675 | * Parameters are: | ||
676 | * astart start address (register gets clobbered) | ||
677 | * asize size of the region in bytes (register gets clobbered) | ||
678 | * ac unique register used as temporary | ||
679 | */ | ||
680 | .macro dcache_unlock_region astart, asize, ac | ||
681 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
682 | // Data cache region unlock: | ||
683 | cache_hit_region dhu, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
684 | dcache_sync \ac | ||
685 | // End of data cache region unlock | ||
686 | #endif | ||
687 | .endm | ||
688 | |||
689 | |||
690 | |||
691 | /* | ||
692 | * Unlock entire data cache. | ||
693 | * | ||
694 | * Parameters: | ||
695 | * aa, ab unique address registers (temporaries) | ||
696 | */ | ||
697 | .macro dcache_unlock_all aa, ab | ||
698 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
699 | // Data cache unlock: | ||
700 | cache_index_all diu, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, 1, \aa, \ab | ||
701 | dcache_sync \aa | ||
702 | // End of data cache unlock | ||
703 | #endif | ||
704 | .endm | ||
705 | |||
706 | |||
707 | #endif /*XTENSA_CACHEASM_H*/ | ||
708 | |||
diff --git a/include/asm-xtensa/xtensa/cacheattrasm.h b/include/asm-xtensa/xtensa/cacheattrasm.h new file mode 100644 index 000000000000..1c3e117b3592 --- /dev/null +++ b/include/asm-xtensa/xtensa/cacheattrasm.h | |||
@@ -0,0 +1,432 @@ | |||
1 | #ifndef XTENSA_CACHEATTRASM_H | ||
2 | #define XTENSA_CACHEATTRASM_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/cacheattrasm.h -- assembler-specific | ||
8 | * CACHEATTR register related definitions that depend on CORE | ||
9 | * configuration. | ||
10 | * | ||
11 | * This file is subject to the terms and conditions of the GNU General Public | ||
12 | * License. See the file "COPYING" in the main directory of this archive | ||
13 | * for more details. | ||
14 | * | ||
15 | * Copyright (C) 2002 Tensilica Inc. | ||
16 | */ | ||
17 | |||
18 | |||
19 | #include <xtensa/coreasm.h> | ||
20 | |||
21 | |||
22 | /* | ||
23 | * This header file defines assembler macros of the form: | ||
24 | * <x>cacheattr_<func> | ||
25 | * where: | ||
26 | * <x> is 'i', 'd' or absent for instruction, data | ||
27 | * or both caches; and | ||
28 | * <func> indicates the function of the macro. | ||
29 | * | ||
30 | * The following functions are defined: | ||
31 | * | ||
32 | * icacheattr_get | ||
33 | * Reads I-cache CACHEATTR into a2 (clobbers a3-a5). | ||
34 | * | ||
35 | * dcacheattr_get | ||
36 | * Reads D-cache CACHEATTR into a2 (clobbers a3-a5). | ||
37 | * (Note: for configs with a real CACHEATTR register, the | ||
38 | * above two macros are identical.) | ||
39 | * | ||
40 | * cacheattr_set | ||
41 | * Writes both I-cache and D-cache CACHEATTRs from a2 (a3-a8 clobbered). | ||
42 | * Works even when changing one's own code's attributes. | ||
43 | * | ||
44 | * icacheattr_is_enabled label | ||
45 | * Branches to \label if I-cache appears to have been enabled | ||
46 | * (eg. if CACHEATTR contains a cache-enabled attribute). | ||
47 | * (clobbers a2-a5,SAR) | ||
48 | * | ||
49 | * dcacheattr_is_enabled label | ||
50 | * Branches to \label if D-cache appears to have been enabled | ||
51 | * (eg. if CACHEATTR contains a cache-enabled attribute). | ||
52 | * (clobbers a2-a5,SAR) | ||
53 | * | ||
54 | * cacheattr_is_enabled label | ||
55 | * Branches to \label if either I-cache or D-cache appears to have been enabled | ||
56 | * (eg. if CACHEATTR contains a cache-enabled attribute). | ||
57 | * (clobbers a2-a5,SAR) | ||
58 | * | ||
59 | * The following macros are only defined under certain conditions: | ||
60 | * | ||
61 | * icacheattr_set (if XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR) | ||
62 | * Writes I-cache CACHEATTR from a2 (a3-a8 clobbered). | ||
63 | * | ||
64 | * dcacheattr_set (if XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR) | ||
65 | * Writes D-cache CACHEATTR from a2 (a3-a8 clobbered). | ||
66 | */ | ||
67 | |||
68 | |||
69 | |||
70 | /*************************** GENERIC -- ALL CACHES ***************************/ | ||
71 | |||
72 | /* | ||
73 | * _cacheattr_get | ||
74 | * | ||
75 | * (Internal macro.) | ||
76 | * Returns value of CACHEATTR register (or closest equivalent) in a2. | ||
77 | * | ||
78 | * Entry: | ||
79 | * (none) | ||
80 | * Exit: | ||
81 | * a2 value read from CACHEATTR | ||
82 | * a3-a5 clobbered (temporaries) | ||
83 | */ | ||
84 | .macro _cacheattr_get tlb | ||
85 | #if XCHAL_HAVE_CACHEATTR | ||
86 | rsr a2, CACHEATTR | ||
87 | #elif XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
88 | // We have a config that "mimics" CACHEATTR using a simplified | ||
89 | // "MMU" composed of a single statically-mapped way. | ||
90 | // DTLB and ITLB are independent, so there's no single | ||
91 | // cache attribute that can describe both. So for now | ||
92 | // just return the DTLB state. | ||
93 | movi a5, 0xE0000000 | ||
94 | movi a2, 0 | ||
95 | movi a3, 0 | ||
96 | 1: add a3, a3, a5 // next segment | ||
97 | r&tlb&1 a4, a3 // get PPN+CA of segment at 0xE0000000, 0xC0000000, ..., 0 | ||
98 | dsync // interlock??? | ||
99 | slli a2, a2, 4 | ||
100 | extui a4, a4, 0, 4 // extract CA | ||
101 | or a2, a2, a4 | ||
102 | bnez a3, 1b | ||
103 | #else | ||
104 | // This macro isn't applicable to arbitrary MMU configurations. | ||
105 | // Just return zero. | ||
106 | movi a2, 0 | ||
107 | #endif | ||
108 | .endm | ||
109 | |||
110 | .macro icacheattr_get | ||
111 | _cacheattr_get itlb | ||
112 | .endm | ||
113 | |||
114 | .macro dcacheattr_get | ||
115 | _cacheattr_get dtlb | ||
116 | .endm | ||
117 | |||
118 | |||
119 | #define XCHAL_CACHEATTR_ALL_BYPASS 0x22222222 /* default (powerup/reset) value of CACHEATTR, all BYPASS | ||
120 | mode (ie. disabled/bypassed caches) */ | ||
121 | |||
122 | #if XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
123 | |||
124 | #define XCHAL_FCA_ENAMASK 0x001A /* bitmap of fetch attributes that require enabled icache */ | ||
125 | #define XCHAL_LCA_ENAMASK 0x0003 /* bitmap of load attributes that require enabled dcache */ | ||
126 | #define XCHAL_SCA_ENAMASK 0x0003 /* bitmap of store attributes that require enabled dcache */ | ||
127 | #define XCHAL_LSCA_ENAMASK (XCHAL_LCA_ENAMASK|XCHAL_SCA_ENAMASK) /* l/s attrs requiring enabled dcache */ | ||
128 | #define XCHAL_ALLCA_ENAMASK (XCHAL_FCA_ENAMASK|XCHAL_LSCA_ENAMASK) /* all attrs requiring enabled caches */ | ||
129 | |||
130 | /* | ||
131 | * _cacheattr_is_enabled | ||
132 | * | ||
133 | * (Internal macro.) | ||
134 | * Branches to \label if CACHEATTR in a2 indicates an enabled | ||
135 | * cache, using mask in a3. | ||
136 | * | ||
137 | * Parameters: | ||
138 | * label where to branch to if cache is enabled | ||
139 | * Entry: | ||
140 | * a2 contains CACHEATTR value used to determine whether | ||
141 | * caches are enabled | ||
142 | * a3 16-bit constant where each bit correspond to | ||
143 | * one of the 16 possible CA values (in a CACHEATTR mask); | ||
144 | * CA values that indicate the cache is enabled | ||
145 | * have their corresponding bit set in this mask | ||
146 | * (eg. use XCHAL_xCA_ENAMASK , above) | ||
147 | * Exit: | ||
148 | * a2,a4,a5 clobbered | ||
149 | * SAR clobbered | ||
150 | */ | ||
151 | .macro _cacheattr_is_enabled label | ||
152 | movi a4, 8 // loop 8 times | ||
153 | .Lcaife\@: | ||
154 | extui a5, a2, 0, 4 // get CA nibble | ||
155 | ssr a5 // index into mask according to CA... | ||
156 | srl a5, a3 // ...and get CA's mask bit in a5 bit 0 | ||
157 | bbsi.l a5, 0, \label // if CA indicates cache enabled, jump to label | ||
158 | srli a2, a2, 4 // next nibble | ||
159 | addi a4, a4, -1 | ||
160 | bnez a4, .Lcaife\@ // loop for each nibble | ||
161 | .endm | ||
162 | |||
163 | #else /* XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR */ | ||
164 | .macro _cacheattr_is_enabled label | ||
165 | j \label // macro not applicable, assume caches always enabled | ||
166 | .endm | ||
167 | #endif /* XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR */ | ||
168 | |||
169 | |||
170 | |||
171 | /* | ||
172 | * icacheattr_is_enabled | ||
173 | * | ||
174 | * Branches to \label if I-cache is enabled. | ||
175 | * | ||
176 | * Parameters: | ||
177 | * label where to branch to if icache is enabled | ||
178 | * Entry: | ||
179 | * (none) | ||
180 | * Exit: | ||
181 | * a2-a5, SAR clobbered (temporaries) | ||
182 | */ | ||
183 | .macro icacheattr_is_enabled label | ||
184 | #if XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
185 | icacheattr_get | ||
186 | movi a3, XCHAL_FCA_ENAMASK | ||
187 | #endif | ||
188 | _cacheattr_is_enabled \label | ||
189 | .endm | ||
190 | |||
191 | /* | ||
192 | * dcacheattr_is_enabled | ||
193 | * | ||
194 | * Branches to \label if D-cache is enabled. | ||
195 | * | ||
196 | * Parameters: | ||
197 | * label where to branch to if dcache is enabled | ||
198 | * Entry: | ||
199 | * (none) | ||
200 | * Exit: | ||
201 | * a2-a5, SAR clobbered (temporaries) | ||
202 | */ | ||
203 | .macro dcacheattr_is_enabled label | ||
204 | #if XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
205 | dcacheattr_get | ||
206 | movi a3, XCHAL_LSCA_ENAMASK | ||
207 | #endif | ||
208 | _cacheattr_is_enabled \label | ||
209 | .endm | ||
210 | |||
211 | /* | ||
212 | * cacheattr_is_enabled | ||
213 | * | ||
214 | * Branches to \label if either I-cache or D-cache is enabled. | ||
215 | * | ||
216 | * Parameters: | ||
217 | * label where to branch to if a cache is enabled | ||
218 | * Entry: | ||
219 | * (none) | ||
220 | * Exit: | ||
221 | * a2-a5, SAR clobbered (temporaries) | ||
222 | */ | ||
223 | .macro cacheattr_is_enabled label | ||
224 | #if XCHAL_HAVE_CACHEATTR | ||
225 | rsr a2, CACHEATTR | ||
226 | movi a3, XCHAL_ALLCA_ENAMASK | ||
227 | #elif XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
228 | icacheattr_get | ||
229 | movi a3, XCHAL_FCA_ENAMASK | ||
230 | _cacheattr_is_enabled \label | ||
231 | dcacheattr_get | ||
232 | movi a3, XCHAL_LSCA_ENAMASK | ||
233 | #endif | ||
234 | _cacheattr_is_enabled \label | ||
235 | .endm | ||
236 | |||
237 | |||
238 | |||
239 | /* | ||
240 | * The ISA does not have a defined way to change the | ||
241 | * instruction cache attributes of the running code, | ||
242 | * ie. of the memory area that encloses the current PC. | ||
243 | * However, each micro-architecture (or class of | ||
244 | * configurations within a micro-architecture) | ||
245 | * provides a way to deal with this issue. | ||
246 | * | ||
247 | * Here are a few macros used to implement the relevant | ||
248 | * approach taken. | ||
249 | */ | ||
250 | |||
251 | #if XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
252 | // We have a config that "mimics" CACHEATTR using a simplified | ||
253 | // "MMU" composed of a single statically-mapped way. | ||
254 | |||
255 | /* | ||
256 | * icacheattr_set | ||
257 | * | ||
258 | * Entry: | ||
259 | * a2 cacheattr value to set | ||
260 | * Exit: | ||
261 | * a2 unchanged | ||
262 | * a3-a8 clobbered (temporaries) | ||
263 | */ | ||
264 | .macro icacheattr_set | ||
265 | |||
266 | movi a5, 0xE0000000 // mask of upper 3 bits | ||
267 | movi a6, 3f // PC where ITLB is set | ||
268 | movi a3, 0 // start at region 0 (0 .. 7) | ||
269 | and a6, a6, a5 // upper 3 bits of local PC area | ||
270 | mov a7, a2 // copy a2 so it doesn't get clobbered | ||
271 | j 3f | ||
272 | |||
273 | # if XCHAL_HAVE_XLT_CACHEATTR | ||
274 | // Can do translations, use generic method: | ||
275 | 1: sub a6, a3, a5 // address of some other segment | ||
276 | ritlb1 a8, a6 // save its PPN+CA | ||
277 | dsync // interlock?? | ||
278 | witlb a4, a6 // make it translate to this code area | ||
279 | movi a6, 5f // where to jump into it | ||
280 | isync | ||
281 | sub a6, a6, a5 // adjust jump address within that other segment | ||
282 | jx a6 | ||
283 | |||
284 | // Note that in the following code snippet, which runs at a different virtual | ||
285 | // address than it is assembled for, we avoid using literals (eg. via movi/l32r) | ||
286 | // just in case literals end up in a different 512 MB segment, and we avoid | ||
287 | // instructions that rely on the current PC being what is expected. | ||
288 | // | ||
289 | .align 4 | ||
290 | _j 6f // this is at label '5' minus 4 bytes | ||
291 | .align 4 | ||
292 | 5: witlb a4, a3 // we're in other segment, now can write previous segment's CA | ||
293 | isync | ||
294 | add a6, a6, a5 // back to previous segment | ||
295 | addi a6, a6, -4 // next jump label | ||
296 | jx a6 | ||
297 | |||
298 | 6: sub a6, a3, a5 // address of some other segment | ||
299 | witlb a8, a6 // restore PPN+CA of other segment | ||
300 | mov a6, a3 // restore a6 | ||
301 | isync | ||
302 | # else /* XCHAL_HAVE_XLT_CACHEATTR */ | ||
303 | // Use micro-architecture specific method. | ||
304 | // The following 4-instruction sequence is aligned such that | ||
305 | // it all fits within a single I-cache line. Sixteen byte | ||
306 | // alignment is sufficient for this (using XCHAL_ICACHE_LINESIZE | ||
307 | // actually causes problems because that can be greater than | ||
308 | // the alignment of the reset vector, where this macro is often | ||
309 | // invoked, which would cause the linker to align the reset | ||
310 | // vector code away from the reset vector!!). | ||
311 | .align 16 /*XCHAL_ICACHE_LINESIZE*/ | ||
312 | 1: _witlb a4, a3 // write wired PTE (CA, no PPN) of 512MB segment to ITLB | ||
313 | _isync | ||
314 | nop | ||
315 | nop | ||
316 | # endif /* XCHAL_HAVE_XLT_CACHEATTR */ | ||
317 | beq a3, a5, 4f // done? | ||
318 | |||
319 | // Note that in the WITLB loop, we don't do any load/stores | ||
320 | // (may not be an issue here, but it is important in the DTLB case). | ||
321 | 2: srli a7, a7, 4 // next CA | ||
322 | sub a3, a3, a5 // next segment (add 0x20000000) | ||
323 | 3: | ||
324 | # if XCHAL_HAVE_XLT_CACHEATTR /* if have translation, preserve it */ | ||
325 | ritlb1 a8, a3 // get current PPN+CA of segment | ||
326 | dsync // interlock??? | ||
327 | extui a4, a7, 0, 4 // extract CA to set | ||
328 | srli a8, a8, 4 // clear CA but keep PPN ... | ||
329 | slli a8, a8, 4 // ... | ||
330 | add a4, a4, a8 // combine new CA with PPN to preserve | ||
331 | # else | ||
332 | extui a4, a7, 0, 4 // extract CA | ||
333 | # endif | ||
334 | beq a3, a6, 1b // current PC's region? if so, do it in a safe way | ||
335 | witlb a4, a3 // write wired PTE (CA [+PPN]) of 512MB segment to ITLB | ||
336 | bne a3, a5, 2b | ||
337 | isync // make sure all ifetch changes take effect | ||
338 | 4: | ||
339 | .endm // icacheattr_set | ||
340 | |||
341 | |||
342 | /* | ||
343 | * dcacheattr_set | ||
344 | * | ||
345 | * Entry: | ||
346 | * a2 cacheattr value to set | ||
347 | * Exit: | ||
348 | * a2 unchanged | ||
349 | * a3-a8 clobbered (temporaries) | ||
350 | */ | ||
351 | |||
352 | .macro dcacheattr_set | ||
353 | |||
354 | movi a5, 0xE0000000 // mask of upper 3 bits | ||
355 | movi a3, 0 // start at region 0 (0 .. 7) | ||
356 | mov a7, a2 // copy a2 so it doesn't get clobbered | ||
357 | j 3f | ||
358 | // Note that in the WDTLB loop, we don't do any load/stores | ||
359 | // (including implicit l32r via movi) because it isn't safe. | ||
360 | 2: srli a7, a7, 4 // next CA | ||
361 | sub a3, a3, a5 // next segment (add 0x20000000) | ||
362 | 3: | ||
363 | # if XCHAL_HAVE_XLT_CACHEATTR /* if have translation, preserve it */ | ||
364 | rdtlb1 a8, a3 // get current PPN+CA of segment | ||
365 | dsync // interlock??? | ||
366 | extui a4, a7, 0, 4 // extract CA to set | ||
367 | srli a8, a8, 4 // clear CA but keep PPN ... | ||
368 | slli a8, a8, 4 // ... | ||
369 | add a4, a4, a8 // combine new CA with PPN to preserve | ||
370 | # else | ||
371 | extui a4, a7, 0, 4 // extract CA to set | ||
372 | # endif | ||
373 | wdtlb a4, a3 // write wired PTE (CA [+PPN]) of 512MB segment to DTLB | ||
374 | bne a3, a5, 2b | ||
375 | dsync // make sure all data path changes take effect | ||
376 | .endm // dcacheattr_set | ||
377 | |||
378 | #endif /* XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR */ | ||
379 | |||
380 | |||
381 | |||
382 | /* | ||
383 | * cacheattr_set | ||
384 | * | ||
385 | * Macro that sets the current CACHEATTR safely | ||
386 | * (both i and d) according to the current contents of a2. | ||
387 | * It works even when changing the cache attributes of | ||
388 | * the currently running code. | ||
389 | * | ||
390 | * Entry: | ||
391 | * a2 cacheattr value to set | ||
392 | * Exit: | ||
393 | * a2 unchanged | ||
394 | * a3-a8 clobbered (temporaries) | ||
395 | */ | ||
396 | .macro cacheattr_set | ||
397 | |||
398 | #if XCHAL_HAVE_CACHEATTR | ||
399 | # if XCHAL_ICACHE_LINESIZE < 4 | ||
400 | // No i-cache, so can always safely write to CACHEATTR: | ||
401 | wsr a2, CACHEATTR | ||
402 | # else | ||
403 | // The Athens micro-architecture, when using the old | ||
404 | // exception architecture option (ie. with the CACHEATTR register) | ||
405 | // allows changing the cache attributes of the running code | ||
406 | // using the following exact sequence aligned to be within | ||
407 | // an instruction cache line. (NOTE: using XCHAL_ICACHE_LINESIZE | ||
408 | // alignment actually causes problems because that can be greater | ||
409 | // than the alignment of the reset vector, where this macro is often | ||
410 | // invoked, which would cause the linker to align the reset | ||
411 | // vector code away from the reset vector!!). | ||
412 | j 1f | ||
413 | .align 16 /*XCHAL_ICACHE_LINESIZE*/ // align to within an I-cache line | ||
414 | 1: _wsr a2, CACHEATTR | ||
415 | _isync | ||
416 | nop | ||
417 | nop | ||
418 | # endif | ||
419 | #elif XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
420 | // DTLB and ITLB are independent, but to keep semantics | ||
421 | // of this macro we simply write to both. | ||
422 | icacheattr_set | ||
423 | dcacheattr_set | ||
424 | #else | ||
425 | // This macro isn't applicable to arbitrary MMU configurations. | ||
426 | // Do nothing in this case. | ||
427 | #endif | ||
428 | .endm | ||
429 | |||
430 | |||
431 | #endif /*XTENSA_CACHEATTRASM_H*/ | ||
432 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/core.h b/include/asm-xtensa/xtensa/config-linux_be/core.h new file mode 100644 index 000000000000..d54fe5eb1064 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/core.h | |||
@@ -0,0 +1,1270 @@ | |||
1 | /* | ||
2 | * xtensa/config/core.h -- HAL definitions that are dependent on CORE configuration | ||
3 | * | ||
4 | * This header file is sometimes referred to as the "compile-time HAL" or CHAL. | ||
5 | * It was generated for a specific Xtensa processor configuration. | ||
6 | * | ||
7 | * Source for configuration-independent binaries (which link in a | ||
8 | * configuration-specific HAL library) must NEVER include this file. | ||
9 | * It is perfectly normal, however, for the HAL source itself to include this file. | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
17 | * License as published by the Free Software Foundation. | ||
18 | * | ||
19 | * This program is distributed in the hope that it would be useful, but | ||
20 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
22 | * | ||
23 | * Further, this software is distributed without any warranty that it is | ||
24 | * free of the rightful claim of any third person regarding infringement | ||
25 | * or the like. Any license provided herein, whether implied or | ||
26 | * otherwise, applies only to this software file. Patent licenses, if | ||
27 | * any, provided herein do not apply to combinations of this program with | ||
28 | * other software, or any other product whatsoever. | ||
29 | * | ||
30 | * You should have received a copy of the GNU Lesser General Public | ||
31 | * License along with this program; if not, write the Free Software | ||
32 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
33 | * USA. | ||
34 | */ | ||
35 | |||
36 | |||
37 | #ifndef XTENSA_CONFIG_CORE_H | ||
38 | #define XTENSA_CONFIG_CORE_H | ||
39 | |||
40 | #include <xtensa/hal.h> | ||
41 | |||
42 | |||
43 | /*---------------------------------------------------------------------- | ||
44 | GENERAL | ||
45 | ----------------------------------------------------------------------*/ | ||
46 | |||
47 | /* | ||
48 | * Separators for macros that expand into arrays. | ||
49 | * These can be predefined by files that #include this one, | ||
50 | * when different separators are required. | ||
51 | */ | ||
52 | /* Element separator for macros that expand into 1-dimensional arrays: */ | ||
53 | #ifndef XCHAL_SEP | ||
54 | #define XCHAL_SEP , | ||
55 | #endif | ||
56 | /* Array separator for macros that expand into 2-dimensional arrays: */ | ||
57 | #ifndef XCHAL_SEP2 | ||
58 | #define XCHAL_SEP2 },{ | ||
59 | #endif | ||
60 | |||
61 | |||
62 | /*---------------------------------------------------------------------- | ||
63 | ENDIANNESS | ||
64 | ----------------------------------------------------------------------*/ | ||
65 | |||
66 | #define XCHAL_HAVE_BE 1 | ||
67 | #define XCHAL_HAVE_LE 0 | ||
68 | #define XCHAL_MEMORY_ORDER XTHAL_BIGENDIAN | ||
69 | |||
70 | |||
71 | /*---------------------------------------------------------------------- | ||
72 | REGISTER WINDOWS | ||
73 | ----------------------------------------------------------------------*/ | ||
74 | |||
75 | #define XCHAL_HAVE_WINDOWED 1 /* 1 if windowed registers option configured, 0 otherwise */ | ||
76 | #define XCHAL_NUM_AREGS 64 /* number of physical address regs */ | ||
77 | #define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */ | ||
78 | |||
79 | |||
80 | /*---------------------------------------------------------------------- | ||
81 | ADDRESS ALIGNMENT | ||
82 | ----------------------------------------------------------------------*/ | ||
83 | |||
84 | /* These apply to a selected set of core load and store instructions only (see ISA): */ | ||
85 | #define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* 1 if unaligned loads cause an exception, 0 otherwise */ | ||
86 | #define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* 1 if unaligned stores cause an exception, 0 otherwise */ | ||
87 | |||
88 | |||
89 | /*---------------------------------------------------------------------- | ||
90 | INTERRUPTS | ||
91 | ----------------------------------------------------------------------*/ | ||
92 | |||
93 | #define XCHAL_HAVE_INTERRUPTS 1 /* 1 if interrupt option configured, 0 otherwise */ | ||
94 | #define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* 1 if high-priority interrupt option configured, 0 otherwise */ | ||
95 | #define XCHAL_HAVE_HIGHLEVEL_INTERRUPTS XCHAL_HAVE_HIGHPRI_INTERRUPTS | ||
96 | #define XCHAL_HAVE_NMI 0 /* 1 if NMI option configured, 0 otherwise */ | ||
97 | #define XCHAL_NUM_INTERRUPTS 17 /* number of interrupts */ | ||
98 | #define XCHAL_NUM_INTERRUPTS_LOG2 5 /* number of bits to hold an interrupt number: roundup(log2(number of interrupts)) */ | ||
99 | #define XCHAL_NUM_EXTINTERRUPTS 10 /* number of external interrupts */ | ||
100 | #define XCHAL_NUM_INTLEVELS 4 /* number of interrupt levels (not including level zero!) */ | ||
101 | #define XCHAL_NUM_LOWPRI_LEVELS 1 /* number of low-priority interrupt levels (always 1) */ | ||
102 | #define XCHAL_FIRST_HIGHPRI_LEVEL (XCHAL_NUM_LOWPRI_LEVELS+1) /* level of first high-priority interrupt (always 2) */ | ||
103 | #define XCHAL_EXCM_LEVEL 1 /* level of interrupts masked by PS.EXCM (XEA2 only; always 1 in T10xx); | ||
104 | for XEA1, where there is no PS.EXCM, this is always 1; | ||
105 | interrupts at levels FIRST_HIGHPRI <= n <= EXCM_LEVEL, if any, | ||
106 | are termed "medium priority" interrupts (post T10xx only) */ | ||
107 | /* Note: 1 <= LOWPRI_LEVELS <= EXCM_LEVEL < DEBUGLEVEL <= NUM_INTLEVELS < NMILEVEL <= 15 */ | ||
108 | |||
109 | /* Masks of interrupts at each interrupt level: */ | ||
110 | #define XCHAL_INTLEVEL0_MASK 0x00000000 | ||
111 | #define XCHAL_INTLEVEL1_MASK 0x000064F9 | ||
112 | #define XCHAL_INTLEVEL2_MASK 0x00008902 | ||
113 | #define XCHAL_INTLEVEL3_MASK 0x00011204 | ||
114 | #define XCHAL_INTLEVEL4_MASK 0x00000000 | ||
115 | #define XCHAL_INTLEVEL5_MASK 0x00000000 | ||
116 | #define XCHAL_INTLEVEL6_MASK 0x00000000 | ||
117 | #define XCHAL_INTLEVEL7_MASK 0x00000000 | ||
118 | #define XCHAL_INTLEVEL8_MASK 0x00000000 | ||
119 | #define XCHAL_INTLEVEL9_MASK 0x00000000 | ||
120 | #define XCHAL_INTLEVEL10_MASK 0x00000000 | ||
121 | #define XCHAL_INTLEVEL11_MASK 0x00000000 | ||
122 | #define XCHAL_INTLEVEL12_MASK 0x00000000 | ||
123 | #define XCHAL_INTLEVEL13_MASK 0x00000000 | ||
124 | #define XCHAL_INTLEVEL14_MASK 0x00000000 | ||
125 | #define XCHAL_INTLEVEL15_MASK 0x00000000 | ||
126 | /* As an array of entries (eg. for C constant arrays): */ | ||
127 | #define XCHAL_INTLEVEL_MASKS 0x00000000 XCHAL_SEP \ | ||
128 | 0x000064F9 XCHAL_SEP \ | ||
129 | 0x00008902 XCHAL_SEP \ | ||
130 | 0x00011204 XCHAL_SEP \ | ||
131 | 0x00000000 XCHAL_SEP \ | ||
132 | 0x00000000 XCHAL_SEP \ | ||
133 | 0x00000000 XCHAL_SEP \ | ||
134 | 0x00000000 XCHAL_SEP \ | ||
135 | 0x00000000 XCHAL_SEP \ | ||
136 | 0x00000000 XCHAL_SEP \ | ||
137 | 0x00000000 XCHAL_SEP \ | ||
138 | 0x00000000 XCHAL_SEP \ | ||
139 | 0x00000000 XCHAL_SEP \ | ||
140 | 0x00000000 XCHAL_SEP \ | ||
141 | 0x00000000 XCHAL_SEP \ | ||
142 | 0x00000000 | ||
143 | |||
144 | /* Masks of interrupts at each range 1..n of interrupt levels: */ | ||
145 | #define XCHAL_INTLEVEL0_ANDBELOW_MASK 0x00000000 | ||
146 | #define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x000064F9 | ||
147 | #define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x0000EDFB | ||
148 | #define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x0001FFFF | ||
149 | #define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x0001FFFF | ||
150 | #define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x0001FFFF | ||
151 | #define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x0001FFFF | ||
152 | #define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x0001FFFF | ||
153 | #define XCHAL_INTLEVEL8_ANDBELOW_MASK 0x0001FFFF | ||
154 | #define XCHAL_INTLEVEL9_ANDBELOW_MASK 0x0001FFFF | ||
155 | #define XCHAL_INTLEVEL10_ANDBELOW_MASK 0x0001FFFF | ||
156 | #define XCHAL_INTLEVEL11_ANDBELOW_MASK 0x0001FFFF | ||
157 | #define XCHAL_INTLEVEL12_ANDBELOW_MASK 0x0001FFFF | ||
158 | #define XCHAL_INTLEVEL13_ANDBELOW_MASK 0x0001FFFF | ||
159 | #define XCHAL_INTLEVEL14_ANDBELOW_MASK 0x0001FFFF | ||
160 | #define XCHAL_INTLEVEL15_ANDBELOW_MASK 0x0001FFFF | ||
161 | #define XCHAL_LOWPRI_MASK XCHAL_INTLEVEL1_ANDBELOW_MASK /* mask of all low-priority interrupts */ | ||
162 | #define XCHAL_EXCM_MASK XCHAL_INTLEVEL1_ANDBELOW_MASK /* mask of all interrupts masked by PS.EXCM (or CEXCM) */ | ||
163 | /* As an array of entries (eg. for C constant arrays): */ | ||
164 | #define XCHAL_INTLEVEL_ANDBELOW_MASKS 0x00000000 XCHAL_SEP \ | ||
165 | 0x000064F9 XCHAL_SEP \ | ||
166 | 0x0000EDFB XCHAL_SEP \ | ||
167 | 0x0001FFFF XCHAL_SEP \ | ||
168 | 0x0001FFFF XCHAL_SEP \ | ||
169 | 0x0001FFFF XCHAL_SEP \ | ||
170 | 0x0001FFFF XCHAL_SEP \ | ||
171 | 0x0001FFFF XCHAL_SEP \ | ||
172 | 0x0001FFFF XCHAL_SEP \ | ||
173 | 0x0001FFFF XCHAL_SEP \ | ||
174 | 0x0001FFFF XCHAL_SEP \ | ||
175 | 0x0001FFFF XCHAL_SEP \ | ||
176 | 0x0001FFFF XCHAL_SEP \ | ||
177 | 0x0001FFFF XCHAL_SEP \ | ||
178 | 0x0001FFFF XCHAL_SEP \ | ||
179 | 0x0001FFFF | ||
180 | |||
181 | /* Interrupt numbers for each interrupt level at which only one interrupt was configured: */ | ||
182 | /*#define XCHAL_INTLEVEL1_NUM ...more than one interrupt at this level...*/ | ||
183 | /*#define XCHAL_INTLEVEL2_NUM ...more than one interrupt at this level...*/ | ||
184 | /*#define XCHAL_INTLEVEL3_NUM ...more than one interrupt at this level...*/ | ||
185 | |||
186 | /* Level of each interrupt: */ | ||
187 | #define XCHAL_INT0_LEVEL 1 | ||
188 | #define XCHAL_INT1_LEVEL 2 | ||
189 | #define XCHAL_INT2_LEVEL 3 | ||
190 | #define XCHAL_INT3_LEVEL 1 | ||
191 | #define XCHAL_INT4_LEVEL 1 | ||
192 | #define XCHAL_INT5_LEVEL 1 | ||
193 | #define XCHAL_INT6_LEVEL 1 | ||
194 | #define XCHAL_INT7_LEVEL 1 | ||
195 | #define XCHAL_INT8_LEVEL 2 | ||
196 | #define XCHAL_INT9_LEVEL 3 | ||
197 | #define XCHAL_INT10_LEVEL 1 | ||
198 | #define XCHAL_INT11_LEVEL 2 | ||
199 | #define XCHAL_INT12_LEVEL 3 | ||
200 | #define XCHAL_INT13_LEVEL 1 | ||
201 | #define XCHAL_INT14_LEVEL 1 | ||
202 | #define XCHAL_INT15_LEVEL 2 | ||
203 | #define XCHAL_INT16_LEVEL 3 | ||
204 | #define XCHAL_INT17_LEVEL 0 | ||
205 | #define XCHAL_INT18_LEVEL 0 | ||
206 | #define XCHAL_INT19_LEVEL 0 | ||
207 | #define XCHAL_INT20_LEVEL 0 | ||
208 | #define XCHAL_INT21_LEVEL 0 | ||
209 | #define XCHAL_INT22_LEVEL 0 | ||
210 | #define XCHAL_INT23_LEVEL 0 | ||
211 | #define XCHAL_INT24_LEVEL 0 | ||
212 | #define XCHAL_INT25_LEVEL 0 | ||
213 | #define XCHAL_INT26_LEVEL 0 | ||
214 | #define XCHAL_INT27_LEVEL 0 | ||
215 | #define XCHAL_INT28_LEVEL 0 | ||
216 | #define XCHAL_INT29_LEVEL 0 | ||
217 | #define XCHAL_INT30_LEVEL 0 | ||
218 | #define XCHAL_INT31_LEVEL 0 | ||
219 | /* As an array of entries (eg. for C constant arrays): */ | ||
220 | #define XCHAL_INT_LEVELS 1 XCHAL_SEP \ | ||
221 | 2 XCHAL_SEP \ | ||
222 | 3 XCHAL_SEP \ | ||
223 | 1 XCHAL_SEP \ | ||
224 | 1 XCHAL_SEP \ | ||
225 | 1 XCHAL_SEP \ | ||
226 | 1 XCHAL_SEP \ | ||
227 | 1 XCHAL_SEP \ | ||
228 | 2 XCHAL_SEP \ | ||
229 | 3 XCHAL_SEP \ | ||
230 | 1 XCHAL_SEP \ | ||
231 | 2 XCHAL_SEP \ | ||
232 | 3 XCHAL_SEP \ | ||
233 | 1 XCHAL_SEP \ | ||
234 | 1 XCHAL_SEP \ | ||
235 | 2 XCHAL_SEP \ | ||
236 | 3 XCHAL_SEP \ | ||
237 | 0 XCHAL_SEP \ | ||
238 | 0 XCHAL_SEP \ | ||
239 | 0 XCHAL_SEP \ | ||
240 | 0 XCHAL_SEP \ | ||
241 | 0 XCHAL_SEP \ | ||
242 | 0 XCHAL_SEP \ | ||
243 | 0 XCHAL_SEP \ | ||
244 | 0 XCHAL_SEP \ | ||
245 | 0 XCHAL_SEP \ | ||
246 | 0 XCHAL_SEP \ | ||
247 | 0 XCHAL_SEP \ | ||
248 | 0 XCHAL_SEP \ | ||
249 | 0 XCHAL_SEP \ | ||
250 | 0 XCHAL_SEP \ | ||
251 | 0 | ||
252 | |||
253 | /* Type of each interrupt: */ | ||
254 | #define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
255 | #define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
256 | #define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
257 | #define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
258 | #define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
259 | #define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
260 | #define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
261 | #define XCHAL_INT7_TYPE XTHAL_INTTYPE_EXTERN_EDGE | ||
262 | #define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_EDGE | ||
263 | #define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_EDGE | ||
264 | #define XCHAL_INT10_TYPE XTHAL_INTTYPE_TIMER | ||
265 | #define XCHAL_INT11_TYPE XTHAL_INTTYPE_TIMER | ||
266 | #define XCHAL_INT12_TYPE XTHAL_INTTYPE_TIMER | ||
267 | #define XCHAL_INT13_TYPE XTHAL_INTTYPE_SOFTWARE | ||
268 | #define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE | ||
269 | #define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE | ||
270 | #define XCHAL_INT16_TYPE XTHAL_INTTYPE_SOFTWARE | ||
271 | #define XCHAL_INT17_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
272 | #define XCHAL_INT18_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
273 | #define XCHAL_INT19_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
274 | #define XCHAL_INT20_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
275 | #define XCHAL_INT21_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
276 | #define XCHAL_INT22_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
277 | #define XCHAL_INT23_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
278 | #define XCHAL_INT24_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
279 | #define XCHAL_INT25_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
280 | #define XCHAL_INT26_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
281 | #define XCHAL_INT27_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
282 | #define XCHAL_INT28_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
283 | #define XCHAL_INT29_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
284 | #define XCHAL_INT30_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
285 | #define XCHAL_INT31_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
286 | /* As an array of entries (eg. for C constant arrays): */ | ||
287 | #define XCHAL_INT_TYPES XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
288 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
289 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
290 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
291 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
292 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
293 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
294 | XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \ | ||
295 | XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \ | ||
296 | XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \ | ||
297 | XTHAL_INTTYPE_TIMER XCHAL_SEP \ | ||
298 | XTHAL_INTTYPE_TIMER XCHAL_SEP \ | ||
299 | XTHAL_INTTYPE_TIMER XCHAL_SEP \ | ||
300 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
301 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
302 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
303 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
304 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
305 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
306 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
307 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
308 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
309 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
310 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
311 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
312 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
313 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
314 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
315 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
316 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
317 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
318 | XTHAL_INTTYPE_UNCONFIGURED | ||
319 | |||
320 | /* Masks of interrupts for each type of interrupt: */ | ||
321 | #define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFFE0000 | ||
322 | #define XCHAL_INTTYPE_MASK_SOFTWARE 0x0001E000 | ||
323 | #define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000380 | ||
324 | #define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0000007F | ||
325 | #define XCHAL_INTTYPE_MASK_TIMER 0x00001C00 | ||
326 | #define XCHAL_INTTYPE_MASK_NMI 0x00000000 | ||
327 | /* As an array of entries (eg. for C constant arrays): */ | ||
328 | #define XCHAL_INTTYPE_MASKS 0xFFFE0000 XCHAL_SEP \ | ||
329 | 0x0001E000 XCHAL_SEP \ | ||
330 | 0x00000380 XCHAL_SEP \ | ||
331 | 0x0000007F XCHAL_SEP \ | ||
332 | 0x00001C00 XCHAL_SEP \ | ||
333 | 0x00000000 | ||
334 | |||
335 | /* Interrupts assigned to each timer (CCOMPARE0 to CCOMPARE3), -1 if unassigned */ | ||
336 | #define XCHAL_TIMER0_INTERRUPT 10 | ||
337 | #define XCHAL_TIMER1_INTERRUPT 11 | ||
338 | #define XCHAL_TIMER2_INTERRUPT 12 | ||
339 | #define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED | ||
340 | /* As an array of entries (eg. for C constant arrays): */ | ||
341 | #define XCHAL_TIMER_INTERRUPTS 10 XCHAL_SEP \ | ||
342 | 11 XCHAL_SEP \ | ||
343 | 12 XCHAL_SEP \ | ||
344 | XTHAL_TIMER_UNCONFIGURED | ||
345 | |||
346 | /* Indexing macros: */ | ||
347 | #define _XCHAL_INTLEVEL_MASK(n) XCHAL_INTLEVEL ## n ## _MASK | ||
348 | #define XCHAL_INTLEVEL_MASK(n) _XCHAL_INTLEVEL_MASK(n) /* n = 0 .. 15 */ | ||
349 | #define _XCHAL_INTLEVEL_ANDBELOWMASK(n) XCHAL_INTLEVEL ## n ## _ANDBELOW_MASK | ||
350 | #define XCHAL_INTLEVEL_ANDBELOW_MASK(n) _XCHAL_INTLEVEL_ANDBELOWMASK(n) /* n = 0 .. 15 */ | ||
351 | #define _XCHAL_INT_LEVEL(n) XCHAL_INT ## n ## _LEVEL | ||
352 | #define XCHAL_INT_LEVEL(n) _XCHAL_INT_LEVEL(n) /* n = 0 .. 31 */ | ||
353 | #define _XCHAL_INT_TYPE(n) XCHAL_INT ## n ## _TYPE | ||
354 | #define XCHAL_INT_TYPE(n) _XCHAL_INT_TYPE(n) /* n = 0 .. 31 */ | ||
355 | #define _XCHAL_TIMER_INTERRUPT(n) XCHAL_TIMER ## n ## _INTERRUPT | ||
356 | #define XCHAL_TIMER_INTERRUPT(n) _XCHAL_TIMER_INTERRUPT(n) /* n = 0 .. 3 */ | ||
357 | |||
358 | |||
359 | |||
360 | /* | ||
361 | * External interrupt vectors/levels. | ||
362 | * These macros describe how Xtensa processor interrupt numbers | ||
363 | * (as numbered internally, eg. in INTERRUPT and INTENABLE registers) | ||
364 | * map to external BInterrupt<n> pins, for those interrupts | ||
365 | * configured as external (level-triggered, edge-triggered, or NMI). | ||
366 | * See the Xtensa processor databook for more details. | ||
367 | */ | ||
368 | |||
369 | /* Core interrupt numbers mapped to each EXTERNAL interrupt number: */ | ||
370 | #define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */ | ||
371 | #define XCHAL_EXTINT1_NUM 1 /* (intlevel 2) */ | ||
372 | #define XCHAL_EXTINT2_NUM 2 /* (intlevel 3) */ | ||
373 | #define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */ | ||
374 | #define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */ | ||
375 | #define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */ | ||
376 | #define XCHAL_EXTINT6_NUM 6 /* (intlevel 1) */ | ||
377 | #define XCHAL_EXTINT7_NUM 7 /* (intlevel 1) */ | ||
378 | #define XCHAL_EXTINT8_NUM 8 /* (intlevel 2) */ | ||
379 | #define XCHAL_EXTINT9_NUM 9 /* (intlevel 3) */ | ||
380 | |||
381 | /* Corresponding interrupt masks: */ | ||
382 | #define XCHAL_EXTINT0_MASK 0x00000001 | ||
383 | #define XCHAL_EXTINT1_MASK 0x00000002 | ||
384 | #define XCHAL_EXTINT2_MASK 0x00000004 | ||
385 | #define XCHAL_EXTINT3_MASK 0x00000008 | ||
386 | #define XCHAL_EXTINT4_MASK 0x00000010 | ||
387 | #define XCHAL_EXTINT5_MASK 0x00000020 | ||
388 | #define XCHAL_EXTINT6_MASK 0x00000040 | ||
389 | #define XCHAL_EXTINT7_MASK 0x00000080 | ||
390 | #define XCHAL_EXTINT8_MASK 0x00000100 | ||
391 | #define XCHAL_EXTINT9_MASK 0x00000200 | ||
392 | |||
393 | /* Core config interrupt levels mapped to each external interrupt: */ | ||
394 | #define XCHAL_EXTINT0_LEVEL 1 /* (int number 0) */ | ||
395 | #define XCHAL_EXTINT1_LEVEL 2 /* (int number 1) */ | ||
396 | #define XCHAL_EXTINT2_LEVEL 3 /* (int number 2) */ | ||
397 | #define XCHAL_EXTINT3_LEVEL 1 /* (int number 3) */ | ||
398 | #define XCHAL_EXTINT4_LEVEL 1 /* (int number 4) */ | ||
399 | #define XCHAL_EXTINT5_LEVEL 1 /* (int number 5) */ | ||
400 | #define XCHAL_EXTINT6_LEVEL 1 /* (int number 6) */ | ||
401 | #define XCHAL_EXTINT7_LEVEL 1 /* (int number 7) */ | ||
402 | #define XCHAL_EXTINT8_LEVEL 2 /* (int number 8) */ | ||
403 | #define XCHAL_EXTINT9_LEVEL 3 /* (int number 9) */ | ||
404 | |||
405 | |||
406 | /*---------------------------------------------------------------------- | ||
407 | EXCEPTIONS and VECTORS | ||
408 | ----------------------------------------------------------------------*/ | ||
409 | |||
410 | #define XCHAL_HAVE_EXCEPTIONS 1 /* 1 if exception option configured, 0 otherwise */ | ||
411 | |||
412 | #define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture number: 1 for XEA1 (old), 2 for XEA2 (new) */ | ||
413 | #define XCHAL_HAVE_XEA1 0 /* 1 if XEA1, 0 otherwise */ | ||
414 | #define XCHAL_HAVE_XEA2 1 /* 1 if XEA2, 0 otherwise */ | ||
415 | /* For backward compatibility ONLY -- DO NOT USE (will be removed in future release): */ | ||
416 | #define XCHAL_HAVE_OLD_EXC_ARCH XCHAL_HAVE_XEA1 /* (DEPRECATED) 1 if old exception architecture (XEA1), 0 otherwise (eg. XEA2) */ | ||
417 | #define XCHAL_HAVE_EXCM XCHAL_HAVE_XEA2 /* (DEPRECATED) 1 if PS.EXCM bit exists (currently equals XCHAL_HAVE_TLBS) */ | ||
418 | |||
419 | #define XCHAL_RESET_VECTOR_VADDR 0xFE000020 | ||
420 | #define XCHAL_RESET_VECTOR_PADDR 0xFE000020 | ||
421 | #define XCHAL_USER_VECTOR_VADDR 0xD0000220 | ||
422 | #define XCHAL_PROGRAMEXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR /* for backward compatibility */ | ||
423 | #define XCHAL_USEREXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR /* for backward compatibility */ | ||
424 | #define XCHAL_USER_VECTOR_PADDR 0x00000220 | ||
425 | #define XCHAL_PROGRAMEXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR /* for backward compatibility */ | ||
426 | #define XCHAL_USEREXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR /* for backward compatibility */ | ||
427 | #define XCHAL_KERNEL_VECTOR_VADDR 0xD0000200 | ||
428 | #define XCHAL_STACKEDEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR /* for backward compatibility */ | ||
429 | #define XCHAL_KERNELEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR /* for backward compatibility */ | ||
430 | #define XCHAL_KERNEL_VECTOR_PADDR 0x00000200 | ||
431 | #define XCHAL_STACKEDEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR /* for backward compatibility */ | ||
432 | #define XCHAL_KERNELEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR /* for backward compatibility */ | ||
433 | #define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xD0000290 | ||
434 | #define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x00000290 | ||
435 | #define XCHAL_WINDOW_VECTORS_VADDR 0xD0000000 | ||
436 | #define XCHAL_WINDOW_VECTORS_PADDR 0x00000000 | ||
437 | #define XCHAL_INTLEVEL2_VECTOR_VADDR 0xD0000240 | ||
438 | #define XCHAL_INTLEVEL2_VECTOR_PADDR 0x00000240 | ||
439 | #define XCHAL_INTLEVEL3_VECTOR_VADDR 0xD0000250 | ||
440 | #define XCHAL_INTLEVEL3_VECTOR_PADDR 0x00000250 | ||
441 | #define XCHAL_INTLEVEL4_VECTOR_VADDR 0xFE000520 | ||
442 | #define XCHAL_INTLEVEL4_VECTOR_PADDR 0xFE000520 | ||
443 | #define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL4_VECTOR_VADDR | ||
444 | #define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL4_VECTOR_PADDR | ||
445 | |||
446 | /* Indexing macros: */ | ||
447 | #define _XCHAL_INTLEVEL_VECTOR_VADDR(n) XCHAL_INTLEVEL ## n ## _VECTOR_VADDR | ||
448 | #define XCHAL_INTLEVEL_VECTOR_VADDR(n) _XCHAL_INTLEVEL_VECTOR_VADDR(n) /* n = 0 .. 15 */ | ||
449 | |||
450 | /* | ||
451 | * General Exception Causes | ||
452 | * (values of EXCCAUSE special register set by general exceptions, | ||
453 | * which vector to the user, kernel, or double-exception vectors): | ||
454 | */ | ||
455 | #define XCHAL_EXCCAUSE_ILLEGAL_INSTRUCTION 0 /* Illegal Instruction (IllegalInstruction) */ | ||
456 | #define XCHAL_EXCCAUSE_SYSTEM_CALL 1 /* System Call (SystemCall) */ | ||
457 | #define XCHAL_EXCCAUSE_INSTRUCTION_FETCH_ERROR 2 /* Instruction Fetch Error (InstructionFetchError) */ | ||
458 | #define XCHAL_EXCCAUSE_LOAD_STORE_ERROR 3 /* Load Store Error (LoadStoreError) */ | ||
459 | #define XCHAL_EXCCAUSE_LEVEL1_INTERRUPT 4 /* Level 1 Interrupt (Level1Interrupt) */ | ||
460 | #define XCHAL_EXCCAUSE_ALLOCA 5 /* Stack Extension Assist (Alloca) */ | ||
461 | #define XCHAL_EXCCAUSE_INTEGER_DIVIDE_BY_ZERO 6 /* Integer Divide by Zero (IntegerDivideByZero) */ | ||
462 | #define XCHAL_EXCCAUSE_SPECULATION 7 /* Speculation (Speculation) */ | ||
463 | #define XCHAL_EXCCAUSE_PRIVILEGED 8 /* Privileged Instruction (Privileged) */ | ||
464 | #define XCHAL_EXCCAUSE_UNALIGNED 9 /* Unaligned Load Store (Unaligned) */ | ||
465 | #define XCHAL_EXCCAUSE_ITLB_MISS 16 /* ITlb Miss Exception (ITlbMiss) */ | ||
466 | #define XCHAL_EXCCAUSE_ITLB_MULTIHIT 17 /* ITlb Mutltihit Exception (ITlbMultihit) */ | ||
467 | #define XCHAL_EXCCAUSE_ITLB_PRIVILEGE 18 /* ITlb Privilege Exception (ITlbPrivilege) */ | ||
468 | #define XCHAL_EXCCAUSE_ITLB_SIZE_RESTRICTION 19 /* ITlb Size Restriction Exception (ITlbSizeRestriction) */ | ||
469 | #define XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE 20 /* Fetch Cache Attribute Exception (FetchCacheAttribute) */ | ||
470 | #define XCHAL_EXCCAUSE_DTLB_MISS 24 /* DTlb Miss Exception (DTlbMiss) */ | ||
471 | #define XCHAL_EXCCAUSE_DTLB_MULTIHIT 25 /* DTlb Multihit Exception (DTlbMultihit) */ | ||
472 | #define XCHAL_EXCCAUSE_DTLB_PRIVILEGE 26 /* DTlb Privilege Exception (DTlbPrivilege) */ | ||
473 | #define XCHAL_EXCCAUSE_DTLB_SIZE_RESTRICTION 27 /* DTlb Size Restriction Exception (DTlbSizeRestriction) */ | ||
474 | #define XCHAL_EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28 /* Load Cache Attribute Exception (LoadCacheAttribute) */ | ||
475 | #define XCHAL_EXCCAUSE_STORE_CACHE_ATTRIBUTE 29 /* Store Cache Attribute Exception (StoreCacheAttribute) */ | ||
476 | #define XCHAL_EXCCAUSE_FLOATING_POINT 40 /* Floating Point Exception (FloatingPoint) */ | ||
477 | |||
478 | |||
479 | |||
480 | /*---------------------------------------------------------------------- | ||
481 | TIMERS | ||
482 | ----------------------------------------------------------------------*/ | ||
483 | |||
484 | #define XCHAL_HAVE_CCOUNT 1 /* 1 if have CCOUNT, 0 otherwise */ | ||
485 | /*#define XCHAL_HAVE_TIMERS XCHAL_HAVE_CCOUNT*/ | ||
486 | #define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */ | ||
487 | |||
488 | |||
489 | |||
490 | /*---------------------------------------------------------------------- | ||
491 | DEBUG | ||
492 | ----------------------------------------------------------------------*/ | ||
493 | |||
494 | #define XCHAL_HAVE_DEBUG 1 /* 1 if debug option configured, 0 otherwise */ | ||
495 | #define XCHAL_HAVE_OCD 1 /* 1 if OnChipDebug option configured, 0 otherwise */ | ||
496 | #define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */ | ||
497 | #define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */ | ||
498 | #define XCHAL_DEBUGLEVEL 4 /* debug interrupt level */ | ||
499 | /*DebugExternalInterrupt 0 0|1*/ | ||
500 | /*DebugUseDIRArray 0 0|1*/ | ||
501 | |||
502 | |||
503 | |||
504 | |||
505 | /*---------------------------------------------------------------------- | ||
506 | COPROCESSORS and EXTRA STATE | ||
507 | ----------------------------------------------------------------------*/ | ||
508 | |||
509 | #define XCHAL_HAVE_CP 0 /* 1 if coprocessor option configured (CPENABLE present) */ | ||
510 | #define XCHAL_CP_MAXCFG 0 /* max allowed cp id plus one (per cfg) */ | ||
511 | |||
512 | #include <xtensa/config/tie.h> | ||
513 | |||
514 | |||
515 | |||
516 | |||
517 | /*---------------------------------------------------------------------- | ||
518 | INTERNAL I/D RAM/ROMs and XLMI | ||
519 | ----------------------------------------------------------------------*/ | ||
520 | |||
521 | #define XCHAL_NUM_INSTROM 0 /* number of core instruction ROMs configured */ | ||
522 | #define XCHAL_NUM_INSTRAM 0 /* number of core instruction RAMs configured */ | ||
523 | #define XCHAL_NUM_DATAROM 0 /* number of core data ROMs configured */ | ||
524 | #define XCHAL_NUM_DATARAM 0 /* number of core data RAMs configured */ | ||
525 | #define XCHAL_NUM_XLMI 0 /* number of core XLMI ports configured */ | ||
526 | #define XCHAL_NUM_IROM XCHAL_NUM_INSTROM /* (DEPRECATED) */ | ||
527 | #define XCHAL_NUM_IRAM XCHAL_NUM_INSTRAM /* (DEPRECATED) */ | ||
528 | #define XCHAL_NUM_DROM XCHAL_NUM_DATAROM /* (DEPRECATED) */ | ||
529 | #define XCHAL_NUM_DRAM XCHAL_NUM_DATARAM /* (DEPRECATED) */ | ||
530 | |||
531 | |||
532 | |||
533 | /*---------------------------------------------------------------------- | ||
534 | CACHE | ||
535 | ----------------------------------------------------------------------*/ | ||
536 | |||
537 | /* Size of the cache lines in log2(bytes): */ | ||
538 | #define XCHAL_ICACHE_LINEWIDTH 4 | ||
539 | #define XCHAL_DCACHE_LINEWIDTH 4 | ||
540 | /* Size of the cache lines in bytes: */ | ||
541 | #define XCHAL_ICACHE_LINESIZE 16 | ||
542 | #define XCHAL_DCACHE_LINESIZE 16 | ||
543 | /* Max for both I-cache and D-cache (used for general alignment): */ | ||
544 | #define XCHAL_CACHE_LINEWIDTH_MAX 4 | ||
545 | #define XCHAL_CACHE_LINESIZE_MAX 16 | ||
546 | |||
547 | /* Number of cache sets in log2(lines per way): */ | ||
548 | #define XCHAL_ICACHE_SETWIDTH 8 | ||
549 | #define XCHAL_DCACHE_SETWIDTH 8 | ||
550 | /* Max for both I-cache and D-cache (used for general cache-coherency page alignment): */ | ||
551 | #define XCHAL_CACHE_SETWIDTH_MAX 8 | ||
552 | #define XCHAL_CACHE_SETSIZE_MAX 256 | ||
553 | |||
554 | /* Cache set associativity (number of ways): */ | ||
555 | #define XCHAL_ICACHE_WAYS 2 | ||
556 | #define XCHAL_DCACHE_WAYS 2 | ||
557 | |||
558 | /* Size of the caches in bytes (ways * 2^(linewidth + setwidth)): */ | ||
559 | #define XCHAL_ICACHE_SIZE 8192 | ||
560 | #define XCHAL_DCACHE_SIZE 8192 | ||
561 | |||
562 | /* Cache features: */ | ||
563 | #define XCHAL_DCACHE_IS_WRITEBACK 0 | ||
564 | /* Whether cache locking feature is available: */ | ||
565 | #define XCHAL_ICACHE_LINE_LOCKABLE 0 | ||
566 | #define XCHAL_DCACHE_LINE_LOCKABLE 0 | ||
567 | |||
568 | /* Number of (encoded) cache attribute bits: */ | ||
569 | #define XCHAL_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */ | ||
570 | /* (The number of access mode bits (decoded cache attribute bits) is defined by the architecture; see xtensa/hal.h?) */ | ||
571 | |||
572 | |||
573 | /* Cache Attribute encodings -- lists of access modes for each cache attribute: */ | ||
574 | #define XCHAL_FCA_LIST XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
575 | XTHAL_FAM_BYPASS XCHAL_SEP \ | ||
576 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
577 | XTHAL_FAM_BYPASS XCHAL_SEP \ | ||
578 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
579 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
580 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
581 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
582 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
583 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
584 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
585 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
586 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
587 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
588 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
589 | XTHAL_FAM_EXCEPTION | ||
590 | #define XCHAL_LCA_LIST XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
591 | XTHAL_LAM_BYPASSG XCHAL_SEP \ | ||
592 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
593 | XTHAL_LAM_BYPASSG XCHAL_SEP \ | ||
594 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
595 | XTHAL_LAM_CACHED XCHAL_SEP \ | ||
596 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
597 | XTHAL_LAM_CACHED XCHAL_SEP \ | ||
598 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
599 | XTHAL_LAM_NACACHED XCHAL_SEP \ | ||
600 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
601 | XTHAL_LAM_NACACHED XCHAL_SEP \ | ||
602 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
603 | XTHAL_LAM_ISOLATE XCHAL_SEP \ | ||
604 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
605 | XTHAL_LAM_CACHED | ||
606 | #define XCHAL_SCA_LIST XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
607 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
608 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
609 | XTHAL_SAM_BYPASS XCHAL_SEP \ | ||
610 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
611 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
612 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
613 | XTHAL_SAM_WRITETHRU XCHAL_SEP \ | ||
614 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
615 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
616 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
617 | XTHAL_SAM_WRITETHRU XCHAL_SEP \ | ||
618 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
619 | XTHAL_SAM_ISOLATE XCHAL_SEP \ | ||
620 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
621 | XTHAL_SAM_WRITETHRU | ||
622 | |||
623 | /* Test: | ||
624 | read/only: 0 + 1 + 2 + 4 + 5 + 6 + 8 + 9 + 10 + 12 + 14 | ||
625 | read/only: 0 + 1 + 2 + 4 + 5 + 6 + 8 + 9 + 10 + 12 + 14 | ||
626 | all: 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 | ||
627 | fault: 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 | ||
628 | r/w/x cached: | ||
629 | r/w/x dcached: | ||
630 | I-bypass: 1 + 3 | ||
631 | |||
632 | load guard bit set: 1 + 3 | ||
633 | load guard bit clr: 0 + 2 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 | ||
634 | hit-cache r/w/x: 7 + 11 | ||
635 | |||
636 | fams: 5 | ||
637 | fams: 0 / 6 / 18 / 1 / 2 | ||
638 | fams: Bypass / Isolate / Cached / Exception / NACached | ||
639 | |||
640 | MMU okay: yes | ||
641 | */ | ||
642 | |||
643 | |||
644 | /*---------------------------------------------------------------------- | ||
645 | MMU | ||
646 | ----------------------------------------------------------------------*/ | ||
647 | |||
648 | /* | ||
649 | * General notes on MMU parameters. | ||
650 | * | ||
651 | * Terminology: | ||
652 | * ASID = address-space ID (acts as an "extension" of virtual addresses) | ||
653 | * VPN = virtual page number | ||
654 | * PPN = physical page number | ||
655 | * CA = encoded cache attribute (access modes) | ||
656 | * TLB = translation look-aside buffer (term is stretched somewhat here) | ||
657 | * I = instruction (fetch accesses) | ||
658 | * D = data (load and store accesses) | ||
659 | * way = each TLB (ITLB and DTLB) consists of a number of "ways" | ||
660 | * that simultaneously match the virtual address of an access; | ||
661 | * a TLB successfully translates a virtual address if exactly | ||
662 | * one way matches the vaddr; if none match, it is a miss; | ||
663 | * if multiple match, one gets a "multihit" exception; | ||
664 | * each way can be independently configured in terms of number of | ||
665 | * entries, page sizes, which fields are writable or constant, etc. | ||
666 | * set = group of contiguous ways with exactly identical parameters | ||
667 | * ARF = auto-refill; hardware services a 1st-level miss by loading a PTE | ||
668 | * from the page table and storing it in one of the auto-refill ways; | ||
669 | * if this PTE load also misses, a miss exception is posted for s/w. | ||
670 | * min-wired = a "min-wired" way can be used to map a single (minimum-sized) | ||
671 | * page arbitrarily under program control; it has a single entry, | ||
672 | * is non-auto-refill (some other way(s) must be auto-refill), | ||
673 | * all its fields (VPN, PPN, ASID, CA) are all writable, and it | ||
674 | * supports the XCHAL_MMU_MIN_PTE_PAGE_SIZE page size (a current | ||
675 | * restriction is that this be the only page size it supports). | ||
676 | * | ||
677 | * TLB way entries are virtually indexed. | ||
678 | * TLB ways that support multiple page sizes: | ||
679 | * - must have all writable VPN and PPN fields; | ||
680 | * - can only use one page size at any given time (eg. setup at startup), | ||
681 | * selected by the respective ITLBCFG or DTLBCFG special register, | ||
682 | * whose bits n*4+3 .. n*4 index the list of page sizes for way n | ||
683 | * (XCHAL_xTLB_SETm_PAGESZ_LOG2_LIST for set m corresponding to way n); | ||
684 | * this list may be sparse for auto-refill ways because auto-refill | ||
685 | * ways have independent lists of supported page sizes sharing a | ||
686 | * common encoding with PTE entries; the encoding is the index into | ||
687 | * this list; unsupported sizes for a given way are zero in the list; | ||
688 | * selecting unsupported sizes results in undefined hardware behaviour; | ||
689 | * - is only possible for ways 0 thru 7 (due to ITLBCFG/DTLBCFG definition). | ||
690 | */ | ||
691 | |||
692 | #define XCHAL_HAVE_CACHEATTR 0 /* 1 if CACHEATTR register present, 0 if TLBs present instead */ | ||
693 | #define XCHAL_HAVE_TLBS 1 /* 1 if TLBs present, 0 if CACHEATTR present instead */ | ||
694 | #define XCHAL_HAVE_MMU XCHAL_HAVE_TLBS /* (DEPRECATED; use XCHAL_HAVE_TLBS instead; will be removed in future release) */ | ||
695 | #define XCHAL_HAVE_SPANNING_WAY 0 /* 1 if single way maps entire virtual address space in I+D */ | ||
696 | #define XCHAL_HAVE_IDENTITY_MAP 0 /* 1 if virtual addr == physical addr always, 0 otherwise */ | ||
697 | #define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* 1 if have MMU that mimics a CACHEATTR config (CaMMU) */ | ||
698 | #define XCHAL_HAVE_XLT_CACHEATTR 0 /* 1 if have MMU that mimics a CACHEATTR config, but with translation (CaXltMMU) */ | ||
699 | |||
700 | #define XCHAL_MMU_ASID_BITS 8 /* number of bits in ASIDs (address space IDs) */ | ||
701 | #define XCHAL_MMU_ASID_INVALID 0 /* ASID value indicating invalid address space */ | ||
702 | #define XCHAL_MMU_ASID_KERNEL 1 /* ASID value indicating kernel (ring 0) address space */ | ||
703 | #define XCHAL_MMU_RINGS 4 /* number of rings supported (1..4) */ | ||
704 | #define XCHAL_MMU_RING_BITS 2 /* number of bits needed to hold ring number */ | ||
705 | #define XCHAL_MMU_SR_BITS 0 /* number of size-restriction bits supported */ | ||
706 | #define XCHAL_MMU_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */ | ||
707 | #define XCHAL_MMU_MAX_PTE_PAGE_SIZE 12 /* max page size in a PTE structure (log2) */ | ||
708 | #define XCHAL_MMU_MIN_PTE_PAGE_SIZE 12 /* min page size in a PTE structure (log2) */ | ||
709 | |||
710 | |||
711 | /*** Instruction TLB: ***/ | ||
712 | |||
713 | #define XCHAL_ITLB_WAY_BITS 3 /* number of bits holding the ways */ | ||
714 | #define XCHAL_ITLB_WAYS 7 /* number of ways (n-way set-associative TLB) */ | ||
715 | #define XCHAL_ITLB_ARF_WAYS 4 /* number of auto-refill ways */ | ||
716 | #define XCHAL_ITLB_SETS 4 /* number of sets (groups of ways with identical settings) */ | ||
717 | |||
718 | /* Way set to which each way belongs: */ | ||
719 | #define XCHAL_ITLB_WAY0_SET 0 | ||
720 | #define XCHAL_ITLB_WAY1_SET 0 | ||
721 | #define XCHAL_ITLB_WAY2_SET 0 | ||
722 | #define XCHAL_ITLB_WAY3_SET 0 | ||
723 | #define XCHAL_ITLB_WAY4_SET 1 | ||
724 | #define XCHAL_ITLB_WAY5_SET 2 | ||
725 | #define XCHAL_ITLB_WAY6_SET 3 | ||
726 | |||
727 | /* Ways sets that are used by hardware auto-refill (ARF): */ | ||
728 | #define XCHAL_ITLB_ARF_SETS 1 /* number of auto-refill sets */ | ||
729 | #define XCHAL_ITLB_ARF_SET0 0 /* index of n'th auto-refill set */ | ||
730 | |||
731 | /* Way sets that are "min-wired" (see terminology comment above): */ | ||
732 | #define XCHAL_ITLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ | ||
733 | |||
734 | |||
735 | /* ITLB way set 0 (group of ways 0 thru 3): */ | ||
736 | #define XCHAL_ITLB_SET0_WAY 0 /* index of first way in this way set */ | ||
737 | #define XCHAL_ITLB_SET0_WAYS 4 /* number of (contiguous) ways in this way set */ | ||
738 | #define XCHAL_ITLB_SET0_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
739 | #define XCHAL_ITLB_SET0_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
740 | #define XCHAL_ITLB_SET0_ARF 1 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
741 | #define XCHAL_ITLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
742 | #define XCHAL_ITLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
743 | #define XCHAL_ITLB_SET0_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */ | ||
744 | #define XCHAL_ITLB_SET0_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */ | ||
745 | #define XCHAL_ITLB_SET0_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
746 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
747 | #define XCHAL_ITLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
748 | #define XCHAL_ITLB_SET0_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
749 | #define XCHAL_ITLB_SET0_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
750 | #define XCHAL_ITLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
751 | #define XCHAL_ITLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
752 | #define XCHAL_ITLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
753 | #define XCHAL_ITLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
754 | #define XCHAL_ITLB_SET0_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
755 | |||
756 | /* ITLB way set 1 (group of ways 4 thru 4): */ | ||
757 | #define XCHAL_ITLB_SET1_WAY 4 /* index of first way in this way set */ | ||
758 | #define XCHAL_ITLB_SET1_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
759 | #define XCHAL_ITLB_SET1_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
760 | #define XCHAL_ITLB_SET1_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
761 | #define XCHAL_ITLB_SET1_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
762 | #define XCHAL_ITLB_SET1_PAGESIZES 4 /* number of supported page sizes in this way */ | ||
763 | #define XCHAL_ITLB_SET1_PAGESZ_BITS 2 /* number of bits to encode the page size */ | ||
764 | #define XCHAL_ITLB_SET1_PAGESZ_LOG2_MIN 20 /* log2(minimum supported page size) */ | ||
765 | #define XCHAL_ITLB_SET1_PAGESZ_LOG2_MAX 26 /* log2(maximum supported page size) */ | ||
766 | #define XCHAL_ITLB_SET1_PAGESZ_LOG2_LIST 20 XCHAL_SEP 22 XCHAL_SEP 24 XCHAL_SEP 26 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
767 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
768 | #define XCHAL_ITLB_SET1_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
769 | #define XCHAL_ITLB_SET1_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
770 | #define XCHAL_ITLB_SET1_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
771 | #define XCHAL_ITLB_SET1_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
772 | #define XCHAL_ITLB_SET1_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
773 | #define XCHAL_ITLB_SET1_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
774 | #define XCHAL_ITLB_SET1_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
775 | #define XCHAL_ITLB_SET1_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
776 | |||
777 | /* ITLB way set 2 (group of ways 5 thru 5): */ | ||
778 | #define XCHAL_ITLB_SET2_WAY 5 /* index of first way in this way set */ | ||
779 | #define XCHAL_ITLB_SET2_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
780 | #define XCHAL_ITLB_SET2_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
781 | #define XCHAL_ITLB_SET2_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
782 | #define XCHAL_ITLB_SET2_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
783 | #define XCHAL_ITLB_SET2_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
784 | #define XCHAL_ITLB_SET2_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
785 | #define XCHAL_ITLB_SET2_PAGESZ_LOG2_MIN 27 /* log2(minimum supported page size) */ | ||
786 | #define XCHAL_ITLB_SET2_PAGESZ_LOG2_MAX 27 /* log2(maximum supported page size) */ | ||
787 | #define XCHAL_ITLB_SET2_PAGESZ_LOG2_LIST 27 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
788 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
789 | #define XCHAL_ITLB_SET2_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
790 | #define XCHAL_ITLB_SET2_VPN_CONSTMASK 0xF0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
791 | #define XCHAL_ITLB_SET2_PPN_CONSTMASK 0xF8000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
792 | #define XCHAL_ITLB_SET2_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
793 | #define XCHAL_ITLB_SET2_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
794 | #define XCHAL_ITLB_SET2_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
795 | #define XCHAL_ITLB_SET2_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
796 | #define XCHAL_ITLB_SET2_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
797 | /* Constant ASID values for each entry of ITLB way set 2 (because ASID_CONSTMASK is non-zero): */ | ||
798 | #define XCHAL_ITLB_SET2_E0_ASID_CONST 0x01 | ||
799 | #define XCHAL_ITLB_SET2_E1_ASID_CONST 0x01 | ||
800 | /* Constant VPN values for each entry of ITLB way set 2 (because VPN_CONSTMASK is non-zero): */ | ||
801 | #define XCHAL_ITLB_SET2_E0_VPN_CONST 0xD0000000 | ||
802 | #define XCHAL_ITLB_SET2_E1_VPN_CONST 0xD8000000 | ||
803 | /* Constant PPN values for each entry of ITLB way set 2 (because PPN_CONSTMASK is non-zero): */ | ||
804 | #define XCHAL_ITLB_SET2_E0_PPN_CONST 0x00000000 | ||
805 | #define XCHAL_ITLB_SET2_E1_PPN_CONST 0x00000000 | ||
806 | /* Constant CA values for each entry of ITLB way set 2 (because CA_CONSTMASK is non-zero): */ | ||
807 | #define XCHAL_ITLB_SET2_E0_CA_CONST 0x07 | ||
808 | #define XCHAL_ITLB_SET2_E1_CA_CONST 0x03 | ||
809 | |||
810 | /* ITLB way set 3 (group of ways 6 thru 6): */ | ||
811 | #define XCHAL_ITLB_SET3_WAY 6 /* index of first way in this way set */ | ||
812 | #define XCHAL_ITLB_SET3_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
813 | #define XCHAL_ITLB_SET3_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
814 | #define XCHAL_ITLB_SET3_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
815 | #define XCHAL_ITLB_SET3_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
816 | #define XCHAL_ITLB_SET3_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
817 | #define XCHAL_ITLB_SET3_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
818 | #define XCHAL_ITLB_SET3_PAGESZ_LOG2_MIN 28 /* log2(minimum supported page size) */ | ||
819 | #define XCHAL_ITLB_SET3_PAGESZ_LOG2_MAX 28 /* log2(maximum supported page size) */ | ||
820 | #define XCHAL_ITLB_SET3_PAGESZ_LOG2_LIST 28 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
821 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
822 | #define XCHAL_ITLB_SET3_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
823 | #define XCHAL_ITLB_SET3_VPN_CONSTMASK 0xE0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
824 | #define XCHAL_ITLB_SET3_PPN_CONSTMASK 0xF0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
825 | #define XCHAL_ITLB_SET3_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
826 | #define XCHAL_ITLB_SET3_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
827 | #define XCHAL_ITLB_SET3_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
828 | #define XCHAL_ITLB_SET3_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
829 | #define XCHAL_ITLB_SET3_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
830 | /* Constant ASID values for each entry of ITLB way set 3 (because ASID_CONSTMASK is non-zero): */ | ||
831 | #define XCHAL_ITLB_SET3_E0_ASID_CONST 0x01 | ||
832 | #define XCHAL_ITLB_SET3_E1_ASID_CONST 0x01 | ||
833 | /* Constant VPN values for each entry of ITLB way set 3 (because VPN_CONSTMASK is non-zero): */ | ||
834 | #define XCHAL_ITLB_SET3_E0_VPN_CONST 0xE0000000 | ||
835 | #define XCHAL_ITLB_SET3_E1_VPN_CONST 0xF0000000 | ||
836 | /* Constant PPN values for each entry of ITLB way set 3 (because PPN_CONSTMASK is non-zero): */ | ||
837 | #define XCHAL_ITLB_SET3_E0_PPN_CONST 0xF0000000 | ||
838 | #define XCHAL_ITLB_SET3_E1_PPN_CONST 0xF0000000 | ||
839 | /* Constant CA values for each entry of ITLB way set 3 (because CA_CONSTMASK is non-zero): */ | ||
840 | #define XCHAL_ITLB_SET3_E0_CA_CONST 0x07 | ||
841 | #define XCHAL_ITLB_SET3_E1_CA_CONST 0x03 | ||
842 | |||
843 | /* Indexing macros: */ | ||
844 | #define _XCHAL_ITLB_SET(n,_what) XCHAL_ITLB_SET ## n ## _what | ||
845 | #define XCHAL_ITLB_SET(n,what) _XCHAL_ITLB_SET(n, _ ## what ) | ||
846 | #define _XCHAL_ITLB_SET_E(n,i,_what) XCHAL_ITLB_SET ## n ## _E ## i ## _what | ||
847 | #define XCHAL_ITLB_SET_E(n,i,what) _XCHAL_ITLB_SET_E(n,i, _ ## what ) | ||
848 | /* | ||
849 | * Example use: XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,ENTRIES) | ||
850 | * to get the value of XCHAL_ITLB_SET<n>_ENTRIES where <n> is the first auto-refill set. | ||
851 | */ | ||
852 | |||
853 | |||
854 | /*** Data TLB: ***/ | ||
855 | |||
856 | #define XCHAL_DTLB_WAY_BITS 4 /* number of bits holding the ways */ | ||
857 | #define XCHAL_DTLB_WAYS 10 /* number of ways (n-way set-associative TLB) */ | ||
858 | #define XCHAL_DTLB_ARF_WAYS 4 /* number of auto-refill ways */ | ||
859 | #define XCHAL_DTLB_SETS 5 /* number of sets (groups of ways with identical settings) */ | ||
860 | |||
861 | /* Way set to which each way belongs: */ | ||
862 | #define XCHAL_DTLB_WAY0_SET 0 | ||
863 | #define XCHAL_DTLB_WAY1_SET 0 | ||
864 | #define XCHAL_DTLB_WAY2_SET 0 | ||
865 | #define XCHAL_DTLB_WAY3_SET 0 | ||
866 | #define XCHAL_DTLB_WAY4_SET 1 | ||
867 | #define XCHAL_DTLB_WAY5_SET 2 | ||
868 | #define XCHAL_DTLB_WAY6_SET 3 | ||
869 | #define XCHAL_DTLB_WAY7_SET 4 | ||
870 | #define XCHAL_DTLB_WAY8_SET 4 | ||
871 | #define XCHAL_DTLB_WAY9_SET 4 | ||
872 | |||
873 | /* Ways sets that are used by hardware auto-refill (ARF): */ | ||
874 | #define XCHAL_DTLB_ARF_SETS 1 /* number of auto-refill sets */ | ||
875 | #define XCHAL_DTLB_ARF_SET0 0 /* index of n'th auto-refill set */ | ||
876 | |||
877 | /* Way sets that are "min-wired" (see terminology comment above): */ | ||
878 | #define XCHAL_DTLB_MINWIRED_SETS 1 /* number of "min-wired" sets */ | ||
879 | #define XCHAL_DTLB_MINWIRED_SET0 4 /* index of n'th "min-wired" set */ | ||
880 | |||
881 | |||
882 | /* DTLB way set 0 (group of ways 0 thru 3): */ | ||
883 | #define XCHAL_DTLB_SET0_WAY 0 /* index of first way in this way set */ | ||
884 | #define XCHAL_DTLB_SET0_WAYS 4 /* number of (contiguous) ways in this way set */ | ||
885 | #define XCHAL_DTLB_SET0_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
886 | #define XCHAL_DTLB_SET0_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
887 | #define XCHAL_DTLB_SET0_ARF 1 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
888 | #define XCHAL_DTLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
889 | #define XCHAL_DTLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
890 | #define XCHAL_DTLB_SET0_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */ | ||
891 | #define XCHAL_DTLB_SET0_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */ | ||
892 | #define XCHAL_DTLB_SET0_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
893 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
894 | #define XCHAL_DTLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
895 | #define XCHAL_DTLB_SET0_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
896 | #define XCHAL_DTLB_SET0_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
897 | #define XCHAL_DTLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
898 | #define XCHAL_DTLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
899 | #define XCHAL_DTLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
900 | #define XCHAL_DTLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
901 | #define XCHAL_DTLB_SET0_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
902 | |||
903 | /* DTLB way set 1 (group of ways 4 thru 4): */ | ||
904 | #define XCHAL_DTLB_SET1_WAY 4 /* index of first way in this way set */ | ||
905 | #define XCHAL_DTLB_SET1_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
906 | #define XCHAL_DTLB_SET1_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
907 | #define XCHAL_DTLB_SET1_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
908 | #define XCHAL_DTLB_SET1_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
909 | #define XCHAL_DTLB_SET1_PAGESIZES 4 /* number of supported page sizes in this way */ | ||
910 | #define XCHAL_DTLB_SET1_PAGESZ_BITS 2 /* number of bits to encode the page size */ | ||
911 | #define XCHAL_DTLB_SET1_PAGESZ_LOG2_MIN 20 /* log2(minimum supported page size) */ | ||
912 | #define XCHAL_DTLB_SET1_PAGESZ_LOG2_MAX 26 /* log2(maximum supported page size) */ | ||
913 | #define XCHAL_DTLB_SET1_PAGESZ_LOG2_LIST 20 XCHAL_SEP 22 XCHAL_SEP 24 XCHAL_SEP 26 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
914 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
915 | #define XCHAL_DTLB_SET1_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
916 | #define XCHAL_DTLB_SET1_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
917 | #define XCHAL_DTLB_SET1_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
918 | #define XCHAL_DTLB_SET1_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
919 | #define XCHAL_DTLB_SET1_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
920 | #define XCHAL_DTLB_SET1_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
921 | #define XCHAL_DTLB_SET1_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
922 | #define XCHAL_DTLB_SET1_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
923 | |||
924 | /* DTLB way set 2 (group of ways 5 thru 5): */ | ||
925 | #define XCHAL_DTLB_SET2_WAY 5 /* index of first way in this way set */ | ||
926 | #define XCHAL_DTLB_SET2_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
927 | #define XCHAL_DTLB_SET2_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
928 | #define XCHAL_DTLB_SET2_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
929 | #define XCHAL_DTLB_SET2_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
930 | #define XCHAL_DTLB_SET2_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
931 | #define XCHAL_DTLB_SET2_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
932 | #define XCHAL_DTLB_SET2_PAGESZ_LOG2_MIN 27 /* log2(minimum supported page size) */ | ||
933 | #define XCHAL_DTLB_SET2_PAGESZ_LOG2_MAX 27 /* log2(maximum supported page size) */ | ||
934 | #define XCHAL_DTLB_SET2_PAGESZ_LOG2_LIST 27 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
935 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
936 | #define XCHAL_DTLB_SET2_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
937 | #define XCHAL_DTLB_SET2_VPN_CONSTMASK 0xF0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
938 | #define XCHAL_DTLB_SET2_PPN_CONSTMASK 0xF8000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
939 | #define XCHAL_DTLB_SET2_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
940 | #define XCHAL_DTLB_SET2_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
941 | #define XCHAL_DTLB_SET2_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
942 | #define XCHAL_DTLB_SET2_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
943 | #define XCHAL_DTLB_SET2_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
944 | /* Constant ASID values for each entry of DTLB way set 2 (because ASID_CONSTMASK is non-zero): */ | ||
945 | #define XCHAL_DTLB_SET2_E0_ASID_CONST 0x01 | ||
946 | #define XCHAL_DTLB_SET2_E1_ASID_CONST 0x01 | ||
947 | /* Constant VPN values for each entry of DTLB way set 2 (because VPN_CONSTMASK is non-zero): */ | ||
948 | #define XCHAL_DTLB_SET2_E0_VPN_CONST 0xD0000000 | ||
949 | #define XCHAL_DTLB_SET2_E1_VPN_CONST 0xD8000000 | ||
950 | /* Constant PPN values for each entry of DTLB way set 2 (because PPN_CONSTMASK is non-zero): */ | ||
951 | #define XCHAL_DTLB_SET2_E0_PPN_CONST 0x00000000 | ||
952 | #define XCHAL_DTLB_SET2_E1_PPN_CONST 0x00000000 | ||
953 | /* Constant CA values for each entry of DTLB way set 2 (because CA_CONSTMASK is non-zero): */ | ||
954 | #define XCHAL_DTLB_SET2_E0_CA_CONST 0x07 | ||
955 | #define XCHAL_DTLB_SET2_E1_CA_CONST 0x03 | ||
956 | |||
957 | /* DTLB way set 3 (group of ways 6 thru 6): */ | ||
958 | #define XCHAL_DTLB_SET3_WAY 6 /* index of first way in this way set */ | ||
959 | #define XCHAL_DTLB_SET3_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
960 | #define XCHAL_DTLB_SET3_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
961 | #define XCHAL_DTLB_SET3_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
962 | #define XCHAL_DTLB_SET3_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
963 | #define XCHAL_DTLB_SET3_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
964 | #define XCHAL_DTLB_SET3_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
965 | #define XCHAL_DTLB_SET3_PAGESZ_LOG2_MIN 28 /* log2(minimum supported page size) */ | ||
966 | #define XCHAL_DTLB_SET3_PAGESZ_LOG2_MAX 28 /* log2(maximum supported page size) */ | ||
967 | #define XCHAL_DTLB_SET3_PAGESZ_LOG2_LIST 28 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
968 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
969 | #define XCHAL_DTLB_SET3_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
970 | #define XCHAL_DTLB_SET3_VPN_CONSTMASK 0xE0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
971 | #define XCHAL_DTLB_SET3_PPN_CONSTMASK 0xF0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
972 | #define XCHAL_DTLB_SET3_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
973 | #define XCHAL_DTLB_SET3_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
974 | #define XCHAL_DTLB_SET3_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
975 | #define XCHAL_DTLB_SET3_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
976 | #define XCHAL_DTLB_SET3_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
977 | /* Constant ASID values for each entry of DTLB way set 3 (because ASID_CONSTMASK is non-zero): */ | ||
978 | #define XCHAL_DTLB_SET3_E0_ASID_CONST 0x01 | ||
979 | #define XCHAL_DTLB_SET3_E1_ASID_CONST 0x01 | ||
980 | /* Constant VPN values for each entry of DTLB way set 3 (because VPN_CONSTMASK is non-zero): */ | ||
981 | #define XCHAL_DTLB_SET3_E0_VPN_CONST 0xE0000000 | ||
982 | #define XCHAL_DTLB_SET3_E1_VPN_CONST 0xF0000000 | ||
983 | /* Constant PPN values for each entry of DTLB way set 3 (because PPN_CONSTMASK is non-zero): */ | ||
984 | #define XCHAL_DTLB_SET3_E0_PPN_CONST 0xF0000000 | ||
985 | #define XCHAL_DTLB_SET3_E1_PPN_CONST 0xF0000000 | ||
986 | /* Constant CA values for each entry of DTLB way set 3 (because CA_CONSTMASK is non-zero): */ | ||
987 | #define XCHAL_DTLB_SET3_E0_CA_CONST 0x07 | ||
988 | #define XCHAL_DTLB_SET3_E1_CA_CONST 0x03 | ||
989 | |||
990 | /* DTLB way set 4 (group of ways 7 thru 9): */ | ||
991 | #define XCHAL_DTLB_SET4_WAY 7 /* index of first way in this way set */ | ||
992 | #define XCHAL_DTLB_SET4_WAYS 3 /* number of (contiguous) ways in this way set */ | ||
993 | #define XCHAL_DTLB_SET4_ENTRIES_LOG2 0 /* log2(number of entries in this way) */ | ||
994 | #define XCHAL_DTLB_SET4_ENTRIES 1 /* number of entries in this way (always a power of 2) */ | ||
995 | #define XCHAL_DTLB_SET4_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
996 | #define XCHAL_DTLB_SET4_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
997 | #define XCHAL_DTLB_SET4_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
998 | #define XCHAL_DTLB_SET4_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */ | ||
999 | #define XCHAL_DTLB_SET4_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */ | ||
1000 | #define XCHAL_DTLB_SET4_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
1001 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
1002 | #define XCHAL_DTLB_SET4_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
1003 | #define XCHAL_DTLB_SET4_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
1004 | #define XCHAL_DTLB_SET4_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
1005 | #define XCHAL_DTLB_SET4_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
1006 | #define XCHAL_DTLB_SET4_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
1007 | #define XCHAL_DTLB_SET4_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
1008 | #define XCHAL_DTLB_SET4_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
1009 | #define XCHAL_DTLB_SET4_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
1010 | |||
1011 | /* Indexing macros: */ | ||
1012 | #define _XCHAL_DTLB_SET(n,_what) XCHAL_DTLB_SET ## n ## _what | ||
1013 | #define XCHAL_DTLB_SET(n,what) _XCHAL_DTLB_SET(n, _ ## what ) | ||
1014 | #define _XCHAL_DTLB_SET_E(n,i,_what) XCHAL_DTLB_SET ## n ## _E ## i ## _what | ||
1015 | #define XCHAL_DTLB_SET_E(n,i,what) _XCHAL_DTLB_SET_E(n,i, _ ## what ) | ||
1016 | /* | ||
1017 | * Example use: XCHAL_DTLB_SET(XCHAL_DTLB_ARF_SET0,ENTRIES) | ||
1018 | * to get the value of XCHAL_DTLB_SET<n>_ENTRIES where <n> is the first auto-refill set. | ||
1019 | */ | ||
1020 | |||
1021 | |||
1022 | /* | ||
1023 | * Determine whether we have a full MMU (with Page Table and Protection) | ||
1024 | * usable for an MMU-based OS: | ||
1025 | */ | ||
1026 | #if XCHAL_HAVE_TLBS && !XCHAL_HAVE_SPANNING_WAY && XCHAL_ITLB_ARF_WAYS > 0 && XCHAL_DTLB_ARF_WAYS > 0 && XCHAL_MMU_RINGS >= 2 | ||
1027 | # define XCHAL_HAVE_PTP_MMU 1 /* have full MMU (with page table [autorefill] and protection) */ | ||
1028 | #else | ||
1029 | # define XCHAL_HAVE_PTP_MMU 0 /* don't have full MMU */ | ||
1030 | #endif | ||
1031 | |||
1032 | /* | ||
1033 | * For full MMUs, report kernel RAM segment and kernel I/O segment static page mappings: | ||
1034 | */ | ||
1035 | #if XCHAL_HAVE_PTP_MMU | ||
1036 | #define XCHAL_KSEG_CACHED_VADDR 0xD0000000 /* virt.addr of kernel RAM cached static map */ | ||
1037 | #define XCHAL_KSEG_CACHED_PADDR 0x00000000 /* phys.addr of kseg_cached */ | ||
1038 | #define XCHAL_KSEG_CACHED_SIZE 0x08000000 /* size in bytes of kseg_cached (assumed power of 2!!!) */ | ||
1039 | #define XCHAL_KSEG_BYPASS_VADDR 0xD8000000 /* virt.addr of kernel RAM bypass (uncached) static map */ | ||
1040 | #define XCHAL_KSEG_BYPASS_PADDR 0x00000000 /* phys.addr of kseg_bypass */ | ||
1041 | #define XCHAL_KSEG_BYPASS_SIZE 0x08000000 /* size in bytes of kseg_bypass (assumed power of 2!!!) */ | ||
1042 | |||
1043 | #define XCHAL_KIO_CACHED_VADDR 0xE0000000 /* virt.addr of kernel I/O cached static map */ | ||
1044 | #define XCHAL_KIO_CACHED_PADDR 0xF0000000 /* phys.addr of kio_cached */ | ||
1045 | #define XCHAL_KIO_CACHED_SIZE 0x10000000 /* size in bytes of kio_cached (assumed power of 2!!!) */ | ||
1046 | #define XCHAL_KIO_BYPASS_VADDR 0xF0000000 /* virt.addr of kernel I/O bypass (uncached) static map */ | ||
1047 | #define XCHAL_KIO_BYPASS_PADDR 0xF0000000 /* phys.addr of kio_bypass */ | ||
1048 | #define XCHAL_KIO_BYPASS_SIZE 0x10000000 /* size in bytes of kio_bypass (assumed power of 2!!!) */ | ||
1049 | |||
1050 | #define XCHAL_SEG_MAPPABLE_VADDR 0x00000000 /* start of largest non-static-mapped virtual addr area */ | ||
1051 | #define XCHAL_SEG_MAPPABLE_SIZE 0xD0000000 /* size in bytes of " */ | ||
1052 | /* define XCHAL_SEG_MAPPABLE2_xxx if more areas present, sorted in order of descending size. */ | ||
1053 | #endif | ||
1054 | |||
1055 | |||
1056 | /*---------------------------------------------------------------------- | ||
1057 | MISC | ||
1058 | ----------------------------------------------------------------------*/ | ||
1059 | |||
1060 | #define XCHAL_NUM_WRITEBUFFER_ENTRIES 4 /* number of write buffer entries */ | ||
1061 | |||
1062 | #define XCHAL_CORE_ID "linux_be" /* configuration's alphanumeric core identifier | ||
1063 | (CoreID) set in the Xtensa Processor Generator */ | ||
1064 | |||
1065 | #define XCHAL_BUILD_UNIQUE_ID 0x00003256 /* software build-unique ID (22-bit) */ | ||
1066 | |||
1067 | /* These definitions describe the hardware targeted by this software: */ | ||
1068 | #define XCHAL_HW_CONFIGID0 0xC103D1FF /* config ID reg 0 value (upper 32 of 64 bits) */ | ||
1069 | #define XCHAL_HW_CONFIGID1 0x00803256 /* config ID reg 1 value (lower 32 of 64 bits) */ | ||
1070 | #define XCHAL_CONFIGID0 XCHAL_HW_CONFIGID0 /* for backward compatibility only -- don't use! */ | ||
1071 | #define XCHAL_CONFIGID1 XCHAL_HW_CONFIGID1 /* for backward compatibility only -- don't use! */ | ||
1072 | #define XCHAL_HW_RELEASE_MAJOR 1050 /* major release of targeted hardware */ | ||
1073 | #define XCHAL_HW_RELEASE_MINOR 1 /* minor release of targeted hardware */ | ||
1074 | #define XCHAL_HW_RELEASE_NAME "T1050.1" /* full release name of targeted hardware */ | ||
1075 | #define XTHAL_HW_REL_T1050 1 | ||
1076 | #define XTHAL_HW_REL_T1050_1 1 | ||
1077 | #define XCHAL_HW_CONFIGID_RELIABLE 1 | ||
1078 | |||
1079 | |||
1080 | /* | ||
1081 | * Miscellaneous special register fields: | ||
1082 | */ | ||
1083 | |||
1084 | |||
1085 | /* DBREAKC (special register number 160): */ | ||
1086 | #define XCHAL_DBREAKC_VALIDMASK 0xC000003F /* bits of DBREAKC that are defined */ | ||
1087 | /* MASK field: */ | ||
1088 | #define XCHAL_DBREAKC_MASK_BITS 6 /* number of bits in MASK field */ | ||
1089 | #define XCHAL_DBREAKC_MASK_NUM 64 /* max number of possible causes (2^bits) */ | ||
1090 | #define XCHAL_DBREAKC_MASK_SHIFT 0 /* position of MASK bits in DBREAKC, starting from lsbit */ | ||
1091 | #define XCHAL_DBREAKC_MASK_MASK 0x0000003F /* mask of bits in MASK field of DBREAKC */ | ||
1092 | /* LOADBREAK field: */ | ||
1093 | #define XCHAL_DBREAKC_LOADBREAK_BITS 1 /* number of bits in LOADBREAK field */ | ||
1094 | #define XCHAL_DBREAKC_LOADBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1095 | #define XCHAL_DBREAKC_LOADBREAK_SHIFT 30 /* position of LOADBREAK bits in DBREAKC, starting from lsbit */ | ||
1096 | #define XCHAL_DBREAKC_LOADBREAK_MASK 0x40000000 /* mask of bits in LOADBREAK field of DBREAKC */ | ||
1097 | /* STOREBREAK field: */ | ||
1098 | #define XCHAL_DBREAKC_STOREBREAK_BITS 1 /* number of bits in STOREBREAK field */ | ||
1099 | #define XCHAL_DBREAKC_STOREBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1100 | #define XCHAL_DBREAKC_STOREBREAK_SHIFT 31 /* position of STOREBREAK bits in DBREAKC, starting from lsbit */ | ||
1101 | #define XCHAL_DBREAKC_STOREBREAK_MASK 0x80000000 /* mask of bits in STOREBREAK field of DBREAKC */ | ||
1102 | |||
1103 | /* PS (special register number 230): */ | ||
1104 | #define XCHAL_PS_VALIDMASK 0x00070FFF /* bits of PS that are defined */ | ||
1105 | /* INTLEVEL field: */ | ||
1106 | #define XCHAL_PS_INTLEVEL_BITS 4 /* number of bits in INTLEVEL field */ | ||
1107 | #define XCHAL_PS_INTLEVEL_NUM 16 /* max number of possible causes (2^bits) */ | ||
1108 | #define XCHAL_PS_INTLEVEL_SHIFT 0 /* position of INTLEVEL bits in PS, starting from lsbit */ | ||
1109 | #define XCHAL_PS_INTLEVEL_MASK 0x0000000F /* mask of bits in INTLEVEL field of PS */ | ||
1110 | /* EXCM field: */ | ||
1111 | #define XCHAL_PS_EXCM_BITS 1 /* number of bits in EXCM field */ | ||
1112 | #define XCHAL_PS_EXCM_NUM 2 /* max number of possible causes (2^bits) */ | ||
1113 | #define XCHAL_PS_EXCM_SHIFT 4 /* position of EXCM bits in PS, starting from lsbit */ | ||
1114 | #define XCHAL_PS_EXCM_MASK 0x00000010 /* mask of bits in EXCM field of PS */ | ||
1115 | /* PROGSTACK field: */ | ||
1116 | #define XCHAL_PS_PROGSTACK_BITS 1 /* number of bits in PROGSTACK field */ | ||
1117 | #define XCHAL_PS_PROGSTACK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1118 | #define XCHAL_PS_PROGSTACK_SHIFT 5 /* position of PROGSTACK bits in PS, starting from lsbit */ | ||
1119 | #define XCHAL_PS_PROGSTACK_MASK 0x00000020 /* mask of bits in PROGSTACK field of PS */ | ||
1120 | /* RING field: */ | ||
1121 | #define XCHAL_PS_RING_BITS 2 /* number of bits in RING field */ | ||
1122 | #define XCHAL_PS_RING_NUM 4 /* max number of possible causes (2^bits) */ | ||
1123 | #define XCHAL_PS_RING_SHIFT 6 /* position of RING bits in PS, starting from lsbit */ | ||
1124 | #define XCHAL_PS_RING_MASK 0x000000C0 /* mask of bits in RING field of PS */ | ||
1125 | /* OWB field: */ | ||
1126 | #define XCHAL_PS_OWB_BITS 4 /* number of bits in OWB field */ | ||
1127 | #define XCHAL_PS_OWB_NUM 16 /* max number of possible causes (2^bits) */ | ||
1128 | #define XCHAL_PS_OWB_SHIFT 8 /* position of OWB bits in PS, starting from lsbit */ | ||
1129 | #define XCHAL_PS_OWB_MASK 0x00000F00 /* mask of bits in OWB field of PS */ | ||
1130 | /* CALLINC field: */ | ||
1131 | #define XCHAL_PS_CALLINC_BITS 2 /* number of bits in CALLINC field */ | ||
1132 | #define XCHAL_PS_CALLINC_NUM 4 /* max number of possible causes (2^bits) */ | ||
1133 | #define XCHAL_PS_CALLINC_SHIFT 16 /* position of CALLINC bits in PS, starting from lsbit */ | ||
1134 | #define XCHAL_PS_CALLINC_MASK 0x00030000 /* mask of bits in CALLINC field of PS */ | ||
1135 | /* WOE field: */ | ||
1136 | #define XCHAL_PS_WOE_BITS 1 /* number of bits in WOE field */ | ||
1137 | #define XCHAL_PS_WOE_NUM 2 /* max number of possible causes (2^bits) */ | ||
1138 | #define XCHAL_PS_WOE_SHIFT 18 /* position of WOE bits in PS, starting from lsbit */ | ||
1139 | #define XCHAL_PS_WOE_MASK 0x00040000 /* mask of bits in WOE field of PS */ | ||
1140 | |||
1141 | /* EXCCAUSE (special register number 232): */ | ||
1142 | #define XCHAL_EXCCAUSE_VALIDMASK 0x0000003F /* bits of EXCCAUSE that are defined */ | ||
1143 | /* EXCCAUSE field: */ | ||
1144 | #define XCHAL_EXCCAUSE_BITS 6 /* number of bits in EXCCAUSE register */ | ||
1145 | #define XCHAL_EXCCAUSE_NUM 64 /* max number of possible causes (2^bits) */ | ||
1146 | #define XCHAL_EXCCAUSE_SHIFT 0 /* position of EXCCAUSE bits in register, starting from lsbit */ | ||
1147 | #define XCHAL_EXCCAUSE_MASK 0x0000003F /* mask of bits in EXCCAUSE register */ | ||
1148 | |||
1149 | /* DEBUGCAUSE (special register number 233): */ | ||
1150 | #define XCHAL_DEBUGCAUSE_VALIDMASK 0x0000003F /* bits of DEBUGCAUSE that are defined */ | ||
1151 | /* ICOUNT field: */ | ||
1152 | #define XCHAL_DEBUGCAUSE_ICOUNT_BITS 1 /* number of bits in ICOUNT field */ | ||
1153 | #define XCHAL_DEBUGCAUSE_ICOUNT_NUM 2 /* max number of possible causes (2^bits) */ | ||
1154 | #define XCHAL_DEBUGCAUSE_ICOUNT_SHIFT 0 /* position of ICOUNT bits in DEBUGCAUSE, starting from lsbit */ | ||
1155 | #define XCHAL_DEBUGCAUSE_ICOUNT_MASK 0x00000001 /* mask of bits in ICOUNT field of DEBUGCAUSE */ | ||
1156 | /* IBREAK field: */ | ||
1157 | #define XCHAL_DEBUGCAUSE_IBREAK_BITS 1 /* number of bits in IBREAK field */ | ||
1158 | #define XCHAL_DEBUGCAUSE_IBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1159 | #define XCHAL_DEBUGCAUSE_IBREAK_SHIFT 1 /* position of IBREAK bits in DEBUGCAUSE, starting from lsbit */ | ||
1160 | #define XCHAL_DEBUGCAUSE_IBREAK_MASK 0x00000002 /* mask of bits in IBREAK field of DEBUGCAUSE */ | ||
1161 | /* DBREAK field: */ | ||
1162 | #define XCHAL_DEBUGCAUSE_DBREAK_BITS 1 /* number of bits in DBREAK field */ | ||
1163 | #define XCHAL_DEBUGCAUSE_DBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1164 | #define XCHAL_DEBUGCAUSE_DBREAK_SHIFT 2 /* position of DBREAK bits in DEBUGCAUSE, starting from lsbit */ | ||
1165 | #define XCHAL_DEBUGCAUSE_DBREAK_MASK 0x00000004 /* mask of bits in DBREAK field of DEBUGCAUSE */ | ||
1166 | /* BREAK field: */ | ||
1167 | #define XCHAL_DEBUGCAUSE_BREAK_BITS 1 /* number of bits in BREAK field */ | ||
1168 | #define XCHAL_DEBUGCAUSE_BREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1169 | #define XCHAL_DEBUGCAUSE_BREAK_SHIFT 3 /* position of BREAK bits in DEBUGCAUSE, starting from lsbit */ | ||
1170 | #define XCHAL_DEBUGCAUSE_BREAK_MASK 0x00000008 /* mask of bits in BREAK field of DEBUGCAUSE */ | ||
1171 | /* BREAKN field: */ | ||
1172 | #define XCHAL_DEBUGCAUSE_BREAKN_BITS 1 /* number of bits in BREAKN field */ | ||
1173 | #define XCHAL_DEBUGCAUSE_BREAKN_NUM 2 /* max number of possible causes (2^bits) */ | ||
1174 | #define XCHAL_DEBUGCAUSE_BREAKN_SHIFT 4 /* position of BREAKN bits in DEBUGCAUSE, starting from lsbit */ | ||
1175 | #define XCHAL_DEBUGCAUSE_BREAKN_MASK 0x00000010 /* mask of bits in BREAKN field of DEBUGCAUSE */ | ||
1176 | /* DEBUGINT field: */ | ||
1177 | #define XCHAL_DEBUGCAUSE_DEBUGINT_BITS 1 /* number of bits in DEBUGINT field */ | ||
1178 | #define XCHAL_DEBUGCAUSE_DEBUGINT_NUM 2 /* max number of possible causes (2^bits) */ | ||
1179 | #define XCHAL_DEBUGCAUSE_DEBUGINT_SHIFT 5 /* position of DEBUGINT bits in DEBUGCAUSE, starting from lsbit */ | ||
1180 | #define XCHAL_DEBUGCAUSE_DEBUGINT_MASK 0x00000020 /* mask of bits in DEBUGINT field of DEBUGCAUSE */ | ||
1181 | |||
1182 | |||
1183 | |||
1184 | /*---------------------------------------------------------------------- | ||
1185 | ISA | ||
1186 | ----------------------------------------------------------------------*/ | ||
1187 | |||
1188 | #define XCHAL_HAVE_DENSITY 1 /* 1 if density option configured, 0 otherwise */ | ||
1189 | #define XCHAL_HAVE_LOOPS 1 /* 1 if zero-overhead loops option configured, 0 otherwise */ | ||
1190 | /* Misc instructions: */ | ||
1191 | #define XCHAL_HAVE_NSA 0 /* 1 if NSA/NSAU instructions option configured, 0 otherwise */ | ||
1192 | #define XCHAL_HAVE_MINMAX 0 /* 1 if MIN/MAX instructions option configured, 0 otherwise */ | ||
1193 | #define XCHAL_HAVE_SEXT 0 /* 1 if sign-extend instruction option configured, 0 otherwise */ | ||
1194 | #define XCHAL_HAVE_CLAMPS 0 /* 1 if CLAMPS instruction option configured, 0 otherwise */ | ||
1195 | #define XCHAL_HAVE_MAC16 0 /* 1 if MAC16 option configured, 0 otherwise */ | ||
1196 | #define XCHAL_HAVE_MUL16 0 /* 1 if 16-bit integer multiply option configured, 0 otherwise */ | ||
1197 | /*#define XCHAL_HAVE_POPC 0*/ /* 1 if CRC instruction option configured, 0 otherwise */ | ||
1198 | /*#define XCHAL_HAVE_CRC 0*/ /* 1 if POPC instruction option configured, 0 otherwise */ | ||
1199 | |||
1200 | #define XCHAL_HAVE_SPECULATION 0 /* 1 if speculation option configured, 0 otherwise */ | ||
1201 | /*#define XCHAL_HAVE_MP_SYNC 0*/ /* 1 if multiprocessor sync. option configured, 0 otherwise */ | ||
1202 | #define XCHAL_HAVE_PRID 0 /* 1 if processor ID register configured, 0 otherwise */ | ||
1203 | |||
1204 | #define XCHAL_NUM_MISC_REGS 2 /* number of miscellaneous registers (0..4) */ | ||
1205 | |||
1206 | /* These relate a bit more to TIE: */ | ||
1207 | #define XCHAL_HAVE_BOOLEANS 0 /* 1 if booleans option configured, 0 otherwise */ | ||
1208 | #define XCHAL_HAVE_MUL32 0 /* 1 if 32-bit integer multiply option configured, 0 otherwise */ | ||
1209 | #define XCHAL_HAVE_MUL32_HIGH 0 /* 1 if MUL32 option includes MULUH and MULSH, 0 otherwise */ | ||
1210 | #define XCHAL_HAVE_FP 0 /* 1 if floating point option configured, 0 otherwise */ | ||
1211 | |||
1212 | |||
1213 | /*---------------------------------------------------------------------- | ||
1214 | DERIVED | ||
1215 | ----------------------------------------------------------------------*/ | ||
1216 | |||
1217 | #if XCHAL_HAVE_BE | ||
1218 | #define XCHAL_INST_ILLN 0xD60F /* 2-byte illegal instruction, msb-first */ | ||
1219 | #define XCHAL_INST_ILLN_BYTE0 0xD6 /* 2-byte illegal instruction, 1st byte */ | ||
1220 | #define XCHAL_INST_ILLN_BYTE1 0x0F /* 2-byte illegal instruction, 2nd byte */ | ||
1221 | #else | ||
1222 | #define XCHAL_INST_ILLN 0xF06D /* 2-byte illegal instruction, lsb-first */ | ||
1223 | #define XCHAL_INST_ILLN_BYTE0 0x6D /* 2-byte illegal instruction, 1st byte */ | ||
1224 | #define XCHAL_INST_ILLN_BYTE1 0xF0 /* 2-byte illegal instruction, 2nd byte */ | ||
1225 | #endif | ||
1226 | /* Belongs in xtensa/hal.h: */ | ||
1227 | #define XTHAL_INST_ILL 0x000000 /* 3-byte illegal instruction */ | ||
1228 | |||
1229 | |||
1230 | /* | ||
1231 | * Because information as to exactly which hardware release is targeted | ||
1232 | * by a given software build is not always available, compile-time HAL | ||
1233 | * Hardware-Release "_AT" macros are fuzzy (return 0, 1, or XCHAL_MAYBE): | ||
1234 | */ | ||
1235 | #ifndef XCHAL_HW_RELEASE_MAJOR | ||
1236 | # define XCHAL_HW_CONFIGID_RELIABLE 0 | ||
1237 | #endif | ||
1238 | #if XCHAL_HW_CONFIGID_RELIABLE | ||
1239 | # define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) (XTHAL_REL_LE( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0) | ||
1240 | # define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) (XTHAL_REL_GE( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0) | ||
1241 | # define XCHAL_HW_RELEASE_AT(major,minor) (XTHAL_REL_EQ( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0) | ||
1242 | # define XCHAL_HW_RELEASE_MAJOR_AT(major) ((XCHAL_HW_RELEASE_MAJOR == (major)) ? 1 : 0) | ||
1243 | #else | ||
1244 | # define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) ( ((major) < 1040 && XCHAL_HAVE_XEA2) ? 0 \ | ||
1245 | : ((major) > 1050 && XCHAL_HAVE_XEA1) ? 1 \ | ||
1246 | : XTHAL_MAYBE ) | ||
1247 | # define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) ( ((major) >= 2000 && XCHAL_HAVE_XEA1) ? 0 \ | ||
1248 | : (XTHAL_REL_LE(major,minor, 1040,0) && XCHAL_HAVE_XEA2) ? 1 \ | ||
1249 | : XTHAL_MAYBE ) | ||
1250 | # define XCHAL_HW_RELEASE_AT(major,minor) ( (((major) < 1040 && XCHAL_HAVE_XEA2) || \ | ||
1251 | ((major) >= 2000 && XCHAL_HAVE_XEA1)) ? 0 : XTHAL_MAYBE) | ||
1252 | # define XCHAL_HW_RELEASE_MAJOR_AT(major) XCHAL_HW_RELEASE_AT(major,0) | ||
1253 | #endif | ||
1254 | |||
1255 | /* | ||
1256 | * Specific errata: | ||
1257 | */ | ||
1258 | |||
1259 | /* | ||
1260 | * Erratum T1020.H13, T1030.H7, T1040.H10, T1050.H4 (fixed in T1040.3 and T1050.1; | ||
1261 | * relevant only in XEA1, kernel-vector mode, level-one interrupts and overflows enabled): | ||
1262 | */ | ||
1263 | #define XCHAL_MAYHAVE_ERRATUM_XEA1KWIN (XCHAL_HAVE_XEA1 && \ | ||
1264 | (XCHAL_HW_RELEASE_AT_OR_BELOW(1040,2) != 0 \ | ||
1265 | || XCHAL_HW_RELEASE_AT(1050,0))) | ||
1266 | |||
1267 | |||
1268 | |||
1269 | #endif /*XTENSA_CONFIG_CORE_H*/ | ||
1270 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/defs.h b/include/asm-xtensa/xtensa/config-linux_be/defs.h new file mode 100644 index 000000000000..f7c58b273371 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/defs.h | |||
@@ -0,0 +1,270 @@ | |||
1 | /* Definitions for Xtensa instructions, types, and protos. */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it would be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | * | ||
14 | * Further, this software is distributed without any warranty that it is | ||
15 | * free of the rightful claim of any third person regarding infringement | ||
16 | * or the like. Any license provided herein, whether implied or | ||
17 | * otherwise, applies only to this software file. Patent licenses, if | ||
18 | * any, provided herein do not apply to combinations of this program with | ||
19 | * other software, or any other product whatsoever. | ||
20 | * | ||
21 | * You should have received a copy of the GNU Lesser General Public | ||
22 | * License along with this program; if not, write the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
24 | * USA. | ||
25 | */ | ||
26 | |||
27 | /* Do not modify. This is automatically generated.*/ | ||
28 | |||
29 | #ifndef _XTENSA_BASE_HEADER | ||
30 | #define _XTENSA_BASE_HEADER | ||
31 | |||
32 | #ifdef __XTENSA__ | ||
33 | #if defined(__GNUC__) && !defined(__XCC__) | ||
34 | |||
35 | #define L8UI_ASM(arr, ars, imm) { \ | ||
36 | __asm__ volatile("l8ui %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
37 | } | ||
38 | |||
39 | #define XT_L8UI(ars, imm) \ | ||
40 | ({ \ | ||
41 | unsigned char _arr; \ | ||
42 | const unsigned char *_ars = ars; \ | ||
43 | L8UI_ASM(_arr, _ars, imm); \ | ||
44 | _arr; \ | ||
45 | }) | ||
46 | |||
47 | #define L16UI_ASM(arr, ars, imm) { \ | ||
48 | __asm__ volatile("l16ui %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
49 | } | ||
50 | |||
51 | #define XT_L16UI(ars, imm) \ | ||
52 | ({ \ | ||
53 | unsigned short _arr; \ | ||
54 | const unsigned short *_ars = ars; \ | ||
55 | L16UI_ASM(_arr, _ars, imm); \ | ||
56 | _arr; \ | ||
57 | }) | ||
58 | |||
59 | #define L16SI_ASM(arr, ars, imm) {\ | ||
60 | __asm__ volatile("l16si %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
61 | } | ||
62 | |||
63 | #define XT_L16SI(ars, imm) \ | ||
64 | ({ \ | ||
65 | signed short _arr; \ | ||
66 | const signed short *_ars = ars; \ | ||
67 | L16SI_ASM(_arr, _ars, imm); \ | ||
68 | _arr; \ | ||
69 | }) | ||
70 | |||
71 | #define L32I_ASM(arr, ars, imm) { \ | ||
72 | __asm__ volatile("l32i %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
73 | } | ||
74 | |||
75 | #define XT_L32I(ars, imm) \ | ||
76 | ({ \ | ||
77 | unsigned _arr; \ | ||
78 | const unsigned *_ars = ars; \ | ||
79 | L32I_ASM(_arr, _ars, imm); \ | ||
80 | _arr; \ | ||
81 | }) | ||
82 | |||
83 | #define S8I_ASM(arr, ars, imm) {\ | ||
84 | __asm__ volatile("s8i %0, %1, %2" : : "a" (arr), "a" (ars) , "i" (imm) : "memory" ); \ | ||
85 | } | ||
86 | |||
87 | #define XT_S8I(arr, ars, imm) \ | ||
88 | ({ \ | ||
89 | signed char _arr = arr; \ | ||
90 | const signed char *_ars = ars; \ | ||
91 | S8I_ASM(_arr, _ars, imm); \ | ||
92 | }) | ||
93 | |||
94 | #define S16I_ASM(arr, ars, imm) {\ | ||
95 | __asm__ volatile("s16i %0, %1, %2" : : "a" (arr), "a" (ars) , "i" (imm) : "memory" ); \ | ||
96 | } | ||
97 | |||
98 | #define XT_S16I(arr, ars, imm) \ | ||
99 | ({ \ | ||
100 | signed short _arr = arr; \ | ||
101 | const signed short *_ars = ars; \ | ||
102 | S16I_ASM(_arr, _ars, imm); \ | ||
103 | }) | ||
104 | |||
105 | #define S32I_ASM(arr, ars, imm) { \ | ||
106 | __asm__ volatile("s32i %0, %1, %2" : : "a" (arr), "a" (ars) , "i" (imm) : "memory" ); \ | ||
107 | } | ||
108 | |||
109 | #define XT_S32I(arr, ars, imm) \ | ||
110 | ({ \ | ||
111 | signed int _arr = arr; \ | ||
112 | const signed int *_ars = ars; \ | ||
113 | S32I_ASM(_arr, _ars, imm); \ | ||
114 | }) | ||
115 | |||
116 | #define ADDI_ASM(art, ars, imm) {\ | ||
117 | __asm__ ("addi %0, %1, %2" : "=a" (art) : "a" (ars), "i" (imm)); \ | ||
118 | } | ||
119 | |||
120 | #define XT_ADDI(ars, imm) \ | ||
121 | ({ \ | ||
122 | unsigned _art; \ | ||
123 | unsigned _ars = ars; \ | ||
124 | ADDI_ASM(_art, _ars, imm); \ | ||
125 | _art; \ | ||
126 | }) | ||
127 | |||
128 | #define ABS_ASM(arr, art) {\ | ||
129 | __asm__ ("abs %0, %1" : "=a" (arr) : "a" (art)); \ | ||
130 | } | ||
131 | |||
132 | #define XT_ABS(art) \ | ||
133 | ({ \ | ||
134 | unsigned _arr; \ | ||
135 | signed _art = art; \ | ||
136 | ABS_ASM(_arr, _art); \ | ||
137 | _arr; \ | ||
138 | }) | ||
139 | |||
140 | /* Note: In the following macros that reference SAR, the magic "state" | ||
141 | register is used to capture the dependency on SAR. This is because | ||
142 | SAR is a 5-bit register and thus there are no C types that can be | ||
143 | used to represent it. It doesn't appear that the SAR register is | ||
144 | even relevant to GCC, but it is marked as "clobbered" just in | ||
145 | case. */ | ||
146 | |||
147 | #define SRC_ASM(arr, ars, art) {\ | ||
148 | register int _xt_sar __asm__ ("state"); \ | ||
149 | __asm__ ("src %0, %1, %2" \ | ||
150 | : "=a" (arr) : "a" (ars), "a" (art), "t" (_xt_sar)); \ | ||
151 | } | ||
152 | |||
153 | #define XT_SRC(ars, art) \ | ||
154 | ({ \ | ||
155 | unsigned _arr; \ | ||
156 | unsigned _ars = ars; \ | ||
157 | unsigned _art = art; \ | ||
158 | SRC_ASM(_arr, _ars, _art); \ | ||
159 | _arr; \ | ||
160 | }) | ||
161 | |||
162 | #define SSR_ASM(ars) {\ | ||
163 | register int _xt_sar __asm__ ("state"); \ | ||
164 | __asm__ ("ssr %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
165 | } | ||
166 | |||
167 | #define XT_SSR(ars) \ | ||
168 | ({ \ | ||
169 | unsigned _ars = ars; \ | ||
170 | SSR_ASM(_ars); \ | ||
171 | }) | ||
172 | |||
173 | #define SSL_ASM(ars) {\ | ||
174 | register int _xt_sar __asm__ ("state"); \ | ||
175 | __asm__ ("ssl %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
176 | } | ||
177 | |||
178 | #define XT_SSL(ars) \ | ||
179 | ({ \ | ||
180 | unsigned _ars = ars; \ | ||
181 | SSL_ASM(_ars); \ | ||
182 | }) | ||
183 | |||
184 | #define SSA8B_ASM(ars) {\ | ||
185 | register int _xt_sar __asm__ ("state"); \ | ||
186 | __asm__ ("ssa8b %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
187 | } | ||
188 | |||
189 | #define XT_SSA8B(ars) \ | ||
190 | ({ \ | ||
191 | unsigned _ars = ars; \ | ||
192 | SSA8B_ASM(_ars); \ | ||
193 | }) | ||
194 | |||
195 | #define SSA8L_ASM(ars) {\ | ||
196 | register int _xt_sar __asm__ ("state"); \ | ||
197 | __asm__ ("ssa8l %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
198 | } | ||
199 | |||
200 | #define XT_SSA8L(ars) \ | ||
201 | ({ \ | ||
202 | unsigned _ars = ars; \ | ||
203 | SSA8L_ASM(_ars); \ | ||
204 | }) | ||
205 | |||
206 | #define SSAI_ASM(imm) {\ | ||
207 | register int _xt_sar __asm__ ("state"); \ | ||
208 | __asm__ ("ssai %1" : "=t" (_xt_sar) : "i" (imm) : "sar"); \ | ||
209 | } | ||
210 | |||
211 | #define XT_SSAI(imm) \ | ||
212 | ({ \ | ||
213 | SSAI_ASM(imm); \ | ||
214 | }) | ||
215 | |||
216 | |||
217 | |||
218 | |||
219 | |||
220 | |||
221 | |||
222 | |||
223 | #endif /* __GNUC__ && !__XCC__ */ | ||
224 | |||
225 | #ifdef __XCC__ | ||
226 | |||
227 | /* Core load/store instructions */ | ||
228 | extern unsigned char _TIE_L8UI(const unsigned char * ars, immediate imm); | ||
229 | extern unsigned short _TIE_L16UI(const unsigned short * ars, immediate imm); | ||
230 | extern signed short _TIE_L16SI(const signed short * ars, immediate imm); | ||
231 | extern unsigned _TIE_L32I(const unsigned * ars, immediate imm); | ||
232 | extern void _TIE_S8I(unsigned char arr, unsigned char * ars, immediate imm); | ||
233 | extern void _TIE_S16I(unsigned short arr, unsigned short * ars, immediate imm); | ||
234 | extern void _TIE_S32I(unsigned arr, unsigned * ars, immediate imm); | ||
235 | |||
236 | #define XT_L8UI _TIE_L8UI | ||
237 | #define XT_L16UI _TIE_L16UI | ||
238 | #define XT_L16SI _TIE_L16SI | ||
239 | #define XT_L32I _TIE_L32I | ||
240 | #define XT_S8I _TIE_S8I | ||
241 | #define XT_S16I _TIE_S16I | ||
242 | #define XT_S32I _TIE_S32I | ||
243 | |||
244 | /* Add-immediate instruction */ | ||
245 | extern unsigned _TIE_ADDI(unsigned ars, immediate imm); | ||
246 | #define XT_ADDI _TIE_ADDI | ||
247 | |||
248 | /* Absolute value instruction */ | ||
249 | extern unsigned _TIE_ABS(int art); | ||
250 | #define XT_ABS _TIE_ABS | ||
251 | |||
252 | /* funnel shift instructions */ | ||
253 | extern unsigned _TIE_SRC(unsigned ars, unsigned art); | ||
254 | #define XT_SRC _TIE_SRC | ||
255 | extern void _TIE_SSR(unsigned ars); | ||
256 | #define XT_SSR _TIE_SSR | ||
257 | extern void _TIE_SSL(unsigned ars); | ||
258 | #define XT_SSL _TIE_SSL | ||
259 | extern void _TIE_SSA8B(unsigned ars); | ||
260 | #define XT_SSA8B _TIE_SSA8B | ||
261 | extern void _TIE_SSA8L(unsigned ars); | ||
262 | #define XT_SSA8L _TIE_SSA8L | ||
263 | extern void _TIE_SSAI(immediate imm); | ||
264 | #define XT_SSAI _TIE_SSAI | ||
265 | |||
266 | |||
267 | #endif /* __XCC__ */ | ||
268 | |||
269 | #endif /* __XTENSA__ */ | ||
270 | #endif /* !_XTENSA_BASE_HEADER */ | ||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/specreg.h b/include/asm-xtensa/xtensa/config-linux_be/specreg.h new file mode 100644 index 000000000000..fa4106aa9a02 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/specreg.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Xtensa Special Register symbolic names | ||
3 | */ | ||
4 | |||
5 | /* $Id: specreg.h,v 1.2 2003/03/07 19:15:18 joetaylor Exp $ */ | ||
6 | |||
7 | /* | ||
8 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
12 | * License as published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it would be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | * | ||
18 | * Further, this software is distributed without any warranty that it is | ||
19 | * free of the rightful claim of any third person regarding infringement | ||
20 | * or the like. Any license provided herein, whether implied or | ||
21 | * otherwise, applies only to this software file. Patent licenses, if | ||
22 | * any, provided herein do not apply to combinations of this program with | ||
23 | * other software, or any other product whatsoever. | ||
24 | * | ||
25 | * You should have received a copy of the GNU Lesser General Public | ||
26 | * License along with this program; if not, write the Free Software | ||
27 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
28 | * USA. | ||
29 | */ | ||
30 | |||
31 | #ifndef XTENSA_SPECREG_H | ||
32 | #define XTENSA_SPECREG_H | ||
33 | |||
34 | /* Include these special register bitfield definitions, for historical reasons: */ | ||
35 | #include <xtensa/corebits.h> | ||
36 | |||
37 | |||
38 | /* Special registers: */ | ||
39 | #define LBEG 0 | ||
40 | #define LEND 1 | ||
41 | #define LCOUNT 2 | ||
42 | #define SAR 3 | ||
43 | #define WINDOWBASE 72 | ||
44 | #define WINDOWSTART 73 | ||
45 | #define PTEVADDR 83 | ||
46 | #define RASID 90 | ||
47 | #define ITLBCFG 91 | ||
48 | #define DTLBCFG 92 | ||
49 | #define IBREAKENABLE 96 | ||
50 | #define DDR 104 | ||
51 | #define IBREAKA_0 128 | ||
52 | #define IBREAKA_1 129 | ||
53 | #define DBREAKA_0 144 | ||
54 | #define DBREAKA_1 145 | ||
55 | #define DBREAKC_0 160 | ||
56 | #define DBREAKC_1 161 | ||
57 | #define EPC_1 177 | ||
58 | #define EPC_2 178 | ||
59 | #define EPC_3 179 | ||
60 | #define EPC_4 180 | ||
61 | #define DEPC 192 | ||
62 | #define EPS_2 194 | ||
63 | #define EPS_3 195 | ||
64 | #define EPS_4 196 | ||
65 | #define EXCSAVE_1 209 | ||
66 | #define EXCSAVE_2 210 | ||
67 | #define EXCSAVE_3 211 | ||
68 | #define EXCSAVE_4 212 | ||
69 | #define INTERRUPT 226 | ||
70 | #define INTENABLE 228 | ||
71 | #define PS 230 | ||
72 | #define EXCCAUSE 232 | ||
73 | #define DEBUGCAUSE 233 | ||
74 | #define CCOUNT 234 | ||
75 | #define ICOUNT 236 | ||
76 | #define ICOUNTLEVEL 237 | ||
77 | #define EXCVADDR 238 | ||
78 | #define CCOMPARE_0 240 | ||
79 | #define CCOMPARE_1 241 | ||
80 | #define CCOMPARE_2 242 | ||
81 | #define MISC_REG_0 244 | ||
82 | #define MISC_REG_1 245 | ||
83 | |||
84 | /* Special cases (bases of special register series): */ | ||
85 | #define IBREAKA 128 | ||
86 | #define DBREAKA 144 | ||
87 | #define DBREAKC 160 | ||
88 | #define EPC 176 | ||
89 | #define EPS 192 | ||
90 | #define EXCSAVE 208 | ||
91 | #define CCOMPARE 240 | ||
92 | |||
93 | /* Special names for read-only and write-only interrupt registers: */ | ||
94 | #define INTREAD 226 | ||
95 | #define INTSET 226 | ||
96 | #define INTCLEAR 227 | ||
97 | |||
98 | #endif /* XTENSA_SPECREG_H */ | ||
99 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/system.h b/include/asm-xtensa/xtensa/config-linux_be/system.h new file mode 100644 index 000000000000..cf9d4d308e3a --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/system.h | |||
@@ -0,0 +1,198 @@ | |||
1 | /* | ||
2 | * xtensa/config/system.h -- HAL definitions that are dependent on SYSTEM configuration | ||
3 | * | ||
4 | * NOTE: The location and contents of this file are highly subject to change. | ||
5 | * | ||
6 | * Source for configuration-independent binaries (which link in a | ||
7 | * configuration-specific HAL library) must NEVER include this file. | ||
8 | * The HAL itself has historically included this file in some instances, | ||
9 | * but this is not appropriate either, because the HAL is meant to be | ||
10 | * core-specific but system independent. | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
18 | * License as published by the Free Software Foundation. | ||
19 | * | ||
20 | * This program is distributed in the hope that it would be useful, but | ||
21 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
23 | * | ||
24 | * Further, this software is distributed without any warranty that it is | ||
25 | * free of the rightful claim of any third person regarding infringement | ||
26 | * or the like. Any license provided herein, whether implied or | ||
27 | * otherwise, applies only to this software file. Patent licenses, if | ||
28 | * any, provided herein do not apply to combinations of this program with | ||
29 | * other software, or any other product whatsoever. | ||
30 | * | ||
31 | * You should have received a copy of the GNU Lesser General Public | ||
32 | * License along with this program; if not, write the Free Software | ||
33 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
34 | * USA. | ||
35 | */ | ||
36 | |||
37 | |||
38 | #ifndef XTENSA_CONFIG_SYSTEM_H | ||
39 | #define XTENSA_CONFIG_SYSTEM_H | ||
40 | |||
41 | /*#include <xtensa/hal.h>*/ | ||
42 | |||
43 | |||
44 | |||
45 | /*---------------------------------------------------------------------- | ||
46 | DEVICE ADDRESSES | ||
47 | ----------------------------------------------------------------------*/ | ||
48 | |||
49 | /* | ||
50 | * Strange place to find these, but the configuration GUI | ||
51 | * allows moving these around to account for various core | ||
52 | * configurations. Specific boards (and their BSP software) | ||
53 | * will have specific meanings for these components. | ||
54 | */ | ||
55 | |||
56 | /* I/O Block areas: */ | ||
57 | #define XSHAL_IOBLOCK_CACHED_VADDR 0xE0000000 | ||
58 | #define XSHAL_IOBLOCK_CACHED_PADDR 0xF0000000 | ||
59 | #define XSHAL_IOBLOCK_CACHED_SIZE 0x0E000000 | ||
60 | |||
61 | #define XSHAL_IOBLOCK_BYPASS_VADDR 0xF0000000 | ||
62 | #define XSHAL_IOBLOCK_BYPASS_PADDR 0xF0000000 | ||
63 | #define XSHAL_IOBLOCK_BYPASS_SIZE 0x0E000000 | ||
64 | |||
65 | /* System ROM: */ | ||
66 | #define XSHAL_ROM_VADDR 0xEE000000 | ||
67 | #define XSHAL_ROM_PADDR 0xFE000000 | ||
68 | #define XSHAL_ROM_SIZE 0x00400000 | ||
69 | /* Largest available area (free of vectors): */ | ||
70 | #define XSHAL_ROM_AVAIL_VADDR 0xEE00052C | ||
71 | #define XSHAL_ROM_AVAIL_VSIZE 0x003FFAD4 | ||
72 | |||
73 | /* System RAM: */ | ||
74 | #define XSHAL_RAM_VADDR 0xD0000000 | ||
75 | #define XSHAL_RAM_PADDR 0x00000000 | ||
76 | #define XSHAL_RAM_VSIZE 0x08000000 | ||
77 | #define XSHAL_RAM_PSIZE 0x10000000 | ||
78 | #define XSHAL_RAM_SIZE XSHAL_RAM_PSIZE | ||
79 | /* Largest available area (free of vectors): */ | ||
80 | #define XSHAL_RAM_AVAIL_VADDR 0xD0000370 | ||
81 | #define XSHAL_RAM_AVAIL_VSIZE 0x07FFFC90 | ||
82 | |||
83 | /* | ||
84 | * Shadow system RAM (same device as system RAM, at different address). | ||
85 | * (Emulation boards need this for the SONIC Ethernet driver | ||
86 | * when data caches are configured for writeback mode.) | ||
87 | * NOTE: on full MMU configs, this points to the BYPASS virtual address | ||
88 | * of system RAM, ie. is the same as XSHAL_RAM_* except that virtual | ||
89 | * addresses are viewed through the BYPASS static map rather than | ||
90 | * the CACHED static map. | ||
91 | */ | ||
92 | #define XSHAL_RAM_BYPASS_VADDR 0xD8000000 | ||
93 | #define XSHAL_RAM_BYPASS_PADDR 0x00000000 | ||
94 | #define XSHAL_RAM_BYPASS_PSIZE 0x08000000 | ||
95 | |||
96 | /* Alternate system RAM (different device than system RAM): */ | ||
97 | #define XSHAL_ALTRAM_VADDR 0xCEE00000 | ||
98 | #define XSHAL_ALTRAM_PADDR 0xC0000000 | ||
99 | #define XSHAL_ALTRAM_SIZE 0x00200000 | ||
100 | |||
101 | |||
102 | /*---------------------------------------------------------------------- | ||
103 | * DEVICE-ADDRESS DEPENDENT... | ||
104 | * | ||
105 | * Values written to CACHEATTR special register (or its equivalent) | ||
106 | * to enable and disable caches in various modes. | ||
107 | *----------------------------------------------------------------------*/ | ||
108 | |||
109 | /*---------------------------------------------------------------------- | ||
110 | BACKWARD COMPATIBILITY ... | ||
111 | ----------------------------------------------------------------------*/ | ||
112 | |||
113 | /* | ||
114 | * NOTE: the following two macros are DEPRECATED. Use the latter | ||
115 | * board-specific macros instead, which are specially tuned for the | ||
116 | * particular target environments' memory maps. | ||
117 | */ | ||
118 | #define XSHAL_CACHEATTR_BYPASS XSHAL_XT2000_CACHEATTR_BYPASS /* disable caches in bypass mode */ | ||
119 | #define XSHAL_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_DEFAULT /* default setting to enable caches (no writeback!) */ | ||
120 | |||
121 | /*---------------------------------------------------------------------- | ||
122 | ISS (Instruction Set Simulator) SPECIFIC ... | ||
123 | ----------------------------------------------------------------------*/ | ||
124 | |||
125 | #define XSHAL_ISS_CACHEATTR_WRITEBACK 0x1122222F /* enable caches in write-back mode */ | ||
126 | #define XSHAL_ISS_CACHEATTR_WRITEALLOC 0x1122222F /* enable caches in write-allocate mode */ | ||
127 | #define XSHAL_ISS_CACHEATTR_WRITETHRU 0x1122222F /* enable caches in write-through mode */ | ||
128 | #define XSHAL_ISS_CACHEATTR_BYPASS 0x2222222F /* disable caches in bypass mode */ | ||
129 | #define XSHAL_ISS_CACHEATTR_DEFAULT XSHAL_ISS_CACHEATTR_WRITEBACK /* default setting to enable caches */ | ||
130 | |||
131 | /* For Coware only: */ | ||
132 | #define XSHAL_COWARE_CACHEATTR_WRITEBACK 0x11222222 /* enable caches in write-back mode */ | ||
133 | #define XSHAL_COWARE_CACHEATTR_WRITEALLOC 0x11222222 /* enable caches in write-allocate mode */ | ||
134 | #define XSHAL_COWARE_CACHEATTR_WRITETHRU 0x11222222 /* enable caches in write-through mode */ | ||
135 | #define XSHAL_COWARE_CACHEATTR_BYPASS 0x22222222 /* disable caches in bypass mode */ | ||
136 | #define XSHAL_COWARE_CACHEATTR_DEFAULT XSHAL_COWARE_CACHEATTR_WRITEBACK /* default setting to enable caches */ | ||
137 | |||
138 | /* For BFM and other purposes: */ | ||
139 | #define XSHAL_ALLVALID_CACHEATTR_WRITEBACK 0x11222222 /* enable caches without any invalid regions */ | ||
140 | #define XSHAL_ALLVALID_CACHEATTR_DEFAULT XSHAL_ALLVALID_CACHEATTR_WRITEBACK /* default setting for caches without any invalid regions */ | ||
141 | |||
142 | #define XSHAL_ISS_PIPE_REGIONS 0 | ||
143 | #define XSHAL_ISS_SDRAM_REGIONS 0 | ||
144 | |||
145 | |||
146 | /*---------------------------------------------------------------------- | ||
147 | XT2000 BOARD SPECIFIC ... | ||
148 | ----------------------------------------------------------------------*/ | ||
149 | |||
150 | #define XSHAL_XT2000_CACHEATTR_WRITEBACK 0x22FFFFFF /* enable caches in write-back mode */ | ||
151 | #define XSHAL_XT2000_CACHEATTR_WRITEALLOC 0x22FFFFFF /* enable caches in write-allocate mode */ | ||
152 | #define XSHAL_XT2000_CACHEATTR_WRITETHRU 0x22FFFFFF /* enable caches in write-through mode */ | ||
153 | #define XSHAL_XT2000_CACHEATTR_BYPASS 0x22FFFFFF /* disable caches in bypass mode */ | ||
154 | #define XSHAL_XT2000_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_WRITEBACK /* default setting to enable caches */ | ||
155 | |||
156 | #define XSHAL_XT2000_PIPE_REGIONS 0x00001000 /* BusInt pipeline regions */ | ||
157 | #define XSHAL_XT2000_SDRAM_REGIONS 0x00000005 /* BusInt SDRAM regions */ | ||
158 | |||
159 | |||
160 | /*---------------------------------------------------------------------- | ||
161 | VECTOR SIZES | ||
162 | ----------------------------------------------------------------------*/ | ||
163 | |||
164 | /* | ||
165 | * Sizes allocated to vectors by the system (memory map) configuration. | ||
166 | * These sizes are constrained by core configuration (eg. one vector's | ||
167 | * code cannot overflow into another vector) but are dependent on the | ||
168 | * system or board (or LSP) memory map configuration. | ||
169 | * | ||
170 | * Whether or not each vector happens to be in a system ROM is also | ||
171 | * a system configuration matter, sometimes useful, included here also: | ||
172 | */ | ||
173 | #define XSHAL_RESET_VECTOR_SIZE 0x000004E0 | ||
174 | #define XSHAL_RESET_VECTOR_ISROM 1 | ||
175 | #define XSHAL_USER_VECTOR_SIZE 0x0000001C | ||
176 | #define XSHAL_USER_VECTOR_ISROM 0 | ||
177 | #define XSHAL_PROGRAMEXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ | ||
178 | #define XSHAL_USEREXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ | ||
179 | #define XSHAL_KERNEL_VECTOR_SIZE 0x0000001C | ||
180 | #define XSHAL_KERNEL_VECTOR_ISROM 0 | ||
181 | #define XSHAL_STACKEDEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ | ||
182 | #define XSHAL_KERNELEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ | ||
183 | #define XSHAL_DOUBLEEXC_VECTOR_SIZE 0x000000E0 | ||
184 | #define XSHAL_DOUBLEEXC_VECTOR_ISROM 0 | ||
185 | #define XSHAL_WINDOW_VECTORS_SIZE 0x00000180 | ||
186 | #define XSHAL_WINDOW_VECTORS_ISROM 0 | ||
187 | #define XSHAL_INTLEVEL2_VECTOR_SIZE 0x0000000C | ||
188 | #define XSHAL_INTLEVEL2_VECTOR_ISROM 0 | ||
189 | #define XSHAL_INTLEVEL3_VECTOR_SIZE 0x0000000C | ||
190 | #define XSHAL_INTLEVEL3_VECTOR_ISROM 0 | ||
191 | #define XSHAL_INTLEVEL4_VECTOR_SIZE 0x0000000C | ||
192 | #define XSHAL_INTLEVEL4_VECTOR_ISROM 1 | ||
193 | #define XSHAL_DEBUG_VECTOR_SIZE XSHAL_INTLEVEL4_VECTOR_SIZE | ||
194 | #define XSHAL_DEBUG_VECTOR_ISROM XSHAL_INTLEVEL4_VECTOR_ISROM | ||
195 | |||
196 | |||
197 | #endif /*XTENSA_CONFIG_SYSTEM_H*/ | ||
198 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/tie.h b/include/asm-xtensa/xtensa/config-linux_be/tie.h new file mode 100644 index 000000000000..3c2e514602f4 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/tie.h | |||
@@ -0,0 +1,275 @@ | |||
1 | /* | ||
2 | * xtensa/config/tie.h -- HAL definitions that are dependent on CORE and TIE configuration | ||
3 | * | ||
4 | * This header file is sometimes referred to as the "compile-time HAL" or CHAL. | ||
5 | * It was generated for a specific Xtensa processor configuration, | ||
6 | * and furthermore for a specific set of TIE source files that extend | ||
7 | * basic core functionality. | ||
8 | * | ||
9 | * Source for configuration-independent binaries (which link in a | ||
10 | * configuration-specific HAL library) must NEVER include this file. | ||
11 | * It is perfectly normal, however, for the HAL source itself to include this file. | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
19 | * License as published by the Free Software Foundation. | ||
20 | * | ||
21 | * This program is distributed in the hope that it would be useful, but | ||
22 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
24 | * | ||
25 | * Further, this software is distributed without any warranty that it is | ||
26 | * free of the rightful claim of any third person regarding infringement | ||
27 | * or the like. Any license provided herein, whether implied or | ||
28 | * otherwise, applies only to this software file. Patent licenses, if | ||
29 | * any, provided herein do not apply to combinations of this program with | ||
30 | * other software, or any other product whatsoever. | ||
31 | * | ||
32 | * You should have received a copy of the GNU Lesser General Public | ||
33 | * License along with this program; if not, write the Free Software | ||
34 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
35 | * USA. | ||
36 | */ | ||
37 | |||
38 | |||
39 | #ifndef XTENSA_CONFIG_TIE_H | ||
40 | #define XTENSA_CONFIG_TIE_H | ||
41 | |||
42 | #include <xtensa/hal.h> | ||
43 | |||
44 | |||
45 | /*---------------------------------------------------------------------- | ||
46 | GENERAL | ||
47 | ----------------------------------------------------------------------*/ | ||
48 | |||
49 | /* | ||
50 | * Separators for macros that expand into arrays. | ||
51 | * These can be predefined by files that #include this one, | ||
52 | * when different separators are required. | ||
53 | */ | ||
54 | /* Element separator for macros that expand into 1-dimensional arrays: */ | ||
55 | #ifndef XCHAL_SEP | ||
56 | #define XCHAL_SEP , | ||
57 | #endif | ||
58 | /* Array separator for macros that expand into 2-dimensional arrays: */ | ||
59 | #ifndef XCHAL_SEP2 | ||
60 | #define XCHAL_SEP2 },{ | ||
61 | #endif | ||
62 | |||
63 | |||
64 | |||
65 | |||
66 | |||
67 | |||
68 | /*---------------------------------------------------------------------- | ||
69 | COPROCESSORS and EXTRA STATE | ||
70 | ----------------------------------------------------------------------*/ | ||
71 | |||
72 | #define XCHAL_CP_NUM 0 /* number of coprocessors */ | ||
73 | #define XCHAL_CP_MAX 0 /* max coprocessor id plus one (0 if none) */ | ||
74 | #define XCHAL_CP_MASK 0x00 /* bitmask of coprocessors by id */ | ||
75 | |||
76 | /* Space for coprocessors' state save areas: */ | ||
77 | #define XCHAL_CP0_SA_SIZE 0 | ||
78 | #define XCHAL_CP1_SA_SIZE 0 | ||
79 | #define XCHAL_CP2_SA_SIZE 0 | ||
80 | #define XCHAL_CP3_SA_SIZE 0 | ||
81 | #define XCHAL_CP4_SA_SIZE 0 | ||
82 | #define XCHAL_CP5_SA_SIZE 0 | ||
83 | #define XCHAL_CP6_SA_SIZE 0 | ||
84 | #define XCHAL_CP7_SA_SIZE 0 | ||
85 | /* Minimum required alignments of CP state save areas: */ | ||
86 | #define XCHAL_CP0_SA_ALIGN 1 | ||
87 | #define XCHAL_CP1_SA_ALIGN 1 | ||
88 | #define XCHAL_CP2_SA_ALIGN 1 | ||
89 | #define XCHAL_CP3_SA_ALIGN 1 | ||
90 | #define XCHAL_CP4_SA_ALIGN 1 | ||
91 | #define XCHAL_CP5_SA_ALIGN 1 | ||
92 | #define XCHAL_CP6_SA_ALIGN 1 | ||
93 | #define XCHAL_CP7_SA_ALIGN 1 | ||
94 | |||
95 | /* Indexing macros: */ | ||
96 | #define _XCHAL_CP_SA_SIZE(n) XCHAL_CP ## n ## _SA_SIZE | ||
97 | #define XCHAL_CP_SA_SIZE(n) _XCHAL_CP_SA_SIZE(n) /* n = 0 .. 7 */ | ||
98 | #define _XCHAL_CP_SA_ALIGN(n) XCHAL_CP ## n ## _SA_ALIGN | ||
99 | #define XCHAL_CP_SA_ALIGN(n) _XCHAL_CP_SA_ALIGN(n) /* n = 0 .. 7 */ | ||
100 | |||
101 | |||
102 | /* Space for "extra" state (user special registers and non-cp TIE) save area: */ | ||
103 | #define XCHAL_EXTRA_SA_SIZE 0 | ||
104 | #define XCHAL_EXTRA_SA_ALIGN 1 | ||
105 | |||
106 | /* Total save area size (extra + all coprocessors) */ | ||
107 | /* (not useful until xthal_{save,restore}_all_extra() is implemented, */ | ||
108 | /* but included for Tor2 beta; doesn't account for alignment!): */ | ||
109 | #define XCHAL_CPEXTRA_SA_SIZE_TOR2 0 /* Tor2Beta temporary definition -- do not use */ | ||
110 | |||
111 | /* Combined required alignment for all CP and EXTRA state save areas */ | ||
112 | /* (does not include required alignment for any base config registers): */ | ||
113 | #define XCHAL_CPEXTRA_SA_ALIGN 1 | ||
114 | |||
115 | /* ... */ | ||
116 | |||
117 | |||
118 | #ifdef _ASMLANGUAGE | ||
119 | /* | ||
120 | * Assembly-language specific definitions (assembly macros, etc.). | ||
121 | */ | ||
122 | #include <xtensa/config/specreg.h> | ||
123 | |||
124 | /******************** | ||
125 | * Macros to save and restore the non-coprocessor TIE portion of EXTRA state. | ||
126 | */ | ||
127 | |||
128 | /* (none) */ | ||
129 | |||
130 | |||
131 | /******************** | ||
132 | * Macros to create functions that save and restore all EXTRA (non-coprocessor) state | ||
133 | * (does not include zero-overhead loop registers and non-optional registers). | ||
134 | */ | ||
135 | |||
136 | /* | ||
137 | * Macro that expands to the body of a function that | ||
138 | * stores the extra (non-coprocessor) optional/custom state. | ||
139 | * Entry: a2 = ptr to save area in which to save extra state | ||
140 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
141 | */ | ||
142 | .macro xchal_extra_store_funcbody | ||
143 | .endm | ||
144 | |||
145 | |||
146 | /* | ||
147 | * Macro that expands to the body of a function that | ||
148 | * loads the extra (non-coprocessor) optional/custom state. | ||
149 | * Entry: a2 = ptr to save area from which to restore extra state | ||
150 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
151 | */ | ||
152 | .macro xchal_extra_load_funcbody | ||
153 | .endm | ||
154 | |||
155 | |||
156 | /******************** | ||
157 | * Macros to save and restore the state of each TIE coprocessor. | ||
158 | */ | ||
159 | |||
160 | |||
161 | |||
162 | /******************** | ||
163 | * Macros to create functions that save and restore the state of *any* TIE coprocessor. | ||
164 | */ | ||
165 | |||
166 | /* | ||
167 | * Macro that expands to the body of a function | ||
168 | * that stores the selected coprocessor's state (registers etc). | ||
169 | * Entry: a2 = ptr to save area in which to save cp state | ||
170 | * a3 = coprocessor number | ||
171 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
172 | */ | ||
173 | .macro xchal_cpi_store_funcbody | ||
174 | .endm | ||
175 | |||
176 | |||
177 | /* | ||
178 | * Macro that expands to the body of a function | ||
179 | * that loads the selected coprocessor's state (registers etc). | ||
180 | * Entry: a2 = ptr to save area from which to restore cp state | ||
181 | * a3 = coprocessor number | ||
182 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
183 | */ | ||
184 | .macro xchal_cpi_load_funcbody | ||
185 | .endm | ||
186 | |||
187 | #endif /*_ASMLANGUAGE*/ | ||
188 | |||
189 | |||
190 | /* | ||
191 | * Contents of save areas in terms of libdb register numbers. | ||
192 | * NOTE: CONTENTS_LIBDB_{UREG,REGF} macros are not defined in this file; | ||
193 | * it is up to the user of this header file to define these macros | ||
194 | * usefully before each expansion of the CONTENTS_LIBDB macros. | ||
195 | * (Fields rsv[123] are reserved for future additions; they are currently | ||
196 | * set to zero but may be set to some useful values in the future.) | ||
197 | * | ||
198 | * CONTENTS_LIBDB_SREG(libdbnum, offset, size, align, rsv1, name, sregnum, bitmask, rsv2, rsv3) | ||
199 | * CONTENTS_LIBDB_UREG(libdbnum, offset, size, align, rsv1, name, uregnum, bitmask, rsv2, rsv3) | ||
200 | * CONTENTS_LIBDB_REGF(libdbnum, offset, size, align, rsv1, name, index, numentries, contentsize, regname_base, regfile_name, rsv2, rsv3) | ||
201 | */ | ||
202 | |||
203 | #define XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM 0 | ||
204 | #define XCHAL_EXTRA_SA_CONTENTS_LIBDB /* empty */ | ||
205 | |||
206 | #define XCHAL_CP0_SA_CONTENTS_LIBDB_NUM 0 | ||
207 | #define XCHAL_CP0_SA_CONTENTS_LIBDB /* empty */ | ||
208 | |||
209 | #define XCHAL_CP1_SA_CONTENTS_LIBDB_NUM 0 | ||
210 | #define XCHAL_CP1_SA_CONTENTS_LIBDB /* empty */ | ||
211 | |||
212 | #define XCHAL_CP2_SA_CONTENTS_LIBDB_NUM 0 | ||
213 | #define XCHAL_CP2_SA_CONTENTS_LIBDB /* empty */ | ||
214 | |||
215 | #define XCHAL_CP3_SA_CONTENTS_LIBDB_NUM 0 | ||
216 | #define XCHAL_CP3_SA_CONTENTS_LIBDB /* empty */ | ||
217 | |||
218 | #define XCHAL_CP4_SA_CONTENTS_LIBDB_NUM 0 | ||
219 | #define XCHAL_CP4_SA_CONTENTS_LIBDB /* empty */ | ||
220 | |||
221 | #define XCHAL_CP5_SA_CONTENTS_LIBDB_NUM 0 | ||
222 | #define XCHAL_CP5_SA_CONTENTS_LIBDB /* empty */ | ||
223 | |||
224 | #define XCHAL_CP6_SA_CONTENTS_LIBDB_NUM 0 | ||
225 | #define XCHAL_CP6_SA_CONTENTS_LIBDB /* empty */ | ||
226 | |||
227 | #define XCHAL_CP7_SA_CONTENTS_LIBDB_NUM 0 | ||
228 | #define XCHAL_CP7_SA_CONTENTS_LIBDB /* empty */ | ||
229 | |||
230 | |||
231 | |||
232 | |||
233 | |||
234 | |||
235 | /*---------------------------------------------------------------------- | ||
236 | MISC | ||
237 | ----------------------------------------------------------------------*/ | ||
238 | |||
239 | #if 0 /* is there something equivalent for user TIE? */ | ||
240 | #define XCHAL_CORE_ID "linux_be" /* configuration's alphanumeric core identifier | ||
241 | (CoreID) set in the Xtensa Processor Generator */ | ||
242 | |||
243 | #define XCHAL_BUILD_UNIQUE_ID 0x00003256 /* software build-unique ID (22-bit) */ | ||
244 | |||
245 | /* These definitions describe the hardware targeted by this software: */ | ||
246 | #define XCHAL_HW_CONFIGID0 0xC103D1FF /* config ID reg 0 value (upper 32 of 64 bits) */ | ||
247 | #define XCHAL_HW_CONFIGID1 0x00803256 /* config ID reg 1 value (lower 32 of 64 bits) */ | ||
248 | #define XCHAL_CONFIGID0 XCHAL_HW_CONFIGID0 /* for backward compatibility only -- don't use! */ | ||
249 | #define XCHAL_CONFIGID1 XCHAL_HW_CONFIGID1 /* for backward compatibility only -- don't use! */ | ||
250 | #define XCHAL_HW_RELEASE_MAJOR 1050 /* major release of targeted hardware */ | ||
251 | #define XCHAL_HW_RELEASE_MINOR 1 /* minor release of targeted hardware */ | ||
252 | #define XCHAL_HW_RELEASE_NAME "T1050.1" /* full release name of targeted hardware */ | ||
253 | #define XTHAL_HW_REL_T1050 1 | ||
254 | #define XTHAL_HW_REL_T1050_1 1 | ||
255 | #define XCHAL_HW_CONFIGID_RELIABLE 1 | ||
256 | #endif /*0*/ | ||
257 | |||
258 | |||
259 | |||
260 | /*---------------------------------------------------------------------- | ||
261 | ISA | ||
262 | ----------------------------------------------------------------------*/ | ||
263 | |||
264 | #if 0 /* these probably don't belong here, but are related to or implemented using TIE */ | ||
265 | #define XCHAL_HAVE_BOOLEANS 0 /* 1 if booleans option configured, 0 otherwise */ | ||
266 | /* Misc instructions: */ | ||
267 | #define XCHAL_HAVE_MUL32 0 /* 1 if 32-bit integer multiply option configured, 0 otherwise */ | ||
268 | #define XCHAL_HAVE_MUL32_HIGH 0 /* 1 if MUL32 option includes MULUH and MULSH, 0 otherwise */ | ||
269 | |||
270 | #define XCHAL_HAVE_FP 0 /* 1 if floating point option configured, 0 otherwise */ | ||
271 | #endif /*0*/ | ||
272 | |||
273 | |||
274 | #endif /*XTENSA_CONFIG_TIE_H*/ | ||
275 | |||
diff --git a/include/asm-xtensa/xtensa/coreasm.h b/include/asm-xtensa/xtensa/coreasm.h new file mode 100644 index 000000000000..a8cfb54c20a1 --- /dev/null +++ b/include/asm-xtensa/xtensa/coreasm.h | |||
@@ -0,0 +1,526 @@ | |||
1 | #ifndef XTENSA_COREASM_H | ||
2 | #define XTENSA_COREASM_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/coreasm.h -- assembler-specific | ||
8 | * definitions that depend on CORE configuration. | ||
9 | * | ||
10 | * Source for configuration-independent binaries (which link in a | ||
11 | * configuration-specific HAL library) must NEVER include this file. | ||
12 | * It is perfectly normal, however, for the HAL itself to include this | ||
13 | * file. | ||
14 | * | ||
15 | * This file must NOT include xtensa/config/system.h. Any assembler | ||
16 | * header file that depends on system information should likely go in | ||
17 | * a new systemasm.h (or sysasm.h) header file. | ||
18 | * | ||
19 | * NOTE: macro beqi32 is NOT configuration-dependent, and is placed | ||
20 | * here til we will have configuration-independent header file. | ||
21 | * | ||
22 | * This file is subject to the terms and conditions of the GNU General | ||
23 | * Public License. See the file "COPYING" in the main directory of | ||
24 | * this archive for more details. | ||
25 | * | ||
26 | * Copyright (C) 2002 Tensilica Inc. | ||
27 | */ | ||
28 | |||
29 | |||
30 | #include <xtensa/config/core.h> | ||
31 | #include <xtensa/config/specreg.h> | ||
32 | |||
33 | /* | ||
34 | * Assembly-language specific definitions (assembly macros, etc.). | ||
35 | */ | ||
36 | |||
37 | /*---------------------------------------------------------------------- | ||
38 | * find_ms_setbit | ||
39 | * | ||
40 | * This macro finds the most significant bit that is set in <as> | ||
41 | * and return its index + <base> in <ad>, or <base> - 1 if <as> is zero. | ||
42 | * The index counts starting at zero for the lsbit, so the return | ||
43 | * value ranges from <base>-1 (no bit set) to <base>+31 (msbit set). | ||
44 | * | ||
45 | * Parameters: | ||
46 | * <ad> destination address register (any register) | ||
47 | * <as> source address register | ||
48 | * <at> temporary address register (must be different than <as>) | ||
49 | * <base> constant value added to result (usually 0 or 1) | ||
50 | * On entry: | ||
51 | * <ad> = undefined if different than <as> | ||
52 | * <as> = value whose most significant set bit is to be found | ||
53 | * <at> = undefined | ||
54 | * no other registers are used by this macro. | ||
55 | * On exit: | ||
56 | * <ad> = <base> + index of msbit set in original <as>, | ||
57 | * = <base> - 1 if original <as> was zero. | ||
58 | * <as> clobbered (if not <ad>) | ||
59 | * <at> clobbered (if not <ad>) | ||
60 | * Example: | ||
61 | * find_ms_setbit a0, a4, a0, 0 -- return in a0 index of msbit set in a4 | ||
62 | */ | ||
63 | |||
64 | .macro find_ms_setbit ad, as, at, base | ||
65 | #if XCHAL_HAVE_NSA | ||
66 | movi \at, 31+\base | ||
67 | nsau \as, \as // get index of \as, numbered from msbit (32 if absent) | ||
68 | sub \ad, \at, \as // get numbering from lsbit (0..31, -1 if absent) | ||
69 | #else /* XCHAL_HAVE_NSA */ | ||
70 | movi \at, \base // start with result of 0 (point to lsbit of 32) | ||
71 | |||
72 | beqz \as, 2f // special case for zero argument: return -1 | ||
73 | bltui \as, 0x10000, 1f // is it one of the 16 lsbits? (if so, check lower 16 bits) | ||
74 | addi \at, \at, 16 // no, increment result to upper 16 bits (of 32) | ||
75 | //srli \as, \as, 16 // check upper half (shift right 16 bits) | ||
76 | extui \as, \as, 16, 16 // check upper half (shift right 16 bits) | ||
77 | 1: bltui \as, 0x100, 1f // is it one of the 8 lsbits? (if so, check lower 8 bits) | ||
78 | addi \at, \at, 8 // no, increment result to upper 8 bits (of 16) | ||
79 | srli \as, \as, 8 // shift right to check upper 8 bits | ||
80 | 1: bltui \as, 0x10, 1f // is it one of the 4 lsbits? (if so, check lower 4 bits) | ||
81 | addi \at, \at, 4 // no, increment result to upper 4 bits (of 8) | ||
82 | srli \as, \as, 4 // shift right 4 bits to check upper half | ||
83 | 1: bltui \as, 0x4, 1f // is it one of the 2 lsbits? (if so, check lower 2 bits) | ||
84 | addi \at, \at, 2 // no, increment result to upper 2 bits (of 4) | ||
85 | srli \as, \as, 2 // shift right 2 bits to check upper half | ||
86 | 1: bltui \as, 0x2, 1f // is it the lsbit? | ||
87 | addi \at, \at, 2 // no, increment result to upper bit (of 2) | ||
88 | 2: addi \at, \at, -1 // (from just above: add 1; from beqz: return -1) | ||
89 | //srli \as, \as, 1 | ||
90 | 1: // done! \at contains index of msbit set (or -1 if none set) | ||
91 | .if 0x\ad - 0x\at // destination different than \at ? (works because regs are a0-a15) | ||
92 | mov \ad, \at // then move result to \ad | ||
93 | .endif | ||
94 | #endif /* XCHAL_HAVE_NSA */ | ||
95 | .endm // find_ms_setbit | ||
96 | |||
97 | /*---------------------------------------------------------------------- | ||
98 | * find_ls_setbit | ||
99 | * | ||
100 | * This macro finds the least significant bit that is set in <as>, | ||
101 | * and return its index in <ad>. | ||
102 | * Usage is the same as for the find_ms_setbit macro. | ||
103 | * Example: | ||
104 | * find_ls_setbit a0, a4, a0, 0 -- return in a0 index of lsbit set in a4 | ||
105 | */ | ||
106 | |||
107 | .macro find_ls_setbit ad, as, at, base | ||
108 | neg \at, \as // keep only the least-significant bit that is set... | ||
109 | and \as, \at, \as // ... in \as | ||
110 | find_ms_setbit \ad, \as, \at, \base | ||
111 | .endm // find_ls_setbit | ||
112 | |||
113 | /*---------------------------------------------------------------------- | ||
114 | * find_ls_one | ||
115 | * | ||
116 | * Same as find_ls_setbit with base zero. | ||
117 | * Source (as) and destination (ad) registers must be different. | ||
118 | * Provided for backward compatibility. | ||
119 | */ | ||
120 | |||
121 | .macro find_ls_one ad, as | ||
122 | find_ls_setbit \ad, \as, \ad, 0 | ||
123 | .endm // find_ls_one | ||
124 | |||
125 | /*---------------------------------------------------------------------- | ||
126 | * floop, floopnez, floopgtz, floopend | ||
127 | * | ||
128 | * These macros are used for fast inner loops that | ||
129 | * work whether or not the Loops options is configured. | ||
130 | * If the Loops option is configured, they simply use | ||
131 | * the zero-overhead LOOP instructions; otherwise | ||
132 | * they use explicit decrement and branch instructions. | ||
133 | * | ||
134 | * They are used in pairs, with floop, floopnez or floopgtz | ||
135 | * at the beginning of the loop, and floopend at the end. | ||
136 | * | ||
137 | * Each pair of loop macro calls must be given the loop count | ||
138 | * address register and a unique label for that loop. | ||
139 | * | ||
140 | * Example: | ||
141 | * | ||
142 | * movi a3, 16 // loop 16 times | ||
143 | * floop a3, myloop1 | ||
144 | * : | ||
145 | * bnez a7, end1 // exit loop if a7 != 0 | ||
146 | * : | ||
147 | * floopend a3, myloop1 | ||
148 | * end1: | ||
149 | * | ||
150 | * Like the LOOP instructions, these macros cannot be | ||
151 | * nested, must include at least one instruction, | ||
152 | * cannot call functions inside the loop, etc. | ||
153 | * The loop can be exited by jumping to the instruction | ||
154 | * following floopend (or elsewhere outside the loop), | ||
155 | * or continued by jumping to a NOP instruction placed | ||
156 | * immediately before floopend. | ||
157 | * | ||
158 | * Unlike LOOP instructions, the register passed to floop* | ||
159 | * cannot be used inside the loop, because it is used as | ||
160 | * the loop counter if the Loops option is not configured. | ||
161 | * And its value is undefined after exiting the loop. | ||
162 | * And because the loop counter register is active inside | ||
163 | * the loop, you can't easily use this construct to loop | ||
164 | * across a register file using ROTW as you might with LOOP | ||
165 | * instructions, unless you copy the loop register along. | ||
166 | */ | ||
167 | |||
168 | /* Named label version of the macros: */ | ||
169 | |||
170 | .macro floop ar, endlabel | ||
171 | floop_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
172 | .endm | ||
173 | |||
174 | .macro floopnez ar, endlabel | ||
175 | floopnez_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
176 | .endm | ||
177 | |||
178 | .macro floopgtz ar, endlabel | ||
179 | floopgtz_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
180 | .endm | ||
181 | |||
182 | .macro floopend ar, endlabel | ||
183 | floopend_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
184 | .endm | ||
185 | |||
186 | /* Numbered local label version of the macros: */ | ||
187 | #if 0 /*UNTESTED*/ | ||
188 | .macro floop89 ar | ||
189 | floop_ \ar, 8, 9f | ||
190 | .endm | ||
191 | |||
192 | .macro floopnez89 ar | ||
193 | floopnez_ \ar, 8, 9f | ||
194 | .endm | ||
195 | |||
196 | .macro floopgtz89 ar | ||
197 | floopgtz_ \ar, 8, 9f | ||
198 | .endm | ||
199 | |||
200 | .macro floopend89 ar | ||
201 | floopend_ \ar, 8b, 9 | ||
202 | .endm | ||
203 | #endif /*0*/ | ||
204 | |||
205 | /* Underlying version of the macros: */ | ||
206 | |||
207 | .macro floop_ ar, startlabel, endlabelref | ||
208 | .ifdef _infloop_ | ||
209 | .if _infloop_ | ||
210 | .err // Error: floop cannot be nested | ||
211 | .endif | ||
212 | .endif | ||
213 | .set _infloop_, 1 | ||
214 | #if XCHAL_HAVE_LOOPS | ||
215 | loop \ar, \endlabelref | ||
216 | #else /* XCHAL_HAVE_LOOPS */ | ||
217 | \startlabel: | ||
218 | addi \ar, \ar, -1 | ||
219 | #endif /* XCHAL_HAVE_LOOPS */ | ||
220 | .endm // floop_ | ||
221 | |||
222 | .macro floopnez_ ar, startlabel, endlabelref | ||
223 | .ifdef _infloop_ | ||
224 | .if _infloop_ | ||
225 | .err // Error: floopnez cannot be nested | ||
226 | .endif | ||
227 | .endif | ||
228 | .set _infloop_, 1 | ||
229 | #if XCHAL_HAVE_LOOPS | ||
230 | loopnez \ar, \endlabelref | ||
231 | #else /* XCHAL_HAVE_LOOPS */ | ||
232 | beqz \ar, \endlabelref | ||
233 | \startlabel: | ||
234 | addi \ar, \ar, -1 | ||
235 | #endif /* XCHAL_HAVE_LOOPS */ | ||
236 | .endm // floopnez_ | ||
237 | |||
238 | .macro floopgtz_ ar, startlabel, endlabelref | ||
239 | .ifdef _infloop_ | ||
240 | .if _infloop_ | ||
241 | .err // Error: floopgtz cannot be nested | ||
242 | .endif | ||
243 | .endif | ||
244 | .set _infloop_, 1 | ||
245 | #if XCHAL_HAVE_LOOPS | ||
246 | loopgtz \ar, \endlabelref | ||
247 | #else /* XCHAL_HAVE_LOOPS */ | ||
248 | bltz \ar, \endlabelref | ||
249 | beqz \ar, \endlabelref | ||
250 | \startlabel: | ||
251 | addi \ar, \ar, -1 | ||
252 | #endif /* XCHAL_HAVE_LOOPS */ | ||
253 | .endm // floopgtz_ | ||
254 | |||
255 | |||
256 | .macro floopend_ ar, startlabelref, endlabel | ||
257 | .ifndef _infloop_ | ||
258 | .err // Error: floopend without matching floopXXX | ||
259 | .endif | ||
260 | .ifeq _infloop_ | ||
261 | .err // Error: floopend without matching floopXXX | ||
262 | .endif | ||
263 | .set _infloop_, 0 | ||
264 | #if ! XCHAL_HAVE_LOOPS | ||
265 | bnez \ar, \startlabelref | ||
266 | #endif /* XCHAL_HAVE_LOOPS */ | ||
267 | \endlabel: | ||
268 | .endm // floopend_ | ||
269 | |||
270 | /*---------------------------------------------------------------------- | ||
271 | * crsil -- conditional RSIL (read/set interrupt level) | ||
272 | * | ||
273 | * Executes the RSIL instruction if it exists, else just reads PS. | ||
274 | * The RSIL instruction does not exist in the new exception architecture | ||
275 | * if the interrupt option is not selected. | ||
276 | */ | ||
277 | |||
278 | .macro crsil ar, newlevel | ||
279 | #if XCHAL_HAVE_OLD_EXC_ARCH || XCHAL_HAVE_INTERRUPTS | ||
280 | rsil \ar, \newlevel | ||
281 | #else | ||
282 | rsr \ar, PS | ||
283 | #endif | ||
284 | .endm // crsil | ||
285 | |||
286 | /*---------------------------------------------------------------------- | ||
287 | * window_spill{4,8,12} | ||
288 | * | ||
289 | * These macros spill callers' register windows to the stack. | ||
290 | * They work for both privileged and non-privileged tasks. | ||
291 | * Must be called from a windowed ABI context, eg. within | ||
292 | * a windowed ABI function (ie. valid stack frame, window | ||
293 | * exceptions enabled, not in exception mode, etc). | ||
294 | * | ||
295 | * This macro requires a single invocation of the window_spill_common | ||
296 | * macro in the same assembly unit and section. | ||
297 | * | ||
298 | * Note that using window_spill{4,8,12} macros is more efficient | ||
299 | * than calling a function implemented using window_spill_function, | ||
300 | * because the latter needs extra code to figure out the size of | ||
301 | * the call to the spilling function. | ||
302 | * | ||
303 | * Example usage: | ||
304 | * | ||
305 | * .text | ||
306 | * .align 4 | ||
307 | * .global some_function | ||
308 | * .type some_function,@function | ||
309 | * some_function: | ||
310 | * entry a1, 16 | ||
311 | * : | ||
312 | * : | ||
313 | * | ||
314 | * window_spill4 // spill windows of some_function's callers; preserves a0..a3 only; | ||
315 | * // to use window_spill{8,12} in this example function we'd have | ||
316 | * // to increase space allocated by the entry instruction, because | ||
317 | * // 16 bytes only allows call4; 32 or 48 bytes (+locals) are needed | ||
318 | * // for call8/window_spill8 or call12/window_spill12 respectively. | ||
319 | * : | ||
320 | * | ||
321 | * retw | ||
322 | * | ||
323 | * window_spill_common // instantiates code used by window_spill4 | ||
324 | * | ||
325 | * | ||
326 | * On entry: | ||
327 | * none (if window_spill4) | ||
328 | * stack frame has enough space allocated for call8 (if window_spill8) | ||
329 | * stack frame has enough space allocated for call12 (if window_spill12) | ||
330 | * On exit: | ||
331 | * a4..a15 clobbered (if window_spill4) | ||
332 | * a8..a15 clobbered (if window_spill8) | ||
333 | * a12..a15 clobbered (if window_spill12) | ||
334 | * no caller windows are in live registers | ||
335 | */ | ||
336 | |||
337 | .macro window_spill4 | ||
338 | #if XCHAL_HAVE_WINDOWED | ||
339 | # if XCHAL_NUM_AREGS == 16 | ||
340 | movi a15, 0 // for 16-register files, no need to call to reach the end | ||
341 | # elif XCHAL_NUM_AREGS == 32 | ||
342 | call4 .L__wdwspill_assist28 // call deep enough to clear out any live callers | ||
343 | # elif XCHAL_NUM_AREGS == 64 | ||
344 | call4 .L__wdwspill_assist60 // call deep enough to clear out any live callers | ||
345 | # endif | ||
346 | #endif | ||
347 | .endm // window_spill4 | ||
348 | |||
349 | .macro window_spill8 | ||
350 | #if XCHAL_HAVE_WINDOWED | ||
351 | # if XCHAL_NUM_AREGS == 16 | ||
352 | movi a15, 0 // for 16-register files, no need to call to reach the end | ||
353 | # elif XCHAL_NUM_AREGS == 32 | ||
354 | call8 .L__wdwspill_assist24 // call deep enough to clear out any live callers | ||
355 | # elif XCHAL_NUM_AREGS == 64 | ||
356 | call8 .L__wdwspill_assist56 // call deep enough to clear out any live callers | ||
357 | # endif | ||
358 | #endif | ||
359 | .endm // window_spill8 | ||
360 | |||
361 | .macro window_spill12 | ||
362 | #if XCHAL_HAVE_WINDOWED | ||
363 | # if XCHAL_NUM_AREGS == 16 | ||
364 | movi a15, 0 // for 16-register files, no need to call to reach the end | ||
365 | # elif XCHAL_NUM_AREGS == 32 | ||
366 | call12 .L__wdwspill_assist20 // call deep enough to clear out any live callers | ||
367 | # elif XCHAL_NUM_AREGS == 64 | ||
368 | call12 .L__wdwspill_assist52 // call deep enough to clear out any live callers | ||
369 | # endif | ||
370 | #endif | ||
371 | .endm // window_spill12 | ||
372 | |||
373 | /*---------------------------------------------------------------------- | ||
374 | * window_spill_function | ||
375 | * | ||
376 | * This macro outputs a function that will spill its caller's callers' | ||
377 | * register windows to the stack. Eg. it could be used to implement | ||
378 | * a version of xthal_window_spill() that works in non-privileged tasks. | ||
379 | * This works for both privileged and non-privileged tasks. | ||
380 | * | ||
381 | * Typical usage: | ||
382 | * | ||
383 | * .text | ||
384 | * .align 4 | ||
385 | * .global my_spill_function | ||
386 | * .type my_spill_function,@function | ||
387 | * my_spill_function: | ||
388 | * window_spill_function | ||
389 | * | ||
390 | * On entry to resulting function: | ||
391 | * none | ||
392 | * On exit from resulting function: | ||
393 | * none (no caller windows are in live registers) | ||
394 | */ | ||
395 | |||
396 | .macro window_spill_function | ||
397 | #if XCHAL_HAVE_WINDOWED | ||
398 | # if XCHAL_NUM_AREGS == 32 | ||
399 | entry sp, 48 | ||
400 | bbci.l a0, 31, 1f // branch if called with call4 | ||
401 | bbsi.l a0, 30, 2f // branch if called with call12 | ||
402 | call8 .L__wdwspill_assist16 // called with call8, only need another 8 | ||
403 | retw | ||
404 | 1: call12 .L__wdwspill_assist16 // called with call4, only need another 12 | ||
405 | retw | ||
406 | 2: call4 .L__wdwspill_assist16 // called with call12, only need another 4 | ||
407 | retw | ||
408 | # elif XCHAL_NUM_AREGS == 64 | ||
409 | entry sp, 48 | ||
410 | bbci.l a0, 31, 1f // branch if called with call4 | ||
411 | bbsi.l a0, 30, 2f // branch if called with call12 | ||
412 | call4 .L__wdwspill_assist52 // called with call8, only need a call4 | ||
413 | retw | ||
414 | 1: call8 .L__wdwspill_assist52 // called with call4, only need a call8 | ||
415 | retw | ||
416 | 2: call12 .L__wdwspill_assist40 // called with call12, can skip a call12 | ||
417 | retw | ||
418 | # elif XCHAL_NUM_AREGS == 16 | ||
419 | entry sp, 16 | ||
420 | bbci.l a0, 31, 1f // branch if called with call4 | ||
421 | bbsi.l a0, 30, 2f // branch if called with call12 | ||
422 | movi a7, 0 // called with call8 | ||
423 | retw | ||
424 | 1: movi a11, 0 // called with call4 | ||
425 | 2: retw // if called with call12, everything already spilled | ||
426 | |||
427 | // movi a15, 0 // trick to spill all but the direct caller | ||
428 | // j 1f | ||
429 | // // The entry instruction is magical in the assembler (gets auto-aligned) | ||
430 | // // so we have to jump to it to avoid falling through the padding. | ||
431 | // // We need entry/retw to know where to return. | ||
432 | //1: entry sp, 16 | ||
433 | // retw | ||
434 | # else | ||
435 | # error "unrecognized address register file size" | ||
436 | # endif | ||
437 | #endif /* XCHAL_HAVE_WINDOWED */ | ||
438 | window_spill_common | ||
439 | .endm // window_spill_function | ||
440 | |||
441 | /*---------------------------------------------------------------------- | ||
442 | * window_spill_common | ||
443 | * | ||
444 | * Common code used by any number of invocations of the window_spill## | ||
445 | * and window_spill_function macros. | ||
446 | * | ||
447 | * Must be instantiated exactly once within a given assembly unit, | ||
448 | * within call/j range of and same section as window_spill## | ||
449 | * macro invocations for that assembly unit. | ||
450 | * (Is automatically instantiated by the window_spill_function macro.) | ||
451 | */ | ||
452 | |||
453 | .macro window_spill_common | ||
454 | #if XCHAL_HAVE_WINDOWED && (XCHAL_NUM_AREGS == 32 || XCHAL_NUM_AREGS == 64) | ||
455 | .ifndef .L__wdwspill_defined | ||
456 | # if XCHAL_NUM_AREGS >= 64 | ||
457 | .L__wdwspill_assist60: | ||
458 | entry sp, 32 | ||
459 | call8 .L__wdwspill_assist52 | ||
460 | retw | ||
461 | .L__wdwspill_assist56: | ||
462 | entry sp, 16 | ||
463 | call4 .L__wdwspill_assist52 | ||
464 | retw | ||
465 | .L__wdwspill_assist52: | ||
466 | entry sp, 48 | ||
467 | call12 .L__wdwspill_assist40 | ||
468 | retw | ||
469 | .L__wdwspill_assist40: | ||
470 | entry sp, 48 | ||
471 | call12 .L__wdwspill_assist28 | ||
472 | retw | ||
473 | # endif | ||
474 | .L__wdwspill_assist28: | ||
475 | entry sp, 48 | ||
476 | call12 .L__wdwspill_assist16 | ||
477 | retw | ||
478 | .L__wdwspill_assist24: | ||
479 | entry sp, 32 | ||
480 | call8 .L__wdwspill_assist16 | ||
481 | retw | ||
482 | .L__wdwspill_assist20: | ||
483 | entry sp, 16 | ||
484 | call4 .L__wdwspill_assist16 | ||
485 | retw | ||
486 | .L__wdwspill_assist16: | ||
487 | entry sp, 16 | ||
488 | movi a15, 0 | ||
489 | retw | ||
490 | .set .L__wdwspill_defined, 1 | ||
491 | .endif | ||
492 | #endif /* XCHAL_HAVE_WINDOWED with 32 or 64 aregs */ | ||
493 | .endm // window_spill_common | ||
494 | |||
495 | /*---------------------------------------------------------------------- | ||
496 | * beqi32 | ||
497 | * | ||
498 | * macro implements version of beqi for arbitrary 32-bit immidiate value | ||
499 | * | ||
500 | * beqi32 ax, ay, imm32, label | ||
501 | * | ||
502 | * Compares value in register ax with imm32 value and jumps to label if | ||
503 | * equal. Clobberes register ay if needed | ||
504 | * | ||
505 | */ | ||
506 | .macro beqi32 ax, ay, imm, label | ||
507 | .ifeq ((\imm-1) & ~7) // 1..8 ? | ||
508 | beqi \ax, \imm, \label | ||
509 | .else | ||
510 | .ifeq (\imm+1) // -1 ? | ||
511 | beqi \ax, \imm, \label | ||
512 | .else | ||
513 | .ifeq (\imm) // 0 ? | ||
514 | beqz \ax, \label | ||
515 | .else | ||
516 | // We could also handle immediates 10,12,16,32,64,128,256 | ||
517 | // but it would be a long macro... | ||
518 | movi \ay, \imm | ||
519 | beq \ax, \ay, \label | ||
520 | .endif | ||
521 | .endif | ||
522 | .endif | ||
523 | .endm // beqi32 | ||
524 | |||
525 | #endif /*XTENSA_COREASM_H*/ | ||
526 | |||
diff --git a/include/asm-xtensa/xtensa/corebits.h b/include/asm-xtensa/xtensa/corebits.h new file mode 100644 index 000000000000..e578ade41632 --- /dev/null +++ b/include/asm-xtensa/xtensa/corebits.h | |||
@@ -0,0 +1,77 @@ | |||
1 | #ifndef XTENSA_COREBITS_H | ||
2 | #define XTENSA_COREBITS_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * xtensa/corebits.h - Xtensa Special Register field positions and masks. | ||
8 | * | ||
9 | * (In previous releases, these were defined in specreg.h, a generated file. | ||
10 | * This file is not generated, i.e. it is processor configuration independent.) | ||
11 | */ | ||
12 | |||
13 | |||
14 | /* EXCCAUSE register fields: */ | ||
15 | #define EXCCAUSE_EXCCAUSE_SHIFT 0 | ||
16 | #define EXCCAUSE_EXCCAUSE_MASK 0x3F | ||
17 | /* Exception causes (mostly incomplete!): */ | ||
18 | #define EXCCAUSE_ILLEGAL 0 | ||
19 | #define EXCCAUSE_SYSCALL 1 | ||
20 | #define EXCCAUSE_IFETCHERROR 2 | ||
21 | #define EXCCAUSE_LOADSTOREERROR 3 | ||
22 | #define EXCCAUSE_LEVEL1INTERRUPT 4 | ||
23 | #define EXCCAUSE_ALLOCA 5 | ||
24 | |||
25 | /* PS register fields: */ | ||
26 | #define PS_WOE_SHIFT 18 | ||
27 | #define PS_WOE_MASK 0x00040000 | ||
28 | #define PS_WOE PS_WOE_MASK | ||
29 | #define PS_CALLINC_SHIFT 16 | ||
30 | #define PS_CALLINC_MASK 0x00030000 | ||
31 | #define PS_CALLINC(n) (((n)&3)<<PS_CALLINC_SHIFT) /* n = 0..3 */ | ||
32 | #define PS_OWB_SHIFT 8 | ||
33 | #define PS_OWB_MASK 0x00000F00 | ||
34 | #define PS_OWB(n) (((n)&15)<<PS_OWB_SHIFT) /* n = 0..15 (or 0..7) */ | ||
35 | #define PS_RING_SHIFT 6 | ||
36 | #define PS_RING_MASK 0x000000C0 | ||
37 | #define PS_RING(n) (((n)&3)<<PS_RING_SHIFT) /* n = 0..3 */ | ||
38 | #define PS_UM_SHIFT 5 | ||
39 | #define PS_UM_MASK 0x00000020 | ||
40 | #define PS_UM PS_UM_MASK | ||
41 | #define PS_EXCM_SHIFT 4 | ||
42 | #define PS_EXCM_MASK 0x00000010 | ||
43 | #define PS_EXCM PS_EXCM_MASK | ||
44 | #define PS_INTLEVEL_SHIFT 0 | ||
45 | #define PS_INTLEVEL_MASK 0x0000000F | ||
46 | #define PS_INTLEVEL(n) ((n)&PS_INTLEVEL_MASK) /* n = 0..15 */ | ||
47 | /* Backward compatibility (deprecated): */ | ||
48 | #define PS_PROGSTACK_SHIFT PS_UM_SHIFT | ||
49 | #define PS_PROGSTACK_MASK PS_UM_MASK | ||
50 | #define PS_PROG_SHIFT PS_UM_SHIFT | ||
51 | #define PS_PROG_MASK PS_UM_MASK | ||
52 | #define PS_PROG PS_UM | ||
53 | |||
54 | /* DBREAKCn register fields: */ | ||
55 | #define DBREAKC_MASK_SHIFT 0 | ||
56 | #define DBREAKC_MASK_MASK 0x0000003F | ||
57 | #define DBREAKC_LOADBREAK_SHIFT 30 | ||
58 | #define DBREAKC_LOADBREAK_MASK 0x40000000 | ||
59 | #define DBREAKC_STOREBREAK_SHIFT 31 | ||
60 | #define DBREAKC_STOREBREAK_MASK 0x80000000 | ||
61 | |||
62 | /* DEBUGCAUSE register fields: */ | ||
63 | #define DEBUGCAUSE_DEBUGINT_SHIFT 5 | ||
64 | #define DEBUGCAUSE_DEBUGINT_MASK 0x20 /* debug interrupt */ | ||
65 | #define DEBUGCAUSE_BREAKN_SHIFT 4 | ||
66 | #define DEBUGCAUSE_BREAKN_MASK 0x10 /* BREAK.N instruction */ | ||
67 | #define DEBUGCAUSE_BREAK_SHIFT 3 | ||
68 | #define DEBUGCAUSE_BREAK_MASK 0x08 /* BREAK instruction */ | ||
69 | #define DEBUGCAUSE_DBREAK_SHIFT 2 | ||
70 | #define DEBUGCAUSE_DBREAK_MASK 0x04 /* DBREAK match */ | ||
71 | #define DEBUGCAUSE_IBREAK_SHIFT 1 | ||
72 | #define DEBUGCAUSE_IBREAK_MASK 0x02 /* IBREAK match */ | ||
73 | #define DEBUGCAUSE_ICOUNT_SHIFT 0 | ||
74 | #define DEBUGCAUSE_ICOUNT_MASK 0x01 /* ICOUNT would increment to zero */ | ||
75 | |||
76 | #endif /*XTENSA_COREBITS_H*/ | ||
77 | |||
diff --git a/include/asm-xtensa/xtensa/hal.h b/include/asm-xtensa/xtensa/hal.h new file mode 100644 index 000000000000..d10472505454 --- /dev/null +++ b/include/asm-xtensa/xtensa/hal.h | |||
@@ -0,0 +1,822 @@ | |||
1 | #ifndef XTENSA_HAL_H | ||
2 | #define XTENSA_HAL_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/hal.h -- contains a definition of the | ||
8 | * Core HAL interface. | ||
9 | * | ||
10 | * All definitions in this header file are independent of any specific | ||
11 | * Xtensa processor configuration. Thus an OS or other software can | ||
12 | * include this header file and be compiled into configuration- | ||
13 | * independent objects that can be distributed and eventually linked | ||
14 | * to the HAL library (libhal.a) to create a configuration-specific | ||
15 | * final executable. | ||
16 | * | ||
17 | * Certain definitions, however, are release-specific -- such as the | ||
18 | * XTHAL_RELEASE_xxx macros (or additions made in later releases). | ||
19 | * | ||
20 | * This file is subject to the terms and conditions of the GNU General Public | ||
21 | * License. See the file "COPYING" in the main directory of this archive | ||
22 | * for more details. | ||
23 | * | ||
24 | * Copyright (C) 2002 Tensilica Inc. | ||
25 | */ | ||
26 | |||
27 | |||
28 | /*---------------------------------------------------------------------- | ||
29 | Constant Definitions | ||
30 | (shared with assembly) | ||
31 | ----------------------------------------------------------------------*/ | ||
32 | |||
33 | /* Software release information (not configuration-specific!): */ | ||
34 | #define XTHAL_RELEASE_MAJOR 1050 | ||
35 | #define XTHAL_RELEASE_MINOR 0 | ||
36 | #define XTHAL_RELEASE_NAME "T1050.0-2002-08-06-eng0" | ||
37 | #define XTHAL_RELEASE_INTERNAL "2002-08-06-eng0" | ||
38 | #define XTHAL_REL_T1050 1 | ||
39 | #define XTHAL_REL_T1050_0 1 | ||
40 | #define XTHAL_REL_T1050_0_2002 1 | ||
41 | #define XTHAL_REL_T1050_0_2002_08 1 | ||
42 | #define XTHAL_REL_T1050_0_2002_08_06 1 | ||
43 | #define XTHAL_REL_T1050_0_2002_08_06_ENG0 1 | ||
44 | |||
45 | /* HAL version numbers (these names are for backward compatibility): */ | ||
46 | #define XTHAL_MAJOR_REV XTHAL_RELEASE_MAJOR | ||
47 | #define XTHAL_MINOR_REV XTHAL_RELEASE_MINOR | ||
48 | /* | ||
49 | * A bit of software release history on values of XTHAL_{MAJOR,MINOR}_REV: | ||
50 | * | ||
51 | * Release MAJOR MINOR Comment | ||
52 | * ======= ===== ===== ======= | ||
53 | * T1015.n n/a n/a (HAL not yet available) | ||
54 | * T1020.{0,1,2} 0 1 (HAL beta) | ||
55 | * T1020.{3,4} 0 2 First release. | ||
56 | * T1020.n (n>4) 0 2 or >3 (TBD) | ||
57 | * T1030.0 0 1 (HAL beta) | ||
58 | * T1030.{1,2} 0 3 Equivalent to first release. | ||
59 | * T1030.n (n>=3) 0 >= 3 (TBD) | ||
60 | * T1040.n 1040 n Full CHAL available from T1040.2 | ||
61 | * T1050.n 1050 n Current release. | ||
62 | * | ||
63 | * | ||
64 | * Note: there is a distinction between the software release with | ||
65 | * which something is compiled (accessible using XTHAL_RELEASE_* macros) | ||
66 | * and the software release with which the HAL library was compiled | ||
67 | * (accessible using Xthal_release_* global variables). This | ||
68 | * distinction is particularly relevant for vendors that distribute | ||
69 | * configuration-independent binaries (eg. an OS), where their customer | ||
70 | * might link it with a HAL of a different Xtensa software release. | ||
71 | * In this case, it may be appropriate for the OS to verify at run-time | ||
72 | * whether XTHAL_RELEASE_* and Xthal_release_* are compatible. | ||
73 | * [Guidelines as to which release is compatible with which are not | ||
74 | * currently provided explicitly, but might be inferred from reading | ||
75 | * OSKit documentation for all releases -- compatibility is also highly | ||
76 | * dependent on which HAL features are used. Each release is usually | ||
77 | * backward compatible, with very few exceptions if any.] | ||
78 | * | ||
79 | * Notes: | ||
80 | * Tornado 2.0 supported in T1020.3+, T1030.1+, and T1040.{0,1} only. | ||
81 | * Tornado 2.0.2 supported in T1040.2+, and T1050. | ||
82 | * Compile-time HAL port of NucleusPlus supported by T1040.2+ and T1050. | ||
83 | */ | ||
84 | |||
85 | |||
86 | /* | ||
87 | * Architectural limits, independent of configuration. | ||
88 | * Note that these are ISA-defined limits, not micro-architecture implementation | ||
89 | * limits enforced by the Xtensa Processor Generator (which may be stricter than | ||
90 | * these below). | ||
91 | */ | ||
92 | #define XTHAL_MAX_CPS 8 /* max number of coprocessors (0..7) */ | ||
93 | #define XTHAL_MAX_INTERRUPTS 32 /* max number of interrupts (0..31) */ | ||
94 | #define XTHAL_MAX_INTLEVELS 16 /* max number of interrupt levels (0..15) */ | ||
95 | /* (as of T1040, implementation limit is 7: 0..6) */ | ||
96 | #define XTHAL_MAX_TIMERS 4 /* max number of timers (CCOMPARE0..CCOMPARE3) */ | ||
97 | /* (as of T1040, implementation limit is 3: 0..2) */ | ||
98 | |||
99 | /* Misc: */ | ||
100 | #define XTHAL_LITTLEENDIAN 0 | ||
101 | #define XTHAL_BIGENDIAN 1 | ||
102 | |||
103 | |||
104 | /* Interrupt types: */ | ||
105 | #define XTHAL_INTTYPE_UNCONFIGURED 0 | ||
106 | #define XTHAL_INTTYPE_SOFTWARE 1 | ||
107 | #define XTHAL_INTTYPE_EXTERN_EDGE 2 | ||
108 | #define XTHAL_INTTYPE_EXTERN_LEVEL 3 | ||
109 | #define XTHAL_INTTYPE_TIMER 4 | ||
110 | #define XTHAL_INTTYPE_NMI 5 | ||
111 | #define XTHAL_MAX_INTTYPES 6 /* number of interrupt types */ | ||
112 | |||
113 | /* Timer related: */ | ||
114 | #define XTHAL_TIMER_UNCONFIGURED -1 /* Xthal_timer_interrupt[] value for non-existent timers */ | ||
115 | #define XTHAL_TIMER_UNASSIGNED XTHAL_TIMER_UNCONFIGURED /* (for backwards compatibility only) */ | ||
116 | |||
117 | |||
118 | /* Access Mode bits (tentative): */ /* bit abbr unit short_name PPC equ - Description */ | ||
119 | #define XTHAL_AMB_EXCEPTION 0 /* 001 E EX fls: EXception none - generate exception on any access (aka "illegal") */ | ||
120 | #define XTHAL_AMB_HITCACHE 1 /* 002 C CH fls: use Cache on Hit ~(I CI) - use cache on hit -- way from tag match [or H HC, or U UC] (ISA: same, except for Isolate case) */ | ||
121 | #define XTHAL_AMB_ALLOCATE 2 /* 004 A AL fl?: ALlocate none - refill cache on miss -- way from LRU [or F FI fill] (ISA: Read/Write Miss Refill) */ | ||
122 | #define XTHAL_AMB_WRITETHRU 3 /* 008 W WT --s: WriteThrough W WT - store immediately to memory (ISA: same) */ | ||
123 | #define XTHAL_AMB_ISOLATE 4 /* 010 I IS fls: ISolate none - use cache regardless of hit-vs-miss -- way from vaddr (ISA: use-cache-on-miss+hit) */ | ||
124 | #define XTHAL_AMB_GUARD 5 /* 020 G GU ?l?: GUard G * - non-speculative; spec/replay refs not permitted */ | ||
125 | #if 0 | ||
126 | #define XTHAL_AMB_ORDERED x /* 000 O OR fls: ORdered G * - mem accesses cannot be out of order */ | ||
127 | #define XTHAL_AMB_FUSEWRITES x /* 000 F FW --s: FuseWrites none - allow combining/merging multiple writes (to same datapath data unit) into one (implied by writeback) */ | ||
128 | #define XTHAL_AMB_COHERENT x /* 000 M MC fl?: Mem/MP Coherent M - on reads, other CPUs/bus-masters may need to supply data */ | ||
129 | #define XTHAL_AMB_TRUSTED x /* 000 T TR ?l?: TRusted none - memory will not bus error (if it does, handle as fatal imprecise interrupt) */ | ||
130 | #define XTHAL_AMB_PREFETCH x /* 000 P PR fl?: PRefetch none - on refill, read line+1 into prefetch buffers */ | ||
131 | #define XTHAL_AMB_STREAM x /* 000 S ST ???: STreaming none - access one of N stream buffers */ | ||
132 | #endif /*0*/ | ||
133 | |||
134 | #define XTHAL_AM_EXCEPTION (1<<XTHAL_AMB_EXCEPTION) | ||
135 | #define XTHAL_AM_HITCACHE (1<<XTHAL_AMB_HITCACHE) | ||
136 | #define XTHAL_AM_ALLOCATE (1<<XTHAL_AMB_ALLOCATE) | ||
137 | #define XTHAL_AM_WRITETHRU (1<<XTHAL_AMB_WRITETHRU) | ||
138 | #define XTHAL_AM_ISOLATE (1<<XTHAL_AMB_ISOLATE) | ||
139 | #define XTHAL_AM_GUARD (1<<XTHAL_AMB_GUARD) | ||
140 | #if 0 | ||
141 | #define XTHAL_AM_ORDERED (1<<XTHAL_AMB_ORDERED) | ||
142 | #define XTHAL_AM_FUSEWRITES (1<<XTHAL_AMB_FUSEWRITES) | ||
143 | #define XTHAL_AM_COHERENT (1<<XTHAL_AMB_COHERENT) | ||
144 | #define XTHAL_AM_TRUSTED (1<<XTHAL_AMB_TRUSTED) | ||
145 | #define XTHAL_AM_PREFETCH (1<<XTHAL_AMB_PREFETCH) | ||
146 | #define XTHAL_AM_STREAM (1<<XTHAL_AMB_STREAM) | ||
147 | #endif /*0*/ | ||
148 | |||
149 | /* | ||
150 | * Allowed Access Modes (bit combinations). | ||
151 | * | ||
152 | * Columns are: | ||
153 | * "FOGIWACE" | ||
154 | * Access mode bits (see XTHAL_AMB_xxx above). | ||
155 | * <letter> = bit is set | ||
156 | * '-' = bit is clear | ||
157 | * '.' = bit is irrelevant / don't care, as follows: | ||
158 | * E=1 makes all others irrelevant | ||
159 | * W,F relevant only for stores | ||
160 | * "2345" | ||
161 | * Indicates which Xtensa releases support the corresponding | ||
162 | * access mode. Releases for each character column are: | ||
163 | * 2 = prior to T1020.2: T1015 (V1.5), T1020.0, T1020.1 | ||
164 | * 3 = T1020.2 and later: T1020.2+, T1030 | ||
165 | * 4 = T1040 | ||
166 | * 5 = T1050 (maybe) | ||
167 | * And the character column contents are: | ||
168 | * <number> = support by release(s) | ||
169 | * "." = unsupported by release(s) | ||
170 | * "?" = support unknown | ||
171 | */ | ||
172 | /* FOGIWACE 2345 */ | ||
173 | /* For instruction fetch: */ | ||
174 | #define XTHAL_FAM_EXCEPTION 0x001 /* .......E 2345 exception */ | ||
175 | #define XTHAL_FAM_ISOLATE 0x012 /* .--I.-C- .... isolate */ | ||
176 | #define XTHAL_FAM_BYPASS 0x000 /* .---.--- 2345 bypass */ | ||
177 | #define XTHAL_FAM_NACACHED 0x002 /* .---.-C- .... cached no-allocate (frozen) */ | ||
178 | #define XTHAL_FAM_CACHED 0x006 /* .---.AC- 2345 cached */ | ||
179 | /* For data load: */ | ||
180 | #define XTHAL_LAM_EXCEPTION 0x001 /* .......E 2345 exception */ | ||
181 | #define XTHAL_LAM_ISOLATE 0x012 /* .--I.-C- 2345 isolate */ | ||
182 | #define XTHAL_LAM_BYPASS 0x000 /* .O--.--- 2... bypass speculative */ | ||
183 | #define XTHAL_LAM_BYPASSG 0x020 /* .OG-.--- .345 bypass guarded */ | ||
184 | #define XTHAL_LAM_NACACHED 0x002 /* .O--.-C- 2... cached no-allocate speculative */ | ||
185 | #define XTHAL_LAM_NACACHEDG 0x022 /* .OG-.-C- .345 cached no-allocate guarded */ | ||
186 | #define XTHAL_LAM_CACHED 0x006 /* .---.AC- 2345 cached speculative */ | ||
187 | #define XTHAL_LAM_CACHEDG 0x026 /* .?G-.AC- .... cached guarded */ | ||
188 | /* For data store: */ | ||
189 | #define XTHAL_SAM_EXCEPTION 0x001 /* .......E 2345 exception */ | ||
190 | #define XTHAL_SAM_ISOLATE 0x032 /* .-GI--C- 2345 isolate */ | ||
191 | #define XTHAL_SAM_BYPASS 0x028 /* -OG-W--- 2345 bypass */ | ||
192 | /*efine XTHAL_SAM_BYPASSF 0x028*/ /* F-G-W--- ...? bypass write-combined */ | ||
193 | #define XTHAL_SAM_WRITETHRU 0x02A /* -OG-W-C- 234? writethrough */ | ||
194 | /*efine XTHAL_SAM_WRITETHRUF 0x02A*/ /* F-G-W-C- ...5 writethrough write-combined */ | ||
195 | #define XTHAL_SAM_WRITEALLOC 0x02E /* -OG-WAC- ...? writethrough-allocate */ | ||
196 | /*efine XTHAL_SAM_WRITEALLOCF 0x02E*/ /* F-G-WAC- ...? writethrough-allocate write-combined */ | ||
197 | #define XTHAL_SAM_WRITEBACK 0x026 /* F-G--AC- ...5 writeback */ | ||
198 | |||
199 | #if 0 | ||
200 | /* | ||
201 | Cache attribute encoding for CACHEATTR (per ISA): | ||
202 | (Note: if this differs from ISA Ref Manual, ISA has precedence) | ||
203 | |||
204 | Inst-fetches Loads Stores | ||
205 | ------------- ------------ ------------- | ||
206 | 0x0 FCA_EXCEPTION ?LCA_NACACHED_G* SCA_WRITETHRU "uncached" | ||
207 | 0x1 FCA_CACHED LCA_CACHED SCA_WRITETHRU cached | ||
208 | 0x2 FCA_BYPASS LCA_BYPASS_G* SCA_BYPASS bypass | ||
209 | 0x3 FCA_CACHED LCA_CACHED SCA_WRITEALLOCF write-allocate | ||
210 | or LCA_EXCEPTION SCA_EXCEPTION (if unimplemented) | ||
211 | 0x4 FCA_CACHED LCA_CACHED SCA_WRITEBACK write-back | ||
212 | or LCA_EXCEPTION SCA_EXCEPTION (if unimplemented) | ||
213 | 0x5..D FCA_EXCEPTION LCA_EXCEPTION SCA_EXCEPTION (reserved) | ||
214 | 0xE FCA_EXCEPTION LCA_ISOLATE SCA_ISOLATE isolate | ||
215 | 0xF FCA_EXCEPTION LCA_EXCEPTION SCA_EXCEPTION illegal | ||
216 | * Prior to T1020.2?, guard feature not supported, this defaulted to speculative (no _G) | ||
217 | */ | ||
218 | #endif /*0*/ | ||
219 | |||
220 | |||
221 | #if !defined(__ASSEMBLY__) && !defined(_NOCLANGUAGE) | ||
222 | #ifdef __cplusplus | ||
223 | extern "C" { | ||
224 | #endif | ||
225 | |||
226 | /*---------------------------------------------------------------------- | ||
227 | HAL | ||
228 | ----------------------------------------------------------------------*/ | ||
229 | |||
230 | /* Constant to be checked in build = (XTHAL_MAJOR_REV<<16)|XTHAL_MINOR_REV */ | ||
231 | extern const unsigned int Xthal_rev_no; | ||
232 | |||
233 | |||
234 | /*---------------------------------------------------------------------- | ||
235 | Processor State | ||
236 | ----------------------------------------------------------------------*/ | ||
237 | /* save & restore the extra processor state */ | ||
238 | extern void xthal_save_extra(void *base); | ||
239 | extern void xthal_restore_extra(void *base); | ||
240 | |||
241 | extern void xthal_save_cpregs(void *base, int); | ||
242 | extern void xthal_restore_cpregs(void *base, int); | ||
243 | |||
244 | /*extern void xthal_save_all_extra(void *base);*/ | ||
245 | /*extern void xthal_restore_all_extra(void *base);*/ | ||
246 | |||
247 | /* space for processor state */ | ||
248 | extern const unsigned int Xthal_extra_size; | ||
249 | extern const unsigned int Xthal_extra_align; | ||
250 | /* space for TIE register files */ | ||
251 | extern const unsigned int Xthal_cpregs_size[XTHAL_MAX_CPS]; | ||
252 | extern const unsigned int Xthal_cpregs_align[XTHAL_MAX_CPS]; | ||
253 | |||
254 | /* total of space for the processor state (for Tor2) */ | ||
255 | extern const unsigned int Xthal_all_extra_size; | ||
256 | extern const unsigned int Xthal_all_extra_align; | ||
257 | |||
258 | /* initialize the extra processor */ | ||
259 | /*extern void xthal_init_extra(void);*/ | ||
260 | /* initialize the TIE coprocessor */ | ||
261 | /*extern void xthal_init_cp(int);*/ | ||
262 | |||
263 | /* initialize the extra processor */ | ||
264 | extern void xthal_init_mem_extra(void *); | ||
265 | /* initialize the TIE coprocessor */ | ||
266 | extern void xthal_init_mem_cp(void *, int); | ||
267 | |||
268 | /* validate & invalidate the TIE register file */ | ||
269 | extern void xthal_validate_cp(int); | ||
270 | extern void xthal_invalidate_cp(int); | ||
271 | |||
272 | /* the number of TIE coprocessors contiguous from zero (for Tor2) */ | ||
273 | extern const unsigned int Xthal_num_coprocessors; | ||
274 | |||
275 | /* actual number of coprocessors */ | ||
276 | extern const unsigned char Xthal_cp_num; | ||
277 | /* index of highest numbered coprocessor, plus one */ | ||
278 | extern const unsigned char Xthal_cp_max; | ||
279 | /* index of highest allowed coprocessor number, per cfg, plus one */ | ||
280 | /*extern const unsigned char Xthal_cp_maxcfg;*/ | ||
281 | /* bitmask of which coprocessors are present */ | ||
282 | extern const unsigned int Xthal_cp_mask; | ||
283 | |||
284 | /* read and write cpenable register */ | ||
285 | extern void xthal_set_cpenable(unsigned); | ||
286 | extern unsigned xthal_get_cpenable(void); | ||
287 | |||
288 | /* read & write extra state register */ | ||
289 | /*extern int xthal_read_extra(void *base, unsigned reg, unsigned *value);*/ | ||
290 | /*extern int xthal_write_extra(void *base, unsigned reg, unsigned value);*/ | ||
291 | |||
292 | /* read & write a TIE coprocessor register */ | ||
293 | /*extern int xthal_read_cpreg(void *base, int cp, unsigned reg, unsigned *value);*/ | ||
294 | /*extern int xthal_write_cpreg(void *base, int cp, unsigned reg, unsigned value);*/ | ||
295 | |||
296 | /* return coprocessor number based on register */ | ||
297 | /*extern int xthal_which_cp(unsigned reg);*/ | ||
298 | |||
299 | /*---------------------------------------------------------------------- | ||
300 | Interrupts | ||
301 | ----------------------------------------------------------------------*/ | ||
302 | |||
303 | /* the number of interrupt levels */ | ||
304 | extern const unsigned char Xthal_num_intlevels; | ||
305 | /* the number of interrupts */ | ||
306 | extern const unsigned char Xthal_num_interrupts; | ||
307 | |||
308 | /* mask for level of interrupts */ | ||
309 | extern const unsigned int Xthal_intlevel_mask[XTHAL_MAX_INTLEVELS]; | ||
310 | /* mask for level 0 to N interrupts */ | ||
311 | extern const unsigned int Xthal_intlevel_andbelow_mask[XTHAL_MAX_INTLEVELS]; | ||
312 | |||
313 | /* level of each interrupt */ | ||
314 | extern const unsigned char Xthal_intlevel[XTHAL_MAX_INTERRUPTS]; | ||
315 | |||
316 | /* type per interrupt */ | ||
317 | extern const unsigned char Xthal_inttype[XTHAL_MAX_INTERRUPTS]; | ||
318 | |||
319 | /* masks of each type of interrupt */ | ||
320 | extern const unsigned int Xthal_inttype_mask[XTHAL_MAX_INTTYPES]; | ||
321 | |||
322 | /* interrupt numbers assigned to each timer interrupt */ | ||
323 | extern const int Xthal_timer_interrupt[XTHAL_MAX_TIMERS]; | ||
324 | |||
325 | /*** Virtual interrupt prioritization: ***/ | ||
326 | |||
327 | /* Convert between interrupt levels (as per PS.INTLEVEL) and virtual interrupt priorities: */ | ||
328 | extern unsigned xthal_vpri_to_intlevel(unsigned vpri); | ||
329 | extern unsigned xthal_intlevel_to_vpri(unsigned intlevel); | ||
330 | |||
331 | /* Enables/disables given set (mask) of interrupts; returns previous enabled-mask of all ints: */ | ||
332 | extern unsigned xthal_int_enable(unsigned); | ||
333 | extern unsigned xthal_int_disable(unsigned); | ||
334 | |||
335 | /* Set/get virtual priority of an interrupt: */ | ||
336 | extern int xthal_set_int_vpri(int intnum, int vpri); | ||
337 | extern int xthal_get_int_vpri(int intnum); | ||
338 | |||
339 | /* Set/get interrupt lockout level for exclusive access to virtual priority data structures: */ | ||
340 | extern void xthal_set_vpri_locklevel(unsigned intlevel); | ||
341 | extern unsigned xthal_get_vpri_locklevel(void); | ||
342 | |||
343 | /* Set/get current virtual interrupt priority: */ | ||
344 | extern unsigned xthal_set_vpri(unsigned vpri); | ||
345 | extern unsigned xthal_get_vpri(unsigned vpri); | ||
346 | extern unsigned xthal_set_vpri_intlevel(unsigned intlevel); | ||
347 | extern unsigned xthal_set_vpri_lock(void); | ||
348 | |||
349 | |||
350 | |||
351 | /*---------------------------------------------------------------------- | ||
352 | Generic Interrupt Trampolining Support | ||
353 | ----------------------------------------------------------------------*/ | ||
354 | |||
355 | typedef void (XtHalVoidFunc)(void); | ||
356 | |||
357 | /* | ||
358 | * Bitmask of interrupts currently trampolining down: | ||
359 | */ | ||
360 | extern unsigned Xthal_tram_pending; | ||
361 | |||
362 | /* | ||
363 | * Bitmask of which interrupts currently trampolining down | ||
364 | * synchronously are actually enabled; this bitmask is necessary | ||
365 | * because INTENABLE cannot hold that state (sync-trampolining | ||
366 | * interrupts must be kept disabled while trampolining); | ||
367 | * in the current implementation, any bit set here is not set | ||
368 | * in INTENABLE, and vice-versa; once a sync-trampoline is | ||
369 | * handled (at level one), its enable bit must be moved from | ||
370 | * here to INTENABLE: | ||
371 | */ | ||
372 | extern unsigned Xthal_tram_enabled; | ||
373 | |||
374 | /* | ||
375 | * Bitmask of interrupts configured for sync trampolining: | ||
376 | */ | ||
377 | extern unsigned Xthal_tram_sync; | ||
378 | |||
379 | |||
380 | /* Trampoline support functions: */ | ||
381 | extern unsigned xthal_tram_pending_to_service( void ); | ||
382 | extern void xthal_tram_done( unsigned serviced_mask ); | ||
383 | extern int xthal_tram_set_sync( int intnum, int sync ); | ||
384 | extern XtHalVoidFunc* xthal_set_tram_trigger_func( XtHalVoidFunc *trigger_fn ); | ||
385 | |||
386 | /* INTENABLE,INTREAD,INTSET,INTCLEAR register access functions: */ | ||
387 | extern unsigned xthal_get_intenable( void ); | ||
388 | extern void xthal_set_intenable( unsigned ); | ||
389 | extern unsigned xthal_get_intread( void ); | ||
390 | extern void xthal_set_intset( unsigned ); | ||
391 | extern void xthal_set_intclear( unsigned ); | ||
392 | |||
393 | |||
394 | /*---------------------------------------------------------------------- | ||
395 | Register Windows | ||
396 | ----------------------------------------------------------------------*/ | ||
397 | |||
398 | /* number of registers in register window */ | ||
399 | extern const unsigned int Xthal_num_aregs; | ||
400 | extern const unsigned char Xthal_num_aregs_log2; | ||
401 | |||
402 | /* This spill any live register windows (other than the caller's): */ | ||
403 | extern void xthal_window_spill( void ); | ||
404 | |||
405 | |||
406 | /*---------------------------------------------------------------------- | ||
407 | Cache | ||
408 | ----------------------------------------------------------------------*/ | ||
409 | |||
410 | /* size of the cache lines in log2(bytes) */ | ||
411 | extern const unsigned char Xthal_icache_linewidth; | ||
412 | extern const unsigned char Xthal_dcache_linewidth; | ||
413 | /* size of the cache lines in bytes */ | ||
414 | extern const unsigned short Xthal_icache_linesize; | ||
415 | extern const unsigned short Xthal_dcache_linesize; | ||
416 | /* number of cache sets in log2(lines per way) */ | ||
417 | extern const unsigned char Xthal_icache_setwidth; | ||
418 | extern const unsigned char Xthal_dcache_setwidth; | ||
419 | /* cache set associativity (number of ways) */ | ||
420 | extern const unsigned int Xthal_icache_ways; | ||
421 | extern const unsigned int Xthal_dcache_ways; | ||
422 | /* size of the caches in bytes (ways * 2^(linewidth + setwidth)) */ | ||
423 | extern const unsigned int Xthal_icache_size; | ||
424 | extern const unsigned int Xthal_dcache_size; | ||
425 | /* cache features */ | ||
426 | extern const unsigned char Xthal_dcache_is_writeback; | ||
427 | extern const unsigned char Xthal_icache_line_lockable; | ||
428 | extern const unsigned char Xthal_dcache_line_lockable; | ||
429 | |||
430 | /* cache attribute register control (used by other HAL routines) */ | ||
431 | extern unsigned xthal_get_cacheattr( void ); | ||
432 | extern unsigned xthal_get_icacheattr( void ); | ||
433 | extern unsigned xthal_get_dcacheattr( void ); | ||
434 | extern void xthal_set_cacheattr( unsigned ); | ||
435 | extern void xthal_set_icacheattr( unsigned ); | ||
436 | extern void xthal_set_dcacheattr( unsigned ); | ||
437 | |||
438 | /* initialize cache support (must be called once at startup, before all other cache calls) */ | ||
439 | /*extern void xthal_cache_startinit( void );*/ | ||
440 | /* reset caches */ | ||
441 | /*extern void xthal_icache_reset( void );*/ | ||
442 | /*extern void xthal_dcache_reset( void );*/ | ||
443 | /* enable caches */ | ||
444 | extern void xthal_icache_enable( void ); /* DEPRECATED */ | ||
445 | extern void xthal_dcache_enable( void ); /* DEPRECATED */ | ||
446 | /* disable caches */ | ||
447 | extern void xthal_icache_disable( void ); /* DEPRECATED */ | ||
448 | extern void xthal_dcache_disable( void ); /* DEPRECATED */ | ||
449 | |||
450 | /* invalidate the caches */ | ||
451 | extern void xthal_icache_all_invalidate( void ); | ||
452 | extern void xthal_dcache_all_invalidate( void ); | ||
453 | extern void xthal_icache_region_invalidate( void *addr, unsigned size ); | ||
454 | extern void xthal_dcache_region_invalidate( void *addr, unsigned size ); | ||
455 | extern void xthal_icache_line_invalidate(void *addr); | ||
456 | extern void xthal_dcache_line_invalidate(void *addr); | ||
457 | /* write dirty data back */ | ||
458 | extern void xthal_dcache_all_writeback( void ); | ||
459 | extern void xthal_dcache_region_writeback( void *addr, unsigned size ); | ||
460 | extern void xthal_dcache_line_writeback(void *addr); | ||
461 | /* write dirty data back and invalidate */ | ||
462 | extern void xthal_dcache_all_writeback_inv( void ); | ||
463 | extern void xthal_dcache_region_writeback_inv( void *addr, unsigned size ); | ||
464 | extern void xthal_dcache_line_writeback_inv(void *addr); | ||
465 | /* prefetch and lock specified memory range into cache */ | ||
466 | extern void xthal_icache_region_lock( void *addr, unsigned size ); | ||
467 | extern void xthal_dcache_region_lock( void *addr, unsigned size ); | ||
468 | extern void xthal_icache_line_lock(void *addr); | ||
469 | extern void xthal_dcache_line_lock(void *addr); | ||
470 | /* unlock from cache */ | ||
471 | extern void xthal_icache_all_unlock( void ); | ||
472 | extern void xthal_dcache_all_unlock( void ); | ||
473 | extern void xthal_icache_region_unlock( void *addr, unsigned size ); | ||
474 | extern void xthal_dcache_region_unlock( void *addr, unsigned size ); | ||
475 | extern void xthal_icache_line_unlock(void *addr); | ||
476 | extern void xthal_dcache_line_unlock(void *addr); | ||
477 | |||
478 | |||
479 | /* sync icache and memory */ | ||
480 | extern void xthal_icache_sync( void ); | ||
481 | /* sync dcache and memory */ | ||
482 | extern void xthal_dcache_sync( void ); | ||
483 | |||
484 | /*---------------------------------------------------------------------- | ||
485 | Debug | ||
486 | ----------------------------------------------------------------------*/ | ||
487 | |||
488 | /* 1 if debug option configured, 0 if not: */ | ||
489 | extern const int Xthal_debug_configured; | ||
490 | |||
491 | /* Number of instruction and data break registers: */ | ||
492 | extern const int Xthal_num_ibreak; | ||
493 | extern const int Xthal_num_dbreak; | ||
494 | |||
495 | /* Set (plant) and remove software breakpoint, both synchronizing cache: */ | ||
496 | extern unsigned int xthal_set_soft_break(void *addr); | ||
497 | extern void xthal_remove_soft_break(void *addr, unsigned int); | ||
498 | |||
499 | |||
500 | /*---------------------------------------------------------------------- | ||
501 | Disassembler | ||
502 | ----------------------------------------------------------------------*/ | ||
503 | |||
504 | /* Max expected size of the return buffer for a disassembled instruction (hint only): */ | ||
505 | #define XTHAL_DISASM_BUFSIZE 80 | ||
506 | |||
507 | /* Disassembly option bits for selecting what to return: */ | ||
508 | #define XTHAL_DISASM_OPT_ADDR 0x0001 /* display address */ | ||
509 | #define XTHAL_DISASM_OPT_OPHEX 0x0002 /* display opcode bytes in hex */ | ||
510 | #define XTHAL_DISASM_OPT_OPCODE 0x0004 /* display opcode name (mnemonic) */ | ||
511 | #define XTHAL_DISASM_OPT_PARMS 0x0008 /* display parameters */ | ||
512 | #define XTHAL_DISASM_OPT_ALL 0x0FFF /* display everything */ | ||
513 | |||
514 | /* routine to get a string for the disassembled instruction */ | ||
515 | extern int xthal_disassemble( unsigned char *instr_buf, void *tgt_addr, | ||
516 | char *buffer, unsigned buflen, unsigned options ); | ||
517 | |||
518 | /* routine to get the size of the next instruction. Returns 0 for | ||
519 | illegal instruction */ | ||
520 | extern int xthal_disassemble_size( unsigned char *instr_buf ); | ||
521 | |||
522 | |||
523 | /*---------------------------------------------------------------------- | ||
524 | Core Counter | ||
525 | ----------------------------------------------------------------------*/ | ||
526 | |||
527 | /* counter info */ | ||
528 | extern const unsigned char Xthal_have_ccount; /* set if CCOUNT register present */ | ||
529 | extern const unsigned char Xthal_num_ccompare; /* number of CCOMPAREn registers */ | ||
530 | |||
531 | /* get CCOUNT register (if not present return 0) */ | ||
532 | extern unsigned xthal_get_ccount(void); | ||
533 | |||
534 | /* set and get CCOMPAREn registers (if not present, get returns 0) */ | ||
535 | extern void xthal_set_ccompare(int, unsigned); | ||
536 | extern unsigned xthal_get_ccompare(int); | ||
537 | |||
538 | |||
539 | /*---------------------------------------------------------------------- | ||
540 | Instruction/Data RAM/ROM Access | ||
541 | ----------------------------------------------------------------------*/ | ||
542 | |||
543 | extern void* xthal_memcpy(void *dst, const void *src, unsigned len); | ||
544 | extern void* xthal_bcopy(const void *src, void *dst, unsigned len); | ||
545 | |||
546 | /*---------------------------------------------------------------------- | ||
547 | MP Synchronization | ||
548 | ----------------------------------------------------------------------*/ | ||
549 | extern int xthal_compare_and_set( int *addr, int test_val, int compare_val ); | ||
550 | extern unsigned xthal_get_prid( void ); | ||
551 | |||
552 | /*extern const char Xthal_have_s32c1i;*/ | ||
553 | extern const unsigned char Xthal_have_prid; | ||
554 | |||
555 | |||
556 | /*---------------------------------------------------------------------- | ||
557 | Miscellaneous | ||
558 | ----------------------------------------------------------------------*/ | ||
559 | |||
560 | extern const unsigned int Xthal_release_major; | ||
561 | extern const unsigned int Xthal_release_minor; | ||
562 | extern const char * const Xthal_release_name; | ||
563 | extern const char * const Xthal_release_internal; | ||
564 | |||
565 | extern const unsigned char Xthal_memory_order; | ||
566 | extern const unsigned char Xthal_have_windowed; | ||
567 | extern const unsigned char Xthal_have_density; | ||
568 | extern const unsigned char Xthal_have_booleans; | ||
569 | extern const unsigned char Xthal_have_loops; | ||
570 | extern const unsigned char Xthal_have_nsa; | ||
571 | extern const unsigned char Xthal_have_minmax; | ||
572 | extern const unsigned char Xthal_have_sext; | ||
573 | extern const unsigned char Xthal_have_clamps; | ||
574 | extern const unsigned char Xthal_have_mac16; | ||
575 | extern const unsigned char Xthal_have_mul16; | ||
576 | extern const unsigned char Xthal_have_fp; | ||
577 | extern const unsigned char Xthal_have_speculation; | ||
578 | extern const unsigned char Xthal_have_exceptions; | ||
579 | extern const unsigned char Xthal_xea_version; | ||
580 | extern const unsigned char Xthal_have_interrupts; | ||
581 | extern const unsigned char Xthal_have_highlevel_interrupts; | ||
582 | extern const unsigned char Xthal_have_nmi; | ||
583 | |||
584 | extern const unsigned short Xthal_num_writebuffer_entries; | ||
585 | |||
586 | extern const unsigned int Xthal_build_unique_id; | ||
587 | /* Release info for hardware targeted by software upgrades: */ | ||
588 | extern const unsigned int Xthal_hw_configid0; | ||
589 | extern const unsigned int Xthal_hw_configid1; | ||
590 | extern const unsigned int Xthal_hw_release_major; | ||
591 | extern const unsigned int Xthal_hw_release_minor; | ||
592 | extern const char * const Xthal_hw_release_name; | ||
593 | extern const char * const Xthal_hw_release_internal; | ||
594 | |||
595 | |||
596 | /* Internal memories... */ | ||
597 | |||
598 | extern const unsigned char Xthal_num_instrom; | ||
599 | extern const unsigned char Xthal_num_instram; | ||
600 | extern const unsigned char Xthal_num_datarom; | ||
601 | extern const unsigned char Xthal_num_dataram; | ||
602 | extern const unsigned char Xthal_num_xlmi; | ||
603 | extern const unsigned int Xthal_instrom_vaddr[1]; | ||
604 | extern const unsigned int Xthal_instrom_paddr[1]; | ||
605 | extern const unsigned int Xthal_instrom_size [1]; | ||
606 | extern const unsigned int Xthal_instram_vaddr[1]; | ||
607 | extern const unsigned int Xthal_instram_paddr[1]; | ||
608 | extern const unsigned int Xthal_instram_size [1]; | ||
609 | extern const unsigned int Xthal_datarom_vaddr[1]; | ||
610 | extern const unsigned int Xthal_datarom_paddr[1]; | ||
611 | extern const unsigned int Xthal_datarom_size [1]; | ||
612 | extern const unsigned int Xthal_dataram_vaddr[1]; | ||
613 | extern const unsigned int Xthal_dataram_paddr[1]; | ||
614 | extern const unsigned int Xthal_dataram_size [1]; | ||
615 | extern const unsigned int Xthal_xlmi_vaddr[1]; | ||
616 | extern const unsigned int Xthal_xlmi_paddr[1]; | ||
617 | extern const unsigned int Xthal_xlmi_size [1]; | ||
618 | |||
619 | |||
620 | |||
621 | /*---------------------------------------------------------------------- | ||
622 | Memory Management Unit | ||
623 | ----------------------------------------------------------------------*/ | ||
624 | |||
625 | extern const unsigned char Xthal_have_spanning_way; | ||
626 | extern const unsigned char Xthal_have_identity_map; | ||
627 | extern const unsigned char Xthal_have_mimic_cacheattr; | ||
628 | extern const unsigned char Xthal_have_xlt_cacheattr; | ||
629 | extern const unsigned char Xthal_have_cacheattr; | ||
630 | extern const unsigned char Xthal_have_tlbs; | ||
631 | |||
632 | extern const unsigned char Xthal_mmu_asid_bits; /* 0 .. 8 */ | ||
633 | extern const unsigned char Xthal_mmu_asid_kernel; | ||
634 | extern const unsigned char Xthal_mmu_rings; /* 1 .. 4 (perhaps 0 if no MMU and/or no protection?) */ | ||
635 | extern const unsigned char Xthal_mmu_ring_bits; | ||
636 | extern const unsigned char Xthal_mmu_sr_bits; | ||
637 | extern const unsigned char Xthal_mmu_ca_bits; | ||
638 | extern const unsigned int Xthal_mmu_max_pte_page_size; | ||
639 | extern const unsigned int Xthal_mmu_min_pte_page_size; | ||
640 | |||
641 | extern const unsigned char Xthal_itlb_way_bits; | ||
642 | extern const unsigned char Xthal_itlb_ways; | ||
643 | extern const unsigned char Xthal_itlb_arf_ways; | ||
644 | extern const unsigned char Xthal_dtlb_way_bits; | ||
645 | extern const unsigned char Xthal_dtlb_ways; | ||
646 | extern const unsigned char Xthal_dtlb_arf_ways; | ||
647 | |||
648 | /* Convert between virtual and physical addresses (through static maps only): */ | ||
649 | /*** WARNING: these two functions may go away in a future release; don't depend on them! ***/ | ||
650 | extern int xthal_static_v2p( unsigned vaddr, unsigned *paddrp ); | ||
651 | extern int xthal_static_p2v( unsigned paddr, unsigned *vaddrp, unsigned cached ); | ||
652 | |||
653 | #if 0 | ||
654 | /******************* EXPERIMENTAL AND TENTATIVE ONLY ********************/ | ||
655 | |||
656 | #define XTHAL_MMU_PAGESZ_COUNT_MAX 8 /* maximum number of different page sizes */ | ||
657 | extern const char Xthal_mmu_pagesz_count; /* 0 .. 8 number of different page sizes configured */ | ||
658 | |||
659 | /* Note: the following table doesn't necessarily have page sizes in increasing order: */ | ||
660 | extern const char Xthal_mmu_pagesz_log2[XTHAL_MMU_PAGESZ_COUNT_MAX]; /* 10 .. 28 (0 past count) */ | ||
661 | |||
662 | /* Sorted (increasing) table of page sizes, that indexes into the above table: */ | ||
663 | extern const char Xthal_mmu_pagesz_sorted[XTHAL_MMU_PAGESZ_COUNT_MAX]; /* 0 .. 7 (0 past count) */ | ||
664 | |||
665 | /*u32 Xthal_virtual_exceptions;*/ /* bitmask of which exceptions execute in virtual mode... */ | ||
666 | |||
667 | extern const char Xthal_mmu_pte_pagesz_log2_min; /* ?? minimum page size in PTEs */ | ||
668 | extern const char Xthal_mmu_pte_pagesz_log2_max; /* ?? maximum page size in PTEs */ | ||
669 | |||
670 | /* Cache Attribute Bits Implemented by the Cache (part of the cache abstraction) */ | ||
671 | extern const char Xthal_icache_fca_bits_implemented; /* ITLB/UTLB only! */ | ||
672 | extern const char Xthal_dcache_lca_bits_implemented; /* DTLB/UTLB only! */ | ||
673 | extern const char Xthal_dcache_sca_bits_implemented; /* DTLB/UTLB only! */ | ||
674 | |||
675 | /* Per TLB Parameters (Instruction, Data, Unified) */ | ||
676 | struct XtHalMmuTlb Xthal_itlb; /* description of MMU I-TLB generic features */ | ||
677 | struct XtHalMmuTlb Xthal_dtlb; /* description of MMU D-TLB generic features */ | ||
678 | struct XtHalMmuTlb Xthal_utlb; /* description of MMU U-TLB generic features */ | ||
679 | |||
680 | #define XTHAL_MMU_WAYS_MAX 8 /* maximum number of ways (associativities) for each TLB */ | ||
681 | |||
682 | /* Structure for common information described for each possible TLB (instruction, data and unified): */ | ||
683 | typedef struct XtHalMmuTlb { | ||
684 | u8 va_bits; /* 32 (number of virtual address bits) */ | ||
685 | u8 pa_bits; /* 32 (number of physical address bits) */ | ||
686 | bool tlb_va_indexed; /* 1 (set if TLB is indexed by virtual address) */ | ||
687 | bool tlb_va_tagged; /* 0 (set if TLB is tagged by virtual address) */ | ||
688 | bool cache_va_indexed; /* 1 (set if cache is indexed by virtual address) */ | ||
689 | bool cache_va_tagged; /* 0 (set if cache is tagged by virtual address) */ | ||
690 | /*bool (whether page tables are traversed in vaddr sorted order, paddr sorted order, ...) */ | ||
691 | /*u8 (set of available page attribute bits, other than cache attribute bits defined above) */ | ||
692 | /*u32 (various masks for pages, MMU table/TLB entries, etc.) */ | ||
693 | u8 way_count; /* 0 .. 8 (number of ways, a.k.a. associativities, for this TLB) */ | ||
694 | XtHalMmuTlbWay * ways[XTHAL_MMU_WAYS_MAX]; /* pointers to per-way parms for each way */ | ||
695 | } XtHalMmuTlb; | ||
696 | |||
697 | /* Per TLB Way (Per Associativity) Parameters */ | ||
698 | typedef struct XtHalMmuTlbWay { | ||
699 | u32 index_count_log2; /* 0 .. 4 */ | ||
700 | u32 pagesz_mask; /* 0 .. 2^pagesz_count - 1 (each bit corresponds to a size */ | ||
701 | /* defined in the Xthal_mmu_pagesz_log2[] table) */ | ||
702 | u32 vpn_const_mask; | ||
703 | u32 vpn_const_value; | ||
704 | u64 ppn_const_mask; /* future may support pa_bits > 32 */ | ||
705 | u64 ppn_const_value; | ||
706 | u32 ppn_id_mask; /* paddr bits taken directly from vaddr */ | ||
707 | bool backgnd_match; /* 0 or 1 */ | ||
708 | /* These are defined in terms of the XTHAL_CACHE_xxx bits: */ | ||
709 | u8 fca_const_mask; /* ITLB/UTLB only! */ | ||
710 | u8 fca_const_value; /* ITLB/UTLB only! */ | ||
711 | u8 lca_const_mask; /* DTLB/UTLB only! */ | ||
712 | u8 lca_const_value; /* DTLB/UTLB only! */ | ||
713 | u8 sca_const_mask; /* DTLB/UTLB only! */ | ||
714 | u8 sca_const_value; /* DTLB/UTLB only! */ | ||
715 | /* These define an encoding that map 5 bits in TLB and PTE entries to */ | ||
716 | /* 8 bits (FCA, ITLB), 16 bits (LCA+SCA, DTLB) or 24 bits (FCA+LCA+SCA, UTLB): */ | ||
717 | /* (they may be moved to struct XtHalMmuTlb) */ | ||
718 | u8 ca_bits; /* number of bits in TLB/PTE entries for cache attributes */ | ||
719 | u32 * ca_map; /* pointer to array of 2^ca_bits entries of FCA+LCA+SCA bits */ | ||
720 | } XtHalMmuTlbWay; | ||
721 | |||
722 | /* | ||
723 | * The way to determine whether protection support is present in core | ||
724 | * is to [look at Xthal_mmu_rings ???]. | ||
725 | * Give info on memory requirements for MMU tables and other in-memory | ||
726 | * data structures (globally, per task, base and per page, etc.) - whatever bounds can be calculated. | ||
727 | */ | ||
728 | |||
729 | |||
730 | /* Default vectors: */ | ||
731 | xthal_immu_fetch_miss_vector | ||
732 | xthal_dmmu_load_miss_vector | ||
733 | xthal_dmmu_store_miss_vector | ||
734 | |||
735 | /* Functions called when a fault is detected: */ | ||
736 | typedef void (XtHalMmuFaultFunc)( unsigned vaddr, ...context... ); | ||
737 | /* Or, */ | ||
738 | /* a? = vaddr */ | ||
739 | /* a? = context... */ | ||
740 | /* PS.xxx = xxx */ | ||
741 | XtHalMMuFaultFunc *Xthal_immu_fetch_fault_func; | ||
742 | XtHalMMuFaultFunc *Xthal_dmmu_load_fault_func; | ||
743 | XtHalMMuFaultFunc *Xthal_dmmu_store_fault_func; | ||
744 | |||
745 | /* Default Handlers: */ | ||
746 | /* The user and/or kernel exception handlers may jump to these handlers to handle the relevant exceptions, | ||
747 | * according to the value of EXCCAUSE. The exact register state on entry to these handlers is TBD. */ | ||
748 | /* When multiple TLB entries match (hit) on the same access: */ | ||
749 | xthal_immu_fetch_multihit_handler | ||
750 | xthal_dmmu_load_multihit_handler | ||
751 | xthal_dmmu_store_multihit_handler | ||
752 | /* Protection violations according to cache attributes, and other cache attribute mismatches: */ | ||
753 | xthal_immu_fetch_attr_handler | ||
754 | xthal_dmmu_load_attr_handler | ||
755 | xthal_dmmu_store_attr_handler | ||
756 | /* Protection violations due to insufficient ring level: */ | ||
757 | xthal_immu_fetch_priv_handler | ||
758 | xthal_dmmu_load_priv_handler | ||
759 | xthal_dmmu_store_priv_handler | ||
760 | /* Alignment exception handlers (if supported by the particular Xtensa MMU configuration): */ | ||
761 | xthal_dmmu_load_align_handler | ||
762 | xthal_dmmu_store_align_handler | ||
763 | |||
764 | /* Or, alternatively, the OS user and/or kernel exception handlers may simply jump to the | ||
765 | * following entry points which will handle any values of EXCCAUSE not handled by the OS: */ | ||
766 | xthal_user_exc_default_handler | ||
767 | xthal_kernel_exc_default_handler | ||
768 | |||
769 | #endif /*0*/ | ||
770 | |||
771 | #ifdef INCLUDE_DEPRECATED_HAL_CODE | ||
772 | extern const unsigned char Xthal_have_old_exc_arch; | ||
773 | extern const unsigned char Xthal_have_mmu; | ||
774 | extern const unsigned int Xthal_num_regs; | ||
775 | extern const unsigned char Xthal_num_iroms; | ||
776 | extern const unsigned char Xthal_num_irams; | ||
777 | extern const unsigned char Xthal_num_droms; | ||
778 | extern const unsigned char Xthal_num_drams; | ||
779 | extern const unsigned int Xthal_configid0; | ||
780 | extern const unsigned int Xthal_configid1; | ||
781 | #endif | ||
782 | |||
783 | #ifdef INCLUDE_DEPRECATED_HAL_DEBUG_CODE | ||
784 | #define XTHAL_24_BIT_BREAK 0x80000000 | ||
785 | #define XTHAL_16_BIT_BREAK 0x40000000 | ||
786 | extern const unsigned short Xthal_ill_inst_16[16]; | ||
787 | #define XTHAL_DEST_REG 0xf0000000 /* Mask for destination register */ | ||
788 | #define XTHAL_DEST_REG_INST 0x08000000 /* Branch address is in register */ | ||
789 | #define XTHAL_DEST_REL_INST 0x04000000 /* Branch address is relative */ | ||
790 | #define XTHAL_RFW_INST 0x00000800 | ||
791 | #define XTHAL_RFUE_INST 0x00000400 | ||
792 | #define XTHAL_RFI_INST 0x00000200 | ||
793 | #define XTHAL_RFE_INST 0x00000100 | ||
794 | #define XTHAL_RET_INST 0x00000080 | ||
795 | #define XTHAL_BREAK_INST 0x00000040 | ||
796 | #define XTHAL_SYSCALL_INST 0x00000020 | ||
797 | #define XTHAL_LOOP_END 0x00000010 /* Not set by xthal_inst_type */ | ||
798 | #define XTHAL_JUMP_INST 0x00000008 /* Call or jump instruction */ | ||
799 | #define XTHAL_BRANCH_INST 0x00000004 /* Branch instruction */ | ||
800 | #define XTHAL_24_BIT_INST 0x00000002 | ||
801 | #define XTHAL_16_BIT_INST 0x00000001 | ||
802 | typedef struct xthal_state { | ||
803 | unsigned pc; | ||
804 | unsigned ar[16]; | ||
805 | unsigned lbeg; | ||
806 | unsigned lend; | ||
807 | unsigned lcount; | ||
808 | unsigned extra_ptr; | ||
809 | unsigned cpregs_ptr[XTHAL_MAX_CPS]; | ||
810 | } XTHAL_STATE; | ||
811 | extern unsigned int xthal_inst_type(void *addr); | ||
812 | extern unsigned int xthal_branch_addr(void *addr); | ||
813 | extern unsigned int xthal_get_npc(XTHAL_STATE *user_state); | ||
814 | #endif /* INCLUDE_DEPRECATED_HAL_DEBUG_CODE */ | ||
815 | |||
816 | #ifdef __cplusplus | ||
817 | } | ||
818 | #endif | ||
819 | #endif /*!__ASSEMBLY__ */ | ||
820 | |||
821 | #endif /*XTENSA_HAL_H*/ | ||
822 | |||
diff --git a/include/asm-xtensa/xtensa/simcall.h b/include/asm-xtensa/xtensa/simcall.h new file mode 100644 index 000000000000..a2b868929a49 --- /dev/null +++ b/include/asm-xtensa/xtensa/simcall.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef SIMCALL_INCLUDED | ||
2 | #define SIMCALL_INCLUDED | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/simcall.h - Simulator call numbers | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General | ||
10 | * Public License. See the file "COPYING" in the main directory of | ||
11 | * this archive for more details. | ||
12 | * | ||
13 | * Copyright (C) 2002 Tensilica Inc. | ||
14 | */ | ||
15 | |||
16 | |||
17 | /* | ||
18 | * System call like services offered by the simulator host. | ||
19 | * These are modeled after the Linux 2.4 kernel system calls | ||
20 | * for Xtensa processors. However not all system calls and | ||
21 | * not all functionality of a given system call are implemented, | ||
22 | * or necessarily have well defined or equivalent semantics in | ||
23 | * the context of a simulation (as opposed to a Unix kernel). | ||
24 | * | ||
25 | * These services behave largely as if they had been invoked | ||
26 | * as a task in the simulator host's operating system | ||
27 | * (eg. files accessed are those of the simulator host). | ||
28 | * However, these SIMCALLs model a virtual operating system | ||
29 | * so that various definitions, bit assignments etc | ||
30 | * (eg. open mode bits, errno values, etc) are independent | ||
31 | * of the host operating system used to run the simulation. | ||
32 | * Rather these definitions are specific to the Xtensa ISS. | ||
33 | * This way Xtensa ISA code written to use these SIMCALLs | ||
34 | * can (in principle) be simulated on any host. | ||
35 | * | ||
36 | * Up to 6 parameters are passed in registers a3 to a8 | ||
37 | * (note the 6th parameter isn't passed on the stack, | ||
38 | * unlike windowed function calling conventions). | ||
39 | * The return value is in a2. A negative value in the | ||
40 | * range -4096 to -1 indicates a negated error code to be | ||
41 | * reported in errno with a return value of -1, otherwise | ||
42 | * the value in a2 is returned as is. | ||
43 | */ | ||
44 | |||
45 | /* These #defines need to match what's in Xtensa/OS/vxworks/xtiss/simcalls.c */ | ||
46 | |||
47 | #define SYS_nop 0 /* n/a - setup; used to flush register windows */ | ||
48 | #define SYS_exit 1 /*x*/ | ||
49 | #define SYS_fork 2 | ||
50 | #define SYS_read 3 /*x*/ | ||
51 | #define SYS_write 4 /*x*/ | ||
52 | #define SYS_open 5 /*x*/ | ||
53 | #define SYS_close 6 /*x*/ | ||
54 | #define SYS_rename 7 /*x 38 - waitpid */ | ||
55 | #define SYS_creat 8 /*x*/ | ||
56 | #define SYS_link 9 /*x (not implemented on WIN32) */ | ||
57 | #define SYS_unlink 10 /*x*/ | ||
58 | #define SYS_execv 11 /* n/a - execve */ | ||
59 | #define SYS_execve 12 /* 11 - chdir */ | ||
60 | #define SYS_pipe 13 /* 42 - time */ | ||
61 | #define SYS_stat 14 /* 106 - mknod */ | ||
62 | #define SYS_chmod 15 | ||
63 | #define SYS_chown 16 /* 202 - lchown */ | ||
64 | #define SYS_utime 17 /* 30 - break */ | ||
65 | #define SYS_wait 18 /* n/a - oldstat */ | ||
66 | #define SYS_lseek 19 /*x*/ | ||
67 | #define SYS_getpid 20 | ||
68 | #define SYS_isatty 21 /* n/a - mount */ | ||
69 | #define SYS_fstat 22 /* 108 - oldumount */ | ||
70 | #define SYS_time 23 /* 13 - setuid */ | ||
71 | #define SYS_gettimeofday 24 /*x 78 - getuid (not implemented on WIN32) */ | ||
72 | #define SYS_times 25 /*X 43 - stime (Xtensa-specific implementation) */ | ||
73 | #define SYS_socket 26 | ||
74 | #define SYS_sendto 27 | ||
75 | #define SYS_recvfrom 28 | ||
76 | #define SYS_select_one 29 /* not compitible select, one file descriptor at the time */ | ||
77 | #define SYS_bind 30 | ||
78 | #define SYS_ioctl 31 | ||
79 | |||
80 | /* | ||
81 | * Other... | ||
82 | */ | ||
83 | #define SYS_iss_argc 1000 /* returns value of argc */ | ||
84 | #define SYS_iss_argv_size 1001 /* bytes needed for argv & arg strings */ | ||
85 | #define SYS_iss_set_argv 1002 /* saves argv & arg strings at given addr */ | ||
86 | |||
87 | /* | ||
88 | * SIMCALLs for the ferret memory debugger. All are invoked by | ||
89 | * libferret.a ... ( Xtensa/Target-Libs/ferret ) | ||
90 | */ | ||
91 | #define SYS_ferret 1010 | ||
92 | #define SYS_malloc 1011 | ||
93 | #define SYS_free 1012 | ||
94 | #define SYS_more_heap 1013 | ||
95 | #define SYS_no_heap 1014 | ||
96 | |||
97 | |||
98 | /* | ||
99 | * Extra SIMCALLs for GDB: | ||
100 | */ | ||
101 | #define SYS_gdb_break -1 /* invoked by XTOS on user exceptions if EPC points | ||
102 | to a break.n/break, regardless of cause! */ | ||
103 | #define SYS_xmon_out -2 /* invoked by XMON: ... */ | ||
104 | #define SYS_xmon_in -3 /* invoked by XMON: ... */ | ||
105 | #define SYS_xmon_flush -4 /* invoked by XMON: ... */ | ||
106 | #define SYS_gdb_abort -5 /* invoked by XTOS in _xtos_panic() */ | ||
107 | #define SYS_gdb_illegal_inst -6 /* invoked by XTOS for illegal instructions (too deeply) */ | ||
108 | #define SYS_xmon_init -7 /* invoked by XMON: ... */ | ||
109 | #define SYS_gdb_enter_sktloop -8 /* invoked by XTOS on debug exceptions */ | ||
110 | |||
111 | /* | ||
112 | * SIMCALLs for vxWorks xtiss BSP: | ||
113 | */ | ||
114 | #define SYS_setup_ppp_pipes -83 | ||
115 | #define SYS_log_msg -84 | ||
116 | |||
117 | /* | ||
118 | * Test SIMCALLs: | ||
119 | */ | ||
120 | #define SYS_test_write_state -100 | ||
121 | #define SYS_test_read_state -101 | ||
122 | |||
123 | /* | ||
124 | * SYS_select_one specifiers | ||
125 | */ | ||
126 | #define XTISS_SELECT_ONE_READ 1 | ||
127 | #define XTISS_SELECT_ONE_WRITE 2 | ||
128 | #define XTISS_SELECT_ONE_EXCEPT 3 | ||
129 | |||
130 | #endif /* !SIMCALL_INCLUDED */ | ||
diff --git a/include/asm-xtensa/xtensa/xt2000-uart.h b/include/asm-xtensa/xtensa/xt2000-uart.h new file mode 100644 index 000000000000..0154460f0ed8 --- /dev/null +++ b/include/asm-xtensa/xtensa/xt2000-uart.h | |||
@@ -0,0 +1,155 @@ | |||
1 | #ifndef _uart_h_included_ | ||
2 | #define _uart_h_included_ | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/xt2000-uart.h -- NatSemi PC16552D DUART | ||
8 | * definitions | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | * | ||
14 | * Copyright (C) 2002 Tensilica Inc. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include <xtensa/xt2000.h> | ||
19 | |||
20 | |||
21 | /* 16550 UART DEVICE REGISTERS | ||
22 | The XT2000 board aligns each register to a 32-bit word but the UART device only uses | ||
23 | one byte of the word, which is the least-significant byte regardless of the | ||
24 | endianness of the core (ie. byte offset 0 for little-endian and 3 for big-endian). | ||
25 | So if using word accesses then endianness doesn't matter. | ||
26 | The macros provided here do that. | ||
27 | */ | ||
28 | struct uart_dev_s { | ||
29 | union { | ||
30 | unsigned int rxb; /* DLAB=0: receive buffer, read-only */ | ||
31 | unsigned int txb; /* DLAB=0: transmit buffer, write-only */ | ||
32 | unsigned int dll; /* DLAB=1: divisor, least-significant byte latch (was write-only?) */ | ||
33 | } w0; | ||
34 | union { | ||
35 | unsigned int ier; /* DLAB=0: interrupt-enable register (was write-only?) */ | ||
36 | unsigned int dlm; /* DLAB=1: divisor, most-significant byte latch (was write-only?) */ | ||
37 | } w1; | ||
38 | |||
39 | union { | ||
40 | unsigned int isr; /* DLAB=0: interrupt status register, read-only */ | ||
41 | unsigned int fcr; /* DLAB=0: FIFO control register, write-only */ | ||
42 | unsigned int afr; /* DLAB=1: alternate function register */ | ||
43 | } w2; | ||
44 | |||
45 | unsigned int lcr; /* line control-register, write-only */ | ||
46 | unsigned int mcr; /* modem control-regsiter, write-only */ | ||
47 | unsigned int lsr; /* line status register, read-only */ | ||
48 | unsigned int msr; /* modem status register, read-only */ | ||
49 | unsigned int scr; /* scratch regsiter, read/write */ | ||
50 | }; | ||
51 | |||
52 | #define _RXB(u) ((u)->w0.rxb) | ||
53 | #define _TXB(u) ((u)->w0.txb) | ||
54 | #define _DLL(u) ((u)->w0.dll) | ||
55 | #define _IER(u) ((u)->w1.ier) | ||
56 | #define _DLM(u) ((u)->w1.dlm) | ||
57 | #define _ISR(u) ((u)->w2.isr) | ||
58 | #define _FCR(u) ((u)->w2.fcr) | ||
59 | #define _AFR(u) ((u)->w2.afr) | ||
60 | #define _LCR(u) ((u)->lcr) | ||
61 | #define _MCR(u) ((u)->mcr) | ||
62 | #define _LSR(u) ((u)->lsr) | ||
63 | #define _MSR(u) ((u)->msr) | ||
64 | #define _SCR(u) ((u)->scr) | ||
65 | |||
66 | typedef volatile struct uart_dev_s uart_dev_t; | ||
67 | |||
68 | /* IER bits */ | ||
69 | #define RCVR_DATA_REG_INTENABLE 0x01 | ||
70 | #define XMIT_HOLD_REG_INTENABLE 0x02 | ||
71 | #define RCVR_STATUS_INTENABLE 0x04 | ||
72 | #define MODEM_STATUS_INTENABLE 0x08 | ||
73 | |||
74 | /* FCR bits */ | ||
75 | #define _FIFO_ENABLE 0x01 | ||
76 | #define RCVR_FIFO_RESET 0x02 | ||
77 | #define XMIT_FIFO_RESET 0x04 | ||
78 | #define DMA_MODE_SELECT 0x08 | ||
79 | #define RCVR_TRIGGER_LSB 0x40 | ||
80 | #define RCVR_TRIGGER_MSB 0x80 | ||
81 | |||
82 | /* AFR bits */ | ||
83 | #define AFR_CONC_WRITE 0x01 | ||
84 | #define AFR_BAUDOUT_SEL 0x02 | ||
85 | #define AFR_RXRDY_SEL 0x04 | ||
86 | |||
87 | /* ISR bits */ | ||
88 | #define INT_STATUS(r) ((r)&1) | ||
89 | #define INT_PRIORITY(r) (((r)>>1)&0x7) | ||
90 | |||
91 | /* LCR bits */ | ||
92 | #define WORD_LENGTH(n) (((n)-5)&0x3) | ||
93 | #define STOP_BIT_ENABLE 0x04 | ||
94 | #define PARITY_ENABLE 0x08 | ||
95 | #define EVEN_PARITY 0x10 | ||
96 | #define FORCE_PARITY 0x20 | ||
97 | #define XMIT_BREAK 0x40 | ||
98 | #define DLAB_ENABLE 0x80 | ||
99 | |||
100 | /* MCR bits */ | ||
101 | #define _DTR 0x01 | ||
102 | #define _RTS 0x02 | ||
103 | #define _OP1 0x04 | ||
104 | #define _OP2 0x08 | ||
105 | #define LOOP_BACK 0x10 | ||
106 | |||
107 | /* LSR Bits */ | ||
108 | #define RCVR_DATA_READY 0x01 | ||
109 | #define OVERRUN_ERROR 0x02 | ||
110 | #define PARITY_ERROR 0x04 | ||
111 | #define FRAMING_ERROR 0x08 | ||
112 | #define BREAK_INTERRUPT 0x10 | ||
113 | #define XMIT_HOLD_EMPTY 0x20 | ||
114 | #define XMIT_EMPTY 0x40 | ||
115 | #define FIFO_ERROR 0x80 | ||
116 | #define RCVR_READY(u) (_LSR(u)&RCVR_DATA_READY) | ||
117 | #define XMIT_READY(u) (_LSR(u)&XMIT_HOLD_EMPTY) | ||
118 | |||
119 | /* MSR bits */ | ||
120 | #define _RDR 0x01 | ||
121 | #define DELTA_DSR 0x02 | ||
122 | #define DELTA_RI 0x04 | ||
123 | #define DELTA_CD 0x08 | ||
124 | #define _CTS 0x10 | ||
125 | #define _DSR 0x20 | ||
126 | #define _RI 0x40 | ||
127 | #define _CD 0x80 | ||
128 | |||
129 | /* prototypes */ | ||
130 | void uart_init( uart_dev_t *u, int bitrate ); | ||
131 | void uart_out( uart_dev_t *u, char c ); | ||
132 | void uart_puts( uart_dev_t *u, char *s ); | ||
133 | char uart_in( uart_dev_t *u ); | ||
134 | void uart_enable_rcvr_int( uart_dev_t *u ); | ||
135 | void uart_disable_rcvr_int( uart_dev_t *u ); | ||
136 | |||
137 | #ifdef DUART16552_1_VADDR | ||
138 | /* DUART present. */ | ||
139 | #define DUART_1_BASE (*(uart_dev_t*)DUART16552_1_VADDR) | ||
140 | #define DUART_2_BASE (*(uart_dev_t*)DUART16552_2_VADDR) | ||
141 | #define UART1_PUTS(s) uart_puts( &DUART_1_BASE, s ) | ||
142 | #define UART2_PUTS(s) uart_puts( &DUART_2_BASE, s ) | ||
143 | #else | ||
144 | /* DUART not configured, use dummy placeholders to allow compiles to work. */ | ||
145 | #define DUART_1_BASE (*(uart_dev_t*)0) | ||
146 | #define DUART_2_BASE (*(uart_dev_t*)0) | ||
147 | #define UART1_PUTS(s) | ||
148 | #define UART2_PUTS(s) | ||
149 | #endif | ||
150 | |||
151 | /* Compute 16-bit divisor for baudrate generator, with rounding: */ | ||
152 | #define DUART_DIVISOR(crystal,speed) (((crystal)/16 + (speed)/2)/(speed)) | ||
153 | |||
154 | #endif /*_uart_h_included_*/ | ||
155 | |||
diff --git a/include/asm-xtensa/xtensa/xt2000.h b/include/asm-xtensa/xtensa/xt2000.h new file mode 100644 index 000000000000..703a45002f8f --- /dev/null +++ b/include/asm-xtensa/xtensa/xt2000.h | |||
@@ -0,0 +1,408 @@ | |||
1 | #ifndef _INC_XT2000_H_ | ||
2 | #define _INC_XT2000_H_ | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/xt2000.h - Definitions specific to the | ||
8 | * Tensilica XT2000 Emulation Board | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | * | ||
14 | * Copyright (C) 2002 Tensilica Inc. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include <xtensa/config/core.h> | ||
19 | #include <xtensa/config/system.h> | ||
20 | |||
21 | |||
22 | /* | ||
23 | * Default assignment of XT2000 devices to external interrupts. | ||
24 | */ | ||
25 | |||
26 | /* Ethernet interrupt: */ | ||
27 | #ifdef XCHAL_EXTINT3_NUM | ||
28 | #define SONIC83934_INTNUM XCHAL_EXTINT3_NUM | ||
29 | #define SONIC83934_INTLEVEL XCHAL_EXTINT3_LEVEL | ||
30 | #define SONIC83934_INTMASK XCHAL_EXTINT3_MASK | ||
31 | #else | ||
32 | #define SONIC83934_INTMASK 0 | ||
33 | #endif | ||
34 | |||
35 | /* DUART channel 1 interrupt (P1 - console): */ | ||
36 | #ifdef XCHAL_EXTINT4_NUM | ||
37 | #define DUART16552_1_INTNUM XCHAL_EXTINT4_NUM | ||
38 | #define DUART16552_1_INTLEVEL XCHAL_EXTINT4_LEVEL | ||
39 | #define DUART16552_1_INTMASK XCHAL_EXTINT4_MASK | ||
40 | #else | ||
41 | #define DUART16552_1_INTMASK 0 | ||
42 | #endif | ||
43 | |||
44 | /* DUART channel 2 interrupt (P2 - 2nd serial port): */ | ||
45 | #ifdef XCHAL_EXTINT5_NUM | ||
46 | #define DUART16552_2_INTNUM XCHAL_EXTINT5_NUM | ||
47 | #define DUART16552_2_INTLEVEL XCHAL_EXTINT5_LEVEL | ||
48 | #define DUART16552_2_INTMASK XCHAL_EXTINT5_MASK | ||
49 | #else | ||
50 | #define DUART16552_2_INTMASK 0 | ||
51 | #endif | ||
52 | |||
53 | /* FPGA-combined PCI/etc interrupts: */ | ||
54 | #ifdef XCHAL_EXTINT6_NUM | ||
55 | #define XT2000_FPGAPCI_INTNUM XCHAL_EXTINT6_NUM | ||
56 | #define XT2000_FPGAPCI_INTLEVEL XCHAL_EXTINT6_LEVEL | ||
57 | #define XT2000_FPGAPCI_INTMASK XCHAL_EXTINT6_MASK | ||
58 | #else | ||
59 | #define XT2000_FPGAPCI_INTMASK 0 | ||
60 | #endif | ||
61 | |||
62 | |||
63 | |||
64 | /* | ||
65 | * Device addresses. | ||
66 | * | ||
67 | * Note: for endianness-independence, use 32-bit loads and stores for all | ||
68 | * register accesses to Ethernet, DUART and LED devices. Undefined bits | ||
69 | * may need to be masked out if needed when reading if the actual register | ||
70 | * size is smaller than 32 bits. | ||
71 | * | ||
72 | * Note: XT2000 bus byte lanes are defined in terms of msbyte and lsbyte | ||
73 | * relative to the processor. So 32-bit registers are accessed consistently | ||
74 | * from both big and little endian processors. However, this means byte | ||
75 | * sequences are not consistent between big and little endian processors. | ||
76 | * This is fine for RAM, and for ROM if ROM is created for a specific | ||
77 | * processor (and thus has correct byte sequences). However this may be | ||
78 | * unexpected for Flash, which might contain a file-system that one wants | ||
79 | * to use for multiple processor configurations (eg. the Flash might contain | ||
80 | * the Ethernet card's address, endianness-independent application data, etc). | ||
81 | * That is, byte sequences written in Flash by a core of a given endianness | ||
82 | * will be byte-swapped when seen by a core of the other endianness. | ||
83 | * Someone implementing an endianness-independent Flash file system will | ||
84 | * likely handle this byte-swapping issue in the Flash driver software. | ||
85 | */ | ||
86 | |||
87 | #define DUART16552_XTAL_FREQ 18432000 /* crystal frequency in Hz */ | ||
88 | #define XTBOARD_FLASH_MAXSIZE 0x4000000 /* 64 MB (max; depends on what is socketed!) */ | ||
89 | #define XTBOARD_EPROM_MAXSIZE 0x0400000 /* 4 MB (max; depends on what is socketed!) */ | ||
90 | #define XTBOARD_EEPROM_MAXSIZE 0x0080000 /* 512 kB (max; depends on what is socketed!) */ | ||
91 | #define XTBOARD_ASRAM_SIZE 0x0100000 /* 1 MB */ | ||
92 | #define XTBOARD_PCI_MEM_SIZE 0x8000000 /* 128 MB (allocated) */ | ||
93 | #define XTBOARD_PCI_IO_SIZE 0x1000000 /* 16 MB (allocated) */ | ||
94 | |||
95 | #ifdef XSHAL_IOBLOCK_BYPASS_PADDR | ||
96 | /* PCI memory space: */ | ||
97 | # define XTBOARD_PCI_MEM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0x0000000) | ||
98 | /* Socketed Flash (eg. 2 x 16-bit devices): */ | ||
99 | # define XTBOARD_FLASH_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0x8000000) | ||
100 | /* PCI I/O space: */ | ||
101 | # define XTBOARD_PCI_IO_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xC000000) | ||
102 | /* V3 PCI interface chip register/config space: */ | ||
103 | # define XTBOARD_V3PCI_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD000000) | ||
104 | /* Bus Interface registers: */ | ||
105 | # define XTBOARD_BUSINT_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD010000) | ||
106 | /* FPGA registers: */ | ||
107 | # define XT2000_FPGAREGS_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD020000) | ||
108 | /* SONIC SN83934 Ethernet controller/transceiver: */ | ||
109 | # define SONIC83934_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD030000) | ||
110 | /* 8-character bitmapped LED display: */ | ||
111 | # define XTBOARD_LED_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD040000) | ||
112 | /* National-Semi PC16552D DUART: */ | ||
113 | # define DUART16552_1_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD050020) /* channel 1 (P1 - console) */ | ||
114 | # define DUART16552_2_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD050000) /* channel 2 (P2) */ | ||
115 | /* Asynchronous Static RAM: */ | ||
116 | # define XTBOARD_ASRAM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD400000) | ||
117 | /* 8-bit EEPROM: */ | ||
118 | # define XTBOARD_EEPROM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD600000) | ||
119 | /* 2 x 16-bit EPROMs: */ | ||
120 | # define XTBOARD_EPROM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD800000) | ||
121 | #endif /* XSHAL_IOBLOCK_BYPASS_PADDR */ | ||
122 | |||
123 | /* These devices might be accessed cached: */ | ||
124 | #ifdef XSHAL_IOBLOCK_CACHED_PADDR | ||
125 | # define XTBOARD_PCI_MEM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0x0000000) | ||
126 | # define XTBOARD_FLASH_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0x8000000) | ||
127 | # define XTBOARD_ASRAM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0xD400000) | ||
128 | # define XTBOARD_EEPROM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0xD600000) | ||
129 | # define XTBOARD_EPROM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0xD800000) | ||
130 | #endif /* XSHAL_IOBLOCK_CACHED_PADDR */ | ||
131 | |||
132 | |||
133 | /*** Same thing over again, this time with virtual addresses: ***/ | ||
134 | |||
135 | #ifdef XSHAL_IOBLOCK_BYPASS_VADDR | ||
136 | /* PCI memory space: */ | ||
137 | # define XTBOARD_PCI_MEM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0x0000000) | ||
138 | /* Socketed Flash (eg. 2 x 16-bit devices): */ | ||
139 | # define XTBOARD_FLASH_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0x8000000) | ||
140 | /* PCI I/O space: */ | ||
141 | # define XTBOARD_PCI_IO_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xC000000) | ||
142 | /* V3 PCI interface chip register/config space: */ | ||
143 | # define XTBOARD_V3PCI_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD000000) | ||
144 | /* Bus Interface registers: */ | ||
145 | # define XTBOARD_BUSINT_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD010000) | ||
146 | /* FPGA registers: */ | ||
147 | # define XT2000_FPGAREGS_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD020000) | ||
148 | /* SONIC SN83934 Ethernet controller/transceiver: */ | ||
149 | # define SONIC83934_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD030000) | ||
150 | /* 8-character bitmapped LED display: */ | ||
151 | # define XTBOARD_LED_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD040000) | ||
152 | /* National-Semi PC16552D DUART: */ | ||
153 | # define DUART16552_1_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD050020) /* channel 1 (P1 - console) */ | ||
154 | # define DUART16552_2_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD050000) /* channel 2 (P2) */ | ||
155 | /* Asynchronous Static RAM: */ | ||
156 | # define XTBOARD_ASRAM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD400000) | ||
157 | /* 8-bit EEPROM: */ | ||
158 | # define XTBOARD_EEPROM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD600000) | ||
159 | /* 2 x 16-bit EPROMs: */ | ||
160 | # define XTBOARD_EPROM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD800000) | ||
161 | #endif /* XSHAL_IOBLOCK_BYPASS_VADDR */ | ||
162 | |||
163 | /* These devices might be accessed cached: */ | ||
164 | #ifdef XSHAL_IOBLOCK_CACHED_VADDR | ||
165 | # define XTBOARD_PCI_MEM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0x0000000) | ||
166 | # define XTBOARD_FLASH_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0x8000000) | ||
167 | # define XTBOARD_ASRAM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0xD400000) | ||
168 | # define XTBOARD_EEPROM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0xD600000) | ||
169 | # define XTBOARD_EPROM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0xD800000) | ||
170 | #endif /* XSHAL_IOBLOCK_CACHED_VADDR */ | ||
171 | |||
172 | |||
173 | /* System ROM: */ | ||
174 | #define XTBOARD_ROM_SIZE XSHAL_ROM_SIZE | ||
175 | #ifdef XSHAL_ROM_VADDR | ||
176 | #define XTBOARD_ROM_VADDR XSHAL_ROM_VADDR | ||
177 | #endif | ||
178 | #ifdef XSHAL_ROM_PADDR | ||
179 | #define XTBOARD_ROM_PADDR XSHAL_ROM_PADDR | ||
180 | #endif | ||
181 | |||
182 | /* System RAM: */ | ||
183 | #define XTBOARD_RAM_SIZE XSHAL_RAM_SIZE | ||
184 | #ifdef XSHAL_RAM_VADDR | ||
185 | #define XTBOARD_RAM_VADDR XSHAL_RAM_VADDR | ||
186 | #endif | ||
187 | #ifdef XSHAL_RAM_PADDR | ||
188 | #define XTBOARD_RAM_PADDR XSHAL_RAM_PADDR | ||
189 | #endif | ||
190 | #define XTBOARD_RAM_BYPASS_VADDR XSHAL_RAM_BYPASS_VADDR | ||
191 | #define XTBOARD_RAM_BYPASS_PADDR XSHAL_RAM_BYPASS_PADDR | ||
192 | |||
193 | |||
194 | |||
195 | /* | ||
196 | * Things that depend on device addresses. | ||
197 | */ | ||
198 | |||
199 | |||
200 | #define XTBOARD_CACHEATTR_WRITEBACK XSHAL_XT2000_CACHEATTR_WRITEBACK | ||
201 | #define XTBOARD_CACHEATTR_WRITEALLOC XSHAL_XT2000_CACHEATTR_WRITEALLOC | ||
202 | #define XTBOARD_CACHEATTR_WRITETHRU XSHAL_XT2000_CACHEATTR_WRITETHRU | ||
203 | #define XTBOARD_CACHEATTR_BYPASS XSHAL_XT2000_CACHEATTR_BYPASS | ||
204 | #define XTBOARD_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_DEFAULT | ||
205 | |||
206 | #define XTBOARD_BUSINT_PIPE_REGIONS XSHAL_XT2000_PIPE_REGIONS | ||
207 | #define XTBOARD_BUSINT_SDRAM_REGIONS XSHAL_XT2000_SDRAM_REGIONS | ||
208 | |||
209 | |||
210 | |||
211 | /* | ||
212 | * BusLogic (FPGA) registers. | ||
213 | * All these registers are normally accessed using 32-bit loads/stores. | ||
214 | */ | ||
215 | |||
216 | /* Register offsets: */ | ||
217 | #define XT2000_DATECD_OFS 0x00 /* date code (read-only) */ | ||
218 | #define XT2000_STSREG_OFS 0x04 /* status (read-only) */ | ||
219 | #define XT2000_SYSLED_OFS 0x08 /* system LED */ | ||
220 | #define XT2000_WRPROT_OFS 0x0C /* write protect */ | ||
221 | #define XT2000_SWRST_OFS 0x10 /* software reset */ | ||
222 | #define XT2000_SYSRST_OFS 0x14 /* system (peripherals) reset */ | ||
223 | #define XT2000_IMASK_OFS 0x18 /* interrupt mask */ | ||
224 | #define XT2000_ISTAT_OFS 0x1C /* interrupt status */ | ||
225 | #define XT2000_V3CFG_OFS 0x20 /* V3 config (V320 PCI) */ | ||
226 | |||
227 | /* Physical register addresses: */ | ||
228 | #ifdef XT2000_FPGAREGS_PADDR | ||
229 | #define XT2000_DATECD_PADDR (XT2000_FPGAREGS_PADDR+XT2000_DATECD_OFS) | ||
230 | #define XT2000_STSREG_PADDR (XT2000_FPGAREGS_PADDR+XT2000_STSREG_OFS) | ||
231 | #define XT2000_SYSLED_PADDR (XT2000_FPGAREGS_PADDR+XT2000_SYSLED_OFS) | ||
232 | #define XT2000_WRPROT_PADDR (XT2000_FPGAREGS_PADDR+XT2000_WRPROT_OFS) | ||
233 | #define XT2000_SWRST_PADDR (XT2000_FPGAREGS_PADDR+XT2000_SWRST_OFS) | ||
234 | #define XT2000_SYSRST_PADDR (XT2000_FPGAREGS_PADDR+XT2000_SYSRST_OFS) | ||
235 | #define XT2000_IMASK_PADDR (XT2000_FPGAREGS_PADDR+XT2000_IMASK_OFS) | ||
236 | #define XT2000_ISTAT_PADDR (XT2000_FPGAREGS_PADDR+XT2000_ISTAT_OFS) | ||
237 | #define XT2000_V3CFG_PADDR (XT2000_FPGAREGS_PADDR+XT2000_V3CFG_OFS) | ||
238 | #endif | ||
239 | |||
240 | /* Virtual register addresses: */ | ||
241 | #ifdef XT2000_FPGAREGS_VADDR | ||
242 | #define XT2000_DATECD_VADDR (XT2000_FPGAREGS_VADDR+XT2000_DATECD_OFS) | ||
243 | #define XT2000_STSREG_VADDR (XT2000_FPGAREGS_VADDR+XT2000_STSREG_OFS) | ||
244 | #define XT2000_SYSLED_VADDR (XT2000_FPGAREGS_VADDR+XT2000_SYSLED_OFS) | ||
245 | #define XT2000_WRPROT_VADDR (XT2000_FPGAREGS_VADDR+XT2000_WRPROT_OFS) | ||
246 | #define XT2000_SWRST_VADDR (XT2000_FPGAREGS_VADDR+XT2000_SWRST_OFS) | ||
247 | #define XT2000_SYSRST_VADDR (XT2000_FPGAREGS_VADDR+XT2000_SYSRST_OFS) | ||
248 | #define XT2000_IMASK_VADDR (XT2000_FPGAREGS_VADDR+XT2000_IMASK_OFS) | ||
249 | #define XT2000_ISTAT_VADDR (XT2000_FPGAREGS_VADDR+XT2000_ISTAT_OFS) | ||
250 | #define XT2000_V3CFG_VADDR (XT2000_FPGAREGS_VADDR+XT2000_V3CFG_OFS) | ||
251 | /* Register access (for C code): */ | ||
252 | #define XT2000_DATECD_REG (*(volatile unsigned*) XT2000_DATECD_VADDR) | ||
253 | #define XT2000_STSREG_REG (*(volatile unsigned*) XT2000_STSREG_VADDR) | ||
254 | #define XT2000_SYSLED_REG (*(volatile unsigned*) XT2000_SYSLED_VADDR) | ||
255 | #define XT2000_WRPROT_REG (*(volatile unsigned*) XT2000_WRPROT_VADDR) | ||
256 | #define XT2000_SWRST_REG (*(volatile unsigned*) XT2000_SWRST_VADDR) | ||
257 | #define XT2000_SYSRST_REG (*(volatile unsigned*) XT2000_SYSRST_VADDR) | ||
258 | #define XT2000_IMASK_REG (*(volatile unsigned*) XT2000_IMASK_VADDR) | ||
259 | #define XT2000_ISTAT_REG (*(volatile unsigned*) XT2000_ISTAT_VADDR) | ||
260 | #define XT2000_V3CFG_REG (*(volatile unsigned*) XT2000_V3CFG_VADDR) | ||
261 | #endif | ||
262 | |||
263 | /* DATECD (date code) bit fields: */ | ||
264 | |||
265 | /* BCD-coded month (01..12): */ | ||
266 | #define XT2000_DATECD_MONTH_SHIFT 24 | ||
267 | #define XT2000_DATECD_MONTH_BITS 8 | ||
268 | #define XT2000_DATECD_MONTH_MASK 0xFF000000 | ||
269 | /* BCD-coded day (01..31): */ | ||
270 | #define XT2000_DATECD_DAY_SHIFT 16 | ||
271 | #define XT2000_DATECD_DAY_BITS 8 | ||
272 | #define XT2000_DATECD_DAY_MASK 0x00FF0000 | ||
273 | /* BCD-coded year (2001..9999): */ | ||
274 | #define XT2000_DATECD_YEAR_SHIFT 0 | ||
275 | #define XT2000_DATECD_YEAR_BITS 16 | ||
276 | #define XT2000_DATECD_YEAR_MASK 0x0000FFFF | ||
277 | |||
278 | /* STSREG (status) bit fields: */ | ||
279 | |||
280 | /* Switch SW3 setting bit fields (0=off/up, 1=on/down): */ | ||
281 | #define XT2000_STSREG_SW3_SHIFT 0 | ||
282 | #define XT2000_STSREG_SW3_BITS 4 | ||
283 | #define XT2000_STSREG_SW3_MASK 0x0000000F | ||
284 | /* Boot-select bits of switch SW3: */ | ||
285 | #define XT2000_STSREG_BOOTSEL_SHIFT 0 | ||
286 | #define XT2000_STSREG_BOOTSEL_BITS 2 | ||
287 | #define XT2000_STSREG_BOOTSEL_MASK 0x00000003 | ||
288 | /* Boot-select values: */ | ||
289 | #define XT2000_STSREG_BOOTSEL_FLASH 0 | ||
290 | #define XT2000_STSREG_BOOTSEL_EPROM16 1 | ||
291 | #define XT2000_STSREG_BOOTSEL_PROM8 2 | ||
292 | #define XT2000_STSREG_BOOTSEL_ASRAM 3 | ||
293 | /* User-defined bits of switch SW3: */ | ||
294 | #define XT2000_STSREG_SW3_2_SHIFT 2 | ||
295 | #define XT2000_STSREG_SW3_2_MASK 0x00000004 | ||
296 | #define XT2000_STSREG_SW3_3_SHIFT 3 | ||
297 | #define XT2000_STSREG_SW3_3_MASK 0x00000008 | ||
298 | |||
299 | /* SYSLED (system LED) bit fields: */ | ||
300 | |||
301 | /* LED control bit (0=off, 1=on): */ | ||
302 | #define XT2000_SYSLED_LEDON_SHIFT 0 | ||
303 | #define XT2000_SYSLED_LEDON_MASK 0x00000001 | ||
304 | |||
305 | /* WRPROT (write protect) bit fields (0=writable, 1=write-protected [default]): */ | ||
306 | |||
307 | /* Flash write protect: */ | ||
308 | #define XT2000_WRPROT_FLWP_SHIFT 0 | ||
309 | #define XT2000_WRPROT_FLWP_MASK 0x00000001 | ||
310 | /* Reserved but present write protect bits: */ | ||
311 | #define XT2000_WRPROT_WRP_SHIFT 1 | ||
312 | #define XT2000_WRPROT_WRP_BITS 7 | ||
313 | #define XT2000_WRPROT_WRP_MASK 0x000000FE | ||
314 | |||
315 | /* SWRST (software reset; allows s/w to generate power-on equivalent reset): */ | ||
316 | |||
317 | /* Software reset bits: */ | ||
318 | #define XT2000_SWRST_SWR_SHIFT 0 | ||
319 | #define XT2000_SWRST_SWR_BITS 16 | ||
320 | #define XT2000_SWRST_SWR_MASK 0x0000FFFF | ||
321 | /* Software reset value -- writing this value resets the board: */ | ||
322 | #define XT2000_SWRST_RESETVALUE 0x0000DEAD | ||
323 | |||
324 | /* SYSRST (system reset; controls reset of individual peripherals): */ | ||
325 | |||
326 | /* All-device reset: */ | ||
327 | #define XT2000_SYSRST_ALL_SHIFT 0 | ||
328 | #define XT2000_SYSRST_ALL_BITS 4 | ||
329 | #define XT2000_SYSRST_ALL_MASK 0x0000000F | ||
330 | /* HDSP-2534 LED display reset (1=reset, 0=nothing): */ | ||
331 | #define XT2000_SYSRST_LED_SHIFT 0 | ||
332 | #define XT2000_SYSRST_LED_MASK 0x00000001 | ||
333 | /* Sonic DP83934 Ethernet controller reset (1=reset, 0=nothing): */ | ||
334 | #define XT2000_SYSRST_SONIC_SHIFT 1 | ||
335 | #define XT2000_SYSRST_SONIC_MASK 0x00000002 | ||
336 | /* DP16552 DUART reset (1=reset, 0=nothing): */ | ||
337 | #define XT2000_SYSRST_DUART_SHIFT 2 | ||
338 | #define XT2000_SYSRST_DUART_MASK 0x00000004 | ||
339 | /* V3 V320 PCI bridge controller reset (1=reset, 0=nothing): */ | ||
340 | #define XT2000_SYSRST_V3_SHIFT 3 | ||
341 | #define XT2000_SYSRST_V3_MASK 0x00000008 | ||
342 | |||
343 | /* IMASK (interrupt mask; 0=disable, 1=enable): */ | ||
344 | /* ISTAT (interrupt status; 0=inactive, 1=pending): */ | ||
345 | |||
346 | /* PCI INTP interrupt: */ | ||
347 | #define XT2000_INTMUX_PCI_INTP_SHIFT 2 | ||
348 | #define XT2000_INTMUX_PCI_INTP_MASK 0x00000004 | ||
349 | /* PCI INTS interrupt: */ | ||
350 | #define XT2000_INTMUX_PCI_INTS_SHIFT 3 | ||
351 | #define XT2000_INTMUX_PCI_INTS_MASK 0x00000008 | ||
352 | /* PCI INTD interrupt: */ | ||
353 | #define XT2000_INTMUX_PCI_INTD_SHIFT 4 | ||
354 | #define XT2000_INTMUX_PCI_INTD_MASK 0x00000010 | ||
355 | /* V320 PCI controller interrupt: */ | ||
356 | #define XT2000_INTMUX_V3_SHIFT 5 | ||
357 | #define XT2000_INTMUX_V3_MASK 0x00000020 | ||
358 | /* PCI ENUM interrupt: */ | ||
359 | #define XT2000_INTMUX_PCI_ENUM_SHIFT 6 | ||
360 | #define XT2000_INTMUX_PCI_ENUM_MASK 0x00000040 | ||
361 | /* PCI DEG interrupt: */ | ||
362 | #define XT2000_INTMUX_PCI_DEG_SHIFT 7 | ||
363 | #define XT2000_INTMUX_PCI_DEG_MASK 0x00000080 | ||
364 | |||
365 | /* V3CFG (V3 config, V320 PCI controller): */ | ||
366 | |||
367 | /* V3 address control (0=pass-thru, 1=V3 address bits 31:28 set to 4'b0001 [default]): */ | ||
368 | #define XT2000_V3CFG_V3ADC_SHIFT 0 | ||
369 | #define XT2000_V3CFG_V3ADC_MASK 0x00000001 | ||
370 | |||
371 | /* I2C Devices */ | ||
372 | |||
373 | #define XT2000_I2C_RTC_ID 0x68 | ||
374 | #define XT2000_I2C_NVRAM0_ID 0x56 /* 1st 256 byte block */ | ||
375 | #define XT2000_I2C_NVRAM1_ID 0x57 /* 2nd 256 byte block */ | ||
376 | |||
377 | /* NVRAM Board Info structure: */ | ||
378 | |||
379 | #define XT2000_NVRAM_SIZE 512 | ||
380 | |||
381 | #define XT2000_NVRAM_BINFO_START 0x100 | ||
382 | #define XT2000_NVRAM_BINFO_SIZE 0x20 | ||
383 | #define XT2000_NVRAM_BINFO_VERSION 0x10 /* version 1.0 */ | ||
384 | #if 0 | ||
385 | #define XT2000_NVRAM_BINFO_VERSION_OFFSET 0x00 | ||
386 | #define XT2000_NVRAM_BINFO_VERSION_SIZE 0x1 | ||
387 | #define XT2000_NVRAM_BINFO_ETH_ADDR_OFFSET 0x02 | ||
388 | #define XT2000_NVRAM_BINFO_ETH_ADDR_SIZE 0x6 | ||
389 | #define XT2000_NVRAM_BINFO_SN_OFFSET 0x10 | ||
390 | #define XT2000_NVRAM_BINFO_SN_SIZE 0xE | ||
391 | #define XT2000_NVRAM_BINFO_CRC_OFFSET 0x1E | ||
392 | #define XT2000_NVRAM_BINFO_CRC_SIZE 0x2 | ||
393 | #endif /*0*/ | ||
394 | |||
395 | #if !defined(__ASSEMBLY__) && !defined(_NOCLANGUAGE) | ||
396 | typedef struct xt2000_nvram_binfo { | ||
397 | unsigned char version; | ||
398 | unsigned char reserved1; | ||
399 | unsigned char eth_addr[6]; | ||
400 | unsigned char reserved8[8]; | ||
401 | unsigned char serialno[14]; | ||
402 | unsigned char crc[2]; /* 16-bit CRC */ | ||
403 | } xt2000_nvram_binfo; | ||
404 | #endif /*!__ASSEMBLY__ && !_NOCLANGUAGE*/ | ||
405 | |||
406 | |||
407 | #endif /*_INC_XT2000_H_*/ | ||
408 | |||
diff --git a/include/asm-xtensa/xtensa/xtboard.h b/include/asm-xtensa/xtensa/xtboard.h new file mode 100644 index 000000000000..22469c175307 --- /dev/null +++ b/include/asm-xtensa/xtensa/xtboard.h | |||
@@ -0,0 +1,120 @@ | |||
1 | #ifndef _xtboard_h_included_ | ||
2 | #define _xtboard_h_included_ | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * xtboard.h -- Routines for getting useful information from the board. | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file "COPYING" in the main directory of this archive | ||
11 | * for more details. | ||
12 | * | ||
13 | * Copyright (C) 2002 Tensilica Inc. | ||
14 | */ | ||
15 | |||
16 | |||
17 | #include <xtensa/xt2000.h> | ||
18 | |||
19 | #define XTBOARD_RTC_ERROR -1 | ||
20 | #define XTBOARD_RTC_STOPPED -2 | ||
21 | |||
22 | |||
23 | /* xt2000-i2cdev.c: */ | ||
24 | typedef void XtboardDelayFunc( unsigned ); | ||
25 | extern XtboardDelayFunc* xtboard_set_nsdelay_func( XtboardDelayFunc *delay_fn ); | ||
26 | extern int xtboard_i2c_read (unsigned id, unsigned char *buf, unsigned addr, unsigned size); | ||
27 | extern int xtboard_i2c_write(unsigned id, unsigned char *buf, unsigned addr, unsigned size); | ||
28 | extern int xtboard_i2c_wait_nvram_ack(unsigned id, unsigned swtimer); | ||
29 | |||
30 | /* xtboard.c: */ | ||
31 | extern int xtboard_nvram_read (unsigned addr, unsigned len, unsigned char *buf); | ||
32 | extern int xtboard_nvram_write(unsigned addr, unsigned len, unsigned char *buf); | ||
33 | extern int xtboard_nvram_binfo_read (xt2000_nvram_binfo *buf); | ||
34 | extern int xtboard_nvram_binfo_write(xt2000_nvram_binfo *buf); | ||
35 | extern int xtboard_nvram_binfo_valid(xt2000_nvram_binfo *buf); | ||
36 | extern int xtboard_ethermac_get(unsigned char *buf); | ||
37 | extern int xtboard_ethermac_set(unsigned char *buf); | ||
38 | |||
39 | /*+*---------------------------------------------------------------------------- | ||
40 | / Function: xtboard_get_rtc_time | ||
41 | / | ||
42 | / Description: Get time stored in real-time clock. | ||
43 | / | ||
44 | / Returns: time in seconds stored in real-time clock. | ||
45 | /-**----------------------------------------------------------------------------*/ | ||
46 | |||
47 | extern unsigned xtboard_get_rtc_time(void); | ||
48 | |||
49 | /*+*---------------------------------------------------------------------------- | ||
50 | / Function: xtboard_set_rtc_time | ||
51 | / | ||
52 | / Description: Set time stored in real-time clock. | ||
53 | / | ||
54 | / Parameters: time -- time in seconds to store to real-time clock | ||
55 | / | ||
56 | / Returns: 0 on success, xtboard_i2c_write() error code otherwise. | ||
57 | /-**----------------------------------------------------------------------------*/ | ||
58 | |||
59 | extern int xtboard_set_rtc_time(unsigned time); | ||
60 | |||
61 | |||
62 | /* xtfreq.c: */ | ||
63 | /*+*---------------------------------------------------------------------------- | ||
64 | / Function: xtboard_measure_sys_clk | ||
65 | / | ||
66 | / Description: Get frequency of system clock. | ||
67 | / | ||
68 | / Parameters: none | ||
69 | / | ||
70 | / Returns: frequency of system clock. | ||
71 | /-**----------------------------------------------------------------------------*/ | ||
72 | |||
73 | extern unsigned xtboard_measure_sys_clk(void); | ||
74 | |||
75 | |||
76 | #if 0 /* old stuff from xtboard.c: */ | ||
77 | |||
78 | /*+*---------------------------------------------------------------------------- | ||
79 | / Function: xtboard_nvram valid | ||
80 | / | ||
81 | / Description: Determines if data in NVRAM is valid. | ||
82 | / | ||
83 | / Parameters: delay -- 10us delay function | ||
84 | / | ||
85 | / Returns: 1 if NVRAM is valid, 0 otherwise | ||
86 | /-**----------------------------------------------------------------------------*/ | ||
87 | |||
88 | extern unsigned xtboard_nvram_valid(void (*delay)( void )); | ||
89 | |||
90 | /*+*---------------------------------------------------------------------------- | ||
91 | / Function: xtboard_get_nvram_contents | ||
92 | / | ||
93 | / Description: Returns contents of NVRAM. | ||
94 | / | ||
95 | / Parameters: buf -- buffer to NVRAM contents. | ||
96 | / delay -- 10us delay function | ||
97 | / | ||
98 | / Returns: 1 if NVRAM is valid, 0 otherwise | ||
99 | /-**----------------------------------------------------------------------------*/ | ||
100 | |||
101 | extern unsigned xtboard_get_nvram_contents(unsigned char *buf, void (*delay)( void )); | ||
102 | |||
103 | /*+*---------------------------------------------------------------------------- | ||
104 | / Function: xtboard_get_ether_addr | ||
105 | / | ||
106 | / Description: Returns ethernet address of board. | ||
107 | / | ||
108 | / Parameters: buf -- buffer to store ethernet address | ||
109 | / delay -- 10us delay function | ||
110 | / | ||
111 | / Returns: nothing. | ||
112 | /-**----------------------------------------------------------------------------*/ | ||
113 | |||
114 | extern void xtboard_get_ether_addr(unsigned char *buf, void (*delay)( void )); | ||
115 | |||
116 | #endif /*0*/ | ||
117 | |||
118 | |||
119 | #endif /*_xtboard_h_included_*/ | ||
120 | |||
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 7e736e201c46..c1e82c514443 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -69,6 +69,11 @@ extern void remove_arg_zero(struct linux_binprm *); | |||
69 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); | 69 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); |
70 | extern int flush_old_exec(struct linux_binprm * bprm); | 70 | extern int flush_old_exec(struct linux_binprm * bprm); |
71 | 71 | ||
72 | extern int suid_dumpable; | ||
73 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | ||
74 | #define SUID_DUMP_USER 1 /* Dump as user of process */ | ||
75 | #define SUID_DUMP_ROOT 2 /* Dump as root */ | ||
76 | |||
72 | /* Stack area protections */ | 77 | /* Stack area protections */ |
73 | #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ | 78 | #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ |
74 | #define EXSTACK_DISABLE_X 1 /* Disable executable stacks */ | 79 | #define EXSTACK_DISABLE_X 1 /* Disable executable stacks */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4a99b76c5a33..60272141ff19 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -285,16 +285,12 @@ enum blk_queue_state { | |||
285 | Queue_up, | 285 | Queue_up, |
286 | }; | 286 | }; |
287 | 287 | ||
288 | #define BLK_TAGS_PER_LONG (sizeof(unsigned long) * 8) | ||
289 | #define BLK_TAGS_MASK (BLK_TAGS_PER_LONG - 1) | ||
290 | |||
291 | struct blk_queue_tag { | 288 | struct blk_queue_tag { |
292 | struct request **tag_index; /* map of busy tags */ | 289 | struct request **tag_index; /* map of busy tags */ |
293 | unsigned long *tag_map; /* bit map of free/busy tags */ | 290 | unsigned long *tag_map; /* bit map of free/busy tags */ |
294 | struct list_head busy_list; /* fifo list of busy tags */ | 291 | struct list_head busy_list; /* fifo list of busy tags */ |
295 | int busy; /* current depth */ | 292 | int busy; /* current depth */ |
296 | int max_depth; /* what we will send to device */ | 293 | int max_depth; /* what we will send to device */ |
297 | int real_max_depth; /* what the array can hold */ | ||
298 | atomic_t refcnt; /* map can be shared */ | 294 | atomic_t refcnt; /* map can be shared */ |
299 | }; | 295 | }; |
300 | 296 | ||
@@ -396,6 +392,7 @@ struct request_queue | |||
396 | */ | 392 | */ |
397 | unsigned int sg_timeout; | 393 | unsigned int sg_timeout; |
398 | unsigned int sg_reserved_size; | 394 | unsigned int sg_reserved_size; |
395 | int node; | ||
399 | 396 | ||
400 | struct list_head drain_list; | 397 | struct list_head drain_list; |
401 | 398 | ||
@@ -615,6 +612,8 @@ static inline void blkdev_dequeue_request(struct request *req) | |||
615 | /* | 612 | /* |
616 | * Access functions for manipulating queue properties | 613 | * Access functions for manipulating queue properties |
617 | */ | 614 | */ |
615 | extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn, | ||
616 | spinlock_t *lock, int node_id); | ||
618 | extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); | 617 | extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); |
619 | extern void blk_cleanup_queue(request_queue_t *); | 618 | extern void blk_cleanup_queue(request_queue_t *); |
620 | extern void blk_queue_make_request(request_queue_t *, make_request_fn *); | 619 | extern void blk_queue_make_request(request_queue_t *, make_request_fn *); |
@@ -646,7 +645,8 @@ extern void blk_wait_queue_drained(request_queue_t *, int); | |||
646 | extern void blk_finish_queue_drain(request_queue_t *); | 645 | extern void blk_finish_queue_drain(request_queue_t *); |
647 | 646 | ||
648 | int blk_get_queue(request_queue_t *); | 647 | int blk_get_queue(request_queue_t *); |
649 | request_queue_t *blk_alloc_queue(int); | 648 | request_queue_t *blk_alloc_queue(int gfp_mask); |
649 | request_queue_t *blk_alloc_queue_node(int,int); | ||
650 | #define blk_put_queue(q) blk_cleanup_queue((q)) | 650 | #define blk_put_queue(q) blk_cleanup_queue((q)) |
651 | 651 | ||
652 | /* | 652 | /* |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 0dd8ca1a3d5a..500f451ce0c0 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -67,6 +67,15 @@ extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, | |||
67 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) | 67 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) |
68 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 68 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
69 | 69 | ||
70 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP | ||
71 | extern void *alloc_remap(int nid, unsigned long size); | ||
72 | #else | ||
73 | static inline void *alloc_remap(int nid, unsigned long size) | ||
74 | { | ||
75 | return NULL; | ||
76 | } | ||
77 | #endif | ||
78 | |||
70 | extern unsigned long __initdata nr_kernel_pages; | 79 | extern unsigned long __initdata nr_kernel_pages; |
71 | extern unsigned long __initdata nr_all_pages; | 80 | extern unsigned long __initdata nr_all_pages; |
72 | 81 | ||
diff --git a/include/linux/dqblk_v1.h b/include/linux/dqblk_v1.h index 42fbf4797156..57f1250d5a52 100644 --- a/include/linux/dqblk_v1.h +++ b/include/linux/dqblk_v1.h | |||
@@ -11,6 +11,12 @@ | |||
11 | /* Root squash turned on */ | 11 | /* Root squash turned on */ |
12 | #define V1_DQF_RSQUASH 1 | 12 | #define V1_DQF_RSQUASH 1 |
13 | 13 | ||
14 | /* Numbers of blocks needed for updates */ | ||
15 | #define V1_INIT_ALLOC 1 | ||
16 | #define V1_INIT_REWRITE 1 | ||
17 | #define V1_DEL_ALLOC 0 | ||
18 | #define V1_DEL_REWRITE 2 | ||
19 | |||
14 | /* Special information about quotafile */ | 20 | /* Special information about quotafile */ |
15 | struct v1_mem_dqinfo { | 21 | struct v1_mem_dqinfo { |
16 | }; | 22 | }; |
diff --git a/include/linux/dqblk_v2.h b/include/linux/dqblk_v2.h index 4a6c5f6867bb..4f853322cb7f 100644 --- a/include/linux/dqblk_v2.h +++ b/include/linux/dqblk_v2.h | |||
@@ -10,6 +10,12 @@ | |||
10 | /* id numbers of quota format */ | 10 | /* id numbers of quota format */ |
11 | #define QFMT_VFS_V0 2 | 11 | #define QFMT_VFS_V0 2 |
12 | 12 | ||
13 | /* Numbers of blocks needed for updates */ | ||
14 | #define V2_INIT_ALLOC 4 | ||
15 | #define V2_INIT_REWRITE 2 | ||
16 | #define V2_DEL_ALLOC 0 | ||
17 | #define V2_DEL_REWRITE 6 | ||
18 | |||
13 | /* Inmemory copy of version specific information */ | 19 | /* Inmemory copy of version specific information */ |
14 | struct v2_mem_dqinfo { | 20 | struct v2_mem_dqinfo { |
15 | unsigned int dqi_blocks; | 21 | unsigned int dqi_blocks; |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index fab43527e597..a657130ba03a 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
@@ -300,18 +300,19 @@ struct ext2_inode { | |||
300 | /* | 300 | /* |
301 | * Mount flags | 301 | * Mount flags |
302 | */ | 302 | */ |
303 | #define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */ | 303 | #define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */ |
304 | #define EXT2_MOUNT_OLDALLOC 0x0002 /* Don't use the new Orlov allocator */ | 304 | #define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */ |
305 | #define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */ | 305 | #define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */ |
306 | #define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */ | 306 | #define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */ |
307 | #define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ | 307 | #define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */ |
308 | #define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ | 308 | #define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */ |
309 | #define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ | 309 | #define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */ |
310 | #define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */ | 310 | #define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */ |
311 | #define EXT2_MOUNT_NOBH 0x0100 /* No buffer_heads */ | 311 | #define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */ |
312 | #define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */ | 312 | #define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */ |
313 | #define EXT2_MOUNT_XATTR_USER 0x4000 /* Extended user attributes */ | 313 | #define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */ |
314 | #define EXT2_MOUNT_POSIX_ACL 0x8000 /* POSIX Access Control Lists */ | 314 | #define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */ |
315 | #define EXT2_MOUNT_XIP 0x010000 /* Execute in place */ | ||
315 | 316 | ||
316 | #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt | 317 | #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt |
317 | #define set_opt(o, opt) o |= EXT2_MOUNT_##opt | 318 | #define set_opt(o, opt) o |= EXT2_MOUNT_##opt |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 74ad31781e3e..4b6e1ab216a5 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -358,6 +358,7 @@ struct ext3_inode { | |||
358 | #define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ | 358 | #define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ |
359 | #define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ | 359 | #define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ |
360 | #define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */ | 360 | #define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */ |
361 | #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ | ||
361 | 362 | ||
362 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ | 363 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ |
363 | #ifndef _LINUX_EXT2_FS_H | 364 | #ifndef _LINUX_EXT2_FS_H |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index e8292af9033b..c8307c02dd07 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
@@ -42,15 +42,15 @@ | |||
42 | * superblock only gets updated once, of course, so don't bother | 42 | * superblock only gets updated once, of course, so don't bother |
43 | * counting that again for the quota updates. */ | 43 | * counting that again for the quota updates. */ |
44 | 44 | ||
45 | #define EXT3_DATA_TRANS_BLOCKS (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ |
46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ |
47 | 2*EXT3_QUOTA_TRANS_BLOCKS) | 47 | 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) |
48 | 48 | ||
49 | /* Delete operations potentially hit one directory's namespace plus an | 49 | /* Delete operations potentially hit one directory's namespace plus an |
50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be |
51 | * generous. We can grow the delete transaction later if necessary. */ | 51 | * generous. We can grow the delete transaction later if necessary. */ |
52 | 52 | ||
53 | #define EXT3_DELETE_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS + 64) | 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) |
54 | 54 | ||
55 | /* Define an arbitrary limit for the amount of data we will anticipate | 55 | /* Define an arbitrary limit for the amount of data we will anticipate |
56 | * writing to any given transaction. For unbounded transactions such as | 56 | * writing to any given transaction. For unbounded transactions such as |
@@ -74,14 +74,17 @@ | |||
74 | #ifdef CONFIG_QUOTA | 74 | #ifdef CONFIG_QUOTA |
75 | /* Amount of blocks needed for quota update - we know that the structure was | 75 | /* Amount of blocks needed for quota update - we know that the structure was |
76 | * allocated so we need to update only inode+data */ | 76 | * allocated so we need to update only inode+data */ |
77 | #define EXT3_QUOTA_TRANS_BLOCKS 2 | 77 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) |
78 | /* Amount of blocks needed for quota insert/delete - we do some block writes | 78 | /* Amount of blocks needed for quota insert/delete - we do some block writes |
79 | * but inode, sb and group updates are done only once */ | 79 | * but inode, sb and group updates are done only once */ |
80 | #define EXT3_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*\ | 80 | #define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ |
81 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3) | 81 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0) |
82 | #define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ | ||
83 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0) | ||
82 | #else | 84 | #else |
83 | #define EXT3_QUOTA_TRANS_BLOCKS 0 | 85 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) 0 |
84 | #define EXT3_QUOTA_INIT_BLOCKS 0 | 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 |
87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | ||
85 | #endif | 88 | #endif |
86 | 89 | ||
87 | int | 90 | int |
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index 704fb76b6334..8a7c82151de9 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h | |||
@@ -25,6 +25,10 @@ | |||
25 | 25 | ||
26 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
27 | 27 | ||
28 | #ifndef force_o_largefile | ||
29 | #define force_o_largefile() (BITS_PER_LONG != 32) | ||
30 | #endif | ||
31 | |||
28 | #if BITS_PER_LONG == 32 | 32 | #if BITS_PER_LONG == 32 |
29 | #define IS_GETLK32(cmd) ((cmd) == F_GETLK) | 33 | #define IS_GETLK32(cmd) ((cmd) == F_GETLK) |
30 | #define IS_SETLK32(cmd) ((cmd) == F_SETLK) | 34 | #define IS_SETLK32(cmd) ((cmd) == F_SETLK) |
diff --git a/include/linux/fs.h b/include/linux/fs.h index e5a8db00df29..3ae8e37bdfc8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -220,6 +220,7 @@ extern int dir_notify_enable; | |||
220 | 220 | ||
221 | struct iovec; | 221 | struct iovec; |
222 | struct nameidata; | 222 | struct nameidata; |
223 | struct kiocb; | ||
223 | struct pipe_inode_info; | 224 | struct pipe_inode_info; |
224 | struct poll_table_struct; | 225 | struct poll_table_struct; |
225 | struct kstatfs; | 226 | struct kstatfs; |
@@ -240,7 +241,7 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock, | |||
240 | typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, | 241 | typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, |
241 | unsigned long max_blocks, | 242 | unsigned long max_blocks, |
242 | struct buffer_head *bh_result, int create); | 243 | struct buffer_head *bh_result, int create); |
243 | typedef void (dio_iodone_t)(struct inode *inode, loff_t offset, | 244 | typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, |
244 | ssize_t bytes, void *private); | 245 | ssize_t bytes, void *private); |
245 | 246 | ||
246 | /* | 247 | /* |
@@ -302,7 +303,6 @@ struct iattr { | |||
302 | struct page; | 303 | struct page; |
303 | struct address_space; | 304 | struct address_space; |
304 | struct writeback_control; | 305 | struct writeback_control; |
305 | struct kiocb; | ||
306 | 306 | ||
307 | struct address_space_operations { | 307 | struct address_space_operations { |
308 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 308 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
@@ -330,6 +330,8 @@ struct address_space_operations { | |||
330 | int (*releasepage) (struct page *, int); | 330 | int (*releasepage) (struct page *, int); |
331 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 331 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
332 | loff_t offset, unsigned long nr_segs); | 332 | loff_t offset, unsigned long nr_segs); |
333 | struct page* (*get_xip_page)(struct address_space *, sector_t, | ||
334 | int); | ||
333 | }; | 335 | }; |
334 | 336 | ||
335 | struct backing_dev_info; | 337 | struct backing_dev_info; |
@@ -581,7 +583,6 @@ struct file { | |||
581 | atomic_t f_count; | 583 | atomic_t f_count; |
582 | unsigned int f_flags; | 584 | unsigned int f_flags; |
583 | mode_t f_mode; | 585 | mode_t f_mode; |
584 | int f_error; | ||
585 | loff_t f_pos; | 586 | loff_t f_pos; |
586 | struct fown_struct f_owner; | 587 | struct fown_struct f_owner; |
587 | unsigned int f_uid, f_gid; | 588 | unsigned int f_uid, f_gid; |
@@ -884,7 +885,9 @@ struct block_device_operations { | |||
884 | int (*open) (struct inode *, struct file *); | 885 | int (*open) (struct inode *, struct file *); |
885 | int (*release) (struct inode *, struct file *); | 886 | int (*release) (struct inode *, struct file *); |
886 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); | 887 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); |
888 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); | ||
887 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); | 889 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); |
890 | int (*direct_access) (struct block_device *, sector_t, unsigned long *); | ||
888 | int (*media_changed) (struct gendisk *); | 891 | int (*media_changed) (struct gendisk *); |
889 | int (*revalidate_disk) (struct gendisk *); | 892 | int (*revalidate_disk) (struct gendisk *); |
890 | struct module *owner; | 893 | struct module *owner; |
@@ -1025,6 +1028,7 @@ struct super_operations { | |||
1025 | #define I_FREEING 16 | 1028 | #define I_FREEING 16 |
1026 | #define I_CLEAR 32 | 1029 | #define I_CLEAR 32 |
1027 | #define I_NEW 64 | 1030 | #define I_NEW 64 |
1031 | #define I_WILL_FREE 128 | ||
1028 | 1032 | ||
1029 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1033 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
1030 | 1034 | ||
@@ -1495,6 +1499,23 @@ extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); | |||
1495 | extern int generic_file_open(struct inode * inode, struct file * filp); | 1499 | extern int generic_file_open(struct inode * inode, struct file * filp); |
1496 | extern int nonseekable_open(struct inode * inode, struct file * filp); | 1500 | extern int nonseekable_open(struct inode * inode, struct file * filp); |
1497 | 1501 | ||
1502 | #ifdef CONFIG_FS_XIP | ||
1503 | extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len, | ||
1504 | loff_t *ppos); | ||
1505 | extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos, | ||
1506 | size_t count, read_actor_t actor, | ||
1507 | void *target); | ||
1508 | extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma); | ||
1509 | extern ssize_t xip_file_write(struct file *filp, const char __user *buf, | ||
1510 | size_t len, loff_t *ppos); | ||
1511 | extern int xip_truncate_page(struct address_space *mapping, loff_t from); | ||
1512 | #else | ||
1513 | static inline int xip_truncate_page(struct address_space *mapping, loff_t from) | ||
1514 | { | ||
1515 | return 0; | ||
1516 | } | ||
1517 | #endif | ||
1518 | |||
1498 | static inline void do_generic_file_read(struct file * filp, loff_t *ppos, | 1519 | static inline void do_generic_file_read(struct file * filp, loff_t *ppos, |
1499 | read_descriptor_t * desc, | 1520 | read_descriptor_t * desc, |
1500 | read_actor_t actor) | 1521 | read_actor_t actor) |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 47dedaf971d6..01796c41c951 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -224,7 +224,7 @@ static inline void free_disk_stats(struct gendisk *disk) | |||
224 | extern void disk_round_stats(struct gendisk *disk); | 224 | extern void disk_round_stats(struct gendisk *disk); |
225 | 225 | ||
226 | /* drivers/block/genhd.c */ | 226 | /* drivers/block/genhd.c */ |
227 | extern int get_blkdev_list(char *); | 227 | extern int get_blkdev_list(char *, int); |
228 | extern void add_disk(struct gendisk *disk); | 228 | extern void add_disk(struct gendisk *disk); |
229 | extern void del_gendisk(struct gendisk *gp); | 229 | extern void del_gendisk(struct gendisk *gp); |
230 | extern void unlink_gendisk(struct gendisk *gp); | 230 | extern void unlink_gendisk(struct gendisk *gp); |
@@ -403,6 +403,7 @@ extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | |||
403 | extern void add_partition(struct gendisk *, int, sector_t, sector_t); | 403 | extern void add_partition(struct gendisk *, int, sector_t, sector_t); |
404 | extern void delete_partition(struct gendisk *, int); | 404 | extern void delete_partition(struct gendisk *, int); |
405 | 405 | ||
406 | extern struct gendisk *alloc_disk_node(int minors, int node_id); | ||
406 | extern struct gendisk *alloc_disk(int minors); | 407 | extern struct gendisk *alloc_disk(int minors); |
407 | extern struct kobject *get_disk(struct gendisk *disk); | 408 | extern struct kobject *get_disk(struct gendisk *disk); |
408 | extern void put_disk(struct gendisk *disk); | 409 | extern void put_disk(struct gendisk *disk); |
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h index ef7f644dd873..36fd18cdad28 100644 --- a/include/linux/i2o-dev.h +++ b/include/linux/i2o-dev.h | |||
@@ -24,6 +24,13 @@ | |||
24 | #define MAX_I2O_CONTROLLERS 32 | 24 | #define MAX_I2O_CONTROLLERS 32 |
25 | 25 | ||
26 | //#include <linux/ioctl.h> | 26 | //#include <linux/ioctl.h> |
27 | #ifndef __KERNEL__ | ||
28 | |||
29 | typedef unsigned char u8; | ||
30 | typedef unsigned short u16; | ||
31 | typedef unsigned int u32; | ||
32 | |||
33 | #endif /* __KERNEL__ */ | ||
27 | 34 | ||
28 | /* | 35 | /* |
29 | * I2O Control IOCTLs and structures | 36 | * I2O Control IOCTLs and structures |
@@ -113,6 +120,10 @@ struct i2o_evt_get { | |||
113 | int lost; | 120 | int lost; |
114 | }; | 121 | }; |
115 | 122 | ||
123 | typedef struct i2o_sg_io_hdr { | ||
124 | unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */ | ||
125 | } i2o_sg_io_hdr_t; | ||
126 | |||
116 | /************************************************************************** | 127 | /************************************************************************** |
117 | * HRT related constants and structures | 128 | * HRT related constants and structures |
118 | **************************************************************************/ | 129 | **************************************************************************/ |
@@ -126,14 +137,6 @@ struct i2o_evt_get { | |||
126 | #define I2O_BUS_CARDBUS 7 | 137 | #define I2O_BUS_CARDBUS 7 |
127 | #define I2O_BUS_UNKNOWN 0x80 | 138 | #define I2O_BUS_UNKNOWN 0x80 |
128 | 139 | ||
129 | #ifndef __KERNEL__ | ||
130 | |||
131 | typedef unsigned char u8; | ||
132 | typedef unsigned short u16; | ||
133 | typedef unsigned int u32; | ||
134 | |||
135 | #endif /* __KERNEL__ */ | ||
136 | |||
137 | typedef struct _i2o_pci_bus { | 140 | typedef struct _i2o_pci_bus { |
138 | u8 PciFunctionNumber; | 141 | u8 PciFunctionNumber; |
139 | u8 PciDeviceNumber; | 142 | u8 PciDeviceNumber; |
@@ -333,7 +336,7 @@ typedef struct _i2o_status_block { | |||
333 | #define I2O_CLASS_ATE_PERIPHERAL 0x061 | 336 | #define I2O_CLASS_ATE_PERIPHERAL 0x061 |
334 | #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 | 337 | #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 |
335 | #define I2O_CLASS_FLOPPY_DEVICE 0x071 | 338 | #define I2O_CLASS_FLOPPY_DEVICE 0x071 |
336 | #define I2O_CLASS_BUS_ADAPTER_PORT 0x080 | 339 | #define I2O_CLASS_BUS_ADAPTER 0x080 |
337 | #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 | 340 | #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 |
338 | #define I2O_CLASS_PEER_TRANSPORT 0x091 | 341 | #define I2O_CLASS_PEER_TRANSPORT 0x091 |
339 | #define I2O_CLASS_END 0xfff | 342 | #define I2O_CLASS_END 0xfff |
@@ -399,4 +402,26 @@ typedef struct _i2o_status_block { | |||
399 | #define ADAPTER_STATE_FAILED 0x10 | 402 | #define ADAPTER_STATE_FAILED 0x10 |
400 | #define ADAPTER_STATE_FAULTED 0x11 | 403 | #define ADAPTER_STATE_FAULTED 0x11 |
401 | 404 | ||
405 | /* | ||
406 | * Software module types | ||
407 | */ | ||
408 | #define I2O_SOFTWARE_MODULE_IRTOS 0x11 | ||
409 | #define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22 | ||
410 | #define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23 | ||
411 | |||
412 | /* | ||
413 | * Vendors | ||
414 | */ | ||
415 | #define I2O_VENDOR_DPT 0x001b | ||
416 | |||
417 | /* | ||
418 | * DPT / Adaptec specific values for i2o_sg_io_hdr flags. | ||
419 | */ | ||
420 | #define I2O_DPT_SG_FLAG_INTERPRET 0x00010000 | ||
421 | #define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000 | ||
422 | |||
423 | #define I2O_DPT_FLASH_FRAG_SIZE 0x10000 | ||
424 | #define I2O_DPT_FLASH_READ 0x0101 | ||
425 | #define I2O_DPT_FLASH_WRITE 0x0102 | ||
426 | |||
402 | #endif /* _I2O_DEV_H */ | 427 | #endif /* _I2O_DEV_H */ |
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index ea9a3ad4b67f..bdc286ec947c 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -119,12 +119,21 @@ struct i2o_driver { | |||
119 | }; | 119 | }; |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Contains all information which are necessary for DMA operations | 122 | * Contains DMA mapped address information |
123 | */ | 123 | */ |
124 | struct i2o_dma { | 124 | struct i2o_dma { |
125 | void *virt; | 125 | void *virt; |
126 | dma_addr_t phys; | 126 | dma_addr_t phys; |
127 | u32 len; | 127 | size_t len; |
128 | }; | ||
129 | |||
130 | /* | ||
131 | * Contains IO mapped address information | ||
132 | */ | ||
133 | struct i2o_io { | ||
134 | void __iomem *virt; | ||
135 | unsigned long phys; | ||
136 | unsigned long len; | ||
128 | }; | 137 | }; |
129 | 138 | ||
130 | /* | 139 | /* |
@@ -147,28 +156,25 @@ struct i2o_controller { | |||
147 | 156 | ||
148 | struct pci_dev *pdev; /* PCI device */ | 157 | struct pci_dev *pdev; /* PCI device */ |
149 | 158 | ||
150 | unsigned int short_req:1; /* use small block sizes */ | 159 | unsigned int promise:1; /* Promise controller */ |
160 | unsigned int adaptec:1; /* DPT / Adaptec controller */ | ||
161 | unsigned int raptor:1; /* split bar */ | ||
151 | unsigned int no_quiesce:1; /* dont quiesce before reset */ | 162 | unsigned int no_quiesce:1; /* dont quiesce before reset */ |
152 | unsigned int raptor:1; /* split bar */ | 163 | unsigned int short_req:1; /* use small block sizes */ |
153 | unsigned int promise:1; /* Promise controller */ | 164 | unsigned int limit_sectors:1; /* limit number of sectors / request */ |
154 | 165 | unsigned int pae_support:1; /* controller has 64-bit SGL support */ | |
155 | #ifdef CONFIG_MTRR | ||
156 | int mtrr_reg0; | ||
157 | int mtrr_reg1; | ||
158 | #endif | ||
159 | 166 | ||
160 | struct list_head devices; /* list of I2O devices */ | 167 | struct list_head devices; /* list of I2O devices */ |
161 | |||
162 | struct notifier_block *event_notifer; /* Events */ | ||
163 | atomic_t users; | ||
164 | struct list_head list; /* Controller list */ | 168 | struct list_head list; /* Controller list */ |
165 | void __iomem *post_port; /* Inbout port address */ | 169 | |
166 | void __iomem *reply_port; /* Outbound port address */ | 170 | void __iomem *in_port; /* Inbout port address */ |
167 | void __iomem *irq_mask; /* Interrupt register address */ | 171 | void __iomem *out_port; /* Outbound port address */ |
172 | void __iomem *irq_status; /* Interrupt status register address */ | ||
173 | void __iomem *irq_mask; /* Interrupt mask register address */ | ||
168 | 174 | ||
169 | /* Dynamic LCT related data */ | 175 | /* Dynamic LCT related data */ |
170 | 176 | ||
171 | struct i2o_dma status; /* status of IOP */ | 177 | struct i2o_dma status; /* IOP status block */ |
172 | 178 | ||
173 | struct i2o_dma hrt; /* HW Resource Table */ | 179 | struct i2o_dma hrt; /* HW Resource Table */ |
174 | i2o_lct *lct; /* Logical Config Table */ | 180 | i2o_lct *lct; /* Logical Config Table */ |
@@ -176,21 +182,19 @@ struct i2o_controller { | |||
176 | struct semaphore lct_lock; /* Lock for LCT updates */ | 182 | struct semaphore lct_lock; /* Lock for LCT updates */ |
177 | struct i2o_dma status_block; /* IOP status block */ | 183 | struct i2o_dma status_block; /* IOP status block */ |
178 | 184 | ||
179 | struct i2o_dma base; /* controller messaging unit */ | 185 | struct i2o_io base; /* controller messaging unit */ |
180 | struct i2o_dma in_queue; /* inbound message queue Host->IOP */ | 186 | struct i2o_io in_queue; /* inbound message queue Host->IOP */ |
181 | struct i2o_dma out_queue; /* outbound message queue IOP->Host */ | 187 | struct i2o_dma out_queue; /* outbound message queue IOP->Host */ |
182 | 188 | ||
183 | unsigned int battery:1; /* Has a battery backup */ | 189 | unsigned int battery:1; /* Has a battery backup */ |
184 | unsigned int io_alloc:1; /* An I/O resource was allocated */ | 190 | unsigned int io_alloc:1; /* An I/O resource was allocated */ |
185 | unsigned int mem_alloc:1; /* A memory resource was allocated */ | 191 | unsigned int mem_alloc:1; /* A memory resource was allocated */ |
186 | 192 | ||
187 | struct resource io_resource; /* I/O resource allocated to the IOP */ | 193 | struct resource io_resource; /* I/O resource allocated to the IOP */ |
188 | struct resource mem_resource; /* Mem resource allocated to the IOP */ | 194 | struct resource mem_resource; /* Mem resource allocated to the IOP */ |
189 | 195 | ||
190 | struct proc_dir_entry *proc_entry; /* /proc dir */ | ||
191 | |||
192 | struct list_head bus_list; /* list of busses on IOP */ | ||
193 | struct device device; | 196 | struct device device; |
197 | struct class_device classdev; /* I2O controller class */ | ||
194 | struct i2o_device *exec; /* Executive */ | 198 | struct i2o_device *exec; /* Executive */ |
195 | #if BITS_PER_LONG == 64 | 199 | #if BITS_PER_LONG == 64 |
196 | spinlock_t context_list_lock; /* lock for context_list */ | 200 | spinlock_t context_list_lock; /* lock for context_list */ |
@@ -241,9 +245,10 @@ struct i2o_sys_tbl { | |||
241 | extern struct list_head i2o_controllers; | 245 | extern struct list_head i2o_controllers; |
242 | 246 | ||
243 | /* Message functions */ | 247 | /* Message functions */ |
244 | static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message __iomem **); | 248 | static inline u32 i2o_msg_get(struct i2o_controller *, |
245 | extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message __iomem **, | 249 | struct i2o_message __iomem **); |
246 | int); | 250 | extern u32 i2o_msg_get_wait(struct i2o_controller *, |
251 | struct i2o_message __iomem **, int); | ||
247 | static inline void i2o_msg_post(struct i2o_controller *, u32); | 252 | static inline void i2o_msg_post(struct i2o_controller *, u32); |
248 | static inline int i2o_msg_post_wait(struct i2o_controller *, u32, | 253 | static inline int i2o_msg_post_wait(struct i2o_controller *, u32, |
249 | unsigned long); | 254 | unsigned long); |
@@ -252,15 +257,6 @@ extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long, | |||
252 | extern void i2o_msg_nop(struct i2o_controller *, u32); | 257 | extern void i2o_msg_nop(struct i2o_controller *, u32); |
253 | static inline void i2o_flush_reply(struct i2o_controller *, u32); | 258 | static inline void i2o_flush_reply(struct i2o_controller *, u32); |
254 | 259 | ||
255 | /* DMA handling functions */ | ||
256 | static inline int i2o_dma_alloc(struct device *, struct i2o_dma *, size_t, | ||
257 | unsigned int); | ||
258 | static inline void i2o_dma_free(struct device *, struct i2o_dma *); | ||
259 | int i2o_dma_realloc(struct device *, struct i2o_dma *, size_t, unsigned int); | ||
260 | |||
261 | static inline int i2o_dma_map(struct device *, struct i2o_dma *); | ||
262 | static inline void i2o_dma_unmap(struct device *, struct i2o_dma *); | ||
263 | |||
264 | /* IOP functions */ | 260 | /* IOP functions */ |
265 | extern int i2o_status_get(struct i2o_controller *); | 261 | extern int i2o_status_get(struct i2o_controller *); |
266 | 262 | ||
@@ -285,6 +281,16 @@ static inline u32 i2o_ptr_high(void *ptr) | |||
285 | { | 281 | { |
286 | return (u32) ((u64) ptr >> 32); | 282 | return (u32) ((u64) ptr >> 32); |
287 | }; | 283 | }; |
284 | |||
285 | static inline u32 i2o_dma_low(dma_addr_t dma_addr) | ||
286 | { | ||
287 | return (u32) (u64) dma_addr; | ||
288 | }; | ||
289 | |||
290 | static inline u32 i2o_dma_high(dma_addr_t dma_addr) | ||
291 | { | ||
292 | return (u32) ((u64) dma_addr >> 32); | ||
293 | }; | ||
288 | #else | 294 | #else |
289 | static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr) | 295 | static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr) |
290 | { | 296 | { |
@@ -315,8 +321,246 @@ static inline u32 i2o_ptr_high(void *ptr) | |||
315 | { | 321 | { |
316 | return 0; | 322 | return 0; |
317 | }; | 323 | }; |
324 | |||
325 | static inline u32 i2o_dma_low(dma_addr_t dma_addr) | ||
326 | { | ||
327 | return (u32) dma_addr; | ||
328 | }; | ||
329 | |||
330 | static inline u32 i2o_dma_high(dma_addr_t dma_addr) | ||
331 | { | ||
332 | return 0; | ||
333 | }; | ||
318 | #endif | 334 | #endif |
319 | 335 | ||
336 | /** | ||
337 | * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL | ||
338 | * @c: I2O controller for which the calculation should be done | ||
339 | * @body_size: maximum body size used for message in 32-bit words. | ||
340 | * | ||
341 | * Return the maximum number of SG elements in a SG list. | ||
342 | */ | ||
343 | static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size) | ||
344 | { | ||
345 | i2o_status_block *sb = c->status_block.virt; | ||
346 | u16 sg_count = | ||
347 | (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) - | ||
348 | body_size; | ||
349 | |||
350 | if (c->pae_support) { | ||
351 | /* | ||
352 | * for 64-bit a SG attribute element must be added and each | ||
353 | * SG element needs 12 bytes instead of 8. | ||
354 | */ | ||
355 | sg_count -= 2; | ||
356 | sg_count /= 3; | ||
357 | } else | ||
358 | sg_count /= 2; | ||
359 | |||
360 | if (c->short_req && (sg_count > 8)) | ||
361 | sg_count = 8; | ||
362 | |||
363 | return sg_count; | ||
364 | }; | ||
365 | |||
366 | /** | ||
367 | * i2o_dma_map_single - Map pointer to controller and fill in I2O message. | ||
368 | * @c: I2O controller | ||
369 | * @ptr: pointer to the data which should be mapped | ||
370 | * @size: size of data in bytes | ||
371 | * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE | ||
372 | * @sg_ptr: pointer to the SG list inside the I2O message | ||
373 | * | ||
374 | * This function does all necessary DMA handling and also writes the I2O | ||
375 | * SGL elements into the I2O message. For details on DMA handling see also | ||
376 | * dma_map_single(). The pointer sg_ptr will only be set to the end of the | ||
377 | * SG list if the allocation was successful. | ||
378 | * | ||
379 | * Returns DMA address which must be checked for failures using | ||
380 | * dma_mapping_error(). | ||
381 | */ | ||
382 | static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, | ||
383 | size_t size, | ||
384 | enum dma_data_direction direction, | ||
385 | u32 __iomem ** sg_ptr) | ||
386 | { | ||
387 | u32 sg_flags; | ||
388 | u32 __iomem *mptr = *sg_ptr; | ||
389 | dma_addr_t dma_addr; | ||
390 | |||
391 | switch (direction) { | ||
392 | case DMA_TO_DEVICE: | ||
393 | sg_flags = 0xd4000000; | ||
394 | break; | ||
395 | case DMA_FROM_DEVICE: | ||
396 | sg_flags = 0xd0000000; | ||
397 | break; | ||
398 | default: | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); | ||
403 | if (!dma_mapping_error(dma_addr)) { | ||
404 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
405 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { | ||
406 | writel(0x7C020002, mptr++); | ||
407 | writel(PAGE_SIZE, mptr++); | ||
408 | } | ||
409 | #endif | ||
410 | |||
411 | writel(sg_flags | size, mptr++); | ||
412 | writel(i2o_dma_low(dma_addr), mptr++); | ||
413 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
414 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) | ||
415 | writel(i2o_dma_high(dma_addr), mptr++); | ||
416 | #endif | ||
417 | *sg_ptr = mptr; | ||
418 | } | ||
419 | return dma_addr; | ||
420 | }; | ||
421 | |||
422 | /** | ||
423 | * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message. | ||
424 | * @c: I2O controller | ||
425 | * @sg: SG list to be mapped | ||
426 | * @sg_count: number of elements in the SG list | ||
427 | * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE | ||
428 | * @sg_ptr: pointer to the SG list inside the I2O message | ||
429 | * | ||
430 | * This function does all necessary DMA handling and also writes the I2O | ||
431 | * SGL elements into the I2O message. For details on DMA handling see also | ||
432 | * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG | ||
433 | * list if the allocation was successful. | ||
434 | * | ||
435 | * Returns 0 on failure or 1 on success. | ||
436 | */ | ||
437 | static inline int i2o_dma_map_sg(struct i2o_controller *c, | ||
438 | struct scatterlist *sg, int sg_count, | ||
439 | enum dma_data_direction direction, | ||
440 | u32 __iomem ** sg_ptr) | ||
441 | { | ||
442 | u32 sg_flags; | ||
443 | u32 __iomem *mptr = *sg_ptr; | ||
444 | |||
445 | switch (direction) { | ||
446 | case DMA_TO_DEVICE: | ||
447 | sg_flags = 0x14000000; | ||
448 | break; | ||
449 | case DMA_FROM_DEVICE: | ||
450 | sg_flags = 0x10000000; | ||
451 | break; | ||
452 | default: | ||
453 | return 0; | ||
454 | } | ||
455 | |||
456 | sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction); | ||
457 | if (!sg_count) | ||
458 | return 0; | ||
459 | |||
460 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
461 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { | ||
462 | writel(0x7C020002, mptr++); | ||
463 | writel(PAGE_SIZE, mptr++); | ||
464 | } | ||
465 | #endif | ||
466 | |||
467 | while (sg_count-- > 0) { | ||
468 | if (!sg_count) | ||
469 | sg_flags |= 0xC0000000; | ||
470 | writel(sg_flags | sg_dma_len(sg), mptr++); | ||
471 | writel(i2o_dma_low(sg_dma_address(sg)), mptr++); | ||
472 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
473 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) | ||
474 | writel(i2o_dma_high(sg_dma_address(sg)), mptr++); | ||
475 | #endif | ||
476 | sg++; | ||
477 | } | ||
478 | *sg_ptr = mptr; | ||
479 | |||
480 | return 1; | ||
481 | }; | ||
482 | |||
483 | /** | ||
484 | * i2o_dma_alloc - Allocate DMA memory | ||
485 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
486 | * @addr: i2o_dma struct which should get the DMA buffer | ||
487 | * @len: length of the new DMA memory | ||
488 | * @gfp_mask: GFP mask | ||
489 | * | ||
490 | * Allocate a coherent DMA memory and write the pointers into addr. | ||
491 | * | ||
492 | * Returns 0 on success or -ENOMEM on failure. | ||
493 | */ | ||
494 | static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, | ||
495 | size_t len, unsigned int gfp_mask) | ||
496 | { | ||
497 | struct pci_dev *pdev = to_pci_dev(dev); | ||
498 | int dma_64 = 0; | ||
499 | |||
500 | if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) { | ||
501 | dma_64 = 1; | ||
502 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) | ||
503 | return -ENOMEM; | ||
504 | } | ||
505 | |||
506 | addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); | ||
507 | |||
508 | if ((sizeof(dma_addr_t) > 4) && dma_64) | ||
509 | if (pci_set_dma_mask(pdev, DMA_64BIT_MASK)) | ||
510 | printk(KERN_WARNING "i2o: unable to set 64-bit DMA"); | ||
511 | |||
512 | if (!addr->virt) | ||
513 | return -ENOMEM; | ||
514 | |||
515 | memset(addr->virt, 0, len); | ||
516 | addr->len = len; | ||
517 | |||
518 | return 0; | ||
519 | }; | ||
520 | |||
521 | /** | ||
522 | * i2o_dma_free - Free DMA memory | ||
523 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
524 | * @addr: i2o_dma struct which contains the DMA buffer | ||
525 | * | ||
526 | * Free a coherent DMA memory and set virtual address of addr to NULL. | ||
527 | */ | ||
528 | static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr) | ||
529 | { | ||
530 | if (addr->virt) { | ||
531 | if (addr->phys) | ||
532 | dma_free_coherent(dev, addr->len, addr->virt, | ||
533 | addr->phys); | ||
534 | else | ||
535 | kfree(addr->virt); | ||
536 | addr->virt = NULL; | ||
537 | } | ||
538 | }; | ||
539 | |||
540 | /** | ||
541 | * i2o_dma_realloc - Realloc DMA memory | ||
542 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
543 | * @addr: pointer to a i2o_dma struct DMA buffer | ||
544 | * @len: new length of memory | ||
545 | * @gfp_mask: GFP mask | ||
546 | * | ||
547 | * If there was something allocated in the addr, free it first. If len > 0 | ||
548 | * than try to allocate it and write the addresses back to the addr | ||
549 | * structure. If len == 0 set the virtual address to NULL. | ||
550 | * | ||
551 | * Returns the 0 on success or negative error code on failure. | ||
552 | */ | ||
553 | static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr, | ||
554 | size_t len, unsigned int gfp_mask) | ||
555 | { | ||
556 | i2o_dma_free(dev, addr); | ||
557 | |||
558 | if (len) | ||
559 | return i2o_dma_alloc(dev, addr, len, gfp_mask); | ||
560 | |||
561 | return 0; | ||
562 | }; | ||
563 | |||
320 | /* I2O driver (OSM) functions */ | 564 | /* I2O driver (OSM) functions */ |
321 | extern int i2o_driver_register(struct i2o_driver *); | 565 | extern int i2o_driver_register(struct i2o_driver *); |
322 | extern void i2o_driver_unregister(struct i2o_driver *); | 566 | extern void i2o_driver_unregister(struct i2o_driver *); |
@@ -385,49 +629,11 @@ extern int i2o_device_claim_release(struct i2o_device *); | |||
385 | /* Exec OSM functions */ | 629 | /* Exec OSM functions */ |
386 | extern int i2o_exec_lct_get(struct i2o_controller *); | 630 | extern int i2o_exec_lct_get(struct i2o_controller *); |
387 | 631 | ||
388 | /* device to i2o_device and driver to i2o_driver convertion functions */ | 632 | /* device / driver / kobject conversion functions */ |
389 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) | 633 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) |
390 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) | 634 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) |
391 | 635 | #define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device) | |
392 | /* | 636 | #define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj)) |
393 | * Messenger inlines | ||
394 | */ | ||
395 | static inline u32 I2O_POST_READ32(struct i2o_controller *c) | ||
396 | { | ||
397 | rmb(); | ||
398 | return readl(c->post_port); | ||
399 | }; | ||
400 | |||
401 | static inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 val) | ||
402 | { | ||
403 | wmb(); | ||
404 | writel(val, c->post_port); | ||
405 | }; | ||
406 | |||
407 | static inline u32 I2O_REPLY_READ32(struct i2o_controller *c) | ||
408 | { | ||
409 | rmb(); | ||
410 | return readl(c->reply_port); | ||
411 | }; | ||
412 | |||
413 | static inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 val) | ||
414 | { | ||
415 | wmb(); | ||
416 | writel(val, c->reply_port); | ||
417 | }; | ||
418 | |||
419 | static inline u32 I2O_IRQ_READ32(struct i2o_controller *c) | ||
420 | { | ||
421 | rmb(); | ||
422 | return readl(c->irq_mask); | ||
423 | }; | ||
424 | |||
425 | static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val) | ||
426 | { | ||
427 | wmb(); | ||
428 | writel(val, c->irq_mask); | ||
429 | wmb(); | ||
430 | }; | ||
431 | 637 | ||
432 | /** | 638 | /** |
433 | * i2o_msg_get - obtain an I2O message from the IOP | 639 | * i2o_msg_get - obtain an I2O message from the IOP |
@@ -443,11 +649,11 @@ static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val) | |||
443 | * available returns I2O_QUEUE_EMPTY and msg is leaved untouched. | 649 | * available returns I2O_QUEUE_EMPTY and msg is leaved untouched. |
444 | */ | 650 | */ |
445 | static inline u32 i2o_msg_get(struct i2o_controller *c, | 651 | static inline u32 i2o_msg_get(struct i2o_controller *c, |
446 | struct i2o_message __iomem **msg) | 652 | struct i2o_message __iomem ** msg) |
447 | { | 653 | { |
448 | u32 m; | 654 | u32 m = readl(c->in_port); |
449 | 655 | ||
450 | if ((m = I2O_POST_READ32(c)) != I2O_QUEUE_EMPTY) | 656 | if (m != I2O_QUEUE_EMPTY) |
451 | *msg = c->in_queue.virt + m; | 657 | *msg = c->in_queue.virt + m; |
452 | 658 | ||
453 | return m; | 659 | return m; |
@@ -462,7 +668,7 @@ static inline u32 i2o_msg_get(struct i2o_controller *c, | |||
462 | */ | 668 | */ |
463 | static inline void i2o_msg_post(struct i2o_controller *c, u32 m) | 669 | static inline void i2o_msg_post(struct i2o_controller *c, u32 m) |
464 | { | 670 | { |
465 | I2O_POST_WRITE32(c, m); | 671 | writel(m, c->in_port); |
466 | }; | 672 | }; |
467 | 673 | ||
468 | /** | 674 | /** |
@@ -491,12 +697,10 @@ static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m, | |||
491 | * The I2O controller must be informed that the reply message is not needed | 697 | * The I2O controller must be informed that the reply message is not needed |
492 | * anymore. If you forget to flush the reply, the message frame can't be | 698 | * anymore. If you forget to flush the reply, the message frame can't be |
493 | * used by the controller anymore and is therefore lost. | 699 | * used by the controller anymore and is therefore lost. |
494 | * | ||
495 | * FIXME: is there a timeout after which the controller reuse the message? | ||
496 | */ | 700 | */ |
497 | static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) | 701 | static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) |
498 | { | 702 | { |
499 | I2O_REPLY_WRITE32(c, m); | 703 | writel(m, c->out_port); |
500 | }; | 704 | }; |
501 | 705 | ||
502 | /** | 706 | /** |
@@ -530,97 +734,13 @@ static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c, | |||
530 | * work for receive side messages as they are kmalloc objects | 734 | * work for receive side messages as they are kmalloc objects |
531 | * in a different pool. | 735 | * in a different pool. |
532 | */ | 736 | */ |
533 | static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct i2o_controller *c, | 737 | static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct |
534 | u32 m) | 738 | i2o_controller *c, |
739 | u32 m) | ||
535 | { | 740 | { |
536 | return c->in_queue.virt + m; | 741 | return c->in_queue.virt + m; |
537 | }; | 742 | }; |
538 | 743 | ||
539 | /** | ||
540 | * i2o_dma_alloc - Allocate DMA memory | ||
541 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
542 | * @addr: i2o_dma struct which should get the DMA buffer | ||
543 | * @len: length of the new DMA memory | ||
544 | * @gfp_mask: GFP mask | ||
545 | * | ||
546 | * Allocate a coherent DMA memory and write the pointers into addr. | ||
547 | * | ||
548 | * Returns 0 on success or -ENOMEM on failure. | ||
549 | */ | ||
550 | static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, | ||
551 | size_t len, unsigned int gfp_mask) | ||
552 | { | ||
553 | addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); | ||
554 | if (!addr->virt) | ||
555 | return -ENOMEM; | ||
556 | |||
557 | memset(addr->virt, 0, len); | ||
558 | addr->len = len; | ||
559 | |||
560 | return 0; | ||
561 | }; | ||
562 | |||
563 | /** | ||
564 | * i2o_dma_free - Free DMA memory | ||
565 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
566 | * @addr: i2o_dma struct which contains the DMA buffer | ||
567 | * | ||
568 | * Free a coherent DMA memory and set virtual address of addr to NULL. | ||
569 | */ | ||
570 | static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr) | ||
571 | { | ||
572 | if (addr->virt) { | ||
573 | if (addr->phys) | ||
574 | dma_free_coherent(dev, addr->len, addr->virt, | ||
575 | addr->phys); | ||
576 | else | ||
577 | kfree(addr->virt); | ||
578 | addr->virt = NULL; | ||
579 | } | ||
580 | }; | ||
581 | |||
582 | /** | ||
583 | * i2o_dma_map - Map the memory to DMA | ||
584 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
585 | * @addr: i2o_dma struct which should be mapped | ||
586 | * | ||
587 | * Map the memory in addr->virt to coherent DMA memory and write the | ||
588 | * physical address into addr->phys. | ||
589 | * | ||
590 | * Returns 0 on success or -ENOMEM on failure. | ||
591 | */ | ||
592 | static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr) | ||
593 | { | ||
594 | if (!addr->virt) | ||
595 | return -EFAULT; | ||
596 | |||
597 | if (!addr->phys) | ||
598 | addr->phys = dma_map_single(dev, addr->virt, addr->len, | ||
599 | DMA_BIDIRECTIONAL); | ||
600 | if (!addr->phys) | ||
601 | return -ENOMEM; | ||
602 | |||
603 | return 0; | ||
604 | }; | ||
605 | |||
606 | /** | ||
607 | * i2o_dma_unmap - Unmap the DMA memory | ||
608 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
609 | * @addr: i2o_dma struct which should be unmapped | ||
610 | * | ||
611 | * Unmap the memory in addr->virt from DMA memory. | ||
612 | */ | ||
613 | static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr) | ||
614 | { | ||
615 | if (!addr->virt) | ||
616 | return; | ||
617 | |||
618 | if (addr->phys) { | ||
619 | dma_unmap_single(dev, addr->phys, addr->len, DMA_BIDIRECTIONAL); | ||
620 | addr->phys = 0; | ||
621 | } | ||
622 | }; | ||
623 | |||
624 | /* | 744 | /* |
625 | * Endian handling wrapped into the macro - keeps the core code | 745 | * Endian handling wrapped into the macro - keeps the core code |
626 | * cleaner. | 746 | * cleaner. |
@@ -773,6 +893,14 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
773 | #define I2O_CMD_SCSI_BUSRESET 0x27 | 893 | #define I2O_CMD_SCSI_BUSRESET 0x27 |
774 | 894 | ||
775 | /* | 895 | /* |
896 | * Bus Adapter Class | ||
897 | */ | ||
898 | #define I2O_CMD_BUS_ADAPTER_RESET 0x85 | ||
899 | #define I2O_CMD_BUS_RESET 0x87 | ||
900 | #define I2O_CMD_BUS_SCAN 0x89 | ||
901 | #define I2O_CMD_BUS_QUIESCE 0x8b | ||
902 | |||
903 | /* | ||
776 | * Random Block Storage Class | 904 | * Random Block Storage Class |
777 | */ | 905 | */ |
778 | #define I2O_CMD_BLOCK_READ 0x30 | 906 | #define I2O_CMD_BLOCK_READ 0x30 |
@@ -784,7 +912,7 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
784 | #define I2O_CMD_BLOCK_MEJECT 0x43 | 912 | #define I2O_CMD_BLOCK_MEJECT 0x43 |
785 | #define I2O_CMD_BLOCK_POWER 0x70 | 913 | #define I2O_CMD_BLOCK_POWER 0x70 |
786 | 914 | ||
787 | #define I2O_PRIVATE_MSG 0xFF | 915 | #define I2O_CMD_PRIVATE 0xFF |
788 | 916 | ||
789 | /* Command status values */ | 917 | /* Command status values */ |
790 | 918 | ||
@@ -922,7 +1050,7 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
922 | #define I2OVER15 0x0001 | 1050 | #define I2OVER15 0x0001 |
923 | #define I2OVER20 0x0002 | 1051 | #define I2OVER20 0x0002 |
924 | 1052 | ||
925 | /* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */ | 1053 | /* Default is 1.5 */ |
926 | #define I2OVERSION I2OVER15 | 1054 | #define I2OVERSION I2OVER15 |
927 | 1055 | ||
928 | #define SGL_OFFSET_0 I2OVERSION | 1056 | #define SGL_OFFSET_0 I2OVERSION |
@@ -933,9 +1061,9 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
933 | #define SGL_OFFSET_8 (0x0080 | I2OVERSION) | 1061 | #define SGL_OFFSET_8 (0x0080 | I2OVERSION) |
934 | #define SGL_OFFSET_9 (0x0090 | I2OVERSION) | 1062 | #define SGL_OFFSET_9 (0x0090 | I2OVERSION) |
935 | #define SGL_OFFSET_10 (0x00A0 | I2OVERSION) | 1063 | #define SGL_OFFSET_10 (0x00A0 | I2OVERSION) |
936 | 1064 | #define SGL_OFFSET_11 (0x00B0 | I2OVERSION) | |
937 | #define TRL_OFFSET_5 (0x0050 | I2OVERSION) | 1065 | #define SGL_OFFSET_12 (0x00C0 | I2OVERSION) |
938 | #define TRL_OFFSET_6 (0x0060 | I2OVERSION) | 1066 | #define SGL_OFFSET(x) (((x)<<4) | I2OVERSION) |
939 | 1067 | ||
940 | /* Transaction Reply Lists (TRL) Control Word structure */ | 1068 | /* Transaction Reply Lists (TRL) Control Word structure */ |
941 | #define TRL_SINGLE_FIXED_LENGTH 0x00 | 1069 | #define TRL_SINGLE_FIXED_LENGTH 0x00 |
@@ -962,17 +1090,13 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
962 | #define ELEVEN_WORD_MSG_SIZE 0x000B0000 | 1090 | #define ELEVEN_WORD_MSG_SIZE 0x000B0000 |
963 | #define I2O_MESSAGE_SIZE(x) ((x)<<16) | 1091 | #define I2O_MESSAGE_SIZE(x) ((x)<<16) |
964 | 1092 | ||
965 | /* Special TID Assignments */ | 1093 | /* special TID assignments */ |
966 | |||
967 | #define ADAPTER_TID 0 | 1094 | #define ADAPTER_TID 0 |
968 | #define HOST_TID 1 | 1095 | #define HOST_TID 1 |
969 | 1096 | ||
970 | #define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */ | 1097 | /* outbound queue defines */ |
971 | #define REPLY_FRAME_SIZE 17 | 1098 | #define I2O_MAX_OUTBOUND_MSG_FRAMES 128 |
972 | #define SG_TABLESIZE 30 | 1099 | #define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */ |
973 | #define NMBR_MSG_FRAMES 128 | ||
974 | |||
975 | #define MSG_POOL_SIZE (MSG_FRAME_SIZE*NMBR_MSG_FRAMES*sizeof(u32)) | ||
976 | 1100 | ||
977 | #define I2O_POST_WAIT_OK 0 | 1101 | #define I2O_POST_WAIT_OK 0 |
978 | #define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT | 1102 | #define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT |
@@ -993,11 +1117,10 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
993 | #define I2O_HRT_GET_TRIES 3 | 1117 | #define I2O_HRT_GET_TRIES 3 |
994 | #define I2O_LCT_GET_TRIES 3 | 1118 | #define I2O_LCT_GET_TRIES 3 |
995 | 1119 | ||
996 | /* request queue sizes */ | 1120 | /* defines for max_sectors and max_phys_segments */ |
997 | #define I2O_MAX_SECTORS 1024 | 1121 | #define I2O_MAX_SECTORS 1024 |
998 | #define I2O_MAX_SEGMENTS 128 | 1122 | #define I2O_MAX_SECTORS_LIMITED 256 |
999 | 1123 | #define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS | |
1000 | #define I2O_REQ_MEMPOOL_SIZE 32 | ||
1001 | 1124 | ||
1002 | #endif /* __KERNEL__ */ | 1125 | #endif /* __KERNEL__ */ |
1003 | #endif /* _I2O_H */ | 1126 | #endif /* _I2O_H */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 336d6e509f59..92129078d4f3 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -917,7 +917,7 @@ typedef struct hwif_s { | |||
917 | unsigned dma; | 917 | unsigned dma; |
918 | 918 | ||
919 | void (*led_act)(void *data, int rw); | 919 | void (*led_act)(void *data, int rw); |
920 | } ide_hwif_t; | 920 | } ____cacheline_maxaligned_in_smp ide_hwif_t; |
921 | 921 | ||
922 | /* | 922 | /* |
923 | * internal ide interrupt handler type | 923 | * internal ide interrupt handler type |
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 2ec265e1045f..596ca6130159 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
@@ -209,6 +209,11 @@ struct kernel_ipmi_msg | |||
209 | #include <linux/list.h> | 209 | #include <linux/list.h> |
210 | #include <linux/module.h> | 210 | #include <linux/module.h> |
211 | 211 | ||
212 | #ifdef CONFIG_PROC_FS | ||
213 | #include <linux/proc_fs.h> | ||
214 | extern struct proc_dir_entry *proc_ipmi_root; | ||
215 | #endif /* CONFIG_PROC_FS */ | ||
216 | |||
212 | /* Opaque type for a IPMI message user. One of these is needed to | 217 | /* Opaque type for a IPMI message user. One of these is needed to |
213 | send and receive messages. */ | 218 | send and receive messages. */ |
214 | typedef struct ipmi_user *ipmi_user_t; | 219 | typedef struct ipmi_user *ipmi_user_t; |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 7fc1022be9ee..12277799c007 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -88,7 +88,6 @@ extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, | |||
88 | struct irqaction *action); | 88 | struct irqaction *action); |
89 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); | 89 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); |
90 | extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret); | 90 | extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret); |
91 | extern void report_bad_irq(unsigned int irq, irq_desc_t *desc, int action_ret); | ||
92 | extern int can_request_irq(unsigned int irq, unsigned long irqflags); | 91 | extern int can_request_irq(unsigned int irq, unsigned long irqflags); |
93 | 92 | ||
94 | extern void init_irq_proc(void); | 93 | extern void init_irq_proc(void); |
diff --git a/include/linux/key-ui.h b/include/linux/key-ui.h index 60cc7b762e78..cc326174a808 100644 --- a/include/linux/key-ui.h +++ b/include/linux/key-ui.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* key-ui.h: key userspace interface stuff for use by keyfs | 1 | /* key-ui.h: key userspace interface stuff |
2 | * | 2 | * |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -31,8 +31,10 @@ extern spinlock_t key_serial_lock; | |||
31 | * subscribed | 31 | * subscribed |
32 | */ | 32 | */ |
33 | struct keyring_list { | 33 | struct keyring_list { |
34 | unsigned maxkeys; /* max keys this list can hold */ | 34 | struct rcu_head rcu; /* RCU deletion hook */ |
35 | unsigned nkeys; /* number of keys currently held */ | 35 | unsigned short maxkeys; /* max keys this list can hold */ |
36 | unsigned short nkeys; /* number of keys currently held */ | ||
37 | unsigned short delkey; /* key to be unlinked by RCU */ | ||
36 | struct key *keys[0]; | 38 | struct key *keys[0]; |
37 | }; | 39 | }; |
38 | 40 | ||
@@ -82,8 +84,45 @@ static inline int key_any_permission(const struct key *key, key_perm_t perm) | |||
82 | return kperm != 0; | 84 | return kperm != 0; |
83 | } | 85 | } |
84 | 86 | ||
87 | static inline int key_task_groups_search(struct task_struct *tsk, gid_t gid) | ||
88 | { | ||
89 | int ret; | ||
90 | |||
91 | task_lock(tsk); | ||
92 | ret = groups_search(tsk->group_info, gid); | ||
93 | task_unlock(tsk); | ||
94 | return ret; | ||
95 | } | ||
96 | |||
97 | static inline int key_task_permission(const struct key *key, | ||
98 | struct task_struct *context, | ||
99 | key_perm_t perm) | ||
100 | { | ||
101 | key_perm_t kperm; | ||
102 | |||
103 | if (key->uid == context->fsuid) { | ||
104 | kperm = key->perm >> 16; | ||
105 | } | ||
106 | else if (key->gid != -1 && | ||
107 | key->perm & KEY_GRP_ALL && ( | ||
108 | key->gid == context->fsgid || | ||
109 | key_task_groups_search(context, key->gid) | ||
110 | ) | ||
111 | ) { | ||
112 | kperm = key->perm >> 8; | ||
113 | } | ||
114 | else { | ||
115 | kperm = key->perm; | ||
116 | } | ||
117 | |||
118 | kperm = kperm & perm & KEY_ALL; | ||
119 | |||
120 | return kperm == perm; | ||
121 | |||
122 | } | ||
85 | 123 | ||
86 | extern struct key *lookup_user_key(key_serial_t id, int create, int part, | 124 | extern struct key *lookup_user_key(struct task_struct *context, |
125 | key_serial_t id, int create, int partial, | ||
87 | key_perm_t perm); | 126 | key_perm_t perm); |
88 | 127 | ||
89 | extern long join_session_keyring(const char *name); | 128 | extern long join_session_keyring(const char *name); |
diff --git a/include/linux/key.h b/include/linux/key.h index 6aa46d0e812f..970bbd916cf4 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/rbtree.h> | 20 | #include <linux/rbtree.h> |
21 | #include <linux/spinlock.h> | 21 | #include <linux/rcupdate.h> |
22 | #include <asm/atomic.h> | 22 | #include <asm/atomic.h> |
23 | 23 | ||
24 | #ifdef __KERNEL__ | 24 | #ifdef __KERNEL__ |
@@ -78,7 +78,6 @@ struct key { | |||
78 | key_serial_t serial; /* key serial number */ | 78 | key_serial_t serial; /* key serial number */ |
79 | struct rb_node serial_node; | 79 | struct rb_node serial_node; |
80 | struct key_type *type; /* type of key */ | 80 | struct key_type *type; /* type of key */ |
81 | rwlock_t lock; /* examination vs change lock */ | ||
82 | struct rw_semaphore sem; /* change vs change sem */ | 81 | struct rw_semaphore sem; /* change vs change sem */ |
83 | struct key_user *user; /* owner of this key */ | 82 | struct key_user *user; /* owner of this key */ |
84 | time_t expiry; /* time at which key expires (or 0) */ | 83 | time_t expiry; /* time at which key expires (or 0) */ |
@@ -86,14 +85,10 @@ struct key { | |||
86 | gid_t gid; | 85 | gid_t gid; |
87 | key_perm_t perm; /* access permissions */ | 86 | key_perm_t perm; /* access permissions */ |
88 | unsigned short quotalen; /* length added to quota */ | 87 | unsigned short quotalen; /* length added to quota */ |
89 | unsigned short datalen; /* payload data length */ | 88 | unsigned short datalen; /* payload data length |
90 | unsigned short flags; /* status flags (change with lock writelocked) */ | 89 | * - may not match RCU dereferenced payload |
91 | #define KEY_FLAG_INSTANTIATED 0x00000001 /* set if key has been instantiated */ | 90 | * - payload should contain own length |
92 | #define KEY_FLAG_DEAD 0x00000002 /* set if key type has been deleted */ | 91 | */ |
93 | #define KEY_FLAG_REVOKED 0x00000004 /* set if key had been revoked */ | ||
94 | #define KEY_FLAG_IN_QUOTA 0x00000008 /* set if key consumes quota */ | ||
95 | #define KEY_FLAG_USER_CONSTRUCT 0x00000010 /* set if key is being constructed in userspace */ | ||
96 | #define KEY_FLAG_NEGATIVE 0x00000020 /* set if key is negative */ | ||
97 | 92 | ||
98 | #ifdef KEY_DEBUGGING | 93 | #ifdef KEY_DEBUGGING |
99 | unsigned magic; | 94 | unsigned magic; |
@@ -101,6 +96,14 @@ struct key { | |||
101 | #define KEY_DEBUG_MAGIC_X 0xf8e9dacbu | 96 | #define KEY_DEBUG_MAGIC_X 0xf8e9dacbu |
102 | #endif | 97 | #endif |
103 | 98 | ||
99 | unsigned long flags; /* status flags (change with bitops) */ | ||
100 | #define KEY_FLAG_INSTANTIATED 0 /* set if key has been instantiated */ | ||
101 | #define KEY_FLAG_DEAD 1 /* set if key type has been deleted */ | ||
102 | #define KEY_FLAG_REVOKED 2 /* set if key had been revoked */ | ||
103 | #define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */ | ||
104 | #define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ | ||
105 | #define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ | ||
106 | |||
104 | /* the description string | 107 | /* the description string |
105 | * - this is used to match a key against search criteria | 108 | * - this is used to match a key against search criteria |
106 | * - this should be a printable string | 109 | * - this should be a printable string |
@@ -196,10 +199,12 @@ extern int key_payload_reserve(struct key *key, size_t datalen); | |||
196 | extern int key_instantiate_and_link(struct key *key, | 199 | extern int key_instantiate_and_link(struct key *key, |
197 | const void *data, | 200 | const void *data, |
198 | size_t datalen, | 201 | size_t datalen, |
199 | struct key *keyring); | 202 | struct key *keyring, |
203 | struct key *instkey); | ||
200 | extern int key_negate_and_link(struct key *key, | 204 | extern int key_negate_and_link(struct key *key, |
201 | unsigned timeout, | 205 | unsigned timeout, |
202 | struct key *keyring); | 206 | struct key *keyring, |
207 | struct key *instkey); | ||
203 | extern void key_revoke(struct key *key); | 208 | extern void key_revoke(struct key *key); |
204 | extern void key_put(struct key *key); | 209 | extern void key_put(struct key *key); |
205 | 210 | ||
@@ -242,14 +247,13 @@ extern struct key *keyring_search(struct key *keyring, | |||
242 | struct key_type *type, | 247 | struct key_type *type, |
243 | const char *description); | 248 | const char *description); |
244 | 249 | ||
245 | extern struct key *search_process_keyrings(struct key_type *type, | ||
246 | const char *description); | ||
247 | |||
248 | extern int keyring_add_key(struct key *keyring, | 250 | extern int keyring_add_key(struct key *keyring, |
249 | struct key *key); | 251 | struct key *key); |
250 | 252 | ||
251 | extern struct key *key_lookup(key_serial_t id); | 253 | extern struct key *key_lookup(key_serial_t id); |
252 | 254 | ||
255 | extern void keyring_replace_payload(struct key *key, void *replacement); | ||
256 | |||
253 | #define key_serial(key) ((key) ? (key)->serial : 0) | 257 | #define key_serial(key) ((key) ? (key)->serial : 0) |
254 | 258 | ||
255 | /* | 259 | /* |
@@ -268,14 +272,22 @@ extern void key_fsuid_changed(struct task_struct *tsk); | |||
268 | extern void key_fsgid_changed(struct task_struct *tsk); | 272 | extern void key_fsgid_changed(struct task_struct *tsk); |
269 | extern void key_init(void); | 273 | extern void key_init(void); |
270 | 274 | ||
275 | #define __install_session_keyring(tsk, keyring) \ | ||
276 | ({ \ | ||
277 | struct key *old_session = tsk->signal->session_keyring; \ | ||
278 | tsk->signal->session_keyring = keyring; \ | ||
279 | old_session; \ | ||
280 | }) | ||
281 | |||
271 | #else /* CONFIG_KEYS */ | 282 | #else /* CONFIG_KEYS */ |
272 | 283 | ||
273 | #define key_validate(k) 0 | 284 | #define key_validate(k) 0 |
274 | #define key_serial(k) 0 | 285 | #define key_serial(k) 0 |
275 | #define key_get(k) NULL | 286 | #define key_get(k) ({ NULL; }) |
276 | #define key_put(k) do { } while(0) | 287 | #define key_put(k) do { } while(0) |
277 | #define alloc_uid_keyring(u) 0 | 288 | #define alloc_uid_keyring(u) 0 |
278 | #define switch_uid_keyring(u) do { } while(0) | 289 | #define switch_uid_keyring(u) do { } while(0) |
290 | #define __install_session_keyring(t, k) ({ NULL; }) | ||
279 | #define copy_keys(f,t) 0 | 291 | #define copy_keys(f,t) 0 |
280 | #define copy_thread_group_keys(t) 0 | 292 | #define copy_thread_group_keys(t) 0 |
281 | #define exit_keys(t) do { } while(0) | 293 | #define exit_keys(t) do { } while(0) |
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h index 381dedc370a3..8d7c59a29e09 100644 --- a/include/linux/keyctl.h +++ b/include/linux/keyctl.h | |||
@@ -20,6 +20,16 @@ | |||
20 | #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ | 20 | #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ |
21 | #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ | 21 | #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ |
22 | 22 | ||
23 | /* request-key default keyrings */ | ||
24 | #define KEY_REQKEY_DEFL_NO_CHANGE -1 | ||
25 | #define KEY_REQKEY_DEFL_DEFAULT 0 | ||
26 | #define KEY_REQKEY_DEFL_THREAD_KEYRING 1 | ||
27 | #define KEY_REQKEY_DEFL_PROCESS_KEYRING 2 | ||
28 | #define KEY_REQKEY_DEFL_SESSION_KEYRING 3 | ||
29 | #define KEY_REQKEY_DEFL_USER_KEYRING 4 | ||
30 | #define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 | ||
31 | #define KEY_REQKEY_DEFL_GROUP_KEYRING 6 | ||
32 | |||
23 | /* keyctl commands */ | 33 | /* keyctl commands */ |
24 | #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ | 34 | #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ |
25 | #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ | 35 | #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ |
@@ -35,5 +45,6 @@ | |||
35 | #define KEYCTL_READ 11 /* read a key or keyring's contents */ | 45 | #define KEYCTL_READ 11 /* read a key or keyring's contents */ |
36 | #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ | 46 | #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ |
37 | #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ | 47 | #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ |
48 | #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ | ||
38 | 49 | ||
39 | #endif /* _LINUX_KEYCTL_H */ | 50 | #endif /* _LINUX_KEYCTL_H */ |
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 95d0e4b0814d..e4a231549407 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -19,6 +19,7 @@ | |||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/stddef.h> | ||
22 | #include <linux/config.h> | 23 | #include <linux/config.h> |
23 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
24 | #include <linux/compiler.h> | 25 | #include <linux/compiler.h> |
@@ -34,7 +35,17 @@ static inline int request_module(const char * name, ...) { return -ENOSYS; } | |||
34 | #endif | 35 | #endif |
35 | 36 | ||
36 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | 37 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) |
37 | extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait); | 38 | |
39 | struct key; | ||
40 | extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[], | ||
41 | struct key *session_keyring, int wait); | ||
42 | |||
43 | static inline int | ||
44 | call_usermodehelper(char *path, char **argv, char **envp, int wait) | ||
45 | { | ||
46 | return call_usermodehelper_keys(path, argv, envp, NULL, wait); | ||
47 | } | ||
48 | |||
38 | extern void usermodehelper_init(void); | 49 | extern void usermodehelper_init(void); |
39 | 50 | ||
40 | #endif /* __LINUX_KMOD_H__ */ | 51 | #endif /* __LINUX_KMOD_H__ */ |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 99ddba5a4e00..5e1a7b0d7b3f 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -25,27 +25,45 @@ | |||
25 | * Rusty Russell). | 25 | * Rusty Russell). |
26 | * 2004-July Suparna Bhattacharya <suparna@in.ibm.com> added jumper probes | 26 | * 2004-July Suparna Bhattacharya <suparna@in.ibm.com> added jumper probes |
27 | * interface to access function arguments. | 27 | * interface to access function arguments. |
28 | * 2005-May Hien Nguyen <hien@us.ibm.com> and Jim Keniston | ||
29 | * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi | ||
30 | * <prasanna@in.ibm.com> added function-return probes. | ||
28 | */ | 31 | */ |
29 | #include <linux/config.h> | 32 | #include <linux/config.h> |
30 | #include <linux/list.h> | 33 | #include <linux/list.h> |
31 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
32 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
36 | |||
33 | #include <asm/kprobes.h> | 37 | #include <asm/kprobes.h> |
34 | 38 | ||
39 | /* kprobe_status settings */ | ||
40 | #define KPROBE_HIT_ACTIVE 0x00000001 | ||
41 | #define KPROBE_HIT_SS 0x00000002 | ||
42 | #define KPROBE_REENTER 0x00000004 | ||
43 | #define KPROBE_HIT_SSDONE 0x00000008 | ||
44 | |||
35 | struct kprobe; | 45 | struct kprobe; |
36 | struct pt_regs; | 46 | struct pt_regs; |
47 | struct kretprobe; | ||
48 | struct kretprobe_instance; | ||
37 | typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *); | 49 | typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *); |
38 | typedef int (*kprobe_break_handler_t) (struct kprobe *, struct pt_regs *); | 50 | typedef int (*kprobe_break_handler_t) (struct kprobe *, struct pt_regs *); |
39 | typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *, | 51 | typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *, |
40 | unsigned long flags); | 52 | unsigned long flags); |
41 | typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *, | 53 | typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *, |
42 | int trapnr); | 54 | int trapnr); |
55 | typedef int (*kretprobe_handler_t) (struct kretprobe_instance *, | ||
56 | struct pt_regs *); | ||
57 | |||
43 | struct kprobe { | 58 | struct kprobe { |
44 | struct hlist_node hlist; | 59 | struct hlist_node hlist; |
45 | 60 | ||
46 | /* list of kprobes for multi-handler support */ | 61 | /* list of kprobes for multi-handler support */ |
47 | struct list_head list; | 62 | struct list_head list; |
48 | 63 | ||
64 | /*count the number of times this probe was temporarily disarmed */ | ||
65 | unsigned long nmissed; | ||
66 | |||
49 | /* location of the probe point */ | 67 | /* location of the probe point */ |
50 | kprobe_opcode_t *addr; | 68 | kprobe_opcode_t *addr; |
51 | 69 | ||
@@ -85,6 +103,62 @@ struct jprobe { | |||
85 | kprobe_opcode_t *entry; /* probe handling code to jump to */ | 103 | kprobe_opcode_t *entry; /* probe handling code to jump to */ |
86 | }; | 104 | }; |
87 | 105 | ||
106 | #ifdef ARCH_SUPPORTS_KRETPROBES | ||
107 | extern int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs); | ||
108 | extern void trampoline_post_handler(struct kprobe *p, struct pt_regs *regs, | ||
109 | unsigned long flags); | ||
110 | extern struct task_struct *arch_get_kprobe_task(void *ptr); | ||
111 | extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); | ||
112 | extern void arch_kprobe_flush_task(struct task_struct *tk); | ||
113 | #else /* ARCH_SUPPORTS_KRETPROBES */ | ||
114 | static inline void kretprobe_trampoline(void) | ||
115 | { | ||
116 | } | ||
117 | static inline int trampoline_probe_handler(struct kprobe *p, | ||
118 | struct pt_regs *regs) | ||
119 | { | ||
120 | return 0; | ||
121 | } | ||
122 | static inline void trampoline_post_handler(struct kprobe *p, | ||
123 | struct pt_regs *regs, unsigned long flags) | ||
124 | { | ||
125 | } | ||
126 | static inline void arch_prepare_kretprobe(struct kretprobe *rp, | ||
127 | struct pt_regs *regs) | ||
128 | { | ||
129 | } | ||
130 | static inline void arch_kprobe_flush_task(struct task_struct *tk) | ||
131 | { | ||
132 | } | ||
133 | #define arch_get_kprobe_task(ptr) ((struct task_struct *)NULL) | ||
134 | #endif /* ARCH_SUPPORTS_KRETPROBES */ | ||
135 | /* | ||
136 | * Function-return probe - | ||
137 | * Note: | ||
138 | * User needs to provide a handler function, and initialize maxactive. | ||
139 | * maxactive - The maximum number of instances of the probed function that | ||
140 | * can be active concurrently. | ||
141 | * nmissed - tracks the number of times the probed function's return was | ||
142 | * ignored, due to maxactive being too low. | ||
143 | * | ||
144 | */ | ||
145 | struct kretprobe { | ||
146 | struct kprobe kp; | ||
147 | kretprobe_handler_t handler; | ||
148 | int maxactive; | ||
149 | int nmissed; | ||
150 | struct hlist_head free_instances; | ||
151 | struct hlist_head used_instances; | ||
152 | }; | ||
153 | |||
154 | struct kretprobe_instance { | ||
155 | struct hlist_node uflist; /* either on free list or used list */ | ||
156 | struct hlist_node hlist; | ||
157 | struct kretprobe *rp; | ||
158 | void *ret_addr; | ||
159 | void *stack_addr; | ||
160 | }; | ||
161 | |||
88 | #ifdef CONFIG_KPROBES | 162 | #ifdef CONFIG_KPROBES |
89 | /* Locks kprobe: irq must be disabled */ | 163 | /* Locks kprobe: irq must be disabled */ |
90 | void lock_kprobes(void); | 164 | void lock_kprobes(void); |
@@ -99,11 +173,14 @@ static inline int kprobe_running(void) | |||
99 | 173 | ||
100 | extern int arch_prepare_kprobe(struct kprobe *p); | 174 | extern int arch_prepare_kprobe(struct kprobe *p); |
101 | extern void arch_copy_kprobe(struct kprobe *p); | 175 | extern void arch_copy_kprobe(struct kprobe *p); |
176 | extern void arch_arm_kprobe(struct kprobe *p); | ||
177 | extern void arch_disarm_kprobe(struct kprobe *p); | ||
102 | extern void arch_remove_kprobe(struct kprobe *p); | 178 | extern void arch_remove_kprobe(struct kprobe *p); |
103 | extern void show_registers(struct pt_regs *regs); | 179 | extern void show_registers(struct pt_regs *regs); |
104 | 180 | ||
105 | /* Get the kprobe at this addr (if any). Must have called lock_kprobes */ | 181 | /* Get the kprobe at this addr (if any). Must have called lock_kprobes */ |
106 | struct kprobe *get_kprobe(void *addr); | 182 | struct kprobe *get_kprobe(void *addr); |
183 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); | ||
107 | 184 | ||
108 | int register_kprobe(struct kprobe *p); | 185 | int register_kprobe(struct kprobe *p); |
109 | void unregister_kprobe(struct kprobe *p); | 186 | void unregister_kprobe(struct kprobe *p); |
@@ -113,7 +190,16 @@ int register_jprobe(struct jprobe *p); | |||
113 | void unregister_jprobe(struct jprobe *p); | 190 | void unregister_jprobe(struct jprobe *p); |
114 | void jprobe_return(void); | 191 | void jprobe_return(void); |
115 | 192 | ||
116 | #else | 193 | int register_kretprobe(struct kretprobe *rp); |
194 | void unregister_kretprobe(struct kretprobe *rp); | ||
195 | |||
196 | struct kretprobe_instance *get_free_rp_inst(struct kretprobe *rp); | ||
197 | struct kretprobe_instance *get_rp_inst(void *sara); | ||
198 | struct kretprobe_instance *get_rp_inst_tsk(struct task_struct *tk); | ||
199 | void add_rp_inst(struct kretprobe_instance *ri); | ||
200 | void kprobe_flush_task(struct task_struct *tk); | ||
201 | void recycle_rp_inst(struct kretprobe_instance *ri); | ||
202 | #else /* CONFIG_KPROBES */ | ||
117 | static inline int kprobe_running(void) | 203 | static inline int kprobe_running(void) |
118 | { | 204 | { |
119 | return 0; | 205 | return 0; |
@@ -135,5 +221,15 @@ static inline void unregister_jprobe(struct jprobe *p) | |||
135 | static inline void jprobe_return(void) | 221 | static inline void jprobe_return(void) |
136 | { | 222 | { |
137 | } | 223 | } |
138 | #endif | 224 | static inline int register_kretprobe(struct kretprobe *rp) |
225 | { | ||
226 | return -ENOSYS; | ||
227 | } | ||
228 | static inline void unregister_kretprobe(struct kretprobe *rp) | ||
229 | { | ||
230 | } | ||
231 | static inline void kprobe_flush_task(struct task_struct *tk) | ||
232 | { | ||
233 | } | ||
234 | #endif /* CONFIG_KPROBES */ | ||
139 | #endif /* _LINUX_KPROBES_H */ | 235 | #endif /* _LINUX_KPROBES_H */ |
diff --git a/include/linux/loop.h b/include/linux/loop.h index 8220d9c9da00..53fa51595443 100644 --- a/include/linux/loop.h +++ b/include/linux/loop.h | |||
@@ -61,7 +61,7 @@ struct loop_device { | |||
61 | struct semaphore lo_sem; | 61 | struct semaphore lo_sem; |
62 | struct semaphore lo_ctl_mutex; | 62 | struct semaphore lo_ctl_mutex; |
63 | struct semaphore lo_bh_mutex; | 63 | struct semaphore lo_bh_mutex; |
64 | atomic_t lo_pending; | 64 | int lo_pending; |
65 | 65 | ||
66 | request_queue_t *lo_queue; | 66 | request_queue_t *lo_queue; |
67 | }; | 67 | }; |
diff --git a/include/linux/mempool.h b/include/linux/mempool.h index 4a36edf1c974..796220ce47cc 100644 --- a/include/linux/mempool.h +++ b/include/linux/mempool.h | |||
@@ -20,9 +20,14 @@ typedef struct mempool_s { | |||
20 | mempool_free_t *free; | 20 | mempool_free_t *free; |
21 | wait_queue_head_t wait; | 21 | wait_queue_head_t wait; |
22 | } mempool_t; | 22 | } mempool_t; |
23 | extern mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn, | 23 | |
24 | mempool_free_t *free_fn, void *pool_data); | 24 | extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn, |
25 | extern int mempool_resize(mempool_t *pool, int new_min_nr, unsigned int __nocast gfp_mask); | 25 | mempool_free_t *free_fn, void *pool_data); |
26 | extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn, | ||
27 | mempool_free_t *free_fn, void *pool_data, int nid); | ||
28 | |||
29 | extern int mempool_resize(mempool_t *pool, int new_min_nr, | ||
30 | unsigned int __nocast gfp_mask); | ||
26 | extern void mempool_destroy(mempool_t *pool); | 31 | extern void mempool_destroy(mempool_t *pool); |
27 | extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); | 32 | extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); |
28 | extern void mempool_free(void *element, mempool_t *pool); | 33 | extern void mempool_free(void *element, mempool_t *pool); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 1813b162b0a8..6eb7f48317f8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -395,19 +395,81 @@ static inline void put_page(struct page *page) | |||
395 | /* | 395 | /* |
396 | * The zone field is never updated after free_area_init_core() | 396 | * The zone field is never updated after free_area_init_core() |
397 | * sets it, so none of the operations on it need to be atomic. | 397 | * sets it, so none of the operations on it need to be atomic. |
398 | * We'll have up to (MAX_NUMNODES * MAX_NR_ZONES) zones total, | ||
399 | * so we use (MAX_NODES_SHIFT + MAX_ZONES_SHIFT) here to get enough bits. | ||
400 | */ | 398 | */ |
401 | #define NODEZONE_SHIFT (sizeof(page_flags_t)*8 - MAX_NODES_SHIFT - MAX_ZONES_SHIFT) | 399 | |
402 | #define NODEZONE(node, zone) ((node << ZONES_SHIFT) | zone) | 400 | |
401 | /* | ||
402 | * page->flags layout: | ||
403 | * | ||
404 | * There are three possibilities for how page->flags get | ||
405 | * laid out. The first is for the normal case, without | ||
406 | * sparsemem. The second is for sparsemem when there is | ||
407 | * plenty of space for node and section. The last is when | ||
408 | * we have run out of space and have to fall back to an | ||
409 | * alternate (slower) way of determining the node. | ||
410 | * | ||
411 | * No sparsemem: | NODE | ZONE | ... | FLAGS | | ||
412 | * with space for node: | SECTION | NODE | ZONE | ... | FLAGS | | ||
413 | * no space for node: | SECTION | ZONE | ... | FLAGS | | ||
414 | */ | ||
415 | #ifdef CONFIG_SPARSEMEM | ||
416 | #define SECTIONS_WIDTH SECTIONS_SHIFT | ||
417 | #else | ||
418 | #define SECTIONS_WIDTH 0 | ||
419 | #endif | ||
420 | |||
421 | #define ZONES_WIDTH ZONES_SHIFT | ||
422 | |||
423 | #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED | ||
424 | #define NODES_WIDTH NODES_SHIFT | ||
425 | #else | ||
426 | #define NODES_WIDTH 0 | ||
427 | #endif | ||
428 | |||
429 | /* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */ | ||
430 | #define SECTIONS_PGOFF ((sizeof(page_flags_t)*8) - SECTIONS_WIDTH) | ||
431 | #define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) | ||
432 | #define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) | ||
433 | |||
434 | /* | ||
435 | * We are going to use the flags for the page to node mapping if its in | ||
436 | * there. This includes the case where there is no node, so it is implicit. | ||
437 | */ | ||
438 | #define FLAGS_HAS_NODE (NODES_WIDTH > 0 || NODES_SHIFT == 0) | ||
439 | |||
440 | #ifndef PFN_SECTION_SHIFT | ||
441 | #define PFN_SECTION_SHIFT 0 | ||
442 | #endif | ||
443 | |||
444 | /* | ||
445 | * Define the bit shifts to access each section. For non-existant | ||
446 | * sections we define the shift as 0; that plus a 0 mask ensures | ||
447 | * the compiler will optimise away reference to them. | ||
448 | */ | ||
449 | #define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0)) | ||
450 | #define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) | ||
451 | #define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) | ||
452 | |||
453 | /* NODE:ZONE or SECTION:ZONE is used to lookup the zone from a page. */ | ||
454 | #if FLAGS_HAS_NODE | ||
455 | #define ZONETABLE_SHIFT (NODES_SHIFT + ZONES_SHIFT) | ||
456 | #else | ||
457 | #define ZONETABLE_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT) | ||
458 | #endif | ||
459 | #define ZONETABLE_PGSHIFT ZONES_PGSHIFT | ||
460 | |||
461 | #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED | ||
462 | #error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED | ||
463 | #endif | ||
464 | |||
465 | #define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) | ||
466 | #define NODES_MASK ((1UL << NODES_WIDTH) - 1) | ||
467 | #define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) | ||
468 | #define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) | ||
403 | 469 | ||
404 | static inline unsigned long page_zonenum(struct page *page) | 470 | static inline unsigned long page_zonenum(struct page *page) |
405 | { | 471 | { |
406 | return (page->flags >> NODEZONE_SHIFT) & (~(~0UL << ZONES_SHIFT)); | 472 | return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; |
407 | } | ||
408 | static inline unsigned long page_to_nid(struct page *page) | ||
409 | { | ||
410 | return (page->flags >> (NODEZONE_SHIFT + ZONES_SHIFT)); | ||
411 | } | 473 | } |
412 | 474 | ||
413 | struct zone; | 475 | struct zone; |
@@ -415,13 +477,44 @@ extern struct zone *zone_table[]; | |||
415 | 477 | ||
416 | static inline struct zone *page_zone(struct page *page) | 478 | static inline struct zone *page_zone(struct page *page) |
417 | { | 479 | { |
418 | return zone_table[page->flags >> NODEZONE_SHIFT]; | 480 | return zone_table[(page->flags >> ZONETABLE_PGSHIFT) & |
481 | ZONETABLE_MASK]; | ||
482 | } | ||
483 | |||
484 | static inline unsigned long page_to_nid(struct page *page) | ||
485 | { | ||
486 | if (FLAGS_HAS_NODE) | ||
487 | return (page->flags >> NODES_PGSHIFT) & NODES_MASK; | ||
488 | else | ||
489 | return page_zone(page)->zone_pgdat->node_id; | ||
490 | } | ||
491 | static inline unsigned long page_to_section(struct page *page) | ||
492 | { | ||
493 | return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; | ||
494 | } | ||
495 | |||
496 | static inline void set_page_zone(struct page *page, unsigned long zone) | ||
497 | { | ||
498 | page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); | ||
499 | page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; | ||
500 | } | ||
501 | static inline void set_page_node(struct page *page, unsigned long node) | ||
502 | { | ||
503 | page->flags &= ~(NODES_MASK << NODES_PGSHIFT); | ||
504 | page->flags |= (node & NODES_MASK) << NODES_PGSHIFT; | ||
505 | } | ||
506 | static inline void set_page_section(struct page *page, unsigned long section) | ||
507 | { | ||
508 | page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); | ||
509 | page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; | ||
419 | } | 510 | } |
420 | 511 | ||
421 | static inline void set_page_zone(struct page *page, unsigned long nodezone_num) | 512 | static inline void set_page_links(struct page *page, unsigned long zone, |
513 | unsigned long node, unsigned long pfn) | ||
422 | { | 514 | { |
423 | page->flags &= ~(~0UL << NODEZONE_SHIFT); | 515 | set_page_zone(page, zone); |
424 | page->flags |= nodezone_num << NODEZONE_SHIFT; | 516 | set_page_node(page, node); |
517 | set_page_section(page, pfn_to_section_nr(pfn)); | ||
425 | } | 518 | } |
426 | 519 | ||
427 | #ifndef CONFIG_DISCONTIGMEM | 520 | #ifndef CONFIG_DISCONTIGMEM |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 4733d35d8223..6c90461ed99f 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -269,7 +269,9 @@ typedef struct pglist_data { | |||
269 | struct zone node_zones[MAX_NR_ZONES]; | 269 | struct zone node_zones[MAX_NR_ZONES]; |
270 | struct zonelist node_zonelists[GFP_ZONETYPES]; | 270 | struct zonelist node_zonelists[GFP_ZONETYPES]; |
271 | int nr_zones; | 271 | int nr_zones; |
272 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | ||
272 | struct page *node_mem_map; | 273 | struct page *node_mem_map; |
274 | #endif | ||
273 | struct bootmem_data *bdata; | 275 | struct bootmem_data *bdata; |
274 | unsigned long node_start_pfn; | 276 | unsigned long node_start_pfn; |
275 | unsigned long node_present_pages; /* total number of physical pages */ | 277 | unsigned long node_present_pages; /* total number of physical pages */ |
@@ -284,6 +286,12 @@ typedef struct pglist_data { | |||
284 | 286 | ||
285 | #define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) | 287 | #define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) |
286 | #define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages) | 288 | #define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages) |
289 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | ||
290 | #define pgdat_page_nr(pgdat, pagenr) ((pgdat)->node_mem_map + (pagenr)) | ||
291 | #else | ||
292 | #define pgdat_page_nr(pgdat, pagenr) pfn_to_page((pgdat)->node_start_pfn + (pagenr)) | ||
293 | #endif | ||
294 | #define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr)) | ||
287 | 295 | ||
288 | extern struct pglist_data *pgdat_list; | 296 | extern struct pglist_data *pgdat_list; |
289 | 297 | ||
@@ -400,7 +408,7 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, | |||
400 | /* Returns the number of the current Node. */ | 408 | /* Returns the number of the current Node. */ |
401 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) | 409 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) |
402 | 410 | ||
403 | #ifndef CONFIG_DISCONTIGMEM | 411 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
404 | 412 | ||
405 | extern struct pglist_data contig_page_data; | 413 | extern struct pglist_data contig_page_data; |
406 | #define NODE_DATA(nid) (&contig_page_data) | 414 | #define NODE_DATA(nid) (&contig_page_data) |
@@ -408,36 +416,177 @@ extern struct pglist_data contig_page_data; | |||
408 | #define MAX_NODES_SHIFT 1 | 416 | #define MAX_NODES_SHIFT 1 |
409 | #define pfn_to_nid(pfn) (0) | 417 | #define pfn_to_nid(pfn) (0) |
410 | 418 | ||
411 | #else /* CONFIG_DISCONTIGMEM */ | 419 | #else /* CONFIG_NEED_MULTIPLE_NODES */ |
412 | 420 | ||
413 | #include <asm/mmzone.h> | 421 | #include <asm/mmzone.h> |
414 | 422 | ||
423 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | ||
424 | |||
425 | #ifdef CONFIG_SPARSEMEM | ||
426 | #include <asm/sparsemem.h> | ||
427 | #endif | ||
428 | |||
415 | #if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) | 429 | #if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) |
416 | /* | 430 | /* |
417 | * with 32 bit page->flags field, we reserve 8 bits for node/zone info. | 431 | * with 32 bit page->flags field, we reserve 8 bits for node/zone info. |
418 | * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes. | 432 | * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes. |
419 | */ | 433 | */ |
420 | #define MAX_NODES_SHIFT 6 | 434 | #define FLAGS_RESERVED 8 |
435 | |||
421 | #elif BITS_PER_LONG == 64 | 436 | #elif BITS_PER_LONG == 64 |
422 | /* | 437 | /* |
423 | * with 64 bit flags field, there's plenty of room. | 438 | * with 64 bit flags field, there's plenty of room. |
424 | */ | 439 | */ |
425 | #define MAX_NODES_SHIFT 10 | 440 | #define FLAGS_RESERVED 32 |
441 | |||
442 | #else | ||
443 | |||
444 | #error BITS_PER_LONG not defined | ||
445 | |||
446 | #endif | ||
447 | |||
448 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
449 | #define early_pfn_to_nid(nid) (0UL) | ||
426 | #endif | 450 | #endif |
427 | 451 | ||
428 | #endif /* !CONFIG_DISCONTIGMEM */ | 452 | #define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT) |
453 | #define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT) | ||
454 | |||
455 | #ifdef CONFIG_SPARSEMEM | ||
456 | |||
457 | /* | ||
458 | * SECTION_SHIFT #bits space required to store a section # | ||
459 | * | ||
460 | * PA_SECTION_SHIFT physical address to/from section number | ||
461 | * PFN_SECTION_SHIFT pfn to/from section number | ||
462 | */ | ||
463 | #define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS) | ||
464 | |||
465 | #define PA_SECTION_SHIFT (SECTION_SIZE_BITS) | ||
466 | #define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT) | ||
467 | |||
468 | #define NR_MEM_SECTIONS (1UL << SECTIONS_SHIFT) | ||
429 | 469 | ||
430 | #if NODES_SHIFT > MAX_NODES_SHIFT | 470 | #define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT) |
431 | #error NODES_SHIFT > MAX_NODES_SHIFT | 471 | #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) |
472 | |||
473 | #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS | ||
474 | #error Allocator MAX_ORDER exceeds SECTION_SIZE | ||
432 | #endif | 475 | #endif |
433 | 476 | ||
434 | /* There are currently 3 zones: DMA, Normal & Highmem, thus we need 2 bits */ | 477 | struct page; |
435 | #define MAX_ZONES_SHIFT 2 | 478 | struct mem_section { |
479 | /* | ||
480 | * This is, logically, a pointer to an array of struct | ||
481 | * pages. However, it is stored with some other magic. | ||
482 | * (see sparse.c::sparse_init_one_section()) | ||
483 | * | ||
484 | * Making it a UL at least makes someone do a cast | ||
485 | * before using it wrong. | ||
486 | */ | ||
487 | unsigned long section_mem_map; | ||
488 | }; | ||
489 | |||
490 | extern struct mem_section mem_section[NR_MEM_SECTIONS]; | ||
436 | 491 | ||
437 | #if ZONES_SHIFT > MAX_ZONES_SHIFT | 492 | static inline struct mem_section *__nr_to_section(unsigned long nr) |
438 | #error ZONES_SHIFT > MAX_ZONES_SHIFT | 493 | { |
494 | return &mem_section[nr]; | ||
495 | } | ||
496 | |||
497 | /* | ||
498 | * We use the lower bits of the mem_map pointer to store | ||
499 | * a little bit of information. There should be at least | ||
500 | * 3 bits here due to 32-bit alignment. | ||
501 | */ | ||
502 | #define SECTION_MARKED_PRESENT (1UL<<0) | ||
503 | #define SECTION_HAS_MEM_MAP (1UL<<1) | ||
504 | #define SECTION_MAP_LAST_BIT (1UL<<2) | ||
505 | #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) | ||
506 | |||
507 | static inline struct page *__section_mem_map_addr(struct mem_section *section) | ||
508 | { | ||
509 | unsigned long map = section->section_mem_map; | ||
510 | map &= SECTION_MAP_MASK; | ||
511 | return (struct page *)map; | ||
512 | } | ||
513 | |||
514 | static inline int valid_section(struct mem_section *section) | ||
515 | { | ||
516 | return (section->section_mem_map & SECTION_MARKED_PRESENT); | ||
517 | } | ||
518 | |||
519 | static inline int section_has_mem_map(struct mem_section *section) | ||
520 | { | ||
521 | return (section->section_mem_map & SECTION_HAS_MEM_MAP); | ||
522 | } | ||
523 | |||
524 | static inline int valid_section_nr(unsigned long nr) | ||
525 | { | ||
526 | return valid_section(__nr_to_section(nr)); | ||
527 | } | ||
528 | |||
529 | /* | ||
530 | * Given a kernel address, find the home node of the underlying memory. | ||
531 | */ | ||
532 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) | ||
533 | |||
534 | static inline struct mem_section *__pfn_to_section(unsigned long pfn) | ||
535 | { | ||
536 | return __nr_to_section(pfn_to_section_nr(pfn)); | ||
537 | } | ||
538 | |||
539 | #define pfn_to_page(pfn) \ | ||
540 | ({ \ | ||
541 | unsigned long __pfn = (pfn); \ | ||
542 | __section_mem_map_addr(__pfn_to_section(__pfn)) + __pfn; \ | ||
543 | }) | ||
544 | #define page_to_pfn(page) \ | ||
545 | ({ \ | ||
546 | page - __section_mem_map_addr(__nr_to_section( \ | ||
547 | page_to_section(page))); \ | ||
548 | }) | ||
549 | |||
550 | static inline int pfn_valid(unsigned long pfn) | ||
551 | { | ||
552 | if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) | ||
553 | return 0; | ||
554 | return valid_section(__nr_to_section(pfn_to_section_nr(pfn))); | ||
555 | } | ||
556 | |||
557 | /* | ||
558 | * These are _only_ used during initialisation, therefore they | ||
559 | * can use __initdata ... They could have names to indicate | ||
560 | * this restriction. | ||
561 | */ | ||
562 | #ifdef CONFIG_NUMA | ||
563 | #define pfn_to_nid early_pfn_to_nid | ||
564 | #endif | ||
565 | |||
566 | #define pfn_to_pgdat(pfn) \ | ||
567 | ({ \ | ||
568 | NODE_DATA(pfn_to_nid(pfn)); \ | ||
569 | }) | ||
570 | |||
571 | #define early_pfn_valid(pfn) pfn_valid(pfn) | ||
572 | void sparse_init(void); | ||
573 | #else | ||
574 | #define sparse_init() do {} while (0) | ||
575 | #endif /* CONFIG_SPARSEMEM */ | ||
576 | |||
577 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES | ||
578 | #define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid)) | ||
579 | #else | ||
580 | #define early_pfn_in_nid(pfn, nid) (1) | ||
581 | #endif | ||
582 | |||
583 | #ifndef early_pfn_valid | ||
584 | #define early_pfn_valid(pfn) (1) | ||
439 | #endif | 585 | #endif |
440 | 586 | ||
587 | void memory_present(int nid, unsigned long start, unsigned long end); | ||
588 | unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); | ||
589 | |||
441 | #endif /* !__ASSEMBLY__ */ | 590 | #endif /* !__ASSEMBLY__ */ |
442 | #endif /* __KERNEL__ */ | 591 | #endif /* __KERNEL__ */ |
443 | #endif /* _LINUX_MMZONE_H */ | 592 | #endif /* _LINUX_MMZONE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 0e432a0f4aee..f05372b7fe77 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -51,6 +51,9 @@ struct module_attribute { | |||
51 | ssize_t (*show)(struct module_attribute *, struct module *, char *); | 51 | ssize_t (*show)(struct module_attribute *, struct module *, char *); |
52 | ssize_t (*store)(struct module_attribute *, struct module *, | 52 | ssize_t (*store)(struct module_attribute *, struct module *, |
53 | const char *, size_t count); | 53 | const char *, size_t count); |
54 | void (*setup)(struct module *, const char *); | ||
55 | int (*test)(struct module *); | ||
56 | void (*free)(struct module *); | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | struct module_kobject | 59 | struct module_kobject |
@@ -239,6 +242,8 @@ struct module | |||
239 | /* Sysfs stuff. */ | 242 | /* Sysfs stuff. */ |
240 | struct module_kobject mkobj; | 243 | struct module_kobject mkobj; |
241 | struct module_param_attrs *param_attrs; | 244 | struct module_param_attrs *param_attrs; |
245 | const char *version; | ||
246 | const char *srcversion; | ||
242 | 247 | ||
243 | /* Exported symbols */ | 248 | /* Exported symbols */ |
244 | const struct kernel_symbol *syms; | 249 | const struct kernel_symbol *syms; |
diff --git a/include/linux/namespace.h b/include/linux/namespace.h index 9eca1558d72f..697991b69f9b 100644 --- a/include/linux/namespace.h +++ b/include/linux/namespace.h | |||
@@ -12,7 +12,6 @@ struct namespace { | |||
12 | struct rw_semaphore sem; | 12 | struct rw_semaphore sem; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | extern void umount_tree(struct vfsmount *); | ||
16 | extern int copy_namespace(int, struct task_struct *); | 15 | extern int copy_namespace(int, struct task_struct *); |
17 | extern void __put_namespace(struct namespace *namespace); | 16 | extern void __put_namespace(struct namespace *namespace); |
18 | 17 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d6afd440cf7b..3a0ed7f9e801 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -164,12 +164,6 @@ struct netif_rx_stats | |||
164 | unsigned total; | 164 | unsigned total; |
165 | unsigned dropped; | 165 | unsigned dropped; |
166 | unsigned time_squeeze; | 166 | unsigned time_squeeze; |
167 | unsigned throttled; | ||
168 | unsigned fastroute_hit; | ||
169 | unsigned fastroute_success; | ||
170 | unsigned fastroute_defer; | ||
171 | unsigned fastroute_deferred_out; | ||
172 | unsigned fastroute_latency_reduction; | ||
173 | unsigned cpu_collision; | 167 | unsigned cpu_collision; |
174 | }; | 168 | }; |
175 | 169 | ||
@@ -562,12 +556,9 @@ static inline int unregister_gifconf(unsigned int family) | |||
562 | 556 | ||
563 | struct softnet_data | 557 | struct softnet_data |
564 | { | 558 | { |
565 | int throttle; | 559 | struct net_device *output_queue; |
566 | int cng_level; | ||
567 | int avg_blog; | ||
568 | struct sk_buff_head input_pkt_queue; | 560 | struct sk_buff_head input_pkt_queue; |
569 | struct list_head poll_list; | 561 | struct list_head poll_list; |
570 | struct net_device *output_queue; | ||
571 | struct sk_buff *completion_queue; | 562 | struct sk_buff *completion_queue; |
572 | 563 | ||
573 | struct net_device backlog_dev; /* Sorry. 8) */ | 564 | struct net_device backlog_dev; /* Sorry. 8) */ |
@@ -925,10 +916,6 @@ extern int skb_checksum_help(struct sk_buff *skb, int inward); | |||
925 | extern void net_enable_timestamp(void); | 916 | extern void net_enable_timestamp(void); |
926 | extern void net_disable_timestamp(void); | 917 | extern void net_disable_timestamp(void); |
927 | 918 | ||
928 | #ifdef CONFIG_SYSCTL | ||
929 | extern char *net_sysctl_strdup(const char *s); | ||
930 | #endif | ||
931 | |||
932 | #endif /* __KERNEL__ */ | 919 | #endif /* __KERNEL__ */ |
933 | 920 | ||
934 | #endif /* _LINUX_DEV_H */ | 921 | #endif /* _LINUX_DEV_H */ |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 5bb5b2fd7ba2..0c1c306cdaec 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #define NFS4_ACCESS_DELETE 0x0010 | 28 | #define NFS4_ACCESS_DELETE 0x0010 |
29 | #define NFS4_ACCESS_EXECUTE 0x0020 | 29 | #define NFS4_ACCESS_EXECUTE 0x0020 |
30 | 30 | ||
31 | #define NFS4_FH_PERISTENT 0x0000 | 31 | #define NFS4_FH_PERSISTENT 0x0000 |
32 | #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 | 32 | #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 |
33 | #define NFS4_FH_VOLATILE_ANY 0x0002 | 33 | #define NFS4_FH_VOLATILE_ANY 0x0002 |
34 | #define NFS4_FH_VOL_MIGRATION 0x0004 | 34 | #define NFS4_FH_VOL_MIGRATION 0x0004 |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 4bf931d5ff56..5791dfd30dd0 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -145,15 +145,19 @@ int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | |||
145 | * NFSv4 State | 145 | * NFSv4 State |
146 | */ | 146 | */ |
147 | #ifdef CONFIG_NFSD_V4 | 147 | #ifdef CONFIG_NFSD_V4 |
148 | int nfs4_state_init(void); | 148 | void nfs4_state_init(void); |
149 | int nfs4_state_start(void); | ||
149 | void nfs4_state_shutdown(void); | 150 | void nfs4_state_shutdown(void); |
150 | time_t nfs4_lease_time(void); | 151 | time_t nfs4_lease_time(void); |
151 | void nfs4_reset_lease(time_t leasetime); | 152 | void nfs4_reset_lease(time_t leasetime); |
153 | int nfs4_reset_recoverydir(char *recdir); | ||
152 | #else | 154 | #else |
153 | static inline int nfs4_state_init(void){return 0;} | 155 | static inline void nfs4_state_init(void){}; |
156 | static inline int nfs4_state_start(void){return 0;} | ||
154 | static inline void nfs4_state_shutdown(void){} | 157 | static inline void nfs4_state_shutdown(void){} |
155 | static inline time_t nfs4_lease_time(void){return 0;} | 158 | static inline time_t nfs4_lease_time(void){return 0;} |
156 | static inline void nfs4_reset_lease(time_t leasetime){} | 159 | static inline void nfs4_reset_lease(time_t leasetime){} |
160 | static inline int nfs4_reset_recoverydir(char *recdir) {return 0;} | ||
157 | #endif | 161 | #endif |
158 | 162 | ||
159 | /* | 163 | /* |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index b6b2fe1e7c63..a84a3fa99be1 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -61,11 +61,6 @@ typedef struct { | |||
61 | #define si_stateownerid si_opaque.so_stateownerid | 61 | #define si_stateownerid si_opaque.so_stateownerid |
62 | #define si_fileid si_opaque.so_fileid | 62 | #define si_fileid si_opaque.so_fileid |
63 | 63 | ||
64 | extern stateid_t zerostateid; | ||
65 | extern stateid_t onestateid; | ||
66 | |||
67 | #define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t))) | ||
68 | #define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t))) | ||
69 | 64 | ||
70 | struct nfs4_cb_recall { | 65 | struct nfs4_cb_recall { |
71 | u32 cbr_ident; | 66 | u32 cbr_ident; |
@@ -77,8 +72,8 @@ struct nfs4_cb_recall { | |||
77 | }; | 72 | }; |
78 | 73 | ||
79 | struct nfs4_delegation { | 74 | struct nfs4_delegation { |
80 | struct list_head dl_del_perfile; /* nfs4_file->fi_del_perfile */ | 75 | struct list_head dl_perfile; |
81 | struct list_head dl_del_perclnt; /* nfs4_client->cl_del_perclnt*/ | 76 | struct list_head dl_perclnt; |
82 | struct list_head dl_recall_lru; /* delegation recalled */ | 77 | struct list_head dl_recall_lru; /* delegation recalled */ |
83 | atomic_t dl_count; /* ref count */ | 78 | atomic_t dl_count; /* ref count */ |
84 | struct nfs4_client *dl_client; | 79 | struct nfs4_client *dl_client; |
@@ -97,7 +92,6 @@ struct nfs4_delegation { | |||
97 | /* client delegation callback info */ | 92 | /* client delegation callback info */ |
98 | struct nfs4_callback { | 93 | struct nfs4_callback { |
99 | /* SETCLIENTID info */ | 94 | /* SETCLIENTID info */ |
100 | u32 cb_parsed; /* addr parsed */ | ||
101 | u32 cb_addr; | 95 | u32 cb_addr; |
102 | unsigned short cb_port; | 96 | unsigned short cb_port; |
103 | u32 cb_prog; | 97 | u32 cb_prog; |
@@ -109,6 +103,8 @@ struct nfs4_callback { | |||
109 | struct rpc_clnt * cb_client; | 103 | struct rpc_clnt * cb_client; |
110 | }; | 104 | }; |
111 | 105 | ||
106 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ | ||
107 | |||
112 | /* | 108 | /* |
113 | * struct nfs4_client - one per client. Clientids live here. | 109 | * struct nfs4_client - one per client. Clientids live here. |
114 | * o Each nfs4_client is hashed by clientid. | 110 | * o Each nfs4_client is hashed by clientid. |
@@ -122,10 +118,11 @@ struct nfs4_callback { | |||
122 | struct nfs4_client { | 118 | struct nfs4_client { |
123 | struct list_head cl_idhash; /* hash by cl_clientid.id */ | 119 | struct list_head cl_idhash; /* hash by cl_clientid.id */ |
124 | struct list_head cl_strhash; /* hash by cl_name */ | 120 | struct list_head cl_strhash; /* hash by cl_name */ |
125 | struct list_head cl_perclient; /* list: stateowners */ | 121 | struct list_head cl_openowners; |
126 | struct list_head cl_del_perclnt; /* list: delegations */ | 122 | struct list_head cl_delegations; |
127 | struct list_head cl_lru; /* tail queue */ | 123 | struct list_head cl_lru; /* tail queue */ |
128 | struct xdr_netobj cl_name; /* id generated by client */ | 124 | struct xdr_netobj cl_name; /* id generated by client */ |
125 | char cl_recdir[HEXDIR_LEN]; /* recovery dir */ | ||
129 | nfs4_verifier cl_verifier; /* generated by client */ | 126 | nfs4_verifier cl_verifier; /* generated by client */ |
130 | time_t cl_time; /* time of last lease renewal */ | 127 | time_t cl_time; /* time of last lease renewal */ |
131 | u32 cl_addr; /* client ipaddress */ | 128 | u32 cl_addr; /* client ipaddress */ |
@@ -134,6 +131,7 @@ struct nfs4_client { | |||
134 | nfs4_verifier cl_confirm; /* generated by server */ | 131 | nfs4_verifier cl_confirm; /* generated by server */ |
135 | struct nfs4_callback cl_callback; /* callback info */ | 132 | struct nfs4_callback cl_callback; /* callback info */ |
136 | atomic_t cl_count; /* ref count */ | 133 | atomic_t cl_count; /* ref count */ |
134 | u32 cl_firststate; /* recovery dir creation */ | ||
137 | }; | 135 | }; |
138 | 136 | ||
139 | /* struct nfs4_client_reset | 137 | /* struct nfs4_client_reset |
@@ -143,7 +141,7 @@ struct nfs4_client { | |||
143 | */ | 141 | */ |
144 | struct nfs4_client_reclaim { | 142 | struct nfs4_client_reclaim { |
145 | struct list_head cr_strhash; /* hash by cr_name */ | 143 | struct list_head cr_strhash; /* hash by cr_name */ |
146 | struct xdr_netobj cr_name; /* id generated by client */ | 144 | char cr_recdir[HEXDIR_LEN]; /* recover dir */ |
147 | }; | 145 | }; |
148 | 146 | ||
149 | static inline void | 147 | static inline void |
@@ -197,9 +195,9 @@ struct nfs4_stateowner { | |||
197 | struct kref so_ref; | 195 | struct kref so_ref; |
198 | struct list_head so_idhash; /* hash by so_id */ | 196 | struct list_head so_idhash; /* hash by so_id */ |
199 | struct list_head so_strhash; /* hash by op_name */ | 197 | struct list_head so_strhash; /* hash by op_name */ |
200 | struct list_head so_perclient; /* nfs4_client->cl_perclient */ | 198 | struct list_head so_perclient; |
201 | struct list_head so_perfilestate; /* list: nfs4_stateid */ | 199 | struct list_head so_stateids; |
202 | struct list_head so_perlockowner; /* nfs4_stateid->st_perlockowner */ | 200 | struct list_head so_perstateid; /* for lockowners only */ |
203 | struct list_head so_close_lru; /* tail queue */ | 201 | struct list_head so_close_lru; /* tail queue */ |
204 | time_t so_time; /* time of placement on so_close_lru */ | 202 | time_t so_time; /* time of placement on so_close_lru */ |
205 | int so_is_open_owner; /* 1=openowner,0=lockowner */ | 203 | int so_is_open_owner; /* 1=openowner,0=lockowner */ |
@@ -217,9 +215,10 @@ struct nfs4_stateowner { | |||
217 | * share_acces, share_deny on the file. | 215 | * share_acces, share_deny on the file. |
218 | */ | 216 | */ |
219 | struct nfs4_file { | 217 | struct nfs4_file { |
218 | struct kref fi_ref; | ||
220 | struct list_head fi_hash; /* hash by "struct inode *" */ | 219 | struct list_head fi_hash; /* hash by "struct inode *" */ |
221 | struct list_head fi_perfile; /* list: nfs4_stateid */ | 220 | struct list_head fi_stateids; |
222 | struct list_head fi_del_perfile; /* list: nfs4_delegation */ | 221 | struct list_head fi_delegations; |
223 | struct inode *fi_inode; | 222 | struct inode *fi_inode; |
224 | u32 fi_id; /* used with stateowner->so_id | 223 | u32 fi_id; /* used with stateowner->so_id |
225 | * for stateid_hashtbl hash */ | 224 | * for stateid_hashtbl hash */ |
@@ -241,8 +240,8 @@ struct nfs4_file { | |||
241 | struct nfs4_stateid { | 240 | struct nfs4_stateid { |
242 | struct list_head st_hash; | 241 | struct list_head st_hash; |
243 | struct list_head st_perfile; | 242 | struct list_head st_perfile; |
244 | struct list_head st_perfilestate; | 243 | struct list_head st_perstateowner; |
245 | struct list_head st_perlockowner; | 244 | struct list_head st_lockowners; |
246 | struct nfs4_stateowner * st_stateowner; | 245 | struct nfs4_stateowner * st_stateowner; |
247 | struct nfs4_file * st_file; | 246 | struct nfs4_file * st_file; |
248 | stateid_t st_stateid; | 247 | stateid_t st_stateid; |
@@ -267,12 +266,9 @@ struct nfs4_stateid { | |||
267 | ((err) != nfserr_stale_stateid) && \ | 266 | ((err) != nfserr_stale_stateid) && \ |
268 | ((err) != nfserr_bad_stateid)) | 267 | ((err) != nfserr_bad_stateid)) |
269 | 268 | ||
270 | extern time_t nfs4_laundromat(void); | ||
271 | extern int nfsd4_renew(clientid_t *clid); | 269 | extern int nfsd4_renew(clientid_t *clid); |
272 | extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, | 270 | extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, |
273 | stateid_t *stateid, int flags, struct file **filp); | 271 | stateid_t *stateid, int flags, struct file **filp); |
274 | extern int nfs4_share_conflict(struct svc_fh *current_fh, | ||
275 | unsigned int deny_type); | ||
276 | extern void nfs4_lock_state(void); | 272 | extern void nfs4_lock_state(void); |
277 | extern void nfs4_unlock_state(void); | 273 | extern void nfs4_unlock_state(void); |
278 | extern int nfs4_in_grace(void); | 274 | extern int nfs4_in_grace(void); |
@@ -282,6 +278,15 @@ extern void nfs4_free_stateowner(struct kref *kref); | |||
282 | extern void nfsd4_probe_callback(struct nfs4_client *clp); | 278 | extern void nfsd4_probe_callback(struct nfs4_client *clp); |
283 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); | 279 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); |
284 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); | 280 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); |
281 | extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); | ||
282 | extern void nfsd4_init_recdir(char *recdir_name); | ||
283 | extern int nfsd4_recdir_load(void); | ||
284 | extern void nfsd4_shutdown_recdir(void); | ||
285 | extern int nfs4_client_to_reclaim(const char *name); | ||
286 | extern int nfs4_has_reclaimed_state(const char *name); | ||
287 | extern void nfsd4_recdir_purge_old(void); | ||
288 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); | ||
289 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); | ||
285 | 290 | ||
286 | static inline void | 291 | static inline void |
287 | nfs4_put_stateowner(struct nfs4_stateowner *so) | 292 | nfs4_put_stateowner(struct nfs4_stateowner *so) |
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index a1f5ad0be1bf..4d24d65c0e88 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h | |||
@@ -210,6 +210,7 @@ struct nfsd4_open { | |||
210 | u32 op_share_access; /* request */ | 210 | u32 op_share_access; /* request */ |
211 | u32 op_share_deny; /* request */ | 211 | u32 op_share_deny; /* request */ |
212 | stateid_t op_stateid; /* response */ | 212 | stateid_t op_stateid; /* response */ |
213 | u32 op_recall; /* recall */ | ||
213 | struct nfsd4_change_info op_cinfo; /* response */ | 214 | struct nfsd4_change_info op_cinfo; /* response */ |
214 | u32 op_rflags; /* response */ | 215 | u32 op_rflags; /* response */ |
215 | int op_truncate; /* used during processing */ | 216 | int op_truncate; /* used during processing */ |
diff --git a/include/linux/nfsd_idmap.h b/include/linux/nfsd_idmap.h index 9bb7f30e923b..e82746fcad14 100644 --- a/include/linux/nfsd_idmap.h +++ b/include/linux/nfsd_idmap.h | |||
@@ -43,8 +43,13 @@ | |||
43 | /* XXX from linux/nfs_idmap.h */ | 43 | /* XXX from linux/nfs_idmap.h */ |
44 | #define IDMAP_NAMESZ 128 | 44 | #define IDMAP_NAMESZ 128 |
45 | 45 | ||
46 | #ifdef CONFIG_NFSD_V4 | ||
46 | void nfsd_idmap_init(void); | 47 | void nfsd_idmap_init(void); |
47 | void nfsd_idmap_shutdown(void); | 48 | void nfsd_idmap_shutdown(void); |
49 | #else | ||
50 | static inline void nfsd_idmap_init(void) {}; | ||
51 | static inline void nfsd_idmap_shutdown(void) {}; | ||
52 | #endif | ||
48 | 53 | ||
49 | int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); | 54 | int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); |
50 | int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *); | 55 | int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *); |
diff --git a/include/linux/numa.h b/include/linux/numa.h index bd0c8c4e9a95..f0c539bd3cfc 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | #ifdef CONFIG_DISCONTIGMEM | 6 | #ifndef CONFIG_FLATMEM |
7 | #include <asm/numnodes.h> | 7 | #include <asm/numnodes.h> |
8 | #endif | 8 | #endif |
9 | 9 | ||
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 63e89e47b8e9..bf608808a60c 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1568,6 +1568,7 @@ | |||
1568 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 | 1568 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 |
1569 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB | 1569 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB |
1570 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 | 1570 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 |
1571 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 | ||
1571 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 | 1572 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 |
1572 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 | 1573 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 |
1573 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 | 1574 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 |
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index d2aa214d6803..25d2d67c1faf 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h | |||
@@ -408,6 +408,7 @@ enum | |||
408 | TCF_EM_NBYTE, | 408 | TCF_EM_NBYTE, |
409 | TCF_EM_U32, | 409 | TCF_EM_U32, |
410 | TCF_EM_META, | 410 | TCF_EM_META, |
411 | TCF_EM_TEXT, | ||
411 | __TCF_EM_MAX | 412 | __TCF_EM_MAX |
412 | }; | 413 | }; |
413 | 414 | ||
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h index 4e2d2a942ecb..4b32bce9a289 100644 --- a/include/linux/pktcdvd.h +++ b/include/linux/pktcdvd.h | |||
@@ -159,7 +159,7 @@ struct packet_iosched | |||
159 | struct bio *read_queue_tail; | 159 | struct bio *read_queue_tail; |
160 | struct bio *write_queue; | 160 | struct bio *write_queue; |
161 | struct bio *write_queue_tail; | 161 | struct bio *write_queue_tail; |
162 | int high_prio_read; /* An important read request has been queued */ | 162 | sector_t last_write; /* The sector where the last write ended */ |
163 | int successive_reads; | 163 | int successive_reads; |
164 | }; | 164 | }; |
165 | 165 | ||
diff --git a/include/linux/posix_acl_xattr.h b/include/linux/posix_acl_xattr.h index 5efd0a6dad94..6e53c34035cd 100644 --- a/include/linux/posix_acl_xattr.h +++ b/include/linux/posix_acl_xattr.h | |||
@@ -23,13 +23,13 @@ | |||
23 | #define ACL_UNDEFINED_ID (-1) | 23 | #define ACL_UNDEFINED_ID (-1) |
24 | 24 | ||
25 | typedef struct { | 25 | typedef struct { |
26 | __u16 e_tag; | 26 | __le16 e_tag; |
27 | __u16 e_perm; | 27 | __le16 e_perm; |
28 | __u32 e_id; | 28 | __le32 e_id; |
29 | } posix_acl_xattr_entry; | 29 | } posix_acl_xattr_entry; |
30 | 30 | ||
31 | typedef struct { | 31 | typedef struct { |
32 | __u32 a_version; | 32 | __le32 a_version; |
33 | posix_acl_xattr_entry a_entries[0]; | 33 | posix_acl_xattr_entry a_entries[0]; |
34 | } posix_acl_xattr_header; | 34 | } posix_acl_xattr_header; |
35 | 35 | ||
@@ -52,4 +52,7 @@ posix_acl_xattr_count(size_t size) | |||
52 | return size / sizeof(posix_acl_xattr_entry); | 52 | return size / sizeof(posix_acl_xattr_entry); |
53 | } | 53 | } |
54 | 54 | ||
55 | struct posix_acl *posix_acl_from_xattr(const void *value, size_t size); | ||
56 | int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size); | ||
57 | |||
55 | #endif /* _POSIX_ACL_XATTR_H */ | 58 | #endif /* _POSIX_ACL_XATTR_H */ |
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h index 22ba580b0ae8..fc610bb0f733 100644 --- a/include/linux/qnx4_fs.h +++ b/include/linux/qnx4_fs.h | |||
@@ -46,11 +46,11 @@ struct qnx4_inode_entry { | |||
46 | char di_fname[QNX4_SHORT_NAME_MAX]; | 46 | char di_fname[QNX4_SHORT_NAME_MAX]; |
47 | qnx4_off_t di_size; | 47 | qnx4_off_t di_size; |
48 | qnx4_xtnt_t di_first_xtnt; | 48 | qnx4_xtnt_t di_first_xtnt; |
49 | __u32 di_xblk; | 49 | __le32 di_xblk; |
50 | __s32 di_ftime; | 50 | __le32 di_ftime; |
51 | __s32 di_mtime; | 51 | __le32 di_mtime; |
52 | __s32 di_atime; | 52 | __le32 di_atime; |
53 | __s32 di_ctime; | 53 | __le32 di_ctime; |
54 | qnx4_nxtnt_t di_num_xtnts; | 54 | qnx4_nxtnt_t di_num_xtnts; |
55 | qnx4_mode_t di_mode; | 55 | qnx4_mode_t di_mode; |
56 | qnx4_muid_t di_uid; | 56 | qnx4_muid_t di_uid; |
@@ -63,18 +63,18 @@ struct qnx4_inode_entry { | |||
63 | 63 | ||
64 | struct qnx4_link_info { | 64 | struct qnx4_link_info { |
65 | char dl_fname[QNX4_NAME_MAX]; | 65 | char dl_fname[QNX4_NAME_MAX]; |
66 | __u32 dl_inode_blk; | 66 | __le32 dl_inode_blk; |
67 | __u8 dl_inode_ndx; | 67 | __u8 dl_inode_ndx; |
68 | __u8 dl_spare[10]; | 68 | __u8 dl_spare[10]; |
69 | __u8 dl_status; | 69 | __u8 dl_status; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct qnx4_xblk { | 72 | struct qnx4_xblk { |
73 | __u32 xblk_next_xblk; | 73 | __le32 xblk_next_xblk; |
74 | __u32 xblk_prev_xblk; | 74 | __le32 xblk_prev_xblk; |
75 | __u8 xblk_num_xtnts; | 75 | __u8 xblk_num_xtnts; |
76 | __u8 xblk_spare[3]; | 76 | __u8 xblk_spare[3]; |
77 | __s32 xblk_num_blocks; | 77 | __le32 xblk_num_blocks; |
78 | qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; | 78 | qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; |
79 | char xblk_signature[8]; | 79 | char xblk_signature[8]; |
80 | qnx4_xtnt_t xblk_first_xtnt; | 80 | qnx4_xtnt_t xblk_first_xtnt; |
diff --git a/include/linux/qnxtypes.h b/include/linux/qnxtypes.h index fb518e318c7c..a3eb1137857b 100644 --- a/include/linux/qnxtypes.h +++ b/include/linux/qnxtypes.h | |||
@@ -12,18 +12,18 @@ | |||
12 | #ifndef _QNX4TYPES_H | 12 | #ifndef _QNX4TYPES_H |
13 | #define _QNX4TYPES_H | 13 | #define _QNX4TYPES_H |
14 | 14 | ||
15 | typedef __u16 qnx4_nxtnt_t; | 15 | typedef __le16 qnx4_nxtnt_t; |
16 | typedef __u8 qnx4_ftype_t; | 16 | typedef __u8 qnx4_ftype_t; |
17 | 17 | ||
18 | typedef struct { | 18 | typedef struct { |
19 | __u32 xtnt_blk; | 19 | __le32 xtnt_blk; |
20 | __u32 xtnt_size; | 20 | __le32 xtnt_size; |
21 | } qnx4_xtnt_t; | 21 | } qnx4_xtnt_t; |
22 | 22 | ||
23 | typedef __u16 qnx4_mode_t; | 23 | typedef __le16 qnx4_mode_t; |
24 | typedef __u16 qnx4_muid_t; | 24 | typedef __le16 qnx4_muid_t; |
25 | typedef __u16 qnx4_mgid_t; | 25 | typedef __le16 qnx4_mgid_t; |
26 | typedef __u32 qnx4_off_t; | 26 | typedef __le32 qnx4_off_t; |
27 | typedef __u16 qnx4_nlink_t; | 27 | typedef __le16 qnx4_nlink_t; |
28 | 28 | ||
29 | #endif | 29 | #endif |
diff --git a/include/linux/quota.h b/include/linux/quota.h index ac5b90f4f256..700ead45084f 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -138,8 +138,11 @@ struct if_dqinfo { | |||
138 | #include <linux/dqblk_v2.h> | 138 | #include <linux/dqblk_v2.h> |
139 | 139 | ||
140 | /* Maximal numbers of writes for quota operation (insert/delete/update) | 140 | /* Maximal numbers of writes for quota operation (insert/delete/update) |
141 | * (over all formats) - info block, 4 pointer blocks, data block */ | 141 | * (over VFS all formats) */ |
142 | #define DQUOT_MAX_WRITES 6 | 142 | #define DQUOT_INIT_ALLOC max(V1_INIT_ALLOC, V2_INIT_ALLOC) |
143 | #define DQUOT_INIT_REWRITE max(V1_INIT_REWRITE, V2_INIT_REWRITE) | ||
144 | #define DQUOT_DEL_ALLOC max(V1_DEL_ALLOC, V2_DEL_ALLOC) | ||
145 | #define DQUOT_DEL_REWRITE max(V1_DEL_REWRITE, V2_DEL_REWRITE) | ||
143 | 146 | ||
144 | /* | 147 | /* |
145 | * Data for one user/group kept in memory | 148 | * Data for one user/group kept in memory |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index e57baa85e744..d211507ab246 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -39,7 +39,8 @@ extern int dquot_commit_info(struct super_block *sb, int type); | |||
39 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); | 39 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); |
40 | 40 | ||
41 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); | 41 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); |
42 | extern int vfs_quota_on_mount(int type, int format_id, struct dentry *dentry); | 42 | extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, |
43 | int format_id, int type); | ||
43 | extern int vfs_quota_off(struct super_block *sb, int type); | 44 | extern int vfs_quota_off(struct super_block *sb, int type); |
44 | #define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type) | 45 | #define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type) |
45 | extern int vfs_quota_sync(struct super_block *sb, int type); | 46 | extern int vfs_quota_sync(struct super_block *sb, int type); |
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h index 2aef9c3f5ce8..0760507a545b 100644 --- a/include/linux/reiserfs_acl.h +++ b/include/linux/reiserfs_acl.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/posix_acl.h> | 2 | #include <linux/posix_acl.h> |
3 | #include <linux/xattr_acl.h> | ||
4 | 3 | ||
5 | #define REISERFS_ACL_VERSION 0x0001 | 4 | #define REISERFS_ACL_VERSION 0x0001 |
6 | 5 | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 32148625fc2f..4c7c5689ad93 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1644,11 +1644,18 @@ struct reiserfs_journal_header { | |||
1644 | #define JOURNAL_MAX_TRANS_AGE 30 | 1644 | #define JOURNAL_MAX_TRANS_AGE 30 |
1645 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | 1645 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) |
1646 | #ifdef CONFIG_QUOTA | 1646 | #ifdef CONFIG_QUOTA |
1647 | #define REISERFS_QUOTA_TRANS_BLOCKS 2 /* We need to update data and inode (atime) */ | 1647 | /* We need to update data and inode (atime) */ |
1648 | #define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*(JOURNAL_PER_BALANCE_CNT+2)+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ | 1648 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) |
1649 | /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ | ||
1650 | #define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ | ||
1651 | (DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) | ||
1652 | /* same as with INIT */ | ||
1653 | #define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ | ||
1654 | (DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) | ||
1649 | #else | 1655 | #else |
1650 | #define REISERFS_QUOTA_TRANS_BLOCKS 0 | 1656 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 |
1651 | #define REISERFS_QUOTA_INIT_BLOCKS 0 | 1657 | #define REISERFS_QUOTA_INIT_BLOCKS(s) 0 |
1658 | #define REISERFS_QUOTA_DEL_BLOCKS(s) 0 | ||
1652 | #endif | 1659 | #endif |
1653 | 1660 | ||
1654 | /* both of these can be as low as 1, or as high as you want. The min is the | 1661 | /* both of these can be as low as 1, or as high as you want. The min is the |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 37a3a7afbec7..31c709d0fe18 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -467,6 +467,8 @@ enum reiserfs_mount_options { | |||
467 | REISERFS_ERROR_RO, | 467 | REISERFS_ERROR_RO, |
468 | REISERFS_ERROR_CONTINUE, | 468 | REISERFS_ERROR_CONTINUE, |
469 | 469 | ||
470 | REISERFS_QUOTA, /* Some quota option specified */ | ||
471 | |||
470 | REISERFS_TEST1, | 472 | REISERFS_TEST1, |
471 | REISERFS_TEST2, | 473 | REISERFS_TEST2, |
472 | REISERFS_TEST3, | 474 | REISERFS_TEST3, |
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 11b484e37ac9..e80fb7ee6efd 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -93,6 +93,12 @@ int page_referenced(struct page *, int is_locked, int ignore_token); | |||
93 | int try_to_unmap(struct page *); | 93 | int try_to_unmap(struct page *); |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * Called from mm/filemap_xip.c to unmap empty zero page | ||
97 | */ | ||
98 | pte_t *page_check_address(struct page *, struct mm_struct *, unsigned long); | ||
99 | |||
100 | |||
101 | /* | ||
96 | * Used by swapoff to help locate where page is expected in vma. | 102 | * Used by swapoff to help locate where page is expected in vma. |
97 | */ | 103 | */ |
98 | unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); | 104 | unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index e68dbf0bf579..d021888b58f1 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -892,10 +892,13 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
892 | goto rtattr_failure; \ | 892 | goto rtattr_failure; \ |
893 | __rta_fill(skb, attrtype, attrlen, data); }) | 893 | __rta_fill(skb, attrtype, attrlen, data); }) |
894 | 894 | ||
895 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | 895 | #define RTA_APPEND(skb, attrlen, data) \ |
896 | ({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ | 896 | ({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ |
897 | goto rtattr_failure; \ | 897 | goto rtattr_failure; \ |
898 | memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) | 898 | memcpy(skb_put(skb, attrlen), data, attrlen); }) |
899 | |||
900 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | ||
901 | RTA_APPEND(skb, RTA_ALIGN(attrlen), data) | ||
899 | 902 | ||
900 | #define RTA_PUT_U8(skb, attrtype, value) \ | 903 | #define RTA_PUT_U8(skb, attrtype, value) \ |
901 | ({ u8 _tmp = (value); \ | 904 | ({ u8 _tmp = (value); \ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index b58afd97a180..2c69682b0444 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -246,7 +246,7 @@ struct mm_struct { | |||
246 | 246 | ||
247 | unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ | 247 | unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ |
248 | 248 | ||
249 | unsigned dumpable:1; | 249 | unsigned dumpable:2; |
250 | cpumask_t cpu_vm_mask; | 250 | cpumask_t cpu_vm_mask; |
251 | 251 | ||
252 | /* Architecture-specific MM context */ | 252 | /* Architecture-specific MM context */ |
@@ -561,9 +561,10 @@ struct group_info { | |||
561 | groups_free(group_info); \ | 561 | groups_free(group_info); \ |
562 | } while (0) | 562 | } while (0) |
563 | 563 | ||
564 | struct group_info *groups_alloc(int gidsetsize); | 564 | extern struct group_info *groups_alloc(int gidsetsize); |
565 | void groups_free(struct group_info *group_info); | 565 | extern void groups_free(struct group_info *group_info); |
566 | int set_current_groups(struct group_info *group_info); | 566 | extern int set_current_groups(struct group_info *group_info); |
567 | extern int groups_search(struct group_info *group_info, gid_t grp); | ||
567 | /* access the groups "array" with this macro */ | 568 | /* access the groups "array" with this macro */ |
568 | #define GROUP_AT(gi, i) \ | 569 | #define GROUP_AT(gi, i) \ |
569 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) | 570 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) |
@@ -660,6 +661,7 @@ struct task_struct { | |||
660 | struct user_struct *user; | 661 | struct user_struct *user; |
661 | #ifdef CONFIG_KEYS | 662 | #ifdef CONFIG_KEYS |
662 | struct key *thread_keyring; /* keyring private to this thread */ | 663 | struct key *thread_keyring; /* keyring private to this thread */ |
664 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ | ||
663 | #endif | 665 | #endif |
664 | int oomkilladj; /* OOM kill score adjustment (bit shift). */ | 666 | int oomkilladj; /* OOM kill score adjustment (bit shift). */ |
665 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 667 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index d7c839a21842..416a2e4024b2 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/highmem.h> | 27 | #include <linux/highmem.h> |
28 | #include <linux/poll.h> | 28 | #include <linux/poll.h> |
29 | #include <linux/net.h> | 29 | #include <linux/net.h> |
30 | #include <linux/textsearch.h> | ||
30 | #include <net/checksum.h> | 31 | #include <net/checksum.h> |
31 | 32 | ||
32 | #define HAVE_ALLOC_SKB /* For the drivers to know */ | 33 | #define HAVE_ALLOC_SKB /* For the drivers to know */ |
@@ -321,6 +322,28 @@ extern void skb_over_panic(struct sk_buff *skb, int len, | |||
321 | extern void skb_under_panic(struct sk_buff *skb, int len, | 322 | extern void skb_under_panic(struct sk_buff *skb, int len, |
322 | void *here); | 323 | void *here); |
323 | 324 | ||
325 | struct skb_seq_state | ||
326 | { | ||
327 | __u32 lower_offset; | ||
328 | __u32 upper_offset; | ||
329 | __u32 frag_idx; | ||
330 | __u32 stepped_offset; | ||
331 | struct sk_buff *root_skb; | ||
332 | struct sk_buff *cur_skb; | ||
333 | __u8 *frag_data; | ||
334 | }; | ||
335 | |||
336 | extern void skb_prepare_seq_read(struct sk_buff *skb, | ||
337 | unsigned int from, unsigned int to, | ||
338 | struct skb_seq_state *st); | ||
339 | extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data, | ||
340 | struct skb_seq_state *st); | ||
341 | extern void skb_abort_seq_read(struct skb_seq_state *st); | ||
342 | |||
343 | extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, | ||
344 | unsigned int to, struct ts_config *config, | ||
345 | struct ts_state *state); | ||
346 | |||
324 | /* Internal */ | 347 | /* Internal */ |
325 | #define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) | 348 | #define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) |
326 | 349 | ||
diff --git a/include/linux/string.h b/include/linux/string.h index b9fc59469956..93994c613095 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -88,6 +88,8 @@ extern int memcmp(const void *,const void *,__kernel_size_t); | |||
88 | extern void * memchr(const void *,int,__kernel_size_t); | 88 | extern void * memchr(const void *,int,__kernel_size_t); |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | extern char *kstrdup(const char *s, int gfp); | ||
92 | |||
91 | #ifdef __cplusplus | 93 | #ifdef __cplusplus |
92 | } | 94 | } |
93 | #endif | 95 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index a17745c80a91..ebfe1250f0a4 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -136,6 +136,7 @@ enum | |||
136 | KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ | 136 | KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ |
137 | KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ | 137 | KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ |
138 | KERN_RANDOMIZE=68, /* int: randomize virtual address space */ | 138 | KERN_RANDOMIZE=68, /* int: randomize virtual address space */ |
139 | KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ | ||
139 | }; | 140 | }; |
140 | 141 | ||
141 | 142 | ||
@@ -242,6 +243,7 @@ enum | |||
242 | NET_CORE_MOD_CONG=16, | 243 | NET_CORE_MOD_CONG=16, |
243 | NET_CORE_DEV_WEIGHT=17, | 244 | NET_CORE_DEV_WEIGHT=17, |
244 | NET_CORE_SOMAXCONN=18, | 245 | NET_CORE_SOMAXCONN=18, |
246 | NET_CORE_BUDGET=19, | ||
245 | }; | 247 | }; |
246 | 248 | ||
247 | /* /proc/sys/net/ethernet */ | 249 | /* /proc/sys/net/ethernet */ |
@@ -332,21 +334,14 @@ enum | |||
332 | NET_TCP_FRTO=92, | 334 | NET_TCP_FRTO=92, |
333 | NET_TCP_LOW_LATENCY=93, | 335 | NET_TCP_LOW_LATENCY=93, |
334 | NET_IPV4_IPFRAG_SECRET_INTERVAL=94, | 336 | NET_IPV4_IPFRAG_SECRET_INTERVAL=94, |
335 | NET_TCP_WESTWOOD=95, | ||
336 | NET_IPV4_IGMP_MAX_MSF=96, | 337 | NET_IPV4_IGMP_MAX_MSF=96, |
337 | NET_TCP_NO_METRICS_SAVE=97, | 338 | NET_TCP_NO_METRICS_SAVE=97, |
338 | NET_TCP_VEGAS=98, | ||
339 | NET_TCP_VEGAS_ALPHA=99, | ||
340 | NET_TCP_VEGAS_BETA=100, | ||
341 | NET_TCP_VEGAS_GAMMA=101, | ||
342 | NET_TCP_BIC=102, | ||
343 | NET_TCP_BIC_FAST_CONVERGENCE=103, | ||
344 | NET_TCP_BIC_LOW_WINDOW=104, | ||
345 | NET_TCP_DEFAULT_WIN_SCALE=105, | 339 | NET_TCP_DEFAULT_WIN_SCALE=105, |
346 | NET_TCP_MODERATE_RCVBUF=106, | 340 | NET_TCP_MODERATE_RCVBUF=106, |
347 | NET_TCP_TSO_WIN_DIVISOR=107, | 341 | NET_TCP_TSO_WIN_DIVISOR=107, |
348 | NET_TCP_BIC_BETA=108, | 342 | NET_TCP_BIC_BETA=108, |
349 | NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, | 343 | NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, |
344 | NET_TCP_CONG_CONTROL=110, | ||
350 | }; | 345 | }; |
351 | 346 | ||
352 | enum { | 347 | enum { |
diff --git a/include/linux/tc_ematch/tc_em_text.h b/include/linux/tc_ematch/tc_em_text.h new file mode 100644 index 000000000000..7cd43e99c7f5 --- /dev/null +++ b/include/linux/tc_ematch/tc_em_text.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __LINUX_TC_EM_TEXT_H | ||
2 | #define __LINUX_TC_EM_TEXT_H | ||
3 | |||
4 | #include <linux/pkt_cls.h> | ||
5 | |||
6 | #define TC_EM_TEXT_ALGOSIZ 16 | ||
7 | |||
8 | struct tcf_em_text | ||
9 | { | ||
10 | char algo[TC_EM_TEXT_ALGOSIZ]; | ||
11 | __u16 from_offset; | ||
12 | __u16 to_offset; | ||
13 | __u16 pattern_len; | ||
14 | __u8 from_layer:4; | ||
15 | __u8 to_layer:4; | ||
16 | __u8 pad; | ||
17 | }; | ||
18 | |||
19 | #endif | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 97a7c9e03df5..dfd93d03f5d2 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -127,6 +127,7 @@ enum { | |||
127 | #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ | 127 | #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ |
128 | #define TCP_INFO 11 /* Information about this connection. */ | 128 | #define TCP_INFO 11 /* Information about this connection. */ |
129 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ | 129 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ |
130 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ | ||
130 | 131 | ||
131 | #define TCPI_OPT_TIMESTAMPS 1 | 132 | #define TCPI_OPT_TIMESTAMPS 1 |
132 | #define TCPI_OPT_SACK 2 | 133 | #define TCPI_OPT_SACK 2 |
@@ -203,13 +204,6 @@ struct tcp_sack_block { | |||
203 | __u32 end_seq; | 204 | __u32 end_seq; |
204 | }; | 205 | }; |
205 | 206 | ||
206 | enum tcp_congestion_algo { | ||
207 | TCP_RENO=0, | ||
208 | TCP_VEGAS, | ||
209 | TCP_WESTWOOD, | ||
210 | TCP_BIC, | ||
211 | }; | ||
212 | |||
213 | struct tcp_options_received { | 207 | struct tcp_options_received { |
214 | /* PAWS/RTTM data */ | 208 | /* PAWS/RTTM data */ |
215 | long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ | 209 | long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ |
@@ -305,7 +299,7 @@ struct tcp_sock { | |||
305 | __u8 reordering; /* Packet reordering metric. */ | 299 | __u8 reordering; /* Packet reordering metric. */ |
306 | __u8 frto_counter; /* Number of new acks after RTO */ | 300 | __u8 frto_counter; /* Number of new acks after RTO */ |
307 | 301 | ||
308 | __u8 adv_cong; /* Using Vegas, Westwood, or BIC */ | 302 | __u8 unused; |
309 | __u8 defer_accept; /* User waits for some data after accept() */ | 303 | __u8 defer_accept; /* User waits for some data after accept() */ |
310 | 304 | ||
311 | /* RTT measurement */ | 305 | /* RTT measurement */ |
@@ -401,37 +395,10 @@ struct tcp_sock { | |||
401 | __u32 time; | 395 | __u32 time; |
402 | } rcvq_space; | 396 | } rcvq_space; |
403 | 397 | ||
404 | /* TCP Westwood structure */ | 398 | /* Pluggable TCP congestion control hook */ |
405 | struct { | 399 | struct tcp_congestion_ops *ca_ops; |
406 | __u32 bw_ns_est; /* first bandwidth estimation..not too smoothed 8) */ | 400 | u32 ca_priv[16]; |
407 | __u32 bw_est; /* bandwidth estimate */ | 401 | #define TCP_CA_PRIV_SIZE (16*sizeof(u32)) |
408 | __u32 rtt_win_sx; /* here starts a new evaluation... */ | ||
409 | __u32 bk; | ||
410 | __u32 snd_una; /* used for evaluating the number of acked bytes */ | ||
411 | __u32 cumul_ack; | ||
412 | __u32 accounted; | ||
413 | __u32 rtt; | ||
414 | __u32 rtt_min; /* minimum observed RTT */ | ||
415 | } westwood; | ||
416 | |||
417 | /* Vegas variables */ | ||
418 | struct { | ||
419 | __u32 beg_snd_nxt; /* right edge during last RTT */ | ||
420 | __u32 beg_snd_una; /* left edge during last RTT */ | ||
421 | __u32 beg_snd_cwnd; /* saves the size of the cwnd */ | ||
422 | __u8 doing_vegas_now;/* if true, do vegas for this RTT */ | ||
423 | __u16 cntRTT; /* # of RTTs measured within last RTT */ | ||
424 | __u32 minRTT; /* min of RTTs measured within last RTT (in usec) */ | ||
425 | __u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */ | ||
426 | } vegas; | ||
427 | |||
428 | /* BI TCP Parameters */ | ||
429 | struct { | ||
430 | __u32 cnt; /* increase cwnd by 1 after this number of ACKs */ | ||
431 | __u32 last_max_cwnd; /* last maximium snd_cwnd */ | ||
432 | __u32 last_cwnd; /* the last snd_cwnd */ | ||
433 | __u32 last_stamp; /* time when updated last_cwnd */ | ||
434 | } bictcp; | ||
435 | }; | 402 | }; |
436 | 403 | ||
437 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 404 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
@@ -439,6 +406,11 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk) | |||
439 | return (struct tcp_sock *)sk; | 406 | return (struct tcp_sock *)sk; |
440 | } | 407 | } |
441 | 408 | ||
409 | static inline void *tcp_ca(const struct tcp_sock *tp) | ||
410 | { | ||
411 | return (void *) tp->ca_priv; | ||
412 | } | ||
413 | |||
442 | #endif | 414 | #endif |
443 | 415 | ||
444 | #endif /* _LINUX_TCP_H */ | 416 | #endif /* _LINUX_TCP_H */ |
diff --git a/include/linux/tcp_diag.h b/include/linux/tcp_diag.h index ceee962e1d15..7a5996743946 100644 --- a/include/linux/tcp_diag.h +++ b/include/linux/tcp_diag.h | |||
@@ -99,9 +99,10 @@ enum | |||
99 | TCPDIAG_MEMINFO, | 99 | TCPDIAG_MEMINFO, |
100 | TCPDIAG_INFO, | 100 | TCPDIAG_INFO, |
101 | TCPDIAG_VEGASINFO, | 101 | TCPDIAG_VEGASINFO, |
102 | TCPDIAG_CONG, | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | #define TCPDIAG_MAX TCPDIAG_VEGASINFO | 105 | #define TCPDIAG_MAX TCPDIAG_CONG |
105 | 106 | ||
106 | 107 | ||
107 | /* TCPDIAG_MEM */ | 108 | /* TCPDIAG_MEM */ |
@@ -123,5 +124,4 @@ struct tcpvegas_info { | |||
123 | __u32 tcpv_minrtt; | 124 | __u32 tcpv_minrtt; |
124 | }; | 125 | }; |
125 | 126 | ||
126 | |||
127 | #endif /* _TCP_DIAG_H_ */ | 127 | #endif /* _TCP_DIAG_H_ */ |
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h new file mode 100644 index 000000000000..941f45ac117a --- /dev/null +++ b/include/linux/textsearch.h | |||
@@ -0,0 +1,180 @@ | |||
1 | #ifndef __LINUX_TEXTSEARCH_H | ||
2 | #define __LINUX_TEXTSEARCH_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/types.h> | ||
7 | #include <linux/list.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/err.h> | ||
11 | |||
12 | struct ts_config; | ||
13 | |||
14 | /** | ||
15 | * TS_AUTOLOAD - Automatically load textsearch modules when needed | ||
16 | */ | ||
17 | #define TS_AUTOLOAD 1 | ||
18 | |||
19 | /** | ||
20 | * struct ts_state - search state | ||
21 | * @offset: offset for next match | ||
22 | * @cb: control buffer, for persistant variables of get_next_block() | ||
23 | */ | ||
24 | struct ts_state | ||
25 | { | ||
26 | unsigned int offset; | ||
27 | char cb[40]; | ||
28 | }; | ||
29 | |||
30 | /** | ||
31 | * struct ts_ops - search module operations | ||
32 | * @name: name of search algorithm | ||
33 | * @init: initialization function to prepare a search | ||
34 | * @find: find the next occurrence of the pattern | ||
35 | * @destroy: destroy algorithm specific parts of a search configuration | ||
36 | * @get_pattern: return head of pattern | ||
37 | * @get_pattern_len: return length of pattern | ||
38 | * @owner: module reference to algorithm | ||
39 | */ | ||
40 | struct ts_ops | ||
41 | { | ||
42 | const char *name; | ||
43 | struct ts_config * (*init)(const void *, unsigned int, int); | ||
44 | unsigned int (*find)(struct ts_config *, | ||
45 | struct ts_state *); | ||
46 | void (*destroy)(struct ts_config *); | ||
47 | void * (*get_pattern)(struct ts_config *); | ||
48 | unsigned int (*get_pattern_len)(struct ts_config *); | ||
49 | struct module *owner; | ||
50 | struct list_head list; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * struct ts_config - search configuration | ||
55 | * @ops: operations of chosen algorithm | ||
56 | * @get_next_block: callback to fetch the next block to search in | ||
57 | * @finish: callback to finalize a search | ||
58 | */ | ||
59 | struct ts_config | ||
60 | { | ||
61 | struct ts_ops *ops; | ||
62 | |||
63 | /** | ||
64 | * get_next_block - fetch next block of data | ||
65 | * @consumed: number of bytes consumed by the caller | ||
66 | * @dst: destination buffer | ||
67 | * @conf: search configuration | ||
68 | * @state: search state | ||
69 | * | ||
70 | * Called repeatedly until 0 is returned. Must assign the | ||
71 | * head of the next block of data to &*dst and return the length | ||
72 | * of the block or 0 if at the end. consumed == 0 indicates | ||
73 | * a new search. May store/read persistant values in state->cb. | ||
74 | */ | ||
75 | unsigned int (*get_next_block)(unsigned int consumed, | ||
76 | const u8 **dst, | ||
77 | struct ts_config *conf, | ||
78 | struct ts_state *state); | ||
79 | |||
80 | /** | ||
81 | * finish - finalize/clean a series of get_next_block() calls | ||
82 | * @conf: search configuration | ||
83 | * @state: search state | ||
84 | * | ||
85 | * Called after the last use of get_next_block(), may be used | ||
86 | * to cleanup any leftovers. | ||
87 | */ | ||
88 | void (*finish)(struct ts_config *conf, | ||
89 | struct ts_state *state); | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * textsearch_next - continue searching for a pattern | ||
94 | * @conf: search configuration | ||
95 | * @state: search state | ||
96 | * | ||
97 | * Continues a search looking for more occurrences of the pattern. | ||
98 | * textsearch_find() must be called to find the first occurrence | ||
99 | * in order to reset the state. | ||
100 | * | ||
101 | * Returns the position of the next occurrence of the pattern or | ||
102 | * UINT_MAX if not match was found. | ||
103 | */ | ||
104 | static inline unsigned int textsearch_next(struct ts_config *conf, | ||
105 | struct ts_state *state) | ||
106 | { | ||
107 | unsigned int ret = conf->ops->find(conf, state); | ||
108 | |||
109 | if (conf->finish) | ||
110 | conf->finish(conf, state); | ||
111 | |||
112 | return ret; | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * textsearch_find - start searching for a pattern | ||
117 | * @conf: search configuration | ||
118 | * @state: search state | ||
119 | * | ||
120 | * Returns the position of first occurrence of the pattern or | ||
121 | * UINT_MAX if no match was found. | ||
122 | */ | ||
123 | static inline unsigned int textsearch_find(struct ts_config *conf, | ||
124 | struct ts_state *state) | ||
125 | { | ||
126 | state->offset = 0; | ||
127 | return textsearch_next(conf, state); | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * textsearch_get_pattern - return head of the pattern | ||
132 | * @conf: search configuration | ||
133 | */ | ||
134 | static inline void *textsearch_get_pattern(struct ts_config *conf) | ||
135 | { | ||
136 | return conf->ops->get_pattern(conf); | ||
137 | } | ||
138 | |||
139 | /** | ||
140 | * textsearch_get_pattern_len - return length of the pattern | ||
141 | * @conf: search configuration | ||
142 | */ | ||
143 | static inline unsigned int textsearch_get_pattern_len(struct ts_config *conf) | ||
144 | { | ||
145 | return conf->ops->get_pattern_len(conf); | ||
146 | } | ||
147 | |||
148 | extern int textsearch_register(struct ts_ops *); | ||
149 | extern int textsearch_unregister(struct ts_ops *); | ||
150 | extern struct ts_config *textsearch_prepare(const char *, const void *, | ||
151 | unsigned int, int, int); | ||
152 | extern void textsearch_destroy(struct ts_config *conf); | ||
153 | extern unsigned int textsearch_find_continuous(struct ts_config *, | ||
154 | struct ts_state *, | ||
155 | const void *, unsigned int); | ||
156 | |||
157 | |||
158 | #define TS_PRIV_ALIGNTO 8 | ||
159 | #define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) | ||
160 | |||
161 | static inline struct ts_config *alloc_ts_config(size_t payload, int gfp_mask) | ||
162 | { | ||
163 | struct ts_config *conf; | ||
164 | |||
165 | conf = kmalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask); | ||
166 | if (conf == NULL) | ||
167 | return ERR_PTR(-ENOMEM); | ||
168 | |||
169 | memset(conf, 0, TS_PRIV_ALIGN(sizeof(*conf)) + payload); | ||
170 | return conf; | ||
171 | } | ||
172 | |||
173 | static inline void *ts_config_priv(struct ts_config *conf) | ||
174 | { | ||
175 | return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); | ||
176 | } | ||
177 | |||
178 | #endif /* __KERNEL__ */ | ||
179 | |||
180 | #endif | ||
diff --git a/include/linux/textsearch_fsm.h b/include/linux/textsearch_fsm.h new file mode 100644 index 000000000000..fdfa078c66e5 --- /dev/null +++ b/include/linux/textsearch_fsm.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef __LINUX_TEXTSEARCH_FSM_H | ||
2 | #define __LINUX_TEXTSEARCH_FSM_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | TS_FSM_SPECIFIC, /* specific character */ | ||
8 | TS_FSM_WILDCARD, /* any character */ | ||
9 | TS_FSM_DIGIT, /* isdigit() */ | ||
10 | TS_FSM_XDIGIT, /* isxdigit() */ | ||
11 | TS_FSM_PRINT, /* isprint() */ | ||
12 | TS_FSM_ALPHA, /* isalpha() */ | ||
13 | TS_FSM_ALNUM, /* isalnum() */ | ||
14 | TS_FSM_ASCII, /* isascii() */ | ||
15 | TS_FSM_CNTRL, /* iscntrl() */ | ||
16 | TS_FSM_GRAPH, /* isgraph() */ | ||
17 | TS_FSM_LOWER, /* islower() */ | ||
18 | TS_FSM_UPPER, /* isupper() */ | ||
19 | TS_FSM_PUNCT, /* ispunct() */ | ||
20 | TS_FSM_SPACE, /* isspace() */ | ||
21 | __TS_FSM_TYPE_MAX, | ||
22 | }; | ||
23 | #define TS_FSM_TYPE_MAX (__TS_FSM_TYPE_MAX - 1) | ||
24 | |||
25 | enum { | ||
26 | TS_FSM_SINGLE, /* 1 occurrence */ | ||
27 | TS_FSM_PERHAPS, /* 1 or 0 occurrence */ | ||
28 | TS_FSM_ANY, /* 0..n occurrences */ | ||
29 | TS_FSM_MULTI, /* 1..n occurrences */ | ||
30 | TS_FSM_HEAD_IGNORE, /* 0..n ignored occurrences at head */ | ||
31 | __TS_FSM_RECUR_MAX, | ||
32 | }; | ||
33 | #define TS_FSM_RECUR_MAX (__TS_FSM_RECUR_MAX - 1) | ||
34 | |||
35 | /** | ||
36 | * struct ts_fsm_token - state machine token (state) | ||
37 | * @type: type of token | ||
38 | * @recur: number of recurrences | ||
39 | * @value: character value for TS_FSM_SPECIFIC | ||
40 | */ | ||
41 | struct ts_fsm_token | ||
42 | { | ||
43 | __u16 type; | ||
44 | __u8 recur; | ||
45 | __u8 value; | ||
46 | }; | ||
47 | |||
48 | #endif | ||
diff --git a/include/linux/timer.h b/include/linux/timer.h index 90db1cc62ddd..221f81ac2002 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -6,45 +6,33 @@ | |||
6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
7 | #include <linux/stddef.h> | 7 | #include <linux/stddef.h> |
8 | 8 | ||
9 | struct tvec_t_base_s; | 9 | struct timer_base_s; |
10 | 10 | ||
11 | struct timer_list { | 11 | struct timer_list { |
12 | struct list_head entry; | 12 | struct list_head entry; |
13 | unsigned long expires; | 13 | unsigned long expires; |
14 | 14 | ||
15 | spinlock_t lock; | ||
16 | unsigned long magic; | 15 | unsigned long magic; |
17 | 16 | ||
18 | void (*function)(unsigned long); | 17 | void (*function)(unsigned long); |
19 | unsigned long data; | 18 | unsigned long data; |
20 | 19 | ||
21 | struct tvec_t_base_s *base; | 20 | struct timer_base_s *base; |
22 | }; | 21 | }; |
23 | 22 | ||
24 | #define TIMER_MAGIC 0x4b87ad6e | 23 | #define TIMER_MAGIC 0x4b87ad6e |
25 | 24 | ||
25 | extern struct timer_base_s __init_timer_base; | ||
26 | |||
26 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ | 27 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ |
27 | .function = (_function), \ | 28 | .function = (_function), \ |
28 | .expires = (_expires), \ | 29 | .expires = (_expires), \ |
29 | .data = (_data), \ | 30 | .data = (_data), \ |
30 | .base = NULL, \ | 31 | .base = &__init_timer_base, \ |
31 | .magic = TIMER_MAGIC, \ | 32 | .magic = TIMER_MAGIC, \ |
32 | .lock = SPIN_LOCK_UNLOCKED, \ | ||
33 | } | 33 | } |
34 | 34 | ||
35 | /*** | 35 | void fastcall init_timer(struct timer_list * timer); |
36 | * init_timer - initialize a timer. | ||
37 | * @timer: the timer to be initialized | ||
38 | * | ||
39 | * init_timer() must be done to a timer prior calling *any* of the | ||
40 | * other timer functions. | ||
41 | */ | ||
42 | static inline void init_timer(struct timer_list * timer) | ||
43 | { | ||
44 | timer->base = NULL; | ||
45 | timer->magic = TIMER_MAGIC; | ||
46 | spin_lock_init(&timer->lock); | ||
47 | } | ||
48 | 36 | ||
49 | /*** | 37 | /*** |
50 | * timer_pending - is a timer pending? | 38 | * timer_pending - is a timer pending? |
@@ -58,7 +46,7 @@ static inline void init_timer(struct timer_list * timer) | |||
58 | */ | 46 | */ |
59 | static inline int timer_pending(const struct timer_list * timer) | 47 | static inline int timer_pending(const struct timer_list * timer) |
60 | { | 48 | { |
61 | return timer->base != NULL; | 49 | return timer->entry.next != NULL; |
62 | } | 50 | } |
63 | 51 | ||
64 | extern void add_timer_on(struct timer_list *timer, int cpu); | 52 | extern void add_timer_on(struct timer_list *timer, int cpu); |
@@ -88,13 +76,15 @@ static inline void add_timer(struct timer_list * timer) | |||
88 | } | 76 | } |
89 | 77 | ||
90 | #ifdef CONFIG_SMP | 78 | #ifdef CONFIG_SMP |
79 | extern int try_to_del_timer_sync(struct timer_list *timer); | ||
91 | extern int del_timer_sync(struct timer_list *timer); | 80 | extern int del_timer_sync(struct timer_list *timer); |
92 | extern int del_singleshot_timer_sync(struct timer_list *timer); | ||
93 | #else | 81 | #else |
94 | # define del_timer_sync(t) del_timer(t) | 82 | # define try_to_del_timer_sync(t) del_timer(t) |
95 | # define del_singleshot_timer_sync(t) del_timer(t) | 83 | # define del_timer_sync(t) del_timer(t) |
96 | #endif | 84 | #endif |
97 | 85 | ||
86 | #define del_singleshot_timer_sync(t) del_timer_sync(t) | ||
87 | |||
98 | extern void init_timers(void); | 88 | extern void init_timers(void); |
99 | extern void run_local_timers(void); | 89 | extern void run_local_timers(void); |
100 | extern void it_real_fn(unsigned long); | 90 | extern void it_real_fn(unsigned long); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 1b76106272d3..59ff42c629ec 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -345,6 +345,7 @@ extern int tty_check_change(struct tty_struct * tty); | |||
345 | extern void stop_tty(struct tty_struct * tty); | 345 | extern void stop_tty(struct tty_struct * tty); |
346 | extern void start_tty(struct tty_struct * tty); | 346 | extern void start_tty(struct tty_struct * tty); |
347 | extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); | 347 | extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); |
348 | extern int tty_unregister_ldisc(int disc); | ||
348 | extern int tty_register_driver(struct tty_driver *driver); | 349 | extern int tty_register_driver(struct tty_driver *driver); |
349 | extern int tty_unregister_driver(struct tty_driver *driver); | 350 | extern int tty_unregister_driver(struct tty_driver *driver); |
350 | extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev); | 351 | extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 3d508bf08402..eb282b581546 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -290,7 +290,7 @@ struct usb_bus { | |||
290 | struct class_device *class_dev; /* class device for this bus */ | 290 | struct class_device *class_dev; /* class device for this bus */ |
291 | struct kref kref; /* handles reference counting this bus */ | 291 | struct kref kref; /* handles reference counting this bus */ |
292 | void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ | 292 | void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ |
293 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) | 293 | #if defined(CONFIG_USB_MON) |
294 | struct mon_bus *mon_bus; /* non-null when associated */ | 294 | struct mon_bus *mon_bus; /* non-null when associated */ |
295 | int monitored; /* non-zero when monitored */ | 295 | int monitored; /* non-zero when monitored */ |
296 | #endif | 296 | #endif |
diff --git a/include/linux/wait.h b/include/linux/wait.h index c9486c3efb4a..d38c9fecdc36 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -33,7 +33,7 @@ int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key | |||
33 | struct __wait_queue { | 33 | struct __wait_queue { |
34 | unsigned int flags; | 34 | unsigned int flags; |
35 | #define WQ_FLAG_EXCLUSIVE 0x01 | 35 | #define WQ_FLAG_EXCLUSIVE 0x01 |
36 | struct task_struct * task; | 36 | void *private; |
37 | wait_queue_func_t func; | 37 | wait_queue_func_t func; |
38 | struct list_head task_list; | 38 | struct list_head task_list; |
39 | }; | 39 | }; |
@@ -60,7 +60,7 @@ typedef struct __wait_queue_head wait_queue_head_t; | |||
60 | */ | 60 | */ |
61 | 61 | ||
62 | #define __WAITQUEUE_INITIALIZER(name, tsk) { \ | 62 | #define __WAITQUEUE_INITIALIZER(name, tsk) { \ |
63 | .task = tsk, \ | 63 | .private = tsk, \ |
64 | .func = default_wake_function, \ | 64 | .func = default_wake_function, \ |
65 | .task_list = { NULL, NULL } } | 65 | .task_list = { NULL, NULL } } |
66 | 66 | ||
@@ -86,7 +86,7 @@ static inline void init_waitqueue_head(wait_queue_head_t *q) | |||
86 | static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) | 86 | static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) |
87 | { | 87 | { |
88 | q->flags = 0; | 88 | q->flags = 0; |
89 | q->task = p; | 89 | q->private = p; |
90 | q->func = default_wake_function; | 90 | q->func = default_wake_function; |
91 | } | 91 | } |
92 | 92 | ||
@@ -94,7 +94,7 @@ static inline void init_waitqueue_func_entry(wait_queue_t *q, | |||
94 | wait_queue_func_t func) | 94 | wait_queue_func_t func) |
95 | { | 95 | { |
96 | q->flags = 0; | 96 | q->flags = 0; |
97 | q->task = NULL; | 97 | q->private = NULL; |
98 | q->func = func; | 98 | q->func = func; |
99 | } | 99 | } |
100 | 100 | ||
@@ -110,7 +110,7 @@ static inline int waitqueue_active(wait_queue_head_t *q) | |||
110 | * aio specifies a wait queue entry with an async notification | 110 | * aio specifies a wait queue entry with an async notification |
111 | * callback routine, not associated with any task. | 111 | * callback routine, not associated with any task. |
112 | */ | 112 | */ |
113 | #define is_sync_wait(wait) (!(wait) || ((wait)->task)) | 113 | #define is_sync_wait(wait) (!(wait) || ((wait)->private)) |
114 | 114 | ||
115 | extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); | 115 | extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); |
116 | extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)); | 116 | extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)); |
@@ -384,7 +384,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | |||
384 | 384 | ||
385 | #define DEFINE_WAIT(name) \ | 385 | #define DEFINE_WAIT(name) \ |
386 | wait_queue_t name = { \ | 386 | wait_queue_t name = { \ |
387 | .task = current, \ | 387 | .private = current, \ |
388 | .func = autoremove_wake_function, \ | 388 | .func = autoremove_wake_function, \ |
389 | .task_list = LIST_HEAD_INIT((name).task_list), \ | 389 | .task_list = LIST_HEAD_INIT((name).task_list), \ |
390 | } | 390 | } |
@@ -393,7 +393,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | |||
393 | struct wait_bit_queue name = { \ | 393 | struct wait_bit_queue name = { \ |
394 | .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ | 394 | .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ |
395 | .wait = { \ | 395 | .wait = { \ |
396 | .task = current, \ | 396 | .private = current, \ |
397 | .func = wake_bit_function, \ | 397 | .func = wake_bit_function, \ |
398 | .task_list = \ | 398 | .task_list = \ |
399 | LIST_HEAD_INIT((name).wait.task_list), \ | 399 | LIST_HEAD_INIT((name).wait.task_list), \ |
@@ -402,7 +402,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | |||
402 | 402 | ||
403 | #define init_wait(wait) \ | 403 | #define init_wait(wait) \ |
404 | do { \ | 404 | do { \ |
405 | (wait)->task = current; \ | 405 | (wait)->private = current; \ |
406 | (wait)->func = autoremove_wake_function; \ | 406 | (wait)->func = autoremove_wake_function; \ |
407 | INIT_LIST_HEAD(&(wait)->task_list); \ | 407 | INIT_LIST_HEAD(&(wait)->task_list); \ |
408 | } while (0) | 408 | } while (0) |
diff --git a/include/media/audiochip.h b/include/media/audiochip.h index d3e9e30608dc..f345a61c3bdb 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: audiochip.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | #ifndef AUDIOCHIP_H | 5 | #ifndef AUDIOCHIP_H |
2 | #define AUDIOCHIP_H | 6 | #define AUDIOCHIP_H |
3 | 7 | ||
diff --git a/include/media/id.h b/include/media/id.h index 1b0320dc8f73..a39a6423914b 100644 --- a/include/media/id.h +++ b/include/media/id.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: id.h,v 1.4 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ | 5 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ |
2 | 6 | ||
3 | /* drivers */ | 7 | /* drivers */ |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 62c963a52d86..698670547f16 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-common.h,v 1.8 2005/02/22 12:28:40 kraxel Exp $ | 2 | * $Id: ir-common.h,v 1.9 2005/05/15 19:01:26 mchehab Exp $ |
3 | * | 3 | * |
4 | * some common structs and functions to handle infrared remotes via | 4 | * some common structs and functions to handle infrared remotes via |
5 | * input layer ... | 5 | * input layer ... |
@@ -50,6 +50,7 @@ extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; | |||
50 | extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; | 50 | extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; |
51 | extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; | 51 | extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; |
52 | extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; | 52 | extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; |
53 | extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; | ||
53 | 54 | ||
54 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | 55 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, |
55 | int ir_type, IR_KEYTAB_TYPE *ir_codes); | 56 | int ir_type, IR_KEYTAB_TYPE *ir_codes); |
diff --git a/include/media/tuner.h b/include/media/tuner.h index 156a9c51ffec..2dd8310901e8 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #include "id.h" | 26 | #include "id.h" |
27 | 27 | ||
28 | #define ADDR_UNSET (255) | ||
29 | |||
28 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ | 30 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ |
29 | #define TUNER_PHILIPS_PAL_I 1 | 31 | #define TUNER_PHILIPS_PAL_I 1 |
30 | #define TUNER_PHILIPS_NTSC 2 | 32 | #define TUNER_PHILIPS_NTSC 2 |
@@ -98,12 +100,23 @@ | |||
98 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ | 100 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ |
99 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ | 101 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ |
100 | 102 | ||
103 | #define TUNER_YMEC_TVF_8531MF 58 | ||
104 | #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ | ||
105 | #define TUNER_THOMSON_DTT7611 60 | ||
106 | #define TUNER_TENA_9533_DI 61 | ||
107 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ | ||
108 | |||
109 | #define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio" | ||
110 | |||
111 | #define TUNER_THOMSON_DTT7611 60 | ||
112 | |||
101 | #define NOTUNER 0 | 113 | #define NOTUNER 0 |
102 | #define PAL 1 /* PAL_BG */ | 114 | #define PAL 1 /* PAL_BG */ |
103 | #define PAL_I 2 | 115 | #define PAL_I 2 |
104 | #define NTSC 3 | 116 | #define NTSC 3 |
105 | #define SECAM 4 | 117 | #define SECAM 4 |
106 | #define ATSC 5 | 118 | #define ATSC 5 |
119 | #define RADIO 6 | ||
107 | 120 | ||
108 | #define NoTuner 0 | 121 | #define NoTuner 0 |
109 | #define Philips 1 | 122 | #define Philips 1 |
@@ -119,10 +132,20 @@ | |||
119 | #define TCL 11 | 132 | #define TCL 11 |
120 | #define THOMSON 12 | 133 | #define THOMSON 12 |
121 | 134 | ||
135 | enum v4l_radio_tuner { | ||
136 | TEA5767_LOW_LO_32768 = 0, | ||
137 | TEA5767_HIGH_LO_32768 = 1, | ||
138 | TEA5767_LOW_LO_13MHz = 2, | ||
139 | TEA5767_HIGH_LO_13MHz = 3, | ||
140 | }; | ||
141 | |||
142 | |||
122 | #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ | 143 | #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ |
123 | #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ | 144 | #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ |
145 | #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) /* set tuner type and I2C addr */ | ||
124 | 146 | ||
125 | #define TDA9887_SET_CONFIG _IOW('t',5,int) | 147 | #define TDA9887_SET_CONFIG _IOW('t',5,int) |
148 | |||
126 | /* tv card specific */ | 149 | /* tv card specific */ |
127 | # define TDA9887_PRESENT (1<<0) | 150 | # define TDA9887_PRESENT (1<<0) |
128 | # define TDA9887_PORT1_INACTIVE (1<<1) | 151 | # define TDA9887_PORT1_INACTIVE (1<<1) |
@@ -143,6 +166,12 @@ | |||
143 | #define I2C_ADDR_TDA8290 0x4b | 166 | #define I2C_ADDR_TDA8290 0x4b |
144 | #define I2C_ADDR_TDA8275 0x61 | 167 | #define I2C_ADDR_TDA8275 0x61 |
145 | 168 | ||
169 | struct tuner_addr { | ||
170 | enum v4l2_tuner_type v4l2_tuner; | ||
171 | unsigned int type; | ||
172 | unsigned short addr; | ||
173 | }; | ||
174 | |||
146 | struct tuner { | 175 | struct tuner { |
147 | /* device */ | 176 | /* device */ |
148 | struct i2c_client i2c; | 177 | struct i2c_client i2c; |
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h index 627603e561a6..5c4fe30e8d1d 100644 --- a/include/media/tveeprom.h +++ b/include/media/tveeprom.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: tveeprom.h,v 1.2 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | struct tveeprom { | 5 | struct tveeprom { |
2 | u32 has_radio; | 6 | u32 has_radio; |
3 | 7 | ||
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index a53e08a45e32..88d9fe5975d5 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -131,7 +131,6 @@ sctp_state_fn_t sctp_sf_do_ecne; | |||
131 | sctp_state_fn_t sctp_sf_ootb; | 131 | sctp_state_fn_t sctp_sf_ootb; |
132 | sctp_state_fn_t sctp_sf_pdiscard; | 132 | sctp_state_fn_t sctp_sf_pdiscard; |
133 | sctp_state_fn_t sctp_sf_violation; | 133 | sctp_state_fn_t sctp_sf_violation; |
134 | sctp_state_fn_t sctp_sf_violation_chunklen; | ||
135 | sctp_state_fn_t sctp_sf_discard_chunk; | 134 | sctp_state_fn_t sctp_sf_discard_chunk; |
136 | sctp_state_fn_t sctp_sf_do_5_2_1_siminit; | 135 | sctp_state_fn_t sctp_sf_do_5_2_1_siminit; |
137 | sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; | 136 | sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; |
@@ -259,11 +258,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, | |||
259 | void sctp_chunk_assign_tsn(struct sctp_chunk *); | 258 | void sctp_chunk_assign_tsn(struct sctp_chunk *); |
260 | void sctp_chunk_assign_ssn(struct sctp_chunk *); | 259 | void sctp_chunk_assign_ssn(struct sctp_chunk *); |
261 | 260 | ||
262 | sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, | ||
263 | __u16 error, | ||
264 | const struct sctp_association *asoc, | ||
265 | struct sctp_transport *transport); | ||
266 | |||
267 | /* Prototypes for statetable processing. */ | 261 | /* Prototypes for statetable processing. */ |
268 | 262 | ||
269 | int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, | 263 | int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, |
diff --git a/include/net/tcp.h b/include/net/tcp.h index f730935b824a..ec9e20c27179 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -505,25 +505,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk) | |||
505 | #else | 505 | #else |
506 | # define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) | 506 | # define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) |
507 | #endif | 507 | #endif |
508 | |||
509 | #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation | ||
510 | * max_cwnd = snd_cwnd * beta | ||
511 | */ | ||
512 | #define BICTCP_MAX_INCREMENT 32 /* | ||
513 | * Limit on the amount of | ||
514 | * increment allowed during | ||
515 | * binary search. | ||
516 | */ | ||
517 | #define BICTCP_FUNC_OF_MIN_INCR 11 /* | ||
518 | * log(B/Smin)/log(B/(B-1))+1, | ||
519 | * Smin:min increment | ||
520 | * B:log factor | ||
521 | */ | ||
522 | #define BICTCP_B 4 /* | ||
523 | * In binary search, | ||
524 | * go to point (max+min)/N | ||
525 | */ | ||
526 | |||
527 | /* | 508 | /* |
528 | * TCP option | 509 | * TCP option |
529 | */ | 510 | */ |
@@ -596,16 +577,7 @@ extern int sysctl_tcp_adv_win_scale; | |||
596 | extern int sysctl_tcp_tw_reuse; | 577 | extern int sysctl_tcp_tw_reuse; |
597 | extern int sysctl_tcp_frto; | 578 | extern int sysctl_tcp_frto; |
598 | extern int sysctl_tcp_low_latency; | 579 | extern int sysctl_tcp_low_latency; |
599 | extern int sysctl_tcp_westwood; | ||
600 | extern int sysctl_tcp_vegas_cong_avoid; | ||
601 | extern int sysctl_tcp_vegas_alpha; | ||
602 | extern int sysctl_tcp_vegas_beta; | ||
603 | extern int sysctl_tcp_vegas_gamma; | ||
604 | extern int sysctl_tcp_nometrics_save; | 580 | extern int sysctl_tcp_nometrics_save; |
605 | extern int sysctl_tcp_bic; | ||
606 | extern int sysctl_tcp_bic_fast_convergence; | ||
607 | extern int sysctl_tcp_bic_low_window; | ||
608 | extern int sysctl_tcp_bic_beta; | ||
609 | extern int sysctl_tcp_moderate_rcvbuf; | 581 | extern int sysctl_tcp_moderate_rcvbuf; |
610 | extern int sysctl_tcp_tso_win_divisor; | 582 | extern int sysctl_tcp_tso_win_divisor; |
611 | 583 | ||
@@ -1136,6 +1108,82 @@ static inline void tcp_packets_out_dec(struct tcp_sock *tp, | |||
1136 | tp->packets_out -= tcp_skb_pcount(skb); | 1108 | tp->packets_out -= tcp_skb_pcount(skb); |
1137 | } | 1109 | } |
1138 | 1110 | ||
1111 | /* Events passed to congestion control interface */ | ||
1112 | enum tcp_ca_event { | ||
1113 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ | ||
1114 | CA_EVENT_CWND_RESTART, /* congestion window restart */ | ||
1115 | CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ | ||
1116 | CA_EVENT_FRTO, /* fast recovery timeout */ | ||
1117 | CA_EVENT_LOSS, /* loss timeout */ | ||
1118 | CA_EVENT_FAST_ACK, /* in sequence ack */ | ||
1119 | CA_EVENT_SLOW_ACK, /* other ack */ | ||
1120 | }; | ||
1121 | |||
1122 | /* | ||
1123 | * Interface for adding new TCP congestion control handlers | ||
1124 | */ | ||
1125 | #define TCP_CA_NAME_MAX 16 | ||
1126 | struct tcp_congestion_ops { | ||
1127 | struct list_head list; | ||
1128 | |||
1129 | /* initialize private data (optional) */ | ||
1130 | void (*init)(struct tcp_sock *tp); | ||
1131 | /* cleanup private data (optional) */ | ||
1132 | void (*release)(struct tcp_sock *tp); | ||
1133 | |||
1134 | /* return slow start threshold (required) */ | ||
1135 | u32 (*ssthresh)(struct tcp_sock *tp); | ||
1136 | /* lower bound for congestion window (optional) */ | ||
1137 | u32 (*min_cwnd)(struct tcp_sock *tp); | ||
1138 | /* do new cwnd calculation (required) */ | ||
1139 | void (*cong_avoid)(struct tcp_sock *tp, u32 ack, | ||
1140 | u32 rtt, u32 in_flight, int good_ack); | ||
1141 | /* round trip time sample per acked packet (optional) */ | ||
1142 | void (*rtt_sample)(struct tcp_sock *tp, u32 usrtt); | ||
1143 | /* call before changing ca_state (optional) */ | ||
1144 | void (*set_state)(struct tcp_sock *tp, u8 new_state); | ||
1145 | /* call when cwnd event occurs (optional) */ | ||
1146 | void (*cwnd_event)(struct tcp_sock *tp, enum tcp_ca_event ev); | ||
1147 | /* new value of cwnd after loss (optional) */ | ||
1148 | u32 (*undo_cwnd)(struct tcp_sock *tp); | ||
1149 | /* hook for packet ack accounting (optional) */ | ||
1150 | void (*pkts_acked)(struct tcp_sock *tp, u32 num_acked); | ||
1151 | /* get info for tcp_diag (optional) */ | ||
1152 | void (*get_info)(struct tcp_sock *tp, u32 ext, struct sk_buff *skb); | ||
1153 | |||
1154 | char name[TCP_CA_NAME_MAX]; | ||
1155 | struct module *owner; | ||
1156 | }; | ||
1157 | |||
1158 | extern int tcp_register_congestion_control(struct tcp_congestion_ops *type); | ||
1159 | extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); | ||
1160 | |||
1161 | extern void tcp_init_congestion_control(struct tcp_sock *tp); | ||
1162 | extern void tcp_cleanup_congestion_control(struct tcp_sock *tp); | ||
1163 | extern int tcp_set_default_congestion_control(const char *name); | ||
1164 | extern void tcp_get_default_congestion_control(char *name); | ||
1165 | extern int tcp_set_congestion_control(struct tcp_sock *tp, const char *name); | ||
1166 | |||
1167 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | ||
1168 | extern u32 tcp_reno_ssthresh(struct tcp_sock *tp); | ||
1169 | extern void tcp_reno_cong_avoid(struct tcp_sock *tp, u32 ack, | ||
1170 | u32 rtt, u32 in_flight, int flag); | ||
1171 | extern u32 tcp_reno_min_cwnd(struct tcp_sock *tp); | ||
1172 | extern struct tcp_congestion_ops tcp_reno; | ||
1173 | |||
1174 | static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state) | ||
1175 | { | ||
1176 | if (tp->ca_ops->set_state) | ||
1177 | tp->ca_ops->set_state(tp, ca_state); | ||
1178 | tp->ca_state = ca_state; | ||
1179 | } | ||
1180 | |||
1181 | static inline void tcp_ca_event(struct tcp_sock *tp, enum tcp_ca_event event) | ||
1182 | { | ||
1183 | if (tp->ca_ops->cwnd_event) | ||
1184 | tp->ca_ops->cwnd_event(tp, event); | ||
1185 | } | ||
1186 | |||
1139 | /* This determines how many packets are "in the network" to the best | 1187 | /* This determines how many packets are "in the network" to the best |
1140 | * of our knowledge. In many cases it is conservative, but where | 1188 | * of our knowledge. In many cases it is conservative, but where |
1141 | * detailed information is available from the receiver (via SACK | 1189 | * detailed information is available from the receiver (via SACK |
@@ -1155,91 +1203,6 @@ static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) | |||
1155 | return (tp->packets_out - tp->left_out + tp->retrans_out); | 1203 | return (tp->packets_out - tp->left_out + tp->retrans_out); |
1156 | } | 1204 | } |
1157 | 1205 | ||
1158 | /* | ||
1159 | * Which congestion algorithim is in use on the connection. | ||
1160 | */ | ||
1161 | #define tcp_is_vegas(__tp) ((__tp)->adv_cong == TCP_VEGAS) | ||
1162 | #define tcp_is_westwood(__tp) ((__tp)->adv_cong == TCP_WESTWOOD) | ||
1163 | #define tcp_is_bic(__tp) ((__tp)->adv_cong == TCP_BIC) | ||
1164 | |||
1165 | /* Recalculate snd_ssthresh, we want to set it to: | ||
1166 | * | ||
1167 | * Reno: | ||
1168 | * one half the current congestion window, but no | ||
1169 | * less than two segments | ||
1170 | * | ||
1171 | * BIC: | ||
1172 | * behave like Reno until low_window is reached, | ||
1173 | * then increase congestion window slowly | ||
1174 | */ | ||
1175 | static inline __u32 tcp_recalc_ssthresh(struct tcp_sock *tp) | ||
1176 | { | ||
1177 | if (tcp_is_bic(tp)) { | ||
1178 | if (sysctl_tcp_bic_fast_convergence && | ||
1179 | tp->snd_cwnd < tp->bictcp.last_max_cwnd) | ||
1180 | tp->bictcp.last_max_cwnd = (tp->snd_cwnd * | ||
1181 | (BICTCP_BETA_SCALE | ||
1182 | + sysctl_tcp_bic_beta)) | ||
1183 | / (2 * BICTCP_BETA_SCALE); | ||
1184 | else | ||
1185 | tp->bictcp.last_max_cwnd = tp->snd_cwnd; | ||
1186 | |||
1187 | if (tp->snd_cwnd > sysctl_tcp_bic_low_window) | ||
1188 | return max((tp->snd_cwnd * sysctl_tcp_bic_beta) | ||
1189 | / BICTCP_BETA_SCALE, 2U); | ||
1190 | } | ||
1191 | |||
1192 | return max(tp->snd_cwnd >> 1U, 2U); | ||
1193 | } | ||
1194 | |||
1195 | /* Stop taking Vegas samples for now. */ | ||
1196 | #define tcp_vegas_disable(__tp) ((__tp)->vegas.doing_vegas_now = 0) | ||
1197 | |||
1198 | static inline void tcp_vegas_enable(struct tcp_sock *tp) | ||
1199 | { | ||
1200 | /* There are several situations when we must "re-start" Vegas: | ||
1201 | * | ||
1202 | * o when a connection is established | ||
1203 | * o after an RTO | ||
1204 | * o after fast recovery | ||
1205 | * o when we send a packet and there is no outstanding | ||
1206 | * unacknowledged data (restarting an idle connection) | ||
1207 | * | ||
1208 | * In these circumstances we cannot do a Vegas calculation at the | ||
1209 | * end of the first RTT, because any calculation we do is using | ||
1210 | * stale info -- both the saved cwnd and congestion feedback are | ||
1211 | * stale. | ||
1212 | * | ||
1213 | * Instead we must wait until the completion of an RTT during | ||
1214 | * which we actually receive ACKs. | ||
1215 | */ | ||
1216 | |||
1217 | /* Begin taking Vegas samples next time we send something. */ | ||
1218 | tp->vegas.doing_vegas_now = 1; | ||
1219 | |||
1220 | /* Set the beginning of the next send window. */ | ||
1221 | tp->vegas.beg_snd_nxt = tp->snd_nxt; | ||
1222 | |||
1223 | tp->vegas.cntRTT = 0; | ||
1224 | tp->vegas.minRTT = 0x7fffffff; | ||
1225 | } | ||
1226 | |||
1227 | /* Should we be taking Vegas samples right now? */ | ||
1228 | #define tcp_vegas_enabled(__tp) ((__tp)->vegas.doing_vegas_now) | ||
1229 | |||
1230 | extern void tcp_ca_init(struct tcp_sock *tp); | ||
1231 | |||
1232 | static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state) | ||
1233 | { | ||
1234 | if (tcp_is_vegas(tp)) { | ||
1235 | if (ca_state == TCP_CA_Open) | ||
1236 | tcp_vegas_enable(tp); | ||
1237 | else | ||
1238 | tcp_vegas_disable(tp); | ||
1239 | } | ||
1240 | tp->ca_state = ca_state; | ||
1241 | } | ||
1242 | |||
1243 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. | 1206 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. |
1244 | * The exception is rate halving phase, when cwnd is decreasing towards | 1207 | * The exception is rate halving phase, when cwnd is decreasing towards |
1245 | * ssthresh. | 1208 | * ssthresh. |
@@ -1288,7 +1251,7 @@ static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp) | |||
1288 | static inline void __tcp_enter_cwr(struct tcp_sock *tp) | 1251 | static inline void __tcp_enter_cwr(struct tcp_sock *tp) |
1289 | { | 1252 | { |
1290 | tp->undo_marker = 0; | 1253 | tp->undo_marker = 0; |
1291 | tp->snd_ssthresh = tcp_recalc_ssthresh(tp); | 1254 | tp->snd_ssthresh = tp->ca_ops->ssthresh(tp); |
1292 | tp->snd_cwnd = min(tp->snd_cwnd, | 1255 | tp->snd_cwnd = min(tp->snd_cwnd, |
1293 | tcp_packets_in_flight(tp) + 1U); | 1256 | tcp_packets_in_flight(tp) + 1U); |
1294 | tp->snd_cwnd_cnt = 0; | 1257 | tp->snd_cwnd_cnt = 0; |
@@ -1876,52 +1839,4 @@ struct tcp_iter_state { | |||
1876 | extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); | 1839 | extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); |
1877 | extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); | 1840 | extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); |
1878 | 1841 | ||
1879 | /* TCP Westwood functions and constants */ | ||
1880 | |||
1881 | #define TCP_WESTWOOD_INIT_RTT (20*HZ) /* maybe too conservative?! */ | ||
1882 | #define TCP_WESTWOOD_RTT_MIN (HZ/20) /* 50ms */ | ||
1883 | |||
1884 | static inline void tcp_westwood_update_rtt(struct tcp_sock *tp, __u32 rtt_seq) | ||
1885 | { | ||
1886 | if (tcp_is_westwood(tp)) | ||
1887 | tp->westwood.rtt = rtt_seq; | ||
1888 | } | ||
1889 | |||
1890 | static inline __u32 __tcp_westwood_bw_rttmin(const struct tcp_sock *tp) | ||
1891 | { | ||
1892 | return max((tp->westwood.bw_est) * (tp->westwood.rtt_min) / | ||
1893 | (__u32) (tp->mss_cache_std), | ||
1894 | 2U); | ||
1895 | } | ||
1896 | |||
1897 | static inline __u32 tcp_westwood_bw_rttmin(const struct tcp_sock *tp) | ||
1898 | { | ||
1899 | return tcp_is_westwood(tp) ? __tcp_westwood_bw_rttmin(tp) : 0; | ||
1900 | } | ||
1901 | |||
1902 | static inline int tcp_westwood_ssthresh(struct tcp_sock *tp) | ||
1903 | { | ||
1904 | __u32 ssthresh = 0; | ||
1905 | |||
1906 | if (tcp_is_westwood(tp)) { | ||
1907 | ssthresh = __tcp_westwood_bw_rttmin(tp); | ||
1908 | if (ssthresh) | ||
1909 | tp->snd_ssthresh = ssthresh; | ||
1910 | } | ||
1911 | |||
1912 | return (ssthresh != 0); | ||
1913 | } | ||
1914 | |||
1915 | static inline int tcp_westwood_cwnd(struct tcp_sock *tp) | ||
1916 | { | ||
1917 | __u32 cwnd = 0; | ||
1918 | |||
1919 | if (tcp_is_westwood(tp)) { | ||
1920 | cwnd = __tcp_westwood_bw_rttmin(tp); | ||
1921 | if (cwnd) | ||
1922 | tp->snd_cwnd = cwnd; | ||
1923 | } | ||
1924 | |||
1925 | return (cwnd != 0); | ||
1926 | } | ||
1927 | #endif /* _TCP_H */ | 1842 | #endif /* _TCP_H */ |
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 6d3413a56708..67b867f31fe4 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h | |||
@@ -77,6 +77,11 @@ extern socket_state_t dead_socket; | |||
77 | /* Use this just for bridge windows */ | 77 | /* Use this just for bridge windows */ |
78 | #define MAP_IOSPACE 0x20 | 78 | #define MAP_IOSPACE 0x20 |
79 | 79 | ||
80 | /* power hook operations */ | ||
81 | #define HOOK_POWER_PRE 0x01 | ||
82 | #define HOOK_POWER_POST 0x02 | ||
83 | |||
84 | |||
80 | typedef struct pccard_io_map { | 85 | typedef struct pccard_io_map { |
81 | u_char map; | 86 | u_char map; |
82 | u_char flags; | 87 | u_char flags; |
@@ -222,6 +227,9 @@ struct pcmcia_socket { | |||
222 | /* Zoom video behaviour is so chip specific its not worth adding | 227 | /* Zoom video behaviour is so chip specific its not worth adding |
223 | this to _ops */ | 228 | this to _ops */ |
224 | void (*zoom_video)(struct pcmcia_socket *, int); | 229 | void (*zoom_video)(struct pcmcia_socket *, int); |
230 | |||
231 | /* so is power hook */ | ||
232 | int (*power_hook)(struct pcmcia_socket *sock, int operation); | ||
225 | 233 | ||
226 | /* state thread */ | 234 | /* state thread */ |
227 | struct semaphore skt_sem; /* protects socket h/w state */ | 235 | struct semaphore skt_sem; /* protects socket h/w state */ |
diff --git a/include/scsi/sg_request.h b/include/scsi/sg_request.h new file mode 100644 index 000000000000..57ff525bdd3b --- /dev/null +++ b/include/scsi/sg_request.h | |||
@@ -0,0 +1,26 @@ | |||
1 | typedef struct scsi_request Scsi_Request; | ||
2 | |||
3 | static Scsi_Request *dummy_cmdp; /* only used for sizeof */ | ||
4 | |||
5 | typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ | ||
6 | unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */ | ||
7 | unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */ | ||
8 | unsigned bufflen; /* Size of (aggregate) data buffer */ | ||
9 | unsigned b_malloc_len; /* actual len malloc'ed in buffer */ | ||
10 | void *buffer; /* Data buffer or scatter list (k_use_sg>0) */ | ||
11 | char dio_in_use; /* 0->indirect IO (or mmap), 1->dio */ | ||
12 | unsigned char cmd_opcode; /* first byte of command */ | ||
13 | } Sg_scatter_hold; | ||
14 | |||
15 | typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */ | ||
16 | Scsi_Request *my_cmdp; /* != 0 when request with lower levels */ | ||
17 | struct sg_request *nextrp; /* NULL -> tail request (slist) */ | ||
18 | struct sg_fd *parentfp; /* NULL -> not in use */ | ||
19 | Sg_scatter_hold data; /* hold buffer, perhaps scatter list */ | ||
20 | sg_io_hdr_t header; /* scsi command+info, see <scsi/sg.h> */ | ||
21 | unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)]; | ||
22 | char res_used; /* 1 -> using reserve buffer, 0 -> not ... */ | ||
23 | char orphan; /* 1 -> drop on sight, 0 -> normal */ | ||
24 | char sg_io_owned; /* 1 -> packet belongs to SG_IO */ | ||
25 | volatile char done; /* 0->before bh, 1->before read, 2->read */ | ||
26 | } Sg_request; | ||
diff --git a/include/sound/core.h b/include/sound/core.h index 9117c23e3a01..f8c4ef0aa352 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -292,6 +292,7 @@ void *snd_hidden_kcalloc(size_t n, size_t size, int flags); | |||
292 | void snd_hidden_kfree(const void *obj); | 292 | void snd_hidden_kfree(const void *obj); |
293 | void *snd_hidden_vmalloc(unsigned long size); | 293 | void *snd_hidden_vmalloc(unsigned long size); |
294 | void snd_hidden_vfree(void *obj); | 294 | void snd_hidden_vfree(void *obj); |
295 | char *snd_hidden_kstrdup(const char *s, int flags); | ||
295 | #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) | 296 | #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) |
296 | #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) | 297 | #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) |
297 | #define kfree(obj) snd_hidden_kfree(obj) | 298 | #define kfree(obj) snd_hidden_kfree(obj) |
@@ -301,6 +302,7 @@ void snd_hidden_vfree(void *obj); | |||
301 | #define vmalloc_nocheck(size) snd_wrapper_vmalloc(size) | 302 | #define vmalloc_nocheck(size) snd_wrapper_vmalloc(size) |
302 | #define kfree_nocheck(obj) snd_wrapper_kfree(obj) | 303 | #define kfree_nocheck(obj) snd_wrapper_kfree(obj) |
303 | #define vfree_nocheck(obj) snd_wrapper_vfree(obj) | 304 | #define vfree_nocheck(obj) snd_wrapper_vfree(obj) |
305 | #define kstrdup(s, flags) snd_hidden_kstrdup(s, flags) | ||
304 | #else | 306 | #else |
305 | #define snd_memory_init() /*NOP*/ | 307 | #define snd_memory_init() /*NOP*/ |
306 | #define snd_memory_done() /*NOP*/ | 308 | #define snd_memory_done() /*NOP*/ |
@@ -311,7 +313,6 @@ void snd_hidden_vfree(void *obj); | |||
311 | #define kfree_nocheck(obj) kfree(obj) | 313 | #define kfree_nocheck(obj) kfree(obj) |
312 | #define vfree_nocheck(obj) vfree(obj) | 314 | #define vfree_nocheck(obj) vfree(obj) |
313 | #endif | 315 | #endif |
314 | char *snd_kmalloc_strdup(const char *string, int flags); | ||
315 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); | 316 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); |
316 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); | 317 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); |
317 | 318 | ||