2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Quick'n'dirty IP checksum ...
8 * Copyright (C) 1998, 1999 Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
12 #include <asm/regdef.h>
16 * As we are sharing code base with the mips32 tree (which use the o32 ABI
17 * register definitions). We need to redefine the register definitions from
18 * the n64 ABI register naming to the o32 ABI register naming.
34 #define ADDC(sum,reg) \
39 #define CSUM_BIGCHUNK(src, offset, sum, _t0, _t1, _t2, _t3) \
40 lw _t0, (offset + 0x00)(src); \
41 lw _t1, (offset + 0x04)(src); \
42 lw _t2, (offset + 0x08)(src); \
43 lw _t3, (offset + 0x0c)(src); \
48 lw _t0, (offset + 0x10)(src); \
49 lw _t1, (offset + 0x14)(src); \
50 lw _t2, (offset + 0x18)(src); \
51 lw _t3, (offset + 0x1c)(src); \
59 * a1: length of the area to checksum
60 * a2: partial checksum
74 bnez t8, small_csumcpy /* < 8 bytes to copy */
77 andi t7, src, 0x1 /* odd buffer? */
89 PTR_ADDU src, src, 0x1
100 PTR_ADDU src, src, 0x2
103 bnez t8, do_end_words
111 LONG_SUBU a1, a1, 0x4
113 PTR_ADDU src, src, 0x4
122 LONG_SUBU a1, a1, 0x8
125 PTR_ADDU src, src, 0x8
129 beqz t8, begin_movement
140 LONG_SUBU a1, a1, 0x10
141 PTR_ADDU src, src, 0x10
149 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
150 CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4)
151 CSUM_BIGCHUNK(src, 0x40, sum, t0, t1, t3, t4)
152 CSUM_BIGCHUNK(src, 0x60, sum, t0, t1, t3, t4)
153 LONG_SUBU t8, t8, 0x01
154 bnez t8, move_128bytes
155 PTR_ADDU src, src, 0x80
162 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
163 CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4)
164 PTR_ADDU src, src, 0x40
167 beqz t2, do_end_words
171 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
173 PTR_ADDU src, src, 0x20
176 beqz t8, small_csumcpy
182 LONG_SUBU t8, t8, 0x1
185 PTR_ADDU src, src, 0x4
187 /* unknown src alignment and < 8 bytes to go */
195 /* Still a full word to go */
204 /* Still a halfword to go */
228 /* odd buffer alignment? */
237 /* Add the passed partial csum. */