Skip to content

Commit 4fad21e

Browse files
committed
[ot] hw/core: loader.c: make generic loader image loadable at will
Image file loaded with "-device loader,file=..." are copied back to their destination device when the generic QEMU reset feature is invoked. As OpenTitan device use a specialized reset scheme, we may need to copy the so-called "ROM" images (as QEMU non-modifiable image, not related to OT ROM controller images) at will. Add a public API to trigger this image-to-device copy since the default API is private. Signed-off-by: Emmanuel Blot <[email protected]>
1 parent 49896ee commit 4fad21e

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

hw/core/loader.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,11 @@ int rom_check_and_register_reset(void)
14201420
return 0;
14211421
}
14221422

1423+
void rom_load(void)
1424+
{
1425+
rom_reset(NULL);
1426+
}
1427+
14231428
void rom_set_fw(FWCfgState *f)
14241429
{
14251430
fw_cfg = f;

hw/riscv/ot_darjeeling.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "hw/intc/sifive_plic.h"
3030
#include "hw/jtag/tap_ctrl.h"
3131
#include "hw/jtag/tap_ctrl_rbb.h"
32+
#include "hw/loader.h"
3233
#include "hw/misc/pulp_rv_dm.h"
3334
#include "hw/misc/unimp.h"
3435
#include "hw/opentitan/ot_address_space.h"
@@ -1716,6 +1717,8 @@ static void ot_dj_soc_reset_exit(Object *obj, ResetType type)
17161717
c->parent_phases.exit(obj, type);
17171718
}
17181719

1720+
rom_load();
1721+
17191722
/* Kick off ROM checks and boot */
17201723
object_property_set_bool(OBJECT(s->devices[OT_DJ_SOC_DEV_ROM_CTRL0]),
17211724
"load", true, &error_fatal);

include/hw/loader.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,9 @@ typedef struct RomGap {
389389
*/
390390
RomGap rom_find_largest_gap_between(hwaddr base, size_t size);
391391

392+
/**
393+
* rom_load: Load all registered ROMs
394+
*/
395+
void rom_load(void);
396+
392397
#endif

0 commit comments

Comments
 (0)