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>
30 #define ADDC(sum,reg) \
35 #define CSUM_BIGCHUNK(src, offset, sum, _t0, _t1, _t2, _t3) \
36 lw _t0, (offset + 0x00)(src); \
37 lw _t1, (offset + 0x04)(src); \
38 lw _t2, (offset + 0x08)(src); \
39 lw _t3, (offset + 0x0c)(src); \
44 lw _t0, (offset + 0x10)(src); \
45 lw _t1, (offset + 0x14)(src); \
46 lw _t2, (offset + 0x18)(src); \
47 lw _t3, (offset + 0x1c)(src); \
55 * a1: length of the area to checksum
56 * a2: partial checksum
65 /* unknown src alignment and < 8 bytes to go */
73 /* Still a full word to go */
82 /* Still a halfword to go */
106 /* odd buffer alignment? */
115 /* Add the passed partial csum. */
120 /* ------------------------------------------------------------------------- */
128 bnez t8, small_csumcpy /* < 8 bytes to copy */
132 andi T7, src, 0x1 /* odd buffer? */
139 LONG_SUBU a1, a1, 0x1
144 PTR_ADDU src, src, 0x1
152 LONG_SUBU a1, a1, 0x2
155 PTR_ADDU src, src, 0x2
158 bnez t8, do_end_words
166 LONG_SUBU a1, a1, 0x4
168 PTR_ADDU src, src, 0x4
177 LONG_SUBU a1, a1, 0x8
180 PTR_ADDU src, src, 0x8
184 beqz t8, begin_movement
195 LONG_SUBU a1, a1, 0x10
196 PTR_ADDU src, src, 0x10
204 CSUM_BIGCHUNK(src, 0x00, sum, T0, T1, T3, T4)
205 CSUM_BIGCHUNK(src, 0x20, sum, T0, T1, T3, T4)
206 CSUM_BIGCHUNK(src, 0x40, sum, T0, T1, T3, T4)
207 CSUM_BIGCHUNK(src, 0x60, sum, T0, T1, T3, T4)
208 LONG_SUBU t8, t8, 0x01
209 bnez t8, move_128bytes
210 PTR_ADDU src, src, 0x80
217 CSUM_BIGCHUNK(src, 0x00, sum, T0, T1, T3, T4)
218 CSUM_BIGCHUNK(src, 0x20, sum, T0, T1, T3, T4)
219 PTR_ADDU src, src, 0x40
222 beqz T2, do_end_words
226 CSUM_BIGCHUNK(src, 0x00, sum, T0, T1, T3, T4)
228 PTR_ADDU src, src, 0x20
231 beqz t8, maybe_end_cruft
236 LONG_SUBU t8, t8, 0x1
239 PTR_ADDU src, src, 0x4
245 j small_csumcpy; move a1, T2 /* XXX ??? */
251 LONG_SUBU a1, a1, 0x1
253 PTR_ADDU src, src, 0x1