aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-10-16 21:50:32 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2005-10-16 21:50:32 -0400
commit7dffb72028bfd909ac51a1546d182de2df4d2426 (patch)
treec465c35642872973543f710f8aa06b955b84f7e5
parentcf764855620aa1aa5b134687ca18b841ac9be4c7 (diff)
ppc32: use L1_CACHE_SHIFT/L1_CACHE_BYTES
instead of L1_CACHE_LINE_SIZE and LG_L1_CACHE_LINE_SIZE Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
-rw-r--r--arch/powerpc/kernel/head_32.S2
-rw-r--r--arch/powerpc/kernel/misc_32.S58
-rw-r--r--arch/powerpc/lib/copy_32.S24
-rw-r--r--arch/powerpc/platforms/powermac/sleep.S4
-rw-r--r--arch/ppc/kernel/cpu_setup_6xx.S4
-rw-r--r--arch/ppc/kernel/cpu_setup_power4.S4
-rw-r--r--arch/ppc/kernel/head.S2
-rw-r--r--arch/ppc/kernel/l2cr.S2
-rw-r--r--arch/ppc/kernel/misc.S58
-rw-r--r--arch/ppc/lib/string.S24
-rw-r--r--arch/ppc/platforms/katana.c2
-rw-r--r--arch/ppc/platforms/pmac_sleep.S4
-rw-r--r--arch/ppc/syslib/mv64x60.c2
-rw-r--r--include/asm-ppc/cache.h13
14 files changed, 100 insertions, 103 deletions
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 108e78ef3878..d9b063f567e0 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -837,7 +837,7 @@ relocate_kernel:
837copy_and_flush: 837copy_and_flush:
838 addi r5,r5,-4 838 addi r5,r5,-4
839 addi r6,r6,-4 839 addi r6,r6,-4
8404: li r0,L1_CACHE_LINE_SIZE/4 8404: li r0,L1_CACHE_BYTES/4
841 mtctr r0 841 mtctr r0
8423: addi r6,r6,4 /* copy a cache line */ 8423: addi r6,r6,4 /* copy a cache line */
843 lwzx r0,r6,r4 843 lwzx r0,r6,r4
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 27274108116f..0b0e908b5065 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -496,21 +496,21 @@ _GLOBAL(flush_icache_range)
496BEGIN_FTR_SECTION 496BEGIN_FTR_SECTION
497 blr /* for 601, do nothing */ 497 blr /* for 601, do nothing */
498END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 498END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
499 li r5,L1_CACHE_LINE_SIZE-1 499 li r5,L1_CACHE_BYTES-1
500 andc r3,r3,r5 500 andc r3,r3,r5
501 subf r4,r3,r4 501 subf r4,r3,r4
502 add r4,r4,r5 502 add r4,r4,r5
503 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 503 srwi. r4,r4,L1_CACHE_SHIFT
504 beqlr 504 beqlr
505 mtctr r4 505 mtctr r4
506 mr r6,r3 506 mr r6,r3
5071: dcbst 0,r3 5071: dcbst 0,r3
508 addi r3,r3,L1_CACHE_LINE_SIZE 508 addi r3,r3,L1_CACHE_BYTES
509 bdnz 1b 509 bdnz 1b
510 sync /* wait for dcbst's to get to ram */ 510 sync /* wait for dcbst's to get to ram */
511 mtctr r4 511 mtctr r4
5122: icbi 0,r6 5122: icbi 0,r6
513 addi r6,r6,L1_CACHE_LINE_SIZE 513 addi r6,r6,L1_CACHE_BYTES
514 bdnz 2b 514 bdnz 2b
515 sync /* additional sync needed on g4 */ 515 sync /* additional sync needed on g4 */
516 isync 516 isync
@@ -523,16 +523,16 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
523 * clean_dcache_range(unsigned long start, unsigned long stop) 523 * clean_dcache_range(unsigned long start, unsigned long stop)
524 */ 524 */
525_GLOBAL(clean_dcache_range) 525_GLOBAL(clean_dcache_range)
526 li r5,L1_CACHE_LINE_SIZE-1 526 li r5,L1_CACHE_BYTES-1
527 andc r3,r3,r5 527 andc r3,r3,r5
528 subf r4,r3,r4 528 subf r4,r3,r4
529 add r4,r4,r5 529 add r4,r4,r5
530 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 530 srwi. r4,r4,L1_CACHE_SHIFT
531 beqlr 531 beqlr
532 mtctr r4 532 mtctr r4
533 533
5341: dcbst 0,r3 5341: dcbst 0,r3
535 addi r3,r3,L1_CACHE_LINE_SIZE 535 addi r3,r3,L1_CACHE_BYTES
536 bdnz 1b 536 bdnz 1b
537 sync /* wait for dcbst's to get to ram */ 537 sync /* wait for dcbst's to get to ram */
538 blr 538 blr
@@ -544,16 +544,16 @@ _GLOBAL(clean_dcache_range)
544 * flush_dcache_range(unsigned long start, unsigned long stop) 544 * flush_dcache_range(unsigned long start, unsigned long stop)
545 */ 545 */
546_GLOBAL(flush_dcache_range) 546_GLOBAL(flush_dcache_range)
547 li r5,L1_CACHE_LINE_SIZE-1 547 li r5,L1_CACHE_BYTES-1
548 andc r3,r3,r5 548 andc r3,r3,r5
549 subf r4,r3,r4 549 subf r4,r3,r4
550 add r4,r4,r5 550 add r4,r4,r5
551 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 551 srwi. r4,r4,L1_CACHE_SHIFT
552 beqlr 552 beqlr
553 mtctr r4 553 mtctr r4
554 554
5551: dcbf 0,r3 5551: dcbf 0,r3
556 addi r3,r3,L1_CACHE_LINE_SIZE 556 addi r3,r3,L1_CACHE_BYTES
557 bdnz 1b 557 bdnz 1b
558 sync /* wait for dcbst's to get to ram */ 558 sync /* wait for dcbst's to get to ram */
559 blr 559 blr
@@ -566,16 +566,16 @@ _GLOBAL(flush_dcache_range)
566 * invalidate_dcache_range(unsigned long start, unsigned long stop) 566 * invalidate_dcache_range(unsigned long start, unsigned long stop)
567 */ 567 */
568_GLOBAL(invalidate_dcache_range) 568_GLOBAL(invalidate_dcache_range)
569 li r5,L1_CACHE_LINE_SIZE-1 569 li r5,L1_CACHE_BYTES-1
570 andc r3,r3,r5 570 andc r3,r3,r5
571 subf r4,r3,r4 571 subf r4,r3,r4
572 add r4,r4,r5 572 add r4,r4,r5
573 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 573 srwi. r4,r4,L1_CACHE_SHIFT
574 beqlr 574 beqlr
575 mtctr r4 575 mtctr r4
576 576
5771: dcbi 0,r3 5771: dcbi 0,r3
578 addi r3,r3,L1_CACHE_LINE_SIZE 578 addi r3,r3,L1_CACHE_BYTES
579 bdnz 1b 579 bdnz 1b
580 sync /* wait for dcbi's to get to ram */ 580 sync /* wait for dcbi's to get to ram */
581 blr 581 blr
@@ -596,7 +596,7 @@ _GLOBAL(flush_dcache_all)
596 mtctr r4 596 mtctr r4
597 lis r5, KERNELBASE@h 597 lis r5, KERNELBASE@h
5981: lwz r3, 0(r5) /* Load one word from every line */ 5981: lwz r3, 0(r5) /* Load one word from every line */
599 addi r5, r5, L1_CACHE_LINE_SIZE 599 addi r5, r5, L1_CACHE_BYTES
600 bdnz 1b 600 bdnz 1b
601 blr 601 blr
602#endif /* CONFIG_NOT_COHERENT_CACHE */ 602#endif /* CONFIG_NOT_COHERENT_CACHE */
@@ -614,16 +614,16 @@ BEGIN_FTR_SECTION
614 blr /* for 601, do nothing */ 614 blr /* for 601, do nothing */
615END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 615END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
616 rlwinm r3,r3,0,0,19 /* Get page base address */ 616 rlwinm r3,r3,0,0,19 /* Get page base address */
617 li r4,4096/L1_CACHE_LINE_SIZE /* Number of lines in a page */ 617 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */
618 mtctr r4 618 mtctr r4
619 mr r6,r3 619 mr r6,r3
6200: dcbst 0,r3 /* Write line to ram */ 6200: dcbst 0,r3 /* Write line to ram */
621 addi r3,r3,L1_CACHE_LINE_SIZE 621 addi r3,r3,L1_CACHE_BYTES
622 bdnz 0b 622 bdnz 0b
623 sync 623 sync
624 mtctr r4 624 mtctr r4
6251: icbi 0,r6 6251: icbi 0,r6
626 addi r6,r6,L1_CACHE_LINE_SIZE 626 addi r6,r6,L1_CACHE_BYTES
627 bdnz 1b 627 bdnz 1b
628 sync 628 sync
629 isync 629 isync
@@ -646,16 +646,16 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
646 mtmsr r0 646 mtmsr r0
647 isync 647 isync
648 rlwinm r3,r3,0,0,19 /* Get page base address */ 648 rlwinm r3,r3,0,0,19 /* Get page base address */
649 li r4,4096/L1_CACHE_LINE_SIZE /* Number of lines in a page */ 649 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */
650 mtctr r4 650 mtctr r4
651 mr r6,r3 651 mr r6,r3
6520: dcbst 0,r3 /* Write line to ram */ 6520: dcbst 0,r3 /* Write line to ram */
653 addi r3,r3,L1_CACHE_LINE_SIZE 653 addi r3,r3,L1_CACHE_BYTES
654 bdnz 0b 654 bdnz 0b
655 sync 655 sync
656 mtctr r4 656 mtctr r4
6571: icbi 0,r6 6571: icbi 0,r6
658 addi r6,r6,L1_CACHE_LINE_SIZE 658 addi r6,r6,L1_CACHE_BYTES
659 bdnz 1b 659 bdnz 1b
660 sync 660 sync
661 mtmsr r10 /* restore DR */ 661 mtmsr r10 /* restore DR */
@@ -670,7 +670,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
670 * void clear_pages(void *page, int order) ; 670 * void clear_pages(void *page, int order) ;
671 */ 671 */
672_GLOBAL(clear_pages) 672_GLOBAL(clear_pages)
673 li r0,4096/L1_CACHE_LINE_SIZE 673 li r0,4096/L1_CACHE_BYTES
674 slw r0,r0,r4 674 slw r0,r0,r4
675 mtctr r0 675 mtctr r0
676#ifdef CONFIG_8xx 676#ifdef CONFIG_8xx
@@ -682,7 +682,7 @@ _GLOBAL(clear_pages)
682#else 682#else
6831: dcbz 0,r3 6831: dcbz 0,r3
684#endif 684#endif
685 addi r3,r3,L1_CACHE_LINE_SIZE 685 addi r3,r3,L1_CACHE_BYTES
686 bdnz 1b 686 bdnz 1b
687 blr 687 blr
688 688
@@ -708,7 +708,7 @@ _GLOBAL(copy_page)
708 708
709#ifdef CONFIG_8xx 709#ifdef CONFIG_8xx
710 /* don't use prefetch on 8xx */ 710 /* don't use prefetch on 8xx */
711 li r0,4096/L1_CACHE_LINE_SIZE 711 li r0,4096/L1_CACHE_BYTES
712 mtctr r0 712 mtctr r0
7131: COPY_16_BYTES 7131: COPY_16_BYTES
714 bdnz 1b 714 bdnz 1b
@@ -722,13 +722,13 @@ _GLOBAL(copy_page)
722 li r11,4 722 li r11,4
723 mtctr r0 723 mtctr r0
72411: dcbt r11,r4 72411: dcbt r11,r4
725 addi r11,r11,L1_CACHE_LINE_SIZE 725 addi r11,r11,L1_CACHE_BYTES
726 bdnz 11b 726 bdnz 11b
727#else /* MAX_COPY_PREFETCH == 1 */ 727#else /* MAX_COPY_PREFETCH == 1 */
728 dcbt r5,r4 728 dcbt r5,r4
729 li r11,L1_CACHE_LINE_SIZE+4 729 li r11,L1_CACHE_BYTES+4
730#endif /* MAX_COPY_PREFETCH */ 730#endif /* MAX_COPY_PREFETCH */
731 li r0,4096/L1_CACHE_LINE_SIZE - MAX_COPY_PREFETCH 731 li r0,4096/L1_CACHE_BYTES - MAX_COPY_PREFETCH
732 crclr 4*cr0+eq 732 crclr 4*cr0+eq
7332: 7332:
734 mtctr r0 734 mtctr r0
@@ -736,12 +736,12 @@ _GLOBAL(copy_page)
736 dcbt r11,r4 736 dcbt r11,r4
737 dcbz r5,r3 737 dcbz r5,r3
738 COPY_16_BYTES 738 COPY_16_BYTES
739#if L1_CACHE_LINE_SIZE >= 32 739#if L1_CACHE_BYTES >= 32
740 COPY_16_BYTES 740 COPY_16_BYTES
741#if L1_CACHE_LINE_SIZE >= 64 741#if L1_CACHE_BYTES >= 64
742 COPY_16_BYTES 742 COPY_16_BYTES
743 COPY_16_BYTES 743 COPY_16_BYTES
744#if L1_CACHE_LINE_SIZE >= 128 744#if L1_CACHE_BYTES >= 128
745 COPY_16_BYTES 745 COPY_16_BYTES
746 COPY_16_BYTES 746 COPY_16_BYTES
747 COPY_16_BYTES 747 COPY_16_BYTES
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index 420a912198a2..bee51414812e 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -66,9 +66,9 @@
66 .stabs "copy32.S",N_SO,0,0,0f 66 .stabs "copy32.S",N_SO,0,0,0f
670: 670:
68 68
69CACHELINE_BYTES = L1_CACHE_LINE_SIZE 69CACHELINE_BYTES = L1_CACHE_BYTES
70LG_CACHELINE_BYTES = LG_L1_CACHE_LINE_SIZE 70LG_CACHELINE_BYTES = L1_CACHE_SHIFT
71CACHELINE_MASK = (L1_CACHE_LINE_SIZE-1) 71CACHELINE_MASK = (L1_CACHE_BYTES-1)
72 72
73/* 73/*
74 * Use dcbz on the complete cache lines in the destination 74 * Use dcbz on the complete cache lines in the destination
@@ -205,12 +205,12 @@ _GLOBAL(cacheable_memcpy)
205 dcbz r11,r6 205 dcbz r11,r6
206#endif 206#endif
207 COPY_16_BYTES 207 COPY_16_BYTES
208#if L1_CACHE_LINE_SIZE >= 32 208#if L1_CACHE_BYTES >= 32
209 COPY_16_BYTES 209 COPY_16_BYTES
210#if L1_CACHE_LINE_SIZE >= 64 210#if L1_CACHE_BYTES >= 64
211 COPY_16_BYTES 211 COPY_16_BYTES
212 COPY_16_BYTES 212 COPY_16_BYTES
213#if L1_CACHE_LINE_SIZE >= 128 213#if L1_CACHE_BYTES >= 128
214 COPY_16_BYTES 214 COPY_16_BYTES
215 COPY_16_BYTES 215 COPY_16_BYTES
216 COPY_16_BYTES 216 COPY_16_BYTES
@@ -399,12 +399,12 @@ _GLOBAL(__copy_tofrom_user)
399 .text 399 .text
400/* the main body of the cacheline loop */ 400/* the main body of the cacheline loop */
401 COPY_16_BYTES_WITHEX(0) 401 COPY_16_BYTES_WITHEX(0)
402#if L1_CACHE_LINE_SIZE >= 32 402#if L1_CACHE_BYTES >= 32
403 COPY_16_BYTES_WITHEX(1) 403 COPY_16_BYTES_WITHEX(1)
404#if L1_CACHE_LINE_SIZE >= 64 404#if L1_CACHE_BYTES >= 64
405 COPY_16_BYTES_WITHEX(2) 405 COPY_16_BYTES_WITHEX(2)
406 COPY_16_BYTES_WITHEX(3) 406 COPY_16_BYTES_WITHEX(3)
407#if L1_CACHE_LINE_SIZE >= 128 407#if L1_CACHE_BYTES >= 128
408 COPY_16_BYTES_WITHEX(4) 408 COPY_16_BYTES_WITHEX(4)
409 COPY_16_BYTES_WITHEX(5) 409 COPY_16_BYTES_WITHEX(5)
410 COPY_16_BYTES_WITHEX(6) 410 COPY_16_BYTES_WITHEX(6)
@@ -458,12 +458,12 @@ _GLOBAL(__copy_tofrom_user)
458 * 104f (if in read part) or 105f (if in write part), after updating r5 458 * 104f (if in read part) or 105f (if in write part), after updating r5
459 */ 459 */
460 COPY_16_BYTES_EXCODE(0) 460 COPY_16_BYTES_EXCODE(0)
461#if L1_CACHE_LINE_SIZE >= 32 461#if L1_CACHE_BYTES >= 32
462 COPY_16_BYTES_EXCODE(1) 462 COPY_16_BYTES_EXCODE(1)
463#if L1_CACHE_LINE_SIZE >= 64 463#if L1_CACHE_BYTES >= 64
464 COPY_16_BYTES_EXCODE(2) 464 COPY_16_BYTES_EXCODE(2)
465 COPY_16_BYTES_EXCODE(3) 465 COPY_16_BYTES_EXCODE(3)
466#if L1_CACHE_LINE_SIZE >= 128 466#if L1_CACHE_BYTES >= 128
467 COPY_16_BYTES_EXCODE(4) 467 COPY_16_BYTES_EXCODE(4)
468 COPY_16_BYTES_EXCODE(5) 468 COPY_16_BYTES_EXCODE(5)
469 COPY_16_BYTES_EXCODE(6) 469 COPY_16_BYTES_EXCODE(6)
diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
index 88419c77ac43..22b113d19b24 100644
--- a/arch/powerpc/platforms/powermac/sleep.S
+++ b/arch/powerpc/platforms/powermac/sleep.S
@@ -387,10 +387,10 @@ turn_on_mmu:
387#endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */ 387#endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */
388 388
389 .section .data 389 .section .data
390 .balign L1_CACHE_LINE_SIZE 390 .balign L1_CACHE_BYTES
391sleep_storage: 391sleep_storage:
392 .long 0 392 .long 0
393 .balign L1_CACHE_LINE_SIZE, 0 393 .balign L1_CACHE_BYTES, 0
394 394
395#endif /* CONFIG_6xx */ 395#endif /* CONFIG_6xx */
396 .section .text 396 .section .text
diff --git a/arch/ppc/kernel/cpu_setup_6xx.S b/arch/ppc/kernel/cpu_setup_6xx.S
index a5333c07fc3c..55ed7716636f 100644
--- a/arch/ppc/kernel/cpu_setup_6xx.S
+++ b/arch/ppc/kernel/cpu_setup_6xx.S
@@ -290,10 +290,10 @@ _GLOBAL(__init_fpu_registers)
290#define CS_SIZE 32 290#define CS_SIZE 32
291 291
292 .data 292 .data
293 .balign L1_CACHE_LINE_SIZE 293 .balign L1_CACHE_BYTES
294cpu_state_storage: 294cpu_state_storage:
295 .space CS_SIZE 295 .space CS_SIZE
296 .balign L1_CACHE_LINE_SIZE,0 296 .balign L1_CACHE_BYTES,0
297 .text 297 .text
298 298
299/* Called in normal context to backup CPU 0 state. This 299/* Called in normal context to backup CPU 0 state. This
diff --git a/arch/ppc/kernel/cpu_setup_power4.S b/arch/ppc/kernel/cpu_setup_power4.S
index 0abb5f25b2ca..d7bfd60e21fc 100644
--- a/arch/ppc/kernel/cpu_setup_power4.S
+++ b/arch/ppc/kernel/cpu_setup_power4.S
@@ -86,10 +86,10 @@ _GLOBAL(__setup_cpu_ppc970)
86#define CS_SIZE 32 86#define CS_SIZE 32
87 87
88 .data 88 .data
89 .balign L1_CACHE_LINE_SIZE 89 .balign L1_CACHE_BYTES
90cpu_state_storage: 90cpu_state_storage:
91 .space CS_SIZE 91 .space CS_SIZE
92 .balign L1_CACHE_LINE_SIZE,0 92 .balign L1_CACHE_BYTES,0
93 .text 93 .text
94 94
95/* Called in normal context to backup CPU 0 state. This 95/* Called in normal context to backup CPU 0 state. This
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
index 5b43987a943b..c5a890dca9cf 100644
--- a/arch/ppc/kernel/head.S
+++ b/arch/ppc/kernel/head.S
@@ -916,7 +916,7 @@ relocate_kernel:
916copy_and_flush: 916copy_and_flush:
917 addi r5,r5,-4 917 addi r5,r5,-4
918 addi r6,r6,-4 918 addi r6,r6,-4
9194: li r0,L1_CACHE_LINE_SIZE/4 9194: li r0,L1_CACHE_BYTES/4
920 mtctr r0 920 mtctr r0
9213: addi r6,r6,4 /* copy a cache line */ 9213: addi r6,r6,4 /* copy a cache line */
922 lwzx r0,r6,r4 922 lwzx r0,r6,r4
diff --git a/arch/ppc/kernel/l2cr.S b/arch/ppc/kernel/l2cr.S
index 861115249b35..d7f4e982b539 100644
--- a/arch/ppc/kernel/l2cr.S
+++ b/arch/ppc/kernel/l2cr.S
@@ -203,7 +203,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
203 * L1 icache 203 * L1 icache
204 */ 204 */
205 b 20f 205 b 20f
206 .balign L1_CACHE_LINE_SIZE 206 .balign L1_CACHE_BYTES
20722: 20722:
208 sync 208 sync
209 mtspr SPRN_L2CR,r3 209 mtspr SPRN_L2CR,r3
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 2b9a16274b0b..2350f3e09f95 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -498,21 +498,21 @@ _GLOBAL(flush_icache_range)
498BEGIN_FTR_SECTION 498BEGIN_FTR_SECTION
499 blr /* for 601, do nothing */ 499 blr /* for 601, do nothing */
500END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 500END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
501 li r5,L1_CACHE_LINE_SIZE-1 501 li r5,L1_CACHE_BYTES-1
502 andc r3,r3,r5 502 andc r3,r3,r5
503 subf r4,r3,r4 503 subf r4,r3,r4
504 add r4,r4,r5 504 add r4,r4,r5
505 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 505 srwi. r4,r4,L1_CACHE_SHIFT
506 beqlr 506 beqlr
507 mtctr r4 507 mtctr r4
508 mr r6,r3 508 mr r6,r3
5091: dcbst 0,r3 5091: dcbst 0,r3
510 addi r3,r3,L1_CACHE_LINE_SIZE 510 addi r3,r3,L1_CACHE_BYTES
511 bdnz 1b 511 bdnz 1b
512 sync /* wait for dcbst's to get to ram */ 512 sync /* wait for dcbst's to get to ram */
513 mtctr r4 513 mtctr r4
5142: icbi 0,r6 5142: icbi 0,r6
515 addi r6,r6,L1_CACHE_LINE_SIZE 515 addi r6,r6,L1_CACHE_BYTES
516 bdnz 2b 516 bdnz 2b
517 sync /* additional sync needed on g4 */ 517 sync /* additional sync needed on g4 */
518 isync 518 isync
@@ -525,16 +525,16 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
525 * clean_dcache_range(unsigned long start, unsigned long stop) 525 * clean_dcache_range(unsigned long start, unsigned long stop)
526 */ 526 */
527_GLOBAL(clean_dcache_range) 527_GLOBAL(clean_dcache_range)
528 li r5,L1_CACHE_LINE_SIZE-1 528 li r5,L1_CACHE_BYTES-1
529 andc r3,r3,r5 529 andc r3,r3,r5
530 subf r4,r3,r4 530 subf r4,r3,r4
531 add r4,r4,r5 531 add r4,r4,r5
532 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 532 srwi. r4,r4,L1_CACHE_SHIFT
533 beqlr 533 beqlr
534 mtctr r4 534 mtctr r4
535 535
5361: dcbst 0,r3 5361: dcbst 0,r3
537 addi r3,r3,L1_CACHE_LINE_SIZE 537 addi r3,r3,L1_CACHE_BYTES
538 bdnz 1b 538 bdnz 1b
539 sync /* wait for dcbst's to get to ram */ 539 sync /* wait for dcbst's to get to ram */
540 blr 540 blr
@@ -546,16 +546,16 @@ _GLOBAL(clean_dcache_range)
546 * flush_dcache_range(unsigned long start, unsigned long stop) 546 * flush_dcache_range(unsigned long start, unsigned long stop)
547 */ 547 */
548_GLOBAL(flush_dcache_range) 548_GLOBAL(flush_dcache_range)
549 li r5,L1_CACHE_LINE_SIZE-1 549 li r5,L1_CACHE_BYTES-1
550 andc r3,r3,r5 550 andc r3,r3,r5
551 subf r4,r3,r4 551 subf r4,r3,r4
552 add r4,r4,r5 552 add r4,r4,r5
553 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 553 srwi. r4,r4,L1_CACHE_SHIFT
554 beqlr 554 beqlr
555 mtctr r4 555 mtctr r4
556 556
5571: dcbf 0,r3 5571: dcbf 0,r3
558 addi r3,r3,L1_CACHE_LINE_SIZE 558 addi r3,r3,L1_CACHE_BYTES
559 bdnz 1b 559 bdnz 1b
560 sync /* wait for dcbst's to get to ram */ 560 sync /* wait for dcbst's to get to ram */
561 blr 561 blr
@@ -568,16 +568,16 @@ _GLOBAL(flush_dcache_range)
568 * invalidate_dcache_range(unsigned long start, unsigned long stop) 568 * invalidate_dcache_range(unsigned long start, unsigned long stop)
569 */ 569 */
570_GLOBAL(invalidate_dcache_range) 570_GLOBAL(invalidate_dcache_range)
571 li r5,L1_CACHE_LINE_SIZE-1 571 li r5,L1_CACHE_BYTES-1
572 andc r3,r3,r5 572 andc r3,r3,r5
573 subf r4,r3,r4 573 subf r4,r3,r4
574 add r4,r4,r5 574 add r4,r4,r5
575 srwi. r4,r4,LG_L1_CACHE_LINE_SIZE 575 srwi. r4,r4,L1_CACHE_SHIFT
576 beqlr 576 beqlr
577 mtctr r4 577 mtctr r4
578 578
5791: dcbi 0,r3 5791: dcbi 0,r3
580 addi r3,r3,L1_CACHE_LINE_SIZE 580 addi r3,r3,L1_CACHE_BYTES
581 bdnz 1b 581 bdnz 1b
582 sync /* wait for dcbi's to get to ram */ 582 sync /* wait for dcbi's to get to ram */
583 blr 583 blr
@@ -598,7 +598,7 @@ _GLOBAL(flush_dcache_all)
598 mtctr r4 598 mtctr r4
599 lis r5, KERNELBASE@h 599 lis r5, KERNELBASE@h
6001: lwz r3, 0(r5) /* Load one word from every line */ 6001: lwz r3, 0(r5) /* Load one word from every line */
601 addi r5, r5, L1_CACHE_LINE_SIZE 601 addi r5, r5, L1_CACHE_BYTES
602 bdnz 1b 602 bdnz 1b
603 blr 603 blr
604#endif /* CONFIG_NOT_COHERENT_CACHE */ 604#endif /* CONFIG_NOT_COHERENT_CACHE */
@@ -616,16 +616,16 @@ BEGIN_FTR_SECTION
616 blr /* for 601, do nothing */ 616 blr /* for 601, do nothing */
617END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 617END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
618 rlwinm r3,r3,0,0,19 /* Get page base address */ 618 rlwinm r3,r3,0,0,19 /* Get page base address */
619 li r4,4096/L1_CACHE_LINE_SIZE /* Number of lines in a page */ 619 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */
620 mtctr r4 620 mtctr r4
621 mr r6,r3 621 mr r6,r3
6220: dcbst 0,r3 /* Write line to ram */ 6220: dcbst 0,r3 /* Write line to ram */
623 addi r3,r3,L1_CACHE_LINE_SIZE 623 addi r3,r3,L1_CACHE_BYTES
624 bdnz 0b 624 bdnz 0b
625 sync 625 sync
626 mtctr r4 626 mtctr r4
6271: icbi 0,r6 6271: icbi 0,r6
628 addi r6,r6,L1_CACHE_LINE_SIZE 628 addi r6,r6,L1_CACHE_BYTES
629 bdnz 1b 629 bdnz 1b
630 sync 630 sync
631 isync 631 isync
@@ -648,16 +648,16 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
648 mtmsr r0 648 mtmsr r0
649 isync 649 isync
650 rlwinm r3,r3,0,0,19 /* Get page base address */ 650 rlwinm r3,r3,0,0,19 /* Get page base address */
651 li r4,4096/L1_CACHE_LINE_SIZE /* Number of lines in a page */ 651 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */
652 mtctr r4 652 mtctr r4
653 mr r6,r3 653 mr r6,r3
6540: dcbst 0,r3 /* Write line to ram */ 6540: dcbst 0,r3 /* Write line to ram */
655 addi r3,r3,L1_CACHE_LINE_SIZE 655 addi r3,r3,L1_CACHE_BYTES
656 bdnz 0b 656 bdnz 0b
657 sync 657 sync
658 mtctr r4 658 mtctr r4
6591: icbi 0,r6 6591: icbi 0,r6
660 addi r6,r6,L1_CACHE_LINE_SIZE 660 addi r6,r6,L1_CACHE_BYTES
661 bdnz 1b 661 bdnz 1b
662 sync 662 sync
663 mtmsr r10 /* restore DR */ 663 mtmsr r10 /* restore DR */
@@ -672,7 +672,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
672 * void clear_pages(void *page, int order) ; 672 * void clear_pages(void *page, int order) ;
673 */ 673 */
674_GLOBAL(clear_pages) 674_GLOBAL(clear_pages)
675 li r0,4096/L1_CACHE_LINE_SIZE 675 li r0,4096/L1_CACHE_BYTES
676 slw r0,r0,r4 676 slw r0,r0,r4
677 mtctr r0 677 mtctr r0
678#ifdef CONFIG_8xx 678#ifdef CONFIG_8xx
@@ -684,7 +684,7 @@ _GLOBAL(clear_pages)
684#else 684#else
6851: dcbz 0,r3 6851: dcbz 0,r3
686#endif 686#endif
687 addi r3,r3,L1_CACHE_LINE_SIZE 687 addi r3,r3,L1_CACHE_BYTES
688 bdnz 1b 688 bdnz 1b
689 blr 689 blr
690 690
@@ -710,7 +710,7 @@ _GLOBAL(copy_page)
710 710
711#ifdef CONFIG_8xx 711#ifdef CONFIG_8xx
712 /* don't use prefetch on 8xx */ 712 /* don't use prefetch on 8xx */
713 li r0,4096/L1_CACHE_LINE_SIZE 713 li r0,4096/L1_CACHE_BYTES
714 mtctr r0 714 mtctr r0
7151: COPY_16_BYTES 7151: COPY_16_BYTES
716 bdnz 1b 716 bdnz 1b
@@ -724,13 +724,13 @@ _GLOBAL(copy_page)
724 li r11,4 724 li r11,4
725 mtctr r0 725 mtctr r0
72611: dcbt r11,r4 72611: dcbt r11,r4
727 addi r11,r11,L1_CACHE_LINE_SIZE 727 addi r11,r11,L1_CACHE_BYTES
728 bdnz 11b 728 bdnz 11b
729#else /* MAX_COPY_PREFETCH == 1 */ 729#else /* MAX_COPY_PREFETCH == 1 */
730 dcbt r5,r4 730 dcbt r5,r4
731 li r11,L1_CACHE_LINE_SIZE+4 731 li r11,L1_CACHE_BYTES+4
732#endif /* MAX_COPY_PREFETCH */ 732#endif /* MAX_COPY_PREFETCH */
733 li r0,4096/L1_CACHE_LINE_SIZE - MAX_COPY_PREFETCH 733 li r0,4096/L1_CACHE_BYTES - MAX_COPY_PREFETCH
734 crclr 4*cr0+eq 734 crclr 4*cr0+eq
7352: 7352:
736 mtctr r0 736 mtctr r0
@@ -738,12 +738,12 @@ _GLOBAL(copy_page)
738 dcbt r11,r4 738 dcbt r11,r4
739 dcbz r5,r3 739 dcbz r5,r3
740 COPY_16_BYTES 740 COPY_16_BYTES
741#if L1_CACHE_LINE_SIZE >= 32 741#if L1_CACHE_BYTES >= 32
742 COPY_16_BYTES 742 COPY_16_BYTES
743#if L1_CACHE_LINE_SIZE >= 64 743#if L1_CACHE_BYTES >= 64
744 COPY_16_BYTES 744 COPY_16_BYTES
745 COPY_16_BYTES 745 COPY_16_BYTES
746#if L1_CACHE_LINE_SIZE >= 128 746#if L1_CACHE_BYTES >= 128
747 COPY_16_BYTES 747 COPY_16_BYTES
748 COPY_16_BYTES 748 COPY_16_BYTES
749 COPY_16_BYTES 749 COPY_16_BYTES
diff --git a/arch/ppc/lib/string.S b/arch/ppc/lib/string.S
index 36c9b97fd92a..2e258c49e8be 100644
--- a/arch/ppc/lib/string.S
+++ b/arch/ppc/lib/string.S
@@ -65,9 +65,9 @@
65 .stabs "arch/ppc/lib/",N_SO,0,0,0f 65 .stabs "arch/ppc/lib/",N_SO,0,0,0f
66 .stabs "string.S",N_SO,0,0,0f 66 .stabs "string.S",N_SO,0,0,0f
67 67
68CACHELINE_BYTES = L1_CACHE_LINE_SIZE 68CACHELINE_BYTES = L1_CACHE_BYTES
69LG_CACHELINE_BYTES = LG_L1_CACHE_LINE_SIZE 69LG_CACHELINE_BYTES = L1_CACHE_SHIFT
70CACHELINE_MASK = (L1_CACHE_LINE_SIZE-1) 70CACHELINE_MASK = (L1_CACHE_BYTES-1)
71 71
72_GLOBAL(strcpy) 72_GLOBAL(strcpy)
73 addi r5,r3,-1 73 addi r5,r3,-1
@@ -265,12 +265,12 @@ _GLOBAL(cacheable_memcpy)
265 dcbz r11,r6 265 dcbz r11,r6
266#endif 266#endif
267 COPY_16_BYTES 267 COPY_16_BYTES
268#if L1_CACHE_LINE_SIZE >= 32 268#if L1_CACHE_BYTES >= 32
269 COPY_16_BYTES 269 COPY_16_BYTES
270#if L1_CACHE_LINE_SIZE >= 64 270#if L1_CACHE_BYTES >= 64
271 COPY_16_BYTES 271 COPY_16_BYTES
272 COPY_16_BYTES 272 COPY_16_BYTES
273#if L1_CACHE_LINE_SIZE >= 128 273#if L1_CACHE_BYTES >= 128
274 COPY_16_BYTES 274 COPY_16_BYTES
275 COPY_16_BYTES 275 COPY_16_BYTES
276 COPY_16_BYTES 276 COPY_16_BYTES
@@ -485,12 +485,12 @@ _GLOBAL(__copy_tofrom_user)
485 .text 485 .text
486/* the main body of the cacheline loop */ 486/* the main body of the cacheline loop */
487 COPY_16_BYTES_WITHEX(0) 487 COPY_16_BYTES_WITHEX(0)
488#if L1_CACHE_LINE_SIZE >= 32 488#if L1_CACHE_BYTES >= 32
489 COPY_16_BYTES_WITHEX(1) 489 COPY_16_BYTES_WITHEX(1)
490#if L1_CACHE_LINE_SIZE >= 64 490#if L1_CACHE_BYTES >= 64
491 COPY_16_BYTES_WITHEX(2) 491 COPY_16_BYTES_WITHEX(2)
492 COPY_16_BYTES_WITHEX(3) 492 COPY_16_BYTES_WITHEX(3)
493#if L1_CACHE_LINE_SIZE >= 128 493#if L1_CACHE_BYTES >= 128
494 COPY_16_BYTES_WITHEX(4) 494 COPY_16_BYTES_WITHEX(4)
495 COPY_16_BYTES_WITHEX(5) 495 COPY_16_BYTES_WITHEX(5)
496 COPY_16_BYTES_WITHEX(6) 496 COPY_16_BYTES_WITHEX(6)
@@ -544,12 +544,12 @@ _GLOBAL(__copy_tofrom_user)
544 * 104f (if in read part) or 105f (if in write part), after updating r5 544 * 104f (if in read part) or 105f (if in write part), after updating r5
545 */ 545 */
546 COPY_16_BYTES_EXCODE(0) 546 COPY_16_BYTES_EXCODE(0)
547#if L1_CACHE_LINE_SIZE >= 32 547#if L1_CACHE_BYTES >= 32
548 COPY_16_BYTES_EXCODE(1) 548 COPY_16_BYTES_EXCODE(1)
549#if L1_CACHE_LINE_SIZE >= 64 549#if L1_CACHE_BYTES >= 64
550 COPY_16_BYTES_EXCODE(2) 550 COPY_16_BYTES_EXCODE(2)
551 COPY_16_BYTES_EXCODE(3) 551 COPY_16_BYTES_EXCODE(3)
552#if L1_CACHE_LINE_SIZE >= 128 552#if L1_CACHE_BYTES >= 128
553 COPY_16_BYTES_EXCODE(4) 553 COPY_16_BYTES_EXCODE(4)
554 COPY_16_BYTES_EXCODE(5) 554 COPY_16_BYTES_EXCODE(5)
555 COPY_16_BYTES_EXCODE(6) 555 COPY_16_BYTES_EXCODE(6)
diff --git a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c
index 3eb611e23f69..a301c5ac58dd 100644
--- a/arch/ppc/platforms/katana.c
+++ b/arch/ppc/platforms/katana.c
@@ -521,7 +521,7 @@ katana_fixup_resources(struct pci_dev *dev)
521{ 521{
522 u16 v16; 522 u16 v16;
523 523
524 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, L1_CACHE_LINE_SIZE>>2); 524 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, L1_CACHE_BYTES>>2);
525 525
526 pci_read_config_word(dev, PCI_COMMAND, &v16); 526 pci_read_config_word(dev, PCI_COMMAND, &v16);
527 v16 |= PCI_COMMAND_INVALIDATE | PCI_COMMAND_FAST_BACK; 527 v16 |= PCI_COMMAND_INVALIDATE | PCI_COMMAND_FAST_BACK;
diff --git a/arch/ppc/platforms/pmac_sleep.S b/arch/ppc/platforms/pmac_sleep.S
index 88419c77ac43..22b113d19b24 100644
--- a/arch/ppc/platforms/pmac_sleep.S
+++ b/arch/ppc/platforms/pmac_sleep.S
@@ -387,10 +387,10 @@ turn_on_mmu:
387#endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */ 387#endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */
388 388
389 .section .data 389 .section .data
390 .balign L1_CACHE_LINE_SIZE 390 .balign L1_CACHE_BYTES
391sleep_storage: 391sleep_storage:
392 .long 0 392 .long 0
393 .balign L1_CACHE_LINE_SIZE, 0 393 .balign L1_CACHE_BYTES, 0
394 394
395#endif /* CONFIG_6xx */ 395#endif /* CONFIG_6xx */
396 .section .text 396 .section .text
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
index 4849850a59ed..a781c50d2f4c 100644
--- a/arch/ppc/syslib/mv64x60.c
+++ b/arch/ppc/syslib/mv64x60.c
@@ -1304,7 +1304,7 @@ mv64x60_config_pci_params(struct pci_controller *hose,
1304 early_write_config_word(hose, 0, devfn, PCI_COMMAND, u16_val); 1304 early_write_config_word(hose, 0, devfn, PCI_COMMAND, u16_val);
1305 1305
1306 /* Set latency timer, cache line size, clear BIST */ 1306 /* Set latency timer, cache line size, clear BIST */
1307 u16_val = (pi->latency_timer << 8) | (L1_CACHE_LINE_SIZE >> 2); 1307 u16_val = (pi->latency_timer << 8) | (L1_CACHE_BYTES >> 2);
1308 early_write_config_word(hose, 0, devfn, PCI_CACHE_LINE_SIZE, u16_val); 1308 early_write_config_word(hose, 0, devfn, PCI_CACHE_LINE_SIZE, u16_val);
1309 1309
1310 mv64x60_pci_exclude_bridge = save_exclude; 1310 mv64x60_pci_exclude_bridge = save_exclude;
diff --git a/include/asm-ppc/cache.h b/include/asm-ppc/cache.h
index 38f2f1be4a87..7a157d0f4b5f 100644
--- a/include/asm-ppc/cache.h
+++ b/include/asm-ppc/cache.h
@@ -9,21 +9,18 @@
9 9
10/* bytes per L1 cache line */ 10/* bytes per L1 cache line */
11#if defined(CONFIG_8xx) || defined(CONFIG_403GCX) 11#if defined(CONFIG_8xx) || defined(CONFIG_403GCX)
12#define L1_CACHE_LINE_SIZE 16 12#define L1_CACHE_SHIFT 4
13#define LG_L1_CACHE_LINE_SIZE 4
14#define MAX_COPY_PREFETCH 1 13#define MAX_COPY_PREFETCH 1
15#elif defined(CONFIG_PPC64BRIDGE) 14#elif defined(CONFIG_PPC64BRIDGE)
16#define L1_CACHE_LINE_SIZE 128 15#define L1_CACHE_SHIFT 7
17#define LG_L1_CACHE_LINE_SIZE 7
18#define MAX_COPY_PREFETCH 1 16#define MAX_COPY_PREFETCH 1
19#else 17#else
20#define L1_CACHE_LINE_SIZE 32 18#define L1_CACHE_SHIFT 5
21#define LG_L1_CACHE_LINE_SIZE 5
22#define MAX_COPY_PREFETCH 4 19#define MAX_COPY_PREFETCH 4
23#endif 20#endif
24 21
25#define L1_CACHE_BYTES L1_CACHE_LINE_SIZE 22#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
26#define L1_CACHE_SHIFT LG_L1_CACHE_LINE_SIZE 23
27#define SMP_CACHE_BYTES L1_CACHE_BYTES 24#define SMP_CACHE_BYTES L1_CACHE_BYTES
28#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ 25#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */
29 26