Lines Matching +full:0 +full:x409

97 #define dbg(_fmt, args...)     do {} while (0)
118 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
119 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
120 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
121 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
122 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
123 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
124 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
125 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
126 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
127 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
128 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
129 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
130 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
131 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
132 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
133 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
134 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
135 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
136 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
137 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
138 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
139 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
140 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
141 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
142 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
143 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
144 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
145 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
146 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
147 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
148 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
149 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
174 p = bch->mod8_tab + (l+1)*(((ecc[0] >> 24)^(tmp)) & 0xff); in bch_encode_unaligned()
176 for (i = 0; i < l; i++) in bch_encode_unaligned()
189 uint8_t pad[4] = {0, 0, 0, 0}; in load_ecc8()
192 for (i = 0; i < nwords; i++, src += 4) in load_ecc8()
193 dst[i] = ((u32)swap_bits(bch, src[0]) << 24) | in load_ecc8()
199 dst[nwords] = ((u32)swap_bits(bch, pad[0]) << 24) | in load_ecc8()
214 for (i = 0; i < nwords; i++) { in store_ecc8()
220 pad[0] = swap_bits(bch, src[nwords] >> 24); in store_ecc8()
236 * @ecc_bytes of @bch, and should be initialized to 0 before the first call.
262 memset(bch->ecc_buf, 0, r_bytes); in bch_encode()
284 * 31 ...24 23 ...16 15 ... 8 7 ... 0 in bch_encode()
300 w ^= r[0]; in bch_encode()
301 p0 = tab0 + (l+1)*((w >> 0) & 0xff); in bch_encode()
302 p1 = tab1 + (l+1)*((w >> 8) & 0xff); in bch_encode()
303 p2 = tab2 + (l+1)*((w >> 16) & 0xff); in bch_encode()
304 p3 = tab3 + (l+1)*((w >> 24) & 0xff); in bch_encode()
306 for (i = 0; i < l; i++) in bch_encode()
356 x = (x & 0x11111111U) * 0x11111111U; in parity()
366 bch->a_log_tab[b])] : 0; in gf_mul()
371 return a ? bch->a_pow_tab[mod_s(bch, 2*bch->a_log_tab[a])] : 0; in gf_sqr()
378 GF_N(bch)-bch->a_log_tab[b])] : 0; in gf_div()
418 memset(syn, 0, 2*t*sizeof(*syn)); in compute_syndromes()
426 for (j = 0; j < 2*t; j += 2) in compute_syndromes()
431 } while (s > 0); in compute_syndromes()
434 for (j = 0; j < t; j++) in compute_syndromes()
448 unsigned int i, j, tmp, l, pd = 1, d = syn[0]; in compute_error_locator_polynomial()
450 struct gf_poly *pelp = bch->poly_2t[0]; in compute_error_locator_polynomial()
454 memset(pelp, 0, GF_POLY_SZ(2*t)); in compute_error_locator_polynomial()
455 memset(elp, 0, GF_POLY_SZ(2*t)); in compute_error_locator_polynomial()
457 pelp->deg = 0; in compute_error_locator_polynomial()
458 pelp->c[0] = 1; in compute_error_locator_polynomial()
459 elp->deg = 0; in compute_error_locator_polynomial()
460 elp->c[0] = 1; in compute_error_locator_polynomial()
463 for (i = 0; (i < t) && (elp->deg <= t); i++) { in compute_error_locator_polynomial()
469 for (j = 0; j <= pelp->deg; j++) { in compute_error_locator_polynomial()
506 k = 0; in solve_linear_system()
510 for (c = 0; c < m; c++) { in solve_linear_system()
511 rem = 0; in solve_linear_system()
539 if (k > 0) { in solve_linear_system()
541 for (r = m-1; r >= 0; r--) { in solve_linear_system()
544 return 0; in solve_linear_system()
553 return 0; in solve_linear_system()
555 for (p = 0; p < nsol; p++) { in solve_linear_system()
557 for (c = 0; c < k; c++) in solve_linear_system()
561 tmp = 0; in solve_linear_system()
562 for (r = m-1; r >= 0; r--) { in solve_linear_system()
581 unsigned int mask = 0xff, t, rows[16] = {0,}; in find_affine4_roots()
585 rows[0] = c; in find_affine4_roots()
587 /* buid linear system to solve X^4+aX^2+bX+c = 0 */ in find_affine4_roots()
588 for (i = 0; i < m; i++) { in find_affine4_roots()
590 (a ? bch->a_pow_tab[mod_s(bch, k)] : 0)^ in find_affine4_roots()
591 (b ? bch->a_pow_tab[mod_s(bch, j)] : 0); in find_affine4_roots()
599 for (j = 8; j != 0; j >>= 1, mask ^= (mask << j)) { in find_affine4_roots()
600 for (k = 0; k < 16; k = (k+j+1) & ~j) { in find_affine4_roots()
615 int n = 0; in find_poly_deg1_roots()
617 if (poly->c[0]) in find_poly_deg1_roots()
618 /* poly[X] = bX+c with c!=0, root=c/b */ in find_poly_deg1_roots()
619 roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+ in find_poly_deg1_roots()
630 int n = 0, i, l0, l1, l2; in find_poly_deg2_roots()
633 if (poly->c[0] && poly->c[1]) { in find_poly_deg2_roots()
635 l0 = bch->a_log_tab[poly->c[0]]; in find_poly_deg2_roots()
642 * let u = sum(li.a^i) i=0..m-1; then compute r = sum(li.xi): in find_poly_deg2_roots()
645 * i.e. r and r+1 are roots iff Tr(u)=0 in find_poly_deg2_roots()
647 r = 0; in find_poly_deg2_roots()
672 int i, n = 0; in find_poly_deg3_roots()
675 if (poly->c[0]) { in find_poly_deg3_roots()
678 c2 = gf_div(bch, poly->c[0], e3); in find_poly_deg3_roots()
690 for (i = 0; i < 4; i++) { in find_poly_deg3_roots()
705 int i, l, n = 0; in find_poly_deg4_roots()
706 unsigned int a, b, c, d, e = 0, f, a2, b2, c2, e4; in find_poly_deg4_roots()
708 if (poly->c[0] == 0) in find_poly_deg4_roots()
709 return 0; in find_poly_deg4_roots()
713 d = gf_div(bch, poly->c[0], e4); in find_poly_deg4_roots()
720 /* first, eliminate cX by using z=X+e with ae^2+c=0 */ in find_poly_deg4_roots()
725 l += (l & 1) ? GF_N(bch) : 0; in find_poly_deg4_roots()
738 if (d == 0) in find_poly_deg4_roots()
740 return 0; in find_poly_deg4_roots()
753 for (i = 0; i < 4; i++) { in find_poly_deg4_roots()
771 /* represent 0 values with -1; warning, rep[d] is not set to 1 */ in gf_poly_logrep()
772 for (i = 0; i < d; i++) in gf_poly_logrep()
799 for (i = 0; i < d; i++, p++) { in gf_poly_mod()
801 if (m >= 0) in gf_poly_mod()
825 q->deg = 0; in gf_poly_div()
826 q->c[0] = 0; in gf_poly_div()
846 while (b->deg > 0) { in gf_poly_gcd()
871 z->c[0] = 0; in compute_trace_bk_mod()
874 out->deg = 0; in compute_trace_bk_mod()
875 memset(out, 0, GF_POLY_SZ(f->deg)); in compute_trace_bk_mod()
880 for (i = 0; i < m; i++) { in compute_trace_bk_mod()
882 for (j = z->deg; j >= 0; j--) { in compute_trace_bk_mod()
885 z->c[2*j+1] = 0; in compute_trace_bk_mod()
908 struct gf_poly *f2 = bch->poly_2t[0]; in factor_polynomial()
922 if (tk->deg > 0) { in factor_polynomial()
963 cnt = 0; in find_poly_roots()
985 unsigned int i, j, syn, syn0, count = 0; in chien_search()
990 bch->cache[p->deg] = 0; in chien_search()
991 syn0 = gf_div(bch, p->c[0], p->c[p->deg]); in chien_search()
997 if (m >= 0) in chien_search()
1000 if (syn == 0) { in chien_search()
1006 return (count == p->deg) ? count : 0; in chien_search()
1081 for (i = 0, sum = 0; i < (int)ecc_words; i++) { in bch_decode()
1087 return 0; in bch_decode()
1094 if (err > 0) { in bch_decode()
1099 if (err > 0) { in bch_decode()
1102 for (i = 0; i < err; i++) { in bch_decode()
1113 return (err >= 0) ? err : -EBADMSG; in bch_decode()
1129 for (i = 0; i < GF_N(bch); i++) { in build_gf_tables()
1133 /* polynomial is not primitive (a^i=1 with 0<i<2^m-1) */ in build_gf_tables()
1140 bch->a_log_tab[0] = 0; in build_gf_tables()
1142 return 0; in build_gf_tables()
1156 memset(bch->mod8_tab, 0, 4*256*l*sizeof(*bch->mod8_tab)); in build_mod8_tables()
1158 for (i = 0; i < 256; i++) { in build_mod8_tables()
1160 for (b = 0; b < 4; b++) { in build_mod8_tables()
1167 data ^= g[0] >> (31-d); in build_mod8_tables()
1168 for (j = 0; j < ecclen; j++) { in build_mod8_tables()
1169 hi = (d < 31) ? g[j] << (d+1) : 0; in build_mod8_tables()
1171 g[j+1] >> (31-d) : 0; in build_mod8_tables()
1186 unsigned int sum, x, y, remaining, ak = 0, xi[BCH_MAX_M]; in build_deg2_base()
1188 /* find k s.t. Tr(a^k) = 1 and 0 <= k < m */ in build_deg2_base()
1189 for (i = 0; i < m; i++) { in build_deg2_base()
1190 for (j = 0, sum = 0; j < m; j++) in build_deg2_base()
1198 /* find xi, i=0..m-1 such that xi^2+xi = a^i+Tr(a^i).a^k */ in build_deg2_base()
1200 memset(xi, 0, sizeof(xi)); in build_deg2_base()
1202 for (x = 0; (x <= GF_N(bch)) && remaining; x++) { in build_deg2_base()
1204 for (i = 0; i < 2; i++) { in build_deg2_base()
1217 return remaining ? -1 : 0; in build_deg2_base()
1237 int n, err = 0; in compute_generator_polynomial()
1253 memset(roots , 0, (bch->n+1)*sizeof(*roots)); in compute_generator_polynomial()
1254 for (i = 0; i < t; i++) { in compute_generator_polynomial()
1255 for (j = 0, r = 2*i+1; j < m; j++) { in compute_generator_polynomial()
1261 g->deg = 0; in compute_generator_polynomial()
1262 g->c[0] = 1; in compute_generator_polynomial()
1263 for (i = 0; i < GF_N(bch); i++) { in compute_generator_polynomial()
1268 for (j = g->deg; j > 0; j--) in compute_generator_polynomial()
1271 g->c[0] = gf_mul(bch, g->c[0], r); in compute_generator_polynomial()
1277 i = 0; in compute_generator_polynomial()
1279 while (n > 0) { in compute_generator_polynomial()
1281 for (j = 0, word = 0; j < nbits; j++) { in compute_generator_polynomial()
1301 * @prim_poly: user-provided primitive polynomial (or 0 to use default)
1322 int err = 0; in bch_init()
1331 0x25, 0x43, 0x83, 0x11d, 0x211, 0x409, 0x805, 0x1053, 0x201b, in bch_init()
1332 0x402b, 0x8003, in bch_init()
1364 if (prim_poly == 0) in bch_init()
1387 for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++) in bch_init()
1436 for (i = 0; i < ARRAY_SIZE(bch->poly_2t); i++) in bch_free()