openocd: src/target: replace the GPL-2.0-or-later license tag
[fw/openocd] / src / target / lakemont.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /*
4  * Copyright(c) 2013-2016 Intel Corporation.
5  *
6  * Adrian Burns (adrian.burns@intel.com)
7  * Thomas Faust (thomas.faust@intel.com)
8  * Ivan De Cesaris (ivan.de.cesaris@intel.com)
9  * Julien Carreno (julien.carreno@intel.com)
10  * Jeffrey Maxwell (jeffrey.r.maxwell@intel.com)
11  *
12  * Contact Information:
13  * Intel Corporation
14  */
15
16 /*
17  * @file
18  * This is the interface to the probemode operations for Lakemont 1 (LMT1).
19  */
20
21 #ifndef OPENOCD_TARGET_LAKEMONT_H
22 #define OPENOCD_TARGET_LAKEMONT_H
23
24 #include <jtag/jtag.h>
25 #include <helper/types.h>
26
27 /* The Intel Quark SoC X1000 Core is codenamed lakemont */
28
29 #define LMT_IRLEN               8
30
31 /* lakemont tap instruction opcodes */
32 #define IDCODE                  2
33 #define SUBMITPIR               3
34 #define PROBEMODE               4
35 #define WRPIR                   6
36 #define RDWRPDR                 8
37 #define TAPSTATUS               11
38 #define BYPASS                  255
39 #define NOT_NULL                2
40
41 /* DR sizes */
42 #define ID_SIZE                 32
43 #define PM_SIZE                 1
44 #define PIR_SIZE                64
45 #define PDR_SIZE                32
46 #define TS_SIZE                 32
47 #define BP_SIZE                 1
48 #define MAX_SCAN_SIZE   PIR_SIZE
49
50 /* needed during lakemont probemode */
51 #define NOT_PMREG               0xfe
52 #define NOT_AVAIL_REG           0xff
53 #define PM_DSB                  ((uint32_t)0x00000000)
54 #define PM_DSL                  ((uint32_t)0xFFFFFFFF)
55 #define PM_DSAR                 ((uint32_t)0x004F9300)
56 #define PM_DR7                  ((uint32_t)0x00000400)
57 #define DELAY_SUBMITPIR         0 /* for now 0 is working */
58
59 /* lakemont tapstatus bits */
60 #define TS_PRDY_BIT             ((uint32_t)0x00000001)
61 #define TS_EN_PM_BIT            ((uint32_t)0x00000002)
62 #define TS_PM_BIT               ((uint32_t)0x00000004)
63 #define TS_PMCR_BIT             ((uint32_t)0x00000008)
64 #define TS_SBP_BIT              ((uint32_t)0x00000010)
65
66 struct lakemont_core_reg {
67         uint32_t num;
68         struct target *target;
69         struct x86_32_common *x86_32_common;
70         uint64_t op;
71         uint8_t pm_idx;
72 };
73
74 struct scan_blk {
75         uint8_t out[MAX_SCAN_SIZE]; /* scanned out to the tap */
76         uint8_t in[MAX_SCAN_SIZE]; /* in to our capture buf */
77         struct scan_field field;
78 };
79
80 #define I(name) (((struct lakemont_core_reg *)x86_32->cache->reg_list[name].arch_info)->pm_idx)
81
82 int lakemont_init_target(struct command_context *cmd_ctx, struct target *t);
83 int lakemont_init_arch_info(struct target *t, struct x86_32_common *x86_32);
84 int lakemont_poll(struct target *t);
85 int lakemont_arch_state(struct target *t);
86 int lakemont_halt(struct target *t);
87 int lakemont_resume(struct target *t, int current, target_addr_t address,
88                         int handle_breakpoints, int debug_execution);
89 int lakemont_step(struct target *t, int current,
90                         target_addr_t address, int handle_breakpoints);
91 int lakemont_reset_assert(struct target *t);
92 int lakemont_reset_deassert(struct target *t);
93 int lakemont_update_after_probemode_entry(struct target *t);
94
95 #endif /* OPENOCD_TARGET_LAKEMONT_H */