diff options
29 files changed, 324 insertions, 175 deletions
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index af4d1bc9a2eb..94db25708456 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -163,15 +163,13 @@ EXPORT_SYMBOL(giveup_altivec); | |||
163 | EXPORT_SYMBOL(giveup_spe); | 163 | EXPORT_SYMBOL(giveup_spe); |
164 | #endif /* CONFIG_SPE */ | 164 | #endif /* CONFIG_SPE */ |
165 | 165 | ||
166 | #ifdef CONFIG_PPC64 | 166 | #ifndef CONFIG_PPC64 |
167 | EXPORT_SYMBOL(__flush_icache_range); | ||
168 | #else | ||
169 | EXPORT_SYMBOL(flush_instruction_cache); | 167 | EXPORT_SYMBOL(flush_instruction_cache); |
170 | EXPORT_SYMBOL(flush_icache_range); | ||
171 | EXPORT_SYMBOL(flush_tlb_kernel_range); | 168 | EXPORT_SYMBOL(flush_tlb_kernel_range); |
172 | EXPORT_SYMBOL(flush_tlb_page); | 169 | EXPORT_SYMBOL(flush_tlb_page); |
173 | EXPORT_SYMBOL(_tlbie); | 170 | EXPORT_SYMBOL(_tlbie); |
174 | #endif | 171 | #endif |
172 | EXPORT_SYMBOL(__flush_icache_range); | ||
175 | EXPORT_SYMBOL(flush_dcache_range); | 173 | EXPORT_SYMBOL(flush_dcache_range); |
176 | 174 | ||
177 | #ifdef CONFIG_SMP | 175 | #ifdef CONFIG_SMP |
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 66073f775193..bb6a5c6a64be 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
@@ -184,7 +184,7 @@ EXPORT_SYMBOL(kernel_thread); | |||
184 | 184 | ||
185 | EXPORT_SYMBOL(flush_instruction_cache); | 185 | EXPORT_SYMBOL(flush_instruction_cache); |
186 | EXPORT_SYMBOL(giveup_fpu); | 186 | EXPORT_SYMBOL(giveup_fpu); |
187 | EXPORT_SYMBOL(flush_icache_range); | 187 | EXPORT_SYMBOL(__flush_icache_range); |
188 | EXPORT_SYMBOL(flush_dcache_range); | 188 | EXPORT_SYMBOL(flush_dcache_range); |
189 | EXPORT_SYMBOL(flush_icache_user_range); | 189 | EXPORT_SYMBOL(flush_icache_user_range); |
190 | EXPORT_SYMBOL(flush_dcache_page); | 190 | EXPORT_SYMBOL(flush_dcache_page); |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 74022316fc63..65c2ec5c421b 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -91,9 +91,9 @@ static int mfcounter = 0; | |||
91 | * Public data... | 91 | * Public data... |
92 | */ | 92 | */ |
93 | int mpt_lan_index = -1; | 93 | int mpt_lan_index = -1; |
94 | static int mpt_stm_index = -1; | 94 | int mpt_stm_index = -1; |
95 | 95 | ||
96 | static struct proc_dir_entry *mpt_proc_root_dir; | 96 | struct proc_dir_entry *mpt_proc_root_dir; |
97 | 97 | ||
98 | #define WHOINIT_UNKNOWN 0xAA | 98 | #define WHOINIT_UNKNOWN 0xAA |
99 | 99 | ||
@@ -6271,6 +6271,7 @@ EXPORT_SYMBOL(mpt_resume); | |||
6271 | EXPORT_SYMBOL(mpt_suspend); | 6271 | EXPORT_SYMBOL(mpt_suspend); |
6272 | #endif | 6272 | #endif |
6273 | EXPORT_SYMBOL(ioc_list); | 6273 | EXPORT_SYMBOL(ioc_list); |
6274 | EXPORT_SYMBOL(mpt_proc_root_dir); | ||
6274 | EXPORT_SYMBOL(mpt_register); | 6275 | EXPORT_SYMBOL(mpt_register); |
6275 | EXPORT_SYMBOL(mpt_deregister); | 6276 | EXPORT_SYMBOL(mpt_deregister); |
6276 | EXPORT_SYMBOL(mpt_event_register); | 6277 | EXPORT_SYMBOL(mpt_event_register); |
@@ -6288,6 +6289,7 @@ EXPORT_SYMBOL(mpt_verify_adapter); | |||
6288 | EXPORT_SYMBOL(mpt_GetIocState); | 6289 | EXPORT_SYMBOL(mpt_GetIocState); |
6289 | EXPORT_SYMBOL(mpt_print_ioc_summary); | 6290 | EXPORT_SYMBOL(mpt_print_ioc_summary); |
6290 | EXPORT_SYMBOL(mpt_lan_index); | 6291 | EXPORT_SYMBOL(mpt_lan_index); |
6292 | EXPORT_SYMBOL(mpt_stm_index); | ||
6291 | EXPORT_SYMBOL(mpt_HardResetHandler); | 6293 | EXPORT_SYMBOL(mpt_HardResetHandler); |
6292 | EXPORT_SYMBOL(mpt_config); | 6294 | EXPORT_SYMBOL(mpt_config); |
6293 | EXPORT_SYMBOL(mpt_toolbox); | 6295 | EXPORT_SYMBOL(mpt_toolbox); |
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 8ad277a9afa1..5f5b3fb5b4d7 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -1006,8 +1006,10 @@ extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); | |||
1006 | * Public data decl's... | 1006 | * Public data decl's... |
1007 | */ | 1007 | */ |
1008 | extern struct list_head ioc_list; | 1008 | extern struct list_head ioc_list; |
1009 | extern struct proc_dir_entry *mpt_proc_root_dir; | ||
1009 | 1010 | ||
1010 | extern int mpt_lan_index; /* needed by mptlan.c */ | 1011 | extern int mpt_lan_index; /* needed by mptlan.c */ |
1012 | extern int mpt_stm_index; /* needed by mptstm.c */ | ||
1011 | 1013 | ||
1012 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1014 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1013 | #endif /* } __KERNEL__ */ | 1015 | #endif /* } __KERNEL__ */ |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 143f01a4c170..69c04945591f 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * (C) 2000 Red Hat. GPL'd | 5 | * (C) 2000 Red Hat. GPL'd |
6 | * | 6 | * |
7 | * $Id: cfi_cmdset_0001.c,v 1.185 2005/11/07 11:14:22 gleixner Exp $ | 7 | * $Id: cfi_cmdset_0001.c,v 1.186 2005/11/23 22:07:52 nico Exp $ |
8 | * | 8 | * |
9 | * | 9 | * |
10 | * 10/10/2000 Nicolas Pitre <nico@cam.org> | 10 | * 10/10/2000 Nicolas Pitre <nico@cam.org> |
@@ -644,9 +644,8 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
644 | * | 644 | * |
645 | * - contension arbitration is handled in the owner's context. | 645 | * - contension arbitration is handled in the owner's context. |
646 | * | 646 | * |
647 | * The 'shared' struct can be read when its lock is taken. | 647 | * The 'shared' struct can be read and/or written only when |
648 | * However any writes to it can only be made when the current | 648 | * its lock is taken. |
649 | * owner's lock is also held. | ||
650 | */ | 649 | */ |
651 | struct flchip_shared *shared = chip->priv; | 650 | struct flchip_shared *shared = chip->priv; |
652 | struct flchip *contender; | 651 | struct flchip *contender; |
@@ -675,14 +674,13 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
675 | } | 674 | } |
676 | timeo = jiffies + HZ; | 675 | timeo = jiffies + HZ; |
677 | spin_lock(&shared->lock); | 676 | spin_lock(&shared->lock); |
677 | spin_unlock(contender->mutex); | ||
678 | } | 678 | } |
679 | 679 | ||
680 | /* We now own it */ | 680 | /* We now own it */ |
681 | shared->writing = chip; | 681 | shared->writing = chip; |
682 | if (mode == FL_ERASING) | 682 | if (mode == FL_ERASING) |
683 | shared->erasing = chip; | 683 | shared->erasing = chip; |
684 | if (contender && contender != chip) | ||
685 | spin_unlock(contender->mutex); | ||
686 | spin_unlock(&shared->lock); | 684 | spin_unlock(&shared->lock); |
687 | } | 685 | } |
688 | 686 | ||
diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c index 90eb30e06b7c..e636aa86bc24 100644 --- a/drivers/mtd/chips/cfi_probe.c +++ b/drivers/mtd/chips/cfi_probe.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | Common Flash Interface probe code. | 2 | Common Flash Interface probe code. |
3 | (C) 2000 Red Hat. GPL'd. | 3 | (C) 2000 Red Hat. GPL'd. |
4 | $Id: cfi_probe.c,v 1.84 2005/11/07 11:14:23 gleixner Exp $ | 4 | $Id: cfi_probe.c,v 1.86 2005/11/29 14:48:31 gleixner Exp $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
@@ -230,8 +230,8 @@ static int __xipram cfi_chip_setup(struct map_info *map, | |||
230 | cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL); | 230 | cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL); |
231 | cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); | 231 | cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); |
232 | cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); | 232 | cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); |
233 | cfi->mfr = cfi_read_query(map, base); | 233 | cfi->mfr = cfi_read_query16(map, base); |
234 | cfi->id = cfi_read_query(map, base + ofs_factor); | 234 | cfi->id = cfi_read_query16(map, base + ofs_factor); |
235 | 235 | ||
236 | /* Put it back into Read Mode */ | 236 | /* Put it back into Read Mode */ |
237 | cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); | 237 | cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); |
@@ -426,7 +426,7 @@ static struct mtd_chip_driver cfi_chipdrv = { | |||
426 | .module = THIS_MODULE | 426 | .module = THIS_MODULE |
427 | }; | 427 | }; |
428 | 428 | ||
429 | int __init cfi_probe_init(void) | 429 | static int __init cfi_probe_init(void) |
430 | { | 430 | { |
431 | register_mtd_chip_driver(&cfi_chipdrv); | 431 | register_mtd_chip_driver(&cfi_chipdrv); |
432 | return 0; | 432 | return 0; |
diff --git a/drivers/mtd/chips/sharp.c b/drivers/mtd/chips/sharp.c index 2d26bdef82d5..36f61a6a766e 100644 --- a/drivers/mtd/chips/sharp.c +++ b/drivers/mtd/chips/sharp.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright 2000,2001 David A. Schleef <ds@schleef.org> | 4 | * Copyright 2000,2001 David A. Schleef <ds@schleef.org> |
5 | * 2000,2001 Lineo, Inc. | 5 | * 2000,2001 Lineo, Inc. |
6 | * | 6 | * |
7 | * $Id: sharp.c,v 1.16 2005/11/07 11:14:23 gleixner Exp $ | 7 | * $Id: sharp.c,v 1.17 2005/11/29 14:28:28 gleixner Exp $ |
8 | * | 8 | * |
9 | * Devices supported: | 9 | * Devices supported: |
10 | * LH28F016SCT Symmetrical block flash memory, 2Mx8 | 10 | * LH28F016SCT Symmetrical block flash memory, 2Mx8 |
@@ -160,22 +160,28 @@ struct mtd_info *sharp_probe(struct map_info *map) | |||
160 | return mtd; | 160 | return mtd; |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline void sharp_send_cmd(struct map_info *map, unsigned long cmd, unsigned long adr) | ||
164 | { | ||
165 | map_word map_cmd; | ||
166 | map_cmd.x[0] = cmd; | ||
167 | map_write(map, map_cmd, adr); | ||
168 | } | ||
169 | |||
163 | static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) | 170 | static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) |
164 | { | 171 | { |
165 | unsigned long tmp; | 172 | map_word tmp, read0, read4; |
166 | unsigned long base = 0; | 173 | unsigned long base = 0; |
167 | u32 read0, read4; | ||
168 | int width = 4; | 174 | int width = 4; |
169 | 175 | ||
170 | tmp = map_read32(map, base+0); | 176 | tmp = map_read(map, base+0); |
171 | 177 | ||
172 | map_write32(map, CMD_READ_ID, base+0); | 178 | sharp_send_cmd(map, CMD_READ_ID, base+0); |
173 | 179 | ||
174 | read0=map_read32(map, base+0); | 180 | read0 = map_read(map, base+0); |
175 | read4=map_read32(map, base+4); | 181 | read4 = map_read(map, base+4); |
176 | if(read0 == 0x89898989){ | 182 | if(read0.x[0] == 0x89898989){ |
177 | printk("Looks like sharp flash\n"); | 183 | printk("Looks like sharp flash\n"); |
178 | switch(read4){ | 184 | switch(read4.x[0]){ |
179 | case 0xaaaaaaaa: | 185 | case 0xaaaaaaaa: |
180 | case 0xa0a0a0a0: | 186 | case 0xa0a0a0a0: |
181 | /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/ | 187 | /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/ |
@@ -197,16 +203,16 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) | |||
197 | return width; | 203 | return width; |
198 | #endif | 204 | #endif |
199 | default: | 205 | default: |
200 | printk("Sort-of looks like sharp flash, 0x%08x 0x%08x\n", | 206 | printk("Sort-of looks like sharp flash, 0x%08lx 0x%08lx\n", |
201 | read0,read4); | 207 | read0.x[0], read4.x[0]); |
202 | } | 208 | } |
203 | }else if((map_read32(map, base+0) == CMD_READ_ID)){ | 209 | }else if((map_read(map, base+0).x[0] == CMD_READ_ID)){ |
204 | /* RAM, probably */ | 210 | /* RAM, probably */ |
205 | printk("Looks like RAM\n"); | 211 | printk("Looks like RAM\n"); |
206 | map_write32(map, tmp, base+0); | 212 | map_write(map, tmp, base+0); |
207 | }else{ | 213 | }else{ |
208 | printk("Doesn't look like sharp flash, 0x%08x 0x%08x\n", | 214 | printk("Doesn't look like sharp flash, 0x%08lx 0x%08lx\n", |
209 | read0,read4); | 215 | read0.x[0], read4.x[0]); |
210 | } | 216 | } |
211 | 217 | ||
212 | return 0; | 218 | return 0; |
@@ -215,7 +221,8 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd) | |||
215 | /* This function returns with the chip->mutex lock held. */ | 221 | /* This function returns with the chip->mutex lock held. */ |
216 | static int sharp_wait(struct map_info *map, struct flchip *chip) | 222 | static int sharp_wait(struct map_info *map, struct flchip *chip) |
217 | { | 223 | { |
218 | int status, i; | 224 | int i; |
225 | map_word status; | ||
219 | unsigned long timeo = jiffies + HZ; | 226 | unsigned long timeo = jiffies + HZ; |
220 | DECLARE_WAITQUEUE(wait, current); | 227 | DECLARE_WAITQUEUE(wait, current); |
221 | int adr = 0; | 228 | int adr = 0; |
@@ -225,12 +232,12 @@ retry: | |||
225 | 232 | ||
226 | switch(chip->state){ | 233 | switch(chip->state){ |
227 | case FL_READY: | 234 | case FL_READY: |
228 | map_write32(map,CMD_READ_STATUS,adr); | 235 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
229 | chip->state = FL_STATUS; | 236 | chip->state = FL_STATUS; |
230 | case FL_STATUS: | 237 | case FL_STATUS: |
231 | for(i=0;i<100;i++){ | 238 | for(i=0;i<100;i++){ |
232 | status = map_read32(map,adr); | 239 | status = map_read(map, adr); |
233 | if((status & SR_READY)==SR_READY) | 240 | if((status.x[0] & SR_READY)==SR_READY) |
234 | break; | 241 | break; |
235 | udelay(1); | 242 | udelay(1); |
236 | } | 243 | } |
@@ -254,7 +261,7 @@ retry: | |||
254 | goto retry; | 261 | goto retry; |
255 | } | 262 | } |
256 | 263 | ||
257 | map_write32(map,CMD_RESET, adr); | 264 | sharp_send_cmd(map, CMD_RESET, adr); |
258 | 265 | ||
259 | chip->state = FL_READY; | 266 | chip->state = FL_READY; |
260 | 267 | ||
@@ -351,37 +358,39 @@ static int sharp_write_oneword(struct map_info *map, struct flchip *chip, | |||
351 | int timeo; | 358 | int timeo; |
352 | int try; | 359 | int try; |
353 | int i; | 360 | int i; |
354 | int status = 0; | 361 | map_word data, status; |
355 | 362 | ||
363 | status.x[0] = 0; | ||
356 | ret = sharp_wait(map,chip); | 364 | ret = sharp_wait(map,chip); |
357 | 365 | ||
358 | for(try=0;try<10;try++){ | 366 | for(try=0;try<10;try++){ |
359 | map_write32(map,CMD_BYTE_WRITE,adr); | 367 | sharp_send_cmd(map, CMD_BYTE_WRITE, adr); |
360 | /* cpu_to_le32 -> hack to fix the writel be->le conversion */ | 368 | /* cpu_to_le32 -> hack to fix the writel be->le conversion */ |
361 | map_write32(map,cpu_to_le32(datum),adr); | 369 | data.x[0] = cpu_to_le32(datum); |
370 | map_write(map, data, adr); | ||
362 | 371 | ||
363 | chip->state = FL_WRITING; | 372 | chip->state = FL_WRITING; |
364 | 373 | ||
365 | timeo = jiffies + (HZ/2); | 374 | timeo = jiffies + (HZ/2); |
366 | 375 | ||
367 | map_write32(map,CMD_READ_STATUS,adr); | 376 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
368 | for(i=0;i<100;i++){ | 377 | for(i=0;i<100;i++){ |
369 | status = map_read32(map,adr); | 378 | status = map_read(map, adr); |
370 | if((status & SR_READY)==SR_READY) | 379 | if((status.x[0] & SR_READY) == SR_READY) |
371 | break; | 380 | break; |
372 | } | 381 | } |
373 | if(i==100){ | 382 | if(i==100){ |
374 | printk("sharp: timed out writing\n"); | 383 | printk("sharp: timed out writing\n"); |
375 | } | 384 | } |
376 | 385 | ||
377 | if(!(status&SR_ERRORS)) | 386 | if(!(status.x[0] & SR_ERRORS)) |
378 | break; | 387 | break; |
379 | 388 | ||
380 | printk("sharp: error writing byte at addr=%08lx status=%08x\n",adr,status); | 389 | printk("sharp: error writing byte at addr=%08lx status=%08lx\n", adr, status.x[0]); |
381 | 390 | ||
382 | map_write32(map,CMD_CLEAR_STATUS,adr); | 391 | sharp_send_cmd(map, CMD_CLEAR_STATUS, adr); |
383 | } | 392 | } |
384 | map_write32(map,CMD_RESET,adr); | 393 | sharp_send_cmd(map, CMD_RESET, adr); |
385 | chip->state = FL_READY; | 394 | chip->state = FL_READY; |
386 | 395 | ||
387 | wake_up(&chip->wq); | 396 | wake_up(&chip->wq); |
@@ -434,18 +443,18 @@ static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip, | |||
434 | { | 443 | { |
435 | int ret; | 444 | int ret; |
436 | unsigned long timeo; | 445 | unsigned long timeo; |
437 | int status; | 446 | map_word status; |
438 | DECLARE_WAITQUEUE(wait, current); | 447 | DECLARE_WAITQUEUE(wait, current); |
439 | 448 | ||
440 | map_write32(map,CMD_READ_STATUS,adr); | 449 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
441 | status = map_read32(map,adr); | 450 | status = map_read(map, adr); |
442 | 451 | ||
443 | timeo = jiffies + HZ; | 452 | timeo = jiffies + HZ; |
444 | 453 | ||
445 | while(time_before(jiffies, timeo)){ | 454 | while(time_before(jiffies, timeo)){ |
446 | map_write32(map,CMD_READ_STATUS,adr); | 455 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
447 | status = map_read32(map,adr); | 456 | status = map_read(map, adr); |
448 | if((status & SR_READY)==SR_READY){ | 457 | if((status.x[0] & SR_READY)==SR_READY){ |
449 | ret = 0; | 458 | ret = 0; |
450 | goto out; | 459 | goto out; |
451 | } | 460 | } |
@@ -476,7 +485,7 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
476 | { | 485 | { |
477 | int ret; | 486 | int ret; |
478 | //int timeo; | 487 | //int timeo; |
479 | int status; | 488 | map_word status; |
480 | //int i; | 489 | //int i; |
481 | 490 | ||
482 | //printk("sharp_erase_oneblock()\n"); | 491 | //printk("sharp_erase_oneblock()\n"); |
@@ -486,26 +495,26 @@ static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
486 | sharp_unlock_oneblock(map,chip,adr); | 495 | sharp_unlock_oneblock(map,chip,adr); |
487 | #endif | 496 | #endif |
488 | 497 | ||
489 | map_write32(map,CMD_BLOCK_ERASE_1,adr); | 498 | sharp_send_cmd(map, CMD_BLOCK_ERASE_1, adr); |
490 | map_write32(map,CMD_BLOCK_ERASE_2,adr); | 499 | sharp_send_cmd(map, CMD_BLOCK_ERASE_2, adr); |
491 | 500 | ||
492 | chip->state = FL_ERASING; | 501 | chip->state = FL_ERASING; |
493 | 502 | ||
494 | ret = sharp_do_wait_for_ready(map,chip,adr); | 503 | ret = sharp_do_wait_for_ready(map,chip,adr); |
495 | if(ret<0)return ret; | 504 | if(ret<0)return ret; |
496 | 505 | ||
497 | map_write32(map,CMD_READ_STATUS,adr); | 506 | sharp_send_cmd(map, CMD_READ_STATUS, adr); |
498 | status = map_read32(map,adr); | 507 | status = map_read(map, adr); |
499 | 508 | ||
500 | if(!(status&SR_ERRORS)){ | 509 | if(!(status.x[0] & SR_ERRORS)){ |
501 | map_write32(map,CMD_RESET,adr); | 510 | sharp_send_cmd(map, CMD_RESET, adr); |
502 | chip->state = FL_READY; | 511 | chip->state = FL_READY; |
503 | //spin_unlock_bh(chip->mutex); | 512 | //spin_unlock_bh(chip->mutex); |
504 | return 0; | 513 | return 0; |
505 | } | 514 | } |
506 | 515 | ||
507 | printk("sharp: error erasing block at addr=%08lx status=%08x\n",adr,status); | 516 | printk("sharp: error erasing block at addr=%08lx status=%08lx\n", adr, status.x[0]); |
508 | map_write32(map,CMD_CLEAR_STATUS,adr); | 517 | sharp_send_cmd(map, CMD_CLEAR_STATUS, adr); |
509 | 518 | ||
510 | //spin_unlock_bh(chip->mutex); | 519 | //spin_unlock_bh(chip->mutex); |
511 | 520 | ||
@@ -517,20 +526,20 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip, | |||
517 | unsigned long adr) | 526 | unsigned long adr) |
518 | { | 527 | { |
519 | int i; | 528 | int i; |
520 | int status; | 529 | map_word status; |
521 | 530 | ||
522 | map_write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr); | 531 | sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_1, adr); |
523 | map_write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr); | 532 | sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_2, adr); |
524 | 533 | ||
525 | udelay(100); | 534 | udelay(100); |
526 | 535 | ||
527 | status = map_read32(map,adr); | 536 | status = map_read(map, adr); |
528 | printk("status=%08x\n",status); | 537 | printk("status=%08lx\n", status.x[0]); |
529 | 538 | ||
530 | for(i=0;i<1000;i++){ | 539 | for(i=0;i<1000;i++){ |
531 | //map_write32(map,CMD_READ_STATUS,adr); | 540 | //sharp_send_cmd(map, CMD_READ_STATUS, adr); |
532 | status = map_read32(map,adr); | 541 | status = map_read(map, adr); |
533 | if((status & SR_READY)==SR_READY) | 542 | if((status.x[0] & SR_READY) == SR_READY) |
534 | break; | 543 | break; |
535 | udelay(100); | 544 | udelay(100); |
536 | } | 545 | } |
@@ -538,14 +547,14 @@ static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip, | |||
538 | printk("sharp: timed out unlocking block\n"); | 547 | printk("sharp: timed out unlocking block\n"); |
539 | } | 548 | } |
540 | 549 | ||
541 | if(!(status&SR_ERRORS)){ | 550 | if(!(status.x[0] & SR_ERRORS)){ |
542 | map_write32(map,CMD_RESET,adr); | 551 | sharp_send_cmd(map, CMD_RESET, adr); |
543 | chip->state = FL_READY; | 552 | chip->state = FL_READY; |
544 | return; | 553 | return; |
545 | } | 554 | } |
546 | 555 | ||
547 | printk("sharp: error unlocking block at addr=%08lx status=%08x\n",adr,status); | 556 | printk("sharp: error unlocking block at addr=%08lx status=%08lx\n", adr, status.x[0]); |
548 | map_write32(map,CMD_CLEAR_STATUS,adr); | 557 | sharp_send_cmd(map, CMD_CLEAR_STATUS, adr); |
549 | } | 558 | } |
550 | #endif | 559 | #endif |
551 | 560 | ||
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 0aaa0ced9aba..7ff403b2a0a0 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: block2mtd.c,v 1.29 2005/11/07 11:14:24 gleixner Exp $ | 2 | * $Id: block2mtd.c,v 1.30 2005/11/29 14:48:32 gleixner Exp $ |
3 | * | 3 | * |
4 | * block2mtd.c - create an mtd from a block device | 4 | * block2mtd.c - create an mtd from a block device |
5 | * | 5 | * |
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
20 | #include <linux/buffer_head.h> | 20 | #include <linux/buffer_head.h> |
21 | 21 | ||
22 | #define VERSION "$Revision: 1.29 $" | 22 | #define VERSION "$Revision: 1.30 $" |
23 | 23 | ||
24 | 24 | ||
25 | #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) | 25 | #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) |
@@ -40,7 +40,7 @@ static LIST_HEAD(blkmtd_device_list); | |||
40 | 40 | ||
41 | 41 | ||
42 | #define PAGE_READAHEAD 64 | 42 | #define PAGE_READAHEAD 64 |
43 | void cache_readahead(struct address_space *mapping, int index) | 43 | static void cache_readahead(struct address_space *mapping, int index) |
44 | { | 44 | { |
45 | filler_t *filler = (filler_t*)mapping->a_ops->readpage; | 45 | filler_t *filler = (filler_t*)mapping->a_ops->readpage; |
46 | int i, pagei; | 46 | int i, pagei; |
diff --git a/drivers/mtd/devices/ms02-nv.c b/drivers/mtd/devices/ms02-nv.c index f5026cee087f..0ff2e4378244 100644 --- a/drivers/mtd/devices/ms02-nv.c +++ b/drivers/mtd/devices/ms02-nv.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * as published by the Free Software Foundation; either version | 6 | * as published by the Free Software Foundation; either version |
7 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
8 | * | 8 | * |
9 | * $Id: ms02-nv.c,v 1.10 2005/06/20 12:24:41 macro Exp $ | 9 | * $Id: ms02-nv.c,v 1.11 2005/11/14 13:41:47 macro Exp $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
@@ -293,13 +293,13 @@ static int __init ms02nv_init(void) | |||
293 | 293 | ||
294 | switch (mips_machtype) { | 294 | switch (mips_machtype) { |
295 | case MACH_DS5000_200: | 295 | case MACH_DS5000_200: |
296 | csr = (volatile u32 *)KN02_CSR_BASE; | 296 | csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR); |
297 | if (*csr & KN02_CSR_BNK32M) | 297 | if (*csr & KN02_CSR_BNK32M) |
298 | stride = 2; | 298 | stride = 2; |
299 | break; | 299 | break; |
300 | case MACH_DS5000_2X0: | 300 | case MACH_DS5000_2X0: |
301 | case MACH_DS5900: | 301 | case MACH_DS5900: |
302 | csr = (volatile u32 *)KN03_MCR_BASE; | 302 | csr = (volatile u32 *)CKSEG1ADDR(KN03_SLOT_BASE + IOASIC_MCR); |
303 | if (*csr & KN03_MCR_BNK32M) | 303 | if (*csr & KN03_MCR_BNK32M) |
304 | stride = 2; | 304 | stride = 2; |
305 | break; | 305 | break; |
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index de7e231d6d18..8a878b34eca0 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* This version ported to the Linux-MTD system by dwmw2@infradead.org | 1 | /* This version ported to the Linux-MTD system by dwmw2@infradead.org |
2 | * $Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $ | 2 | * $Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $ |
3 | * | 3 | * |
4 | * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 4 | * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
5 | * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups | 5 | * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups |
@@ -1084,9 +1084,9 @@ struct mtd_blktrans_ops ftl_tr = { | |||
1084 | .owner = THIS_MODULE, | 1084 | .owner = THIS_MODULE, |
1085 | }; | 1085 | }; |
1086 | 1086 | ||
1087 | int init_ftl(void) | 1087 | static int init_ftl(void) |
1088 | { | 1088 | { |
1089 | DEBUG(0, "$Id: ftl.c,v 1.58 2005/11/07 11:14:19 gleixner Exp $\n"); | 1089 | DEBUG(0, "$Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $\n"); |
1090 | 1090 | ||
1091 | return register_mtd_blktrans(&ftl_tr); | 1091 | return register_mtd_blktrans(&ftl_tr); |
1092 | } | 1092 | } |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 846a533323a8..452ccd5037c3 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -538,12 +538,6 @@ config MTD_MPC1211 | |||
538 | This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). | 538 | This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). |
539 | If you have such a board, say 'Y'. | 539 | If you have such a board, say 'Y'. |
540 | 540 | ||
541 | config MTD_PQ2FADS | ||
542 | tristate "JEDEC flash SIMM mapped on PQ2FADS and 8272ADS boards" | ||
543 | depends on (ADS8272 || PQ2FADS) && MTD_PARTITIONS && MTD_JEDECPROBE && MTD_PHYSMAP && MTD_CFI_GEOMETRY && MTD_CFI_INTELEXT | ||
544 | help | ||
545 | This enables access to flash SIMM on PQ2FADS-like boards | ||
546 | |||
547 | config MTD_OMAP_NOR | 541 | config MTD_OMAP_NOR |
548 | tristate "TI OMAP board mappings" | 542 | tristate "TI OMAP board mappings" |
549 | depends on MTD_CFI && ARCH_OMAP | 543 | depends on MTD_CFI && ARCH_OMAP |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 7d9e940a1dcd..2f7e254912f0 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -70,6 +70,5 @@ obj-$(CONFIG_MTD_DMV182) += dmv182.o | |||
70 | obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o | 70 | obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o |
71 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o | 71 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o |
72 | obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o | 72 | obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o |
73 | obj-$(CONFIG_MTD_PQ2FADS) += pq2fads.o | ||
74 | obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o | 73 | obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o |
75 | obj-$(CONFIG_MTD_TQM834x) += tqm834x.o | 74 | obj-$(CONFIG_MTD_TQM834x) += tqm834x.o |
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index a59f8027903c..986c58628390 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ixp4xx.c,v 1.12 2005/11/07 11:14:27 gleixner Exp $ | 2 | * $Id: ixp4xx.c,v 1.13 2005/11/16 16:23:21 dvrabel Exp $ |
3 | * | 3 | * |
4 | * drivers/mtd/maps/ixp4xx.c | 4 | * drivers/mtd/maps/ixp4xx.c |
5 | * | 5 | * |
@@ -34,10 +34,55 @@ | |||
34 | 34 | ||
35 | #include <linux/reboot.h> | 35 | #include <linux/reboot.h> |
36 | 36 | ||
37 | /* | ||
38 | * Read/write a 16 bit word from flash address 'addr'. | ||
39 | * | ||
40 | * When the cpu is in little-endian mode it swizzles the address lines | ||
41 | * ('address coherency') so we need to undo the swizzling to ensure commands | ||
42 | * and the like end up on the correct flash address. | ||
43 | * | ||
44 | * To further complicate matters, due to the way the expansion bus controller | ||
45 | * handles 32 bit reads, the byte stream ABCD is stored on the flash as: | ||
46 | * D15 D0 | ||
47 | * +---+---+ | ||
48 | * | A | B | 0 | ||
49 | * +---+---+ | ||
50 | * | C | D | 2 | ||
51 | * +---+---+ | ||
52 | * This means that on LE systems each 16 bit word must be swapped. Note that | ||
53 | * this requires CONFIG_MTD_CFI_BE_BYTE_SWAP to be enabled to 'unswap' the CFI | ||
54 | * data and other flash commands which are always in D7-D0. | ||
55 | */ | ||
37 | #ifndef __ARMEB__ | 56 | #ifndef __ARMEB__ |
57 | #ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP | ||
58 | # error CONFIG_MTD_CFI_BE_BYTE_SWAP required | ||
59 | #endif | ||
60 | |||
61 | static inline u16 flash_read16(void __iomem *addr) | ||
62 | { | ||
63 | return be16_to_cpu(__raw_readw((void __iomem *)((unsigned long)addr ^ 0x2))); | ||
64 | } | ||
65 | |||
66 | static inline void flash_write16(u16 d, void __iomem *addr) | ||
67 | { | ||
68 | __raw_writew(cpu_to_be16(d), (void __iomem *)((unsigned long)addr ^ 0x2)); | ||
69 | } | ||
70 | |||
38 | #define BYTE0(h) ((h) & 0xFF) | 71 | #define BYTE0(h) ((h) & 0xFF) |
39 | #define BYTE1(h) (((h) >> 8) & 0xFF) | 72 | #define BYTE1(h) (((h) >> 8) & 0xFF) |
73 | |||
40 | #else | 74 | #else |
75 | |||
76 | static inline u16 flash_read16(const void __iomem *addr) | ||
77 | { | ||
78 | return __raw_readw(addr); | ||
79 | } | ||
80 | |||
81 | static inline void flash_write16(u16 d, void __iomem *addr) | ||
82 | { | ||
83 | __raw_writew(d, addr); | ||
84 | } | ||
85 | |||
41 | #define BYTE0(h) (((h) >> 8) & 0xFF) | 86 | #define BYTE0(h) (((h) >> 8) & 0xFF) |
42 | #define BYTE1(h) ((h) & 0xFF) | 87 | #define BYTE1(h) ((h) & 0xFF) |
43 | #endif | 88 | #endif |
@@ -45,7 +90,7 @@ | |||
45 | static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) | 90 | static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) |
46 | { | 91 | { |
47 | map_word val; | 92 | map_word val; |
48 | val.x[0] = le16_to_cpu(readw(map->virt + ofs)); | 93 | val.x[0] = flash_read16(map->virt + ofs); |
49 | return val; | 94 | return val; |
50 | } | 95 | } |
51 | 96 | ||
@@ -57,19 +102,28 @@ static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) | |||
57 | static void ixp4xx_copy_from(struct map_info *map, void *to, | 102 | static void ixp4xx_copy_from(struct map_info *map, void *to, |
58 | unsigned long from, ssize_t len) | 103 | unsigned long from, ssize_t len) |
59 | { | 104 | { |
60 | int i; | ||
61 | u8 *dest = (u8 *) to; | 105 | u8 *dest = (u8 *) to; |
62 | void __iomem *src = map->virt + from; | 106 | void __iomem *src = map->virt + from; |
63 | u16 data; | ||
64 | 107 | ||
65 | for (i = 0; i < (len / 2); i++) { | 108 | if (len <= 0) |
66 | data = le16_to_cpu(readw(src + 2*i)); | 109 | return; |
67 | dest[i * 2] = BYTE0(data); | 110 | |
68 | dest[i * 2 + 1] = BYTE1(data); | 111 | if (from & 1) { |
112 | *dest++ = BYTE1(flash_read16(src)); | ||
113 | src++; | ||
114 | --len; | ||
69 | } | 115 | } |
70 | 116 | ||
71 | if (len & 1) | 117 | while (len >= 2) { |
72 | dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i))); | 118 | u16 data = flash_read16(src); |
119 | *dest++ = BYTE0(data); | ||
120 | *dest++ = BYTE1(data); | ||
121 | src += 2; | ||
122 | len -= 2; | ||
123 | } | ||
124 | |||
125 | if (len > 0) | ||
126 | *dest++ = BYTE0(flash_read16(src)); | ||
73 | } | 127 | } |
74 | 128 | ||
75 | /* | 129 | /* |
@@ -79,7 +133,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, | |||
79 | static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) | 133 | static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) |
80 | { | 134 | { |
81 | if (!(adr & 1)) | 135 | if (!(adr & 1)) |
82 | writew(cpu_to_le16(d.x[0]), map->virt + adr); | 136 | flash_write16(d.x[0], map->virt + adr); |
83 | } | 137 | } |
84 | 138 | ||
85 | /* | 139 | /* |
@@ -87,7 +141,7 @@ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long | |||
87 | */ | 141 | */ |
88 | static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) | 142 | static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) |
89 | { | 143 | { |
90 | writew(cpu_to_le16(d.x[0]), map->virt + adr); | 144 | flash_write16(d.x[0], map->virt + adr); |
91 | } | 145 | } |
92 | 146 | ||
93 | struct ixp4xx_flash_info { | 147 | struct ixp4xx_flash_info { |
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c index f00ee7e54dba..632eb2aa968f 100644 --- a/drivers/mtd/maps/nettel.c +++ b/drivers/mtd/maps/nettel.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) | 6 | * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) |
7 | * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) | 7 | * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) |
8 | * | 8 | * |
9 | * $Id: nettel.c,v 1.11 2005/11/07 11:14:27 gleixner Exp $ | 9 | * $Id: nettel.c,v 1.12 2005/11/29 14:30:00 gleixner Exp $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /****************************************************************************/ | 12 | /****************************************************************************/ |
@@ -479,7 +479,7 @@ void __exit nettel_cleanup(void) | |||
479 | } | 479 | } |
480 | if (nettel_intel_map.virt) { | 480 | if (nettel_intel_map.virt) { |
481 | iounmap(nettel_intel_map.virt); | 481 | iounmap(nettel_intel_map.virt); |
482 | nettel_intel_map.virt = 0; | 482 | nettel_intel_map.virt = NULL; |
483 | } | 483 | } |
484 | #endif | 484 | #endif |
485 | } | 485 | } |
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c index 8b3570b09095..21822c2edbe4 100644 --- a/drivers/mtd/maps/pci.c +++ b/drivers/mtd/maps/pci.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | * | 9 | * |
10 | * $Id: pci.c,v 1.13 2005/11/07 11:14:27 gleixner Exp $ | 10 | * $Id: pci.c,v 1.14 2005/11/17 08:20:27 dwmw2 Exp $ |
11 | * | 11 | * |
12 | * Generic PCI memory map driver. We support the following boards: | 12 | * Generic PCI memory map driver. We support the following boards: |
13 | * - Intel IQ80310 ATU. | 13 | * - Intel IQ80310 ATU. |
@@ -102,7 +102,7 @@ static void mtd_pci_copyto(struct map_info *_map, unsigned long to, const void * | |||
102 | memcpy_toio(map->base + map->translate(map, to), from, len); | 102 | memcpy_toio(map->base + map->translate(map, to), from, len); |
103 | } | 103 | } |
104 | 104 | ||
105 | static struct map_info mtd_pci_map = { | 105 | static const struct map_info mtd_pci_map = { |
106 | .phys = NO_XIP, | 106 | .phys = NO_XIP, |
107 | .copy_from = mtd_pci_copyfrom, | 107 | .copy_from = mtd_pci_copyfrom, |
108 | .copy_to = mtd_pci_copyto, | 108 | .copy_to = mtd_pci_copyto, |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 9ee760f97bc6..f49ebc3c4606 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: physmap.c,v 1.38 2005/11/07 11:14:28 gleixner Exp $ | 2 | * $Id: physmap.c,v 1.39 2005/11/29 14:49:36 gleixner Exp $ |
3 | * | 3 | * |
4 | * Normal mappings of chips in physical memory | 4 | * Normal mappings of chips in physical memory |
5 | * | 5 | * |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/mtd/map.h> | 19 | #include <linux/mtd/map.h> |
20 | #include <linux/config.h> | 20 | #include <linux/config.h> |
21 | #include <linux/mtd/partitions.h> | 21 | #include <linux/mtd/partitions.h> |
22 | #include <linux/mtd/physmap.h> | ||
22 | 23 | ||
23 | static struct mtd_info *mymtd; | 24 | static struct mtd_info *mymtd; |
24 | 25 | ||
diff --git a/drivers/mtd/maps/sc520cdp.c b/drivers/mtd/maps/sc520cdp.c index 6fb9f3c57aab..ed92afadd8a9 100644 --- a/drivers/mtd/maps/sc520cdp.c +++ b/drivers/mtd/maps/sc520cdp.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
18 | * | 18 | * |
19 | * $Id: sc520cdp.c,v 1.22 2005/11/07 11:14:28 gleixner Exp $ | 19 | * $Id: sc520cdp.c,v 1.23 2005/11/17 08:20:27 dwmw2 Exp $ |
20 | * | 20 | * |
21 | * | 21 | * |
22 | * The SC520CDP is an evaluation board for the Elan SC520 processor available | 22 | * The SC520CDP is an evaluation board for the Elan SC520 processor available |
@@ -164,7 +164,7 @@ struct sc520_par_table | |||
164 | unsigned long default_address; | 164 | unsigned long default_address; |
165 | }; | 165 | }; |
166 | 166 | ||
167 | static struct sc520_par_table par_table[NUM_FLASH_BANKS] = | 167 | static const struct sc520_par_table par_table[NUM_FLASH_BANKS] = |
168 | { | 168 | { |
169 | { /* Flash Bank #0: selected by ROMCS0 */ | 169 | { /* Flash Bank #0: selected by ROMCS0 */ |
170 | SC520_PAR_ROMCS0, | 170 | SC520_PAR_ROMCS0, |
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index de4500395300..a0af92cc7efd 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -1486,7 +1486,7 @@ ns_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len) | |||
1486 | /* | 1486 | /* |
1487 | * Module initialization function | 1487 | * Module initialization function |
1488 | */ | 1488 | */ |
1489 | int __init ns_init_module(void) | 1489 | static int __init ns_init_module(void) |
1490 | { | 1490 | { |
1491 | struct nand_chip *chip; | 1491 | struct nand_chip *chip; |
1492 | struct nandsim *nand; | 1492 | struct nandsim *nand; |
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c index 0ab8d29caeea..20ce212638fc 100644 --- a/drivers/mtd/rfd_ftl.c +++ b/drivers/mtd/rfd_ftl.c | |||
@@ -30,11 +30,9 @@ MODULE_PARM_DESC(block_size, "Block size to use by RFD, defaults to erase unit s | |||
30 | 30 | ||
31 | #define PREFIX "rfd_ftl: " | 31 | #define PREFIX "rfd_ftl: " |
32 | 32 | ||
33 | /* Major device # for FTL device */ | 33 | /* This major has been assigned by device@lanana.org */ |
34 | |||
35 | /* A request for this major has been sent to device@lanana.org */ | ||
36 | #ifndef RFD_FTL_MAJOR | 34 | #ifndef RFD_FTL_MAJOR |
37 | #define RFD_FTL_MAJOR 95 | 35 | #define RFD_FTL_MAJOR 256 |
38 | #endif | 36 | #endif |
39 | 37 | ||
40 | /* Maximum number of partitions in an FTL region */ | 38 | /* Maximum number of partitions in an FTL region */ |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index dfea346b00a5..f9792528e33f 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -380,23 +380,23 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) | |||
380 | 380 | ||
381 | spin_lock_irqsave(&adapter->lock, flags); | 381 | spin_lock_irqsave(&adapter->lock, flags); |
382 | scb = mega_build_cmd(adapter, scmd, &busy); | 382 | scb = mega_build_cmd(adapter, scmd, &busy); |
383 | if (!scb) | ||
384 | goto out; | ||
383 | 385 | ||
384 | if(scb) { | 386 | scb->state |= SCB_PENDQ; |
385 | scb->state |= SCB_PENDQ; | 387 | list_add_tail(&scb->list, &adapter->pending_list); |
386 | list_add_tail(&scb->list, &adapter->pending_list); | ||
387 | 388 | ||
388 | /* | 389 | /* |
389 | * Check if the HBA is in quiescent state, e.g., during a | 390 | * Check if the HBA is in quiescent state, e.g., during a |
390 | * delete logical drive opertion. If it is, don't run | 391 | * delete logical drive opertion. If it is, don't run |
391 | * the pending_list. | 392 | * the pending_list. |
392 | */ | 393 | */ |
393 | if(atomic_read(&adapter->quiescent) == 0) { | 394 | if (atomic_read(&adapter->quiescent) == 0) |
394 | mega_runpendq(adapter); | 395 | mega_runpendq(adapter); |
395 | } | ||
396 | return 0; | ||
397 | } | ||
398 | spin_unlock_irqrestore(&adapter->lock, flags); | ||
399 | 396 | ||
397 | busy = 0; | ||
398 | out: | ||
399 | spin_unlock_irqrestore(&adapter->lock, flags); | ||
400 | return busy; | 400 | return busy; |
401 | } | 401 | } |
402 | 402 | ||
@@ -4677,7 +4677,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
4677 | 4677 | ||
4678 | adapter->flag = flag; | 4678 | adapter->flag = flag; |
4679 | spin_lock_init(&adapter->lock); | 4679 | spin_lock_init(&adapter->lock); |
4680 | scsi_assign_lock(host, &adapter->lock); | ||
4681 | 4680 | ||
4682 | host->cmd_per_lun = max_cmd_per_lun; | 4681 | host->cmd_per_lun = max_cmd_per_lun; |
4683 | host->max_sectors = max_sectors_per_io; | 4682 | host->max_sectors = max_sectors_per_io; |
@@ -306,9 +306,6 @@ void install_arg_page(struct vm_area_struct *vma, | |||
306 | struct page *page, unsigned long address) | 306 | struct page *page, unsigned long address) |
307 | { | 307 | { |
308 | struct mm_struct *mm = vma->vm_mm; | 308 | struct mm_struct *mm = vma->vm_mm; |
309 | pgd_t * pgd; | ||
310 | pud_t * pud; | ||
311 | pmd_t * pmd; | ||
312 | pte_t * pte; | 309 | pte_t * pte; |
313 | spinlock_t *ptl; | 310 | spinlock_t *ptl; |
314 | 311 | ||
@@ -316,14 +313,7 @@ void install_arg_page(struct vm_area_struct *vma, | |||
316 | goto out; | 313 | goto out; |
317 | 314 | ||
318 | flush_dcache_page(page); | 315 | flush_dcache_page(page); |
319 | pgd = pgd_offset(mm, address); | 316 | pte = get_locked_pte(mm, address, &ptl); |
320 | pud = pud_alloc(mm, pgd, address); | ||
321 | if (!pud) | ||
322 | goto out; | ||
323 | pmd = pmd_alloc(mm, pud, address); | ||
324 | if (!pmd) | ||
325 | goto out; | ||
326 | pte = pte_alloc_map_lock(mm, pmd, address, &ptl); | ||
327 | if (!pte) | 317 | if (!pte) |
328 | goto out; | 318 | goto out; |
329 | if (!pte_none(*pte)) { | 319 | if (!pte_none(*pte)) { |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 543420665c5b..d0fcc5f3497e 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -234,6 +234,7 @@ void jffs2_read_inode (struct inode *inode) | |||
234 | c = JFFS2_SB_INFO(inode->i_sb); | 234 | c = JFFS2_SB_INFO(inode->i_sb); |
235 | 235 | ||
236 | jffs2_init_inode_info(f); | 236 | jffs2_init_inode_info(f); |
237 | down(&f->sem); | ||
237 | 238 | ||
238 | ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); | 239 | ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); |
239 | 240 | ||
@@ -400,6 +401,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i | |||
400 | 401 | ||
401 | f = JFFS2_INODE_INFO(inode); | 402 | f = JFFS2_INODE_INFO(inode); |
402 | jffs2_init_inode_info(f); | 403 | jffs2_init_inode_info(f); |
404 | down(&f->sem); | ||
403 | 405 | ||
404 | memset(ri, 0, sizeof(*ri)); | 406 | memset(ri, 0, sizeof(*ri)); |
405 | /* Set OS-specific defaults for new inodes */ | 407 | /* Set OS-specific defaults for new inodes */ |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 9e0b5458d9c0..93883817cbd0 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -51,7 +51,7 @@ static void jffs2_i_init_once(void * foo, kmem_cache_t * cachep, unsigned long f | |||
51 | 51 | ||
52 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 52 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == |
53 | SLAB_CTOR_CONSTRUCTOR) { | 53 | SLAB_CTOR_CONSTRUCTOR) { |
54 | init_MUTEX_LOCKED(&ei->sem); | 54 | init_MUTEX(&ei->sem); |
55 | inode_init_once(&ei->vfs_inode); | 55 | inode_init_once(&ei->vfs_inode); |
56 | } | 56 | } |
57 | } | 57 | } |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 6a75a7a78bf1..0e73f1539d08 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -163,6 +163,7 @@ extern unsigned int kobjsize(const void *objp); | |||
163 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ | 163 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ |
164 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ | 164 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ |
165 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ | 165 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ |
166 | #define VM_INCOMPLETE 0x02000000 /* Strange partial PFN mapping marker */ | ||
166 | 167 | ||
167 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ | 168 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ |
168 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS | 169 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS |
@@ -741,6 +742,8 @@ struct shrinker; | |||
741 | extern struct shrinker *set_shrinker(int, shrinker_t); | 742 | extern struct shrinker *set_shrinker(int, shrinker_t); |
742 | extern void remove_shrinker(struct shrinker *shrinker); | 743 | extern void remove_shrinker(struct shrinker *shrinker); |
743 | 744 | ||
745 | extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); | ||
746 | |||
744 | int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); | 747 | int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); |
745 | int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); | 748 | int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); |
746 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address); | 749 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address); |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 3c9ea4b7adda..23a568910341 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /* Common Flash Interface structures | 2 | /* Common Flash Interface structures |
3 | * See http://support.intel.com/design/flash/technote/index.htm | 3 | * See http://support.intel.com/design/flash/technote/index.htm |
4 | * $Id: cfi.h,v 1.56 2005/11/07 11:14:54 gleixner Exp $ | 4 | * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __MTD_CFI_H__ | 7 | #ifndef __MTD_CFI_H__ |
@@ -426,6 +426,22 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr) | |||
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr) | ||
430 | { | ||
431 | map_word val = map_read(map, addr); | ||
432 | |||
433 | if (map_bankwidth_is_1(map)) { | ||
434 | return val.x[0] & 0xff; | ||
435 | } else if (map_bankwidth_is_2(map)) { | ||
436 | return cfi16_to_cpu(val.x[0]); | ||
437 | } else { | ||
438 | /* No point in a 64-bit byteswap since that would just be | ||
439 | swapping the responses from different chips, and we are | ||
440 | only interested in one chip (a representative sample) */ | ||
441 | return cfi32_to_cpu(val.x[0]); | ||
442 | } | ||
443 | } | ||
444 | |||
429 | static inline void cfi_udelay(int us) | 445 | static inline void cfi_udelay(int us) |
430 | { | 446 | { |
431 | if (us >= 1000) { | 447 | if (us >= 1000) { |
diff --git a/mm/fremap.c b/mm/fremap.c index f851775e09c2..9f381e58bf44 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -55,20 +55,10 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
55 | pgoff_t size; | 55 | pgoff_t size; |
56 | int err = -ENOMEM; | 56 | int err = -ENOMEM; |
57 | pte_t *pte; | 57 | pte_t *pte; |
58 | pmd_t *pmd; | ||
59 | pud_t *pud; | ||
60 | pgd_t *pgd; | ||
61 | pte_t pte_val; | 58 | pte_t pte_val; |
62 | spinlock_t *ptl; | 59 | spinlock_t *ptl; |
63 | 60 | ||
64 | pgd = pgd_offset(mm, addr); | 61 | pte = get_locked_pte(mm, addr, &ptl); |
65 | pud = pud_alloc(mm, pgd, addr); | ||
66 | if (!pud) | ||
67 | goto out; | ||
68 | pmd = pmd_alloc(mm, pud, addr); | ||
69 | if (!pmd) | ||
70 | goto out; | ||
71 | pte = pte_alloc_map_lock(mm, pmd, addr, &ptl); | ||
72 | if (!pte) | 62 | if (!pte) |
73 | goto out; | 63 | goto out; |
74 | 64 | ||
@@ -110,20 +100,10 @@ int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, | |||
110 | { | 100 | { |
111 | int err = -ENOMEM; | 101 | int err = -ENOMEM; |
112 | pte_t *pte; | 102 | pte_t *pte; |
113 | pmd_t *pmd; | ||
114 | pud_t *pud; | ||
115 | pgd_t *pgd; | ||
116 | pte_t pte_val; | 103 | pte_t pte_val; |
117 | spinlock_t *ptl; | 104 | spinlock_t *ptl; |
118 | 105 | ||
119 | pgd = pgd_offset(mm, addr); | 106 | pte = get_locked_pte(mm, addr, &ptl); |
120 | pud = pud_alloc(mm, pgd, addr); | ||
121 | if (!pud) | ||
122 | goto out; | ||
123 | pmd = pmd_alloc(mm, pud, addr); | ||
124 | if (!pmd) | ||
125 | goto out; | ||
126 | pte = pte_alloc_map_lock(mm, pmd, addr, &ptl); | ||
127 | if (!pte) | 107 | if (!pte) |
128 | goto out; | 108 | goto out; |
129 | 109 | ||
diff --git a/mm/memory.c b/mm/memory.c index 9ab206b829a2..5bfa52a98630 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -988,7 +988,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
988 | return i ? : -EFAULT; | 988 | return i ? : -EFAULT; |
989 | } | 989 | } |
990 | if (pages) { | 990 | if (pages) { |
991 | struct page *page = vm_normal_page(vma, start, *pte); | 991 | struct page *page = vm_normal_page(gate_vma, start, *pte); |
992 | pages[i] = page; | 992 | pages[i] = page; |
993 | if (page) | 993 | if (page) |
994 | get_page(page); | 994 | get_page(page); |
@@ -1146,6 +1146,97 @@ int zeromap_page_range(struct vm_area_struct *vma, | |||
1146 | return err; | 1146 | return err; |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl) | ||
1150 | { | ||
1151 | pgd_t * pgd = pgd_offset(mm, addr); | ||
1152 | pud_t * pud = pud_alloc(mm, pgd, addr); | ||
1153 | if (pud) { | ||
1154 | pmd_t * pmd = pmd_alloc(mm, pgd, addr); | ||
1155 | if (pmd) | ||
1156 | return pte_alloc_map_lock(mm, pmd, addr, ptl); | ||
1157 | } | ||
1158 | return NULL; | ||
1159 | } | ||
1160 | |||
1161 | /* | ||
1162 | * This is the old fallback for page remapping. | ||
1163 | * | ||
1164 | * For historical reasons, it only allows reserved pages. Only | ||
1165 | * old drivers should use this, and they needed to mark their | ||
1166 | * pages reserved for the old functions anyway. | ||
1167 | */ | ||
1168 | static int insert_page(struct mm_struct *mm, unsigned long addr, struct page *page, pgprot_t prot) | ||
1169 | { | ||
1170 | int retval; | ||
1171 | pte_t *pte; | ||
1172 | spinlock_t *ptl; | ||
1173 | |||
1174 | retval = -EINVAL; | ||
1175 | if (PageAnon(page) || !PageReserved(page)) | ||
1176 | goto out; | ||
1177 | retval = -ENOMEM; | ||
1178 | flush_dcache_page(page); | ||
1179 | pte = get_locked_pte(mm, addr, &ptl); | ||
1180 | if (!pte) | ||
1181 | goto out; | ||
1182 | retval = -EBUSY; | ||
1183 | if (!pte_none(*pte)) | ||
1184 | goto out_unlock; | ||
1185 | |||
1186 | /* Ok, finally just insert the thing.. */ | ||
1187 | get_page(page); | ||
1188 | inc_mm_counter(mm, file_rss); | ||
1189 | page_add_file_rmap(page); | ||
1190 | set_pte_at(mm, addr, pte, mk_pte(page, prot)); | ||
1191 | |||
1192 | retval = 0; | ||
1193 | out_unlock: | ||
1194 | pte_unmap_unlock(pte, ptl); | ||
1195 | out: | ||
1196 | return retval; | ||
1197 | } | ||
1198 | |||
1199 | /* | ||
1200 | * Somebody does a pfn remapping that doesn't actually work as a vma. | ||
1201 | * | ||
1202 | * Do it as individual pages instead, and warn about it. It's bad form, | ||
1203 | * and very inefficient. | ||
1204 | */ | ||
1205 | static int incomplete_pfn_remap(struct vm_area_struct *vma, | ||
1206 | unsigned long start, unsigned long end, | ||
1207 | unsigned long pfn, pgprot_t prot) | ||
1208 | { | ||
1209 | static int warn = 10; | ||
1210 | struct page *page; | ||
1211 | int retval; | ||
1212 | |||
1213 | if (!(vma->vm_flags & VM_INCOMPLETE)) { | ||
1214 | if (warn) { | ||
1215 | warn--; | ||
1216 | printk("%s does an incomplete pfn remapping", current->comm); | ||
1217 | dump_stack(); | ||
1218 | } | ||
1219 | } | ||
1220 | vma->vm_flags |= VM_INCOMPLETE | VM_IO | VM_RESERVED; | ||
1221 | |||
1222 | if (start < vma->vm_start || end > vma->vm_end) | ||
1223 | return -EINVAL; | ||
1224 | |||
1225 | if (!pfn_valid(pfn)) | ||
1226 | return -EINVAL; | ||
1227 | |||
1228 | retval = 0; | ||
1229 | page = pfn_to_page(pfn); | ||
1230 | while (start < end) { | ||
1231 | retval = insert_page(vma->vm_mm, start, page, prot); | ||
1232 | if (retval < 0) | ||
1233 | break; | ||
1234 | start += PAGE_SIZE; | ||
1235 | page++; | ||
1236 | } | ||
1237 | return retval; | ||
1238 | } | ||
1239 | |||
1149 | /* | 1240 | /* |
1150 | * maps a range of physical memory into the requested pages. the old | 1241 | * maps a range of physical memory into the requested pages. the old |
1151 | * mappings are removed. any references to nonexistent pages results | 1242 | * mappings are removed. any references to nonexistent pages results |
@@ -1220,6 +1311,9 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, | |||
1220 | struct mm_struct *mm = vma->vm_mm; | 1311 | struct mm_struct *mm = vma->vm_mm; |
1221 | int err; | 1312 | int err; |
1222 | 1313 | ||
1314 | if (addr != vma->vm_start || end != vma->vm_end) | ||
1315 | return incomplete_pfn_remap(vma, addr, end, pfn, prot); | ||
1316 | |||
1223 | /* | 1317 | /* |
1224 | * Physically remapped pages are special. Tell the | 1318 | * Physically remapped pages are special. Tell the |
1225 | * rest of the world about it: | 1319 | * rest of the world about it: |
@@ -1300,8 +1394,15 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo | |||
1300 | */ | 1394 | */ |
1301 | if (unlikely(!src)) { | 1395 | if (unlikely(!src)) { |
1302 | void *kaddr = kmap_atomic(dst, KM_USER0); | 1396 | void *kaddr = kmap_atomic(dst, KM_USER0); |
1303 | unsigned long left = __copy_from_user_inatomic(kaddr, (void __user *)va, PAGE_SIZE); | 1397 | void __user *uaddr = (void __user *)(va & PAGE_MASK); |
1304 | if (left) | 1398 | |
1399 | /* | ||
1400 | * This really shouldn't fail, because the page is there | ||
1401 | * in the page tables. But it might just be unreadable, | ||
1402 | * in which case we just give up and fill the result with | ||
1403 | * zeroes. | ||
1404 | */ | ||
1405 | if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) | ||
1305 | memset(kaddr, 0, PAGE_SIZE); | 1406 | memset(kaddr, 0, PAGE_SIZE); |
1306 | kunmap_atomic(kaddr, KM_USER0); | 1407 | kunmap_atomic(kaddr, KM_USER0); |
1307 | return; | 1408 | return; |
@@ -1332,12 +1433,11 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1332 | unsigned long address, pte_t *page_table, pmd_t *pmd, | 1433 | unsigned long address, pte_t *page_table, pmd_t *pmd, |
1333 | spinlock_t *ptl, pte_t orig_pte) | 1434 | spinlock_t *ptl, pte_t orig_pte) |
1334 | { | 1435 | { |
1335 | struct page *old_page, *src_page, *new_page; | 1436 | struct page *old_page, *new_page; |
1336 | pte_t entry; | 1437 | pte_t entry; |
1337 | int ret = VM_FAULT_MINOR; | 1438 | int ret = VM_FAULT_MINOR; |
1338 | 1439 | ||
1339 | old_page = vm_normal_page(vma, address, orig_pte); | 1440 | old_page = vm_normal_page(vma, address, orig_pte); |
1340 | src_page = old_page; | ||
1341 | if (!old_page) | 1441 | if (!old_page) |
1342 | goto gotten; | 1442 | goto gotten; |
1343 | 1443 | ||
@@ -1345,7 +1445,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1345 | int reuse = can_share_swap_page(old_page); | 1445 | int reuse = can_share_swap_page(old_page); |
1346 | unlock_page(old_page); | 1446 | unlock_page(old_page); |
1347 | if (reuse) { | 1447 | if (reuse) { |
1348 | flush_cache_page(vma, address, pfn); | 1448 | flush_cache_page(vma, address, pte_pfn(orig_pte)); |
1349 | entry = pte_mkyoung(orig_pte); | 1449 | entry = pte_mkyoung(orig_pte); |
1350 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); | 1450 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); |
1351 | ptep_set_access_flags(vma, address, page_table, entry, 1); | 1451 | ptep_set_access_flags(vma, address, page_table, entry, 1); |
@@ -1365,7 +1465,7 @@ gotten: | |||
1365 | 1465 | ||
1366 | if (unlikely(anon_vma_prepare(vma))) | 1466 | if (unlikely(anon_vma_prepare(vma))) |
1367 | goto oom; | 1467 | goto oom; |
1368 | if (src_page == ZERO_PAGE(address)) { | 1468 | if (old_page == ZERO_PAGE(address)) { |
1369 | new_page = alloc_zeroed_user_highpage(vma, address); | 1469 | new_page = alloc_zeroed_user_highpage(vma, address); |
1370 | if (!new_page) | 1470 | if (!new_page) |
1371 | goto oom; | 1471 | goto oom; |
@@ -1373,7 +1473,7 @@ gotten: | |||
1373 | new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); | 1473 | new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); |
1374 | if (!new_page) | 1474 | if (!new_page) |
1375 | goto oom; | 1475 | goto oom; |
1376 | cow_user_page(new_page, src_page, address); | 1476 | cow_user_page(new_page, old_page, address); |
1377 | } | 1477 | } |
1378 | 1478 | ||
1379 | /* | 1479 | /* |
@@ -1389,7 +1489,7 @@ gotten: | |||
1389 | } | 1489 | } |
1390 | } else | 1490 | } else |
1391 | inc_mm_counter(mm, anon_rss); | 1491 | inc_mm_counter(mm, anon_rss); |
1392 | flush_cache_page(vma, address, pfn); | 1492 | flush_cache_page(vma, address, pte_pfn(orig_pte)); |
1393 | entry = mk_pte(new_page, vma->vm_page_prot); | 1493 | entry = mk_pte(new_page, vma->vm_page_prot); |
1394 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); | 1494 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); |
1395 | ptep_establish(vma, address, page_table, entry); | 1495 | ptep_establish(vma, address, page_table, entry); |
@@ -1909,6 +2009,8 @@ static int do_no_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1909 | int anon = 0; | 2009 | int anon = 0; |
1910 | 2010 | ||
1911 | pte_unmap(page_table); | 2011 | pte_unmap(page_table); |
2012 | BUG_ON(vma->vm_flags & VM_PFNMAP); | ||
2013 | |||
1912 | if (vma->vm_file) { | 2014 | if (vma->vm_file) { |
1913 | mapping = vma->vm_file->f_mapping; | 2015 | mapping = vma->vm_file->f_mapping; |
1914 | sequence = mapping->truncate_count; | 2016 | sequence = mapping->truncate_count; |
@@ -1941,7 +2043,7 @@ retry: | |||
1941 | page = alloc_page_vma(GFP_HIGHUSER, vma, address); | 2043 | page = alloc_page_vma(GFP_HIGHUSER, vma, address); |
1942 | if (!page) | 2044 | if (!page) |
1943 | goto oom; | 2045 | goto oom; |
1944 | cow_user_page(page, new_page, address); | 2046 | copy_user_highpage(page, new_page, address); |
1945 | page_cache_release(new_page); | 2047 | page_cache_release(new_page); |
1946 | new_page = page; | 2048 | new_page = page; |
1947 | anon = 1; | 2049 | anon = 1; |
@@ -641,7 +641,7 @@ static void try_to_unmap_cluster(unsigned long cursor, | |||
641 | continue; | 641 | continue; |
642 | 642 | ||
643 | /* Nuke the page table entry. */ | 643 | /* Nuke the page table entry. */ |
644 | flush_cache_page(vma, address, pfn); | 644 | flush_cache_page(vma, address, pte_pfn(*pte)); |
645 | pteval = ptep_clear_flush(vma, address, pte); | 645 | pteval = ptep_clear_flush(vma, address, pte); |
646 | 646 | ||
647 | /* If nonlinear, store the file page offset in the pte. */ | 647 | /* If nonlinear, store the file page offset in the pte. */ |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a16064ba0caf..76ff9f4fe89d 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -985,6 +985,8 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, | |||
985 | } | 985 | } |
986 | 986 | ||
987 | /* Rule 4: Prefer home address -- not implemented yet */ | 987 | /* Rule 4: Prefer home address -- not implemented yet */ |
988 | if (hiscore.rule < 4) | ||
989 | hiscore.rule++; | ||
988 | 990 | ||
989 | /* Rule 5: Prefer outgoing interface */ | 991 | /* Rule 5: Prefer outgoing interface */ |
990 | if (hiscore.rule < 5) { | 992 | if (hiscore.rule < 5) { |