1 |
Author: mpagano |
2 |
Date: 2010-09-27 14:27:37 +0000 (Mon, 27 Sep 2010) |
3 |
New Revision: 1794 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/2.6.32/1022_linux-2.6.32.23.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/2.6.32/0000_README |
9 |
Log: |
10 |
Linux patch 2.6.32.23 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/2.6.32/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/2.6.32/0000_README 2010-09-21 20:35:06 UTC (rev 1793) |
15 |
+++ genpatches-2.6/trunk/2.6.32/0000_README 2010-09-27 14:27:37 UTC (rev 1794) |
16 |
@@ -127,6 +127,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 2.6.32.22 |
19 |
|
20 |
+Patch: 1022_linux-2.6.32.23.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 2.6.32.23 |
23 |
+ |
24 |
Patch: 2500_libata-fix-truncated-LBA48-ret-vals.patch |
25 |
From: http://bugs.gentoo.org/show_bug.cgi?id=303313 |
26 |
Desc: Fix bug which truncated LBA48 return values |
27 |
|
28 |
Added: genpatches-2.6/trunk/2.6.32/1022_linux-2.6.32.23.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/2.6.32/1022_linux-2.6.32.23.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/2.6.32/1022_linux-2.6.32.23.patch 2010-09-27 14:27:37 UTC (rev 1794) |
32 |
@@ -0,0 +1,3403 @@ |
33 |
+diff --git a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c |
34 |
+index 52a79df..5c905aa 100644 |
35 |
+--- a/arch/alpha/kernel/err_marvel.c |
36 |
++++ b/arch/alpha/kernel/err_marvel.c |
37 |
+@@ -109,7 +109,7 @@ marvel_print_err_cyc(u64 err_cyc) |
38 |
+ #define IO7__ERR_CYC__CYCLE__M (0x7) |
39 |
+ |
40 |
+ printk("%s Packet In Error: %s\n" |
41 |
+- "%s Error in %s, cycle %ld%s%s\n", |
42 |
++ "%s Error in %s, cycle %lld%s%s\n", |
43 |
+ err_print_prefix, |
44 |
+ packet_desc[EXTRACT(err_cyc, IO7__ERR_CYC__PACKET)], |
45 |
+ err_print_prefix, |
46 |
+@@ -313,7 +313,7 @@ marvel_print_po7_ugbge_sym(u64 ugbge_sym) |
47 |
+ } |
48 |
+ |
49 |
+ printk("%s Up Hose Garbage Symptom:\n" |
50 |
+- "%s Source Port: %ld - Dest PID: %ld - OpCode: %s\n", |
51 |
++ "%s Source Port: %lld - Dest PID: %lld - OpCode: %s\n", |
52 |
+ err_print_prefix, |
53 |
+ err_print_prefix, |
54 |
+ EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_SRC_PORT), |
55 |
+@@ -552,7 +552,7 @@ marvel_print_pox_spl_cmplt(u64 spl_cmplt) |
56 |
+ #define IO7__POX_SPLCMPLT__REM_BYTE_COUNT__M (0xfff) |
57 |
+ |
58 |
+ printk("%s Split Completion Error:\n" |
59 |
+- "%s Source (Bus:Dev:Func): %ld:%ld:%ld\n", |
60 |
++ "%s Source (Bus:Dev:Func): %lld:%lld:%lld\n", |
61 |
+ err_print_prefix, |
62 |
+ err_print_prefix, |
63 |
+ EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__SOURCE_BUS), |
64 |
+diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c |
65 |
+index 332b784..2f7e498 100644 |
66 |
+--- a/arch/arm/mach-at91/at91sam9g45_devices.c |
67 |
++++ b/arch/arm/mach-at91/at91sam9g45_devices.c |
68 |
+@@ -46,7 +46,7 @@ static struct resource hdmac_resources[] = { |
69 |
+ .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, |
70 |
+ .flags = IORESOURCE_MEM, |
71 |
+ }, |
72 |
+- [2] = { |
73 |
++ [1] = { |
74 |
+ .start = AT91SAM9G45_ID_DMA, |
75 |
+ .end = AT91SAM9G45_ID_DMA, |
76 |
+ .flags = IORESOURCE_IRQ, |
77 |
+diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S |
78 |
+index 3567d54..331d42b 100644 |
79 |
+--- a/arch/ia64/kernel/fsys.S |
80 |
++++ b/arch/ia64/kernel/fsys.S |
81 |
+@@ -420,22 +420,31 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set |
82 |
+ ;; |
83 |
+ |
84 |
+ RSM_PSR_I(p0, r18, r19) // mask interrupt delivery |
85 |
+- mov ar.ccv=0 |
86 |
+ andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP |
87 |
++ mov r8=EINVAL // default to EINVAL |
88 |
+ |
89 |
+ #ifdef CONFIG_SMP |
90 |
+- mov r17=1 |
91 |
++ // __ticket_spin_trylock(r31) |
92 |
++ ld4 r17=[r31] |
93 |
+ ;; |
94 |
+- cmpxchg4.acq r18=[r31],r17,ar.ccv // try to acquire the lock |
95 |
+- mov r8=EINVAL // default to EINVAL |
96 |
++ mov.m ar.ccv=r17 |
97 |
++ extr.u r9=r17,17,15 |
98 |
++ adds r19=1,r17 |
99 |
++ extr.u r18=r17,0,15 |
100 |
++ ;; |
101 |
++ cmp.eq p6,p7=r9,r18 |
102 |
+ ;; |
103 |
++(p6) cmpxchg4.acq r9=[r31],r19,ar.ccv |
104 |
++(p6) dep.z r20=r19,1,15 // next serving ticket for unlock |
105 |
++(p7) br.cond.spnt.many .lock_contention |
106 |
++ ;; |
107 |
++ cmp4.eq p0,p7=r9,r17 |
108 |
++ adds r31=2,r31 |
109 |
++(p7) br.cond.spnt.many .lock_contention |
110 |
+ ld8 r3=[r2] // re-read current->blocked now that we hold the lock |
111 |
+- cmp4.ne p6,p0=r18,r0 |
112 |
+-(p6) br.cond.spnt.many .lock_contention |
113 |
+ ;; |
114 |
+ #else |
115 |
+ ld8 r3=[r2] // re-read current->blocked now that we hold the lock |
116 |
+- mov r8=EINVAL // default to EINVAL |
117 |
+ #endif |
118 |
+ add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16 |
119 |
+ add r19=IA64_TASK_SIGNAL_OFFSET,r16 |
120 |
+@@ -490,7 +499,9 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set |
121 |
+ (p6) br.cond.spnt.few 1b // yes -> retry |
122 |
+ |
123 |
+ #ifdef CONFIG_SMP |
124 |
+- st4.rel [r31]=r0 // release the lock |
125 |
++ // __ticket_spin_unlock(r31) |
126 |
++ st2.rel [r31]=r20 |
127 |
++ mov r20=0 // i must not leak kernel bits... |
128 |
+ #endif |
129 |
+ SSM_PSR_I(p0, p9, r31) |
130 |
+ ;; |
131 |
+@@ -512,7 +523,8 @@ EX(.fail_efault, (p15) st8 [r34]=r3) |
132 |
+ |
133 |
+ .sig_pending: |
134 |
+ #ifdef CONFIG_SMP |
135 |
+- st4.rel [r31]=r0 // release the lock |
136 |
++ // __ticket_spin_unlock(r31) |
137 |
++ st2.rel [r31]=r20 // release the lock |
138 |
+ #endif |
139 |
+ SSM_PSR_I(p0, p9, r17) |
140 |
+ ;; |
141 |
+diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h |
142 |
+index dd75d67..09e7128 100644 |
143 |
+--- a/arch/mips/include/asm/atomic.h |
144 |
++++ b/arch/mips/include/asm/atomic.h |
145 |
+@@ -434,7 +434,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v) |
146 |
+ __asm__ __volatile__( |
147 |
+ " .set mips3 \n" |
148 |
+ "1: lld %0, %1 # atomic64_add \n" |
149 |
+- " addu %0, %2 \n" |
150 |
++ " daddu %0, %2 \n" |
151 |
+ " scd %0, %1 \n" |
152 |
+ " beqzl %0, 1b \n" |
153 |
+ " .set mips0 \n" |
154 |
+@@ -446,7 +446,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v) |
155 |
+ __asm__ __volatile__( |
156 |
+ " .set mips3 \n" |
157 |
+ "1: lld %0, %1 # atomic64_add \n" |
158 |
+- " addu %0, %2 \n" |
159 |
++ " daddu %0, %2 \n" |
160 |
+ " scd %0, %1 \n" |
161 |
+ " beqz %0, 2f \n" |
162 |
+ " .subsection 2 \n" |
163 |
+@@ -479,7 +479,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v) |
164 |
+ __asm__ __volatile__( |
165 |
+ " .set mips3 \n" |
166 |
+ "1: lld %0, %1 # atomic64_sub \n" |
167 |
+- " subu %0, %2 \n" |
168 |
++ " dsubu %0, %2 \n" |
169 |
+ " scd %0, %1 \n" |
170 |
+ " beqzl %0, 1b \n" |
171 |
+ " .set mips0 \n" |
172 |
+@@ -491,7 +491,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v) |
173 |
+ __asm__ __volatile__( |
174 |
+ " .set mips3 \n" |
175 |
+ "1: lld %0, %1 # atomic64_sub \n" |
176 |
+- " subu %0, %2 \n" |
177 |
++ " dsubu %0, %2 \n" |
178 |
+ " scd %0, %1 \n" |
179 |
+ " beqz %0, 2f \n" |
180 |
+ " .subsection 2 \n" |
181 |
+@@ -524,10 +524,10 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v) |
182 |
+ __asm__ __volatile__( |
183 |
+ " .set mips3 \n" |
184 |
+ "1: lld %1, %2 # atomic64_add_return \n" |
185 |
+- " addu %0, %1, %3 \n" |
186 |
++ " daddu %0, %1, %3 \n" |
187 |
+ " scd %0, %2 \n" |
188 |
+ " beqzl %0, 1b \n" |
189 |
+- " addu %0, %1, %3 \n" |
190 |
++ " daddu %0, %1, %3 \n" |
191 |
+ " .set mips0 \n" |
192 |
+ : "=&r" (result), "=&r" (temp), "=m" (v->counter) |
193 |
+ : "Ir" (i), "m" (v->counter) |
194 |
+@@ -538,10 +538,10 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v) |
195 |
+ __asm__ __volatile__( |
196 |
+ " .set mips3 \n" |
197 |
+ "1: lld %1, %2 # atomic64_add_return \n" |
198 |
+- " addu %0, %1, %3 \n" |
199 |
++ " daddu %0, %1, %3 \n" |
200 |
+ " scd %0, %2 \n" |
201 |
+ " beqz %0, 2f \n" |
202 |
+- " addu %0, %1, %3 \n" |
203 |
++ " daddu %0, %1, %3 \n" |
204 |
+ " .subsection 2 \n" |
205 |
+ "2: b 1b \n" |
206 |
+ " .previous \n" |
207 |
+@@ -576,10 +576,10 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) |
208 |
+ __asm__ __volatile__( |
209 |
+ " .set mips3 \n" |
210 |
+ "1: lld %1, %2 # atomic64_sub_return \n" |
211 |
+- " subu %0, %1, %3 \n" |
212 |
++ " dsubu %0, %1, %3 \n" |
213 |
+ " scd %0, %2 \n" |
214 |
+ " beqzl %0, 1b \n" |
215 |
+- " subu %0, %1, %3 \n" |
216 |
++ " dsubu %0, %1, %3 \n" |
217 |
+ " .set mips0 \n" |
218 |
+ : "=&r" (result), "=&r" (temp), "=m" (v->counter) |
219 |
+ : "Ir" (i), "m" (v->counter) |
220 |
+@@ -590,10 +590,10 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) |
221 |
+ __asm__ __volatile__( |
222 |
+ " .set mips3 \n" |
223 |
+ "1: lld %1, %2 # atomic64_sub_return \n" |
224 |
+- " subu %0, %1, %3 \n" |
225 |
++ " dsubu %0, %1, %3 \n" |
226 |
+ " scd %0, %2 \n" |
227 |
+ " beqz %0, 2f \n" |
228 |
+- " subu %0, %1, %3 \n" |
229 |
++ " dsubu %0, %1, %3 \n" |
230 |
+ " .subsection 2 \n" |
231 |
+ "2: b 1b \n" |
232 |
+ " .previous \n" |
233 |
+diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c |
234 |
+index 5adba4f..266c003 100644 |
235 |
+--- a/arch/mips/mm/tlbex.c |
236 |
++++ b/arch/mips/mm/tlbex.c |
237 |
+@@ -725,10 +725,15 @@ static void __cpuinit build_r4000_tlb_refill_handler(void) |
238 |
+ * create the plain linear handler |
239 |
+ */ |
240 |
+ if (bcm1250_m3_war()) { |
241 |
+- UASM_i_MFC0(&p, K0, C0_BADVADDR); |
242 |
+- UASM_i_MFC0(&p, K1, C0_ENTRYHI); |
243 |
++ unsigned int segbits = 44; |
244 |
++ |
245 |
++ uasm_i_dmfc0(&p, K0, C0_BADVADDR); |
246 |
++ uasm_i_dmfc0(&p, K1, C0_ENTRYHI); |
247 |
+ uasm_i_xor(&p, K0, K0, K1); |
248 |
+- UASM_i_SRL(&p, K0, K0, PAGE_SHIFT + 1); |
249 |
++ uasm_i_dsrl32(&p, K1, K0, 62 - 32); |
250 |
++ uasm_i_dsrl(&p, K0, K0, 12 + 1); |
251 |
++ uasm_i_dsll32(&p, K0, K0, 64 + 12 + 1 - segbits - 32); |
252 |
++ uasm_i_or(&p, K0, K0, K1); |
253 |
+ uasm_il_bnez(&p, &r, K0, label_leave); |
254 |
+ /* No need for uasm_i_nop */ |
255 |
+ } |
256 |
+@@ -1242,10 +1247,15 @@ static void __cpuinit build_r4000_tlb_load_handler(void) |
257 |
+ memset(relocs, 0, sizeof(relocs)); |
258 |
+ |
259 |
+ if (bcm1250_m3_war()) { |
260 |
+- UASM_i_MFC0(&p, K0, C0_BADVADDR); |
261 |
+- UASM_i_MFC0(&p, K1, C0_ENTRYHI); |
262 |
++ unsigned int segbits = 44; |
263 |
++ |
264 |
++ uasm_i_dmfc0(&p, K0, C0_BADVADDR); |
265 |
++ uasm_i_dmfc0(&p, K1, C0_ENTRYHI); |
266 |
+ uasm_i_xor(&p, K0, K0, K1); |
267 |
+- UASM_i_SRL(&p, K0, K0, PAGE_SHIFT + 1); |
268 |
++ uasm_i_dsrl32(&p, K1, K0, 62 - 32); |
269 |
++ uasm_i_dsrl(&p, K0, K0, 12 + 1); |
270 |
++ uasm_i_dsll32(&p, K0, K0, 64 + 12 + 1 - segbits - 32); |
271 |
++ uasm_i_or(&p, K0, K0, K1); |
272 |
+ uasm_il_bnez(&p, &r, K0, label_leave); |
273 |
+ /* No need for uasm_i_nop */ |
274 |
+ } |
275 |
+diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c |
276 |
+index f467199..e1bd527 100644 |
277 |
+--- a/arch/mips/mm/uasm.c |
278 |
++++ b/arch/mips/mm/uasm.c |
279 |
+@@ -62,7 +62,7 @@ enum opcode { |
280 |
+ insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, |
281 |
+ insn_dsrl32, insn_dsubu, insn_eret, insn_j, insn_jal, insn_jr, |
282 |
+ insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0, |
283 |
+- insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd, |
284 |
++ insn_mtc0, insn_or, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd, |
285 |
+ insn_sd, insn_sll, insn_sra, insn_srl, insn_subu, insn_sw, |
286 |
+ insn_tlbp, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori |
287 |
+ }; |
288 |
+@@ -116,6 +116,7 @@ static struct insn insn_table[] __cpuinitdata = { |
289 |
+ { insn_lw, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
290 |
+ { insn_mfc0, M(cop0_op, mfc_op, 0, 0, 0, 0), RT | RD | SET}, |
291 |
+ { insn_mtc0, M(cop0_op, mtc_op, 0, 0, 0, 0), RT | RD | SET}, |
292 |
++ { insn_or, M(spec_op, 0, 0, 0, 0, or_op), RS | RT | RD }, |
293 |
+ { insn_ori, M(ori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, |
294 |
+ { insn_pref, M(pref_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
295 |
+ { insn_rfe, M(cop0_op, cop_op, 0, 0, 0, rfe_op), 0 }, |
296 |
+@@ -362,6 +363,7 @@ I_u2s3u1(_lw) |
297 |
+ I_u1u2u3(_mfc0) |
298 |
+ I_u1u2u3(_mtc0) |
299 |
+ I_u2u1u3(_ori) |
300 |
++I_u3u1u2(_or) |
301 |
+ I_u2s3u1(_pref) |
302 |
+ I_0(_rfe) |
303 |
+ I_u2s3u1(_sc) |
304 |
+diff --git a/arch/mips/mm/uasm.h b/arch/mips/mm/uasm.h |
305 |
+index c6d1e3d..5198ae5 100644 |
306 |
+--- a/arch/mips/mm/uasm.h |
307 |
++++ b/arch/mips/mm/uasm.h |
308 |
+@@ -78,6 +78,7 @@ Ip_u2s3u1(_lw); |
309 |
+ Ip_u1u2u3(_mfc0); |
310 |
+ Ip_u1u2u3(_mtc0); |
311 |
+ Ip_u2u1u3(_ori); |
312 |
++Ip_u3u1u2(_or); |
313 |
+ Ip_u2s3u1(_pref); |
314 |
+ Ip_0(_rfe); |
315 |
+ Ip_u2s3u1(_sc); |
316 |
+diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c |
317 |
+index 2fbfa1a..bf80921 100644 |
318 |
+--- a/arch/mips/mti-malta/malta-pci.c |
319 |
++++ b/arch/mips/mti-malta/malta-pci.c |
320 |
+@@ -247,6 +247,8 @@ void __init mips_pcibios_init(void) |
321 |
+ iomem_resource.end &= 0xfffffffffULL; /* 64 GB */ |
322 |
+ ioport_resource.end = controller->io_resource->end; |
323 |
+ |
324 |
++ controller->io_map_base = mips_io_port_base; |
325 |
++ |
326 |
+ register_pci_controller(controller); |
327 |
+ } |
328 |
+ |
329 |
+diff --git a/arch/mips/nxp/pnx8550/common/pci.c b/arch/mips/nxp/pnx8550/common/pci.c |
330 |
+index eee4f3d..98e86dd 100644 |
331 |
+--- a/arch/mips/nxp/pnx8550/common/pci.c |
332 |
++++ b/arch/mips/nxp/pnx8550/common/pci.c |
333 |
+@@ -44,6 +44,7 @@ extern struct pci_ops pnx8550_pci_ops; |
334 |
+ |
335 |
+ static struct pci_controller pnx8550_controller = { |
336 |
+ .pci_ops = &pnx8550_pci_ops, |
337 |
++ .io_map_base = PNX8550_PORT_BASE, |
338 |
+ .io_resource = &pci_io_resource, |
339 |
+ .mem_resource = &pci_mem_resource, |
340 |
+ }; |
341 |
+diff --git a/arch/mips/nxp/pnx8550/common/setup.c b/arch/mips/nxp/pnx8550/common/setup.c |
342 |
+index 2aed50f..64246c9 100644 |
343 |
+--- a/arch/mips/nxp/pnx8550/common/setup.c |
344 |
++++ b/arch/mips/nxp/pnx8550/common/setup.c |
345 |
+@@ -113,7 +113,7 @@ void __init plat_mem_setup(void) |
346 |
+ PNX8550_GLB2_ENAB_INTA_O = 0; |
347 |
+ |
348 |
+ /* IO/MEM resources. */ |
349 |
+- set_io_port_base(KSEG1); |
350 |
++ set_io_port_base(PNX8550_PORT_BASE); |
351 |
+ ioport_resource.start = 0; |
352 |
+ ioport_resource.end = ~0; |
353 |
+ iomem_resource.start = 0; |
354 |
+diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c |
355 |
+index 32548b5..421e1a0 100644 |
356 |
+--- a/arch/mips/pci/ops-pmcmsp.c |
357 |
++++ b/arch/mips/pci/ops-pmcmsp.c |
358 |
+@@ -944,6 +944,7 @@ static struct pci_controller msp_pci_controller = { |
359 |
+ .pci_ops = &msp_pci_ops, |
360 |
+ .mem_resource = &pci_mem_resource, |
361 |
+ .mem_offset = 0, |
362 |
++ .io_map_base = MSP_PCI_IOSPACE_BASE, |
363 |
+ .io_resource = &pci_io_resource, |
364 |
+ .io_offset = 0 |
365 |
+ }; |
366 |
+diff --git a/arch/mips/pci/pci-yosemite.c b/arch/mips/pci/pci-yosemite.c |
367 |
+index 0357946..cf5e1a2 100644 |
368 |
+--- a/arch/mips/pci/pci-yosemite.c |
369 |
++++ b/arch/mips/pci/pci-yosemite.c |
370 |
+@@ -54,6 +54,7 @@ static int __init pmc_yosemite_setup(void) |
371 |
+ panic(ioremap_failed); |
372 |
+ |
373 |
+ set_io_port_base(io_v_base); |
374 |
++ py_controller.io_map_base = io_v_base; |
375 |
+ TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1); |
376 |
+ |
377 |
+ ioport_resource.end = TITAN_IO_SIZE - 1; |
378 |
+diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h |
379 |
+index 679c750..2889574 100644 |
380 |
+--- a/arch/sparc/include/asm/io_32.h |
381 |
++++ b/arch/sparc/include/asm/io_32.h |
382 |
+@@ -249,10 +249,14 @@ extern void iounmap(volatile void __iomem *addr); |
383 |
+ |
384 |
+ #define ioread8(X) readb(X) |
385 |
+ #define ioread16(X) readw(X) |
386 |
++#define ioread16be(X) __raw_readw(X) |
387 |
+ #define ioread32(X) readl(X) |
388 |
++#define ioread32be(X) __raw_readl(X) |
389 |
+ #define iowrite8(val,X) writeb(val,X) |
390 |
+ #define iowrite16(val,X) writew(val,X) |
391 |
++#define iowrite16be(val,X) __raw_writew(val,X) |
392 |
+ #define iowrite32(val,X) writel(val,X) |
393 |
++#define iowrite32be(val,X) __raw_writel(val,X) |
394 |
+ |
395 |
+ static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) |
396 |
+ { |
397 |
+diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h |
398 |
+index 4aee21d..9517d06 100644 |
399 |
+--- a/arch/sparc/include/asm/io_64.h |
400 |
++++ b/arch/sparc/include/asm/io_64.h |
401 |
+@@ -468,10 +468,14 @@ static inline void iounmap(volatile void __iomem *addr) |
402 |
+ |
403 |
+ #define ioread8(X) readb(X) |
404 |
+ #define ioread16(X) readw(X) |
405 |
++#define ioread16be(X) __raw_readw(X) |
406 |
+ #define ioread32(X) readl(X) |
407 |
++#define ioread32be(X) __raw_readl(X) |
408 |
+ #define iowrite8(val,X) writeb(val,X) |
409 |
+ #define iowrite16(val,X) writew(val,X) |
410 |
++#define iowrite16be(val,X) __raw_writew(val,X) |
411 |
+ #define iowrite32(val,X) writel(val,X) |
412 |
++#define iowrite32be(val,X) __raw_writel(val,X) |
413 |
+ |
414 |
+ /* Create a virtual mapping cookie for an IO port range */ |
415 |
+ extern void __iomem *ioport_map(unsigned long port, unsigned int nr); |
416 |
+diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h |
417 |
+index a5db031..3e0b2d6 100644 |
418 |
+--- a/arch/sparc/include/asm/oplib_64.h |
419 |
++++ b/arch/sparc/include/asm/oplib_64.h |
420 |
+@@ -185,9 +185,8 @@ extern int prom_getunumber(int syndrome_code, |
421 |
+ char *buf, int buflen); |
422 |
+ |
423 |
+ /* Retain physical memory to the caller across soft resets. */ |
424 |
+-extern unsigned long prom_retain(const char *name, |
425 |
+- unsigned long pa_low, unsigned long pa_high, |
426 |
+- long size, long align); |
427 |
++extern int prom_retain(const char *name, unsigned long size, |
428 |
++ unsigned long align, unsigned long *paddr); |
429 |
+ |
430 |
+ /* Load explicit I/D TLB entries into the calling processor. */ |
431 |
+ extern long prom_itlb_load(unsigned long index, |
432 |
+@@ -287,26 +286,6 @@ extern void prom_sun4v_guest_soft_state(void); |
433 |
+ extern int prom_ihandle2path(int handle, char *buffer, int bufsize); |
434 |
+ |
435 |
+ /* Client interface level routines. */ |
436 |
+-extern long p1275_cmd(const char *, long, ...); |
437 |
+- |
438 |
+-#if 0 |
439 |
+-#define P1275_SIZE(x) ((((long)((x) / 32)) << 32) | (x)) |
440 |
+-#else |
441 |
+-#define P1275_SIZE(x) x |
442 |
+-#endif |
443 |
+- |
444 |
+-/* We support at most 16 input and 1 output argument */ |
445 |
+-#define P1275_ARG_NUMBER 0 |
446 |
+-#define P1275_ARG_IN_STRING 1 |
447 |
+-#define P1275_ARG_OUT_BUF 2 |
448 |
+-#define P1275_ARG_OUT_32B 3 |
449 |
+-#define P1275_ARG_IN_FUNCTION 4 |
450 |
+-#define P1275_ARG_IN_BUF 5 |
451 |
+-#define P1275_ARG_IN_64B 6 |
452 |
+- |
453 |
+-#define P1275_IN(x) ((x) & 0xf) |
454 |
+-#define P1275_OUT(x) (((x) << 4) & 0xf0) |
455 |
+-#define P1275_INOUT(i,o) (P1275_IN(i)|P1275_OUT(o)) |
456 |
+-#define P1275_ARG(n,x) ((x) << ((n)*3 + 8)) |
457 |
++extern void p1275_cmd_direct(unsigned long *); |
458 |
+ |
459 |
+ #endif /* !(__SPARC64_OPLIB_H) */ |
460 |
+diff --git a/arch/sparc/prom/cif.S b/arch/sparc/prom/cif.S |
461 |
+index 5f27ad7..9c86b4b 100644 |
462 |
+--- a/arch/sparc/prom/cif.S |
463 |
++++ b/arch/sparc/prom/cif.S |
464 |
+@@ -9,18 +9,18 @@ |
465 |
+ #include <asm/thread_info.h> |
466 |
+ |
467 |
+ .text |
468 |
+- .globl prom_cif_interface |
469 |
+-prom_cif_interface: |
470 |
+- sethi %hi(p1275buf), %o0 |
471 |
+- or %o0, %lo(p1275buf), %o0 |
472 |
+- ldx [%o0 + 0x010], %o1 ! prom_cif_stack |
473 |
+- save %o1, -192, %sp |
474 |
+- ldx [%i0 + 0x008], %l2 ! prom_cif_handler |
475 |
++ .globl prom_cif_direct |
476 |
++prom_cif_direct: |
477 |
++ sethi %hi(p1275buf), %o1 |
478 |
++ or %o1, %lo(p1275buf), %o1 |
479 |
++ ldx [%o1 + 0x0010], %o2 ! prom_cif_stack |
480 |
++ save %o2, -192, %sp |
481 |
++ ldx [%i1 + 0x0008], %l2 ! prom_cif_handler |
482 |
+ mov %g4, %l0 |
483 |
+ mov %g5, %l1 |
484 |
+ mov %g6, %l3 |
485 |
+ call %l2 |
486 |
+- add %i0, 0x018, %o0 ! prom_args |
487 |
++ mov %i0, %o0 ! prom_args |
488 |
+ mov %l0, %g4 |
489 |
+ mov %l1, %g5 |
490 |
+ mov %l3, %g6 |
491 |
+diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c |
492 |
+index e1c3fc8..7b707b6 100644 |
493 |
+--- a/arch/sparc/prom/console_64.c |
494 |
++++ b/arch/sparc/prom/console_64.c |
495 |
+@@ -21,14 +21,22 @@ extern int prom_stdin, prom_stdout; |
496 |
+ inline int |
497 |
+ prom_nbgetchar(void) |
498 |
+ { |
499 |
++ unsigned long args[7]; |
500 |
+ char inc; |
501 |
+ |
502 |
+- if (p1275_cmd("read", P1275_ARG(1,P1275_ARG_OUT_BUF)| |
503 |
+- P1275_INOUT(3,1), |
504 |
+- prom_stdin, &inc, P1275_SIZE(1)) == 1) |
505 |
++ args[0] = (unsigned long) "read"; |
506 |
++ args[1] = 3; |
507 |
++ args[2] = 1; |
508 |
++ args[3] = (unsigned int) prom_stdin; |
509 |
++ args[4] = (unsigned long) &inc; |
510 |
++ args[5] = 1; |
511 |
++ args[6] = (unsigned long) -1; |
512 |
++ |
513 |
++ p1275_cmd_direct(args); |
514 |
++ |
515 |
++ if (args[6] == 1) |
516 |
+ return inc; |
517 |
+- else |
518 |
+- return -1; |
519 |
++ return -1; |
520 |
+ } |
521 |
+ |
522 |
+ /* Non blocking put character to console device, returns -1 if |
523 |
+@@ -37,12 +45,22 @@ prom_nbgetchar(void) |
524 |
+ inline int |
525 |
+ prom_nbputchar(char c) |
526 |
+ { |
527 |
++ unsigned long args[7]; |
528 |
+ char outc; |
529 |
+ |
530 |
+ outc = c; |
531 |
+- if (p1275_cmd("write", P1275_ARG(1,P1275_ARG_IN_BUF)| |
532 |
+- P1275_INOUT(3,1), |
533 |
+- prom_stdout, &outc, P1275_SIZE(1)) == 1) |
534 |
++ |
535 |
++ args[0] = (unsigned long) "write"; |
536 |
++ args[1] = 3; |
537 |
++ args[2] = 1; |
538 |
++ args[3] = (unsigned int) prom_stdout; |
539 |
++ args[4] = (unsigned long) &outc; |
540 |
++ args[5] = 1; |
541 |
++ args[6] = (unsigned long) -1; |
542 |
++ |
543 |
++ p1275_cmd_direct(args); |
544 |
++ |
545 |
++ if (args[6] == 1) |
546 |
+ return 0; |
547 |
+ else |
548 |
+ return -1; |
549 |
+@@ -68,7 +86,15 @@ prom_putchar(char c) |
550 |
+ void |
551 |
+ prom_puts(const char *s, int len) |
552 |
+ { |
553 |
+- p1275_cmd("write", P1275_ARG(1,P1275_ARG_IN_BUF)| |
554 |
+- P1275_INOUT(3,1), |
555 |
+- prom_stdout, s, P1275_SIZE(len)); |
556 |
++ unsigned long args[7]; |
557 |
++ |
558 |
++ args[0] = (unsigned long) "write"; |
559 |
++ args[1] = 3; |
560 |
++ args[2] = 1; |
561 |
++ args[3] = (unsigned int) prom_stdout; |
562 |
++ args[4] = (unsigned long) s; |
563 |
++ args[5] = len; |
564 |
++ args[6] = (unsigned long) -1; |
565 |
++ |
566 |
++ p1275_cmd_direct(args); |
567 |
+ } |
568 |
+diff --git a/arch/sparc/prom/devops_64.c b/arch/sparc/prom/devops_64.c |
569 |
+index 9dbd803..a017119 100644 |
570 |
+--- a/arch/sparc/prom/devops_64.c |
571 |
++++ b/arch/sparc/prom/devops_64.c |
572 |
+@@ -18,16 +18,32 @@ |
573 |
+ int |
574 |
+ prom_devopen(const char *dstr) |
575 |
+ { |
576 |
+- return p1275_cmd ("open", P1275_ARG(0,P1275_ARG_IN_STRING)| |
577 |
+- P1275_INOUT(1,1), |
578 |
+- dstr); |
579 |
++ unsigned long args[5]; |
580 |
++ |
581 |
++ args[0] = (unsigned long) "open"; |
582 |
++ args[1] = 1; |
583 |
++ args[2] = 1; |
584 |
++ args[3] = (unsigned long) dstr; |
585 |
++ args[4] = (unsigned long) -1; |
586 |
++ |
587 |
++ p1275_cmd_direct(args); |
588 |
++ |
589 |
++ return (int) args[4]; |
590 |
+ } |
591 |
+ |
592 |
+ /* Close the device described by device handle 'dhandle'. */ |
593 |
+ int |
594 |
+ prom_devclose(int dhandle) |
595 |
+ { |
596 |
+- p1275_cmd ("close", P1275_INOUT(1,0), dhandle); |
597 |
++ unsigned long args[4]; |
598 |
++ |
599 |
++ args[0] = (unsigned long) "close"; |
600 |
++ args[1] = 1; |
601 |
++ args[2] = 0; |
602 |
++ args[3] = (unsigned int) dhandle; |
603 |
++ |
604 |
++ p1275_cmd_direct(args); |
605 |
++ |
606 |
+ return 0; |
607 |
+ } |
608 |
+ |
609 |
+@@ -37,5 +53,15 @@ prom_devclose(int dhandle) |
610 |
+ void |
611 |
+ prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo) |
612 |
+ { |
613 |
+- p1275_cmd ("seek", P1275_INOUT(3,1), dhandle, seekhi, seeklo); |
614 |
++ unsigned long args[7]; |
615 |
++ |
616 |
++ args[0] = (unsigned long) "seek"; |
617 |
++ args[1] = 3; |
618 |
++ args[2] = 1; |
619 |
++ args[3] = (unsigned int) dhandle; |
620 |
++ args[4] = seekhi; |
621 |
++ args[5] = seeklo; |
622 |
++ args[6] = (unsigned long) -1; |
623 |
++ |
624 |
++ p1275_cmd_direct(args); |
625 |
+ } |
626 |
+diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c |
627 |
+index 39fc6af..6cb1581 100644 |
628 |
+--- a/arch/sparc/prom/misc_64.c |
629 |
++++ b/arch/sparc/prom/misc_64.c |
630 |
+@@ -20,10 +20,17 @@ |
631 |
+ |
632 |
+ int prom_service_exists(const char *service_name) |
633 |
+ { |
634 |
+- int err = p1275_cmd("test", P1275_ARG(0, P1275_ARG_IN_STRING) | |
635 |
+- P1275_INOUT(1, 1), service_name); |
636 |
++ unsigned long args[5]; |
637 |
+ |
638 |
+- if (err) |
639 |
++ args[0] = (unsigned long) "test"; |
640 |
++ args[1] = 1; |
641 |
++ args[2] = 1; |
642 |
++ args[3] = (unsigned long) service_name; |
643 |
++ args[4] = (unsigned long) -1; |
644 |
++ |
645 |
++ p1275_cmd_direct(args); |
646 |
++ |
647 |
++ if (args[4]) |
648 |
+ return 0; |
649 |
+ return 1; |
650 |
+ } |
651 |
+@@ -31,30 +38,47 @@ int prom_service_exists(const char *service_name) |
652 |
+ void prom_sun4v_guest_soft_state(void) |
653 |
+ { |
654 |
+ const char *svc = "SUNW,soft-state-supported"; |
655 |
++ unsigned long args[3]; |
656 |
+ |
657 |
+ if (!prom_service_exists(svc)) |
658 |
+ return; |
659 |
+- p1275_cmd(svc, P1275_INOUT(0, 0)); |
660 |
++ args[0] = (unsigned long) svc; |
661 |
++ args[1] = 0; |
662 |
++ args[2] = 0; |
663 |
++ p1275_cmd_direct(args); |
664 |
+ } |
665 |
+ |
666 |
+ /* Reset and reboot the machine with the command 'bcommand'. */ |
667 |
+ void prom_reboot(const char *bcommand) |
668 |
+ { |
669 |
++ unsigned long args[4]; |
670 |
++ |
671 |
+ #ifdef CONFIG_SUN_LDOMS |
672 |
+ if (ldom_domaining_enabled) |
673 |
+ ldom_reboot(bcommand); |
674 |
+ #endif |
675 |
+- p1275_cmd("boot", P1275_ARG(0, P1275_ARG_IN_STRING) | |
676 |
+- P1275_INOUT(1, 0), bcommand); |
677 |
++ args[0] = (unsigned long) "boot"; |
678 |
++ args[1] = 1; |
679 |
++ args[2] = 0; |
680 |
++ args[3] = (unsigned long) bcommand; |
681 |
++ |
682 |
++ p1275_cmd_direct(args); |
683 |
+ } |
684 |
+ |
685 |
+ /* Forth evaluate the expression contained in 'fstring'. */ |
686 |
+ void prom_feval(const char *fstring) |
687 |
+ { |
688 |
++ unsigned long args[5]; |
689 |
++ |
690 |
+ if (!fstring || fstring[0] == 0) |
691 |
+ return; |
692 |
+- p1275_cmd("interpret", P1275_ARG(0, P1275_ARG_IN_STRING) | |
693 |
+- P1275_INOUT(1, 1), fstring); |
694 |
++ args[0] = (unsigned long) "interpret"; |
695 |
++ args[1] = 1; |
696 |
++ args[2] = 1; |
697 |
++ args[3] = (unsigned long) fstring; |
698 |
++ args[4] = (unsigned long) -1; |
699 |
++ |
700 |
++ p1275_cmd_direct(args); |
701 |
+ } |
702 |
+ EXPORT_SYMBOL(prom_feval); |
703 |
+ |
704 |
+@@ -68,6 +92,7 @@ extern void smp_release(void); |
705 |
+ */ |
706 |
+ void prom_cmdline(void) |
707 |
+ { |
708 |
++ unsigned long args[3]; |
709 |
+ unsigned long flags; |
710 |
+ |
711 |
+ local_irq_save(flags); |
712 |
+@@ -76,7 +101,11 @@ void prom_cmdline(void) |
713 |
+ smp_capture(); |
714 |
+ #endif |
715 |
+ |
716 |
+- p1275_cmd("enter", P1275_INOUT(0, 0)); |
717 |
++ args[0] = (unsigned long) "enter"; |
718 |
++ args[1] = 0; |
719 |
++ args[2] = 0; |
720 |
++ |
721 |
++ p1275_cmd_direct(args); |
722 |
+ |
723 |
+ #ifdef CONFIG_SMP |
724 |
+ smp_release(); |
725 |
+@@ -90,22 +119,32 @@ void prom_cmdline(void) |
726 |
+ */ |
727 |
+ void notrace prom_halt(void) |
728 |
+ { |
729 |
++ unsigned long args[3]; |
730 |
++ |
731 |
+ #ifdef CONFIG_SUN_LDOMS |
732 |
+ if (ldom_domaining_enabled) |
733 |
+ ldom_power_off(); |
734 |
+ #endif |
735 |
+ again: |
736 |
+- p1275_cmd("exit", P1275_INOUT(0, 0)); |
737 |
++ args[0] = (unsigned long) "exit"; |
738 |
++ args[1] = 0; |
739 |
++ args[2] = 0; |
740 |
++ p1275_cmd_direct(args); |
741 |
+ goto again; /* PROM is out to get me -DaveM */ |
742 |
+ } |
743 |
+ |
744 |
+ void prom_halt_power_off(void) |
745 |
+ { |
746 |
++ unsigned long args[3]; |
747 |
++ |
748 |
+ #ifdef CONFIG_SUN_LDOMS |
749 |
+ if (ldom_domaining_enabled) |
750 |
+ ldom_power_off(); |
751 |
+ #endif |
752 |
+- p1275_cmd("SUNW,power-off", P1275_INOUT(0, 0)); |
753 |
++ args[0] = (unsigned long) "SUNW,power-off"; |
754 |
++ args[1] = 0; |
755 |
++ args[2] = 0; |
756 |
++ p1275_cmd_direct(args); |
757 |
+ |
758 |
+ /* if nothing else helps, we just halt */ |
759 |
+ prom_halt(); |
760 |
+@@ -114,10 +153,15 @@ void prom_halt_power_off(void) |
761 |
+ /* Set prom sync handler to call function 'funcp'. */ |
762 |
+ void prom_setcallback(callback_func_t funcp) |
763 |
+ { |
764 |
++ unsigned long args[5]; |
765 |
+ if (!funcp) |
766 |
+ return; |
767 |
+- p1275_cmd("set-callback", P1275_ARG(0, P1275_ARG_IN_FUNCTION) | |
768 |
+- P1275_INOUT(1, 1), funcp); |
769 |
++ args[0] = (unsigned long) "set-callback"; |
770 |
++ args[1] = 1; |
771 |
++ args[2] = 1; |
772 |
++ args[3] = (unsigned long) funcp; |
773 |
++ args[4] = (unsigned long) -1; |
774 |
++ p1275_cmd_direct(args); |
775 |
+ } |
776 |
+ |
777 |
+ /* Get the idprom and stuff it into buffer 'idbuf'. Returns the |
778 |
+@@ -173,57 +217,61 @@ static int prom_get_memory_ihandle(void) |
779 |
+ } |
780 |
+ |
781 |
+ /* Load explicit I/D TLB entries. */ |
782 |
++static long tlb_load(const char *type, unsigned long index, |
783 |
++ unsigned long tte_data, unsigned long vaddr) |
784 |
++{ |
785 |
++ unsigned long args[9]; |
786 |
++ |
787 |
++ args[0] = (unsigned long) prom_callmethod_name; |
788 |
++ args[1] = 5; |
789 |
++ args[2] = 1; |
790 |
++ args[3] = (unsigned long) type; |
791 |
++ args[4] = (unsigned int) prom_get_mmu_ihandle(); |
792 |
++ args[5] = vaddr; |
793 |
++ args[6] = tte_data; |
794 |
++ args[7] = index; |
795 |
++ args[8] = (unsigned long) -1; |
796 |
++ |
797 |
++ p1275_cmd_direct(args); |
798 |
++ |
799 |
++ return (long) args[8]; |
800 |
++} |
801 |
++ |
802 |
+ long prom_itlb_load(unsigned long index, |
803 |
+ unsigned long tte_data, |
804 |
+ unsigned long vaddr) |
805 |
+ { |
806 |
+- return p1275_cmd(prom_callmethod_name, |
807 |
+- (P1275_ARG(0, P1275_ARG_IN_STRING) | |
808 |
+- P1275_ARG(2, P1275_ARG_IN_64B) | |
809 |
+- P1275_ARG(3, P1275_ARG_IN_64B) | |
810 |
+- P1275_INOUT(5, 1)), |
811 |
+- "SUNW,itlb-load", |
812 |
+- prom_get_mmu_ihandle(), |
813 |
+- /* And then our actual args are pushed backwards. */ |
814 |
+- vaddr, |
815 |
+- tte_data, |
816 |
+- index); |
817 |
++ return tlb_load("SUNW,itlb-load", index, tte_data, vaddr); |
818 |
+ } |
819 |
+ |
820 |
+ long prom_dtlb_load(unsigned long index, |
821 |
+ unsigned long tte_data, |
822 |
+ unsigned long vaddr) |
823 |
+ { |
824 |
+- return p1275_cmd(prom_callmethod_name, |
825 |
+- (P1275_ARG(0, P1275_ARG_IN_STRING) | |
826 |
+- P1275_ARG(2, P1275_ARG_IN_64B) | |
827 |
+- P1275_ARG(3, P1275_ARG_IN_64B) | |
828 |
+- P1275_INOUT(5, 1)), |
829 |
+- "SUNW,dtlb-load", |
830 |
+- prom_get_mmu_ihandle(), |
831 |
+- /* And then our actual args are pushed backwards. */ |
832 |
+- vaddr, |
833 |
+- tte_data, |
834 |
+- index); |
835 |
++ return tlb_load("SUNW,dtlb-load", index, tte_data, vaddr); |
836 |
+ } |
837 |
+ |
838 |
+ int prom_map(int mode, unsigned long size, |
839 |
+ unsigned long vaddr, unsigned long paddr) |
840 |
+ { |
841 |
+- int ret = p1275_cmd(prom_callmethod_name, |
842 |
+- (P1275_ARG(0, P1275_ARG_IN_STRING) | |
843 |
+- P1275_ARG(3, P1275_ARG_IN_64B) | |
844 |
+- P1275_ARG(4, P1275_ARG_IN_64B) | |
845 |
+- P1275_ARG(6, P1275_ARG_IN_64B) | |
846 |
+- P1275_INOUT(7, 1)), |
847 |
+- prom_map_name, |
848 |
+- prom_get_mmu_ihandle(), |
849 |
+- mode, |
850 |
+- size, |
851 |
+- vaddr, |
852 |
+- 0, |
853 |
+- paddr); |
854 |
+- |
855 |
++ unsigned long args[11]; |
856 |
++ int ret; |
857 |
++ |
858 |
++ args[0] = (unsigned long) prom_callmethod_name; |
859 |
++ args[1] = 7; |
860 |
++ args[2] = 1; |
861 |
++ args[3] = (unsigned long) prom_map_name; |
862 |
++ args[4] = (unsigned int) prom_get_mmu_ihandle(); |
863 |
++ args[5] = (unsigned int) mode; |
864 |
++ args[6] = size; |
865 |
++ args[7] = vaddr; |
866 |
++ args[8] = 0; |
867 |
++ args[9] = paddr; |
868 |
++ args[10] = (unsigned long) -1; |
869 |
++ |
870 |
++ p1275_cmd_direct(args); |
871 |
++ |
872 |
++ ret = (int) args[10]; |
873 |
+ if (ret == 0) |
874 |
+ ret = -1; |
875 |
+ return ret; |
876 |
+@@ -231,40 +279,51 @@ int prom_map(int mode, unsigned long size, |
877 |
+ |
878 |
+ void prom_unmap(unsigned long size, unsigned long vaddr) |
879 |
+ { |
880 |
+- p1275_cmd(prom_callmethod_name, |
881 |
+- (P1275_ARG(0, P1275_ARG_IN_STRING) | |
882 |
+- P1275_ARG(2, P1275_ARG_IN_64B) | |
883 |
+- P1275_ARG(3, P1275_ARG_IN_64B) | |
884 |
+- P1275_INOUT(4, 0)), |
885 |
+- prom_unmap_name, |
886 |
+- prom_get_mmu_ihandle(), |
887 |
+- size, |
888 |
+- vaddr); |
889 |
++ unsigned long args[7]; |
890 |
++ |
891 |
++ args[0] = (unsigned long) prom_callmethod_name; |
892 |
++ args[1] = 4; |
893 |
++ args[2] = 0; |
894 |
++ args[3] = (unsigned long) prom_unmap_name; |
895 |
++ args[4] = (unsigned int) prom_get_mmu_ihandle(); |
896 |
++ args[5] = size; |
897 |
++ args[6] = vaddr; |
898 |
++ |
899 |
++ p1275_cmd_direct(args); |
900 |
+ } |
901 |
+ |
902 |
+ /* Set aside physical memory which is not touched or modified |
903 |
+ * across soft resets. |
904 |
+ */ |
905 |
+-unsigned long prom_retain(const char *name, |
906 |
+- unsigned long pa_low, unsigned long pa_high, |
907 |
+- long size, long align) |
908 |
++int prom_retain(const char *name, unsigned long size, |
909 |
++ unsigned long align, unsigned long *paddr) |
910 |
+ { |
911 |
+- /* XXX I don't think we return multiple values correctly. |
912 |
+- * XXX OBP supposedly returns pa_low/pa_high here, how does |
913 |
+- * XXX it work? |
914 |
++ unsigned long args[11]; |
915 |
++ |
916 |
++ args[0] = (unsigned long) prom_callmethod_name; |
917 |
++ args[1] = 5; |
918 |
++ args[2] = 3; |
919 |
++ args[3] = (unsigned long) "SUNW,retain"; |
920 |
++ args[4] = (unsigned int) prom_get_memory_ihandle(); |
921 |
++ args[5] = align; |
922 |
++ args[6] = size; |
923 |
++ args[7] = (unsigned long) name; |
924 |
++ args[8] = (unsigned long) -1; |
925 |
++ args[9] = (unsigned long) -1; |
926 |
++ args[10] = (unsigned long) -1; |
927 |
++ |
928 |
++ p1275_cmd_direct(args); |
929 |
++ |
930 |
++ if (args[8]) |
931 |
++ return (int) args[8]; |
932 |
++ |
933 |
++ /* Next we get "phys_high" then "phys_low". On 64-bit |
934 |
++ * the phys_high cell is don't care since the phys_low |
935 |
++ * cell has the full value. |
936 |
+ */ |
937 |
++ *paddr = args[10]; |
938 |
+ |
939 |
+- /* If align is zero, the pa_low/pa_high args are passed, |
940 |
+- * else they are not. |
941 |
+- */ |
942 |
+- if (align == 0) |
943 |
+- return p1275_cmd("SUNW,retain", |
944 |
+- (P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(5, 2)), |
945 |
+- name, pa_low, pa_high, size, align); |
946 |
+- else |
947 |
+- return p1275_cmd("SUNW,retain", |
948 |
+- (P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(3, 2)), |
949 |
+- name, size, align); |
950 |
++ return 0; |
951 |
+ } |
952 |
+ |
953 |
+ /* Get "Unumber" string for the SIMM at the given |
954 |
+@@ -277,62 +336,129 @@ int prom_getunumber(int syndrome_code, |
955 |
+ unsigned long phys_addr, |
956 |
+ char *buf, int buflen) |
957 |
+ { |
958 |
+- return p1275_cmd(prom_callmethod_name, |
959 |
+- (P1275_ARG(0, P1275_ARG_IN_STRING) | |
960 |
+- P1275_ARG(3, P1275_ARG_OUT_BUF) | |
961 |
+- P1275_ARG(6, P1275_ARG_IN_64B) | |
962 |
+- P1275_INOUT(8, 2)), |
963 |
+- "SUNW,get-unumber", prom_get_memory_ihandle(), |
964 |
+- buflen, buf, P1275_SIZE(buflen), |
965 |
+- 0, phys_addr, syndrome_code); |
966 |
++ unsigned long args[12]; |
967 |
++ |
968 |
++ args[0] = (unsigned long) prom_callmethod_name; |
969 |
++ args[1] = 7; |
970 |
++ args[2] = 2; |
971 |
++ args[3] = (unsigned long) "SUNW,get-unumber"; |
972 |
++ args[4] = (unsigned int) prom_get_memory_ihandle(); |
973 |
++ args[5] = buflen; |
974 |
++ args[6] = (unsigned long) buf; |
975 |
++ args[7] = 0; |
976 |
++ args[8] = phys_addr; |
977 |
++ args[9] = (unsigned int) syndrome_code; |
978 |
++ args[10] = (unsigned long) -1; |
979 |
++ args[11] = (unsigned long) -1; |
980 |
++ |
981 |
++ p1275_cmd_direct(args); |
982 |
++ |
983 |
++ return (int) args[10]; |
984 |
+ } |
985 |
+ |
986 |
+ /* Power management extensions. */ |
987 |
+ void prom_sleepself(void) |
988 |
+ { |
989 |
+- p1275_cmd("SUNW,sleep-self", P1275_INOUT(0, 0)); |
990 |
++ unsigned long args[3]; |
991 |
++ |
992 |
++ args[0] = (unsigned long) "SUNW,sleep-self"; |
993 |
++ args[1] = 0; |
994 |
++ args[2] = 0; |
995 |
++ p1275_cmd_direct(args); |
996 |
+ } |
997 |
+ |
998 |
+ int prom_sleepsystem(void) |
999 |
+ { |
1000 |
+- return p1275_cmd("SUNW,sleep-system", P1275_INOUT(0, 1)); |
1001 |
++ unsigned long args[4]; |
1002 |
++ |
1003 |
++ args[0] = (unsigned long) "SUNW,sleep-system"; |
1004 |
++ args[1] = 0; |
1005 |
++ args[2] = 1; |
1006 |
++ args[3] = (unsigned long) -1; |
1007 |
++ p1275_cmd_direct(args); |
1008 |
++ |
1009 |
++ return (int) args[3]; |
1010 |
+ } |
1011 |
+ |
1012 |
+ int prom_wakeupsystem(void) |
1013 |
+ { |
1014 |
+- return p1275_cmd("SUNW,wakeup-system", P1275_INOUT(0, 1)); |
1015 |
++ unsigned long args[4]; |
1016 |
++ |
1017 |
++ args[0] = (unsigned long) "SUNW,wakeup-system"; |
1018 |
++ args[1] = 0; |
1019 |
++ args[2] = 1; |
1020 |
++ args[3] = (unsigned long) -1; |
1021 |
++ p1275_cmd_direct(args); |
1022 |
++ |
1023 |
++ return (int) args[3]; |
1024 |
+ } |
1025 |
+ |
1026 |
+ #ifdef CONFIG_SMP |
1027 |
+ void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg) |
1028 |
+ { |
1029 |
+- p1275_cmd("SUNW,start-cpu", P1275_INOUT(3, 0), cpunode, pc, arg); |
1030 |
++ unsigned long args[6]; |
1031 |
++ |
1032 |
++ args[0] = (unsigned long) "SUNW,start-cpu"; |
1033 |
++ args[1] = 3; |
1034 |
++ args[2] = 0; |
1035 |
++ args[3] = (unsigned int) cpunode; |
1036 |
++ args[4] = pc; |
1037 |
++ args[5] = arg; |
1038 |
++ p1275_cmd_direct(args); |
1039 |
+ } |
1040 |
+ |
1041 |
+ void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg) |
1042 |
+ { |
1043 |
+- p1275_cmd("SUNW,start-cpu-by-cpuid", P1275_INOUT(3, 0), |
1044 |
+- cpuid, pc, arg); |
1045 |
++ unsigned long args[6]; |
1046 |
++ |
1047 |
++ args[0] = (unsigned long) "SUNW,start-cpu-by-cpuid"; |
1048 |
++ args[1] = 3; |
1049 |
++ args[2] = 0; |
1050 |
++ args[3] = (unsigned int) cpuid; |
1051 |
++ args[4] = pc; |
1052 |
++ args[5] = arg; |
1053 |
++ p1275_cmd_direct(args); |
1054 |
+ } |
1055 |
+ |
1056 |
+ void prom_stopcpu_cpuid(int cpuid) |
1057 |
+ { |
1058 |
+- p1275_cmd("SUNW,stop-cpu-by-cpuid", P1275_INOUT(1, 0), |
1059 |
+- cpuid); |
1060 |
++ unsigned long args[4]; |
1061 |
++ |
1062 |
++ args[0] = (unsigned long) "SUNW,stop-cpu-by-cpuid"; |
1063 |
++ args[1] = 1; |
1064 |
++ args[2] = 0; |
1065 |
++ args[3] = (unsigned int) cpuid; |
1066 |
++ p1275_cmd_direct(args); |
1067 |
+ } |
1068 |
+ |
1069 |
+ void prom_stopself(void) |
1070 |
+ { |
1071 |
+- p1275_cmd("SUNW,stop-self", P1275_INOUT(0, 0)); |
1072 |
++ unsigned long args[3]; |
1073 |
++ |
1074 |
++ args[0] = (unsigned long) "SUNW,stop-self"; |
1075 |
++ args[1] = 0; |
1076 |
++ args[2] = 0; |
1077 |
++ p1275_cmd_direct(args); |
1078 |
+ } |
1079 |
+ |
1080 |
+ void prom_idleself(void) |
1081 |
+ { |
1082 |
+- p1275_cmd("SUNW,idle-self", P1275_INOUT(0, 0)); |
1083 |
++ unsigned long args[3]; |
1084 |
++ |
1085 |
++ args[0] = (unsigned long) "SUNW,idle-self"; |
1086 |
++ args[1] = 0; |
1087 |
++ args[2] = 0; |
1088 |
++ p1275_cmd_direct(args); |
1089 |
+ } |
1090 |
+ |
1091 |
+ void prom_resumecpu(int cpunode) |
1092 |
+ { |
1093 |
+- p1275_cmd("SUNW,resume-cpu", P1275_INOUT(1, 0), cpunode); |
1094 |
++ unsigned long args[4]; |
1095 |
++ |
1096 |
++ args[0] = (unsigned long) "SUNW,resume-cpu"; |
1097 |
++ args[1] = 1; |
1098 |
++ args[2] = 0; |
1099 |
++ args[3] = (unsigned int) cpunode; |
1100 |
++ p1275_cmd_direct(args); |
1101 |
+ } |
1102 |
+ #endif |
1103 |
+diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c |
1104 |
+index 815cab6..7ae5b54 100644 |
1105 |
+--- a/arch/sparc/prom/p1275.c |
1106 |
++++ b/arch/sparc/prom/p1275.c |
1107 |
+@@ -22,13 +22,11 @@ struct { |
1108 |
+ long prom_callback; /* 0x00 */ |
1109 |
+ void (*prom_cif_handler)(long *); /* 0x08 */ |
1110 |
+ unsigned long prom_cif_stack; /* 0x10 */ |
1111 |
+- unsigned long prom_args [23]; /* 0x18 */ |
1112 |
+- char prom_buffer [3000]; |
1113 |
+ } p1275buf; |
1114 |
+ |
1115 |
+ extern void prom_world(int); |
1116 |
+ |
1117 |
+-extern void prom_cif_interface(void); |
1118 |
++extern void prom_cif_direct(unsigned long *args); |
1119 |
+ extern void prom_cif_callback(void); |
1120 |
+ |
1121 |
+ /* |
1122 |
+@@ -36,114 +34,20 @@ extern void prom_cif_callback(void); |
1123 |
+ */ |
1124 |
+ DEFINE_SPINLOCK(prom_entry_lock); |
1125 |
+ |
1126 |
+-long p1275_cmd(const char *service, long fmt, ...) |
1127 |
++void p1275_cmd_direct(unsigned long *args) |
1128 |
+ { |
1129 |
+- char *p, *q; |
1130 |
+ unsigned long flags; |
1131 |
+- int nargs, nrets, i; |
1132 |
+- va_list list; |
1133 |
+- long attrs, x; |
1134 |
+- |
1135 |
+- p = p1275buf.prom_buffer; |
1136 |
+ |
1137 |
+ raw_local_save_flags(flags); |
1138 |
+ raw_local_irq_restore(PIL_NMI); |
1139 |
+ spin_lock(&prom_entry_lock); |
1140 |
+ |
1141 |
+- p1275buf.prom_args[0] = (unsigned long)p; /* service */ |
1142 |
+- strcpy (p, service); |
1143 |
+- p = (char *)(((long)(strchr (p, 0) + 8)) & ~7); |
1144 |
+- p1275buf.prom_args[1] = nargs = (fmt & 0x0f); /* nargs */ |
1145 |
+- p1275buf.prom_args[2] = nrets = ((fmt & 0xf0) >> 4); /* nrets */ |
1146 |
+- attrs = fmt >> 8; |
1147 |
+- va_start(list, fmt); |
1148 |
+- for (i = 0; i < nargs; i++, attrs >>= 3) { |
1149 |
+- switch (attrs & 0x7) { |
1150 |
+- case P1275_ARG_NUMBER: |
1151 |
+- p1275buf.prom_args[i + 3] = |
1152 |
+- (unsigned)va_arg(list, long); |
1153 |
+- break; |
1154 |
+- case P1275_ARG_IN_64B: |
1155 |
+- p1275buf.prom_args[i + 3] = |
1156 |
+- va_arg(list, unsigned long); |
1157 |
+- break; |
1158 |
+- case P1275_ARG_IN_STRING: |
1159 |
+- strcpy (p, va_arg(list, char *)); |
1160 |
+- p1275buf.prom_args[i + 3] = (unsigned long)p; |
1161 |
+- p = (char *)(((long)(strchr (p, 0) + 8)) & ~7); |
1162 |
+- break; |
1163 |
+- case P1275_ARG_OUT_BUF: |
1164 |
+- (void) va_arg(list, char *); |
1165 |
+- p1275buf.prom_args[i + 3] = (unsigned long)p; |
1166 |
+- x = va_arg(list, long); |
1167 |
+- i++; attrs >>= 3; |
1168 |
+- p = (char *)(((long)(p + (int)x + 7)) & ~7); |
1169 |
+- p1275buf.prom_args[i + 3] = x; |
1170 |
+- break; |
1171 |
+- case P1275_ARG_IN_BUF: |
1172 |
+- q = va_arg(list, char *); |
1173 |
+- p1275buf.prom_args[i + 3] = (unsigned long)p; |
1174 |
+- x = va_arg(list, long); |
1175 |
+- i++; attrs >>= 3; |
1176 |
+- memcpy (p, q, (int)x); |
1177 |
+- p = (char *)(((long)(p + (int)x + 7)) & ~7); |
1178 |
+- p1275buf.prom_args[i + 3] = x; |
1179 |
+- break; |
1180 |
+- case P1275_ARG_OUT_32B: |
1181 |
+- (void) va_arg(list, char *); |
1182 |
+- p1275buf.prom_args[i + 3] = (unsigned long)p; |
1183 |
+- p += 32; |
1184 |
+- break; |
1185 |
+- case P1275_ARG_IN_FUNCTION: |
1186 |
+- p1275buf.prom_args[i + 3] = |
1187 |
+- (unsigned long)prom_cif_callback; |
1188 |
+- p1275buf.prom_callback = va_arg(list, long); |
1189 |
+- break; |
1190 |
+- } |
1191 |
+- } |
1192 |
+- va_end(list); |
1193 |
+- |
1194 |
+ prom_world(1); |
1195 |
+- prom_cif_interface(); |
1196 |
++ prom_cif_direct(args); |
1197 |
+ prom_world(0); |
1198 |
+ |
1199 |
+- attrs = fmt >> 8; |
1200 |
+- va_start(list, fmt); |
1201 |
+- for (i = 0; i < nargs; i++, attrs >>= 3) { |
1202 |
+- switch (attrs & 0x7) { |
1203 |
+- case P1275_ARG_NUMBER: |
1204 |
+- (void) va_arg(list, long); |
1205 |
+- break; |
1206 |
+- case P1275_ARG_IN_STRING: |
1207 |
+- (void) va_arg(list, char *); |
1208 |
+- break; |
1209 |
+- case P1275_ARG_IN_FUNCTION: |
1210 |
+- (void) va_arg(list, long); |
1211 |
+- break; |
1212 |
+- case P1275_ARG_IN_BUF: |
1213 |
+- (void) va_arg(list, char *); |
1214 |
+- (void) va_arg(list, long); |
1215 |
+- i++; attrs >>= 3; |
1216 |
+- break; |
1217 |
+- case P1275_ARG_OUT_BUF: |
1218 |
+- p = va_arg(list, char *); |
1219 |
+- x = va_arg(list, long); |
1220 |
+- memcpy (p, (char *)(p1275buf.prom_args[i + 3]), (int)x); |
1221 |
+- i++; attrs >>= 3; |
1222 |
+- break; |
1223 |
+- case P1275_ARG_OUT_32B: |
1224 |
+- p = va_arg(list, char *); |
1225 |
+- memcpy (p, (char *)(p1275buf.prom_args[i + 3]), 32); |
1226 |
+- break; |
1227 |
+- } |
1228 |
+- } |
1229 |
+- va_end(list); |
1230 |
+- x = p1275buf.prom_args [nargs + 3]; |
1231 |
+- |
1232 |
+ spin_unlock(&prom_entry_lock); |
1233 |
+ raw_local_irq_restore(flags); |
1234 |
+- |
1235 |
+- return x; |
1236 |
+ } |
1237 |
+ |
1238 |
+ void prom_cif_init(void *cif_handler, void *cif_stack) |
1239 |
+diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c |
1240 |
+index 8ea73dd..6a05c76 100644 |
1241 |
+--- a/arch/sparc/prom/tree_64.c |
1242 |
++++ b/arch/sparc/prom/tree_64.c |
1243 |
+@@ -16,22 +16,39 @@ |
1244 |
+ #include <asm/oplib.h> |
1245 |
+ #include <asm/ldc.h> |
1246 |
+ |
1247 |
++static int prom_node_to_node(const char *type, int node) |
1248 |
++{ |
1249 |
++ unsigned long args[5]; |
1250 |
++ |
1251 |
++ args[0] = (unsigned long) type; |
1252 |
++ args[1] = 1; |
1253 |
++ args[2] = 1; |
1254 |
++ args[3] = (unsigned int) node; |
1255 |
++ args[4] = (unsigned long) -1; |
1256 |
++ |
1257 |
++ p1275_cmd_direct(args); |
1258 |
++ |
1259 |
++ return (int) args[4]; |
1260 |
++} |
1261 |
++ |
1262 |
+ /* Return the child of node 'node' or zero if no this node has no |
1263 |
+ * direct descendent. |
1264 |
+ */ |
1265 |
+ inline int __prom_getchild(int node) |
1266 |
+ { |
1267 |
+- return p1275_cmd ("child", P1275_INOUT(1, 1), node); |
1268 |
++ return prom_node_to_node("child", node); |
1269 |
+ } |
1270 |
+ |
1271 |
+ inline int prom_getchild(int node) |
1272 |
+ { |
1273 |
+ int cnode; |
1274 |
+ |
1275 |
+- if(node == -1) return 0; |
1276 |
++ if (node == -1) |
1277 |
++ return 0; |
1278 |
+ cnode = __prom_getchild(node); |
1279 |
+- if(cnode == -1) return 0; |
1280 |
+- return (int)cnode; |
1281 |
++ if (cnode == -1) |
1282 |
++ return 0; |
1283 |
++ return cnode; |
1284 |
+ } |
1285 |
+ EXPORT_SYMBOL(prom_getchild); |
1286 |
+ |
1287 |
+@@ -39,10 +56,12 @@ inline int prom_getparent(int node) |
1288 |
+ { |
1289 |
+ int cnode; |
1290 |
+ |
1291 |
+- if(node == -1) return 0; |
1292 |
+- cnode = p1275_cmd ("parent", P1275_INOUT(1, 1), node); |
1293 |
+- if(cnode == -1) return 0; |
1294 |
+- return (int)cnode; |
1295 |
++ if (node == -1) |
1296 |
++ return 0; |
1297 |
++ cnode = prom_node_to_node("parent", node); |
1298 |
++ if (cnode == -1) |
1299 |
++ return 0; |
1300 |
++ return cnode; |
1301 |
+ } |
1302 |
+ |
1303 |
+ /* Return the next sibling of node 'node' or zero if no more siblings |
1304 |
+@@ -50,7 +69,7 @@ inline int prom_getparent(int node) |
1305 |
+ */ |
1306 |
+ inline int __prom_getsibling(int node) |
1307 |
+ { |
1308 |
+- return p1275_cmd(prom_peer_name, P1275_INOUT(1, 1), node); |
1309 |
++ return prom_node_to_node(prom_peer_name, node); |
1310 |
+ } |
1311 |
+ |
1312 |
+ inline int prom_getsibling(int node) |
1313 |
+@@ -72,11 +91,21 @@ EXPORT_SYMBOL(prom_getsibling); |
1314 |
+ */ |
1315 |
+ inline int prom_getproplen(int node, const char *prop) |
1316 |
+ { |
1317 |
+- if((!node) || (!prop)) return -1; |
1318 |
+- return p1275_cmd ("getproplen", |
1319 |
+- P1275_ARG(1,P1275_ARG_IN_STRING)| |
1320 |
+- P1275_INOUT(2, 1), |
1321 |
+- node, prop); |
1322 |
++ unsigned long args[6]; |
1323 |
++ |
1324 |
++ if (!node || !prop) |
1325 |
++ return -1; |
1326 |
++ |
1327 |
++ args[0] = (unsigned long) "getproplen"; |
1328 |
++ args[1] = 2; |
1329 |
++ args[2] = 1; |
1330 |
++ args[3] = (unsigned int) node; |
1331 |
++ args[4] = (unsigned long) prop; |
1332 |
++ args[5] = (unsigned long) -1; |
1333 |
++ |
1334 |
++ p1275_cmd_direct(args); |
1335 |
++ |
1336 |
++ return (int) args[5]; |
1337 |
+ } |
1338 |
+ EXPORT_SYMBOL(prom_getproplen); |
1339 |
+ |
1340 |
+@@ -87,19 +116,25 @@ EXPORT_SYMBOL(prom_getproplen); |
1341 |
+ inline int prom_getproperty(int node, const char *prop, |
1342 |
+ char *buffer, int bufsize) |
1343 |
+ { |
1344 |
++ unsigned long args[8]; |
1345 |
+ int plen; |
1346 |
+ |
1347 |
+ plen = prom_getproplen(node, prop); |
1348 |
+- if ((plen > bufsize) || (plen == 0) || (plen == -1)) { |
1349 |
++ if ((plen > bufsize) || (plen == 0) || (plen == -1)) |
1350 |
+ return -1; |
1351 |
+- } else { |
1352 |
+- /* Ok, things seem all right. */ |
1353 |
+- return p1275_cmd(prom_getprop_name, |
1354 |
+- P1275_ARG(1,P1275_ARG_IN_STRING)| |
1355 |
+- P1275_ARG(2,P1275_ARG_OUT_BUF)| |
1356 |
+- P1275_INOUT(4, 1), |
1357 |
+- node, prop, buffer, P1275_SIZE(plen)); |
1358 |
+- } |
1359 |
++ |
1360 |
++ args[0] = (unsigned long) prom_getprop_name; |
1361 |
++ args[1] = 4; |
1362 |
++ args[2] = 1; |
1363 |
++ args[3] = (unsigned int) node; |
1364 |
++ args[4] = (unsigned long) prop; |
1365 |
++ args[5] = (unsigned long) buffer; |
1366 |
++ args[6] = bufsize; |
1367 |
++ args[7] = (unsigned long) -1; |
1368 |
++ |
1369 |
++ p1275_cmd_direct(args); |
1370 |
++ |
1371 |
++ return (int) args[7]; |
1372 |
+ } |
1373 |
+ EXPORT_SYMBOL(prom_getproperty); |
1374 |
+ |
1375 |
+@@ -110,7 +145,7 @@ inline int prom_getint(int node, const char *prop) |
1376 |
+ { |
1377 |
+ int intprop; |
1378 |
+ |
1379 |
+- if(prom_getproperty(node, prop, (char *) &intprop, sizeof(int)) != -1) |
1380 |
++ if (prom_getproperty(node, prop, (char *) &intprop, sizeof(int)) != -1) |
1381 |
+ return intprop; |
1382 |
+ |
1383 |
+ return -1; |
1384 |
+@@ -126,7 +161,8 @@ int prom_getintdefault(int node, const char *property, int deflt) |
1385 |
+ int retval; |
1386 |
+ |
1387 |
+ retval = prom_getint(node, property); |
1388 |
+- if(retval == -1) return deflt; |
1389 |
++ if (retval == -1) |
1390 |
++ return deflt; |
1391 |
+ |
1392 |
+ return retval; |
1393 |
+ } |
1394 |
+@@ -138,7 +174,8 @@ int prom_getbool(int node, const char *prop) |
1395 |
+ int retval; |
1396 |
+ |
1397 |
+ retval = prom_getproplen(node, prop); |
1398 |
+- if(retval == -1) return 0; |
1399 |
++ if (retval == -1) |
1400 |
++ return 0; |
1401 |
+ return 1; |
1402 |
+ } |
1403 |
+ EXPORT_SYMBOL(prom_getbool); |
1404 |
+@@ -152,7 +189,8 @@ void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size) |
1405 |
+ int len; |
1406 |
+ |
1407 |
+ len = prom_getproperty(node, prop, user_buf, ubuf_size); |
1408 |
+- if(len != -1) return; |
1409 |
++ if (len != -1) |
1410 |
++ return; |
1411 |
+ user_buf[0] = 0; |
1412 |
+ return; |
1413 |
+ } |
1414 |
+@@ -165,7 +203,8 @@ int prom_nodematch(int node, const char *name) |
1415 |
+ { |
1416 |
+ char namebuf[128]; |
1417 |
+ prom_getproperty(node, "name", namebuf, sizeof(namebuf)); |
1418 |
+- if(strcmp(namebuf, name) == 0) return 1; |
1419 |
++ if (strcmp(namebuf, name) == 0) |
1420 |
++ return 1; |
1421 |
+ return 0; |
1422 |
+ } |
1423 |
+ |
1424 |
+@@ -191,16 +230,29 @@ int prom_searchsiblings(int node_start, const char *nodename) |
1425 |
+ } |
1426 |
+ EXPORT_SYMBOL(prom_searchsiblings); |
1427 |
+ |
1428 |
++static const char *prom_nextprop_name = "nextprop"; |
1429 |
++ |
1430 |
+ /* Return the first property type for node 'node'. |
1431 |
+ * buffer should be at least 32B in length |
1432 |
+ */ |
1433 |
+ inline char *prom_firstprop(int node, char *buffer) |
1434 |
+ { |
1435 |
++ unsigned long args[7]; |
1436 |
++ |
1437 |
+ *buffer = 0; |
1438 |
+- if(node == -1) return buffer; |
1439 |
+- p1275_cmd ("nextprop", P1275_ARG(2,P1275_ARG_OUT_32B)| |
1440 |
+- P1275_INOUT(3, 0), |
1441 |
+- node, (char *) 0x0, buffer); |
1442 |
++ if (node == -1) |
1443 |
++ return buffer; |
1444 |
++ |
1445 |
++ args[0] = (unsigned long) prom_nextprop_name; |
1446 |
++ args[1] = 3; |
1447 |
++ args[2] = 1; |
1448 |
++ args[3] = (unsigned int) node; |
1449 |
++ args[4] = 0; |
1450 |
++ args[5] = (unsigned long) buffer; |
1451 |
++ args[6] = (unsigned long) -1; |
1452 |
++ |
1453 |
++ p1275_cmd_direct(args); |
1454 |
++ |
1455 |
+ return buffer; |
1456 |
+ } |
1457 |
+ EXPORT_SYMBOL(prom_firstprop); |
1458 |
+@@ -211,9 +263,10 @@ EXPORT_SYMBOL(prom_firstprop); |
1459 |
+ */ |
1460 |
+ inline char *prom_nextprop(int node, const char *oprop, char *buffer) |
1461 |
+ { |
1462 |
++ unsigned long args[7]; |
1463 |
+ char buf[32]; |
1464 |
+ |
1465 |
+- if(node == -1) { |
1466 |
++ if (node == -1) { |
1467 |
+ *buffer = 0; |
1468 |
+ return buffer; |
1469 |
+ } |
1470 |
+@@ -221,10 +274,17 @@ inline char *prom_nextprop(int node, const char *oprop, char *buffer) |
1471 |
+ strcpy (buf, oprop); |
1472 |
+ oprop = buf; |
1473 |
+ } |
1474 |
+- p1275_cmd ("nextprop", P1275_ARG(1,P1275_ARG_IN_STRING)| |
1475 |
+- P1275_ARG(2,P1275_ARG_OUT_32B)| |
1476 |
+- P1275_INOUT(3, 0), |
1477 |
+- node, oprop, buffer); |
1478 |
++ |
1479 |
++ args[0] = (unsigned long) prom_nextprop_name; |
1480 |
++ args[1] = 3; |
1481 |
++ args[2] = 1; |
1482 |
++ args[3] = (unsigned int) node; |
1483 |
++ args[4] = (unsigned long) oprop; |
1484 |
++ args[5] = (unsigned long) buffer; |
1485 |
++ args[6] = (unsigned long) -1; |
1486 |
++ |
1487 |
++ p1275_cmd_direct(args); |
1488 |
++ |
1489 |
+ return buffer; |
1490 |
+ } |
1491 |
+ EXPORT_SYMBOL(prom_nextprop); |
1492 |
+@@ -232,12 +292,19 @@ EXPORT_SYMBOL(prom_nextprop); |
1493 |
+ int |
1494 |
+ prom_finddevice(const char *name) |
1495 |
+ { |
1496 |
++ unsigned long args[5]; |
1497 |
++ |
1498 |
+ if (!name) |
1499 |
+ return 0; |
1500 |
+- return p1275_cmd(prom_finddev_name, |
1501 |
+- P1275_ARG(0,P1275_ARG_IN_STRING)| |
1502 |
+- P1275_INOUT(1, 1), |
1503 |
+- name); |
1504 |
++ args[0] = (unsigned long) "finddevice"; |
1505 |
++ args[1] = 1; |
1506 |
++ args[2] = 1; |
1507 |
++ args[3] = (unsigned long) name; |
1508 |
++ args[4] = (unsigned long) -1; |
1509 |
++ |
1510 |
++ p1275_cmd_direct(args); |
1511 |
++ |
1512 |
++ return (int) args[4]; |
1513 |
+ } |
1514 |
+ EXPORT_SYMBOL(prom_finddevice); |
1515 |
+ |
1516 |
+@@ -248,7 +315,7 @@ int prom_node_has_property(int node, const char *prop) |
1517 |
+ *buf = 0; |
1518 |
+ do { |
1519 |
+ prom_nextprop(node, buf, buf); |
1520 |
+- if(!strcmp(buf, prop)) |
1521 |
++ if (!strcmp(buf, prop)) |
1522 |
+ return 1; |
1523 |
+ } while (*buf); |
1524 |
+ return 0; |
1525 |
+@@ -261,6 +328,8 @@ EXPORT_SYMBOL(prom_node_has_property); |
1526 |
+ int |
1527 |
+ prom_setprop(int node, const char *pname, char *value, int size) |
1528 |
+ { |
1529 |
++ unsigned long args[8]; |
1530 |
++ |
1531 |
+ if (size == 0) |
1532 |
+ return 0; |
1533 |
+ if ((pname == 0) || (value == 0)) |
1534 |
+@@ -272,19 +341,37 @@ prom_setprop(int node, const char *pname, char *value, int size) |
1535 |
+ return 0; |
1536 |
+ } |
1537 |
+ #endif |
1538 |
+- return p1275_cmd ("setprop", P1275_ARG(1,P1275_ARG_IN_STRING)| |
1539 |
+- P1275_ARG(2,P1275_ARG_IN_BUF)| |
1540 |
+- P1275_INOUT(4, 1), |
1541 |
+- node, pname, value, P1275_SIZE(size)); |
1542 |
++ args[0] = (unsigned long) "setprop"; |
1543 |
++ args[1] = 4; |
1544 |
++ args[2] = 1; |
1545 |
++ args[3] = (unsigned int) node; |
1546 |
++ args[4] = (unsigned long) pname; |
1547 |
++ args[5] = (unsigned long) value; |
1548 |
++ args[6] = size; |
1549 |
++ args[7] = (unsigned long) -1; |
1550 |
++ |
1551 |
++ p1275_cmd_direct(args); |
1552 |
++ |
1553 |
++ return (int) args[7]; |
1554 |
+ } |
1555 |
+ EXPORT_SYMBOL(prom_setprop); |
1556 |
+ |
1557 |
+ inline int prom_inst2pkg(int inst) |
1558 |
+ { |
1559 |
++ unsigned long args[5]; |
1560 |
+ int node; |
1561 |
+ |
1562 |
+- node = p1275_cmd ("instance-to-package", P1275_INOUT(1, 1), inst); |
1563 |
+- if (node == -1) return 0; |
1564 |
++ args[0] = (unsigned long) "instance-to-package"; |
1565 |
++ args[1] = 1; |
1566 |
++ args[2] = 1; |
1567 |
++ args[3] = (unsigned int) inst; |
1568 |
++ args[4] = (unsigned long) -1; |
1569 |
++ |
1570 |
++ p1275_cmd_direct(args); |
1571 |
++ |
1572 |
++ node = (int) args[4]; |
1573 |
++ if (node == -1) |
1574 |
++ return 0; |
1575 |
+ return node; |
1576 |
+ } |
1577 |
+ |
1578 |
+@@ -297,17 +384,28 @@ prom_pathtoinode(const char *path) |
1579 |
+ int node, inst; |
1580 |
+ |
1581 |
+ inst = prom_devopen (path); |
1582 |
+- if (inst == 0) return 0; |
1583 |
+- node = prom_inst2pkg (inst); |
1584 |
+- prom_devclose (inst); |
1585 |
+- if (node == -1) return 0; |
1586 |
++ if (inst == 0) |
1587 |
++ return 0; |
1588 |
++ node = prom_inst2pkg(inst); |
1589 |
++ prom_devclose(inst); |
1590 |
++ if (node == -1) |
1591 |
++ return 0; |
1592 |
+ return node; |
1593 |
+ } |
1594 |
+ |
1595 |
+ int prom_ihandle2path(int handle, char *buffer, int bufsize) |
1596 |
+ { |
1597 |
+- return p1275_cmd("instance-to-path", |
1598 |
+- P1275_ARG(1,P1275_ARG_OUT_BUF)| |
1599 |
+- P1275_INOUT(3, 1), |
1600 |
+- handle, buffer, P1275_SIZE(bufsize)); |
1601 |
++ unsigned long args[7]; |
1602 |
++ |
1603 |
++ args[0] = (unsigned long) "instance-to-path"; |
1604 |
++ args[1] = 3; |
1605 |
++ args[2] = 1; |
1606 |
++ args[3] = (unsigned int) handle; |
1607 |
++ args[4] = (unsigned long) buffer; |
1608 |
++ args[5] = bufsize; |
1609 |
++ args[6] = (unsigned long) -1; |
1610 |
++ |
1611 |
++ p1275_cmd_direct(args); |
1612 |
++ |
1613 |
++ return (int) args[6]; |
1614 |
+ } |
1615 |
+diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h |
1616 |
+index 5af5051..9873a5f 100644 |
1617 |
+--- a/arch/x86/include/asm/cmpxchg_32.h |
1618 |
++++ b/arch/x86/include/asm/cmpxchg_32.h |
1619 |
+@@ -17,60 +17,33 @@ struct __xchg_dummy { |
1620 |
+ #define __xg(x) ((struct __xchg_dummy *)(x)) |
1621 |
+ |
1622 |
+ /* |
1623 |
+- * The semantics of XCHGCMP8B are a bit strange, this is why |
1624 |
+- * there is a loop and the loading of %%eax and %%edx has to |
1625 |
+- * be inside. This inlines well in most cases, the cached |
1626 |
+- * cost is around ~38 cycles. (in the future we might want |
1627 |
+- * to do an SIMD/3DNOW!/MMX/FPU 64-bit store here, but that |
1628 |
+- * might have an implicit FPU-save as a cost, so it's not |
1629 |
+- * clear which path to go.) |
1630 |
++ * CMPXCHG8B only writes to the target if we had the previous |
1631 |
++ * value in registers, otherwise it acts as a read and gives us the |
1632 |
++ * "new previous" value. That is why there is a loop. Preloading |
1633 |
++ * EDX:EAX is a performance optimization: in the common case it means |
1634 |
++ * we need only one locked operation. |
1635 |
+ * |
1636 |
+- * cmpxchg8b must be used with the lock prefix here to allow |
1637 |
+- * the instruction to be executed atomically, see page 3-102 |
1638 |
+- * of the instruction set reference 24319102.pdf. We need |
1639 |
+- * the reader side to see the coherent 64bit value. |
1640 |
++ * A SIMD/3DNOW!/MMX/FPU 64-bit store here would require at the very |
1641 |
++ * least an FPU save and/or %cr0.ts manipulation. |
1642 |
++ * |
1643 |
++ * cmpxchg8b must be used with the lock prefix here to allow the |
1644 |
++ * instruction to be executed atomically. We need to have the reader |
1645 |
++ * side to see the coherent 64bit value. |
1646 |
+ */ |
1647 |
+-static inline void __set_64bit(unsigned long long *ptr, |
1648 |
+- unsigned int low, unsigned int high) |
1649 |
++static inline void set_64bit(volatile u64 *ptr, u64 value) |
1650 |
+ { |
1651 |
++ u32 low = value; |
1652 |
++ u32 high = value >> 32; |
1653 |
++ u64 prev = *ptr; |
1654 |
++ |
1655 |
+ asm volatile("\n1:\t" |
1656 |
+- "movl (%1), %%eax\n\t" |
1657 |
+- "movl 4(%1), %%edx\n\t" |
1658 |
+ LOCK_PREFIX "cmpxchg8b %0\n\t" |
1659 |
+ "jnz 1b" |
1660 |
+- : "=m"(*ptr) |
1661 |
+- : "D" (ptr), |
1662 |
+- "b"(low), |
1663 |
+- "c"(high) |
1664 |
+- : "ax", "dx", "memory"); |
1665 |
+-} |
1666 |
+- |
1667 |
+-static inline void __set_64bit_constant(unsigned long long *ptr, |
1668 |
+- unsigned long long value) |
1669 |
+-{ |
1670 |
+- __set_64bit(ptr, (unsigned int)value, (unsigned int)(value >> 32)); |
1671 |
+-} |
1672 |
+- |
1673 |
+-#define ll_low(x) *(((unsigned int *)&(x)) + 0) |
1674 |
+-#define ll_high(x) *(((unsigned int *)&(x)) + 1) |
1675 |
+- |
1676 |
+-static inline void __set_64bit_var(unsigned long long *ptr, |
1677 |
+- unsigned long long value) |
1678 |
+-{ |
1679 |
+- __set_64bit(ptr, ll_low(value), ll_high(value)); |
1680 |
++ : "=m" (*ptr), "+A" (prev) |
1681 |
++ : "b" (low), "c" (high) |
1682 |
++ : "memory"); |
1683 |
+ } |
1684 |
+ |
1685 |
+-#define set_64bit(ptr, value) \ |
1686 |
+- (__builtin_constant_p((value)) \ |
1687 |
+- ? __set_64bit_constant((ptr), (value)) \ |
1688 |
+- : __set_64bit_var((ptr), (value))) |
1689 |
+- |
1690 |
+-#define _set_64bit(ptr, value) \ |
1691 |
+- (__builtin_constant_p(value) \ |
1692 |
+- ? __set_64bit(ptr, (unsigned int)(value), \ |
1693 |
+- (unsigned int)((value) >> 32)) \ |
1694 |
+- : __set_64bit(ptr, ll_low((value)), ll_high((value)))) |
1695 |
+- |
1696 |
+ /* |
1697 |
+ * Note: no "lock" prefix even on SMP: xchg always implies lock anyway |
1698 |
+ * Note 2: xchg has side effect, so that attribute volatile is necessary, |
1699 |
+diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h |
1700 |
+index 1871cb0..e8cb051 100644 |
1701 |
+--- a/arch/x86/include/asm/cmpxchg_64.h |
1702 |
++++ b/arch/x86/include/asm/cmpxchg_64.h |
1703 |
+@@ -8,13 +8,11 @@ |
1704 |
+ |
1705 |
+ #define __xg(x) ((volatile long *)(x)) |
1706 |
+ |
1707 |
+-static inline void set_64bit(volatile unsigned long *ptr, unsigned long val) |
1708 |
++static inline void set_64bit(volatile u64 *ptr, u64 val) |
1709 |
+ { |
1710 |
+ *ptr = val; |
1711 |
+ } |
1712 |
+ |
1713 |
+-#define _set_64bit set_64bit |
1714 |
+- |
1715 |
+ /* |
1716 |
+ * Note: no "lock" prefix even on SMP: xchg always implies lock anyway |
1717 |
+ * Note 2: xchg has side effect, so that attribute volatile is necessary, |
1718 |
+diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c |
1719 |
+index 3130a4b..238526b 100644 |
1720 |
+--- a/arch/x86/oprofile/nmi_int.c |
1721 |
++++ b/arch/x86/oprofile/nmi_int.c |
1722 |
+@@ -621,7 +621,9 @@ static int __init ppro_init(char **cpu_type) |
1723 |
+ case 14: |
1724 |
+ *cpu_type = "i386/core"; |
1725 |
+ break; |
1726 |
+- case 15: case 23: |
1727 |
++ case 0x0f: |
1728 |
++ case 0x16: |
1729 |
++ case 0x17: |
1730 |
+ *cpu_type = "i386/core_2"; |
1731 |
+ break; |
1732 |
+ case 0x1a: |
1733 |
+diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c |
1734 |
+index 23e5a05..2815df6 100644 |
1735 |
+--- a/drivers/acpi/blacklist.c |
1736 |
++++ b/drivers/acpi/blacklist.c |
1737 |
+@@ -185,6 +185,12 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d) |
1738 |
+ acpi_osi_setup("!Windows 2006"); |
1739 |
+ return 0; |
1740 |
+ } |
1741 |
++static int __init dmi_disable_osi_win7(const struct dmi_system_id *d) |
1742 |
++{ |
1743 |
++ printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); |
1744 |
++ acpi_osi_setup("!Windows 2009"); |
1745 |
++ return 0; |
1746 |
++} |
1747 |
+ |
1748 |
+ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { |
1749 |
+ { |
1750 |
+@@ -211,6 +217,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { |
1751 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"), |
1752 |
+ }, |
1753 |
+ }, |
1754 |
++ { |
1755 |
++ .callback = dmi_disable_osi_win7, |
1756 |
++ .ident = "ASUS K50IJ", |
1757 |
++ .matches = { |
1758 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), |
1759 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"), |
1760 |
++ }, |
1761 |
++ }, |
1762 |
+ |
1763 |
+ /* |
1764 |
+ * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
1765 |
+diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c |
1766 |
+index 2f3c9be..2911120 100644 |
1767 |
+--- a/drivers/ata/pata_pdc202xx_old.c |
1768 |
++++ b/drivers/ata/pata_pdc202xx_old.c |
1769 |
+@@ -2,7 +2,7 @@ |
1770 |
+ * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer |
1771 |
+ * (C) 2005 Red Hat Inc |
1772 |
+ * Alan Cox <alan@××××××××××××××××.uk> |
1773 |
+- * (C) 2007,2009 Bartlomiej Zolnierkiewicz |
1774 |
++ * (C) 2007,2009,2010 Bartlomiej Zolnierkiewicz |
1775 |
+ * |
1776 |
+ * Based in part on linux/drivers/ide/pci/pdc202xx_old.c |
1777 |
+ * |
1778 |
+@@ -35,6 +35,15 @@ static int pdc2026x_cable_detect(struct ata_port *ap) |
1779 |
+ return ATA_CBL_PATA80; |
1780 |
+ } |
1781 |
+ |
1782 |
++static void pdc202xx_exec_command(struct ata_port *ap, |
1783 |
++ const struct ata_taskfile *tf) |
1784 |
++{ |
1785 |
++ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); |
1786 |
++ |
1787 |
++ iowrite8(tf->command, ap->ioaddr.command_addr); |
1788 |
++ ndelay(400); |
1789 |
++} |
1790 |
++ |
1791 |
+ /** |
1792 |
+ * pdc202xx_configure_piomode - set chip PIO timing |
1793 |
+ * @ap: ATA interface |
1794 |
+@@ -271,6 +280,8 @@ static struct ata_port_operations pdc2024x_port_ops = { |
1795 |
+ .cable_detect = ata_cable_40wire, |
1796 |
+ .set_piomode = pdc202xx_set_piomode, |
1797 |
+ .set_dmamode = pdc202xx_set_dmamode, |
1798 |
++ |
1799 |
++ .sff_exec_command = pdc202xx_exec_command, |
1800 |
+ }; |
1801 |
+ |
1802 |
+ static struct ata_port_operations pdc2026x_port_ops = { |
1803 |
+@@ -284,6 +295,8 @@ static struct ata_port_operations pdc2026x_port_ops = { |
1804 |
+ .dev_config = pdc2026x_dev_config, |
1805 |
+ |
1806 |
+ .port_start = pdc2026x_port_start, |
1807 |
++ |
1808 |
++ .sff_exec_command = pdc202xx_exec_command, |
1809 |
+ }; |
1810 |
+ |
1811 |
+ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
1812 |
+diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c |
1813 |
+index 6c3837a..95fdd4d 100644 |
1814 |
+--- a/drivers/char/agp/sis-agp.c |
1815 |
++++ b/drivers/char/agp/sis-agp.c |
1816 |
+@@ -415,14 +415,6 @@ static struct pci_device_id agp_sis_pci_table[] = { |
1817 |
+ .subvendor = PCI_ANY_ID, |
1818 |
+ .subdevice = PCI_ANY_ID, |
1819 |
+ }, |
1820 |
+- { |
1821 |
+- .class = (PCI_CLASS_BRIDGE_HOST << 8), |
1822 |
+- .class_mask = ~0, |
1823 |
+- .vendor = PCI_VENDOR_ID_SI, |
1824 |
+- .device = PCI_DEVICE_ID_SI_760, |
1825 |
+- .subvendor = PCI_ANY_ID, |
1826 |
+- .subdevice = PCI_ANY_ID, |
1827 |
+- }, |
1828 |
+ { } |
1829 |
+ }; |
1830 |
+ |
1831 |
+diff --git a/drivers/char/mem.c b/drivers/char/mem.c |
1832 |
+index aef3fb4..1270f64 100644 |
1833 |
+--- a/drivers/char/mem.c |
1834 |
++++ b/drivers/char/mem.c |
1835 |
+@@ -822,10 +822,11 @@ static const struct file_operations zero_fops = { |
1836 |
+ /* |
1837 |
+ * capabilities for /dev/zero |
1838 |
+ * - permits private mappings, "copies" are taken of the source of zeros |
1839 |
++ * - no writeback happens |
1840 |
+ */ |
1841 |
+ static struct backing_dev_info zero_bdi = { |
1842 |
+ .name = "char/mem", |
1843 |
+- .capabilities = BDI_CAP_MAP_COPY, |
1844 |
++ .capabilities = BDI_CAP_MAP_COPY | BDI_CAP_NO_ACCT_AND_WRITEBACK, |
1845 |
+ }; |
1846 |
+ |
1847 |
+ static const struct file_operations full_fops = { |
1848 |
+diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c |
1849 |
+index 961f5b5..c073246 100644 |
1850 |
+--- a/drivers/clocksource/sh_tmu.c |
1851 |
++++ b/drivers/clocksource/sh_tmu.c |
1852 |
+@@ -199,16 +199,8 @@ static cycle_t sh_tmu_clocksource_read(struct clocksource *cs) |
1853 |
+ static int sh_tmu_clocksource_enable(struct clocksource *cs) |
1854 |
+ { |
1855 |
+ struct sh_tmu_priv *p = cs_to_sh_tmu(cs); |
1856 |
+- int ret; |
1857 |
+- |
1858 |
+- ret = sh_tmu_enable(p); |
1859 |
+- if (ret) |
1860 |
+- return ret; |
1861 |
+ |
1862 |
+- /* TODO: calculate good shift from rate and counter bit width */ |
1863 |
+- cs->shift = 10; |
1864 |
+- cs->mult = clocksource_hz2mult(p->rate, cs->shift); |
1865 |
+- return 0; |
1866 |
++ return sh_tmu_enable(p); |
1867 |
+ } |
1868 |
+ |
1869 |
+ static void sh_tmu_clocksource_disable(struct clocksource *cs) |
1870 |
+@@ -228,6 +220,16 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p, |
1871 |
+ cs->disable = sh_tmu_clocksource_disable; |
1872 |
+ cs->mask = CLOCKSOURCE_MASK(32); |
1873 |
+ cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
1874 |
++ |
1875 |
++ /* clk_get_rate() needs an enabled clock */ |
1876 |
++ clk_enable(p->clk); |
1877 |
++ /* channel will be configured at parent clock / 4 */ |
1878 |
++ p->rate = clk_get_rate(p->clk) / 4; |
1879 |
++ clk_disable(p->clk); |
1880 |
++ /* TODO: calculate good shift from rate and counter bit width */ |
1881 |
++ cs->shift = 10; |
1882 |
++ cs->mult = clocksource_hz2mult(p->rate, cs->shift); |
1883 |
++ |
1884 |
+ pr_info("sh_tmu: %s used as clock source\n", cs->name); |
1885 |
+ clocksource_register(cs); |
1886 |
+ return 0; |
1887 |
+diff --git a/drivers/input/input.c b/drivers/input/input.c |
1888 |
+index 2266ecb..c82ae82 100644 |
1889 |
+--- a/drivers/input/input.c |
1890 |
++++ b/drivers/input/input.c |
1891 |
+@@ -24,6 +24,7 @@ |
1892 |
+ #include <linux/mutex.h> |
1893 |
+ #include <linux/rcupdate.h> |
1894 |
+ #include <linux/smp_lock.h> |
1895 |
++#include "input-compat.h" |
1896 |
+ |
1897 |
+ MODULE_AUTHOR("Vojtech Pavlik <vojtech@××××.cz>"); |
1898 |
+ MODULE_DESCRIPTION("Input core"); |
1899 |
+@@ -758,6 +759,40 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han |
1900 |
+ return error; |
1901 |
+ } |
1902 |
+ |
1903 |
++#ifdef CONFIG_COMPAT |
1904 |
++ |
1905 |
++static int input_bits_to_string(char *buf, int buf_size, |
1906 |
++ unsigned long bits, bool skip_empty) |
1907 |
++{ |
1908 |
++ int len = 0; |
1909 |
++ |
1910 |
++ if (INPUT_COMPAT_TEST) { |
1911 |
++ u32 dword = bits >> 32; |
1912 |
++ if (dword || !skip_empty) |
1913 |
++ len += snprintf(buf, buf_size, "%x ", dword); |
1914 |
++ |
1915 |
++ dword = bits & 0xffffffffUL; |
1916 |
++ if (dword || !skip_empty || len) |
1917 |
++ len += snprintf(buf + len, max(buf_size - len, 0), |
1918 |
++ "%x", dword); |
1919 |
++ } else { |
1920 |
++ if (bits || !skip_empty) |
1921 |
++ len += snprintf(buf, buf_size, "%lx", bits); |
1922 |
++ } |
1923 |
++ |
1924 |
++ return len; |
1925 |
++} |
1926 |
++ |
1927 |
++#else /* !CONFIG_COMPAT */ |
1928 |
++ |
1929 |
++static int input_bits_to_string(char *buf, int buf_size, |
1930 |
++ unsigned long bits, bool skip_empty) |
1931 |
++{ |
1932 |
++ return bits || !skip_empty ? |
1933 |
++ snprintf(buf, buf_size, "%lx", bits) : 0; |
1934 |
++} |
1935 |
++ |
1936 |
++#endif |
1937 |
+ |
1938 |
+ #ifdef CONFIG_PROC_FS |
1939 |
+ |
1940 |
+@@ -826,14 +861,25 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name, |
1941 |
+ unsigned long *bitmap, int max) |
1942 |
+ { |
1943 |
+ int i; |
1944 |
+- |
1945 |
+- for (i = BITS_TO_LONGS(max) - 1; i > 0; i--) |
1946 |
+- if (bitmap[i]) |
1947 |
+- break; |
1948 |
++ bool skip_empty = true; |
1949 |
++ char buf[18]; |
1950 |
+ |
1951 |
+ seq_printf(seq, "B: %s=", name); |
1952 |
+- for (; i >= 0; i--) |
1953 |
+- seq_printf(seq, "%lx%s", bitmap[i], i > 0 ? " " : ""); |
1954 |
++ |
1955 |
++ for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) { |
1956 |
++ if (input_bits_to_string(buf, sizeof(buf), |
1957 |
++ bitmap[i], skip_empty)) { |
1958 |
++ skip_empty = false; |
1959 |
++ seq_printf(seq, "%s%s", buf, i > 0 ? " " : ""); |
1960 |
++ } |
1961 |
++ } |
1962 |
++ |
1963 |
++ /* |
1964 |
++ * If no output was produced print a single 0. |
1965 |
++ */ |
1966 |
++ if (skip_empty) |
1967 |
++ seq_puts(seq, "0"); |
1968 |
++ |
1969 |
+ seq_putc(seq, '\n'); |
1970 |
+ } |
1971 |
+ |
1972 |
+@@ -1122,14 +1168,23 @@ static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap, |
1973 |
+ { |
1974 |
+ int i; |
1975 |
+ int len = 0; |
1976 |
++ bool skip_empty = true; |
1977 |
++ |
1978 |
++ for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) { |
1979 |
++ len += input_bits_to_string(buf + len, max(buf_size - len, 0), |
1980 |
++ bitmap[i], skip_empty); |
1981 |
++ if (len) { |
1982 |
++ skip_empty = false; |
1983 |
++ if (i > 0) |
1984 |
++ len += snprintf(buf + len, max(buf_size - len, 0), " "); |
1985 |
++ } |
1986 |
++ } |
1987 |
+ |
1988 |
+- for (i = BITS_TO_LONGS(max) - 1; i > 0; i--) |
1989 |
+- if (bitmap[i]) |
1990 |
+- break; |
1991 |
+- |
1992 |
+- for (; i >= 0; i--) |
1993 |
+- len += snprintf(buf + len, max(buf_size - len, 0), |
1994 |
+- "%lx%s", bitmap[i], i > 0 ? " " : ""); |
1995 |
++ /* |
1996 |
++ * If no output was produced print a single 0. |
1997 |
++ */ |
1998 |
++ if (len == 0) |
1999 |
++ len = snprintf(buf, buf_size, "%d", 0); |
2000 |
+ |
2001 |
+ if (add_cr) |
2002 |
+ len += snprintf(buf + len, max(buf_size - len, 0), "\n"); |
2003 |
+@@ -1144,7 +1199,8 @@ static ssize_t input_dev_show_cap_##bm(struct device *dev, \ |
2004 |
+ { \ |
2005 |
+ struct input_dev *input_dev = to_input_dev(dev); \ |
2006 |
+ int len = input_print_bitmap(buf, PAGE_SIZE, \ |
2007 |
+- input_dev->bm##bit, ev##_MAX, 1); \ |
2008 |
++ input_dev->bm##bit, ev##_MAX, \ |
2009 |
++ true); \ |
2010 |
+ return min_t(int, len, PAGE_SIZE); \ |
2011 |
+ } \ |
2012 |
+ static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL) |
2013 |
+@@ -1208,7 +1264,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env, |
2014 |
+ |
2015 |
+ len = input_print_bitmap(&env->buf[env->buflen - 1], |
2016 |
+ sizeof(env->buf) - env->buflen, |
2017 |
+- bitmap, max, 0); |
2018 |
++ bitmap, max, false); |
2019 |
+ if (len >= (sizeof(env->buf) - env->buflen)) |
2020 |
+ return -ENOMEM; |
2021 |
+ |
2022 |
+diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c |
2023 |
+index f622734..56d98eb 100644 |
2024 |
+--- a/drivers/message/fusion/mptscsih.c |
2025 |
++++ b/drivers/message/fusion/mptscsih.c |
2026 |
+@@ -2439,6 +2439,8 @@ mptscsih_slave_configure(struct scsi_device *sdev) |
2027 |
+ ioc->name,sdev->tagged_supported, sdev->simple_tags, |
2028 |
+ sdev->ordered_tags)); |
2029 |
+ |
2030 |
++ blk_queue_dma_alignment (sdev->request_queue, 512 - 1); |
2031 |
++ |
2032 |
+ return 0; |
2033 |
+ } |
2034 |
+ |
2035 |
+diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c |
2036 |
+index c71e12d..9fb3a0b 100644 |
2037 |
+--- a/drivers/net/3c503.c |
2038 |
++++ b/drivers/net/3c503.c |
2039 |
+@@ -380,6 +380,12 @@ out: |
2040 |
+ return retval; |
2041 |
+ } |
2042 |
+ |
2043 |
++static irqreturn_t el2_probe_interrupt(int irq, void *seen) |
2044 |
++{ |
2045 |
++ *(bool *)seen = true; |
2046 |
++ return IRQ_HANDLED; |
2047 |
++} |
2048 |
++ |
2049 |
+ static int |
2050 |
+ el2_open(struct net_device *dev) |
2051 |
+ { |
2052 |
+@@ -391,22 +397,35 @@ el2_open(struct net_device *dev) |
2053 |
+ |
2054 |
+ outb(EGACFR_NORM, E33G_GACFR); /* Enable RAM and interrupts. */ |
2055 |
+ do { |
2056 |
+- retval = request_irq(*irqp, NULL, 0, "bogus", dev); |
2057 |
+- if (retval >= 0) { |
2058 |
++ bool seen; |
2059 |
++ |
2060 |
++ retval = request_irq(*irqp, el2_probe_interrupt, 0, |
2061 |
++ dev->name, &seen); |
2062 |
++ if (retval == -EBUSY) |
2063 |
++ continue; |
2064 |
++ if (retval < 0) |
2065 |
++ goto err_disable; |
2066 |
++ |
2067 |
+ /* Twinkle the interrupt, and check if it's seen. */ |
2068 |
+- unsigned long cookie = probe_irq_on(); |
2069 |
++ seen = false; |
2070 |
++ smp_wmb(); |
2071 |
+ outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR); |
2072 |
+ outb_p(0x00, E33G_IDCFR); |
2073 |
+- if (*irqp == probe_irq_off(cookie) /* It's a good IRQ line! */ |
2074 |
+- && ((retval = request_irq(dev->irq = *irqp, |
2075 |
+- eip_interrupt, 0, dev->name, dev)) == 0)) |
2076 |
+- break; |
2077 |
+- } else { |
2078 |
+- if (retval != -EBUSY) |
2079 |
+- return retval; |
2080 |
+- } |
2081 |
++ msleep(1); |
2082 |
++ free_irq(*irqp, el2_probe_interrupt); |
2083 |
++ if (!seen) |
2084 |
++ continue; |
2085 |
++ |
2086 |
++ retval = request_irq(dev->irq = *irqp, eip_interrupt, 0, |
2087 |
++ dev->name, dev); |
2088 |
++ if (retval == -EBUSY) |
2089 |
++ continue; |
2090 |
++ if (retval < 0) |
2091 |
++ goto err_disable; |
2092 |
+ } while (*++irqp); |
2093 |
++ |
2094 |
+ if (*irqp == 0) { |
2095 |
++ err_disable: |
2096 |
+ outb(EGACFR_IRQOFF, E33G_GACFR); /* disable interrupts. */ |
2097 |
+ return -EAGAIN; |
2098 |
+ } |
2099 |
+diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c |
2100 |
+index a9aa957..4874b2b 100644 |
2101 |
+--- a/drivers/net/bnx2.c |
2102 |
++++ b/drivers/net/bnx2.c |
2103 |
+@@ -247,6 +247,9 @@ static const struct flash_spec flash_5709 = { |
2104 |
+ |
2105 |
+ MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); |
2106 |
+ |
2107 |
++static void bnx2_init_napi(struct bnx2 *bp); |
2108 |
++static void bnx2_del_napi(struct bnx2 *bp); |
2109 |
++ |
2110 |
+ static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_tx_ring_info *txr) |
2111 |
+ { |
2112 |
+ u32 diff; |
2113 |
+@@ -6173,6 +6176,7 @@ bnx2_open(struct net_device *dev) |
2114 |
+ bnx2_disable_int(bp); |
2115 |
+ |
2116 |
+ bnx2_setup_int_mode(bp, disable_msi); |
2117 |
++ bnx2_init_napi(bp); |
2118 |
+ bnx2_napi_enable(bp); |
2119 |
+ rc = bnx2_alloc_mem(bp); |
2120 |
+ if (rc) |
2121 |
+@@ -6234,6 +6238,7 @@ open_err: |
2122 |
+ bnx2_free_skbs(bp); |
2123 |
+ bnx2_free_irq(bp); |
2124 |
+ bnx2_free_mem(bp); |
2125 |
++ bnx2_del_napi(bp); |
2126 |
+ return rc; |
2127 |
+ } |
2128 |
+ |
2129 |
+@@ -6441,6 +6446,7 @@ bnx2_close(struct net_device *dev) |
2130 |
+ bnx2_free_irq(bp); |
2131 |
+ bnx2_free_skbs(bp); |
2132 |
+ bnx2_free_mem(bp); |
2133 |
++ bnx2_del_napi(bp); |
2134 |
+ bp->link_up = 0; |
2135 |
+ netif_carrier_off(bp->dev); |
2136 |
+ bnx2_set_power_state(bp, PCI_D3hot); |
2137 |
+@@ -8016,12 +8022,21 @@ bnx2_bus_string(struct bnx2 *bp, char *str) |
2138 |
+ return str; |
2139 |
+ } |
2140 |
+ |
2141 |
+-static void __devinit |
2142 |
++static void |
2143 |
++bnx2_del_napi(struct bnx2 *bp) |
2144 |
++{ |
2145 |
++ int i; |
2146 |
++ |
2147 |
++ for (i = 0; i < bp->irq_nvecs; i++) |
2148 |
++ netif_napi_del(&bp->bnx2_napi[i].napi); |
2149 |
++} |
2150 |
++ |
2151 |
++static void |
2152 |
+ bnx2_init_napi(struct bnx2 *bp) |
2153 |
+ { |
2154 |
+ int i; |
2155 |
+ |
2156 |
+- for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) { |
2157 |
++ for (i = 0; i < bp->irq_nvecs; i++) { |
2158 |
+ struct bnx2_napi *bnapi = &bp->bnx2_napi[i]; |
2159 |
+ int (*poll)(struct napi_struct *, int); |
2160 |
+ |
2161 |
+@@ -8090,7 +8105,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2162 |
+ dev->ethtool_ops = &bnx2_ethtool_ops; |
2163 |
+ |
2164 |
+ bp = netdev_priv(dev); |
2165 |
+- bnx2_init_napi(bp); |
2166 |
+ |
2167 |
+ pci_set_drvdata(pdev, dev); |
2168 |
+ |
2169 |
+diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c |
2170 |
+index c3fa31c..d3854ac 100644 |
2171 |
+--- a/drivers/net/bonding/bond_3ad.c |
2172 |
++++ b/drivers/net/bonding/bond_3ad.c |
2173 |
+@@ -2451,6 +2451,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac |
2174 |
+ if (!(dev->flags & IFF_MASTER)) |
2175 |
+ goto out; |
2176 |
+ |
2177 |
++ if (!pskb_may_pull(skb, sizeof(struct lacpdu))) |
2178 |
++ goto out; |
2179 |
++ |
2180 |
+ read_lock(&bond->lock); |
2181 |
+ slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev), |
2182 |
+ orig_dev); |
2183 |
+diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c |
2184 |
+index 9b5936f..7114375 100644 |
2185 |
+--- a/drivers/net/bonding/bond_alb.c |
2186 |
++++ b/drivers/net/bonding/bond_alb.c |
2187 |
+@@ -370,6 +370,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct |
2188 |
+ goto out; |
2189 |
+ } |
2190 |
+ |
2191 |
++ if (!pskb_may_pull(skb, arp_hdr_len(bond_dev))) |
2192 |
++ goto out; |
2193 |
++ |
2194 |
+ if (skb->len < sizeof(struct arp_pkt)) { |
2195 |
+ pr_debug("Packet is too small to be an ARP\n"); |
2196 |
+ goto out; |
2197 |
+diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c |
2198 |
+index 34e776c..2b378e7 100644 |
2199 |
+--- a/drivers/net/cxgb3/cxgb3_main.c |
2200 |
++++ b/drivers/net/cxgb3/cxgb3_main.c |
2201 |
+@@ -1274,6 +1274,7 @@ static void cxgb_down(struct adapter *adapter) |
2202 |
+ |
2203 |
+ free_irq_resources(adapter); |
2204 |
+ quiesce_rx(adapter); |
2205 |
++ t3_sge_stop(adapter); |
2206 |
+ flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */ |
2207 |
+ } |
2208 |
+ |
2209 |
+@@ -2274,6 +2275,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) |
2210 |
+ case CHELSIO_GET_QSET_NUM:{ |
2211 |
+ struct ch_reg edata; |
2212 |
+ |
2213 |
++ memset(&edata, 0, sizeof(struct ch_reg)); |
2214 |
++ |
2215 |
+ edata.cmd = CHELSIO_GET_QSET_NUM; |
2216 |
+ edata.val = pi->nqsets; |
2217 |
+ if (copy_to_user(useraddr, &edata, sizeof(edata))) |
2218 |
+diff --git a/drivers/net/eql.c b/drivers/net/eql.c |
2219 |
+index f5b96ca..fd57fb4 100644 |
2220 |
+--- a/drivers/net/eql.c |
2221 |
++++ b/drivers/net/eql.c |
2222 |
+@@ -554,6 +554,8 @@ static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp) |
2223 |
+ equalizer_t *eql; |
2224 |
+ master_config_t mc; |
2225 |
+ |
2226 |
++ memset(&mc, 0, sizeof(master_config_t)); |
2227 |
++ |
2228 |
+ if (eql_is_master(dev)) { |
2229 |
+ eql = netdev_priv(dev); |
2230 |
+ mc.max_slaves = eql->max_slaves; |
2231 |
+diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c |
2232 |
+index 211b587..62e784a 100644 |
2233 |
+--- a/drivers/net/r8169.c |
2234 |
++++ b/drivers/net/r8169.c |
2235 |
+@@ -557,6 +557,11 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value) |
2236 |
+ break; |
2237 |
+ udelay(25); |
2238 |
+ } |
2239 |
++ /* |
2240 |
++ * According to hardware specs a 20us delay is required after write |
2241 |
++ * complete indication, but before sending next command. |
2242 |
++ */ |
2243 |
++ udelay(20); |
2244 |
+ } |
2245 |
+ |
2246 |
+ static int mdio_read(void __iomem *ioaddr, int reg_addr) |
2247 |
+@@ -576,6 +581,12 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr) |
2248 |
+ } |
2249 |
+ udelay(25); |
2250 |
+ } |
2251 |
++ /* |
2252 |
++ * According to hardware specs a 20us delay is required after read |
2253 |
++ * complete indication, but before sending next command. |
2254 |
++ */ |
2255 |
++ udelay(20); |
2256 |
++ |
2257 |
+ return value; |
2258 |
+ } |
2259 |
+ |
2260 |
+diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c |
2261 |
+index 6ce7f77..e644f9a 100644 |
2262 |
+--- a/drivers/net/usb/asix.c |
2263 |
++++ b/drivers/net/usb/asix.c |
2264 |
+@@ -54,6 +54,7 @@ static const char driver_name [] = "asix"; |
2265 |
+ #define AX_CMD_WRITE_IPG0 0x12 |
2266 |
+ #define AX_CMD_WRITE_IPG1 0x13 |
2267 |
+ #define AX_CMD_READ_NODE_ID 0x13 |
2268 |
++#define AX_CMD_WRITE_NODE_ID 0x14 |
2269 |
+ #define AX_CMD_WRITE_IPG2 0x14 |
2270 |
+ #define AX_CMD_WRITE_MULTI_FILTER 0x16 |
2271 |
+ #define AX88172_CMD_READ_NODE_ID 0x17 |
2272 |
+@@ -165,6 +166,7 @@ static const char driver_name [] = "asix"; |
2273 |
+ /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ |
2274 |
+ struct asix_data { |
2275 |
+ u8 multi_filter[AX_MCAST_FILTER_SIZE]; |
2276 |
++ u8 mac_addr[ETH_ALEN]; |
2277 |
+ u8 phymode; |
2278 |
+ u8 ledmode; |
2279 |
+ u8 eeprom_len; |
2280 |
+@@ -728,6 +730,30 @@ static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd) |
2281 |
+ return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); |
2282 |
+ } |
2283 |
+ |
2284 |
++static int asix_set_mac_address(struct net_device *net, void *p) |
2285 |
++{ |
2286 |
++ struct usbnet *dev = netdev_priv(net); |
2287 |
++ struct asix_data *data = (struct asix_data *)&dev->data; |
2288 |
++ struct sockaddr *addr = p; |
2289 |
++ |
2290 |
++ if (netif_running(net)) |
2291 |
++ return -EBUSY; |
2292 |
++ if (!is_valid_ether_addr(addr->sa_data)) |
2293 |
++ return -EADDRNOTAVAIL; |
2294 |
++ |
2295 |
++ memcpy(net->dev_addr, addr->sa_data, ETH_ALEN); |
2296 |
++ |
2297 |
++ /* We use the 20 byte dev->data |
2298 |
++ * for our 6 byte mac buffer |
2299 |
++ * to avoid allocating memory that |
2300 |
++ * is tricky to free later */ |
2301 |
++ memcpy(data->mac_addr, addr->sa_data, ETH_ALEN); |
2302 |
++ asix_write_cmd_async(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN, |
2303 |
++ data->mac_addr); |
2304 |
++ |
2305 |
++ return 0; |
2306 |
++} |
2307 |
++ |
2308 |
+ /* We need to override some ethtool_ops so we require our |
2309 |
+ own structure so we don't interfere with other usbnet |
2310 |
+ devices that may be connected at the same time. */ |
2311 |
+@@ -915,7 +941,7 @@ static const struct net_device_ops ax88772_netdev_ops = { |
2312 |
+ .ndo_start_xmit = usbnet_start_xmit, |
2313 |
+ .ndo_tx_timeout = usbnet_tx_timeout, |
2314 |
+ .ndo_change_mtu = usbnet_change_mtu, |
2315 |
+- .ndo_set_mac_address = eth_mac_addr, |
2316 |
++ .ndo_set_mac_address = asix_set_mac_address, |
2317 |
+ .ndo_validate_addr = eth_validate_addr, |
2318 |
+ .ndo_do_ioctl = asix_ioctl, |
2319 |
+ .ndo_set_multicast_list = asix_set_multicast, |
2320 |
+@@ -1208,7 +1234,7 @@ static const struct net_device_ops ax88178_netdev_ops = { |
2321 |
+ .ndo_stop = usbnet_stop, |
2322 |
+ .ndo_start_xmit = usbnet_start_xmit, |
2323 |
+ .ndo_tx_timeout = usbnet_tx_timeout, |
2324 |
+- .ndo_set_mac_address = eth_mac_addr, |
2325 |
++ .ndo_set_mac_address = asix_set_mac_address, |
2326 |
+ .ndo_validate_addr = eth_validate_addr, |
2327 |
+ .ndo_set_multicast_list = asix_set_multicast, |
2328 |
+ .ndo_do_ioctl = asix_ioctl, |
2329 |
+diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c |
2330 |
+index 43bc3fc..f450bc9 100644 |
2331 |
+--- a/drivers/net/usb/hso.c |
2332 |
++++ b/drivers/net/usb/hso.c |
2333 |
+@@ -1634,6 +1634,8 @@ static int hso_get_count(struct hso_serial *serial, |
2334 |
+ struct uart_icount cnow; |
2335 |
+ struct hso_tiocmget *tiocmget = serial->tiocmget; |
2336 |
+ |
2337 |
++ memset(&icount, 0, sizeof(struct serial_icounter_struct)); |
2338 |
++ |
2339 |
+ if (!tiocmget) |
2340 |
+ return -ENOENT; |
2341 |
+ spin_lock_irq(&serial->serial_lock); |
2342 |
+diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c |
2343 |
+index 8fdd41f..e131161 100644 |
2344 |
+--- a/drivers/net/wireless/hostap/hostap_pci.c |
2345 |
++++ b/drivers/net/wireless/hostap/hostap_pci.c |
2346 |
+@@ -329,6 +329,7 @@ static int prism2_pci_probe(struct pci_dev *pdev, |
2347 |
+ |
2348 |
+ dev->irq = pdev->irq; |
2349 |
+ hw_priv->mem_start = mem; |
2350 |
++ dev->base_addr = (unsigned long) mem; |
2351 |
+ |
2352 |
+ prism2_pci_cor_sreset(local); |
2353 |
+ |
2354 |
+diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c |
2355 |
+index 2498602..ba83495 100644 |
2356 |
+--- a/drivers/pci/intel-iommu.c |
2357 |
++++ b/drivers/pci/intel-iommu.c |
2358 |
+@@ -71,6 +71,49 @@ |
2359 |
+ #define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32)) |
2360 |
+ #define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64)) |
2361 |
+ |
2362 |
++/* page table handling */ |
2363 |
++#define LEVEL_STRIDE (9) |
2364 |
++#define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) |
2365 |
++ |
2366 |
++static inline int agaw_to_level(int agaw) |
2367 |
++{ |
2368 |
++ return agaw + 2; |
2369 |
++} |
2370 |
++ |
2371 |
++static inline int agaw_to_width(int agaw) |
2372 |
++{ |
2373 |
++ return 30 + agaw * LEVEL_STRIDE; |
2374 |
++} |
2375 |
++ |
2376 |
++static inline int width_to_agaw(int width) |
2377 |
++{ |
2378 |
++ return (width - 30) / LEVEL_STRIDE; |
2379 |
++} |
2380 |
++ |
2381 |
++static inline unsigned int level_to_offset_bits(int level) |
2382 |
++{ |
2383 |
++ return (level - 1) * LEVEL_STRIDE; |
2384 |
++} |
2385 |
++ |
2386 |
++static inline int pfn_level_offset(unsigned long pfn, int level) |
2387 |
++{ |
2388 |
++ return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK; |
2389 |
++} |
2390 |
++ |
2391 |
++static inline unsigned long level_mask(int level) |
2392 |
++{ |
2393 |
++ return -1UL << level_to_offset_bits(level); |
2394 |
++} |
2395 |
++ |
2396 |
++static inline unsigned long level_size(int level) |
2397 |
++{ |
2398 |
++ return 1UL << level_to_offset_bits(level); |
2399 |
++} |
2400 |
++ |
2401 |
++static inline unsigned long align_to_level(unsigned long pfn, int level) |
2402 |
++{ |
2403 |
++ return (pfn + level_size(level) - 1) & level_mask(level); |
2404 |
++} |
2405 |
+ |
2406 |
+ /* VT-d pages must always be _smaller_ than MM pages. Otherwise things |
2407 |
+ are never going to work. */ |
2408 |
+@@ -449,8 +492,6 @@ void free_iova_mem(struct iova *iova) |
2409 |
+ } |
2410 |
+ |
2411 |
+ |
2412 |
+-static inline int width_to_agaw(int width); |
2413 |
+- |
2414 |
+ static int __iommu_calculate_agaw(struct intel_iommu *iommu, int max_gaw) |
2415 |
+ { |
2416 |
+ unsigned long sagaw; |
2417 |
+@@ -664,51 +705,6 @@ out: |
2418 |
+ spin_unlock_irqrestore(&iommu->lock, flags); |
2419 |
+ } |
2420 |
+ |
2421 |
+-/* page table handling */ |
2422 |
+-#define LEVEL_STRIDE (9) |
2423 |
+-#define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) |
2424 |
+- |
2425 |
+-static inline int agaw_to_level(int agaw) |
2426 |
+-{ |
2427 |
+- return agaw + 2; |
2428 |
+-} |
2429 |
+- |
2430 |
+-static inline int agaw_to_width(int agaw) |
2431 |
+-{ |
2432 |
+- return 30 + agaw * LEVEL_STRIDE; |
2433 |
+- |
2434 |
+-} |
2435 |
+- |
2436 |
+-static inline int width_to_agaw(int width) |
2437 |
+-{ |
2438 |
+- return (width - 30) / LEVEL_STRIDE; |
2439 |
+-} |
2440 |
+- |
2441 |
+-static inline unsigned int level_to_offset_bits(int level) |
2442 |
+-{ |
2443 |
+- return (level - 1) * LEVEL_STRIDE; |
2444 |
+-} |
2445 |
+- |
2446 |
+-static inline int pfn_level_offset(unsigned long pfn, int level) |
2447 |
+-{ |
2448 |
+- return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK; |
2449 |
+-} |
2450 |
+- |
2451 |
+-static inline unsigned long level_mask(int level) |
2452 |
+-{ |
2453 |
+- return -1UL << level_to_offset_bits(level); |
2454 |
+-} |
2455 |
+- |
2456 |
+-static inline unsigned long level_size(int level) |
2457 |
+-{ |
2458 |
+- return 1UL << level_to_offset_bits(level); |
2459 |
+-} |
2460 |
+- |
2461 |
+-static inline unsigned long align_to_level(unsigned long pfn, int level) |
2462 |
+-{ |
2463 |
+- return (pfn + level_size(level) - 1) & level_mask(level); |
2464 |
+-} |
2465 |
+- |
2466 |
+ static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, |
2467 |
+ unsigned long pfn) |
2468 |
+ { |
2469 |
+diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c |
2470 |
+index 574e0b0..a078f6f 100644 |
2471 |
+--- a/drivers/staging/vt6655/wpactl.c |
2472 |
++++ b/drivers/staging/vt6655/wpactl.c |
2473 |
+@@ -767,9 +767,14 @@ static int wpa_set_associate(PSDevice pDevice, |
2474 |
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); |
2475 |
+ |
2476 |
+ |
2477 |
+- if (param->u.wpa_associate.wpa_ie && |
2478 |
+- copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) |
2479 |
+- return -EINVAL; |
2480 |
++ if (param->u.wpa_associate.wpa_ie_len) { |
2481 |
++ if (!param->u.wpa_associate.wpa_ie) |
2482 |
++ return -EINVAL; |
2483 |
++ if (param->u.wpa_associate.wpa_ie_len > sizeof(abyWPAIE)) |
2484 |
++ return -EINVAL; |
2485 |
++ if (copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) |
2486 |
++ return -EFAULT; |
2487 |
++ } |
2488 |
+ |
2489 |
+ if (param->u.wpa_associate.mode == 1) |
2490 |
+ pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; |
2491 |
+diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c |
2492 |
+index 763e32a..f3a73e7 100644 |
2493 |
+--- a/drivers/usb/serial/mos7720.c |
2494 |
++++ b/drivers/usb/serial/mos7720.c |
2495 |
+@@ -1466,6 +1466,9 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file, |
2496 |
+ |
2497 |
+ case TIOCGICOUNT: |
2498 |
+ cnow = mos7720_port->icount; |
2499 |
++ |
2500 |
++ memset(&icount, 0, sizeof(struct serial_icounter_struct)); |
2501 |
++ |
2502 |
+ icount.cts = cnow.cts; |
2503 |
+ icount.dsr = cnow.dsr; |
2504 |
+ icount.rng = cnow.rng; |
2505 |
+diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c |
2506 |
+index cf79fb2..9fdcee2 100644 |
2507 |
+--- a/drivers/usb/serial/mos7840.c |
2508 |
++++ b/drivers/usb/serial/mos7840.c |
2509 |
+@@ -2287,6 +2287,9 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file, |
2510 |
+ case TIOCGICOUNT: |
2511 |
+ cnow = mos7840_port->icount; |
2512 |
+ smp_rmb(); |
2513 |
++ |
2514 |
++ memset(&icount, 0, sizeof(struct serial_icounter_struct)); |
2515 |
++ |
2516 |
+ icount.cts = cnow.cts; |
2517 |
+ icount.dsr = cnow.dsr; |
2518 |
+ icount.rng = cnow.rng; |
2519 |
+diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c |
2520 |
+index a4e05e4..e1836d7 100644 |
2521 |
+--- a/drivers/video/sis/sis_main.c |
2522 |
++++ b/drivers/video/sis/sis_main.c |
2523 |
+@@ -1701,6 +1701,9 @@ static int sisfb_ioctl(struct fb_info *info, unsigned int cmd, |
2524 |
+ break; |
2525 |
+ |
2526 |
+ case FBIOGET_VBLANK: |
2527 |
++ |
2528 |
++ memset(&sisvbblank, 0, sizeof(struct fb_vblank)); |
2529 |
++ |
2530 |
+ sisvbblank.count = 0; |
2531 |
+ sisvbblank.flags = sisfb_setupvbblankflags(ivideo, &sisvbblank.vcount, &sisvbblank.hcount); |
2532 |
+ |
2533 |
+diff --git a/drivers/video/via/ioctl.c b/drivers/video/via/ioctl.c |
2534 |
+index da03c07..4d553d0 100644 |
2535 |
+--- a/drivers/video/via/ioctl.c |
2536 |
++++ b/drivers/video/via/ioctl.c |
2537 |
+@@ -25,6 +25,8 @@ int viafb_ioctl_get_viafb_info(u_long arg) |
2538 |
+ { |
2539 |
+ struct viafb_ioctl_info viainfo; |
2540 |
+ |
2541 |
++ memset(&viainfo, 0, sizeof(struct viafb_ioctl_info)); |
2542 |
++ |
2543 |
+ viainfo.viafb_id = VIAID; |
2544 |
+ viainfo.vendor_id = PCI_VIA_VENDOR_ID; |
2545 |
+ |
2546 |
+diff --git a/fs/aio.c b/fs/aio.c |
2547 |
+index 02a2c93..b84a769 100644 |
2548 |
+--- a/fs/aio.c |
2549 |
++++ b/fs/aio.c |
2550 |
+@@ -1639,6 +1639,9 @@ SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr, |
2551 |
+ if (unlikely(nr < 0)) |
2552 |
+ return -EINVAL; |
2553 |
+ |
2554 |
++ if (unlikely(nr > LONG_MAX/sizeof(*iocbpp))) |
2555 |
++ nr = LONG_MAX/sizeof(*iocbpp); |
2556 |
++ |
2557 |
+ if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(*iocbpp))))) |
2558 |
+ return -EFAULT; |
2559 |
+ |
2560 |
+diff --git a/fs/char_dev.c b/fs/char_dev.c |
2561 |
+index d6db933..be7613e 100644 |
2562 |
+--- a/fs/char_dev.c |
2563 |
++++ b/fs/char_dev.c |
2564 |
+@@ -39,7 +39,9 @@ struct backing_dev_info directly_mappable_cdev_bdi = { |
2565 |
+ #endif |
2566 |
+ /* permit direct mmap, for read, write or exec */ |
2567 |
+ BDI_CAP_MAP_DIRECT | |
2568 |
+- BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP), |
2569 |
++ BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP | |
2570 |
++ /* no writeback happens */ |
2571 |
++ BDI_CAP_NO_ACCT_AND_WRITEBACK), |
2572 |
+ }; |
2573 |
+ |
2574 |
+ static struct kobj_map *cdev_map; |
2575 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
2576 |
+index 99596fc..1b23f9d 100644 |
2577 |
+--- a/fs/ext4/inode.c |
2578 |
++++ b/fs/ext4/inode.c |
2579 |
+@@ -4815,20 +4815,26 @@ void ext4_set_inode_flags(struct inode *inode) |
2580 |
+ /* Propagate flags from i_flags to EXT4_I(inode)->i_flags */ |
2581 |
+ void ext4_get_inode_flags(struct ext4_inode_info *ei) |
2582 |
+ { |
2583 |
+- unsigned int flags = ei->vfs_inode.i_flags; |
2584 |
+- |
2585 |
+- ei->i_flags &= ~(EXT4_SYNC_FL|EXT4_APPEND_FL| |
2586 |
+- EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL|EXT4_DIRSYNC_FL); |
2587 |
+- if (flags & S_SYNC) |
2588 |
+- ei->i_flags |= EXT4_SYNC_FL; |
2589 |
+- if (flags & S_APPEND) |
2590 |
+- ei->i_flags |= EXT4_APPEND_FL; |
2591 |
+- if (flags & S_IMMUTABLE) |
2592 |
+- ei->i_flags |= EXT4_IMMUTABLE_FL; |
2593 |
+- if (flags & S_NOATIME) |
2594 |
+- ei->i_flags |= EXT4_NOATIME_FL; |
2595 |
+- if (flags & S_DIRSYNC) |
2596 |
+- ei->i_flags |= EXT4_DIRSYNC_FL; |
2597 |
++ unsigned int vfs_fl; |
2598 |
++ unsigned long old_fl, new_fl; |
2599 |
++ |
2600 |
++ do { |
2601 |
++ vfs_fl = ei->vfs_inode.i_flags; |
2602 |
++ old_fl = ei->i_flags; |
2603 |
++ new_fl = old_fl & ~(EXT4_SYNC_FL|EXT4_APPEND_FL| |
2604 |
++ EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL| |
2605 |
++ EXT4_DIRSYNC_FL); |
2606 |
++ if (vfs_fl & S_SYNC) |
2607 |
++ new_fl |= EXT4_SYNC_FL; |
2608 |
++ if (vfs_fl & S_APPEND) |
2609 |
++ new_fl |= EXT4_APPEND_FL; |
2610 |
++ if (vfs_fl & S_IMMUTABLE) |
2611 |
++ new_fl |= EXT4_IMMUTABLE_FL; |
2612 |
++ if (vfs_fl & S_NOATIME) |
2613 |
++ new_fl |= EXT4_NOATIME_FL; |
2614 |
++ if (vfs_fl & S_DIRSYNC) |
2615 |
++ new_fl |= EXT4_DIRSYNC_FL; |
2616 |
++ } while (cmpxchg(&ei->i_flags, old_fl, new_fl) != old_fl); |
2617 |
+ } |
2618 |
+ |
2619 |
+ static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode, |
2620 |
+@@ -5067,7 +5073,7 @@ static int ext4_inode_blocks_set(handle_t *handle, |
2621 |
+ */ |
2622 |
+ raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); |
2623 |
+ raw_inode->i_blocks_high = 0; |
2624 |
+- ei->i_flags &= ~EXT4_HUGE_FILE_FL; |
2625 |
++ ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE); |
2626 |
+ return 0; |
2627 |
+ } |
2628 |
+ if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) |
2629 |
+@@ -5080,9 +5086,9 @@ static int ext4_inode_blocks_set(handle_t *handle, |
2630 |
+ */ |
2631 |
+ raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); |
2632 |
+ raw_inode->i_blocks_high = cpu_to_le16(i_blocks >> 32); |
2633 |
+- ei->i_flags &= ~EXT4_HUGE_FILE_FL; |
2634 |
++ ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE); |
2635 |
+ } else { |
2636 |
+- ei->i_flags |= EXT4_HUGE_FILE_FL; |
2637 |
++ ext4_set_inode_flag(inode, EXT4_INODE_HUGE_FILE); |
2638 |
+ /* i_block is stored in file system block size */ |
2639 |
+ i_blocks = i_blocks >> (inode->i_blkbits - 9); |
2640 |
+ raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); |
2641 |
+diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c |
2642 |
+index e27960c..5d3d2a7 100644 |
2643 |
+--- a/fs/notify/inotify/inotify_fsnotify.c |
2644 |
++++ b/fs/notify/inotify/inotify_fsnotify.c |
2645 |
+@@ -72,6 +72,9 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_ev |
2646 |
+ ret = 0; |
2647 |
+ } |
2648 |
+ |
2649 |
++ if (entry->mask & IN_ONESHOT) |
2650 |
++ fsnotify_destroy_mark_by_entry(entry); |
2651 |
++ |
2652 |
+ /* |
2653 |
+ * If we hold the entry until after the event is on the queue |
2654 |
+ * IN_IGNORED won't be able to pass this event in the queue |
2655 |
+diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c |
2656 |
+index 22ef16a..aef8f5d 100644 |
2657 |
+--- a/fs/notify/inotify/inotify_user.c |
2658 |
++++ b/fs/notify/inotify/inotify_user.c |
2659 |
+@@ -106,8 +106,11 @@ static inline __u32 inotify_arg_to_mask(u32 arg) |
2660 |
+ { |
2661 |
+ __u32 mask; |
2662 |
+ |
2663 |
+- /* everything should accept their own ignored and cares about children */ |
2664 |
+- mask = (FS_IN_IGNORED | FS_EVENT_ON_CHILD); |
2665 |
++ /* |
2666 |
++ * everything should accept their own ignored, cares about children, |
2667 |
++ * and should receive events when the inode is unmounted |
2668 |
++ */ |
2669 |
++ mask = (FS_IN_IGNORED | FS_EVENT_ON_CHILD | FS_UNMOUNT); |
2670 |
+ |
2671 |
+ /* mask off the flags used to open the fd */ |
2672 |
+ mask |= (arg & (IN_ALL_EVENTS | IN_ONESHOT)); |
2673 |
+diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c |
2674 |
+index fc71aab..bae725b 100644 |
2675 |
+--- a/fs/partitions/ibm.c |
2676 |
++++ b/fs/partitions/ibm.c |
2677 |
+@@ -74,6 +74,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) |
2678 |
+ } *label; |
2679 |
+ unsigned char *data; |
2680 |
+ Sector sect; |
2681 |
++ sector_t labelsect; |
2682 |
+ |
2683 |
+ res = 0; |
2684 |
+ blocksize = bdev_logical_block_size(bdev); |
2685 |
+@@ -98,9 +99,19 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) |
2686 |
+ goto out_freeall; |
2687 |
+ |
2688 |
+ /* |
2689 |
++ * Special case for FBA disks: label sector does not depend on |
2690 |
++ * blocksize. |
2691 |
++ */ |
2692 |
++ if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) || |
2693 |
++ (info->cu_type == 0x3880 && info->dev_type == 0x3370)) |
2694 |
++ labelsect = info->label_block; |
2695 |
++ else |
2696 |
++ labelsect = info->label_block * (blocksize >> 9); |
2697 |
++ |
2698 |
++ /* |
2699 |
+ * Get volume label, extract name and type. |
2700 |
+ */ |
2701 |
+- data = read_dev_sector(bdev, info->label_block*(blocksize/512), §); |
2702 |
++ data = read_dev_sector(bdev, labelsect, §); |
2703 |
+ if (data == NULL) |
2704 |
+ goto out_readerr; |
2705 |
+ |
2706 |
+diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c |
2707 |
+index 5bb523d..98fe0db 100644 |
2708 |
+--- a/fs/xfs/linux-2.6/xfs_ioctl.c |
2709 |
++++ b/fs/xfs/linux-2.6/xfs_ioctl.c |
2710 |
+@@ -789,6 +789,8 @@ xfs_ioc_fsgetxattr( |
2711 |
+ { |
2712 |
+ struct fsxattr fa; |
2713 |
+ |
2714 |
++ memset(&fa, 0, sizeof(struct fsxattr)); |
2715 |
++ |
2716 |
+ xfs_ilock(ip, XFS_ILOCK_SHARED); |
2717 |
+ fa.fsx_xflags = xfs_ip2xflags(ip); |
2718 |
+ fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog; |
2719 |
+diff --git a/include/linux/mm.h b/include/linux/mm.h |
2720 |
+index 24c3956..a8d25e4 100644 |
2721 |
+--- a/include/linux/mm.h |
2722 |
++++ b/include/linux/mm.h |
2723 |
+@@ -77,7 +77,11 @@ extern unsigned int kobjsize(const void *objp); |
2724 |
+ #define VM_MAYSHARE 0x00000080 |
2725 |
+ |
2726 |
+ #define VM_GROWSDOWN 0x00000100 /* general info on the segment */ |
2727 |
++#if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64) |
2728 |
+ #define VM_GROWSUP 0x00000200 |
2729 |
++#else |
2730 |
++#define VM_GROWSUP 0x00000000 |
2731 |
++#endif |
2732 |
+ #define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ |
2733 |
+ #define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ |
2734 |
+ |
2735 |
+@@ -1195,8 +1199,10 @@ unsigned long ra_submit(struct file_ra_state *ra, |
2736 |
+ |
2737 |
+ /* Do stack extension */ |
2738 |
+ extern int expand_stack(struct vm_area_struct *vma, unsigned long address); |
2739 |
+-#ifdef CONFIG_IA64 |
2740 |
++#if VM_GROWSUP |
2741 |
+ extern int expand_upwards(struct vm_area_struct *vma, unsigned long address); |
2742 |
++#else |
2743 |
++ #define expand_upwards(vma, address) do { } while (0) |
2744 |
+ #endif |
2745 |
+ extern int expand_stack_downwards(struct vm_area_struct *vma, |
2746 |
+ unsigned long address); |
2747 |
+diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h |
2748 |
+index 6f75617..6c31a2a 100644 |
2749 |
+--- a/include/linux/mmzone.h |
2750 |
++++ b/include/linux/mmzone.h |
2751 |
+@@ -290,6 +290,13 @@ struct zone { |
2752 |
+ unsigned long watermark[NR_WMARK]; |
2753 |
+ |
2754 |
+ /* |
2755 |
++ * When free pages are below this point, additional steps are taken |
2756 |
++ * when reading the number of free pages to avoid per-cpu counter |
2757 |
++ * drift allowing watermarks to be breached |
2758 |
++ */ |
2759 |
++ unsigned long percpu_drift_mark; |
2760 |
++ |
2761 |
++ /* |
2762 |
+ * We don't know if the memory that we're going to allocate will be freeable |
2763 |
+ * or/and it will be released eventually, so to avoid totally wasting several |
2764 |
+ * GB of ram we must reserve some of the lower zone memory (otherwise we risk |
2765 |
+@@ -460,6 +467,12 @@ static inline int zone_is_oom_locked(const struct zone *zone) |
2766 |
+ return test_bit(ZONE_OOM_LOCKED, &zone->flags); |
2767 |
+ } |
2768 |
+ |
2769 |
++#ifdef CONFIG_SMP |
2770 |
++unsigned long zone_nr_free_pages(struct zone *zone); |
2771 |
++#else |
2772 |
++#define zone_nr_free_pages(zone) zone_page_state(zone, NR_FREE_PAGES) |
2773 |
++#endif /* CONFIG_SMP */ |
2774 |
++ |
2775 |
+ /* |
2776 |
+ * The "priority" of VM scanning is how much of the queues we will scan in one |
2777 |
+ * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the |
2778 |
+diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h |
2779 |
+index 2d0f222..13070d6 100644 |
2780 |
+--- a/include/linux/vmstat.h |
2781 |
++++ b/include/linux/vmstat.h |
2782 |
+@@ -166,6 +166,28 @@ static inline unsigned long zone_page_state(struct zone *zone, |
2783 |
+ return x; |
2784 |
+ } |
2785 |
+ |
2786 |
++/* |
2787 |
++ * More accurate version that also considers the currently pending |
2788 |
++ * deltas. For that we need to loop over all cpus to find the current |
2789 |
++ * deltas. There is no synchronization so the result cannot be |
2790 |
++ * exactly accurate either. |
2791 |
++ */ |
2792 |
++static inline unsigned long zone_page_state_snapshot(struct zone *zone, |
2793 |
++ enum zone_stat_item item) |
2794 |
++{ |
2795 |
++ long x = atomic_long_read(&zone->vm_stat[item]); |
2796 |
++ |
2797 |
++#ifdef CONFIG_SMP |
2798 |
++ int cpu; |
2799 |
++ for_each_online_cpu(cpu) |
2800 |
++ x += zone_pcp(zone, cpu)->vm_stat_diff[item]; |
2801 |
++ |
2802 |
++ if (x < 0) |
2803 |
++ x = 0; |
2804 |
++#endif |
2805 |
++ return x; |
2806 |
++} |
2807 |
++ |
2808 |
+ extern unsigned long global_reclaimable_pages(void); |
2809 |
+ extern unsigned long zone_reclaimable_pages(struct zone *zone); |
2810 |
+ |
2811 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
2812 |
+index 842ac4d..6cfe18b 100644 |
2813 |
+--- a/include/net/tcp.h |
2814 |
++++ b/include/net/tcp.h |
2815 |
+@@ -259,11 +259,21 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) |
2816 |
+ return seq3 - seq2 >= seq1 - seq2; |
2817 |
+ } |
2818 |
+ |
2819 |
+-static inline int tcp_too_many_orphans(struct sock *sk, int num) |
2820 |
++static inline bool tcp_too_many_orphans(struct sock *sk, int shift) |
2821 |
+ { |
2822 |
+- return (num > sysctl_tcp_max_orphans) || |
2823 |
+- (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && |
2824 |
+- atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); |
2825 |
++ struct percpu_counter *ocp = sk->sk_prot->orphan_count; |
2826 |
++ int orphans = percpu_counter_read_positive(ocp); |
2827 |
++ |
2828 |
++ if (orphans << shift > sysctl_tcp_max_orphans) { |
2829 |
++ orphans = percpu_counter_sum_positive(ocp); |
2830 |
++ if (orphans << shift > sysctl_tcp_max_orphans) |
2831 |
++ return true; |
2832 |
++ } |
2833 |
++ |
2834 |
++ if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && |
2835 |
++ atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]) |
2836 |
++ return true; |
2837 |
++ return false; |
2838 |
+ } |
2839 |
+ |
2840 |
+ /* syncookies: remember time of last synqueue overflow */ |
2841 |
+@@ -501,8 +511,22 @@ extern unsigned int tcp_current_mss(struct sock *sk); |
2842 |
+ /* Bound MSS / TSO packet size with the half of the window */ |
2843 |
+ static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) |
2844 |
+ { |
2845 |
+- if (tp->max_window && pktsize > (tp->max_window >> 1)) |
2846 |
+- return max(tp->max_window >> 1, 68U - tp->tcp_header_len); |
2847 |
++ int cutoff; |
2848 |
++ |
2849 |
++ /* When peer uses tiny windows, there is no use in packetizing |
2850 |
++ * to sub-MSS pieces for the sake of SWS or making sure there |
2851 |
++ * are enough packets in the pipe for fast recovery. |
2852 |
++ * |
2853 |
++ * On the other hand, for extremely large MSS devices, handling |
2854 |
++ * smaller than MSS windows in this way does make sense. |
2855 |
++ */ |
2856 |
++ if (tp->max_window >= 512) |
2857 |
++ cutoff = (tp->max_window >> 1); |
2858 |
++ else |
2859 |
++ cutoff = tp->max_window; |
2860 |
++ |
2861 |
++ if (cutoff && pktsize > cutoff) |
2862 |
++ return max_t(int, cutoff, 68U - tp->tcp_header_len); |
2863 |
+ else |
2864 |
+ return pktsize; |
2865 |
+ } |
2866 |
+diff --git a/kernel/exit.c b/kernel/exit.c |
2867 |
+index 4a0e062..45102e9 100644 |
2868 |
+--- a/kernel/exit.c |
2869 |
++++ b/kernel/exit.c |
2870 |
+@@ -1374,8 +1374,7 @@ static int wait_task_stopped(struct wait_opts *wo, |
2871 |
+ if (!unlikely(wo->wo_flags & WNOWAIT)) |
2872 |
+ *p_code = 0; |
2873 |
+ |
2874 |
+- /* don't need the RCU readlock here as we're holding a spinlock */ |
2875 |
+- uid = __task_cred(p)->uid; |
2876 |
++ uid = task_uid(p); |
2877 |
+ unlock_sig: |
2878 |
+ spin_unlock_irq(&p->sighand->siglock); |
2879 |
+ if (!exit_code) |
2880 |
+@@ -1448,7 +1447,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) |
2881 |
+ } |
2882 |
+ if (!unlikely(wo->wo_flags & WNOWAIT)) |
2883 |
+ p->signal->flags &= ~SIGNAL_STOP_CONTINUED; |
2884 |
+- uid = __task_cred(p)->uid; |
2885 |
++ uid = task_uid(p); |
2886 |
+ spin_unlock_irq(&p->sighand->siglock); |
2887 |
+ |
2888 |
+ pid = task_pid_vnr(p); |
2889 |
+diff --git a/kernel/sched.c b/kernel/sched.c |
2890 |
+index 152214d..3480822 100644 |
2891 |
+--- a/kernel/sched.c |
2892 |
++++ b/kernel/sched.c |
2893 |
+@@ -5341,9 +5341,9 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st) |
2894 |
+ rtime = nsecs_to_cputime(cputime.sum_exec_runtime); |
2895 |
+ |
2896 |
+ if (total) { |
2897 |
+- u64 temp; |
2898 |
++ u64 temp = rtime; |
2899 |
+ |
2900 |
+- temp = (u64)(rtime * cputime.utime); |
2901 |
++ temp *= cputime.utime; |
2902 |
+ do_div(temp, total); |
2903 |
+ utime = (cputime_t)temp; |
2904 |
+ } else |
2905 |
+diff --git a/kernel/sys.c b/kernel/sys.c |
2906 |
+index 26e4b8a..440ca69 100644 |
2907 |
+--- a/kernel/sys.c |
2908 |
++++ b/kernel/sys.c |
2909 |
+@@ -962,6 +962,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) |
2910 |
+ pgid = pid; |
2911 |
+ if (pgid < 0) |
2912 |
+ return -EINVAL; |
2913 |
++ rcu_read_lock(); |
2914 |
+ |
2915 |
+ /* From this point forward we keep holding onto the tasklist lock |
2916 |
+ * so that our parent does not change from under us. -DaveM |
2917 |
+@@ -1015,6 +1016,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) |
2918 |
+ out: |
2919 |
+ /* All paths lead to here, thus we are safe. -DaveM */ |
2920 |
+ write_unlock_irq(&tasklist_lock); |
2921 |
++ rcu_read_unlock(); |
2922 |
+ return err; |
2923 |
+ } |
2924 |
+ |
2925 |
+diff --git a/mm/memory.c b/mm/memory.c |
2926 |
+index 194dc17..53c1da0 100644 |
2927 |
+--- a/mm/memory.c |
2928 |
++++ b/mm/memory.c |
2929 |
+@@ -2630,11 +2630,9 @@ out_release: |
2930 |
+ } |
2931 |
+ |
2932 |
+ /* |
2933 |
+- * This is like a special single-page "expand_downwards()", |
2934 |
+- * except we must first make sure that 'address-PAGE_SIZE' |
2935 |
++ * This is like a special single-page "expand_{down|up}wards()", |
2936 |
++ * except we must first make sure that 'address{-|+}PAGE_SIZE' |
2937 |
+ * doesn't hit another vma. |
2938 |
+- * |
2939 |
+- * The "find_vma()" will do the right thing even if we wrap |
2940 |
+ */ |
2941 |
+ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address) |
2942 |
+ { |
2943 |
+@@ -2653,6 +2651,15 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo |
2944 |
+ |
2945 |
+ expand_stack(vma, address - PAGE_SIZE); |
2946 |
+ } |
2947 |
++ if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { |
2948 |
++ struct vm_area_struct *next = vma->vm_next; |
2949 |
++ |
2950 |
++ /* As VM_GROWSDOWN but s/below/above/ */ |
2951 |
++ if (next && next->vm_start == address + PAGE_SIZE) |
2952 |
++ return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; |
2953 |
++ |
2954 |
++ expand_upwards(vma, address + PAGE_SIZE); |
2955 |
++ } |
2956 |
+ return 0; |
2957 |
+ } |
2958 |
+ |
2959 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
2960 |
+index b309c75..866a666 100644 |
2961 |
+--- a/mm/mmap.c |
2962 |
++++ b/mm/mmap.c |
2963 |
+@@ -1600,9 +1600,6 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns |
2964 |
+ * PA-RISC uses this for its stack; IA64 for its Register Backing Store. |
2965 |
+ * vma is the last one with address > vma->vm_end. Have to extend vma. |
2966 |
+ */ |
2967 |
+-#ifndef CONFIG_IA64 |
2968 |
+-static |
2969 |
+-#endif |
2970 |
+ int expand_upwards(struct vm_area_struct *vma, unsigned long address) |
2971 |
+ { |
2972 |
+ int error; |
2973 |
+diff --git a/mm/mmzone.c b/mm/mmzone.c |
2974 |
+index f5b7d17..e35bfb8 100644 |
2975 |
+--- a/mm/mmzone.c |
2976 |
++++ b/mm/mmzone.c |
2977 |
+@@ -87,3 +87,24 @@ int memmap_valid_within(unsigned long pfn, |
2978 |
+ return 1; |
2979 |
+ } |
2980 |
+ #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ |
2981 |
++ |
2982 |
++#ifdef CONFIG_SMP |
2983 |
++/* Called when a more accurate view of NR_FREE_PAGES is needed */ |
2984 |
++unsigned long zone_nr_free_pages(struct zone *zone) |
2985 |
++{ |
2986 |
++ unsigned long nr_free_pages = zone_page_state(zone, NR_FREE_PAGES); |
2987 |
++ |
2988 |
++ /* |
2989 |
++ * While kswapd is awake, it is considered the zone is under some |
2990 |
++ * memory pressure. Under pressure, there is a risk that |
2991 |
++ * per-cpu-counter-drift will allow the min watermark to be breached |
2992 |
++ * potentially causing a live-lock. While kswapd is awake and |
2993 |
++ * free pages are low, get a better estimate for free pages |
2994 |
++ */ |
2995 |
++ if (nr_free_pages < zone->percpu_drift_mark && |
2996 |
++ !waitqueue_active(&zone->zone_pgdat->kswapd_wait)) |
2997 |
++ return zone_page_state_snapshot(zone, NR_FREE_PAGES); |
2998 |
++ |
2999 |
++ return nr_free_pages; |
3000 |
++} |
3001 |
++#endif /* CONFIG_SMP */ |
3002 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
3003 |
+index 36992b6..902e5fc 100644 |
3004 |
+--- a/mm/page_alloc.c |
3005 |
++++ b/mm/page_alloc.c |
3006 |
+@@ -531,13 +531,13 @@ static void free_pcppages_bulk(struct zone *zone, int count, |
3007 |
+ { |
3008 |
+ int migratetype = 0; |
3009 |
+ int batch_free = 0; |
3010 |
++ int to_free = count; |
3011 |
+ |
3012 |
+ spin_lock(&zone->lock); |
3013 |
+ zone_clear_flag(zone, ZONE_ALL_UNRECLAIMABLE); |
3014 |
+ zone->pages_scanned = 0; |
3015 |
+ |
3016 |
+- __mod_zone_page_state(zone, NR_FREE_PAGES, count); |
3017 |
+- while (count) { |
3018 |
++ while (to_free) { |
3019 |
+ struct page *page; |
3020 |
+ struct list_head *list; |
3021 |
+ |
3022 |
+@@ -562,8 +562,9 @@ static void free_pcppages_bulk(struct zone *zone, int count, |
3023 |
+ /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ |
3024 |
+ __free_one_page(page, zone, 0, page_private(page)); |
3025 |
+ trace_mm_page_pcpu_drain(page, 0, page_private(page)); |
3026 |
+- } while (--count && --batch_free && !list_empty(list)); |
3027 |
++ } while (--to_free && --batch_free && !list_empty(list)); |
3028 |
+ } |
3029 |
++ __mod_zone_page_state(zone, NR_FREE_PAGES, count); |
3030 |
+ spin_unlock(&zone->lock); |
3031 |
+ } |
3032 |
+ |
3033 |
+@@ -574,8 +575,8 @@ static void free_one_page(struct zone *zone, struct page *page, int order, |
3034 |
+ zone_clear_flag(zone, ZONE_ALL_UNRECLAIMABLE); |
3035 |
+ zone->pages_scanned = 0; |
3036 |
+ |
3037 |
+- __mod_zone_page_state(zone, NR_FREE_PAGES, 1 << order); |
3038 |
+ __free_one_page(page, zone, order, migratetype); |
3039 |
++ __mod_zone_page_state(zone, NR_FREE_PAGES, 1 << order); |
3040 |
+ spin_unlock(&zone->lock); |
3041 |
+ } |
3042 |
+ |
3043 |
+@@ -1365,7 +1366,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
3044 |
+ { |
3045 |
+ /* free_pages my go negative - that's OK */ |
3046 |
+ long min = mark; |
3047 |
+- long free_pages = zone_page_state(z, NR_FREE_PAGES) - (1 << order) + 1; |
3048 |
++ long free_pages = zone_nr_free_pages(z) - (1 << order) + 1; |
3049 |
+ int o; |
3050 |
+ |
3051 |
+ if (alloc_flags & ALLOC_HIGH) |
3052 |
+@@ -1681,6 +1682,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, |
3053 |
+ struct page *page = NULL; |
3054 |
+ struct reclaim_state reclaim_state; |
3055 |
+ struct task_struct *p = current; |
3056 |
++ bool drained = false; |
3057 |
+ |
3058 |
+ cond_resched(); |
3059 |
+ |
3060 |
+@@ -1699,14 +1701,25 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, |
3061 |
+ |
3062 |
+ cond_resched(); |
3063 |
+ |
3064 |
+- if (order != 0) |
3065 |
+- drain_all_pages(); |
3066 |
++ if (unlikely(!(*did_some_progress))) |
3067 |
++ return NULL; |
3068 |
+ |
3069 |
+- if (likely(*did_some_progress)) |
3070 |
+- page = get_page_from_freelist(gfp_mask, nodemask, order, |
3071 |
++retry: |
3072 |
++ page = get_page_from_freelist(gfp_mask, nodemask, order, |
3073 |
+ zonelist, high_zoneidx, |
3074 |
+ alloc_flags, preferred_zone, |
3075 |
+ migratetype); |
3076 |
++ |
3077 |
++ /* |
3078 |
++ * If an allocation failed after direct reclaim, it could be because |
3079 |
++ * pages are pinned on the per-cpu lists. Drain them and try again |
3080 |
++ */ |
3081 |
++ if (!page && !drained) { |
3082 |
++ drain_all_pages(); |
3083 |
++ drained = true; |
3084 |
++ goto retry; |
3085 |
++ } |
3086 |
++ |
3087 |
+ return page; |
3088 |
+ } |
3089 |
+ |
3090 |
+@@ -2238,7 +2251,7 @@ void show_free_areas(void) |
3091 |
+ " all_unreclaimable? %s" |
3092 |
+ "\n", |
3093 |
+ zone->name, |
3094 |
+- K(zone_page_state(zone, NR_FREE_PAGES)), |
3095 |
++ K(zone_nr_free_pages(zone)), |
3096 |
+ K(min_wmark_pages(zone)), |
3097 |
+ K(low_wmark_pages(zone)), |
3098 |
+ K(high_wmark_pages(zone)), |
3099 |
+diff --git a/mm/percpu.c b/mm/percpu.c |
3100 |
+index 5adfc26..3bfd6e2 100644 |
3101 |
+--- a/mm/percpu.c |
3102 |
++++ b/mm/percpu.c |
3103 |
+@@ -1702,9 +1702,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, |
3104 |
+ |
3105 |
+ if (pcpu_first_unit_cpu == NR_CPUS) |
3106 |
+ pcpu_first_unit_cpu = cpu; |
3107 |
++ pcpu_last_unit_cpu = cpu; |
3108 |
+ } |
3109 |
+ } |
3110 |
+- pcpu_last_unit_cpu = cpu; |
3111 |
+ pcpu_nr_units = unit; |
3112 |
+ |
3113 |
+ for_each_possible_cpu(cpu) |
3114 |
+diff --git a/mm/vmstat.c b/mm/vmstat.c |
3115 |
+index c81321f..42d76c6 100644 |
3116 |
+--- a/mm/vmstat.c |
3117 |
++++ b/mm/vmstat.c |
3118 |
+@@ -136,10 +136,23 @@ static void refresh_zone_stat_thresholds(void) |
3119 |
+ int threshold; |
3120 |
+ |
3121 |
+ for_each_populated_zone(zone) { |
3122 |
++ unsigned long max_drift, tolerate_drift; |
3123 |
++ |
3124 |
+ threshold = calculate_threshold(zone); |
3125 |
+ |
3126 |
+ for_each_online_cpu(cpu) |
3127 |
+ zone_pcp(zone, cpu)->stat_threshold = threshold; |
3128 |
++ |
3129 |
++ /* |
3130 |
++ * Only set percpu_drift_mark if there is a danger that |
3131 |
++ * NR_FREE_PAGES reports the low watermark is ok when in fact |
3132 |
++ * the min watermark could be breached by an allocation |
3133 |
++ */ |
3134 |
++ tolerate_drift = low_wmark_pages(zone) - min_wmark_pages(zone); |
3135 |
++ max_drift = num_online_cpus() * threshold; |
3136 |
++ if (max_drift > tolerate_drift) |
3137 |
++ zone->percpu_drift_mark = high_wmark_pages(zone) + |
3138 |
++ max_drift; |
3139 |
+ } |
3140 |
+ } |
3141 |
+ |
3142 |
+@@ -715,7 +728,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, |
3143 |
+ "\n scanned %lu" |
3144 |
+ "\n spanned %lu" |
3145 |
+ "\n present %lu", |
3146 |
+- zone_page_state(zone, NR_FREE_PAGES), |
3147 |
++ zone_nr_free_pages(zone), |
3148 |
+ min_wmark_pages(zone), |
3149 |
+ low_wmark_pages(zone), |
3150 |
+ high_wmark_pages(zone), |
3151 |
+diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c |
3152 |
+index a16a234..3072272 100644 |
3153 |
+--- a/net/bridge/br_netfilter.c |
3154 |
++++ b/net/bridge/br_netfilter.c |
3155 |
+@@ -600,6 +600,9 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb, |
3156 |
+ |
3157 |
+ pskb_trim_rcsum(skb, len); |
3158 |
+ |
3159 |
++ /* BUG: Should really parse the IP options here. */ |
3160 |
++ memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); |
3161 |
++ |
3162 |
+ nf_bridge_put(skb->nf_bridge); |
3163 |
+ if (!nf_bridge_alloc(skb)) |
3164 |
+ return NF_DROP; |
3165 |
+@@ -797,9 +800,11 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb) |
3166 |
+ if (skb->nfct != NULL && |
3167 |
+ (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb)) && |
3168 |
+ skb->len > skb->dev->mtu && |
3169 |
+- !skb_is_gso(skb)) |
3170 |
++ !skb_is_gso(skb)) { |
3171 |
++ /* BUG: Should really parse the IP options here. */ |
3172 |
++ memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); |
3173 |
+ return ip_fragment(skb, br_dev_queue_push_xmit); |
3174 |
+- else |
3175 |
++ } else |
3176 |
+ return br_dev_queue_push_xmit(skb); |
3177 |
+ } |
3178 |
+ #else |
3179 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
3180 |
+index ec85681..283f441 100644 |
3181 |
+--- a/net/core/skbuff.c |
3182 |
++++ b/net/core/skbuff.c |
3183 |
+@@ -2575,6 +2575,10 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features) |
3184 |
+ __copy_skb_header(nskb, skb); |
3185 |
+ nskb->mac_len = skb->mac_len; |
3186 |
+ |
3187 |
++ /* nskb and skb might have different headroom */ |
3188 |
++ if (nskb->ip_summed == CHECKSUM_PARTIAL) |
3189 |
++ nskb->csum_start += skb_headroom(nskb) - headroom; |
3190 |
++ |
3191 |
+ skb_reset_mac_header(nskb); |
3192 |
+ skb_set_network_header(nskb, skb->mac_len); |
3193 |
+ nskb->transport_header = (nskb->network_header + |
3194 |
+@@ -2705,7 +2709,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) |
3195 |
+ return -E2BIG; |
3196 |
+ |
3197 |
+ headroom = skb_headroom(p); |
3198 |
+- nskb = netdev_alloc_skb(p->dev, headroom + skb_gro_offset(p)); |
3199 |
++ nskb = alloc_skb(headroom + skb_gro_offset(p), GFP_ATOMIC); |
3200 |
+ if (unlikely(!nskb)) |
3201 |
+ return -ENOMEM; |
3202 |
+ |
3203 |
+@@ -2726,6 +2730,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) |
3204 |
+ *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p); |
3205 |
+ skb_shinfo(nskb)->frag_list = p; |
3206 |
+ skb_shinfo(nskb)->gso_size = pinfo->gso_size; |
3207 |
++ pinfo->gso_size = 0; |
3208 |
+ skb_header_release(p); |
3209 |
+ nskb->prev = p; |
3210 |
+ |
3211 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
3212 |
+index f1813bc..108fad0 100644 |
3213 |
+--- a/net/ipv4/tcp.c |
3214 |
++++ b/net/ipv4/tcp.c |
3215 |
+@@ -451,7 +451,8 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) |
3216 |
+ if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) |
3217 |
+ mask |= POLLOUT | POLLWRNORM; |
3218 |
+ } |
3219 |
+- } |
3220 |
++ } else |
3221 |
++ mask |= POLLOUT | POLLWRNORM; |
3222 |
+ |
3223 |
+ if (tp->urg_data & TCP_URG_VALID) |
3224 |
+ mask |= POLLPRI; |
3225 |
+@@ -1334,6 +1335,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, |
3226 |
+ sk_eat_skb(sk, skb, 0); |
3227 |
+ if (!desc->count) |
3228 |
+ break; |
3229 |
++ tp->copied_seq = seq; |
3230 |
+ } |
3231 |
+ tp->copied_seq = seq; |
3232 |
+ |
3233 |
+@@ -1975,11 +1977,8 @@ adjudge_to_death: |
3234 |
+ } |
3235 |
+ } |
3236 |
+ if (sk->sk_state != TCP_CLOSE) { |
3237 |
+- int orphan_count = percpu_counter_read_positive( |
3238 |
+- sk->sk_prot->orphan_count); |
3239 |
+- |
3240 |
+ sk_mem_reclaim(sk); |
3241 |
+- if (tcp_too_many_orphans(sk, orphan_count)) { |
3242 |
++ if (tcp_too_many_orphans(sk, 0)) { |
3243 |
+ if (net_ratelimit()) |
3244 |
+ printk(KERN_INFO "TCP: too many of orphaned " |
3245 |
+ "sockets\n"); |
3246 |
+@@ -2880,7 +2879,7 @@ void __init tcp_init(void) |
3247 |
+ { |
3248 |
+ struct sk_buff *skb = NULL; |
3249 |
+ unsigned long nr_pages, limit; |
3250 |
+- int order, i, max_share; |
3251 |
++ int i, max_share, cnt; |
3252 |
+ |
3253 |
+ BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); |
3254 |
+ |
3255 |
+@@ -2929,22 +2928,12 @@ void __init tcp_init(void) |
3256 |
+ INIT_HLIST_HEAD(&tcp_hashinfo.bhash[i].chain); |
3257 |
+ } |
3258 |
+ |
3259 |
+- /* Try to be a bit smarter and adjust defaults depending |
3260 |
+- * on available memory. |
3261 |
+- */ |
3262 |
+- for (order = 0; ((1 << order) << PAGE_SHIFT) < |
3263 |
+- (tcp_hashinfo.bhash_size * sizeof(struct inet_bind_hashbucket)); |
3264 |
+- order++) |
3265 |
+- ; |
3266 |
+- if (order >= 4) { |
3267 |
+- tcp_death_row.sysctl_max_tw_buckets = 180000; |
3268 |
+- sysctl_tcp_max_orphans = 4096 << (order - 4); |
3269 |
+- sysctl_max_syn_backlog = 1024; |
3270 |
+- } else if (order < 3) { |
3271 |
+- tcp_death_row.sysctl_max_tw_buckets >>= (3 - order); |
3272 |
+- sysctl_tcp_max_orphans >>= (3 - order); |
3273 |
+- sysctl_max_syn_backlog = 128; |
3274 |
+- } |
3275 |
++ |
3276 |
++ cnt = tcp_hashinfo.ehash_size; |
3277 |
++ |
3278 |
++ tcp_death_row.sysctl_max_tw_buckets = cnt / 2; |
3279 |
++ sysctl_tcp_max_orphans = cnt / 2; |
3280 |
++ sysctl_max_syn_backlog = max(128, cnt / 256); |
3281 |
+ |
3282 |
+ /* Set the pressure threshold to be a fraction of global memory that |
3283 |
+ * is up to 1/2 at 256 MB, decreasing toward zero with the amount of |
3284 |
+diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c |
3285 |
+index cdb2ca7..57d5501 100644 |
3286 |
+--- a/net/ipv4/tcp_timer.c |
3287 |
++++ b/net/ipv4/tcp_timer.c |
3288 |
+@@ -65,18 +65,18 @@ static void tcp_write_err(struct sock *sk) |
3289 |
+ static int tcp_out_of_resources(struct sock *sk, int do_reset) |
3290 |
+ { |
3291 |
+ struct tcp_sock *tp = tcp_sk(sk); |
3292 |
+- int orphans = percpu_counter_read_positive(&tcp_orphan_count); |
3293 |
++ int shift = 0; |
3294 |
+ |
3295 |
+ /* If peer does not open window for long time, or did not transmit |
3296 |
+ * anything for long time, penalize it. */ |
3297 |
+ if ((s32)(tcp_time_stamp - tp->lsndtime) > 2*TCP_RTO_MAX || !do_reset) |
3298 |
+- orphans <<= 1; |
3299 |
++ shift++; |
3300 |
+ |
3301 |
+ /* If some dubious ICMP arrived, penalize even more. */ |
3302 |
+ if (sk->sk_err_soft) |
3303 |
+- orphans <<= 1; |
3304 |
++ shift++; |
3305 |
+ |
3306 |
+- if (tcp_too_many_orphans(sk, orphans)) { |
3307 |
++ if (tcp_too_many_orphans(sk, shift)) { |
3308 |
+ if (net_ratelimit()) |
3309 |
+ printk(KERN_INFO "Out of socket memory\n"); |
3310 |
+ |
3311 |
+diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c |
3312 |
+index dd35641..b6cef980 100644 |
3313 |
+--- a/net/irda/af_irda.c |
3314 |
++++ b/net/irda/af_irda.c |
3315 |
+@@ -810,8 +810,8 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
3316 |
+ |
3317 |
+ err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name); |
3318 |
+ if (err < 0) { |
3319 |
+- kfree(self->ias_obj->name); |
3320 |
+- kfree(self->ias_obj); |
3321 |
++ irias_delete_object(self->ias_obj); |
3322 |
++ self->ias_obj = NULL; |
3323 |
+ return err; |
3324 |
+ } |
3325 |
+ |
3326 |
+diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c |
3327 |
+index 7aa4fd1..2da8d14 100644 |
3328 |
+--- a/net/llc/af_llc.c |
3329 |
++++ b/net/llc/af_llc.c |
3330 |
+@@ -977,7 +977,8 @@ static int llc_ui_setsockopt(struct socket *sock, int level, int optname, |
3331 |
+ { |
3332 |
+ struct sock *sk = sock->sk; |
3333 |
+ struct llc_sock *llc = llc_sk(sk); |
3334 |
+- int rc = -EINVAL, opt; |
3335 |
++ unsigned int opt; |
3336 |
++ int rc = -EINVAL; |
3337 |
+ |
3338 |
+ lock_sock(sk); |
3339 |
+ if (unlikely(level != SOL_LLC || optlen != sizeof(int))) |
3340 |
+diff --git a/net/rds/recv.c b/net/rds/recv.c |
3341 |
+index fdff33c..6a2654a 100644 |
3342 |
+--- a/net/rds/recv.c |
3343 |
++++ b/net/rds/recv.c |
3344 |
+@@ -296,7 +296,7 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc, |
3345 |
+ int rds_notify_queue_get(struct rds_sock *rs, struct msghdr *msghdr) |
3346 |
+ { |
3347 |
+ struct rds_notifier *notifier; |
3348 |
+- struct rds_rdma_notify cmsg; |
3349 |
++ struct rds_rdma_notify cmsg = { 0 }; /* fill holes with zero */ |
3350 |
+ unsigned int count = 0, max_messages = ~0U; |
3351 |
+ unsigned long flags; |
3352 |
+ LIST_HEAD(copy); |
3353 |
+diff --git a/net/sctp/output.c b/net/sctp/output.c |
3354 |
+index 5cbda8f..d494100 100644 |
3355 |
+--- a/net/sctp/output.c |
3356 |
++++ b/net/sctp/output.c |
3357 |
+@@ -91,7 +91,6 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet, |
3358 |
+ SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__, |
3359 |
+ packet, vtag); |
3360 |
+ |
3361 |
+- sctp_packet_reset(packet); |
3362 |
+ packet->vtag = vtag; |
3363 |
+ |
3364 |
+ if (ecn_capable && sctp_packet_empty(packet)) { |
3365 |
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
3366 |
+index fc820cd..065dc66 100644 |
3367 |
+--- a/net/unix/af_unix.c |
3368 |
++++ b/net/unix/af_unix.c |
3369 |
+@@ -671,6 +671,7 @@ static int unix_autobind(struct socket *sock) |
3370 |
+ static u32 ordernum = 1; |
3371 |
+ struct unix_address *addr; |
3372 |
+ int err; |
3373 |
++ unsigned int retries = 0; |
3374 |
+ |
3375 |
+ mutex_lock(&u->readlock); |
3376 |
+ |
3377 |
+@@ -696,9 +697,17 @@ retry: |
3378 |
+ if (__unix_find_socket_byname(net, addr->name, addr->len, sock->type, |
3379 |
+ addr->hash)) { |
3380 |
+ spin_unlock(&unix_table_lock); |
3381 |
+- /* Sanity yield. It is unusual case, but yet... */ |
3382 |
+- if (!(ordernum&0xFF)) |
3383 |
+- yield(); |
3384 |
++ /* |
3385 |
++ * __unix_find_socket_byname() may take long time if many names |
3386 |
++ * are already in use. |
3387 |
++ */ |
3388 |
++ cond_resched(); |
3389 |
++ /* Give up if all names seems to be in use. */ |
3390 |
++ if (retries++ == 0xFFFFF) { |
3391 |
++ err = -ENOSPC; |
3392 |
++ kfree(addr); |
3393 |
++ goto out; |
3394 |
++ } |
3395 |
+ goto retry; |
3396 |
+ } |
3397 |
+ addr->hash ^= sk->sk_type; |
3398 |
+diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c |
3399 |
+index 1cad4c7..b0bd910 100644 |
3400 |
+--- a/security/keys/keyctl.c |
3401 |
++++ b/security/keys/keyctl.c |
3402 |
+@@ -1259,6 +1259,7 @@ long keyctl_session_to_parent(void) |
3403 |
+ keyring_r = NULL; |
3404 |
+ |
3405 |
+ me = current; |
3406 |
++ rcu_read_lock(); |
3407 |
+ write_lock_irq(&tasklist_lock); |
3408 |
+ |
3409 |
+ parent = me->real_parent; |
3410 |
+@@ -1291,7 +1292,8 @@ long keyctl_session_to_parent(void) |
3411 |
+ goto not_permitted; |
3412 |
+ |
3413 |
+ /* the keyrings must have the same UID */ |
3414 |
+- if (pcred ->tgcred->session_keyring->uid != mycred->euid || |
3415 |
++ if ((pcred->tgcred->session_keyring && |
3416 |
++ pcred->tgcred->session_keyring->uid != mycred->euid) || |
3417 |
+ mycred->tgcred->session_keyring->uid != mycred->euid) |
3418 |
+ goto not_permitted; |
3419 |
+ |
3420 |
+@@ -1313,6 +1315,7 @@ long keyctl_session_to_parent(void) |
3421 |
+ set_ti_thread_flag(task_thread_info(parent), TIF_NOTIFY_RESUME); |
3422 |
+ |
3423 |
+ write_unlock_irq(&tasklist_lock); |
3424 |
++ rcu_read_unlock(); |
3425 |
+ if (oldcred) |
3426 |
+ put_cred(oldcred); |
3427 |
+ return 0; |
3428 |
+@@ -1321,6 +1324,7 @@ already_same: |
3429 |
+ ret = 0; |
3430 |
+ not_permitted: |
3431 |
+ write_unlock_irq(&tasklist_lock); |
3432 |
++ rcu_read_unlock(); |
3433 |
+ put_cred(cred); |
3434 |
+ return ret; |
3435 |
+ |