1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef __REG_PATCH_ARMV7M_H__
5 #define __REG_PATCH_ARMV7M_H__
6 
7 #ifdef __ARM_ARCH_7EM__
8 
9 #include "plat_types.h"
10 #include "cmsis.h"
11 
12 struct PATCH_ARMV7M_T {
13     __IO uint32_t FP_CTRL;
14     __IO uint32_t FP_REMAP;
15     __IO uint32_t FP_COMP[512];
16 };
17 
18 #define NUM_CODE_6_4_SHIFT                      12
19 #define NUM_CODE_6_4_MASK                       (0x7 << NUM_CODE_6_4_SHIFT)
20 #define NUM_CODE_6_4(n)                         BITFIELD_VAL(NUM_CODE_6_4, n)
21 #define NUM_LIT_SHIFT                           8
22 #define NUM_LIT_MASK                            (0xF << NUM_LIT_SHIFT)
23 #define NUM_LIT(n)                              BITFIELD_VAL(NUM_LIT, n)
24 #define NUM_CODE_3_0_SHIFT                      4
25 #define NUM_CODE_3_0_MASK                       (0xF << NUM_CODE_3_0_SHIFT)
26 #define NUM_CODE_3_0(n)                         BITFIELD_VAL(NUM_CODE_3_0, n)
27 #define FP_CTRL_KEY                             (1 << 1)
28 #define FP_CTRL_ENABLE                          (1 << 0)
29 
30 #define REMAP_RMPSPT                            (1 << 29)
31 #define REMAP_ADDR_28_5_SHIFT                   5
32 #define REMAP_ADDR_28_5_MASK                    (0xFFFFFF << REMAP_ADDR_28_5_SHIFT)
33 #define REMAP_ADDR_28_5(n)                      BITFIELD_VAL(REMAP_ADDR_28_5, n)
34 #define REMAP_ADDR_SHIFT                        0
35 #define REMAP_ADDR_MASK                         (0x1FFFFFFF << REMAP_ADDR_SHIFT)
36 #define REMAP_ADDR(n)                           BITFIELD_VAL(REMAP_ADDR, n)
37 
38 #define COMP_REPLACE_SHIFT                      30
39 #define COMP_REPLACE_MASK                       (0x3 << COMP_REPLACE_SHIFT)
40 #define COMP_REPLACE(n)                         BITFIELD_VAL(COMP_REPLACE, n)
41 #define COMP_ADDR_28_2_SHIFT                    2
42 #define COMP_ADDR_28_2_MASK                     (0x7FFFFFF << COMP_ADDR_28_2_SHIFT)
43 #define COMP_ADDR_28_2(n)                       BITFIELD_VAL(COMP_ADDR_28_2, n)
44 #define COMP_ADDR_SHIFT                         0
45 #define COMP_ADDR_MASK                          (0x1FFFFFFF << COMP_ADDR_SHIFT)
46 #define COMP_ADDR(n)                            BITFIELD_VAL(COMP_ADDR, n)
47 #define COMP_ENABLE                             (1 << 0)
48 
49 #endif
50 
51 #endif
52