18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) IBM Corporation, 2012 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Author: Anton Blanchard <anton@au.ibm.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_XOR_H 98c2ecf20Sopenharmony_ci#define _ASM_POWERPC_XOR_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifdef CONFIG_ALTIVEC 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <asm/cputable.h> 148c2ecf20Sopenharmony_ci#include <asm/cpu_has_feature.h> 158c2ecf20Sopenharmony_ci#include <asm/xor_altivec.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistatic struct xor_block_template xor_block_altivec = { 188c2ecf20Sopenharmony_ci .name = "altivec", 198c2ecf20Sopenharmony_ci .do_2 = xor_altivec_2, 208c2ecf20Sopenharmony_ci .do_3 = xor_altivec_3, 218c2ecf20Sopenharmony_ci .do_4 = xor_altivec_4, 228c2ecf20Sopenharmony_ci .do_5 = xor_altivec_5, 238c2ecf20Sopenharmony_ci}; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define XOR_SPEED_ALTIVEC() \ 268c2ecf20Sopenharmony_ci do { \ 278c2ecf20Sopenharmony_ci if (cpu_has_feature(CPU_FTR_ALTIVEC)) \ 288c2ecf20Sopenharmony_ci xor_speed(&xor_block_altivec); \ 298c2ecf20Sopenharmony_ci } while (0) 308c2ecf20Sopenharmony_ci#else 318c2ecf20Sopenharmony_ci#define XOR_SPEED_ALTIVEC() 328c2ecf20Sopenharmony_ci#endif 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* Also try the generic routines. */ 358c2ecf20Sopenharmony_ci#include <asm-generic/xor.h> 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#undef XOR_TRY_TEMPLATES 388c2ecf20Sopenharmony_ci#define XOR_TRY_TEMPLATES \ 398c2ecf20Sopenharmony_cido { \ 408c2ecf20Sopenharmony_ci xor_speed(&xor_block_8regs); \ 418c2ecf20Sopenharmony_ci xor_speed(&xor_block_8regs_p); \ 428c2ecf20Sopenharmony_ci xor_speed(&xor_block_32regs); \ 438c2ecf20Sopenharmony_ci xor_speed(&xor_block_32regs_p); \ 448c2ecf20Sopenharmony_ci XOR_SPEED_ALTIVEC(); \ 458c2ecf20Sopenharmony_ci} while (0) 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_XOR_H */ 48