blob: 4d4eeb9004868a3da2f95b7728f4b0d67192a34c [file] [log] [blame]
Paul Mackerras14cf11a2005-09-26 16:04:21 +10001/*
Mark Nelson57dda6e2008-08-22 14:39:00 +10002 * Copyright (C) 2008 Mark Nelson, IBM Corp.
Paul Mackerras14cf11a2005-09-26 16:04:21 +10003 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <asm/processor.h>
10#include <asm/ppc_asm.h>
Mark Nelson57dda6e2008-08-22 14:39:00 +100011#include <asm/asm-offsets.h>
12
13 .section ".toc","aw"
14PPC64_CACHES:
15 .tc ppc64_caches[TC],ppc64_caches
16 .section ".text"
17
Paul Mackerras14cf11a2005-09-26 16:04:21 +100018
Benjamin Herrenschmidt3c726f82005-11-07 11:06:55 +110019_GLOBAL(copy_4K_page)
Mark Nelson57dda6e2008-08-22 14:39:00 +100020 li r5,4096 /* 4K page size */
21BEGIN_FTR_SECTION
22 ld r10,PPC64_CACHES@toc(r2)
23 lwz r11,DCACHEL1LOGLINESIZE(r10) /* log2 of cache line size */
24 lwz r12,DCACHEL1LINESIZE(r10) /* get cache line size */
25 li r9,0
26 srd r8,r5,r11
27
28 mtctr r8
Anton Blanchard3cd980d2009-10-18 01:23:28 +000029.Lsetup:
Mark Nelson57dda6e2008-08-22 14:39:00 +100030 dcbt r9,r4
31 dcbz r9,r3
32 add r9,r9,r12
Anton Blanchard3cd980d2009-10-18 01:23:28 +000033 bdnz .Lsetup
Mark Nelson57dda6e2008-08-22 14:39:00 +100034END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100035 addi r3,r3,-8
Mark Nelson57dda6e2008-08-22 14:39:00 +100036 srdi r8,r5,7 /* page is copied in 128 byte strides */
37 addi r8,r8,-1 /* one stride copied outside loop */
38
39 mtctr r8
40
41 ld r5,0(r4)
42 ld r6,8(r4)
43 ld r7,16(r4)
44 ldu r8,24(r4)
451: std r5,8(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100046 std r6,16(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000047 ld r9,8(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100048 ld r10,16(r4)
49 std r7,24(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100050 std r8,32(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000051 ld r11,24(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100052 ld r12,32(r4)
53 std r9,40(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100054 std r10,48(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000055 ld r5,40(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100056 ld r6,48(r4)
57 std r11,56(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100058 std r12,64(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000059 ld r7,56(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100060 ld r8,64(r4)
61 std r5,72(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100062 std r6,80(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000063 ld r9,72(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100064 ld r10,80(r4)
65 std r7,88(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100066 std r8,96(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000067 ld r11,88(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100068 ld r12,96(r4)
69 std r9,104(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100070 std r10,112(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000071 ld r5,104(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100072 ld r6,112(r4)
73 std r11,120(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100074 stdu r12,128(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000075 ld r7,120(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100076 ldu r8,128(r4)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100077 bdnz 1b
Mark Nelson57dda6e2008-08-22 14:39:00 +100078
79 std r5,8(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100080 std r6,16(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000081 ld r9,8(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100082 ld r10,16(r4)
83 std r7,24(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100084 std r8,32(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000085 ld r11,24(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100086 ld r12,32(r4)
87 std r9,40(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100088 std r10,48(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000089 ld r5,40(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100090 ld r6,48(r4)
91 std r11,56(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100092 std r12,64(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000093 ld r7,56(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100094 ld r8,64(r4)
95 std r5,72(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100096 std r6,80(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000097 ld r9,72(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100098 ld r10,80(r4)
99 std r7,88(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +1000100 std r8,96(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +0000101 ld r11,88(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +1000102 ld r12,96(r4)
103 std r9,104(r3)
104 std r10,112(r3)
105 std r11,120(r3)
106 std r12,128(r3)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000107 blr