This source file includes following definitions.
- octeon_crypto_enable
- octeon_crypto_disable
1
2
3
4
5
6
7
8
9 #include <asm/cop2.h>
10 #include <linux/export.h>
11 #include <linux/interrupt.h>
12 #include <linux/sched/task_stack.h>
13
14 #include "octeon-crypto.h"
15
16
17
18
19
20
21
22
23
24
25
26
27 unsigned long octeon_crypto_enable(struct octeon_cop2_state *state)
28 {
29 int status;
30 unsigned long flags;
31
32 preempt_disable();
33 local_irq_save(flags);
34 status = read_c0_status();
35 write_c0_status(status | ST0_CU2);
36 if (KSTK_STATUS(current) & ST0_CU2) {
37 octeon_cop2_save(&(current->thread.cp2));
38 KSTK_STATUS(current) &= ~ST0_CU2;
39 status &= ~ST0_CU2;
40 } else if (status & ST0_CU2) {
41 octeon_cop2_save(state);
42 }
43 local_irq_restore(flags);
44 return status & ST0_CU2;
45 }
46 EXPORT_SYMBOL_GPL(octeon_crypto_enable);
47
48
49
50
51
52
53
54
55
56 void octeon_crypto_disable(struct octeon_cop2_state *state,
57 unsigned long crypto_flags)
58 {
59 unsigned long flags;
60
61 local_irq_save(flags);
62 if (crypto_flags & ST0_CU2)
63 octeon_cop2_restore(state);
64 else
65 write_c0_status(read_c0_status() & ~ST0_CU2);
66 local_irq_restore(flags);
67 preempt_enable();
68 }
69 EXPORT_SYMBOL_GPL(octeon_crypto_disable);