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 * Copyright (C) 2012-2013 Cavium Inc., All Rights Reserved.
8 * MD5 instruction definitions added by Aaro Koskinen <aaro.koskinen@iki.fi>.
11 #ifndef __LINUX_OCTEON_CRYPTO_H
12 #define __LINUX_OCTEON_CRYPTO_H
14 #include <linux/sched.h>
15 #include <asm/mipsregs.h>
17 #define OCTEON_CR_OPCODE_PRIORITY 300
19 extern unsigned long octeon_crypto_enable(struct octeon_cop2_state *state);
20 extern void octeon_crypto_disable(struct octeon_cop2_state *state,
24 * Macros needed to implement MD5:
28 * The index can be 0-1.
30 #define write_octeon_64bit_hash_dword(value, index) \
32 __asm__ __volatile__ ( \
33 "dmtc2 %[rt],0x0048+" STR(index) \
35 : [rt] "d" (value)); \
39 * The index can be 0-1.
41 #define read_octeon_64bit_hash_dword(index) \
45 __asm__ __volatile__ ( \
46 "dmfc2 %[rt],0x0048+" STR(index) \
47 : [rt] "=d" (__value) \
54 * The index can be 0-6.
56 #define write_octeon_64bit_block_dword(value, index) \
58 __asm__ __volatile__ ( \
59 "dmtc2 %[rt],0x0040+" STR(index) \
61 : [rt] "d" (value)); \
65 * The value is the final block dword (64-bit).
67 #define octeon_md5_start(value) \
69 __asm__ __volatile__ ( \
70 "dmtc2 %[rt],0x4047" \
72 : [rt] "d" (value)); \
75 #endif /* __LINUX_OCTEON_CRYPTO_H */