1ef1313deSAnton Blanchard /* 2ef1313deSAnton Blanchard * This program is free software; you can redistribute it and/or modify 3ef1313deSAnton Blanchard * it under the terms of the GNU General Public License as published by 4ef1313deSAnton Blanchard * the Free Software Foundation; either version 2 of the License, or 5ef1313deSAnton Blanchard * (at your option) any later version. 6ef1313deSAnton Blanchard * 7ef1313deSAnton Blanchard * This program is distributed in the hope that it will be useful, 8ef1313deSAnton Blanchard * but WITHOUT ANY WARRANTY; without even the implied warranty of 9ef1313deSAnton Blanchard * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10ef1313deSAnton Blanchard * GNU General Public License for more details. 11ef1313deSAnton Blanchard * 12ef1313deSAnton Blanchard * You should have received a copy of the GNU General Public License 13ef1313deSAnton Blanchard * along with this program; if not, write to the Free Software 14ef1313deSAnton Blanchard * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15ef1313deSAnton Blanchard * 16ef1313deSAnton Blanchard * Copyright (C) IBM Corporation, 2012 17ef1313deSAnton Blanchard * 18ef1313deSAnton Blanchard * Author: Anton Blanchard <anton@au.ibm.com> 19ef1313deSAnton Blanchard */ 20ef1313deSAnton Blanchard #ifndef _ASM_POWERPC_XOR_H 21ef1313deSAnton Blanchard #define _ASM_POWERPC_XOR_H 22ef1313deSAnton Blanchard 23ef1313deSAnton Blanchard #ifdef CONFIG_ALTIVEC 24ef1313deSAnton Blanchard 25ef1313deSAnton Blanchard #include <asm/cputable.h> 26b92a226eSKevin Hao #include <asm/cpu_has_feature.h> 27ef1313deSAnton Blanchard 28ef1313deSAnton Blanchard void xor_altivec_2(unsigned long bytes, unsigned long *v1_in, 29ef1313deSAnton Blanchard unsigned long *v2_in); 30ef1313deSAnton Blanchard void xor_altivec_3(unsigned long bytes, unsigned long *v1_in, 31ef1313deSAnton Blanchard unsigned long *v2_in, unsigned long *v3_in); 32ef1313deSAnton Blanchard void xor_altivec_4(unsigned long bytes, unsigned long *v1_in, 33ef1313deSAnton Blanchard unsigned long *v2_in, unsigned long *v3_in, 34ef1313deSAnton Blanchard unsigned long *v4_in); 35ef1313deSAnton Blanchard void xor_altivec_5(unsigned long bytes, unsigned long *v1_in, 36ef1313deSAnton Blanchard unsigned long *v2_in, unsigned long *v3_in, 37ef1313deSAnton Blanchard unsigned long *v4_in, unsigned long *v5_in); 38ef1313deSAnton Blanchard 39ef1313deSAnton Blanchard static struct xor_block_template xor_block_altivec = { 40ef1313deSAnton Blanchard .name = "altivec", 41ef1313deSAnton Blanchard .do_2 = xor_altivec_2, 42ef1313deSAnton Blanchard .do_3 = xor_altivec_3, 43ef1313deSAnton Blanchard .do_4 = xor_altivec_4, 44ef1313deSAnton Blanchard .do_5 = xor_altivec_5, 45ef1313deSAnton Blanchard }; 46ef1313deSAnton Blanchard 47ef1313deSAnton Blanchard #define XOR_SPEED_ALTIVEC() \ 48ef1313deSAnton Blanchard do { \ 49ef1313deSAnton Blanchard if (cpu_has_feature(CPU_FTR_ALTIVEC)) \ 50ef1313deSAnton Blanchard xor_speed(&xor_block_altivec); \ 51ef1313deSAnton Blanchard } while (0) 52ef1313deSAnton Blanchard #else 53ef1313deSAnton Blanchard #define XOR_SPEED_ALTIVEC() 54ef1313deSAnton Blanchard #endif 55ef1313deSAnton Blanchard 56ef1313deSAnton Blanchard /* Also try the generic routines. */ 57b8b572e1SStephen Rothwell #include <asm-generic/xor.h> 58ef1313deSAnton Blanchard 59ef1313deSAnton Blanchard #undef XOR_TRY_TEMPLATES 60ef1313deSAnton Blanchard #define XOR_TRY_TEMPLATES \ 61ef1313deSAnton Blanchard do { \ 62ef1313deSAnton Blanchard xor_speed(&xor_block_8regs); \ 63ef1313deSAnton Blanchard xor_speed(&xor_block_8regs_p); \ 64ef1313deSAnton Blanchard xor_speed(&xor_block_32regs); \ 65ef1313deSAnton Blanchard xor_speed(&xor_block_32regs_p); \ 66ef1313deSAnton Blanchard XOR_SPEED_ALTIVEC(); \ 67ef1313deSAnton Blanchard } while (0) 68ef1313deSAnton Blanchard 69ef1313deSAnton Blanchard #endif /* _ASM_POWERPC_XOR_H */ 70