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>
14 #define ADDC(sum,reg) \
19 #define CSUM_BIGCHUNK(src, offset, sum, t0, t1, t2, t3) \
20 lw t0, (offset + 0x00)(src); \
21 lw t1, (offset + 0x04)(src); \
22 lw t2, (offset + 0x08)(src); \
23 lw t3, (offset + 0x0c)(src); \
28 lw t0, (offset + 0x10)(src); \
29 lw t1, (offset + 0x14)(src); \
30 lw t2, (offset + 0x18)(src); \
31 lw t3, (offset + 0x1c)(src); \
39 * a1: length of the area to checksum
40 * a2: partial checksum
49 /* unknown src alignment and < 8 bytes to go */
57 /* Still a full word to go */
66 /* Still a halfword to go */
90 /* odd buffer alignment? */
99 /* Add the passed partial csum. */
104 /* ------------------------------------------------------------------------- */
112 bnez t8, small_csumcpy /* < 8 bytes to copy */
116 andi t3, src, 0x1 /* odd buffer? */
142 bnez t8, do_end_words
168 beqz t8, begin_movement
188 CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0)
189 CSUM_BIGCHUNK(src, 0x20, sum, ta0, ta1, ta3, t0)
190 CSUM_BIGCHUNK(src, 0x40, sum, ta0, ta1, ta3, t0)
191 CSUM_BIGCHUNK(src, 0x60, sum, ta0, ta1, ta3, t0)
193 bnez t8, move_128bytes
201 CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0)
202 CSUM_BIGCHUNK(src, 0x20, sum, ta0, ta1, ta3, t0)
206 beqz ta2, do_end_words
210 CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0)
215 beqz t8, maybe_end_cruft
229 j small_csumcpy; move a1, ta2 /* XXX ??? */