OpenOCD
xlnx-xvc.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-only
2 
3 /*
4  * Copyright (C) 2019 Google, LLC.
5  * Moritz Fischer <moritzf@google.com>
6  *
7  * Copyright (C) 2021 Western Digital Corporation or its affiliates
8  * Jeremy Garff <jeremy.garff@wdc.com>
9  *
10  * Copyright (C) 2024 Inria
11  * Nicolas Derumigny <nicolas.derumigny@inria.fr>
12  */
13 
14 #ifdef HAVE_CONFIG_H
15 #include "config.h"
16 #endif
17 
18 #include <stdint.h>
19 #include <stdlib.h>
20 #include <unistd.h>
21 #include <linux/pci.h>
22 #include <sys/mman.h>
23 
24 #include <jtag/interface.h>
25 #include <jtag/commands.h>
26 #include <jtag/interface.h>
27 #include <jtag/swd.h>
28 #include <helper/replacements.h>
29 #include <helper/bits.h>
30 
31 /* Available only from kernel v4.10 */
32 #ifndef PCI_CFG_SPACE_EXP_SIZE
33 #define PCI_CFG_SPACE_EXP_SIZE 4096
34 #endif
35 
36 #define PCIE_EXT_CAP_LST 0x100
37 
38 #define XLNX_PCIE_XVC_EXT_CAP 0x00
39 #define XLNX_PCIE_XVC_VSEC_HDR 0x04
40 #define XLNX_PCIE_XVC_LEN_REG 0x0C
41 #define XLNX_PCIE_XVC_TMS_REG 0x10
42 #define XLNX_PCIE_XVC_TDX_REG 0x14
43 
44 #define XLNX_PCIE_XVC_CAP_SIZE 0x20
45 #define XLNX_PCIE_XVC_VSEC_ID 0x8
46 
47 #define XLNX_AXI_XVC_LEN_REG 0x00
48 #define XLNX_AXI_XVC_TMS_REG 0x04
49 #define XLNX_AXI_XVC_TDI_REG 0x08
50 #define XLNX_AXI_XVC_TDO_REG 0x0c
51 #define XLNX_AXI_XVC_CTRL_REG 0x10
52 #define XLNX_AXI_XVC_MAX_REG 0x18
53 
54 #define XLNX_AXI_XVC_CTRL_REG_ENABLE_MASK 0x01
55 
56 #define XLNX_XVC_MAX_BITS 0x20
57 
58 #define MASK_ACK(x) (((x) >> 9) & 0x7)
59 #define MASK_PAR(x) ((int)((x) & 0x1))
60 
61 struct xlnx_pcie_xvc {
62  int fd;
63  unsigned int offset;
64  char *device;
65 };
66 
67 struct xlnx_axi_xvc {
68  int fd;
69  uint32_t *base;
70  char *device_addr;
71  // Defaults to `/dev/mem` if NULL
72  char *device_file;
73 };
74 
77  AXI
78 };
79 
82 static struct xlnx_axi_xvc xlnx_axi_xvc_state;
84 
85 static int xlnx_pcie_xvc_read_reg(const int offset, uint32_t *val)
86 {
87  uint32_t res;
88  int err;
89 
90  /* Note: This should be ok endianness-wise because by going
91  * through sysfs the kernel does the conversion in the config
92  * space accessor functions
93  */
94  err = pread(xlnx_pcie_xvc->fd, &res, sizeof(res),
96  if (err != sizeof(res)) {
97  LOG_ERROR("Failed to read offset 0x%x", offset);
99  }
100 
101  if (val)
102  *val = res;
103 
104  return ERROR_OK;
105 }
106 
107 static int xlnx_axi_xvc_read_reg(const int offset, uint32_t *val)
108 {
109  uintptr_t b = ((uintptr_t)xlnx_axi_xvc->base) + offset;
110  volatile uint32_t *w = (uint32_t *)b;
111 
112  if (val) {
113  __atomic_thread_fence(__ATOMIC_SEQ_CST);
114  *val = *w;
115  }
116 
117  return ERROR_OK;
118 }
119 
120 static int xlnx_pcie_xvc_write_reg(const int offset, const uint32_t val)
121 {
122  int err;
123 
124  /* Note: This should be ok endianness-wise because by going
125  * through sysfs the kernel does the conversion in the config
126  * space accessor functions
127  */
128  err = pwrite(xlnx_pcie_xvc->fd, &val, sizeof(val),
130  if (err != sizeof(val)) {
131  LOG_ERROR("Failed to write offset: 0x%x with value: %" PRIx32,
132  offset, val);
134  }
135 
136  return ERROR_OK;
137 }
138 
139 static int xlnx_axi_xvc_write_reg(const int offset, const uint32_t val)
140 {
141  uintptr_t b = ((uintptr_t)xlnx_axi_xvc->base) + offset;
142  volatile uint32_t *w = (uint32_t *)b;
143 
144  *w = val;
145  __atomic_thread_fence(__ATOMIC_SEQ_CST);
146 
147  return ERROR_OK;
148 }
149 
150 static int xlnx_pcie_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi,
151  uint32_t *tdo)
152 {
153  int err;
154 
156  if (err != ERROR_OK)
157  return err;
158 
160  if (err != ERROR_OK)
161  return err;
162 
164  if (err != ERROR_OK)
165  return err;
166 
168  if (err != ERROR_OK)
169  return err;
170 
171  if (tdo)
172  LOG_DEBUG_IO("Transact num_bits: %zu, tms: %" PRIx32 ", tdi: %" PRIx32 ", tdo: %" PRIx32,
173  num_bits, tms, tdi, *tdo);
174  else
175  LOG_DEBUG_IO("Transact num_bits: %zu, tms: %" PRIx32 ", tdi: %" PRIx32 ", tdo: <null>",
176  num_bits, tms, tdi);
177  return ERROR_OK;
178 }
179 
180 static int xlnx_axi_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi,
181  uint32_t *tdo)
182 {
183  uint32_t ctrl;
184  int done = 0;
185  int err;
186 
188  if (err != ERROR_OK)
189  return err;
190 
192  if (err != ERROR_OK)
193  return err;
194 
196  if (err != ERROR_OK)
197  return err;
198 
200  if (err != ERROR_OK)
201  return err;
202 
203  while (!done) {
205  if (err != ERROR_OK)
206  return err;
207 
209  done = 1;
210 
211  /*
212  There is no delay here intentionally. The usleep()
213  function doesn't block and burns CPU cycles anyway.
214  The turnaround time is fast enough at high JTAG rates
215  that adding the call can slow down the overall
216  throughput. So we'll just sacrifice the CPU to get
217  best performance.
218 
219  Additionally there is no timeout. The underlying
220  hardware is guaranteed to unset the enable bit within
221  32 JTAG clock cycles. There is no hardware condition
222  that will keep it set forever. Essentially, the hardware
223  is also our timeout mechanism.
224  */
225  }
226 
228  if (err != ERROR_OK)
229  return err;
230 
231  if (tdo)
232  LOG_DEBUG_IO("Transact num_bits: %zu, tms: 0x%x, tdi: 0x%x, tdo: 0x%x",
233  num_bits, tms, tdi, *tdo);
234  else
235  LOG_DEBUG_IO("Transact num_bits: %zu, tms: 0x%x, tdi: 0x%x, tdo: <null>",
236  num_bits, tms, tdi);
237  return ERROR_OK;
238 }
239 
240 static int xlnx_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi,
241  uint32_t *tdo, enum xlnx_xvc_type_t xvc_type)
242 {
243  if (xvc_type == PCIE)
244  return xlnx_pcie_xvc_transact(num_bits, tms, tdi, tdo);
245  assert(xvc_type == AXI);
246  return xlnx_axi_xvc_transact(num_bits, tms, tdi, tdo);
247 }
248 
250 {
251  int tms = tap_get_state() == TAP_RESET ? 1 : 0;
252  size_t left = cmd->cmd.stableclocks->num_cycles;
253  size_t write;
254  int err;
255 
256  LOG_DEBUG("stableclocks %u cycles", cmd->cmd.runtest->num_cycles);
257 
258  while (left) {
259  write = MIN(XLNX_XVC_MAX_BITS, left);
260  err = xlnx_xvc_transact(write, tms, 0, NULL, xvc_type);
261  if (err != ERROR_OK)
262  return err;
263  left -= write;
264  };
265 
266  return ERROR_OK;
267 }
268 
269 static int xlnx_xvc_execute_statemove(size_t skip, enum xlnx_xvc_type_t xvc_type)
270 {
271  uint8_t tms_scan = tap_get_tms_path(tap_get_state(),
273  int tms_count = tap_get_tms_path_len(tap_get_state(),
275  int err;
276 
277  LOG_DEBUG("statemove starting at (skip: %zu) %s end in %s", skip,
280 
281 
282  err = xlnx_xvc_transact(tms_count - skip, tms_scan >> skip, 0, NULL, xvc_type);
283  if (err != ERROR_OK)
284  return err;
285 
287 
288  return ERROR_OK;
289 }
290 
292  enum xlnx_xvc_type_t xvc_type)
293 {
294  int err = ERROR_OK;
295 
296  LOG_DEBUG("runtest %u cycles, end in %i",
297  cmd->cmd.runtest->num_cycles,
298  cmd->cmd.runtest->end_state);
299 
300  enum tap_state tmp_state = tap_get_end_state();
301 
302  if (tap_get_state() != TAP_IDLE) {
304  err = xlnx_xvc_execute_statemove(0, xvc_type);
305  if (err != ERROR_OK)
306  return err;
307  };
308 
309  size_t left = cmd->cmd.runtest->num_cycles;
310  size_t write;
311 
312  while (left) {
313  write = MIN(XLNX_XVC_MAX_BITS, left);
314  err = xlnx_xvc_transact(write, 0, 0, NULL, xvc_type);
315  if (err != ERROR_OK)
316  return err;
317  left -= write;
318  };
319 
320  tap_set_end_state(tmp_state);
321  if (tap_get_state() != tap_get_end_state())
322  err = xlnx_xvc_execute_statemove(0, xvc_type);
323 
324  return err;
325 }
326 
328  enum xlnx_xvc_type_t xvc_type)
329 {
330  unsigned int num_states = cmd->cmd.pathmove->num_states;
331  enum tap_state *path = cmd->cmd.pathmove->path;
332  int err = ERROR_OK;
333 
334  LOG_DEBUG("pathmove: %u states, end in %i",
335  cmd->cmd.pathmove->num_states,
336  cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
337 
338  for (unsigned int i = 0; i < num_states; i++) {
339  if (path[i] == tap_state_transition(tap_get_state(), false)) {
340  err = xlnx_xvc_transact(1, 0, 0, NULL, xvc_type);
341  } else if (path[i] == tap_state_transition(tap_get_state(), true)) {
342  err = xlnx_xvc_transact(1, 1, 0, NULL, xvc_type);
343  } else {
344  LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition.",
346  tap_state_name(path[i]));
348  }
349  if (err != ERROR_OK)
350  return err;
351  tap_set_state(path[i]);
352  }
353 
355 
356  return ERROR_OK;
357 }
358 
360  enum xlnx_xvc_type_t xvc_type)
361 {
362  enum scan_type type = jtag_scan_type(cmd->cmd.scan);
363  enum tap_state saved_end_state = cmd->cmd.scan->end_state;
364  bool ir_scan = cmd->cmd.scan->ir_scan;
365  uint32_t tdi, tms, tdo;
366  uint8_t *buf, *rd_ptr;
367  int err, scan_size;
368  size_t write;
369  size_t left;
370 
371  scan_size = jtag_build_buffer(cmd->cmd.scan, &buf);
372  rd_ptr = buf;
373  LOG_DEBUG("%s scan type %d %d bits; starts in %s end in %s",
374  (cmd->cmd.scan->ir_scan) ? "IR" : "DR", type, scan_size,
376  tap_state_name(cmd->cmd.scan->end_state));
377 
378  /* If we're in TAP_DR_SHIFT state but need to do a IR_SCAN or
379  * vice-versa, do a statemove to corresponding other state, then restore
380  * end state
381  */
382  if (ir_scan && tap_get_state() != TAP_IRSHIFT) {
384  err = xlnx_xvc_execute_statemove(0, xvc_type);
385  if (err != ERROR_OK)
386  goto out_err;
387  tap_set_end_state(saved_end_state);
388  } else if (!ir_scan && (tap_get_state() != TAP_DRSHIFT)) {
390  err = xlnx_xvc_execute_statemove(0, xvc_type);
391  if (err != ERROR_OK)
392  goto out_err;
393  tap_set_end_state(saved_end_state);
394  }
395 
396  left = scan_size;
397  while (left) {
398  write = MIN(XLNX_XVC_MAX_BITS, left);
399  /* the last TMS should be a 1, to leave the state */
400  tms = left <= XLNX_XVC_MAX_BITS ? BIT(write - 1) : 0;
401  tdi = (type != SCAN_IN) ? buf_get_u32(rd_ptr, 0, write) : 0;
402  err = xlnx_xvc_transact(write, tms, tdi, type != SCAN_OUT ?
403  &tdo : NULL, xvc_type);
404  if (err != ERROR_OK)
405  goto out_err;
406  left -= write;
407  if (type != SCAN_OUT)
408  buf_set_u32(rd_ptr, 0, write, tdo);
409  rd_ptr += sizeof(uint32_t);
410  };
411 
412  err = jtag_read_buffer(buf, cmd->cmd.scan);
413  free(buf);
414 
415  if (tap_get_state() != tap_get_end_state())
416  err = xlnx_xvc_execute_statemove(1, xvc_type);
417 
418  return err;
419 
420 out_err:
421  free(buf);
422  return err;
423 }
424 
426 {
427  LOG_DEBUG("sleep %" PRIu32 "", cmd->cmd.sleep->us);
428  usleep(cmd->cmd.sleep->us);
429 }
430 
432  enum xlnx_xvc_type_t xvc_type)
433 {
434  const size_t num_bits = cmd->cmd.tms->num_bits;
435  const uint8_t *bits = cmd->cmd.tms->bits;
436  size_t left, write;
437  uint32_t tms;
438  int err;
439 
440  LOG_DEBUG("execute tms %zu", num_bits);
441 
442  left = num_bits;
443  while (left) {
444  write = MIN(XLNX_XVC_MAX_BITS, left);
445  tms = buf_get_u32(bits, 0, write);
446  err = xlnx_xvc_transact(write, tms, 0, NULL, xvc_type);
447  if (err != ERROR_OK)
448  return err;
449  left -= write;
450  bits += 4;
451  };
452 
453  return ERROR_OK;
454 }
455 
457  enum xlnx_xvc_type_t xvc_type)
458 {
459  LOG_DEBUG("%s: cmd->type: %u", __func__, cmd->type);
460  switch (cmd->type) {
461  case JTAG_STABLECLOCKS:
462  return xlnx_xvc_execute_stableclocks(cmd, xvc_type);
463  case JTAG_RUNTEST:
464  return xlnx_xvc_execute_runtest(cmd, xvc_type);
465  case JTAG_TLR_RESET:
466  tap_set_end_state(cmd->cmd.statemove->end_state);
467  return xlnx_xvc_execute_statemove(0, xvc_type);
468  case JTAG_PATHMOVE:
469  return xlnx_xvc_execute_pathmove(cmd, xvc_type);
470  case JTAG_SCAN:
471  return xlnx_xvc_execute_scan(cmd, xvc_type);
472  case JTAG_RESET:
473  LOG_INFO("WARN: XVC driver has no reset.");
474  break;
475  case JTAG_SLEEP:
477  break;
478  case JTAG_TMS:
479  return xlnx_xvc_execute_tms(cmd, xvc_type);
480  default:
481  LOG_ERROR("BUG: Unknown JTAG command type encountered.");
483  }
484 
485  return ERROR_OK;
486 }
487 
488 static int xlnx_xvc_execute_queue(struct jtag_command *cmd_queue,
489  enum xlnx_xvc_type_t xvc_type)
490 {
491  struct jtag_command *cmd = cmd_queue;
492  int ret;
493 
494  while (cmd) {
495  ret = xlnx_xvc_execute_command(cmd, xvc_type);
496 
497  if (ret != ERROR_OK)
498  return ret;
499 
500  cmd = cmd->next;
501  }
502 
503  return ERROR_OK;
504 }
505 
506 static int xlnx_pcie_xvc_execute_queue(struct jtag_command *cmd_queue)
507 {
508  return xlnx_xvc_execute_queue(cmd_queue, PCIE);
509 }
510 
511 static int xlnx_axi_xvc_execute_queue(struct jtag_command *cmd_queue)
512 {
513  return xlnx_xvc_execute_queue(cmd_queue, AXI);
514 }
515 
516 static int xlnx_pcie_xvc_init(void)
517 {
518  char filename[PATH_MAX];
519  uint32_t cap, vh;
520  int err;
521 
522  snprintf(filename, PATH_MAX, "/sys/bus/pci/devices/%s/config",
524  xlnx_pcie_xvc->fd = open(filename, O_RDWR | O_SYNC);
525  if (xlnx_pcie_xvc->fd < 0) {
526  LOG_ERROR("Failed to open device: %s", filename);
527  return ERROR_JTAG_INIT_FAILED;
528  }
529 
530  LOG_INFO("Scanning PCIe device %s's for Xilinx XVC/PCIe ...",
532  /* Parse the PCIe extended capability list and try to find
533  * vendor specific header */
535  while (xlnx_pcie_xvc->offset <= PCI_CFG_SPACE_EXP_SIZE - sizeof(cap) &&
538  if (err != ERROR_OK)
539  return err;
540  LOG_DEBUG("Checking capability at 0x%x; id=0x%04" PRIx32 " version=0x%" PRIx32 " next=0x%" PRIx32,
542  PCI_EXT_CAP_ID(cap),
543  PCI_EXT_CAP_VER(cap),
544  PCI_EXT_CAP_NEXT(cap));
545  if (PCI_EXT_CAP_ID(cap) == PCI_EXT_CAP_ID_VNDR) {
547  if (err != ERROR_OK)
548  return err;
549  LOG_DEBUG("Checking possible match at 0x%x; id: 0x%" PRIx32 "; rev: 0x%" PRIx32 "; length: 0x%" PRIx32,
551  PCI_VNDR_HEADER_ID(vh),
552  PCI_VNDR_HEADER_REV(vh),
553  PCI_VNDR_HEADER_LEN(vh));
554  if ((PCI_VNDR_HEADER_ID(vh) == XLNX_PCIE_XVC_VSEC_ID) &&
555  (PCI_VNDR_HEADER_LEN(vh) == XLNX_PCIE_XVC_CAP_SIZE))
556  break;
557  }
558  xlnx_pcie_xvc->offset = PCI_EXT_CAP_NEXT(cap);
559  }
562  close(xlnx_pcie_xvc->fd);
563  return ERROR_JTAG_INIT_FAILED;
564  }
565 
566  LOG_INFO("Found Xilinx XVC/PCIe capability at offset: 0x%x", xlnx_pcie_xvc->offset);
567 
568  return ERROR_OK;
569 }
570 
571 static int xlnx_axi_xvc_init(void)
572 {
573  uint64_t baseaddr;
574 
575  if (xlnx_axi_xvc->device_addr) {
576  baseaddr = strtoul(xlnx_axi_xvc->device_addr, NULL, 0);
577  } else {
578  LOG_ERROR("Please set device addr.");
579  return ERROR_JTAG_INIT_FAILED;
580  }
581 
582  if (xlnx_axi_xvc->device_file) {
583  LOG_INFO("Opening %s for AXI communication", xlnx_axi_xvc->device_file);
584  xlnx_axi_xvc->fd = open(xlnx_axi_xvc->device_file, O_RDWR | O_SYNC);
585  } else {
586  LOG_INFO("Opening /dev/mem for AXI communication");
587  xlnx_axi_xvc->fd = open("/dev/mem", O_RDWR | O_SYNC);
588  }
589 
590  if (xlnx_axi_xvc->fd < 0) {
591  LOG_ERROR("Failed to open device file, check permissions.");
592  return ERROR_JTAG_INIT_FAILED;
593  }
594 
595  xlnx_axi_xvc->base = mmap(0, XLNX_AXI_XVC_MAX_REG, PROT_READ | PROT_WRITE,
596  MAP_SHARED, xlnx_axi_xvc->fd, baseaddr);
597  if (xlnx_axi_xvc->base == MAP_FAILED) {
598  LOG_ERROR("mmap() failed, check permissions.");
599  close(xlnx_axi_xvc->fd);
600  return ERROR_JTAG_INIT_FAILED;
601  }
602 
603  LOG_INFO("Mapped Xilinx XVC/AXI vaddr %p paddr 0x%" PRIx64,
604  xlnx_axi_xvc->base, baseaddr);
605 
606  return ERROR_OK;
607 }
608 
609 static int xlnx_pcie_xvc_quit(void)
610 {
611  int err;
612 
613  err = close(xlnx_pcie_xvc->fd);
614  if (err)
615  return err;
616 
617  return ERROR_OK;
618 }
619 
620 static int xlnx_axi_xvc_quit(void)
621 {
622  int err;
623 
625  free(xlnx_pcie_xvc->device);
626  free(xlnx_axi_xvc->device_file);
627  free(xlnx_axi_xvc->device_addr);
628 
629  err = close(xlnx_axi_xvc->fd);
630  if (err)
631  return err;
632 
633  return ERROR_OK;
634 }
635 
636 COMMAND_HANDLER(xlnx_pcie_xvc_handle_config_command)
637 {
638  if (CMD_ARGC != 1)
640 
641  free(xlnx_pcie_xvc->device);
642 
643  xlnx_pcie_xvc->device = strdup(CMD_ARGV[0]);
644  return ERROR_OK;
645 }
646 
647 COMMAND_HANDLER(xlnx_axi_xvc_handle_dev_addr_command)
648 {
649  if (CMD_ARGC != 1)
651 
652  free(xlnx_axi_xvc->device_addr);
653 
654  xlnx_axi_xvc->device_addr = strdup(CMD_ARGV[0]);
655  return ERROR_OK;
656 }
657 
658 COMMAND_HANDLER(xlnx_axi_xvc_handle_dev_file_command)
659 {
660  if (CMD_ARGC != 1)
662 
663  free(xlnx_axi_xvc->device_file);
664 
665  xlnx_axi_xvc->device_file = strdup(CMD_ARGV[0]);
666  return ERROR_OK;
667 }
668 
670  {
671  .name = "config",
672  .handler = xlnx_pcie_xvc_handle_config_command,
673  .mode = COMMAND_CONFIG,
674  .help = "Configure XVC/PCIe JTAG adapter",
675  .usage = "device",
676  },
678 };
679 
681  {
682  .name = "xlnx_pcie_xvc",
683  .mode = COMMAND_ANY,
684  .help = "perform xlnx_pcie_xvc management",
686  .usage = "",
687  },
689 };
690 
692  {
693  .name = "dev_addr",
694  .handler = xlnx_axi_xvc_handle_dev_addr_command,
695  .mode = COMMAND_CONFIG,
696  .help = "Configure XVC/AXI JTAG device memory address",
697  .usage = "addr",
698  },
699  {
700  .name = "dev_file",
701  .handler = xlnx_axi_xvc_handle_dev_file_command,
702  .mode = COMMAND_CONFIG,
703  .help = "Configure XVC/AXI JTAG device file location",
704  .usage = "addr",
705  },
707 };
708 
709 static const struct command_registration xlnx_axi_xvc_command_handlers[] = {
710  {
711  .name = "xlnx_axi_xvc",
712  .mode = COMMAND_ANY,
713  .help = "perform xlnx_axi_xvc management",
715  .usage = "",
716  },
718 };
719 
720 static struct jtag_interface xlnx_pcie_xvc_jtag_ops = {
722 };
723 
724 static struct jtag_interface xlnx_axi_xvc_jtag_ops = {
726 };
727 
728 static int xlnx_xvc_swd_sequence(const uint8_t *seq, size_t length,
729  enum xlnx_xvc_type_t xvc_type)
730 {
731  size_t left, write;
732  uint32_t send;
733  int err;
734 
735  left = length;
736  while (left) {
737  write = MIN(XLNX_XVC_MAX_BITS, left);
738  send = buf_get_u32(seq, 0, write);
739  err = xlnx_xvc_transact(write, send, 0, NULL, xvc_type);
740  if (err != ERROR_OK)
741  return err;
742  left -= write;
743  seq += sizeof(uint32_t);
744  };
745 
746  return ERROR_OK;
747 }
748 
750  enum xlnx_xvc_type_t xvc_type)
751 {
752  switch (seq) {
753  case LINE_RESET:
754  LOG_DEBUG("SWD line reset");
756  swd_seq_line_reset_len, xvc_type);
757  case JTAG_TO_SWD:
758  LOG_DEBUG("JTAG-to-SWD");
760  swd_seq_jtag_to_swd_len, xvc_type);
761  case SWD_TO_JTAG:
762  LOG_DEBUG("SWD-to-JTAG");
764  swd_seq_swd_to_jtag_len, xvc_type);
765  default:
766  LOG_ERROR("Sequence %d not supported", seq);
767  return ERROR_FAIL;
768  }
769 
770  return ERROR_OK;
771 }
772 
774 {
775  return xlnx_xvc_swd_switch_seq(seq, PCIE);
776 }
777 
779 {
780  return xlnx_xvc_swd_switch_seq(seq, AXI);
781 }
782 
783 static int queued_retval;
784 
785 static void xlnx_xvc_swd_write_reg(uint8_t cmd, uint32_t value,
786  uint32_t ap_delay_clk,
787  enum xlnx_xvc_type_t xvc_type);
788 
789 static void swd_clear_sticky_errors(enum xlnx_xvc_type_t xvc_type)
790 {
791  xlnx_xvc_swd_write_reg(swd_cmd(false, false, DP_ABORT),
792  STKCMPCLR | STKERRCLR | WDERRCLR | ORUNERRCLR, 0, xvc_type);
793 }
794 
795 static void xlnx_xvc_swd_read_reg(uint8_t cmd, uint32_t *value,
796  uint32_t ap_delay_clk,
797  enum xlnx_xvc_type_t xvc_type)
798 {
799  uint32_t res, ack, rpar;
800  int err;
801 
802  assert(cmd & SWD_CMD_RNW);
803 
805  /* cmd + ack */
806  err = xlnx_xvc_transact(12, cmd, 0, &res, xvc_type);
807  if (err != ERROR_OK)
808  goto err_out;
809 
810  ack = MASK_ACK(res);
811 
812  /* read data */
813  err = xlnx_xvc_transact(32, 0, 0, &res, xvc_type);
814  if (err != ERROR_OK)
815  goto err_out;
816 
817  /* parity + trn */
818  err = xlnx_xvc_transact(2, 0, 0, &rpar, xvc_type);
819  if (err != ERROR_OK)
820  goto err_out;
821 
822  LOG_DEBUG("%s %s %s reg %X = %08" PRIx32,
823  ack == SWD_ACK_OK ? "OK" : ack == SWD_ACK_WAIT ?
824  "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK",
825  cmd & SWD_CMD_APNDP ? "AP" : "DP",
826  cmd & SWD_CMD_RNW ? "read" : "write",
827  (cmd & SWD_CMD_A32) >> 1,
828  res);
829  switch (ack) {
830  case SWD_ACK_OK:
831  if (MASK_PAR(rpar) != parity_u32(res)) {
832  LOG_DEBUG_IO("Wrong parity detected");
834  return;
835  }
836  if (value)
837  *value = res;
838  if (cmd & SWD_CMD_APNDP)
839  err = xlnx_xvc_transact(ap_delay_clk, 0, 0, NULL, xvc_type);
840  queued_retval = err;
841  return;
842  case SWD_ACK_WAIT:
843  LOG_DEBUG_IO("SWD_ACK_WAIT");
844  swd_clear_sticky_errors(xvc_type);
845  return;
846  case SWD_ACK_FAULT:
847  LOG_DEBUG_IO("SWD_ACK_FAULT");
848  queued_retval = ack;
849  return;
850  default:
851  LOG_DEBUG_IO("No valid acknowledge: ack=%02" PRIx32, ack);
852  queued_retval = ack;
853  return;
854  }
855 err_out:
856  queued_retval = err;
857 }
858 
859 static void xlnx_pcie_xvc_swd_read_reg(uint8_t cmd, uint32_t *value,
860  uint32_t ap_delay_clk)
861 {
862  xlnx_xvc_swd_read_reg(cmd, value, ap_delay_clk, PCIE);
863 }
864 
865 static void xlnx_axi_xvc_swd_read_reg(uint8_t cmd, uint32_t *value,
866  uint32_t ap_delay_clk)
867 {
868  xlnx_xvc_swd_read_reg(cmd, value, ap_delay_clk, AXI);
869 }
870 
871 static void xlnx_xvc_swd_write_reg(uint8_t cmd, uint32_t value,
872  uint32_t ap_delay_clk,
873  enum xlnx_xvc_type_t xvc_type)
874 {
875  uint32_t res, ack;
876  int err;
877 
878  assert(!(cmd & SWD_CMD_RNW));
879 
881  /* cmd + trn + ack */
882  err = xlnx_xvc_transact(13, cmd, 0, &res, xvc_type);
883  if (err != ERROR_OK)
884  goto err_out;
885 
886  ack = MASK_ACK(res);
887 
888  /* write data */
889  err = xlnx_xvc_transact(32, value, 0, NULL, xvc_type);
890  if (err != ERROR_OK)
891  goto err_out;
892 
893  /* parity + trn */
894  err = xlnx_xvc_transact(2, parity_u32(value), 0, NULL, xvc_type);
895  if (err != ERROR_OK)
896  goto err_out;
897 
898  LOG_DEBUG("%s %s %s reg %X = %08" PRIx32,
899  ack == SWD_ACK_OK ? "OK" : ack == SWD_ACK_WAIT ?
900  "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK",
901  cmd & SWD_CMD_APNDP ? "AP" : "DP",
902  cmd & SWD_CMD_RNW ? "read" : "write",
903  (cmd & SWD_CMD_A32) >> 1,
904  value);
905 
906  switch (ack) {
907  case SWD_ACK_OK:
908  if (cmd & SWD_CMD_APNDP)
909  err = xlnx_xvc_transact(ap_delay_clk, 0, 0, NULL, xvc_type);
910  queued_retval = err;
911  return;
912  case SWD_ACK_WAIT:
913  LOG_DEBUG_IO("SWD_ACK_WAIT");
914  swd_clear_sticky_errors(xvc_type);
915  return;
916  case SWD_ACK_FAULT:
917  LOG_DEBUG_IO("SWD_ACK_FAULT");
918  queued_retval = ack;
919  return;
920  default:
921  LOG_DEBUG_IO("No valid acknowledge: ack=%02" PRIx32, ack);
922  queued_retval = ack;
923  return;
924  }
925 
926 err_out:
927  queued_retval = err;
928 }
929 
930 static void xlnx_pcie_xvc_swd_write_reg(uint8_t cmd, uint32_t value,
931  uint32_t ap_delay_clk)
932 {
933  xlnx_xvc_swd_write_reg(cmd, value, ap_delay_clk, PCIE);
934 }
935 
936 static void xlnx_axi_xvc_swd_write_reg(uint8_t cmd, uint32_t value,
937  uint32_t ap_delay_clk)
938 {
939  xlnx_xvc_swd_write_reg(cmd, value, ap_delay_clk, AXI);
940 }
941 
942 static int xlnx_xvc_swd_run_queue(enum xlnx_xvc_type_t xvc_type)
943 {
944  int err;
945 
946  /* we want at least 8 idle cycles between each transaction */
947  err = xlnx_xvc_transact(8, 0, 0, NULL, xvc_type);
948  if (err != ERROR_OK)
949  return err;
950 
951  err = queued_retval;
953  LOG_DEBUG("SWD queue return value: %02x", err);
954 
955  return err;
956 }
957 
959 {
961 }
962 
964 {
965  return xlnx_xvc_swd_run_queue(AXI);
966 }
967 
968 static int xlnx_xvc_swd_init(void)
969 {
970  return ERROR_OK;
971 }
972 
973 static const struct swd_driver xlnx_pcie_xvc_swd_ops = {
975  .switch_seq = xlnx_pcie_xvc_swd_switch_seq,
976  .read_reg = xlnx_pcie_xvc_swd_read_reg,
977  .write_reg = xlnx_pcie_xvc_swd_write_reg,
979 };
980 
981 static const struct swd_driver xlnx_axi_xvc_swd_ops = {
983  .switch_seq = xlnx_axi_xvc_swd_switch_seq,
984  .read_reg = xlnx_axi_xvc_swd_read_reg,
985  .write_reg = xlnx_axi_xvc_swd_write_reg,
987 };
988 
990  .name = "xlnx_pcie_xvc",
991  .transport_ids = TRANSPORT_JTAG | TRANSPORT_SWD,
992  .transport_preferred_id = TRANSPORT_JTAG,
993  .commands = xlnx_pcie_xvc_command_handlers,
994 
995  .init = &xlnx_pcie_xvc_init,
996  .quit = &xlnx_pcie_xvc_quit,
997 
998  .jtag_ops = &xlnx_pcie_xvc_jtag_ops,
999  .swd_ops = &xlnx_pcie_xvc_swd_ops,
1000 };
1001 
1003  .name = "xlnx_axi_xvc",
1004  .transport_ids = TRANSPORT_JTAG | TRANSPORT_SWD,
1005  .transport_preferred_id = TRANSPORT_JTAG,
1006  .commands = xlnx_axi_xvc_command_handlers,
1007 
1008  .init = &xlnx_axi_xvc_init,
1009  .quit = &xlnx_axi_xvc_quit,
1010 
1011  .jtag_ops = &xlnx_axi_xvc_jtag_ops,
1012  .swd_ops = &xlnx_axi_xvc_swd_ops,
1013 };
#define SWD_ACK_FAULT
Definition: arm_adi_v5.h:33
#define DP_ABORT
Definition: arm_adi_v5.h:46
#define WDERRCLR
Definition: arm_adi_v5.h:71
#define STKERRCLR
Definition: arm_adi_v5.h:70
#define ORUNERRCLR
Definition: arm_adi_v5.h:72
#define STKCMPCLR
Definition: arm_adi_v5.h:69
swd_special_seq
Definition: arm_adi_v5.h:236
@ JTAG_TO_SWD
Definition: arm_adi_v5.h:238
@ LINE_RESET
Definition: arm_adi_v5.h:237
@ SWD_TO_JTAG
Definition: arm_adi_v5.h:240
#define SWD_ACK_WAIT
Definition: arm_adi_v5.h:32
#define SWD_ACK_OK
Definition: arm_adi_v5.h:31
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
Definition: binarybuffer.h:104
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
Definition: binarybuffer.h:34
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
Definition: command.h:156
#define ERROR_COMMAND_SYNTAX_ERROR
Definition: command.h:400
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
Definition: command.h:151
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:251
@ COMMAND_CONFIG
Definition: command.h:41
@ COMMAND_ANY
Definition: command.h:42
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
Definition: commands.c:192
enum scan_type jtag_scan_type(const struct scan_command *cmd)
Definition: commands.c:167
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
Definition: commands.c:230
scan_type
The inferred type of a scan_command structure, indicating whether the command has the host scan in fr...
Definition: commands.h:22
@ SCAN_IN
From device to host,.
Definition: commands.h:24
@ SCAN_OUT
From host to device,.
Definition: commands.h:26
@ JTAG_TLR_RESET
Definition: commands.h:137
@ JTAG_SCAN
Definition: commands.h:129
@ JTAG_PATHMOVE
Definition: commands.h:140
@ JTAG_STABLECLOCKS
Definition: commands.h:142
@ JTAG_RUNTEST
Definition: commands.h:138
@ JTAG_SLEEP
Definition: commands.h:141
@ JTAG_RESET
Definition: commands.h:139
@ JTAG_TMS
Definition: commands.h:143
uint8_t type
Definition: esp_usb_jtag.c:0
uint8_t length
Definition: esp_usb_jtag.c:1
enum tap_state tap_get_end_state(void)
For more information,.
Definition: interface.c:56
enum tap_state tap_state_transition(enum tap_state cur_state, bool tms)
Function tap_state_transition takes a current TAP state and returns the next state according to the t...
Definition: interface.c:223
const char * tap_state_name(enum tap_state state)
Function tap_state_name Returns a string suitable for display representing the JTAG tap_state.
Definition: interface.c:344
int tap_get_tms_path_len(enum tap_state from, enum tap_state to)
Function int tap_get_tms_path_len returns the total number of bits that represents a TMS path transit...
Definition: interface.c:195
void tap_set_end_state(enum tap_state new_end_state)
This function sets the state of an "end state follower" which tracks the state that any cable driver ...
Definition: interface.c:48
enum tap_state tap_get_state(void)
This function gets the state of the "state follower" which tracks the state of the TAPs connected to ...
Definition: interface.c:37
int tap_get_tms_path(enum tap_state from, enum tap_state to)
This function provides a "bit sequence" indicating what has to be done with TMS during a sequence of ...
Definition: interface.c:190
#define tap_set_state(new_state)
This function sets the state of a "state follower" which tracks the state of the TAPs connected to th...
Definition: interface.h:50
#define ERROR_JTAG_DEVICE_ERROR
Definition: jtag.h:558
tap_state
Defines JTAG Test Access Port states.
Definition: jtag.h:37
@ TAP_RESET
Definition: jtag.h:56
@ TAP_IRSHIFT
Definition: jtag.h:51
@ TAP_IDLE
Definition: jtag.h:53
@ TAP_DRSHIFT
Definition: jtag.h:43
#define ERROR_JTAG_QUEUE_FAILED
Definition: jtag.h:556
#define ERROR_JTAG_INIT_FAILED
Definition: jtag.h:552
#define LOG_DEBUG_IO(expr ...)
Definition: log.h:102
#define ERROR_FAIL
Definition: log.h:174
#define LOG_ERROR(expr ...)
Definition: log.h:133
#define LOG_INFO(expr ...)
Definition: log.h:127
#define LOG_DEBUG(expr ...)
Definition: log.h:110
#define ERROR_OK
Definition: log.h:168
uint8_t bits[QN908X_FLASH_MAX_BLOCKS *QN908X_FLASH_PAGES_PER_BLOCK/8]
Definition: qn908x.c:0
#define MIN(a, b)
Definition: replacements.h:22
struct rtt_control ctrl
Control block.
Definition: rtt/rtt.c:25
#define BIT(nr)
Definition: stm32l4x.h:18
Represents a driver for a debugging interface.
Definition: interface.h:208
const char *const name
The name of the interface driver.
Definition: interface.h:210
const char * name
Definition: command.h:234
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:239
Represents a driver for a debugging interface.
Definition: interface.h:183
int(* execute_queue)(struct jtag_command *cmd_queue)
Execute commands in the supplied queue.
Definition: interface.h:196
int(* init)(void)
Initialize the debug link so it can perform SWD operations.
Definition: swd.h:255
char * device_file
Definition: xlnx-xvc.c:72
char * device_addr
Definition: xlnx-xvc.c:70
uint32_t * base
Definition: xlnx-xvc.c:69
char * device
Definition: xlnx-xvc.c:64
unsigned int offset
Definition: xlnx-xvc.c:63
#define SWD_CMD_A32
Definition: swd.h:19
#define SWD_CMD_PARK
Definition: swd.h:22
static uint8_t swd_cmd(bool is_read, bool is_ap, uint8_t regnum)
Construct a "cmd" byte, in lSB bit order, which swd_driver.read_reg() and swd_driver....
Definition: swd.h:35
static const unsigned int swd_seq_jtag_to_swd_len
Definition: swd.h:125
static const unsigned int swd_seq_line_reset_len
Definition: swd.h:104
#define SWD_CMD_APNDP
Definition: swd.h:17
#define SWD_CMD_START
Definition: swd.h:16
#define SWD_CMD_RNW
Definition: swd.h:18
static const uint8_t swd_seq_line_reset[]
SWD Line reset.
Definition: swd.h:98
static const uint8_t swd_seq_jtag_to_swd[]
JTAG-to-SWD sequence.
Definition: swd.h:115
static const uint8_t swd_seq_swd_to_jtag[]
SWD-to-JTAG sequence.
Definition: swd.h:136
static const unsigned int swd_seq_swd_to_jtag_len
Definition: swd.h:144
#define TRANSPORT_SWD
Definition: transport.h:20
#define TRANSPORT_JTAG
Definition: transport.h:19
static int parity_u32(uint32_t x)
Calculate the (even) parity of a 32-bit datum.
Definition: types.h:265
#define NULL
Definition: usb.h:16
uint8_t cmd
Definition: vdebug.c:1
uint8_t offset[4]
Definition: vdebug.c:9
#define XLNX_AXI_XVC_TMS_REG
Definition: xlnx-xvc.c:48
static int xlnx_xvc_swd_run_queue(enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:942
#define XLNX_AXI_XVC_CTRL_REG
Definition: xlnx-xvc.c:51
static int queued_retval
Definition: xlnx-xvc.c:783
static struct jtag_interface xlnx_pcie_xvc_jtag_ops
Definition: xlnx-xvc.c:720
static int xlnx_pcie_xvc_write_reg(const int offset, const uint32_t val)
Definition: xlnx-xvc.c:120
#define XLNX_PCIE_XVC_VSEC_HDR
Definition: xlnx-xvc.c:39
static void xlnx_pcie_xvc_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk)
Definition: xlnx-xvc.c:930
#define XLNX_PCIE_XVC_EXT_CAP
Definition: xlnx-xvc.c:38
static const struct swd_driver xlnx_axi_xvc_swd_ops
Definition: xlnx-xvc.c:981
#define XLNX_PCIE_XVC_TDX_REG
Definition: xlnx-xvc.c:42
static int xlnx_xvc_execute_stableclocks(struct jtag_command *cmd, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:249
static void xlnx_xvc_execute_sleep(struct jtag_command *cmd)
Definition: xlnx-xvc.c:425
static void xlnx_axi_xvc_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk)
Definition: xlnx-xvc.c:865
static int xlnx_xvc_swd_switch_seq(enum swd_special_seq seq, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:749
static int xlnx_pcie_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi, uint32_t *tdo)
Definition: xlnx-xvc.c:150
static int xlnx_xvc_swd_init(void)
Definition: xlnx-xvc.c:968
#define XLNX_AXI_XVC_CTRL_REG_ENABLE_MASK
Definition: xlnx-xvc.c:54
COMMAND_HANDLER(xlnx_pcie_xvc_handle_config_command)
Definition: xlnx-xvc.c:636
struct adapter_driver xlnx_axi_xvc_adapter_driver
Definition: xlnx-xvc.c:1002
static int xlnx_xvc_execute_scan(struct jtag_command *cmd, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:359
static int xlnx_axi_xvc_execute_queue(struct jtag_command *cmd_queue)
Definition: xlnx-xvc.c:511
#define PCIE_EXT_CAP_LST
Definition: xlnx-xvc.c:36
struct adapter_driver xlnx_pcie_xvc_adapter_driver
Definition: xlnx-xvc.c:989
static int xlnx_xvc_execute_tms(struct jtag_command *cmd, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:431
static struct jtag_interface xlnx_axi_xvc_jtag_ops
Definition: xlnx-xvc.c:724
static int xlnx_pcie_xvc_quit(void)
Definition: xlnx-xvc.c:609
static int xlnx_axi_xvc_swd_run_queue(void)
Definition: xlnx-xvc.c:963
static int xlnx_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi, uint32_t *tdo, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:240
static const struct command_registration xlnx_pcie_xvc_command_handlers[]
Definition: xlnx-xvc.c:680
#define XLNX_PCIE_XVC_VSEC_ID
Definition: xlnx-xvc.c:45
static void xlnx_xvc_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:795
static int xlnx_axi_xvc_quit(void)
Definition: xlnx-xvc.c:620
static const struct swd_driver xlnx_pcie_xvc_swd_ops
Definition: xlnx-xvc.c:973
static struct xlnx_axi_xvc xlnx_axi_xvc_state
Definition: xlnx-xvc.c:82
#define XLNX_AXI_XVC_TDO_REG
Definition: xlnx-xvc.c:50
static int xlnx_axi_xvc_init(void)
Definition: xlnx-xvc.c:571
static int xlnx_xvc_swd_sequence(const uint8_t *seq, size_t length, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:728
#define XLNX_AXI_XVC_TDI_REG
Definition: xlnx-xvc.c:49
static int xlnx_axi_xvc_read_reg(const int offset, uint32_t *val)
Definition: xlnx-xvc.c:107
static int xlnx_xvc_execute_pathmove(struct jtag_command *cmd, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:327
xlnx_xvc_type_t
Definition: xlnx-xvc.c:75
@ AXI
Definition: xlnx-xvc.c:77
@ PCIE
Definition: xlnx-xvc.c:76
static int xlnx_pcie_xvc_read_reg(const int offset, uint32_t *val)
Definition: xlnx-xvc.c:85
static int xlnx_pcie_xvc_swd_switch_seq(enum swd_special_seq seq)
Definition: xlnx-xvc.c:773
static void xlnx_xvc_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:871
static void swd_clear_sticky_errors(enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:789
static int xlnx_xvc_execute_command(struct jtag_command *cmd, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:456
static int xlnx_pcie_xvc_init(void)
Definition: xlnx-xvc.c:516
static int xlnx_xvc_execute_runtest(struct jtag_command *cmd, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:291
#define XLNX_AXI_XVC_LEN_REG
Definition: xlnx-xvc.c:47
static int xlnx_axi_xvc_write_reg(const int offset, const uint32_t val)
Definition: xlnx-xvc.c:139
static const struct command_registration xlnx_axi_xvc_command_handlers[]
Definition: xlnx-xvc.c:709
static int xlnx_pcie_xvc_execute_queue(struct jtag_command *cmd_queue)
Definition: xlnx-xvc.c:506
static const struct command_registration xlnx_axi_xvc_subcommand_handlers[]
Definition: xlnx-xvc.c:691
#define XLNX_PCIE_XVC_CAP_SIZE
Definition: xlnx-xvc.c:44
static void xlnx_axi_xvc_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk)
Definition: xlnx-xvc.c:936
static int xlnx_xvc_execute_queue(struct jtag_command *cmd_queue, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:488
static void xlnx_pcie_xvc_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk)
Definition: xlnx-xvc.c:859
static int xlnx_axi_xvc_swd_switch_seq(enum swd_special_seq seq)
Definition: xlnx-xvc.c:778
#define MASK_ACK(x)
Definition: xlnx-xvc.c:58
#define XLNX_XVC_MAX_BITS
Definition: xlnx-xvc.c:56
#define XLNX_AXI_XVC_MAX_REG
Definition: xlnx-xvc.c:52
static int xlnx_axi_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi, uint32_t *tdo)
Definition: xlnx-xvc.c:180
static struct xlnx_pcie_xvc xlnx_pcie_xvc_state
Definition: xlnx-xvc.c:80
#define XLNX_PCIE_XVC_TMS_REG
Definition: xlnx-xvc.c:41
static int xlnx_pcie_xvc_swd_run_queue(void)
Definition: xlnx-xvc.c:958
#define MASK_PAR(x)
Definition: xlnx-xvc.c:59
static int xlnx_xvc_execute_statemove(size_t skip, enum xlnx_xvc_type_t xvc_type)
Definition: xlnx-xvc.c:269
#define PCI_CFG_SPACE_EXP_SIZE
Definition: xlnx-xvc.c:33
static const struct command_registration xlnx_pcie_xvc_subcommand_handlers[]
Definition: xlnx-xvc.c:669
#define XLNX_PCIE_XVC_LEN_REG
Definition: xlnx-xvc.c:40