diff options
author | Alistair Popple <alistair@popple.id.au> | 2016-12-19 21:07:51 +1100 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2017-03-30 15:37:41 +1100 |
commit | f045f14437ef63e10f57580978dc9ca3e0256007 (patch) | |
tree | 86c0bdfe2fd6a54d5517ee5313e89765cd801a08 /libpdbg/operations.h | |
parent | 72bf33c09f06ae63cd9f8d05e412b64622b340d1 (diff) | |
download | pdbg-f045f14437ef63e10f57580978dc9ca3e0256007.tar.gz pdbg-f045f14437ef63e10f57580978dc9ca3e0256007.zip |
Clean-up target configuration in preparation for adding P9 support
The previous implementation of targeting was hardcoded, cumbersome
and difficult to reconfigure for different chip types. This moves to a
method of configuring targets using device-tree which is much easier
to maintain and allows methods to be added to support operations like
getmem on POWER9.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Diffstat (limited to 'libpdbg/operations.h')
-rw-r--r-- | libpdbg/operations.h | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/libpdbg/operations.h b/libpdbg/operations.h index 76a1ca8..4175af3 100644 --- a/libpdbg/operations.h +++ b/libpdbg/operations.h @@ -21,17 +21,10 @@ /* Error codes */ #define EFSI 1 -#define PR_DEBUG(x, args...) \ - //fprintf(stderr, x, ##args) -#define PR_INFO(x, args...) \ - fprintf(stderr, x, ##args) -#define PR_ERROR(x, args...) \ - fprintf(stderr, "%s: " x, __FUNCTION__, ##args) - #define CHECK_ERR(x) do { \ if (x) { \ PR_DEBUG("%s: %d\n", __FUNCTION__, __LINE__); \ - return -EFSI; \ + return x; \ } \ } while(0) @@ -52,37 +45,25 @@ int adu_putmem(struct target *target, uint64_t start_addr, uint8_t *input, uint6 #define THREAD_STATUS_SLEEP PPC_BITMASK(61, 62) #define THREAD_STATUS_QUIESCE PPC_BIT(60) -int ram_getgpr(struct target *thread, int gpr, uint64_t *value); -int ram_putgpr(struct target *thread, int gpr, uint64_t value); -int ram_getnia(struct target *thread, uint64_t *value); -int ram_putnia(struct target *thread, uint64_t value); -int ram_getspr(struct target *thread, int spr, uint64_t *value); -int ram_putspr(struct target *thread, int spr, uint64_t value); -int ram_getmsr(struct target *thread, uint64_t *value); -int ram_putmsr(struct target *thread, uint64_t value); -int ram_getmem(struct target *thread, uint64_t addr, uint64_t *value); -uint64_t chiplet_thread_status(struct target *thread); -int ram_stop_thread(struct target *thread); -int ram_step_thread(struct target *thread, int count); -int ram_start_thread(struct target *thread); +int ram_getgpr(struct thread *thread, int gpr, uint64_t *value); +int ram_putgpr(struct thread *thread, int gpr, uint64_t value); +int ram_getnia(struct thread *thread, uint64_t *value); +int ram_putnia(struct thread *thread, uint64_t value); +int ram_getspr(struct thread *thread, int spr, uint64_t *value); +int ram_putspr(struct thread *thread, int spr, uint64_t value); +int ram_getmsr(struct thread *thread, uint64_t *value); +int ram_putmsr(struct thread *thread, uint64_t value); +int ram_getmem(struct thread *thread, uint64_t addr, uint64_t *value); +uint64_t thread_status(struct thread *thread); +int ram_stop_thread(struct thread *thread); +int ram_step_thread(struct thread *thread, int count); +int ram_start_thread(struct thread *thread); +void fsi_destroy(struct target *target); /* GDB server functionality */ int gdbserver_start(uint16_t port); enum fsi_system_type {FSI_SYSTEM_P8, FSI_SYSTEM_P9W, FSI_SYSTEM_P9R, FSI_SYSTEM_P9Z}; -int fsi_target_init(struct target *target, const char *name, enum fsi_system_type tpye, struct target *next); -int fsi_target_probe(struct target *targets, int max_target_count); -int i2c_target_init(struct target *target, const char *name, struct target *next, - const char *bus, int addr); -int kernel_fsi_target_init(struct target *target, const char *name, struct target *next); -int fsi2pib_target_init(struct target *target, const char *name, uint64_t base, struct target *next); -int kernel_fsi2pib_target_init(struct target *target, const char *name, uint64_t base, struct target *next); -int opb_target_init(struct target *target, const char *name, uint64_t base, struct target *next); enum chip_type get_chip_type(uint64_t chip_id); -int thread_target_init(struct target *thread, const char *name, uint64_t thread_id, struct target *next); -int thread_target_probe(struct target *chiplet, struct target *targets, int max_target_count); -int chiplet_target_init(struct target *target, const char *name, uint64_t chip_id, struct target *next); -int chiplet_target_probe(struct target *processor, struct target *targets, int max_target_count); -int hmfsi_target_probe(struct target *cfam, struct target *targets, int max_target_count); #endif |