1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * High speed xor_block operation for RAID4/5 utilizing the
6 * UltraSparc Visual Instruction Set and Niagara block-init
7 * twin-load instructions.
9 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
10 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
13 #include <asm/spitfire.h>
15 void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
16 void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
18 void xor_vis_4(unsigned long, unsigned long *, unsigned long *,
19 unsigned long *, unsigned long *);
20 void xor_vis_5(unsigned long, unsigned long *, unsigned long *,
21 unsigned long *, unsigned long *, unsigned long *);
23 /* XXX Ugh, write cheetah versions... -DaveM */
25 static struct xor_block_template xor_block_VIS
= {
33 void xor_niagara_2(unsigned long, unsigned long *, unsigned long *);
34 void xor_niagara_3(unsigned long, unsigned long *, unsigned long *,
36 void xor_niagara_4(unsigned long, unsigned long *, unsigned long *,
37 unsigned long *, unsigned long *);
38 void xor_niagara_5(unsigned long, unsigned long *, unsigned long *,
39 unsigned long *, unsigned long *, unsigned long *);
41 static struct xor_block_template xor_block_niagara
= {
43 .do_2
= xor_niagara_2
,
44 .do_3
= xor_niagara_3
,
45 .do_4
= xor_niagara_4
,
46 .do_5
= xor_niagara_5
,
49 #undef XOR_TRY_TEMPLATES
50 #define XOR_TRY_TEMPLATES \
52 xor_speed(&xor_block_VIS); \
53 xor_speed(&xor_block_niagara); \
56 /* For VIS for everything except Niagara. */
57 #define XOR_SELECT_TEMPLATE(FASTEST) \
58 ((tlb_type == hypervisor && \
59 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
60 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \
61 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || \
62 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || \
63 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)) ? \
64 &xor_block_niagara : \