aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/bitops.h2
-rw-r--r--include/asm-avr32/setup.h2
-rw-r--r--include/asm-generic/bitops/ext2-non-atomic.h2
-rw-r--r--include/asm-generic/bitops/le.h4
-rw-r--r--include/asm-generic/vmlinux.lds.h89
-rw-r--r--include/asm-ia64/gcc_intrin.h2
-rw-r--r--include/asm-m68k/bitops.h2
-rw-r--r--include/asm-m68knommu/bitops.h2
-rw-r--r--include/asm-mips/addrspace.h2
-rw-r--r--include/asm-mips/asm.h8
-rw-r--r--include/asm-mips/bootinfo.h105
-rw-r--r--include/asm-mips/bugs.h25
-rw-r--r--include/asm-mips/cpu-info.h5
-rw-r--r--include/asm-mips/cpu.h4
-rw-r--r--include/asm-mips/delay.h23
-rw-r--r--include/asm-mips/dma.h7
-rw-r--r--include/asm-mips/fixmap.h10
-rw-r--r--include/asm-mips/fw/cfe/cfe_api.h87
-rw-r--r--include/asm-mips/fw/cfe/cfe_error.h19
-rw-r--r--include/asm-mips/mach-cobalt/cobalt.h15
-rw-r--r--include/asm-mips/mach-ip28/cpu-feature-overrides.h50
-rw-r--r--include/asm-mips/mach-ip28/ds1286.h4
-rw-r--r--include/asm-mips/mach-ip28/spaces.h22
-rw-r--r--include/asm-mips/mach-ip28/war.h (renamed from include/asm-mips/mach-qemu/war.h)8
-rw-r--r--include/asm-mips/mach-qemu/cpu-feature-overrides.h32
-rw-r--r--include/asm-mips/mips-boards/generic.h6
-rw-r--r--include/asm-mips/mipsprom.h2
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_regs.h4
-rw-r--r--include/asm-mips/r4kcache.h7
-rw-r--r--include/asm-mips/sgi/ioc.h4
-rw-r--r--include/asm-mips/sibyte/board.h6
-rw-r--r--include/asm-mips/sibyte/sb1250.h2
-rw-r--r--include/asm-mips/sibyte/swarm.h18
-rw-r--r--include/asm-mips/smp-ops.h56
-rw-r--r--include/asm-mips/smp.h64
-rw-r--r--include/asm-mips/sni.h159
-rw-r--r--include/asm-mips/stackframe.h9
-rw-r--r--include/asm-mips/time.h9
-rw-r--r--include/asm-mips/topology.h16
-rw-r--r--include/asm-mips/tx4927/tx4927_pci.h1
-rw-r--r--include/asm-mips/uaccess.h13
-rw-r--r--include/asm-mips/war.h62
-rw-r--r--include/asm-powerpc/bitops.h4
-rw-r--r--include/asm-s390/bitops.h2
-rw-r--r--include/asm-sh/machvec.h2
-rw-r--r--include/asm-sh/thread_info.h2
-rw-r--r--include/asm-x86/thread_info_32.h2
-rw-r--r--include/linux/Kbuild8
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/compiler-gcc3.h2
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/elfnote.h2
-rw-r--r--include/linux/ext4_fs.h198
-rw-r--r--include/linux/ext4_fs_extents.h25
-rw-r--r--include/linux/ext4_fs_i.h25
-rw-r--r--include/linux/ext4_fs_sb.h55
-rw-r--r--include/linux/fs.h19
-rw-r--r--include/linux/init.h130
-rw-r--r--include/linux/jbd2.h135
-rw-r--r--include/linux/module.h26
-rw-r--r--include/linux/moduleparam.h4
-rw-r--r--include/linux/pci.h2
63 files changed, 1026 insertions, 598 deletions
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index 47a6b086eee2..5c60bfc1a84d 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -310,6 +310,8 @@ static inline int constant_fls(int x)
310 _find_first_zero_bit_le(p,sz) 310 _find_first_zero_bit_le(p,sz)
311#define ext2_find_next_zero_bit(p,sz,off) \ 311#define ext2_find_next_zero_bit(p,sz,off) \
312 _find_next_zero_bit_le(p,sz,off) 312 _find_next_zero_bit_le(p,sz,off)
313#define ext2_find_next_bit(p, sz, off) \
314 _find_next_bit_le(p, sz, off)
313 315
314/* 316/*
315 * Minix is defined to use little-endian byte ordering. 317 * Minix is defined to use little-endian byte ordering.
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
index b0828d43e110..ea3070ff13a5 100644
--- a/include/asm-avr32/setup.h
+++ b/include/asm-avr32/setup.h
@@ -110,7 +110,7 @@ struct tagtable {
110 int (*parse)(struct tag *); 110 int (*parse)(struct tag *);
111}; 111};
112 112
113#define __tag __attribute_used__ __attribute__((__section__(".taglist.init"))) 113#define __tag __used __attribute__((__section__(".taglist.init")))
114#define __tagtable(tag, fn) \ 114#define __tagtable(tag, fn) \
115 static struct tagtable __tagtable_##fn __tag = { tag, fn } 115 static struct tagtable __tagtable_##fn __tag = { tag, fn }
116 116
diff --git a/include/asm-generic/bitops/ext2-non-atomic.h b/include/asm-generic/bitops/ext2-non-atomic.h
index 1697404afa05..63cf822431a2 100644
--- a/include/asm-generic/bitops/ext2-non-atomic.h
+++ b/include/asm-generic/bitops/ext2-non-atomic.h
@@ -14,5 +14,7 @@
14 generic_find_first_zero_le_bit((unsigned long *)(addr), (size)) 14 generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
15#define ext2_find_next_zero_bit(addr, size, off) \ 15#define ext2_find_next_zero_bit(addr, size, off) \
16 generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off)) 16 generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
17#define ext2_find_next_bit(addr, size, off) \
18 generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
17 19
18#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */ 20#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index b9c7e5d2d2ad..80e3bf13b2b9 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -20,6 +20,8 @@
20#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr) 20#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr)
21 21
22#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset) 22#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset)
23#define generic_find_next_le_bit(addr, size, offset) \
24 find_next_bit(addr, size, offset)
23 25
24#elif defined(__BIG_ENDIAN) 26#elif defined(__BIG_ENDIAN)
25 27
@@ -42,6 +44,8 @@
42 44
43extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, 45extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
44 unsigned long size, unsigned long offset); 46 unsigned long size, unsigned long offset);
47extern unsigned long generic_find_next_le_bit(const unsigned long *addr,
48 unsigned long size, unsigned long offset);
45 49
46#else 50#else
47#error "Please fix <asm/byteorder.h>" 51#error "Please fix <asm/byteorder.h>"
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9f584cc5c5fb..76df771be585 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -9,10 +9,46 @@
9/* Align . to a 8 byte boundary equals to maximum function alignment. */ 9/* Align . to a 8 byte boundary equals to maximum function alignment. */
10#define ALIGN_FUNCTION() . = ALIGN(8) 10#define ALIGN_FUNCTION() . = ALIGN(8)
11 11
12/* The actual configuration determine if the init/exit sections
13 * are handled as text/data or they can be discarded (which
14 * often happens at runtime)
15 */
16#ifdef CONFIG_HOTPLUG
17#define DEV_KEEP(sec) *(.dev##sec)
18#define DEV_DISCARD(sec)
19#else
20#define DEV_KEEP(sec)
21#define DEV_DISCARD(sec) *(.dev##sec)
22#endif
23
24#ifdef CONFIG_HOTPLUG_CPU
25#define CPU_KEEP(sec) *(.cpu##sec)
26#define CPU_DISCARD(sec)
27#else
28#define CPU_KEEP(sec)
29#define CPU_DISCARD(sec) *(.cpu##sec)
30#endif
31
32#if defined(CONFIG_MEMORY_HOTPLUG)
33#define MEM_KEEP(sec) *(.mem##sec)
34#define MEM_DISCARD(sec)
35#else
36#define MEM_KEEP(sec)
37#define MEM_DISCARD(sec) *(.mem##sec)
38#endif
39
40
12/* .data section */ 41/* .data section */
13#define DATA_DATA \ 42#define DATA_DATA \
14 *(.data) \ 43 *(.data) \
15 *(.data.init.refok) \ 44 *(.data.init.refok) \
45 *(.ref.data) \
46 DEV_KEEP(init.data) \
47 DEV_KEEP(exit.data) \
48 CPU_KEEP(init.data) \
49 CPU_KEEP(exit.data) \
50 MEM_KEEP(init.data) \
51 MEM_KEEP(exit.data) \
16 . = ALIGN(8); \ 52 . = ALIGN(8); \
17 VMLINUX_SYMBOL(__start___markers) = .; \ 53 VMLINUX_SYMBOL(__start___markers) = .; \
18 *(__markers) \ 54 *(__markers) \
@@ -132,6 +168,17 @@
132 *(__ksymtab_strings) \ 168 *(__ksymtab_strings) \
133 } \ 169 } \
134 \ 170 \
171 /* __*init sections */ \
172 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
173 *(.ref.rodata) \
174 DEV_KEEP(init.rodata) \
175 DEV_KEEP(exit.rodata) \
176 CPU_KEEP(init.rodata) \
177 CPU_KEEP(exit.rodata) \
178 MEM_KEEP(init.rodata) \
179 MEM_KEEP(exit.rodata) \
180 } \
181 \
135 /* Built-in module parameters. */ \ 182 /* Built-in module parameters. */ \
136 __param : AT(ADDR(__param) - LOAD_OFFSET) { \ 183 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
137 VMLINUX_SYMBOL(__start___param) = .; \ 184 VMLINUX_SYMBOL(__start___param) = .; \
@@ -139,7 +186,6 @@
139 VMLINUX_SYMBOL(__stop___param) = .; \ 186 VMLINUX_SYMBOL(__stop___param) = .; \
140 VMLINUX_SYMBOL(__end_rodata) = .; \ 187 VMLINUX_SYMBOL(__end_rodata) = .; \
141 } \ 188 } \
142 \
143 . = ALIGN((align)); 189 . = ALIGN((align));
144 190
145/* RODATA provided for backward compatibility. 191/* RODATA provided for backward compatibility.
@@ -158,8 +204,16 @@
158#define TEXT_TEXT \ 204#define TEXT_TEXT \
159 ALIGN_FUNCTION(); \ 205 ALIGN_FUNCTION(); \
160 *(.text) \ 206 *(.text) \
207 *(.ref.text) \
161 *(.text.init.refok) \ 208 *(.text.init.refok) \
162 *(.exit.text.refok) 209 *(.exit.text.refok) \
210 DEV_KEEP(init.text) \
211 DEV_KEEP(exit.text) \
212 CPU_KEEP(init.text) \
213 CPU_KEEP(exit.text) \
214 MEM_KEEP(init.text) \
215 MEM_KEEP(exit.text)
216
163 217
164/* sched.text is aling to function alignment to secure we have same 218/* sched.text is aling to function alignment to secure we have same
165 * address even at second ld pass when generating System.map */ 219 * address even at second ld pass when generating System.map */
@@ -183,6 +237,37 @@
183 *(.kprobes.text) \ 237 *(.kprobes.text) \
184 VMLINUX_SYMBOL(__kprobes_text_end) = .; 238 VMLINUX_SYMBOL(__kprobes_text_end) = .;
185 239
240/* init and exit section handling */
241#define INIT_DATA \
242 *(.init.data) \
243 DEV_DISCARD(init.data) \
244 DEV_DISCARD(init.rodata) \
245 CPU_DISCARD(init.data) \
246 CPU_DISCARD(init.rodata) \
247 MEM_DISCARD(init.data) \
248 MEM_DISCARD(init.rodata)
249
250#define INIT_TEXT \
251 *(.init.text) \
252 DEV_DISCARD(init.text) \
253 CPU_DISCARD(init.text) \
254 MEM_DISCARD(init.text)
255
256#define EXIT_DATA \
257 *(.exit.data) \
258 DEV_DISCARD(exit.data) \
259 DEV_DISCARD(exit.rodata) \
260 CPU_DISCARD(exit.data) \
261 CPU_DISCARD(exit.rodata) \
262 MEM_DISCARD(exit.data) \
263 MEM_DISCARD(exit.rodata)
264
265#define EXIT_TEXT \
266 *(.exit.text) \
267 DEV_DISCARD(exit.text) \
268 CPU_DISCARD(exit.text) \
269 MEM_DISCARD(exit.text)
270
186 /* DWARF debug sections. 271 /* DWARF debug sections.
187 Symbols in the DWARF debugging sections are relative to 272 Symbols in the DWARF debugging sections are relative to
188 the beginning of the section so we begin them at 0. */ 273 the beginning of the section so we begin them at 0. */
diff --git a/include/asm-ia64/gcc_intrin.h b/include/asm-ia64/gcc_intrin.h
index e58d3298fa10..5b6665c754c9 100644
--- a/include/asm-ia64/gcc_intrin.h
+++ b/include/asm-ia64/gcc_intrin.h
@@ -24,7 +24,7 @@
24extern void ia64_bad_param_for_setreg (void); 24extern void ia64_bad_param_for_setreg (void);
25extern void ia64_bad_param_for_getreg (void); 25extern void ia64_bad_param_for_getreg (void);
26 26
27register unsigned long ia64_r13 asm ("r13") __attribute_used__; 27register unsigned long ia64_r13 asm ("r13") __used;
28 28
29#define ia64_setreg(regnum, val) \ 29#define ia64_setreg(regnum, val) \
30({ \ 30({ \
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index 2976b5d68e96..83d1f286230b 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -410,6 +410,8 @@ static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
410 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr)); 410 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
411 return (p - addr) * 32 + res; 411 return (p - addr) * 32 + res;
412} 412}
413#define ext2_find_next_bit(addr, size, off) \
414 generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
413 415
414#endif /* __KERNEL__ */ 416#endif /* __KERNEL__ */
415 417
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index f8dfb7ba2e25..f43afe1fc3b3 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -294,6 +294,8 @@ found_middle:
294 return result + ffz(__swab32(tmp)); 294 return result + ffz(__swab32(tmp));
295} 295}
296 296
297#define ext2_find_next_bit(addr, size, off) \
298 generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
297#include <asm-generic/bitops/minix.h> 299#include <asm-generic/bitops/minix.h>
298 300
299#endif /* __KERNEL__ */ 301#endif /* __KERNEL__ */
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 0bb7a93b7a5e..569f80aacbd2 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -127,7 +127,7 @@
127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p)) 127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK) 128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
129#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \ 129#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \
130 ((cm)<<59) | (a)) 130 (_CONST64_(cm) << 59) | (a))
131 131
132/* 132/*
133 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting 133 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting
diff --git a/include/asm-mips/asm.h b/include/asm-mips/asm.h
index 12e17581b823..608cfcfbb3ea 100644
--- a/include/asm-mips/asm.h
+++ b/include/asm-mips/asm.h
@@ -398,4 +398,12 @@ symbol = value
398 398
399#define SSNOP sll zero, zero, 1 399#define SSNOP sll zero, zero, 1
400 400
401#ifdef CONFIG_SGI_IP28
402/* Inhibit speculative stores to volatile (e.g.DMA) or invalid addresses. */
403#include <asm/cacheops.h>
404#define R10KCBARRIER(addr) cache Cache_Barrier, addr;
405#else
406#define R10KCBARRIER(addr)
407#endif
408
401#endif /* __ASM_ASM_H */ 409#endif /* __ASM_ASM_H */
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index b2dd9b33de8f..e031bdff9920 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -48,22 +48,11 @@
48#define MACH_DS5900 10 /* DECsystem 5900 */ 48#define MACH_DS5900 10 /* DECsystem 5900 */
49 49
50/* 50/*
51 * Valid machtype for group ARC
52 */
53#define MACH_DESKSTATION_RPC44 0 /* Deskstation rPC44 */
54#define MACH_DESKSTATION_TYNE 1 /* Deskstation Tyne */
55
56/*
57 * Valid machtype for group SNI_RM 51 * Valid machtype for group SNI_RM
58 */ 52 */
59#define MACH_SNI_RM200_PCI 0 /* RM200/RM300/RM400 PCI series */ 53#define MACH_SNI_RM200_PCI 0 /* RM200/RM300/RM400 PCI series */
60 54
61/* 55/*
62 * Valid machtype for group ACN
63 */
64#define MACH_ACN_MIPS_BOARD 0 /* ACN MIPS single board */
65
66/*
67 * Valid machtype for group SGI 56 * Valid machtype for group SGI
68 */ 57 */
69#define MACH_SGI_IP22 0 /* Indy, Indigo2, Challenge S */ 58#define MACH_SGI_IP22 0 /* Indy, Indigo2, Challenge S */
@@ -73,44 +62,6 @@
73#define MACH_SGI_IP30 4 /* Octane, Octane2 */ 62#define MACH_SGI_IP30 4 /* Octane, Octane2 */
74 63
75/* 64/*
76 * Valid machtype for group COBALT
77 */
78#define MACH_COBALT_27 0 /* Proto "27" hardware */
79
80/*
81 * Valid machtype for group BAGET
82 */
83#define MACH_BAGET201 0 /* BT23-201 */
84#define MACH_BAGET202 1 /* BT23-202 */
85
86/*
87 * Cosine boards.
88 */
89#define MACH_COSINE_ORION 0
90
91/*
92 * Valid machtype for group MOMENCO
93 */
94#define MACH_MOMENCO_OCELOT 0
95#define MACH_MOMENCO_OCELOT_G 1 /* no more supported (may 2007) */
96#define MACH_MOMENCO_OCELOT_C 2 /* no more supported (jun 2007) */
97#define MACH_MOMENCO_JAGUAR_ATX 3 /* no more supported (may 2007) */
98#define MACH_MOMENCO_OCELOT_3 4
99
100/*
101 * Valid machtype for group PHILIPS
102 */
103#define MACH_PHILIPS_NINO 0 /* Nino */
104#define MACH_PHILIPS_VELO 1 /* Velo */
105#define MACH_PHILIPS_JBS 2 /* JBS */
106#define MACH_PHILIPS_STB810 3 /* STB810 */
107
108/*
109 * Valid machtype for group SIBYTE
110 */
111#define MACH_SWARM 0
112
113/*
114 * Valid machtypes for group Toshiba 65 * Valid machtypes for group Toshiba
115 */ 66 */
116#define MACH_PALLAS 0 67#define MACH_PALLAS 0
@@ -122,64 +73,17 @@
122#define MACH_TOSHIBA_RBTX4938 6 73#define MACH_TOSHIBA_RBTX4938 6
123 74
124/* 75/*
125 * Valid machtype for group Alchemy
126 */
127#define MACH_PB1000 0 /* Au1000-based eval board */
128#define MACH_PB1100 1 /* Au1100-based eval board */
129#define MACH_PB1500 2 /* Au1500-based eval board */
130#define MACH_DB1000 3 /* Au1000-based eval board */
131#define MACH_DB1100 4 /* Au1100-based eval board */
132#define MACH_DB1500 5 /* Au1500-based eval board */
133#define MACH_XXS1500 6 /* Au1500-based eval board */
134#define MACH_MTX1 7 /* 4G MTX-1 Au1500-based board */
135#define MACH_PB1550 8 /* Au1550-based eval board */
136#define MACH_DB1550 9 /* Au1550-based eval board */
137#define MACH_PB1200 10 /* Au1200-based eval board */
138#define MACH_DB1200 11 /* Au1200-based eval board */
139
140/*
141 * Valid machtype for group NEC_VR41XX
142 *
143 * Various NEC-based devices.
144 *
145 * FIXME: MACH_GROUPs should be by _MANUFACTURER_ of * the device, not by
146 * technical properties, so no new additions to this group.
147 */
148#define MACH_NEC_OSPREY 0 /* Osprey eval board */
149#define MACH_NEC_EAGLE 1 /* NEC Eagle/Hawk board */
150#define MACH_ZAO_CAPCELLA 2 /* ZAO Networks Capcella */
151#define MACH_VICTOR_MPC30X 3 /* Victor MP-C303/304 */
152#define MACH_IBM_WORKPAD 4 /* IBM WorkPad z50 */
153#define MACH_CASIO_E55 5 /* CASIO CASSIOPEIA E-10/15/55/65 */
154#define MACH_TANBAC_TB0226 6 /* TANBAC TB0226 (Mbase) */
155#define MACH_TANBAC_TB0229 7 /* TANBAC TB0229 (VR4131DIMM) */
156#define MACH_NEC_CMBVR4133 8 /* CMB VR4133 Board */
157
158#define MACH_HP_LASERJET 1
159
160/*
161 * Valid machtype for group LASAT 76 * Valid machtype for group LASAT
162 */ 77 */
163#define MACH_LASAT_100 0 /* Masquerade II/SP100/SP50/SP25 */ 78#define MACH_LASAT_100 0 /* Masquerade II/SP100/SP50/SP25 */
164#define MACH_LASAT_200 1 /* Masquerade PRO/SP200 */ 79#define MACH_LASAT_200 1 /* Masquerade PRO/SP200 */
165 80
166/* 81/*
167 * Valid machtype for group TITAN
168 */
169#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
170#define MACH_TITAN_EXCITE 2 /* Basler eXcite */
171
172/*
173 * Valid machtype for group NEC EMMA2RH 82 * Valid machtype for group NEC EMMA2RH
174 */ 83 */
175#define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */ 84#define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */
176 85
177/* 86/*
178 * Valid machtype for group LEMOTE
179 */
180#define MACH_LEMOTE_FULONG 0
181
182/*
183 * Valid machtype for group PMC-MSP 87 * Valid machtype for group PMC-MSP
184 */ 88 */
185#define MACH_MSP4200_EVAL 0 /* PMC-Sierra MSP4200 Evaluation */ 89#define MACH_MSP4200_EVAL 0 /* PMC-Sierra MSP4200 Evaluation */
@@ -190,16 +94,9 @@
190#define MACH_MSP7120_FPGA 5 /* PMC-Sierra MSP7120 Emulation */ 94#define MACH_MSP7120_FPGA 5 /* PMC-Sierra MSP7120 Emulation */
191#define MACH_MSP_OTHER 255 /* PMC-Sierra unknown board type */ 95#define MACH_MSP_OTHER 255 /* PMC-Sierra unknown board type */
192 96
193#define MACH_WRPPMC 1
194
195/*
196 * Valid machtype for group Broadcom
197 */
198#define MACH_GROUP_BRCM 23 /* Broadcom */
199#define MACH_BCM47XX 1 /* Broadcom BCM47XX */
200
201#define CL_SIZE COMMAND_LINE_SIZE 97#define CL_SIZE COMMAND_LINE_SIZE
202 98
99extern char *system_type;
203const char *get_system_type(void); 100const char *get_system_type(void);
204 101
205extern unsigned long mips_machtype; 102extern unsigned long mips_machtype;
diff --git a/include/asm-mips/bugs.h b/include/asm-mips/bugs.h
index 0d7f9c1f5546..9dc10df32078 100644
--- a/include/asm-mips/bugs.h
+++ b/include/asm-mips/bugs.h
@@ -1,19 +1,34 @@
1/* 1/*
2 * This is included by init/main.c to check for architecture-dependent bugs. 2 * This is included by init/main.c to check for architecture-dependent bugs.
3 * 3 *
4 * Copyright (C) 2007 Maciej W. Rozycki
5 *
4 * Needs: 6 * Needs:
5 * void check_bugs(void); 7 * void check_bugs(void);
6 */ 8 */
7#ifndef _ASM_BUGS_H 9#ifndef _ASM_BUGS_H
8#define _ASM_BUGS_H 10#define _ASM_BUGS_H
9 11
12#include <linux/bug.h>
10#include <linux/delay.h> 13#include <linux/delay.h>
14
11#include <asm/cpu.h> 15#include <asm/cpu.h>
12#include <asm/cpu-info.h> 16#include <asm/cpu-info.h>
13 17
18extern int daddiu_bug;
19
20extern void check_bugs64_early(void);
21
14extern void check_bugs32(void); 22extern void check_bugs32(void);
15extern void check_bugs64(void); 23extern void check_bugs64(void);
16 24
25static inline void check_bugs_early(void)
26{
27#ifdef CONFIG_64BIT
28 check_bugs64_early();
29#endif
30}
31
17static inline void check_bugs(void) 32static inline void check_bugs(void)
18{ 33{
19 unsigned int cpu = smp_processor_id(); 34 unsigned int cpu = smp_processor_id();
@@ -25,4 +40,14 @@ static inline void check_bugs(void)
25#endif 40#endif
26} 41}
27 42
43static inline int r4k_daddiu_bug(void)
44{
45#ifdef CONFIG_64BIT
46 WARN_ON(daddiu_bug < 0);
47 return daddiu_bug != 0;
48#else
49 return 0;
50#endif
51}
52
28#endif /* _ASM_BUGS_H */ 53#endif /* _ASM_BUGS_H */
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index ed5c02c6afbb..0c5a358863f3 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -55,6 +55,7 @@ struct cpuinfo_mips {
55 struct cache_desc scache; /* Secondary cache */ 55 struct cache_desc scache; /* Secondary cache */
56 struct cache_desc tcache; /* Tertiary/split secondary cache */ 56 struct cache_desc tcache; /* Tertiary/split secondary cache */
57 int srsets; /* Shadow register sets */ 57 int srsets; /* Shadow register sets */
58 int core; /* physical core number */
58#if defined(CONFIG_MIPS_MT_SMTC) 59#if defined(CONFIG_MIPS_MT_SMTC)
59 /* 60 /*
60 * In the MIPS MT "SMTC" model, each TC is considered 61 * In the MIPS MT "SMTC" model, each TC is considered
@@ -63,8 +64,10 @@ struct cpuinfo_mips {
63 * to all TCs within the same VPE. 64 * to all TCs within the same VPE.
64 */ 65 */
65 int vpe_id; /* Virtual Processor number */ 66 int vpe_id; /* Virtual Processor number */
66 int tc_id; /* Thread Context number */
67#endif /* CONFIG_MIPS_MT */ 67#endif /* CONFIG_MIPS_MT */
68#ifdef CONFIG_MIPS_MT_SMTC
69 int tc_id; /* Thread Context number */
70#endif
68 void *data; /* Additional data */ 71 void *data; /* Additional data */
69} __attribute__((aligned(SMP_CACHE_BYTES))); 72} __attribute__((aligned(SMP_CACHE_BYTES)));
70 73
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
index 54fc18a4e5a8..bf5bbc78a9f7 100644
--- a/include/asm-mips/cpu.h
+++ b/include/asm-mips/cpu.h
@@ -195,8 +195,8 @@ enum cpu_type_enum {
195 * MIPS32 class processors 195 * MIPS32 class processors
196 */ 196 */
197 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_74K, CPU_AU1000, 197 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_74K, CPU_AU1000,
198 CPU_AU1100, CPU_AU1200, CPU_AU1500, CPU_AU1550, CPU_PR4450, 198 CPU_AU1100, CPU_AU1200, CPU_AU1210, CPU_AU1250, CPU_AU1500, CPU_AU1550,
199 CPU_BCM3302, CPU_BCM4710, 199 CPU_PR4450, CPU_BCM3302, CPU_BCM4710,
200 200
201 /* 201 /*
202 * MIPS64 class processors 202 * MIPS64 class processors
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index fab32131e9b4..b0bccd2c4ed5 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -6,13 +6,16 @@
6 * Copyright (C) 1994 by Waldorf Electronics 6 * Copyright (C) 1994 by Waldorf Electronics
7 * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle 7 * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2007 Maciej W. Rozycki
9 */ 10 */
10#ifndef _ASM_DELAY_H 11#ifndef _ASM_DELAY_H
11#define _ASM_DELAY_H 12#define _ASM_DELAY_H
12 13
13#include <linux/param.h> 14#include <linux/param.h>
14#include <linux/smp.h> 15#include <linux/smp.h>
16
15#include <asm/compiler.h> 17#include <asm/compiler.h>
18#include <asm/war.h>
16 19
17static inline void __delay(unsigned long loops) 20static inline void __delay(unsigned long loops)
18{ 21{
@@ -25,7 +28,7 @@ static inline void __delay(unsigned long loops)
25 " .set reorder \n" 28 " .set reorder \n"
26 : "=r" (loops) 29 : "=r" (loops)
27 : "0" (loops)); 30 : "0" (loops));
28 else if (sizeof(long) == 8) 31 else if (sizeof(long) == 8 && !DADDI_WAR)
29 __asm__ __volatile__ ( 32 __asm__ __volatile__ (
30 " .set noreorder \n" 33 " .set noreorder \n"
31 " .align 3 \n" 34 " .align 3 \n"
@@ -34,6 +37,15 @@ static inline void __delay(unsigned long loops)
34 " .set reorder \n" 37 " .set reorder \n"
35 : "=r" (loops) 38 : "=r" (loops)
36 : "0" (loops)); 39 : "0" (loops));
40 else if (sizeof(long) == 8 && DADDI_WAR)
41 __asm__ __volatile__ (
42 " .set noreorder \n"
43 " .align 3 \n"
44 "1: bnez %0, 1b \n"
45 " dsubu %0, %2 \n"
46 " .set reorder \n"
47 : "=r" (loops)
48 : "0" (loops), "r" (1));
37} 49}
38 50
39 51
@@ -50,7 +62,7 @@ static inline void __delay(unsigned long loops)
50 62
51static inline void __udelay(unsigned long usecs, unsigned long lpj) 63static inline void __udelay(unsigned long usecs, unsigned long lpj)
52{ 64{
53 unsigned long lo; 65 unsigned long hi, lo;
54 66
55 /* 67 /*
56 * The rates of 128 is rounded wrongly by the catchall case 68 * The rates of 128 is rounded wrongly by the catchall case
@@ -70,11 +82,16 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
70 : "=h" (usecs), "=l" (lo) 82 : "=h" (usecs), "=l" (lo)
71 : "r" (usecs), "r" (lpj) 83 : "r" (usecs), "r" (lpj)
72 : GCC_REG_ACCUM); 84 : GCC_REG_ACCUM);
73 else if (sizeof(long) == 8) 85 else if (sizeof(long) == 8 && !R4000_WAR)
74 __asm__("dmultu\t%2, %3" 86 __asm__("dmultu\t%2, %3"
75 : "=h" (usecs), "=l" (lo) 87 : "=h" (usecs), "=l" (lo)
76 : "r" (usecs), "r" (lpj) 88 : "r" (usecs), "r" (lpj)
77 : GCC_REG_ACCUM); 89 : GCC_REG_ACCUM);
90 else if (sizeof(long) == 8 && R4000_WAR)
91 __asm__("dmultu\t%3, %4\n\tmfhi\t%0"
92 : "=r" (usecs), "=h" (hi), "=l" (lo)
93 : "r" (usecs), "r" (lpj)
94 : GCC_REG_ACCUM);
78 95
79 __delay(usecs); 96 __delay(usecs);
80} 97}
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index d6a6c21f16db..1353c81065d1 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -84,10 +84,9 @@
84 * Deskstations or Acer PICA but not the much more versatile DMA logic used 84 * Deskstations or Acer PICA but not the much more versatile DMA logic used
85 * for the local devices on Acer PICA or Magnums. 85 * for the local devices on Acer PICA or Magnums.
86 */ 86 */
87#ifdef CONFIG_SGI_IP22 87#if defined(CONFIG_SGI_IP22) || defined(CONFIG_SGI_IP28)
88/* Horrible hack to have a correct DMA window on IP22 */ 88/* don't care; ISA bus master won't work, ISA slave DMA supports 32bit addr */
89#include <asm/sgi/mc.h> 89#define MAX_DMA_ADDRESS PAGE_OFFSET
90#define MAX_DMA_ADDRESS (PAGE_OFFSET + SGIMC_SEG0_BADDR + 0x01000000)
91#else 90#else
92#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000) 91#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
93#endif 92#endif
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
index f27b96cfac2e..9cc8522a394f 100644
--- a/include/asm-mips/fixmap.h
+++ b/include/asm-mips/fixmap.h
@@ -60,16 +60,6 @@ enum fixed_addresses {
60 __end_of_fixed_addresses 60 __end_of_fixed_addresses
61}; 61};
62 62
63extern void __set_fixmap(enum fixed_addresses idx,
64 unsigned long phys, pgprot_t flags);
65
66#define set_fixmap(idx, phys) \
67 __set_fixmap(idx, phys, PAGE_KERNEL)
68/*
69 * Some hardware wants to get fixmapped without caching.
70 */
71#define set_fixmap_nocache(idx, phys) \
72 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
73/* 63/*
74 * used by vmalloc.c. 64 * used by vmalloc.c.
75 * 65 *
diff --git a/include/asm-mips/fw/cfe/cfe_api.h b/include/asm-mips/fw/cfe/cfe_api.h
index 1003e7156bfc..0995575db320 100644
--- a/include/asm-mips/fw/cfe/cfe_api.h
+++ b/include/asm-mips/fw/cfe/cfe_api.h
@@ -15,49 +15,27 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18 18/*
19/* ********************************************************************* 19 * Broadcom Common Firmware Environment (CFE)
20 * 20 *
21 * Broadcom Common Firmware Environment (CFE) 21 * This file contains declarations for doing callbacks to
22 * 22 * cfe from an application. It should be the only header
23 * Device function prototypes File: cfe_api.h 23 * needed by the application to use this library
24 * 24 *
25 * This file contains declarations for doing callbacks to 25 * Authors: Mitch Lichtenberg, Chris Demetriou
26 * cfe from an application. It should be the only header 26 */
27 * needed by the application to use this library
28 *
29 * Authors: Mitch Lichtenberg, Chris Demetriou
30 *
31 ********************************************************************* */
32
33#ifndef CFE_API_H 27#ifndef CFE_API_H
34#define CFE_API_H 28#define CFE_API_H
35 29
36/*
37 * Apply customizations here for different OSes. These need to:
38 * * typedef uint64_t, int64_t, intptr_t, uintptr_t.
39 * * define cfe_strlen() if use of an existing function is desired.
40 * * define CFE_API_IMPL_NAMESPACE if API functions are to use
41 * names in the implementation namespace.
42 * Also, optionally, if the build environment does not do so automatically,
43 * CFE_API_* can be defined here as desired.
44 */
45/* Begin customization. */
46#include <linux/types.h> 30#include <linux/types.h>
47#include <linux/string.h> 31#include <linux/string.h>
48 32
49typedef long intptr_t; 33typedef long intptr_t;
50 34
51#define cfe_strlen strlen
52 35
53#define CFE_API_ALL 36/*
54#define CFE_API_STRLEN_CUSTOM 37 * Constants
55/* End customization. */ 38 */
56
57
58/* *********************************************************************
59 * Constants
60 ********************************************************************* */
61 39
62/* Seal indicating CFE's presence, passed to user program. */ 40/* Seal indicating CFE's presence, passed to user program. */
63#define CFE_EPTSEAL 0x43464531 41#define CFE_EPTSEAL 0x43464531
@@ -109,54 +87,13 @@ typedef struct {
109 87
110 88
111/* 89/*
112 * cfe_strlen is handled specially: If already defined, it has been
113 * overridden in this environment with a standard strlen-like function.
114 */
115#ifdef cfe_strlen
116# define CFE_API_STRLEN_CUSTOM
117#else
118# ifdef CFE_API_IMPL_NAMESPACE
119# define cfe_strlen(a) __cfe_strlen(a)
120# endif
121int cfe_strlen(char *name);
122#endif
123
124/*
125 * Defines and prototypes for functions which take no arguments. 90 * Defines and prototypes for functions which take no arguments.
126 */ 91 */
127#ifdef CFE_API_IMPL_NAMESPACE
128int64_t __cfe_getticks(void);
129#define cfe_getticks() __cfe_getticks()
130#else
131int64_t cfe_getticks(void); 92int64_t cfe_getticks(void);
132#endif
133 93
134/* 94/*
135 * Defines and prototypes for the rest of the functions. 95 * Defines and prototypes for the rest of the functions.
136 */ 96 */
137#ifdef CFE_API_IMPL_NAMESPACE
138#define cfe_close(a) __cfe_close(a)
139#define cfe_cpu_start(a, b, c, d, e) __cfe_cpu_start(a, b, c, d, e)
140#define cfe_cpu_stop(a) __cfe_cpu_stop(a)
141#define cfe_enumenv(a, b, d, e, f) __cfe_enumenv(a, b, d, e, f)
142#define cfe_enummem(a, b, c, d, e) __cfe_enummem(a, b, c, d, e)
143#define cfe_exit(a, b) __cfe_exit(a, b)
144#define cfe_flushcache(a) __cfe_cacheflush(a)
145#define cfe_getdevinfo(a) __cfe_getdevinfo(a)
146#define cfe_getenv(a, b, c) __cfe_getenv(a, b, c)
147#define cfe_getfwinfo(a) __cfe_getfwinfo(a)
148#define cfe_getstdhandle(a) __cfe_getstdhandle(a)
149#define cfe_init(a, b) __cfe_init(a, b)
150#define cfe_inpstat(a) __cfe_inpstat(a)
151#define cfe_ioctl(a, b, c, d, e, f) __cfe_ioctl(a, b, c, d, e, f)
152#define cfe_open(a) __cfe_open(a)
153#define cfe_read(a, b, c) __cfe_read(a, b, c)
154#define cfe_readblk(a, b, c, d) __cfe_readblk(a, b, c, d)
155#define cfe_setenv(a, b) __cfe_setenv(a, b)
156#define cfe_write(a, b, c) __cfe_write(a, b, c)
157#define cfe_writeblk(a, b, c, d) __cfe_writeblk(a, b, c, d)
158#endif /* CFE_API_IMPL_NAMESPACE */
159
160int cfe_close(int handle); 97int cfe_close(int handle);
161int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1); 98int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1);
162int cfe_cpu_stop(int cpu); 99int cfe_cpu_stop(int cpu);
diff --git a/include/asm-mips/fw/cfe/cfe_error.h b/include/asm-mips/fw/cfe/cfe_error.h
index 975f00002cbe..b80374636279 100644
--- a/include/asm-mips/fw/cfe/cfe_error.h
+++ b/include/asm-mips/fw/cfe/cfe_error.h
@@ -16,18 +16,13 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18 18
19/* ********************************************************************* 19/*
20 * 20 * Broadcom Common Firmware Environment (CFE)
21 * Broadcom Common Firmware Environment (CFE) 21 *
22 * 22 * CFE's global error code list is here.
23 * Error codes File: cfe_error.h 23 *
24 * 24 * Author: Mitch Lichtenberg
25 * CFE's global error code list is here. 25 */
26 *
27 * Author: Mitch Lichtenberg
28 *
29 ********************************************************************* */
30
31 26
32#define CFE_OK 0 27#define CFE_OK 0
33#define CFE_ERR -1 /* generic error */ 28#define CFE_ERR -1 /* generic error */
diff --git a/include/asm-mips/mach-cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h
index a79e7caf3a86..5b9fce73f11d 100644
--- a/include/asm-mips/mach-cobalt/cobalt.h
+++ b/include/asm-mips/mach-cobalt/cobalt.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Lowlevel hardware stuff for the MIPS based Cobalt microservers. 2 * The Cobalt board ID information.
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 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 5 * License. See the file "COPYING" in the main directory of this archive
@@ -12,9 +12,6 @@
12#ifndef __ASM_COBALT_H 12#ifndef __ASM_COBALT_H
13#define __ASM_COBALT_H 13#define __ASM_COBALT_H
14 14
15/*
16 * The Cobalt board ID information.
17 */
18extern int cobalt_board_id; 15extern int cobalt_board_id;
19 16
20#define COBALT_BRD_ID_QUBE1 0x3 17#define COBALT_BRD_ID_QUBE1 0x3
@@ -22,14 +19,4 @@ extern int cobalt_board_id;
22#define COBALT_BRD_ID_QUBE2 0x5 19#define COBALT_BRD_ID_QUBE2 0x5
23#define COBALT_BRD_ID_RAQ2 0x6 20#define COBALT_BRD_ID_RAQ2 0x6
24 21
25#define COBALT_KEY_PORT ((~*(volatile unsigned int *) CKSEG1ADDR(0x1d000000) >> 24) & COBALT_KEY_MASK)
26# define COBALT_KEY_CLEAR (1 << 1)
27# define COBALT_KEY_LEFT (1 << 2)
28# define COBALT_KEY_UP (1 << 3)
29# define COBALT_KEY_DOWN (1 << 4)
30# define COBALT_KEY_RIGHT (1 << 5)
31# define COBALT_KEY_ENTER (1 << 6)
32# define COBALT_KEY_SELECT (1 << 7)
33# define COBALT_KEY_MASK 0xfe
34
35#endif /* __ASM_COBALT_H */ 22#endif /* __ASM_COBALT_H */
diff --git a/include/asm-mips/mach-ip28/cpu-feature-overrides.h b/include/asm-mips/mach-ip28/cpu-feature-overrides.h
new file mode 100644
index 000000000000..9a53b326f848
--- /dev/null
+++ b/include/asm-mips/mach-ip28/cpu-feature-overrides.h
@@ -0,0 +1,50 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ralf Baechle
7 * 6/2004 pf
8 */
9#ifndef __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
11
12/*
13 * IP28 only comes with R10000 family processors all using the same config
14 */
15#define cpu_has_watch 1
16#define cpu_has_mips16 0
17#define cpu_has_divec 0
18#define cpu_has_vce 0
19#define cpu_has_cache_cdex_p 0
20#define cpu_has_cache_cdex_s 0
21#define cpu_has_prefetch 1
22#define cpu_has_mcheck 0
23#define cpu_has_ejtag 0
24
25#define cpu_has_llsc 1
26#define cpu_has_vtag_icache 0
27#define cpu_has_dc_aliases 0 /* see probe_pcache() */
28#define cpu_has_ic_fills_f_dc 0
29#define cpu_has_dsp 0
30#define cpu_icache_snoops_remote_store 1
31#define cpu_has_mipsmt 0
32#define cpu_has_userlocal 0
33
34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1
36
37#define cpu_has_4kex 1
38#define cpu_has_4k_cache 1
39
40#define cpu_has_inclusive_pcaches 1
41
42#define cpu_dcache_line_size() 32
43#define cpu_icache_line_size() 64
44
45#define cpu_has_mips32r1 0
46#define cpu_has_mips32r2 0
47#define cpu_has_mips64r1 0
48#define cpu_has_mips64r2 0
49
50#endif /* __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip28/ds1286.h b/include/asm-mips/mach-ip28/ds1286.h
new file mode 100644
index 000000000000..471bb9a33e0f
--- /dev/null
+++ b/include/asm-mips/mach-ip28/ds1286.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_MACH_IP28_DS1286_H
2#define __ASM_MACH_IP28_DS1286_H
3#include <asm/mach-ip22/ds1286.h>
4#endif /* __ASM_MACH_IP28_DS1286_H */
diff --git a/include/asm-mips/mach-ip28/spaces.h b/include/asm-mips/mach-ip28/spaces.h
new file mode 100644
index 000000000000..05aabb27e5e7
--- /dev/null
+++ b/include/asm-mips/mach-ip28/spaces.h
@@ -0,0 +1,22 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 * 2004 pf
10 */
11#ifndef _ASM_MACH_IP28_SPACES_H
12#define _ASM_MACH_IP28_SPACES_H
13
14#define CAC_BASE 0xa800000000000000
15
16#define HIGHMEM_START (~0UL)
17
18#define PHYS_OFFSET _AC(0x20000000, UL)
19
20#include <asm/mach-generic/spaces.h>
21
22#endif /* _ASM_MACH_IP28_SPACES_H */
diff --git a/include/asm-mips/mach-qemu/war.h b/include/asm-mips/mach-ip28/war.h
index 0eaf0c548a47..a1baafab486a 100644
--- a/include/asm-mips/mach-qemu/war.h
+++ b/include/asm-mips/mach-ip28/war.h
@@ -5,8 +5,8 @@
5 * 5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org> 6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */ 7 */
8#ifndef __ASM_MIPS_MACH_QEMU_WAR_H 8#ifndef __ASM_MIPS_MACH_IP28_WAR_H
9#define __ASM_MIPS_MACH_QEMU_WAR_H 9#define __ASM_MIPS_MACH_IP28_WAR_H
10 10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0 11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0 12#define R4600_V1_HIT_CACHEOP_WAR 0
@@ -19,7 +19,7 @@
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0 20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0 21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0 22#define R10000_LLSC_WAR 1
23#define MIPS34K_MISSED_ITLB_WAR 0 23#define MIPS34K_MISSED_ITLB_WAR 0
24 24
25#endif /* __ASM_MIPS_MACH_QEMU_WAR_H */ 25#endif /* __ASM_MIPS_MACH_IP28_WAR_H */
diff --git a/include/asm-mips/mach-qemu/cpu-feature-overrides.h b/include/asm-mips/mach-qemu/cpu-feature-overrides.h
deleted file mode 100644
index d2daaed235d5..000000000000
--- a/include/asm-mips/mach-qemu/cpu-feature-overrides.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 07 Ralf Baechle
7 */
8#ifndef __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * QEMU only comes with a hazard-free MIPS32 processor, so things are easy.
13 */
14#define cpu_has_mips16 0
15#define cpu_has_divec 0
16#define cpu_has_cache_cdex_p 0
17#define cpu_has_prefetch 0
18#define cpu_has_mcheck 0
19#define cpu_has_ejtag 0
20
21#define cpu_has_llsc 1
22#define cpu_has_vtag_icache 0
23#define cpu_has_dc_aliases 0
24#define cpu_has_ic_fills_f_dc 0
25
26#define cpu_has_dsp 0
27#define cpu_has_mipsmt 0
28
29#define cpu_has_nofpuex 0
30#define cpu_has_64bits 0
31
32#endif /* __ASM_MACH_QEMU_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mips-boards/generic.h b/include/asm-mips/mips-boards/generic.h
index d58977483534..1c39d339521e 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -97,10 +97,16 @@ extern int mips_revision_corid;
97 97
98extern int mips_revision_sconid; 98extern int mips_revision_sconid;
99 99
100extern void mips_reboot_setup(void);
101
100#ifdef CONFIG_PCI 102#ifdef CONFIG_PCI
101extern void mips_pcibios_init(void); 103extern void mips_pcibios_init(void);
102#else 104#else
103#define mips_pcibios_init() do { } while (0) 105#define mips_pcibios_init() do { } while (0)
104#endif 106#endif
105 107
108#ifdef CONFIG_KGDB
109extern void kgdb_config(void);
110#endif
111
106#endif /* __ASM_MIPS_BOARDS_GENERIC_H */ 112#endif /* __ASM_MIPS_BOARDS_GENERIC_H */
diff --git a/include/asm-mips/mipsprom.h b/include/asm-mips/mipsprom.h
index ce7cff7f1e8e..146d41b67adc 100644
--- a/include/asm-mips/mipsprom.h
+++ b/include/asm-mips/mipsprom.h
@@ -71,4 +71,6 @@
71#define PROM_NV_GET 53 /* XXX */ 71#define PROM_NV_GET 53 /* XXX */
72#define PROM_NV_SET 54 /* XXX */ 72#define PROM_NV_SET 54 /* XXX */
73 73
74extern char *prom_getenv(char *);
75
74#endif /* __ASM_MIPS_PROM_H */ 76#endif /* __ASM_MIPS_PROM_H */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_regs.h b/include/asm-mips/pmc-sierra/msp71xx/msp_regs.h
index 0b56f55206c6..603eb737b4a8 100644
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_regs.h
+++ b/include/asm-mips/pmc-sierra/msp71xx/msp_regs.h
@@ -585,11 +585,7 @@
585 * UART defines * 585 * UART defines *
586 *************************************************************************** 586 ***************************************************************************
587 */ 587 */
588#ifndef CONFIG_MSP_FPGA
589#define MSP_BASE_BAUD 25000000 588#define MSP_BASE_BAUD 25000000
590#else
591#define MSP_BASE_BAUD 6000000
592#endif
593#define MSP_UART_REG_LEN 0x20 589#define MSP_UART_REG_LEN 0x20
594 590
595/* 591/*
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index 2b8466ffd3ca..4c140db36786 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -403,6 +403,13 @@ __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
403__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64) 403__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
404__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128) 404__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
405 405
406__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16)
407__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32)
408__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16)
409__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32)
410__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64)
411__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128)
412
406/* build blast_xxx_range, protected_blast_xxx_range */ 413/* build blast_xxx_range, protected_blast_xxx_range */
407#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot) \ 414#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot) \
408static inline void prot##blast_##pfx##cache##_range(unsigned long start, \ 415static inline void prot##blast_##pfx##cache##_range(unsigned long start, \
diff --git a/include/asm-mips/sgi/ioc.h b/include/asm-mips/sgi/ioc.h
index f3e3dc9bb732..343ed15f8dc4 100644
--- a/include/asm-mips/sgi/ioc.h
+++ b/include/asm-mips/sgi/ioc.h
@@ -138,8 +138,8 @@ struct sgioc_regs {
138 u8 _sysid[3]; 138 u8 _sysid[3];
139 volatile u8 sysid; 139 volatile u8 sysid;
140#define SGIOC_SYSID_FULLHOUSE 0x01 140#define SGIOC_SYSID_FULLHOUSE 0x01
141#define SGIOC_SYSID_BOARDREV(x) ((x & 0xe0) > 5) 141#define SGIOC_SYSID_BOARDREV(x) (((x) & 0x1e) >> 1)
142#define SGIOC_SYSID_CHIPREV(x) ((x & 0x1e) > 1) 142#define SGIOC_SYSID_CHIPREV(x) (((x) & 0xe0) >> 5)
143 u32 _unused2; 143 u32 _unused2;
144 u8 _read[3]; 144 u8 _read[3];
145 volatile u8 read; 145 volatile u8 read;
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h
index da198a1c8c81..25372ae0e814 100644
--- a/include/asm-mips/sibyte/board.h
+++ b/include/asm-mips/sibyte/board.h
@@ -19,10 +19,8 @@
19#ifndef _SIBYTE_BOARD_H 19#ifndef _SIBYTE_BOARD_H
20#define _SIBYTE_BOARD_H 20#define _SIBYTE_BOARD_H
21 21
22#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \ 22#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_CRHONE) || \
23 defined(CONFIG_SIBYTE_PT1120) || defined(CONFIG_SIBYTE_PT1125) || \ 23 defined(CONFIG_SIBYTE_CRHINE) || defined(CONFIG_SIBYTE_LITTLESUR)
24 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \
25 defined(CONFIG_SIBYTE_LITTLESUR)
26#include <asm/sibyte/swarm.h> 24#include <asm/sibyte/swarm.h>
27#endif 25#endif
28 26
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
index 0dad844a3b5b..80c1a052662a 100644
--- a/include/asm-mips/sibyte/sb1250.h
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -48,12 +48,10 @@ extern unsigned int zbbus_mhz;
48extern void sb1250_time_init(void); 48extern void sb1250_time_init(void);
49extern void sb1250_mask_irq(int cpu, int irq); 49extern void sb1250_mask_irq(int cpu, int irq);
50extern void sb1250_unmask_irq(int cpu, int irq); 50extern void sb1250_unmask_irq(int cpu, int irq);
51extern void sb1250_smp_finish(void);
52 51
53extern void bcm1480_time_init(void); 52extern void bcm1480_time_init(void);
54extern void bcm1480_mask_irq(int cpu, int irq); 53extern void bcm1480_mask_irq(int cpu, int irq);
55extern void bcm1480_unmask_irq(int cpu, int irq); 54extern void bcm1480_unmask_irq(int cpu, int irq);
56extern void bcm1480_smp_finish(void);
57 55
58#define AT_spin \ 56#define AT_spin \
59 __asm__ __volatile__ ( \ 57 __asm__ __volatile__ ( \
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h
index 540865fa7ec3..114d9d29ca9d 100644
--- a/include/asm-mips/sibyte/swarm.h
+++ b/include/asm-mips/sibyte/swarm.h
@@ -26,24 +26,6 @@
26#define SIBYTE_HAVE_PCMCIA 1 26#define SIBYTE_HAVE_PCMCIA 1
27#define SIBYTE_HAVE_IDE 1 27#define SIBYTE_HAVE_IDE 1
28#endif 28#endif
29#ifdef CONFIG_SIBYTE_PTSWARM
30#define SIBYTE_BOARD_NAME "PTSWARM"
31#define SIBYTE_HAVE_PCMCIA 1
32#define SIBYTE_HAVE_IDE 1
33#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
34#endif
35#ifdef CONFIG_SIBYTE_PT1120
36#define SIBYTE_BOARD_NAME "PT1120"
37#define SIBYTE_HAVE_PCMCIA 1
38#define SIBYTE_HAVE_IDE 1
39#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
40#endif
41#ifdef CONFIG_SIBYTE_PT1125
42#define SIBYTE_BOARD_NAME "PT1125"
43#define SIBYTE_HAVE_PCMCIA 1
44#define SIBYTE_HAVE_IDE 1
45#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
46#endif
47#ifdef CONFIG_SIBYTE_LITTLESUR 29#ifdef CONFIG_SIBYTE_LITTLESUR
48#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)" 30#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)"
49#define SIBYTE_HAVE_PCMCIA 0 31#define SIBYTE_HAVE_PCMCIA 0
diff --git a/include/asm-mips/smp-ops.h b/include/asm-mips/smp-ops.h
new file mode 100644
index 000000000000..b17fdfb5d818
--- /dev/null
+++ b/include/asm-mips/smp-ops.h
@@ -0,0 +1,56 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
5 *
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 * Copyright (C) 2000, 2001, 2002 Ralf Baechle
9 * Copyright (C) 2000, 2001 Broadcom Corporation
10 */
11#ifndef __ASM_SMP_OPS_H
12#define __ASM_SMP_OPS_H
13
14#ifdef CONFIG_SMP
15
16#include <linux/cpumask.h>
17
18struct plat_smp_ops {
19 void (*send_ipi_single)(int cpu, unsigned int action);
20 void (*send_ipi_mask)(cpumask_t mask, unsigned int action);
21 void (*init_secondary)(void);
22 void (*smp_finish)(void);
23 void (*cpus_done)(void);
24 void (*boot_secondary)(int cpu, struct task_struct *idle);
25 void (*smp_setup)(void);
26 void (*prepare_cpus)(unsigned int max_cpus);
27};
28
29extern void register_smp_ops(struct plat_smp_ops *ops);
30
31static inline void plat_smp_setup(void)
32{
33 extern struct plat_smp_ops *mp_ops; /* private */
34
35 mp_ops->smp_setup();
36}
37
38#else /* !CONFIG_SMP */
39
40struct plat_smp_ops;
41
42static inline void plat_smp_setup(void)
43{
44 /* UP, nothing to do ... */
45}
46
47static inline void register_smp_ops(struct plat_smp_ops *ops)
48{
49}
50
51#endif /* !CONFIG_SMP */
52
53extern struct plat_smp_ops up_smp_ops;
54extern struct plat_smp_ops vsmp_smp_ops;
55
56#endif /* __ASM_SMP_OPS_H */
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
index dc770025a9b0..84fef1aeec0c 100644
--- a/include/asm-mips/smp.h
+++ b/include/asm-mips/smp.h
@@ -11,14 +11,16 @@
11#ifndef __ASM_SMP_H 11#ifndef __ASM_SMP_H
12#define __ASM_SMP_H 12#define __ASM_SMP_H
13 13
14
15#ifdef CONFIG_SMP
16
17#include <linux/bitops.h> 14#include <linux/bitops.h>
18#include <linux/linkage.h> 15#include <linux/linkage.h>
19#include <linux/threads.h> 16#include <linux/threads.h>
20#include <linux/cpumask.h> 17#include <linux/cpumask.h>
18
21#include <asm/atomic.h> 19#include <asm/atomic.h>
20#include <asm/smp-ops.h>
21
22extern int smp_num_siblings;
23extern cpumask_t cpu_sibling_map[];
22 24
23#define raw_smp_processor_id() (current_thread_info()->cpu) 25#define raw_smp_processor_id() (current_thread_info()->cpu)
24 26
@@ -49,56 +51,6 @@ extern struct call_data_struct *call_data;
49extern cpumask_t phys_cpu_present_map; 51extern cpumask_t phys_cpu_present_map;
50#define cpu_possible_map phys_cpu_present_map 52#define cpu_possible_map phys_cpu_present_map
51 53
52/*
53 * These are defined by the board-specific code.
54 */
55
56/*
57 * Cause the function described by call_data to be executed on the passed
58 * cpu. When the function has finished, increment the finished field of
59 * call_data.
60 */
61extern void core_send_ipi(int cpu, unsigned int action);
62
63static inline void core_send_ipi_mask(cpumask_t mask, unsigned int action)
64{
65 unsigned int i;
66
67 for_each_cpu_mask(i, mask)
68 core_send_ipi(i, action);
69}
70
71
72/*
73 * Firmware CPU startup hook
74 */
75extern void prom_boot_secondary(int cpu, struct task_struct *idle);
76
77/*
78 * After we've done initial boot, this function is called to allow the
79 * board code to clean up state, if needed
80 */
81extern void prom_init_secondary(void);
82
83/*
84 * Populate cpu_possible_map before smp_init, called from setup_arch.
85 */
86extern void plat_smp_setup(void);
87
88/*
89 * Called in smp_prepare_cpus.
90 */
91extern void plat_prepare_cpus(unsigned int max_cpus);
92
93/*
94 * Last chance for the board code to finish SMP initialization before
95 * the CPU is "online".
96 */
97extern void prom_smp_finish(void);
98
99/* Hook for after all CPUs are online */
100extern void prom_cpus_done(void);
101
102extern void asmlinkage smp_bootstrap(void); 54extern void asmlinkage smp_bootstrap(void);
103 55
104/* 56/*
@@ -108,11 +60,11 @@ extern void asmlinkage smp_bootstrap(void);
108 */ 60 */
109static inline void smp_send_reschedule(int cpu) 61static inline void smp_send_reschedule(int cpu)
110{ 62{
111 core_send_ipi(cpu, SMP_RESCHEDULE_YOURSELF); 63 extern struct plat_smp_ops *mp_ops; /* private */
64
65 mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
112} 66}
113 67
114extern asmlinkage void smp_call_function_interrupt(void); 68extern asmlinkage void smp_call_function_interrupt(void);
115 69
116#endif /* CONFIG_SMP */
117
118#endif /* __ASM_SMP_H */ 70#endif /* __ASM_SMP_H */
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index af081457f847..e716447e5e03 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -35,23 +35,23 @@ extern unsigned int sni_brd_type;
35#define SNI_CPU_M8050 0x0b 35#define SNI_CPU_M8050 0x0b
36#define SNI_CPU_M8053 0x0d 36#define SNI_CPU_M8053 0x0d
37 37
38#define SNI_PORT_BASE 0xb4000000 38#define SNI_PORT_BASE CKSEG1ADDR(0xb4000000)
39 39
40#ifndef __MIPSEL__ 40#ifndef __MIPSEL__
41/* 41/*
42 * ASIC PCI registers for big endian configuration. 42 * ASIC PCI registers for big endian configuration.
43 */ 43 */
44#define PCIMT_UCONF 0xbfff0004 44#define PCIMT_UCONF CKSEG1ADDR(0xbfff0004)
45#define PCIMT_IOADTIMEOUT2 0xbfff000c 45#define PCIMT_IOADTIMEOUT2 CKSEG1ADDR(0xbfff000c)
46#define PCIMT_IOMEMCONF 0xbfff0014 46#define PCIMT_IOMEMCONF CKSEG1ADDR(0xbfff0014)
47#define PCIMT_IOMMU 0xbfff001c 47#define PCIMT_IOMMU CKSEG1ADDR(0xbfff001c)
48#define PCIMT_IOADTIMEOUT1 0xbfff0024 48#define PCIMT_IOADTIMEOUT1 CKSEG1ADDR(0xbfff0024)
49#define PCIMT_DMAACCESS 0xbfff002c 49#define PCIMT_DMAACCESS CKSEG1ADDR(0xbfff002c)
50#define PCIMT_DMAHIT 0xbfff0034 50#define PCIMT_DMAHIT CKSEG1ADDR(0xbfff0034)
51#define PCIMT_ERRSTATUS 0xbfff003c 51#define PCIMT_ERRSTATUS CKSEG1ADDR(0xbfff003c)
52#define PCIMT_ERRADDR 0xbfff0044 52#define PCIMT_ERRADDR CKSEG1ADDR(0xbfff0044)
53#define PCIMT_SYNDROME 0xbfff004c 53#define PCIMT_SYNDROME CKSEG1ADDR(0xbfff004c)
54#define PCIMT_ITPEND 0xbfff0054 54#define PCIMT_ITPEND CKSEG1ADDR(0xbfff0054)
55#define IT_INT2 0x01 55#define IT_INT2 0x01
56#define IT_INTD 0x02 56#define IT_INTD 0x02
57#define IT_INTC 0x04 57#define IT_INTC 0x04
@@ -60,32 +60,32 @@ extern unsigned int sni_brd_type;
60#define IT_EISA 0x20 60#define IT_EISA 0x20
61#define IT_SCSI 0x40 61#define IT_SCSI 0x40
62#define IT_ETH 0x80 62#define IT_ETH 0x80
63#define PCIMT_IRQSEL 0xbfff005c 63#define PCIMT_IRQSEL CKSEG1ADDR(0xbfff005c)
64#define PCIMT_TESTMEM 0xbfff0064 64#define PCIMT_TESTMEM CKSEG1ADDR(0xbfff0064)
65#define PCIMT_ECCREG 0xbfff006c 65#define PCIMT_ECCREG CKSEG1ADDR(0xbfff006c)
66#define PCIMT_CONFIG_ADDRESS 0xbfff0074 66#define PCIMT_CONFIG_ADDRESS CKSEG1ADDR(0xbfff0074)
67#define PCIMT_ASIC_ID 0xbfff007c /* read */ 67#define PCIMT_ASIC_ID CKSEG1ADDR(0xbfff007c) /* read */
68#define PCIMT_SOFT_RESET 0xbfff007c /* write */ 68#define PCIMT_SOFT_RESET CKSEG1ADDR(0xbfff007c) /* write */
69#define PCIMT_PIA_OE 0xbfff0084 69#define PCIMT_PIA_OE CKSEG1ADDR(0xbfff0084)
70#define PCIMT_PIA_DATAOUT 0xbfff008c 70#define PCIMT_PIA_DATAOUT CKSEG1ADDR(0xbfff008c)
71#define PCIMT_PIA_DATAIN 0xbfff0094 71#define PCIMT_PIA_DATAIN CKSEG1ADDR(0xbfff0094)
72#define PCIMT_CACHECONF 0xbfff009c 72#define PCIMT_CACHECONF CKSEG1ADDR(0xbfff009c)
73#define PCIMT_INVSPACE 0xbfff00a4 73#define PCIMT_INVSPACE CKSEG1ADDR(0xbfff00a4)
74#else 74#else
75/* 75/*
76 * ASIC PCI registers for little endian configuration. 76 * ASIC PCI registers for little endian configuration.
77 */ 77 */
78#define PCIMT_UCONF 0xbfff0000 78#define PCIMT_UCONF CKSEG1ADDR(0xbfff0000)
79#define PCIMT_IOADTIMEOUT2 0xbfff0008 79#define PCIMT_IOADTIMEOUT2 CKSEG1ADDR(0xbfff0008)
80#define PCIMT_IOMEMCONF 0xbfff0010 80#define PCIMT_IOMEMCONF CKSEG1ADDR(0xbfff0010)
81#define PCIMT_IOMMU 0xbfff0018 81#define PCIMT_IOMMU CKSEG1ADDR(0xbfff0018)
82#define PCIMT_IOADTIMEOUT1 0xbfff0020 82#define PCIMT_IOADTIMEOUT1 CKSEG1ADDR(0xbfff0020)
83#define PCIMT_DMAACCESS 0xbfff0028 83#define PCIMT_DMAACCESS CKSEG1ADDR(0xbfff0028)
84#define PCIMT_DMAHIT 0xbfff0030 84#define PCIMT_DMAHIT CKSEG1ADDR(0xbfff0030)
85#define PCIMT_ERRSTATUS 0xbfff0038 85#define PCIMT_ERRSTATUS CKSEG1ADDR(0xbfff0038)
86#define PCIMT_ERRADDR 0xbfff0040 86#define PCIMT_ERRADDR CKSEG1ADDR(0xbfff0040)
87#define PCIMT_SYNDROME 0xbfff0048 87#define PCIMT_SYNDROME CKSEG1ADDR(0xbfff0048)
88#define PCIMT_ITPEND 0xbfff0050 88#define PCIMT_ITPEND CKSEG1ADDR(0xbfff0050)
89#define IT_INT2 0x01 89#define IT_INT2 0x01
90#define IT_INTD 0x02 90#define IT_INTD 0x02
91#define IT_INTC 0x04 91#define IT_INTC 0x04
@@ -94,20 +94,20 @@ extern unsigned int sni_brd_type;
94#define IT_EISA 0x20 94#define IT_EISA 0x20
95#define IT_SCSI 0x40 95#define IT_SCSI 0x40
96#define IT_ETH 0x80 96#define IT_ETH 0x80
97#define PCIMT_IRQSEL 0xbfff0058 97#define PCIMT_IRQSEL CKSEG1ADDR(0xbfff0058)
98#define PCIMT_TESTMEM 0xbfff0060 98#define PCIMT_TESTMEM CKSEG1ADDR(0xbfff0060)
99#define PCIMT_ECCREG 0xbfff0068 99#define PCIMT_ECCREG CKSEG1ADDR(0xbfff0068)
100#define PCIMT_CONFIG_ADDRESS 0xbfff0070 100#define PCIMT_CONFIG_ADDRESS CKSEG1ADDR(0xbfff0070)
101#define PCIMT_ASIC_ID 0xbfff0078 /* read */ 101#define PCIMT_ASIC_ID CKSEG1ADDR(0xbfff0078) /* read */
102#define PCIMT_SOFT_RESET 0xbfff0078 /* write */ 102#define PCIMT_SOFT_RESET CKSEG1ADDR(0xbfff0078) /* write */
103#define PCIMT_PIA_OE 0xbfff0080 103#define PCIMT_PIA_OE CKSEG1ADDR(0xbfff0080)
104#define PCIMT_PIA_DATAOUT 0xbfff0088 104#define PCIMT_PIA_DATAOUT CKSEG1ADDR(0xbfff0088)
105#define PCIMT_PIA_DATAIN 0xbfff0090 105#define PCIMT_PIA_DATAIN CKSEG1ADDR(0xbfff0090)
106#define PCIMT_CACHECONF 0xbfff0098 106#define PCIMT_CACHECONF CKSEG1ADDR(0xbfff0098)
107#define PCIMT_INVSPACE 0xbfff00a0 107#define PCIMT_INVSPACE CKSEG1ADDR(0xbfff00a0)
108#endif 108#endif
109 109
110#define PCIMT_PCI_CONF 0xbfff0100 110#define PCIMT_PCI_CONF CKSEG1ADDR(0xbfff0100)
111 111
112/* 112/*
113 * Data port for the PCI bus in IO space 113 * Data port for the PCI bus in IO space
@@ -117,34 +117,34 @@ extern unsigned int sni_brd_type;
117/* 117/*
118 * Board specific registers 118 * Board specific registers
119 */ 119 */
120#define PCIMT_CSMSR 0xbfd00000 120#define PCIMT_CSMSR CKSEG1ADDR(0xbfd00000)
121#define PCIMT_CSSWITCH 0xbfd10000 121#define PCIMT_CSSWITCH CKSEG1ADDR(0xbfd10000)
122#define PCIMT_CSITPEND 0xbfd20000 122#define PCIMT_CSITPEND CKSEG1ADDR(0xbfd20000)
123#define PCIMT_AUTO_PO_EN 0xbfd30000 123#define PCIMT_AUTO_PO_EN CKSEG1ADDR(0xbfd30000)
124#define PCIMT_CLR_TEMP 0xbfd40000 124#define PCIMT_CLR_TEMP CKSEG1ADDR(0xbfd40000)
125#define PCIMT_AUTO_PO_DIS 0xbfd50000 125#define PCIMT_AUTO_PO_DIS CKSEG1ADDR(0xbfd50000)
126#define PCIMT_EXMSR 0xbfd60000 126#define PCIMT_EXMSR CKSEG1ADDR(0xbfd60000)
127#define PCIMT_UNUSED1 0xbfd70000 127#define PCIMT_UNUSED1 CKSEG1ADDR(0xbfd70000)
128#define PCIMT_CSWCSM 0xbfd80000 128#define PCIMT_CSWCSM CKSEG1ADDR(0xbfd80000)
129#define PCIMT_UNUSED2 0xbfd90000 129#define PCIMT_UNUSED2 CKSEG1ADDR(0xbfd90000)
130#define PCIMT_CSLED 0xbfda0000 130#define PCIMT_CSLED CKSEG1ADDR(0xbfda0000)
131#define PCIMT_CSMAPISA 0xbfdb0000 131#define PCIMT_CSMAPISA CKSEG1ADDR(0xbfdb0000)
132#define PCIMT_CSRSTBP 0xbfdc0000 132#define PCIMT_CSRSTBP CKSEG1ADDR(0xbfdc0000)
133#define PCIMT_CLRPOFF 0xbfdd0000 133#define PCIMT_CLRPOFF CKSEG1ADDR(0xbfdd0000)
134#define PCIMT_CSTIMER 0xbfde0000 134#define PCIMT_CSTIMER CKSEG1ADDR(0xbfde0000)
135#define PCIMT_PWDN 0xbfdf0000 135#define PCIMT_PWDN CKSEG1ADDR(0xbfdf0000)
136 136
137/* 137/*
138 * A20R based boards 138 * A20R based boards
139 */ 139 */
140#define A20R_PT_CLOCK_BASE 0xbc040000 140#define A20R_PT_CLOCK_BASE CKSEG1ADDR(0xbc040000)
141#define A20R_PT_TIM0_ACK 0xbc050000 141#define A20R_PT_TIM0_ACK CKSEG1ADDR(0xbc050000)
142#define A20R_PT_TIM1_ACK 0xbc060000 142#define A20R_PT_TIM1_ACK CKSEG1ADDR(0xbc060000)
143 143
144#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE 144#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE
145#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5) 145#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5)
146 146
147#define SNI_PCIT_INT_REG 0xbfff000c 147#define SNI_PCIT_INT_REG CKSEG1ADDR(0xbfff000c)
148 148
149#define SNI_PCIT_INT_START 24 149#define SNI_PCIT_INT_START 24
150#define SNI_PCIT_INT_END 30 150#define SNI_PCIT_INT_END 30
@@ -186,10 +186,30 @@ extern unsigned int sni_brd_type;
186/* 186/*
187 * Base address for the mapped 16mb EISA bus segment. 187 * Base address for the mapped 16mb EISA bus segment.
188 */ 188 */
189#define PCIMT_EISA_BASE 0xb0000000 189#define PCIMT_EISA_BASE CKSEG1ADDR(0xb0000000)
190 190
191/* PCI EISA Interrupt acknowledge */ 191/* PCI EISA Interrupt acknowledge */
192#define PCIMT_INT_ACKNOWLEDGE 0xba000000 192#define PCIMT_INT_ACKNOWLEDGE CKSEG1ADDR(0xba000000)
193
194/*
195 * SNI ID PROM
196 *
197 * SNI_IDPROM_MEMSIZE Memsize in 16MB quantities
198 * SNI_IDPROM_BRDTYPE Board Type
199 * SNI_IDPROM_CPUTYPE CPU Type on RM400
200 */
201#ifdef CONFIG_CPU_BIG_ENDIAN
202#define __SNI_END 0
203#endif
204#ifdef CONFIG_CPU_LITTLE_ENDIAN
205#define __SNI_END 3
206#endif
207#define SNI_IDPROM_BASE CKSEG1ADDR(0x1ff00000)
208#define SNI_IDPROM_MEMSIZE (SNI_IDPROM_BASE + (0x28 ^ __SNI_END))
209#define SNI_IDPROM_BRDTYPE (SNI_IDPROM_BASE + (0x29 ^ __SNI_END))
210#define SNI_IDPROM_CPUTYPE (SNI_IDPROM_BASE + (0x30 ^ __SNI_END))
211
212#define SNI_IDPROM_SIZE 0x1000
193 213
194/* board specific init functions */ 214/* board specific init functions */
195extern void sni_a20r_init(void); 215extern void sni_a20r_init(void);
@@ -207,6 +227,9 @@ extern void sni_pcimt_irq_init(void);
207/* timer inits */ 227/* timer inits */
208extern void sni_cpu_time_init(void); 228extern void sni_cpu_time_init(void);
209 229
230/* eisa init for RM200/400 */
231extern int sni_eisa_root_init(void);
232
210/* common irq stuff */ 233/* common irq stuff */
211extern void (*sni_hwint)(void); 234extern void (*sni_hwint)(void);
212extern struct irqaction sni_isa_irq; 235extern struct irqaction sni_isa_irq;
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index fb41a8d76392..051e1af0bb95 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -6,6 +6,7 @@
6 * Copyright (C) 1994, 95, 96, 99, 2001 Ralf Baechle 6 * Copyright (C) 1994, 95, 96, 99, 2001 Ralf Baechle
7 * Copyright (C) 1994, 1995, 1996 Paul M. Antoine. 7 * Copyright (C) 1994, 1995, 1996 Paul M. Antoine.
8 * Copyright (C) 1999 Silicon Graphics, Inc. 8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 * Copyright (C) 2007 Maciej W. Rozycki
9 */ 10 */
10#ifndef _ASM_STACKFRAME_H 11#ifndef _ASM_STACKFRAME_H
11#define _ASM_STACKFRAME_H 12#define _ASM_STACKFRAME_H
@@ -145,8 +146,16 @@
145 .set reorder 146 .set reorder
146 /* Called from user mode, new stack. */ 147 /* Called from user mode, new stack. */
147 get_saved_sp 148 get_saved_sp
149#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
1488: move k0, sp 1508: move k0, sp
149 PTR_SUBU sp, k1, PT_SIZE 151 PTR_SUBU sp, k1, PT_SIZE
152#else
153 .set at=k0
1548: PTR_SUBU k1, PT_SIZE
155 .set noat
156 move k0, sp
157 move sp, k1
158#endif
150 LONG_S k0, PT_R29(sp) 159 LONG_S k0, PT_R29(sp)
151 LONG_S $3, PT_R3(sp) 160 LONG_S $3, PT_R3(sp)
152 /* 161 /*
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index 7717934f94c3..a8fd16e1981f 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -31,20 +31,13 @@ extern int rtc_mips_set_time(unsigned long);
31extern int rtc_mips_set_mmss(unsigned long); 31extern int rtc_mips_set_mmss(unsigned long);
32 32
33/* 33/*
34 * Timer interrupt functions.
35 * mips_timer_state is needed for high precision timer calibration.
36 */
37extern int (*mips_timer_state)(void);
38
39/*
40 * board specific routines required by time_init(). 34 * board specific routines required by time_init().
41 */ 35 */
42extern void plat_time_init(void); 36extern void plat_time_init(void);
43 37
44/* 38/*
45 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible 39 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible
46 * counter as a timer interrupt source; otherwise it can be set up 40 * counter as a timer interrupt source.
47 * automagically with an aid of mips_timer_state.
48 */ 41 */
49extern unsigned int mips_hpt_frequency; 42extern unsigned int mips_hpt_frequency;
50 43
diff --git a/include/asm-mips/topology.h b/include/asm-mips/topology.h
index 0440fb9f2180..259145e07e97 100644
--- a/include/asm-mips/topology.h
+++ b/include/asm-mips/topology.h
@@ -1 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 by Ralf Baechle
7 */
8#ifndef __ASM_TOPOLOGY_H
9#define __ASM_TOPOLOGY_H
10
1#include <topology.h> 11#include <topology.h>
12
13#ifdef CONFIG_SMP
14#define smt_capable() (smp_num_siblings > 1)
15#endif
16
17#endif /* __ASM_TOPOLOGY_H */
diff --git a/include/asm-mips/tx4927/tx4927_pci.h b/include/asm-mips/tx4927/tx4927_pci.h
index 3f1e470192e3..0be77df70f2b 100644
--- a/include/asm-mips/tx4927/tx4927_pci.h
+++ b/include/asm-mips/tx4927/tx4927_pci.h
@@ -9,6 +9,7 @@
9#define __ASM_TX4927_TX4927_PCI_H 9#define __ASM_TX4927_TX4927_PCI_H
10 10
11#define TX4927_CCFG_TOE 0x00004000 11#define TX4927_CCFG_TOE 0x00004000
12#define TX4927_CCFG_WR 0x00008000
12#define TX4927_CCFG_TINTDIS 0x01000000 13#define TX4927_CCFG_TINTDIS 0x01000000
13 14
14#define TX4927_PCIMEM 0x08000000 15#define TX4927_PCIMEM 0x08000000
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index c30c718994c9..66523d610950 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 03, 04 by Ralf Baechle 6 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 03, 04 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2007 Maciej W. Rozycki
8 */ 9 */
9#ifndef _ASM_UACCESS_H 10#ifndef _ASM_UACCESS_H
10#define _ASM_UACCESS_H 11#define _ASM_UACCESS_H
@@ -387,6 +388,12 @@ extern void __put_user_unknown(void);
387 "jal\t" #destination "\n\t" 388 "jal\t" #destination "\n\t"
388#endif 389#endif
389 390
391#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
392#define DADDI_SCRATCH "$0"
393#else
394#define DADDI_SCRATCH "$3"
395#endif
396
390extern size_t __copy_user(void *__to, const void *__from, size_t __n); 397extern size_t __copy_user(void *__to, const void *__from, size_t __n);
391 398
392#define __invoke_copy_to_user(to, from, n) \ 399#define __invoke_copy_to_user(to, from, n) \
@@ -403,7 +410,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
403 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ 410 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
404 : \ 411 : \
405 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \ 412 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
406 "memory"); \ 413 DADDI_SCRATCH, "memory"); \
407 __cu_len_r; \ 414 __cu_len_r; \
408}) 415})
409 416
@@ -512,7 +519,7 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
512 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ 519 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
513 : \ 520 : \
514 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \ 521 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
515 "memory"); \ 522 DADDI_SCRATCH, "memory"); \
516 __cu_len_r; \ 523 __cu_len_r; \
517}) 524})
518 525
@@ -535,7 +542,7 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
535 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ 542 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
536 : \ 543 : \
537 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \ 544 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
538 "memory"); \ 545 DADDI_SCRATCH, "memory"); \
539 __cu_len_r; \ 546 __cu_len_r; \
540}) 547})
541 548
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index d2808edfd4e9..22361d5e3bf0 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -4,6 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle 6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle
7 * Copyright (C) 2007 Maciej W. Rozycki
7 */ 8 */
8#ifndef _ASM_WAR_H 9#ifndef _ASM_WAR_H
9#define _ASM_WAR_H 10#define _ASM_WAR_H
@@ -11,6 +12,67 @@
11#include <war.h> 12#include <war.h>
12 13
13/* 14/*
15 * Work around certain R4000 CPU errata (as implemented by GCC):
16 *
17 * - A double-word or a variable shift may give an incorrect result
18 * if executed immediately after starting an integer division:
19 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
20 * erratum #28
21 * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
22 * #19
23 *
24 * - A double-word or a variable shift may give an incorrect result
25 * if executed while an integer multiplication is in progress:
26 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
27 * errata #16 & #28
28 *
29 * - An integer division may give an incorrect result if started in
30 * a delay slot of a taken branch or a jump:
31 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
32 * erratum #52
33 */
34#ifdef CONFIG_CPU_R4000_WORKAROUNDS
35#define R4000_WAR 1
36#else
37#define R4000_WAR 0
38#endif
39
40/*
41 * Work around certain R4400 CPU errata (as implemented by GCC):
42 *
43 * - A double-word or a variable shift may give an incorrect result
44 * if executed immediately after starting an integer division:
45 * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
46 * "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
47 */
48#ifdef CONFIG_CPU_R4400_WORKAROUNDS
49#define R4400_WAR 1
50#else
51#define R4400_WAR 0
52#endif
53
54/*
55 * Work around the "daddi" and "daddiu" CPU errata:
56 *
57 * - The `daddi' instruction fails to trap on overflow.
58 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
59 * erratum #23
60 *
61 * - The `daddiu' instruction can produce an incorrect result.
62 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
63 * erratum #41
64 * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
65 * #15
66 * "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
67 * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
68 */
69#ifdef CONFIG_CPU_DADDI_WORKAROUNDS
70#define DADDI_WAR 1
71#else
72#define DADDI_WAR 0
73#endif
74
75/*
14 * Another R4600 erratum. Due to the lack of errata information the exact 76 * Another R4600 erratum. Due to the lack of errata information the exact
15 * technical details aren't known. I've experimentally found that disabling 77 * technical details aren't known. I've experimentally found that disabling
16 * interrupts during indexed I-cache flushes seems to be sufficient to deal 78 * interrupts during indexed I-cache flushes seems to be sufficient to deal
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 733b4af7f4f1..220d9a781ab9 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -359,6 +359,8 @@ static __inline__ int test_le_bit(unsigned long nr,
359unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, 359unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
360 unsigned long size, unsigned long offset); 360 unsigned long size, unsigned long offset);
361 361
362unsigned long generic_find_next_le_bit(const unsigned long *addr,
363 unsigned long size, unsigned long offset);
362/* Bitmap functions for the ext2 filesystem */ 364/* Bitmap functions for the ext2 filesystem */
363 365
364#define ext2_set_bit(nr,addr) \ 366#define ext2_set_bit(nr,addr) \
@@ -378,6 +380,8 @@ unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
378#define ext2_find_next_zero_bit(addr, size, off) \ 380#define ext2_find_next_zero_bit(addr, size, off) \
379 generic_find_next_zero_le_bit((unsigned long*)addr, size, off) 381 generic_find_next_zero_le_bit((unsigned long*)addr, size, off)
380 382
383#define ext2_find_next_bit(addr, size, off) \
384 generic_find_next_le_bit((unsigned long *)addr, size, off)
381/* Bitmap functions for the minix filesystem. */ 385/* Bitmap functions for the minix filesystem. */
382 386
383#define minix_test_and_set_bit(nr,addr) \ 387#define minix_test_and_set_bit(nr,addr) \
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 34d9a6357c38..dba6fecad0be 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -772,6 +772,8 @@ static inline int sched_find_first_bit(unsigned long *b)
772 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 772 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
773#define ext2_test_bit(nr, addr) \ 773#define ext2_test_bit(nr, addr) \
774 test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 774 test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
775#define ext2_find_next_bit(addr, size, off) \
776 generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
775 777
776#ifndef __s390x__ 778#ifndef __s390x__
777 779
diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h
index ddb18ad23303..b2e4124070ae 100644
--- a/include/asm-sh/machvec.h
+++ b/include/asm-sh/machvec.h
@@ -65,6 +65,6 @@ extern struct sh_machine_vector sh_mv;
65#define get_system_type() sh_mv.mv_name 65#define get_system_type() sh_mv.mv_name
66 66
67#define __initmv \ 67#define __initmv \
68 __attribute_used__ __attribute__((__section__ (".machvec.init"))) 68 __used __section(.machvec.init)
69 69
70#endif /* _ASM_SH_MACHVEC_H */ 70#endif /* _ASM_SH_MACHVEC_H */
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index c6577d3dc46d..c50e5d35fe84 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -68,7 +68,7 @@ struct thread_info {
68#define init_stack (init_thread_union.stack) 68#define init_stack (init_thread_union.stack)
69 69
70/* how to get the current stack pointer from C */ 70/* how to get the current stack pointer from C */
71register unsigned long current_stack_pointer asm("r15") __attribute_used__; 71register unsigned long current_stack_pointer asm("r15") __used;
72 72
73/* how to get the thread information struct from C */ 73/* how to get the thread information struct from C */
74static inline struct thread_info *current_thread_info(void) 74static inline struct thread_info *current_thread_info(void)
diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h
index ef58fd2a6eb0..a516e9192f11 100644
--- a/include/asm-x86/thread_info_32.h
+++ b/include/asm-x86/thread_info_32.h
@@ -85,7 +85,7 @@ struct thread_info {
85 85
86 86
87/* how to get the current stack pointer from C */ 87/* how to get the current stack pointer from C */
88register unsigned long current_stack_pointer asm("esp") __attribute_used__; 88register unsigned long current_stack_pointer asm("esp") __used;
89 89
90/* how to get the thread information struct from C */ 90/* how to get the thread information struct from C */
91static inline struct thread_info *current_thread_info(void) 91static inline struct thread_info *current_thread_info(void)
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index bc33a5c87d64..27b9350052b4 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -35,7 +35,6 @@ header-y += atmsap.h
35header-y += atmsvc.h 35header-y += atmsvc.h
36header-y += atm_zatm.h 36header-y += atm_zatm.h
37header-y += auto_fs4.h 37header-y += auto_fs4.h
38header-y += auxvec.h
39header-y += ax25.h 38header-y += ax25.h
40header-y += b1lli.h 39header-y += b1lli.h
41header-y += baycom.h 40header-y += baycom.h
@@ -75,7 +74,7 @@ header-y += gen_stats.h
75header-y += gigaset_dev.h 74header-y += gigaset_dev.h
76header-y += hdsmart.h 75header-y += hdsmart.h
77header-y += hysdn_if.h 76header-y += hysdn_if.h
78header-y += i2c-dev.h 77header-y += i2o-dev.h
79header-y += i8k.h 78header-y += i8k.h
80header-y += if_arcnet.h 79header-y += if_arcnet.h
81header-y += if_bonding.h 80header-y += if_bonding.h
@@ -160,7 +159,6 @@ header-y += veth.h
160header-y += video_decoder.h 159header-y += video_decoder.h
161header-y += video_encoder.h 160header-y += video_encoder.h
162header-y += videotext.h 161header-y += videotext.h
163header-y += vt.h
164header-y += x25.h 162header-y += x25.h
165 163
166unifdef-y += acct.h 164unifdef-y += acct.h
@@ -175,6 +173,7 @@ unifdef-y += atm.h
175unifdef-y += atm_tcp.h 173unifdef-y += atm_tcp.h
176unifdef-y += audit.h 174unifdef-y += audit.h
177unifdef-y += auto_fs.h 175unifdef-y += auto_fs.h
176unifdef-y += auxvec.h
178unifdef-y += binfmts.h 177unifdef-y += binfmts.h
179unifdef-y += capability.h 178unifdef-y += capability.h
180unifdef-y += capi.h 179unifdef-y += capi.h
@@ -216,7 +215,7 @@ unifdef-y += hdreg.h
216unifdef-y += hiddev.h 215unifdef-y += hiddev.h
217unifdef-y += hpet.h 216unifdef-y += hpet.h
218unifdef-y += i2c.h 217unifdef-y += i2c.h
219unifdef-y += i2o-dev.h 218unifdef-y += i2c-dev.h
220unifdef-y += icmp.h 219unifdef-y += icmp.h
221unifdef-y += icmpv6.h 220unifdef-y += icmpv6.h
222unifdef-y += if_addr.h 221unifdef-y += if_addr.h
@@ -350,6 +349,7 @@ unifdef-y += videodev.h
350unifdef-y += virtio_config.h 349unifdef-y += virtio_config.h
351unifdef-y += virtio_blk.h 350unifdef-y += virtio_blk.h
352unifdef-y += virtio_net.h 351unifdef-y += virtio_net.h
352unifdef-y += vt.h
353unifdef-y += wait.h 353unifdef-y += wait.h
354unifdef-y += wanrouter.h 354unifdef-y += wanrouter.h
355unifdef-y += watchdog.h 355unifdef-y += watchdog.h
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index da0d83fbadc0..e98801f06dcc 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -192,6 +192,8 @@ int sync_dirty_buffer(struct buffer_head *bh);
192int submit_bh(int, struct buffer_head *); 192int submit_bh(int, struct buffer_head *);
193void write_boundary_block(struct block_device *bdev, 193void write_boundary_block(struct block_device *bdev,
194 sector_t bblock, unsigned blocksize); 194 sector_t bblock, unsigned blocksize);
195int bh_uptodate_or_lock(struct buffer_head *bh);
196int bh_submit_read(struct buffer_head *bh);
195 197
196extern int buffer_heads_over_limit; 198extern int buffer_heads_over_limit;
197 199
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 2d8c0f48f55e..e5eb795f78a1 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -7,10 +7,8 @@
7 7
8#if __GNUC_MINOR__ >= 3 8#if __GNUC_MINOR__ >= 3
9# define __used __attribute__((__used__)) 9# define __used __attribute__((__used__))
10# define __attribute_used__ __used /* deprecated */
11#else 10#else
12# define __used __attribute__((__unused__)) 11# define __used __attribute__((__unused__))
13# define __attribute_used__ __used /* deprecated */
14#endif 12#endif
15 13
16#if __GNUC_MINOR__ >= 4 14#if __GNUC_MINOR__ >= 4
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index ee7ca5de970c..0ab3a3232330 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -15,7 +15,6 @@
15#endif 15#endif
16 16
17#define __used __attribute__((__used__)) 17#define __used __attribute__((__used__))
18#define __attribute_used__ __used /* deprecated */
19#define __must_check __attribute__((warn_unused_result)) 18#define __must_check __attribute__((warn_unused_result))
20#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 19#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
21#define __always_inline inline __attribute__((always_inline)) 20#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c68b67b86ef1..d0e17e1657dc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
126 * Mark functions that are referenced only in inline assembly as __used so 126 * Mark functions that are referenced only in inline assembly as __used so
127 * the code is emitted even though it appears to be unreferenced. 127 * the code is emitted even though it appears to be unreferenced.
128 */ 128 */
129#ifndef __attribute_used__
130# define __attribute_used__ /* deprecated */
131#endif
132
133#ifndef __used 129#ifndef __used
134# define __used /* unimplemented */ 130# define __used /* unimplemented */
135#endif 131#endif
@@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
175#define __cold 171#define __cold
176#endif 172#endif
177 173
174/* Simple shorthand for a section definition */
175#ifndef __section
176# define __section(S) __attribute__ ((__section__(#S)))
177#endif
178
178#endif /* __LINUX_COMPILER_H */ 179#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index e831759b2fb5..278e3ef05336 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -76,7 +76,7 @@
76 typeof(desc) _desc \ 76 typeof(desc) _desc \
77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
78 } _ELFNOTE_PASTE(_note_, unique) \ 78 } _ELFNOTE_PASTE(_note_, unique) \
79 __attribute_used__ \ 79 __used \
80 __attribute__((section(".note." name), \ 80 __attribute__((section(".note." name), \
81 aligned(sizeof(Elf##size##_Word)), \ 81 aligned(sizeof(Elf##size##_Word)), \
82 unused)) = { \ 82 unused)) = { \
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 97dd409d5f4a..1852313fc7c7 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -20,6 +20,8 @@
20#include <linux/blkdev.h> 20#include <linux/blkdev.h>
21#include <linux/magic.h> 21#include <linux/magic.h>
22 22
23#include <linux/ext4_fs_i.h>
24
23/* 25/*
24 * The second extended filesystem constants/structures 26 * The second extended filesystem constants/structures
25 */ 27 */
@@ -51,6 +53,50 @@
51#define ext4_debug(f, a...) do {} while (0) 53#define ext4_debug(f, a...) do {} while (0)
52#endif 54#endif
53 55
56#define EXT4_MULTIBLOCK_ALLOCATOR 1
57
58/* prefer goal again. length */
59#define EXT4_MB_HINT_MERGE 1
60/* blocks already reserved */
61#define EXT4_MB_HINT_RESERVED 2
62/* metadata is being allocated */
63#define EXT4_MB_HINT_METADATA 4
64/* first blocks in the file */
65#define EXT4_MB_HINT_FIRST 8
66/* search for the best chunk */
67#define EXT4_MB_HINT_BEST 16
68/* data is being allocated */
69#define EXT4_MB_HINT_DATA 32
70/* don't preallocate (for tails) */
71#define EXT4_MB_HINT_NOPREALLOC 64
72/* allocate for locality group */
73#define EXT4_MB_HINT_GROUP_ALLOC 128
74/* allocate goal blocks or none */
75#define EXT4_MB_HINT_GOAL_ONLY 256
76/* goal is meaningful */
77#define EXT4_MB_HINT_TRY_GOAL 512
78
79struct ext4_allocation_request {
80 /* target inode for block we're allocating */
81 struct inode *inode;
82 /* logical block in target inode */
83 ext4_lblk_t logical;
84 /* phys. target (a hint) */
85 ext4_fsblk_t goal;
86 /* the closest logical allocated block to the left */
87 ext4_lblk_t lleft;
88 /* phys. block for ^^^ */
89 ext4_fsblk_t pleft;
90 /* the closest logical allocated block to the right */
91 ext4_lblk_t lright;
92 /* phys. block for ^^^ */
93 ext4_fsblk_t pright;
94 /* how many blocks we want to allocate */
95 unsigned long len;
96 /* flags. see above EXT4_MB_HINT_* */
97 unsigned long flags;
98};
99
54/* 100/*
55 * Special inodes numbers 101 * Special inodes numbers
56 */ 102 */
@@ -73,8 +119,8 @@
73 * Macro-instructions used to manage several block sizes 119 * Macro-instructions used to manage several block sizes
74 */ 120 */
75#define EXT4_MIN_BLOCK_SIZE 1024 121#define EXT4_MIN_BLOCK_SIZE 1024
76#define EXT4_MAX_BLOCK_SIZE 4096 122#define EXT4_MAX_BLOCK_SIZE 65536
77#define EXT4_MIN_BLOCK_LOG_SIZE 10 123#define EXT4_MIN_BLOCK_LOG_SIZE 10
78#ifdef __KERNEL__ 124#ifdef __KERNEL__
79# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize) 125# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
80#else 126#else
@@ -118,6 +164,11 @@ struct ext4_group_desc
118 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ 164 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
119 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ 165 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
120 __le32 bg_inode_table_hi; /* Inodes table block MSB */ 166 __le32 bg_inode_table_hi; /* Inodes table block MSB */
167 __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
168 __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
169 __le16 bg_used_dirs_count_hi; /* Directories count MSB */
170 __le16 bg_itable_unused_hi; /* Unused inodes count MSB */
171 __u32 bg_reserved2[3];
121}; 172};
122 173
123#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ 174#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
@@ -178,8 +229,9 @@ struct ext4_group_desc
178#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 229#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
179#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ 230#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
180#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 231#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
181#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ 232#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
182#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ 233#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
234#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
183 235
184#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */ 236#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
185#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 237#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
@@ -237,6 +289,7 @@ struct ext4_new_group_data {
237#endif 289#endif
238#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) 290#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
239#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) 291#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
292#define EXT4_IOC_MIGRATE _IO('f', 7)
240 293
241/* 294/*
242 * ioctl commands in 32 bit emulation 295 * ioctl commands in 32 bit emulation
@@ -275,18 +328,18 @@ struct ext4_mount_options {
275struct ext4_inode { 328struct ext4_inode {
276 __le16 i_mode; /* File mode */ 329 __le16 i_mode; /* File mode */
277 __le16 i_uid; /* Low 16 bits of Owner Uid */ 330 __le16 i_uid; /* Low 16 bits of Owner Uid */
278 __le32 i_size; /* Size in bytes */ 331 __le32 i_size_lo; /* Size in bytes */
279 __le32 i_atime; /* Access time */ 332 __le32 i_atime; /* Access time */
280 __le32 i_ctime; /* Inode Change time */ 333 __le32 i_ctime; /* Inode Change time */
281 __le32 i_mtime; /* Modification time */ 334 __le32 i_mtime; /* Modification time */
282 __le32 i_dtime; /* Deletion Time */ 335 __le32 i_dtime; /* Deletion Time */
283 __le16 i_gid; /* Low 16 bits of Group Id */ 336 __le16 i_gid; /* Low 16 bits of Group Id */
284 __le16 i_links_count; /* Links count */ 337 __le16 i_links_count; /* Links count */
285 __le32 i_blocks; /* Blocks count */ 338 __le32 i_blocks_lo; /* Blocks count */
286 __le32 i_flags; /* File flags */ 339 __le32 i_flags; /* File flags */
287 union { 340 union {
288 struct { 341 struct {
289 __u32 l_i_reserved1; 342 __le32 l_i_version;
290 } linux1; 343 } linux1;
291 struct { 344 struct {
292 __u32 h_i_translator; 345 __u32 h_i_translator;
@@ -297,12 +350,12 @@ struct ext4_inode {
297 } osd1; /* OS dependent 1 */ 350 } osd1; /* OS dependent 1 */
298 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */ 351 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
299 __le32 i_generation; /* File version (for NFS) */ 352 __le32 i_generation; /* File version (for NFS) */
300 __le32 i_file_acl; /* File ACL */ 353 __le32 i_file_acl_lo; /* File ACL */
301 __le32 i_dir_acl; /* Directory ACL */ 354 __le32 i_size_high;
302 __le32 i_obso_faddr; /* Obsoleted fragment address */ 355 __le32 i_obso_faddr; /* Obsoleted fragment address */
303 union { 356 union {
304 struct { 357 struct {
305 __le16 l_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ 358 __le16 l_i_blocks_high; /* were l_i_reserved1 */
306 __le16 l_i_file_acl_high; 359 __le16 l_i_file_acl_high;
307 __le16 l_i_uid_high; /* these 2 fields */ 360 __le16 l_i_uid_high; /* these 2 fields */
308 __le16 l_i_gid_high; /* were reserved2[0] */ 361 __le16 l_i_gid_high; /* were reserved2[0] */
@@ -328,9 +381,9 @@ struct ext4_inode {
328 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ 381 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
329 __le32 i_crtime; /* File Creation time */ 382 __le32 i_crtime; /* File Creation time */
330 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ 383 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
384 __le32 i_version_hi; /* high 32 bits for 64-bit version */
331}; 385};
332 386
333#define i_size_high i_dir_acl
334 387
335#define EXT4_EPOCH_BITS 2 388#define EXT4_EPOCH_BITS 2
336#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) 389#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
@@ -402,9 +455,12 @@ do { \
402 raw_inode->xtime ## _extra); \ 455 raw_inode->xtime ## _extra); \
403} while (0) 456} while (0)
404 457
458#define i_disk_version osd1.linux1.l_i_version
459
405#if defined(__KERNEL__) || defined(__linux__) 460#if defined(__KERNEL__) || defined(__linux__)
406#define i_reserved1 osd1.linux1.l_i_reserved1 461#define i_reserved1 osd1.linux1.l_i_reserved1
407#define i_file_acl_high osd2.linux2.l_i_file_acl_high 462#define i_file_acl_high osd2.linux2.l_i_file_acl_high
463#define i_blocks_high osd2.linux2.l_i_blocks_high
408#define i_uid_low i_uid 464#define i_uid_low i_uid
409#define i_gid_low i_gid 465#define i_gid_low i_gid
410#define i_uid_high osd2.linux2.l_i_uid_high 466#define i_uid_high osd2.linux2.l_i_uid_high
@@ -461,7 +517,10 @@ do { \
461#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 517#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
462#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 518#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
463#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */ 519#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
464 520#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
521#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
522#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
523#define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */
465/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ 524/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
466#ifndef _LINUX_EXT2_FS_H 525#ifndef _LINUX_EXT2_FS_H
467#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt 526#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
@@ -481,6 +540,7 @@ do { \
481#define ext4_test_bit ext2_test_bit 540#define ext4_test_bit ext2_test_bit
482#define ext4_find_first_zero_bit ext2_find_first_zero_bit 541#define ext4_find_first_zero_bit ext2_find_first_zero_bit
483#define ext4_find_next_zero_bit ext2_find_next_zero_bit 542#define ext4_find_next_zero_bit ext2_find_next_zero_bit
543#define ext4_find_next_bit ext2_find_next_bit
484 544
485/* 545/*
486 * Maximal mount counts between two filesystem checks 546 * Maximal mount counts between two filesystem checks
@@ -671,6 +731,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
671#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 731#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
672#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 732#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
673#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 733#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
734#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
674#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 735#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
675#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 736#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
676#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 737#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
@@ -682,6 +743,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
682#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010 743#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
683#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ 744#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
684#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 745#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
746#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
685#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 747#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
686 748
687#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR 749#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
@@ -696,7 +758,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
696 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ 758 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
697 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ 759 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
698 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ 760 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
699 EXT4_FEATURE_RO_COMPAT_BTREE_DIR) 761 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
762 EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
700 763
701/* 764/*
702 * Default values for user and/or group using reserved blocks 765 * Default values for user and/or group using reserved blocks
@@ -767,6 +830,26 @@ struct ext4_dir_entry_2 {
767#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1) 830#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
768#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \ 831#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
769 ~EXT4_DIR_ROUND) 832 ~EXT4_DIR_ROUND)
833#define EXT4_MAX_REC_LEN ((1<<16)-1)
834
835static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
836{
837 unsigned len = le16_to_cpu(dlen);
838
839 if (len == EXT4_MAX_REC_LEN)
840 return 1 << 16;
841 return len;
842}
843
844static inline __le16 ext4_rec_len_to_disk(unsigned len)
845{
846 if (len == (1 << 16))
847 return cpu_to_le16(EXT4_MAX_REC_LEN);
848 else if (len > (1 << 16))
849 BUG();
850 return cpu_to_le16(len);
851}
852
770/* 853/*
771 * Hash Tree Directory indexing 854 * Hash Tree Directory indexing
772 * (c) Daniel Phillips, 2001 855 * (c) Daniel Phillips, 2001
@@ -810,7 +893,7 @@ struct ext4_iloc
810{ 893{
811 struct buffer_head *bh; 894 struct buffer_head *bh;
812 unsigned long offset; 895 unsigned long offset;
813 unsigned long block_group; 896 ext4_group_t block_group;
814}; 897};
815 898
816static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc) 899static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
@@ -835,7 +918,7 @@ struct dir_private_info {
835 918
836/* calculate the first block number of the group */ 919/* calculate the first block number of the group */
837static inline ext4_fsblk_t 920static inline ext4_fsblk_t
838ext4_group_first_block_no(struct super_block *sb, unsigned long group_no) 921ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
839{ 922{
840 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + 923 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +
841 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); 924 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
@@ -866,21 +949,24 @@ extern unsigned int ext4_block_group(struct super_block *sb,
866 ext4_fsblk_t blocknr); 949 ext4_fsblk_t blocknr);
867extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, 950extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb,
868 ext4_fsblk_t blocknr); 951 ext4_fsblk_t blocknr);
869extern int ext4_bg_has_super(struct super_block *sb, int group); 952extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
870extern unsigned long ext4_bg_num_gdb(struct super_block *sb, int group); 953extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
954 ext4_group_t group);
871extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, 955extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
872 ext4_fsblk_t goal, int *errp); 956 ext4_fsblk_t goal, int *errp);
873extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, 957extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
874 ext4_fsblk_t goal, unsigned long *count, int *errp); 958 ext4_fsblk_t goal, unsigned long *count, int *errp);
959extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
960 ext4_fsblk_t goal, unsigned long *count, int *errp);
875extern void ext4_free_blocks (handle_t *handle, struct inode *inode, 961extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
876 ext4_fsblk_t block, unsigned long count); 962 ext4_fsblk_t block, unsigned long count, int metadata);
877extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, 963extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
878 ext4_fsblk_t block, unsigned long count, 964 ext4_fsblk_t block, unsigned long count,
879 unsigned long *pdquot_freed_blocks); 965 unsigned long *pdquot_freed_blocks);
880extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *); 966extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *);
881extern void ext4_check_blocks_bitmap (struct super_block *); 967extern void ext4_check_blocks_bitmap (struct super_block *);
882extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, 968extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
883 unsigned int block_group, 969 ext4_group_t block_group,
884 struct buffer_head ** bh); 970 struct buffer_head ** bh);
885extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); 971extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
886extern void ext4_init_block_alloc_info(struct inode *); 972extern void ext4_init_block_alloc_info(struct inode *);
@@ -911,15 +997,32 @@ extern unsigned long ext4_count_dirs (struct super_block *);
911extern void ext4_check_inodes_bitmap (struct super_block *); 997extern void ext4_check_inodes_bitmap (struct super_block *);
912extern unsigned long ext4_count_free (struct buffer_head *, unsigned); 998extern unsigned long ext4_count_free (struct buffer_head *, unsigned);
913 999
1000/* mballoc.c */
1001extern long ext4_mb_stats;
1002extern long ext4_mb_max_to_scan;
1003extern int ext4_mb_init(struct super_block *, int);
1004extern int ext4_mb_release(struct super_block *);
1005extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
1006 struct ext4_allocation_request *, int *);
1007extern int ext4_mb_reserve_blocks(struct super_block *, int);
1008extern void ext4_mb_discard_inode_preallocations(struct inode *);
1009extern int __init init_ext4_mballoc(void);
1010extern void exit_ext4_mballoc(void);
1011extern void ext4_mb_free_blocks(handle_t *, struct inode *,
1012 unsigned long, unsigned long, int, unsigned long *);
1013
914 1014
915/* inode.c */ 1015/* inode.c */
916int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, 1016int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
917 struct buffer_head *bh, ext4_fsblk_t blocknr); 1017 struct buffer_head *bh, ext4_fsblk_t blocknr);
918struct buffer_head * ext4_getblk (handle_t *, struct inode *, long, int, int *); 1018struct buffer_head *ext4_getblk(handle_t *, struct inode *,
919struct buffer_head * ext4_bread (handle_t *, struct inode *, int, int, int *); 1019 ext4_lblk_t, int, int *);
1020struct buffer_head *ext4_bread(handle_t *, struct inode *,
1021 ext4_lblk_t, int, int *);
920int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, 1022int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
921 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, 1023 ext4_lblk_t iblock, unsigned long maxblocks,
922 int create, int extend_disksize); 1024 struct buffer_head *bh_result,
1025 int create, int extend_disksize);
923 1026
924extern void ext4_read_inode (struct inode *); 1027extern void ext4_read_inode (struct inode *);
925extern int ext4_write_inode (struct inode *, int); 1028extern int ext4_write_inode (struct inode *, int);
@@ -943,6 +1046,9 @@ extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
943 unsigned long); 1046 unsigned long);
944extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long); 1047extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
945 1048
1049/* migrate.c */
1050extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
1051 unsigned long);
946/* namei.c */ 1052/* namei.c */
947extern int ext4_orphan_add(handle_t *, struct inode *); 1053extern int ext4_orphan_add(handle_t *, struct inode *);
948extern int ext4_orphan_del(handle_t *, struct inode *); 1054extern int ext4_orphan_del(handle_t *, struct inode *);
@@ -965,6 +1071,12 @@ extern void ext4_abort (struct super_block *, const char *, const char *, ...)
965extern void ext4_warning (struct super_block *, const char *, const char *, ...) 1071extern void ext4_warning (struct super_block *, const char *, const char *, ...)
966 __attribute__ ((format (printf, 3, 4))); 1072 __attribute__ ((format (printf, 3, 4)));
967extern void ext4_update_dynamic_rev (struct super_block *sb); 1073extern void ext4_update_dynamic_rev (struct super_block *sb);
1074extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
1075 __u32 compat);
1076extern int ext4_update_rocompat_feature(handle_t *handle,
1077 struct super_block *sb, __u32 rocompat);
1078extern int ext4_update_incompat_feature(handle_t *handle,
1079 struct super_block *sb, __u32 incompat);
968extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, 1080extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
969 struct ext4_group_desc *bg); 1081 struct ext4_group_desc *bg);
970extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, 1082extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
@@ -1017,6 +1129,29 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1017 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32); 1129 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
1018} 1130}
1019 1131
1132static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1133{
1134 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1135 le32_to_cpu(raw_inode->i_size_lo);
1136}
1137
1138static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
1139{
1140 raw_inode->i_size_lo = cpu_to_le32(i_size);
1141 raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
1142}
1143
1144static inline
1145struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
1146 ext4_group_t group)
1147{
1148 struct ext4_group_info ***grp_info;
1149 long indexv, indexh;
1150 grp_info = EXT4_SB(sb)->s_group_info;
1151 indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
1152 indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
1153 return grp_info[indexv][indexh];
1154}
1020 1155
1021 1156
1022#define ext4_std_error(sb, errno) \ 1157#define ext4_std_error(sb, errno) \
@@ -1048,7 +1183,7 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
1048extern int ext4_ext_tree_init(handle_t *handle, struct inode *); 1183extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
1049extern int ext4_ext_writepage_trans_blocks(struct inode *, int); 1184extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1050extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 1185extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1051 ext4_fsblk_t iblock, 1186 ext4_lblk_t iblock,
1052 unsigned long max_blocks, struct buffer_head *bh_result, 1187 unsigned long max_blocks, struct buffer_head *bh_result,
1053 int create, int extend_disksize); 1188 int create, int extend_disksize);
1054extern void ext4_ext_truncate(struct inode *, struct page *); 1189extern void ext4_ext_truncate(struct inode *, struct page *);
@@ -1056,19 +1191,10 @@ extern void ext4_ext_init(struct super_block *);
1056extern void ext4_ext_release(struct super_block *); 1191extern void ext4_ext_release(struct super_block *);
1057extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, 1192extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1058 loff_t len); 1193 loff_t len);
1059static inline int 1194extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
1060ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, 1195 sector_t block, unsigned long max_blocks,
1061 unsigned long max_blocks, struct buffer_head *bh, 1196 struct buffer_head *bh, int create,
1062 int create, int extend_disksize) 1197 int extend_disksize);
1063{
1064 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
1065 return ext4_ext_get_blocks(handle, inode, block, max_blocks,
1066 bh, create, extend_disksize);
1067 return ext4_get_blocks_handle(handle, inode, block, max_blocks, bh,
1068 create, extend_disksize);
1069}
1070
1071
1072#endif /* __KERNEL__ */ 1198#endif /* __KERNEL__ */
1073 1199
1074#endif /* _LINUX_EXT4_FS_H */ 1200#endif /* _LINUX_EXT4_FS_H */
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index d2045a26195d..697da4bce6c5 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -124,20 +124,6 @@ struct ext4_ext_path {
124#define EXT4_EXT_CACHE_GAP 1 124#define EXT4_EXT_CACHE_GAP 1
125#define EXT4_EXT_CACHE_EXTENT 2 125#define EXT4_EXT_CACHE_EXTENT 2
126 126
127/*
128 * to be called by ext4_ext_walk_space()
129 * negative retcode - error
130 * positive retcode - signal for ext4_ext_walk_space(), see below
131 * callback must return valid extent (passed or newly created)
132 */
133typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
134 struct ext4_ext_cache *,
135 void *);
136
137#define EXT_CONTINUE 0
138#define EXT_BREAK 1
139#define EXT_REPEAT 2
140
141 127
142#define EXT_MAX_BLOCK 0xffffffff 128#define EXT_MAX_BLOCK 0xffffffff
143 129
@@ -226,6 +212,8 @@ static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
226 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN)); 212 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
227} 213}
228 214
215extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
216extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
229extern int ext4_extent_tree_init(handle_t *, struct inode *); 217extern int ext4_extent_tree_init(handle_t *, struct inode *);
230extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 218extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
231extern int ext4_ext_try_to_merge(struct inode *inode, 219extern int ext4_ext_try_to_merge(struct inode *inode,
@@ -233,8 +221,11 @@ extern int ext4_ext_try_to_merge(struct inode *inode,
233 struct ext4_extent *); 221 struct ext4_extent *);
234extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); 222extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
235extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); 223extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
236extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); 224extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
237extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *); 225 struct ext4_ext_path *);
238 226extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
227 ext4_lblk_t *, ext4_fsblk_t *);
228extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *,
229 ext4_lblk_t *, ext4_fsblk_t *);
239#endif /* _LINUX_EXT4_EXTENTS */ 230#endif /* _LINUX_EXT4_EXTENTS */
240 231
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index 86ddfe2089f3..d5508d3cf290 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -27,6 +27,12 @@ typedef int ext4_grpblk_t;
27/* data type for filesystem-wide blocks number */ 27/* data type for filesystem-wide blocks number */
28typedef unsigned long long ext4_fsblk_t; 28typedef unsigned long long ext4_fsblk_t;
29 29
30/* data type for file logical block number */
31typedef __u32 ext4_lblk_t;
32
33/* data type for block group number */
34typedef unsigned long ext4_group_t;
35
30struct ext4_reserve_window { 36struct ext4_reserve_window {
31 ext4_fsblk_t _rsv_start; /* First byte reserved */ 37 ext4_fsblk_t _rsv_start; /* First byte reserved */
32 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ 38 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
@@ -48,7 +54,7 @@ struct ext4_block_alloc_info {
48 * most-recently-allocated block in this file. 54 * most-recently-allocated block in this file.
49 * We use this for detecting linearly ascending allocation requests. 55 * We use this for detecting linearly ascending allocation requests.
50 */ 56 */
51 __u32 last_alloc_logical_block; 57 ext4_lblk_t last_alloc_logical_block;
52 /* 58 /*
53 * Was i_next_alloc_goal in ext4_inode_info 59 * Was i_next_alloc_goal in ext4_inode_info
54 * is the *physical* companion to i_next_alloc_block. 60 * is the *physical* companion to i_next_alloc_block.
@@ -67,7 +73,7 @@ struct ext4_block_alloc_info {
67 */ 73 */
68struct ext4_ext_cache { 74struct ext4_ext_cache {
69 ext4_fsblk_t ec_start; 75 ext4_fsblk_t ec_start;
70 __u32 ec_block; 76 ext4_lblk_t ec_block;
71 __u32 ec_len; /* must be 32bit to return holes */ 77 __u32 ec_len; /* must be 32bit to return holes */
72 __u32 ec_type; 78 __u32 ec_type;
73}; 79};
@@ -79,7 +85,6 @@ struct ext4_inode_info {
79 __le32 i_data[15]; /* unconverted */ 85 __le32 i_data[15]; /* unconverted */
80 __u32 i_flags; 86 __u32 i_flags;
81 ext4_fsblk_t i_file_acl; 87 ext4_fsblk_t i_file_acl;
82 __u32 i_dir_acl;
83 __u32 i_dtime; 88 __u32 i_dtime;
84 89
85 /* 90 /*
@@ -89,13 +94,13 @@ struct ext4_inode_info {
89 * place a file's data blocks near its inode block, and new inodes 94 * place a file's data blocks near its inode block, and new inodes
90 * near to their parent directory's inode. 95 * near to their parent directory's inode.
91 */ 96 */
92 __u32 i_block_group; 97 ext4_group_t i_block_group;
93 __u32 i_state; /* Dynamic state flags for ext4 */ 98 __u32 i_state; /* Dynamic state flags for ext4 */
94 99
95 /* block reservation info */ 100 /* block reservation info */
96 struct ext4_block_alloc_info *i_block_alloc_info; 101 struct ext4_block_alloc_info *i_block_alloc_info;
97 102
98 __u32 i_dir_start_lookup; 103 ext4_lblk_t i_dir_start_lookup;
99#ifdef CONFIG_EXT4DEV_FS_XATTR 104#ifdef CONFIG_EXT4DEV_FS_XATTR
100 /* 105 /*
101 * Extended attributes can be read independently of the main file 106 * Extended attributes can be read independently of the main file
@@ -134,16 +139,16 @@ struct ext4_inode_info {
134 __u16 i_extra_isize; 139 __u16 i_extra_isize;
135 140
136 /* 141 /*
137 * truncate_mutex is for serialising ext4_truncate() against 142 * i_data_sem is for serialising ext4_truncate() against
138 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's 143 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
139 * data tree are chopped off during truncate. We can't do that in 144 * data tree are chopped off during truncate. We can't do that in
140 * ext4 because whenever we perform intermediate commits during 145 * ext4 because whenever we perform intermediate commits during
141 * truncate, the inode and all the metadata blocks *must* be in a 146 * truncate, the inode and all the metadata blocks *must* be in a
142 * consistent state which allows truncation of the orphans to restart 147 * consistent state which allows truncation of the orphans to restart
143 * during recovery. Hence we must fix the get_block-vs-truncate race 148 * during recovery. Hence we must fix the get_block-vs-truncate race
144 * by other means, so we have truncate_mutex. 149 * by other means, so we have i_data_sem.
145 */ 150 */
146 struct mutex truncate_mutex; 151 struct rw_semaphore i_data_sem;
147 struct inode vfs_inode; 152 struct inode vfs_inode;
148 153
149 unsigned long i_ext_generation; 154 unsigned long i_ext_generation;
@@ -153,6 +158,10 @@ struct ext4_inode_info {
153 * struct timespec i_{a,c,m}time in the generic inode. 158 * struct timespec i_{a,c,m}time in the generic inode.
154 */ 159 */
155 struct timespec i_crtime; 160 struct timespec i_crtime;
161
162 /* mballoc */
163 struct list_head i_prealloc_list;
164 spinlock_t i_prealloc_lock;
156}; 165};
157 166
158#endif /* _LINUX_EXT4_FS_I */ 167#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index b40e827cd495..abaae2c8cccf 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -35,9 +35,10 @@ struct ext4_sb_info {
35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */ 35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
36 unsigned long s_gdb_count; /* Number of group descriptor blocks */ 36 unsigned long s_gdb_count; /* Number of group descriptor blocks */
37 unsigned long s_desc_per_block; /* Number of group descriptors per block */ 37 unsigned long s_desc_per_block; /* Number of group descriptors per block */
38 unsigned long s_groups_count; /* Number of groups in the fs */ 38 ext4_group_t s_groups_count; /* Number of groups in the fs */
39 unsigned long s_overhead_last; /* Last calculated overhead */ 39 unsigned long s_overhead_last; /* Last calculated overhead */
40 unsigned long s_blocks_last; /* Last seen block count */ 40 unsigned long s_blocks_last; /* Last seen block count */
41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
41 struct buffer_head * s_sbh; /* Buffer containing the super block */ 42 struct buffer_head * s_sbh; /* Buffer containing the super block */
42 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ 43 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
43 struct buffer_head ** s_group_desc; 44 struct buffer_head ** s_group_desc;
@@ -90,6 +91,58 @@ struct ext4_sb_info {
90 unsigned long s_ext_blocks; 91 unsigned long s_ext_blocks;
91 unsigned long s_ext_extents; 92 unsigned long s_ext_extents;
92#endif 93#endif
94
95 /* for buddy allocator */
96 struct ext4_group_info ***s_group_info;
97 struct inode *s_buddy_cache;
98 long s_blocks_reserved;
99 spinlock_t s_reserve_lock;
100 struct list_head s_active_transaction;
101 struct list_head s_closed_transaction;
102 struct list_head s_committed_transaction;
103 spinlock_t s_md_lock;
104 tid_t s_last_transaction;
105 unsigned short *s_mb_offsets, *s_mb_maxs;
106
107 /* tunables */
108 unsigned long s_stripe;
109 unsigned long s_mb_stream_request;
110 unsigned long s_mb_max_to_scan;
111 unsigned long s_mb_min_to_scan;
112 unsigned long s_mb_stats;
113 unsigned long s_mb_order2_reqs;
114 unsigned long s_mb_group_prealloc;
115 /* where last allocation was done - for stream allocation */
116 unsigned long s_mb_last_group;
117 unsigned long s_mb_last_start;
118
119 /* history to debug policy */
120 struct ext4_mb_history *s_mb_history;
121 int s_mb_history_cur;
122 int s_mb_history_max;
123 int s_mb_history_num;
124 struct proc_dir_entry *s_mb_proc;
125 spinlock_t s_mb_history_lock;
126 int s_mb_history_filter;
127
128 /* stats for buddy allocator */
129 spinlock_t s_mb_pa_lock;
130 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
131 atomic_t s_bal_success; /* we found long enough chunks */
132 atomic_t s_bal_allocated; /* in blocks */
133 atomic_t s_bal_ex_scanned; /* total extents scanned */
134 atomic_t s_bal_goals; /* goal hits */
135 atomic_t s_bal_breaks; /* too long searches */
136 atomic_t s_bal_2orders; /* 2^order hits */
137 spinlock_t s_bal_lock;
138 unsigned long s_mb_buddies_generated;
139 unsigned long long s_mb_generation_time;
140 atomic_t s_mb_lost_chunks;
141 atomic_t s_mb_preallocated;
142 atomic_t s_mb_discarded;
143
144 /* locality groups */
145 struct ext4_locality_group *s_locality_groups;
93}; 146};
94 147
95#endif /* _LINUX_EXT4_FS_SB */ 148#endif /* _LINUX_EXT4_FS_SB */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 21398a5d688d..a516b6716870 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -124,6 +124,7 @@ extern int dir_notify_enable;
124#define MS_SHARED (1<<20) /* change to shared */ 124#define MS_SHARED (1<<20) /* change to shared */
125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ 125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
126#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 126#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
127#define MS_I_VERSION (1<<23) /* Update inode I_version field */
127#define MS_ACTIVE (1<<30) 128#define MS_ACTIVE (1<<30)
128#define MS_NOUSER (1<<31) 129#define MS_NOUSER (1<<31)
129 130
@@ -173,6 +174,7 @@ extern int dir_notify_enable;
173 ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) 174 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
174#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) 175#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
175#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) 176#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
177#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
176 178
177#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 179#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
178#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 180#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
@@ -599,7 +601,7 @@ struct inode {
599 uid_t i_uid; 601 uid_t i_uid;
600 gid_t i_gid; 602 gid_t i_gid;
601 dev_t i_rdev; 603 dev_t i_rdev;
602 unsigned long i_version; 604 u64 i_version;
603 loff_t i_size; 605 loff_t i_size;
604#ifdef __NEED_I_SIZE_ORDERED 606#ifdef __NEED_I_SIZE_ORDERED
605 seqcount_t i_size_seqcount; 607 seqcount_t i_size_seqcount;
@@ -1394,6 +1396,21 @@ static inline void inode_dec_link_count(struct inode *inode)
1394 mark_inode_dirty(inode); 1396 mark_inode_dirty(inode);
1395} 1397}
1396 1398
1399/**
1400 * inode_inc_iversion - increments i_version
1401 * @inode: inode that need to be updated
1402 *
1403 * Every time the inode is modified, the i_version field will be incremented.
1404 * The filesystem has to be mounted with i_version flag
1405 */
1406
1407static inline void inode_inc_iversion(struct inode *inode)
1408{
1409 spin_lock(&inode->i_lock);
1410 inode->i_version++;
1411 spin_unlock(&inode->i_lock);
1412}
1413
1397extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); 1414extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1398static inline void file_accessed(struct file *file) 1415static inline void file_accessed(struct file *file)
1399{ 1416{
diff --git a/include/linux/init.h b/include/linux/init.h
index 5141381a7527..2efbda016741 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,10 +40,10 @@
40 40
41/* These are for everybody (although not all archs will actually 41/* These are for everybody (although not all archs will actually
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __attribute__ ((__section__ (".init.text"))) __cold 43#define __init __section(.init.text) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __section(.init.data)
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __section(.exit.data)
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 46#define __exit_call __used __section(.exitcall.exit)
47 47
48/* modpost check for section mismatches during the kernel build. 48/* modpost check for section mismatches during the kernel build.
49 * A section mismatch happens when there are references from a 49 * A section mismatch happens when there are references from a
@@ -52,25 +52,81 @@
52 * when early init has completed so all such references are potential bugs. 52 * when early init has completed so all such references are potential bugs.
53 * For exit sections the same issue exists. 53 * For exit sections the same issue exists.
54 * The following markers are used for the cases where the reference to 54 * The following markers are used for the cases where the reference to
55 * the init/exit section (code or data) is valid and will teach modpost 55 * the *init / *exit section (code or data) is valid and will teach
56 * not to issue a warning. 56 * modpost not to issue a warning.
57 * The markers follow same syntax rules as __init / __initdata. */ 57 * The markers follow same syntax rules as __init / __initdata. */
58#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) 58#define __ref __section(.ref.text) noinline
59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) 59#define __refdata __section(.ref.data)
60#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) 60#define __refconst __section(.ref.rodata)
61
62/* backward compatibility note
63 * A few places hardcode the old section names:
64 * .text.init.refok
65 * .data.init.refok
66 * .exit.text.refok
67 * They should be converted to use the defines from this file
68 */
69
70/* compatibility defines */
71#define __init_refok __ref
72#define __initdata_refok __refdata
73#define __exit_refok __ref
74
61 75
62#ifdef MODULE 76#ifdef MODULE
63#define __exit __attribute__ ((__section__(".exit.text"))) __cold 77#define __exitused
64#else 78#else
65#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold 79#define __exitused __used
66#endif 80#endif
67 81
82#define __exit __section(.exit.text) __exitused __cold
83
84/* Used for HOTPLUG */
85#define __devinit __section(.devinit.text) __cold
86#define __devinitdata __section(.devinit.data)
87#define __devinitconst __section(.devinit.rodata)
88#define __devexit __section(.devexit.text) __exitused __cold
89#define __devexitdata __section(.devexit.data)
90#define __devexitconst __section(.devexit.rodata)
91
92/* Used for HOTPLUG_CPU */
93#define __cpuinit __section(.cpuinit.text) __cold
94#define __cpuinitdata __section(.cpuinit.data)
95#define __cpuinitconst __section(.cpuinit.rodata)
96#define __cpuexit __section(.cpuexit.text) __exitused __cold
97#define __cpuexitdata __section(.cpuexit.data)
98#define __cpuexitconst __section(.cpuexit.rodata)
99
100/* Used for MEMORY_HOTPLUG */
101#define __meminit __section(.meminit.text) __cold
102#define __meminitdata __section(.meminit.data)
103#define __meminitconst __section(.meminit.rodata)
104#define __memexit __section(.memexit.text) __exitused __cold
105#define __memexitdata __section(.memexit.data)
106#define __memexitconst __section(.memexit.rodata)
107
68/* For assembly routines */ 108/* For assembly routines */
69#define __INIT .section ".init.text","ax" 109#define __INIT .section ".init.text","ax"
70#define __INIT_REFOK .section ".text.init.refok","ax"
71#define __FINIT .previous 110#define __FINIT .previous
111
72#define __INITDATA .section ".init.data","aw" 112#define __INITDATA .section ".init.data","aw"
73#define __INITDATA_REFOK .section ".data.init.refok","aw" 113
114#define __DEVINIT .section ".devinit.text", "ax"
115#define __DEVINITDATA .section ".devinit.data", "aw"
116
117#define __CPUINIT .section ".cpuinit.text", "ax"
118#define __CPUINITDATA .section ".cpuinit.data", "aw"
119
120#define __MEMINIT .section ".meminit.text", "ax"
121#define __MEMINITDATA .section ".meminit.data", "aw"
122
123/* silence warnings when references are OK */
124#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
74 130
75#ifndef __ASSEMBLY__ 131#ifndef __ASSEMBLY__
76/* 132/*
@@ -108,7 +164,7 @@ void prepare_namespace(void);
108 */ 164 */
109 165
110#define __define_initcall(level,fn,id) \ 166#define __define_initcall(level,fn,id) \
111 static initcall_t __initcall_##fn##id __attribute_used__ \ 167 static initcall_t __initcall_##fn##id __used \
112 __attribute__((__section__(".initcall" level ".init"))) = fn 168 __attribute__((__section__(".initcall" level ".init"))) = fn
113 169
114/* 170/*
@@ -142,11 +198,11 @@ void prepare_namespace(void);
142 198
143#define console_initcall(fn) \ 199#define console_initcall(fn) \
144 static initcall_t __initcall_##fn \ 200 static initcall_t __initcall_##fn \
145 __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn 201 __used __section(.con_initcall.init) = fn
146 202
147#define security_initcall(fn) \ 203#define security_initcall(fn) \
148 static initcall_t __initcall_##fn \ 204 static initcall_t __initcall_##fn \
149 __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn 205 __used __section(.security_initcall.init) = fn
150 206
151struct obs_kernel_param { 207struct obs_kernel_param {
152 const char *str; 208 const char *str;
@@ -163,8 +219,7 @@ struct obs_kernel_param {
163#define __setup_param(str, unique_id, fn, early) \ 219#define __setup_param(str, unique_id, fn, early) \
164 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 220 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
165 static struct obs_kernel_param __setup_##unique_id \ 221 static struct obs_kernel_param __setup_##unique_id \
166 __attribute_used__ \ 222 __used __section(.init.setup) \
167 __attribute__((__section__(".init.setup"))) \
168 __attribute__((aligned((sizeof(long))))) \ 223 __attribute__((aligned((sizeof(long))))) \
169 = { __setup_str_##unique_id, fn, early } 224 = { __setup_str_##unique_id, fn, early }
170 225
@@ -242,7 +297,7 @@ void __init parse_early_param(void);
242#endif 297#endif
243 298
244/* Data marked not to be saved by software suspend */ 299/* Data marked not to be saved by software suspend */
245#define __nosavedata __attribute__ ((__section__ (".data.nosave"))) 300#define __nosavedata __section(.data.nosave)
246 301
247/* This means "can be init if no module support, otherwise module load 302/* This means "can be init if no module support, otherwise module load
248 may call it." */ 303 may call it." */
@@ -254,43 +309,6 @@ void __init parse_early_param(void);
254#define __initdata_or_module __initdata 309#define __initdata_or_module __initdata
255#endif /*CONFIG_MODULES*/ 310#endif /*CONFIG_MODULES*/
256 311
257#ifdef CONFIG_HOTPLUG
258#define __devinit
259#define __devinitdata
260#define __devexit
261#define __devexitdata
262#else
263#define __devinit __init
264#define __devinitdata __initdata
265#define __devexit __exit
266#define __devexitdata __exitdata
267#endif
268
269#ifdef CONFIG_HOTPLUG_CPU
270#define __cpuinit
271#define __cpuinitdata
272#define __cpuexit
273#define __cpuexitdata
274#else
275#define __cpuinit __init
276#define __cpuinitdata __initdata
277#define __cpuexit __exit
278#define __cpuexitdata __exitdata
279#endif
280
281#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
282 || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
283#define __meminit
284#define __meminitdata
285#define __memexit
286#define __memexitdata
287#else
288#define __meminit __init
289#define __meminitdata __initdata
290#define __memexit __exit
291#define __memexitdata __exitdata
292#endif
293
294/* Functions marked as __devexit may be discarded at kernel link time, depending 312/* Functions marked as __devexit may be discarded at kernel link time, depending
295 on config options. Newer versions of binutils detect references from 313 on config options. Newer versions of binutils detect references from
296 retained sections to discarded sections and flag an error. Pointers to 314 retained sections to discarded sections and flag an error. Pointers to
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 06ef11457051..2cbf6fdb1799 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -149,6 +149,28 @@ typedef struct journal_header_s
149 __be32 h_sequence; 149 __be32 h_sequence;
150} journal_header_t; 150} journal_header_t;
151 151
152/*
153 * Checksum types.
154 */
155#define JBD2_CRC32_CHKSUM 1
156#define JBD2_MD5_CHKSUM 2
157#define JBD2_SHA1_CHKSUM 3
158
159#define JBD2_CRC32_CHKSUM_SIZE 4
160
161#define JBD2_CHECKSUM_BYTES (32 / sizeof(u32))
162/*
163 * Commit block header for storing transactional checksums:
164 */
165struct commit_header {
166 __be32 h_magic;
167 __be32 h_blocktype;
168 __be32 h_sequence;
169 unsigned char h_chksum_type;
170 unsigned char h_chksum_size;
171 unsigned char h_padding[2];
172 __be32 h_chksum[JBD2_CHECKSUM_BYTES];
173};
152 174
153/* 175/*
154 * The block tag: used to describe a single buffer in the journal. 176 * The block tag: used to describe a single buffer in the journal.
@@ -242,31 +264,25 @@ typedef struct journal_superblock_s
242 ((j)->j_format_version >= 2 && \ 264 ((j)->j_format_version >= 2 && \
243 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) 265 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
244 266
245#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001 267#define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
246#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 268
269#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
270#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
271#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
247 272
248/* Features known to this kernel version: */ 273/* Features known to this kernel version: */
249#define JBD2_KNOWN_COMPAT_FEATURES 0 274#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
250#define JBD2_KNOWN_ROCOMPAT_FEATURES 0 275#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
251#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ 276#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
252 JBD2_FEATURE_INCOMPAT_64BIT) 277 JBD2_FEATURE_INCOMPAT_64BIT | \
278 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
253 279
254#ifdef __KERNEL__ 280#ifdef __KERNEL__
255 281
256#include <linux/fs.h> 282#include <linux/fs.h>
257#include <linux/sched.h> 283#include <linux/sched.h>
258 284
259#define JBD2_ASSERTIONS 285#define J_ASSERT(assert) BUG_ON(!(assert))
260#ifdef JBD2_ASSERTIONS
261#define J_ASSERT(assert) \
262do { \
263 if (!(assert)) { \
264 printk (KERN_EMERG \
265 "Assertion failure in %s() at %s:%d: \"%s\"\n", \
266 __FUNCTION__, __FILE__, __LINE__, # assert); \
267 BUG(); \
268 } \
269} while (0)
270 286
271#if defined(CONFIG_BUFFER_DEBUG) 287#if defined(CONFIG_BUFFER_DEBUG)
272void buffer_assertion_failure(struct buffer_head *bh); 288void buffer_assertion_failure(struct buffer_head *bh);
@@ -282,10 +298,6 @@ void buffer_assertion_failure(struct buffer_head *bh);
282#define J_ASSERT_JH(jh, expr) J_ASSERT(expr) 298#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
283#endif 299#endif
284 300
285#else
286#define J_ASSERT(assert) do { } while (0)
287#endif /* JBD2_ASSERTIONS */
288
289#if defined(JBD2_PARANOID_IOFAIL) 301#if defined(JBD2_PARANOID_IOFAIL)
290#define J_EXPECT(expr, why...) J_ASSERT(expr) 302#define J_EXPECT(expr, why...) J_ASSERT(expr)
291#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr) 303#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
@@ -406,9 +418,23 @@ struct handle_s
406 unsigned int h_sync: 1; /* sync-on-close */ 418 unsigned int h_sync: 1; /* sync-on-close */
407 unsigned int h_jdata: 1; /* force data journaling */ 419 unsigned int h_jdata: 1; /* force data journaling */
408 unsigned int h_aborted: 1; /* fatal error on handle */ 420 unsigned int h_aborted: 1; /* fatal error on handle */
421
422#ifdef CONFIG_DEBUG_LOCK_ALLOC
423 struct lockdep_map h_lockdep_map;
424#endif
409}; 425};
410 426
411 427
428/*
429 * Some stats for checkpoint phase
430 */
431struct transaction_chp_stats_s {
432 unsigned long cs_chp_time;
433 unsigned long cs_forced_to_close;
434 unsigned long cs_written;
435 unsigned long cs_dropped;
436};
437
412/* The transaction_t type is the guts of the journaling mechanism. It 438/* The transaction_t type is the guts of the journaling mechanism. It
413 * tracks a compound transaction through its various states: 439 * tracks a compound transaction through its various states:
414 * 440 *
@@ -456,6 +482,8 @@ struct transaction_s
456 /* 482 /*
457 * Transaction's current state 483 * Transaction's current state
458 * [no locking - only kjournald2 alters this] 484 * [no locking - only kjournald2 alters this]
485 * [j_list_lock] guards transition of a transaction into T_FINISHED
486 * state and subsequent call of __jbd2_journal_drop_transaction()
459 * FIXME: needs barriers 487 * FIXME: needs barriers
460 * KLUDGE: [use j_state_lock] 488 * KLUDGE: [use j_state_lock]
461 */ 489 */
@@ -544,6 +572,21 @@ struct transaction_s
544 spinlock_t t_handle_lock; 572 spinlock_t t_handle_lock;
545 573
546 /* 574 /*
575 * Longest time some handle had to wait for running transaction
576 */
577 unsigned long t_max_wait;
578
579 /*
580 * When transaction started
581 */
582 unsigned long t_start;
583
584 /*
585 * Checkpointing stats [j_checkpoint_sem]
586 */
587 struct transaction_chp_stats_s t_chp_stats;
588
589 /*
547 * Number of outstanding updates running on this transaction 590 * Number of outstanding updates running on this transaction
548 * [t_handle_lock] 591 * [t_handle_lock]
549 */ 592 */
@@ -574,6 +617,39 @@ struct transaction_s
574 617
575}; 618};
576 619
620struct transaction_run_stats_s {
621 unsigned long rs_wait;
622 unsigned long rs_running;
623 unsigned long rs_locked;
624 unsigned long rs_flushing;
625 unsigned long rs_logging;
626
627 unsigned long rs_handle_count;
628 unsigned long rs_blocks;
629 unsigned long rs_blocks_logged;
630};
631
632struct transaction_stats_s {
633 int ts_type;
634 unsigned long ts_tid;
635 union {
636 struct transaction_run_stats_s run;
637 struct transaction_chp_stats_s chp;
638 } u;
639};
640
641#define JBD2_STATS_RUN 1
642#define JBD2_STATS_CHECKPOINT 2
643
644static inline unsigned long
645jbd2_time_diff(unsigned long start, unsigned long end)
646{
647 if (end >= start)
648 return end - start;
649
650 return end + (MAX_JIFFY_OFFSET - start);
651}
652
577/** 653/**
578 * struct journal_s - The journal_s type is the concrete type associated with 654 * struct journal_s - The journal_s type is the concrete type associated with
579 * journal_t. 655 * journal_t.
@@ -635,6 +711,12 @@ struct transaction_s
635 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the 711 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
636 * number that will fit in j_blocksize 712 * number that will fit in j_blocksize
637 * @j_last_sync_writer: most recent pid which did a synchronous write 713 * @j_last_sync_writer: most recent pid which did a synchronous write
714 * @j_history: Buffer storing the transactions statistics history
715 * @j_history_max: Maximum number of transactions in the statistics history
716 * @j_history_cur: Current number of transactions in the statistics history
717 * @j_history_lock: Protect the transactions statistics history
718 * @j_proc_entry: procfs entry for the jbd statistics directory
719 * @j_stats: Overall statistics
638 * @j_private: An opaque pointer to fs-private information. 720 * @j_private: An opaque pointer to fs-private information.
639 */ 721 */
640 722
@@ -827,6 +909,19 @@ struct journal_s
827 pid_t j_last_sync_writer; 909 pid_t j_last_sync_writer;
828 910
829 /* 911 /*
912 * Journal statistics
913 */
914 struct transaction_stats_s *j_history;
915 int j_history_max;
916 int j_history_cur;
917 /*
918 * Protect the transactions statistics history
919 */
920 spinlock_t j_history_lock;
921 struct proc_dir_entry *j_proc_entry;
922 struct transaction_stats_s j_stats;
923
924 /*
830 * An opaque pointer to fs-private information. ext3 puts its 925 * An opaque pointer to fs-private information. ext3 puts its
831 * superblock pointer here 926 * superblock pointer here
832 */ 927 */
@@ -932,6 +1027,8 @@ extern int jbd2_journal_check_available_features
932 (journal_t *, unsigned long, unsigned long, unsigned long); 1027 (journal_t *, unsigned long, unsigned long, unsigned long);
933extern int jbd2_journal_set_features 1028extern int jbd2_journal_set_features
934 (journal_t *, unsigned long, unsigned long, unsigned long); 1029 (journal_t *, unsigned long, unsigned long, unsigned long);
1030extern void jbd2_journal_clear_features
1031 (journal_t *, unsigned long, unsigned long, unsigned long);
935extern int jbd2_journal_create (journal_t *); 1032extern int jbd2_journal_create (journal_t *);
936extern int jbd2_journal_load (journal_t *journal); 1033extern int jbd2_journal_load (journal_t *journal);
937extern void jbd2_journal_destroy (journal_t *); 1034extern void jbd2_journal_destroy (journal_t *);
diff --git a/include/linux/module.h b/include/linux/module.h
index c97bdb7eb957..ac481e2094fd 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
178#define __CRC_SYMBOL(sym, sec) \ 178#define __CRC_SYMBOL(sym, sec) \
179 extern void *__crc_##sym __attribute__((weak)); \ 179 extern void *__crc_##sym __attribute__((weak)); \
180 static const unsigned long __kcrctab_##sym \ 180 static const unsigned long __kcrctab_##sym \
181 __attribute_used__ \ 181 __used \
182 __attribute__((section("__kcrctab" sec), unused)) \ 182 __attribute__((section("__kcrctab" sec), unused)) \
183 = (unsigned long) &__crc_##sym; 183 = (unsigned long) &__crc_##sym;
184#else 184#else
@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
193 __attribute__((section("__ksymtab_strings"))) \ 193 __attribute__((section("__ksymtab_strings"))) \
194 = MODULE_SYMBOL_PREFIX #sym; \ 194 = MODULE_SYMBOL_PREFIX #sym; \
195 static const struct kernel_symbol __ksymtab_##sym \ 195 static const struct kernel_symbol __ksymtab_##sym \
196 __attribute_used__ \ 196 __used \
197 __attribute__((section("__ksymtab" sec), unused)) \ 197 __attribute__((section("__ksymtab" sec), unused)) \
198 = { (unsigned long)&sym, __kstrtab_##sym } 198 = { (unsigned long)&sym, __kstrtab_##sym }
199 199
@@ -446,11 +446,14 @@ static inline void __module_get(struct module *module)
446 __mod ? __mod->name : "kernel"; \ 446 __mod ? __mod->name : "kernel"; \
447}) 447})
448 448
449/* For kallsyms to ask for address resolution. NULL means not found. */ 449/* For kallsyms to ask for address resolution. namebuf should be at
450const char *module_address_lookup(unsigned long addr, 450 * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
451 unsigned long *symbolsize, 451 * found, otherwise NULL. */
452 unsigned long *offset, 452char *module_address_lookup(unsigned long addr,
453 char **modname); 453 unsigned long *symbolsize,
454 unsigned long *offset,
455 char **modname,
456 char *namebuf);
454int lookup_module_symbol_name(unsigned long addr, char *symname); 457int lookup_module_symbol_name(unsigned long addr, char *symname);
455int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); 458int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
456 459
@@ -516,10 +519,11 @@ static inline void module_put(struct module *module)
516#define module_name(mod) "kernel" 519#define module_name(mod) "kernel"
517 520
518/* For kallsyms to ask for address resolution. NULL means not found. */ 521/* For kallsyms to ask for address resolution. NULL means not found. */
519static inline const char *module_address_lookup(unsigned long addr, 522static inline char *module_address_lookup(unsigned long addr,
520 unsigned long *symbolsize, 523 unsigned long *symbolsize,
521 unsigned long *offset, 524 unsigned long *offset,
522 char **modname) 525 char **modname,
526 char *namebuf)
523{ 527{
524 return NULL; 528 return NULL;
525} 529}
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 13410b20600f..8126e55c5bdc 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -18,7 +18,7 @@
18#define __module_cat(a,b) ___module_cat(a,b) 18#define __module_cat(a,b) ___module_cat(a,b)
19#define __MODULE_INFO(tag, name, info) \ 19#define __MODULE_INFO(tag, name, info) \
20static const char __module_cat(name,__LINE__)[] \ 20static const char __module_cat(name,__LINE__)[] \
21 __attribute_used__ \ 21 __used \
22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info 22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
23#else /* !MODULE */ 23#else /* !MODULE */
24#define __MODULE_INFO(tag, name, info) 24#define __MODULE_INFO(tag, name, info)
@@ -72,7 +72,7 @@ struct kparam_array
72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ 72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
73 static const char __param_str_##name[] = prefix #name; \ 73 static const char __param_str_##name[] = prefix #name; \
74 static struct kernel_param const __param_##name \ 74 static struct kernel_param const __param_##name \
75 __attribute_used__ \ 75 __used \
76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
77 = { __param_str_##name, perm, set, get, { arg } } 77 = { __param_str_##name, perm, set, get, { arg } }
78 78
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0dd93bb62fbe..ae1006322f80 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -867,7 +867,7 @@ enum pci_fixup_pass {
867 867
868/* Anonymous variables would be nice... */ 868/* Anonymous variables would be nice... */
869#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 869#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
870 static const struct pci_fixup __pci_fixup_##name __attribute_used__ \ 870 static const struct pci_fixup __pci_fixup_##name __used \
871 __attribute__((__section__(#section))) = { vendor, device, hook }; 871 __attribute__((__section__(#section))) = { vendor, device, hook };
872#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 872#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
873 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 873 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \