diff options
-rw-r--r-- | src/cfam.c | 48 | ||||
-rwxr-xr-x | tests/test_hw_bmc.sh | 2 |
2 files changed, 30 insertions, 20 deletions
@@ -21,39 +21,49 @@ #include "main.h" #include "optcmd.h" +#include "path.h" -static int _getcfam(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *unused) +static int getcfam(uint32_t addr) { + struct pdbg_target *target; uint32_t value; + int count = 0; - if (fsi_read(target, *addr, &value)) - return 0; + for_each_path_target_class("fsi", target) { + if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) + continue; - printf("p%d:0x%x = 0x%08x\n", index, (uint32_t) *addr, value); + if (fsi_read(target, addr, &value)) { + printf("p%d: failed\n", pdbg_target_index(target)); + continue; - return 1; -} + } -static int getcfam(uint32_t addr) -{ - uint64_t addr64 = addr; + printf("p%d: 0x%x = 0x%08x\n", pdbg_target_index(target), addr, value); + count++; + } - return for_each_target("fsi", _getcfam, &addr64, NULL); + return count; } OPTCMD_DEFINE_CMD_WITH_ARGS(getcfam, getcfam, (ADDRESS32)); -static int _putcfam(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *data) +static int putcfam(uint32_t addr, uint32_t data) { - if (fsi_write(target, *addr, *data)) - return 0; + struct pdbg_target *target; + int count = 0; - return 1; -} + for_each_path_target_class("fsi", target) { + if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) + continue; -static int putcfam(uint32_t addr, uint32_t data) -{ - uint64_t addr64 = addr, data64 = data; + if (fsi_write(target, addr, data)) { + printf("p%d: failed\n", pdbg_target_index(target)); + continue; + } + + count++; + } - return for_each_target("fsi", _putcfam, &addr64, &data64); + return count; } OPTCMD_DEFINE_CMD_WITH_ARGS(putcfam, putcfam, (ADDRESS32, DATA32)); diff --git a/tests/test_hw_bmc.sh b/tests/test_hw_bmc.sh index c35597b..850afd9 100755 --- a/tests/test_hw_bmc.sh +++ b/tests/test_hw_bmc.sh @@ -84,7 +84,7 @@ result_filter () } test_result 0 <<EOF -p0:0xc09 = HEX8 +p0: 0xc09 = HEX8 EOF do_skip |