Commit 49239d14 authored by Federico Vaga's avatar Federico Vaga

sw:kernel: pause the CPU on dump

If we want to use DUMP to inspect the firmware status at a given moment
in time we must stop the code execution so that nothing change while
the driver extracts the data.
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent ed718e60
......@@ -239,7 +239,7 @@ static int trtl_cpu_firmware_dump(struct trtl_cpu *cpu, void *fw_buf,
size_t count, loff_t off)
{
struct trtl_dev *trtl = to_trtl_dev(cpu->dev.parent);
uint32_t *fw = fw_buf, word;
uint32_t *fw = fw_buf, word, enable;
int size, offset, i, cpu_memsize;
......@@ -258,6 +258,10 @@ static int trtl_cpu_firmware_dump(struct trtl_cpu *cpu, void *fw_buf,
return -ENOMEM;
}
/* Stop the CPU before dumping its memory */
enable = trtl_ioread(trtl, trtl->base_csr + WRN_CPU_CSR_REG_ENABLE);
trtl_cpu_enable_set(trtl, (1 << cpu->index));
/* Dump the firmware */
for (i = 0; i < size; ++i) {
trtl_iowrite(trtl, i + offset,
......@@ -268,6 +272,9 @@ static int trtl_cpu_firmware_dump(struct trtl_cpu *cpu, void *fw_buf,
fw[i] = be32_to_cpu(word);
}
/* Restore the previous enable status */
trtl_iowrite(trtl, enable, trtl->base_csr + WRN_CPU_CSR_REG_ENABLE);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment