X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=riscv%2Fdebug_module.h;h=e554ffc8f3623863851a1a4f5fbf4192402fae69;hb=aa8cbb1ccd3856fd5e0437b0e24cfd7a3b794b8e;hp=00c66cc72253916c36366601ebfd2e40017fd92f;hpb=0185d369153b099be0c363a4ad6a52cec19b80bd;p=riscv-isa-sim.git diff --git a/riscv/debug_module.h b/riscv/debug_module.h index 00c66cc..e554ffc 100644 --- a/riscv/debug_module.h +++ b/riscv/debug_module.h @@ -56,10 +56,32 @@ typedef struct { unsigned autoexecdata; } abstractauto_t; +typedef struct { + unsigned version; + bool readonaddr; + unsigned sbaccess; + bool autoincrement; + bool readondata; + unsigned error; + unsigned asize; + bool access128; + bool access64; + bool access32; + bool access16; + bool access8; +} sbcs_t; + class debug_module_t : public abstract_device_t { public: - debug_module_t(sim_t *sim, unsigned progbufsize); + /* + * If require_authentication is true, then a debugger must authenticate as + * follows: + * 1. Read a 32-bit value from authdata: + * 2. Write the value that was read back, plus one, to authdata. + */ + debug_module_t(sim_t *sim, unsigned progbufsize, unsigned max_bus_master_bits, + bool require_authentication); ~debug_module_t(); void add_device(bus_t *bus); @@ -81,12 +103,16 @@ class debug_module_t : public abstract_device_t // Actual size of the program buffer, which is 1 word bigger than we let on // to implement the implicit ebreak at the end. unsigned program_buffer_bytes; + unsigned max_bus_master_bits; + bool require_authentication; static const unsigned debug_data_start = 0x380; unsigned debug_progbuf_start; static const unsigned debug_abstract_size = 2; unsigned debug_abstract_start; + static const unsigned hartsellen = 10; + sim_t *sim; uint8_t debug_rom_whereto[4]; @@ -101,12 +127,24 @@ class debug_module_t : public abstract_device_t void write32(uint8_t *rom, unsigned int index, uint32_t value); uint32_t read32(uint8_t *rom, unsigned int index); + void sb_autoincrement(); + void sb_read(); + void sb_write(); + unsigned sb_access_bits(); + dmcontrol_t dmcontrol; dmstatus_t dmstatus; abstractcs_t abstractcs; abstractauto_t abstractauto; uint32_t command; + sbcs_t sbcs; + uint32_t sbaddress[4]; + uint32_t sbdata[4]; + + uint32_t challenge; + const uint32_t secret = 1; + processor_t *current_proc() const; void reset(); bool perform_abstract_command();