diff options
author | Alistair Popple <alistair@popple.id.au> | 2016-12-02 17:33:32 +1100 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2016-12-02 17:40:10 +1100 |
commit | 3172dd9a17dc9aabb8dc6438b849db148728fb0c (patch) | |
tree | e5ae2870566338439835e42614e23018592af83a /libpdbg/cfam.c | |
parent | 23410a93cc70009094cbab22fda4063fa6879962 (diff) | |
download | pdbg-3172dd9a17dc9aabb8dc6438b849db148728fb0c.tar.gz pdbg-3172dd9a17dc9aabb8dc6438b849db148728fb0c.zip |
Add detection of chip types
Support detecting different chip types so we enable chip type
dependent behaviour.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Diffstat (limited to 'libpdbg/cfam.c')
-rw-r--r-- | libpdbg/cfam.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libpdbg/cfam.c b/libpdbg/cfam.c index 51d0b84..15000b8 100644 --- a/libpdbg/cfam.c +++ b/libpdbg/cfam.c @@ -225,6 +225,20 @@ int opb_target_init(struct target *target, const char *name, uint64_t base, stru return 0; } +enum chip_type get_chip_type(uint64_t chip_id) +{ + switch(GETFIELD(PPC_BITMASK32(12, 19), chip_id)) { + case 0xea: + return CHIP_P8; + case 0xd3: + return CHIP_P8NV; + case 0xd1: + return CHIP_P9; + default: + return CHIP_UNKNOWN; + } +} + int mfsi_target_init(struct target *target, const char *name, uint64_t base, struct target *next) { target_init(target, name, base, NULL, NULL, NULL, next); @@ -236,7 +250,7 @@ int mfsi_target_init(struct target *target, const char *name, uint64_t base, str int hmfsi_target_probe(struct target *cfam, struct target *targets, int max_target_count) { struct target *target = targets; - uint64_t value, chip_id; + uint64_t value; int target_count = 0, i; for (i = 0; i < 8 && i < max_target_count; i++) { @@ -246,9 +260,8 @@ int hmfsi_target_probe(struct target *cfam, struct target *targets, int max_targ continue; } - /* Ignore unknown chip ids */ - chip_id = GETFIELD(PPC_BITMASK32(12, 19), value); - if (chip_id != 0xea && chip_id != 0xd3) { + target->chip_type = get_chip_type(value); + if (target->chip_type == CHIP_UNKNOWN) { target_del(target); continue; } |