1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Support for processors implementing MIPS64 instruction set 4 * 5 * Copyright (C) 2014 by Andrey Sidorov <anysidorov@gmail.com> 6 * Copyright (C) 2014 by Aleksey Kuleshov <rndfax@yandex.ru> 7 * Copyright (C) 2014-2019 by Peter Mamonov <pmamonov@gmail.com> 8 * 9 * Based on the work of: 10 * Copyright (C) 2008 by Spencer Oliver 11 * Copyright (C) 2008 by David T.L. Wong 12 * Copyright (C) 2010 by Konstantin Kostyukhin, Nikolay Shmyrev 13 */ 14 15 #ifndef OPENOCD_TARGET_MIPS64_PRACC_H 16 #define OPENOCD_TARGET_MIPS64_PRACC_H 17 18 #include "mips_ejtag.h" 19 20 #define MIPS64_PRACC_TEXT 0xffffffffFF200200ull 21 22 #define MIPS64_PRACC_STACK 0xffffffffFF204000ull 23 #define MIPS64_PRACC_PARAM_IN 0xffffffffFF201000ull 24 #define MIPS64_PRACC_PARAM_IN_SIZE 0x1000 25 #define MIPS64_PRACC_PARAM_OUT (MIPS64_PRACC_PARAM_IN + MIPS64_PRACC_PARAM_IN_SIZE) 26 #define MIPS64_PRACC_PARAM_OUT_SIZE 0x1000 27 28 #undef UPPER16 29 #undef LOWER16 30 #define UPPER16(v) ((uint32_t)((v >> 16) & 0xFFFF)) 31 #define LOWER16(v) ((uint32_t)(v & 0xFFFF)) 32 #define MIPS64_PRACC_FASTDATA_AREA 0xffffffffFF200000 33 #define MIPS64_PRACC_FASTDATA_SIZE 16 34 #define MIPS64_FASTDATA_HANDLER_SIZE 0x80 35 36 /* FIXME: 16-bit NEG */ 37 #undef NEG16 38 #define NEG16(v) ((uint32_t)(((~(v)) + 1) & 0xFFFF)) 39 40 #define MIPS64_PRACC_ADDR_STEP 4 41 #define MIPS64_PRACC_DATA_STEP 8 42 43 int mips64_pracc_read_mem(struct mips_ejtag *ejtag_info, uint64_t addr, unsigned size, unsigned count, void *buf); 44 int mips64_pracc_write_mem(struct mips_ejtag *ejtag_info, uint64_t addr, unsigned size, unsigned count, void *buf); 45 46 int mips64_pracc_read_regs(struct mips_ejtag *ejtag_info, uint64_t *regs); 47 int mips64_pracc_write_regs(struct mips_ejtag *ejtag_info, uint64_t *regs); 48 49 int mips64_pracc_exec(struct mips_ejtag *ejtag_info, 50 unsigned code_len, const uint32_t *code, 51 unsigned num_param_in, uint64_t *param_in, 52 unsigned num_param_out, uint64_t *param_out); 53 54 int mips64_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, 55 struct working_area *source, 56 bool write_t, uint64_t addr, 57 unsigned count, uint64_t *buf); 58 59 #endif /* OPENOCD_TARGET_MIPS64_PRACC_H */ 60