Add support for the HiFive1 revB
Subsystems (2)
v2 cover Add support for the HiFive1 revB
Add support for the HiFive1 revB board. We don't want to break current users so this is added as an option that is disabled by default. The main change is the address that we jump to at boot.
v2:
- Add a cover letter
Alistair Francis (2):
riscv: sifive_e: Manually define the machine
sifive_e: Support the revB machine
include/hw/riscv/sifive_e.h | 5 +++ hw/riscv/sifive_e.c | 76 +++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 15 deletions(-)
Signature · 1 line
2.26.2
PATCH v2 1/2 riscv: sifive_e: Manually define the machine
Signed-off-by Alistair Francis <[email protected]>
--- include/hw/riscv/sifive_e.h | 4 ++++ hw/riscv/sifive_e.c | 41 +++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 11 deletions(-)
include/hw/riscv/sifive_e.h +4 -0
@@ -47,6 +47,10 @@ typedef struct SiFiveEState {SiFiveESoCState soc; } SiFiveEState; +#define TYPE_RISCV_E_MACHINE MACHINE_TYPE_NAME("sifive_e") +#define RISCV_E_MACHINE (obj) \ + OBJECT_CHECK(SiFiveEState, (obj), TYPE_RISCV_E_MACHINE) +enum {SIFIVE_E_DEBUG ,SIFIVE_E_MROM ,
hw/riscv/sifive_e.c +30 -11
59 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v2 2/2 sifive_e: Support the revB machine
In reply to Alistair FrancisSigned-off-by Alistair Francis <[email protected]>
--- include/hw/riscv/sifive_e.h | 1 + hw/riscv/sifive_e.c | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-)
include/hw/riscv/sifive_e.h +1 -0
@@ -45,6 +45,7 @@ typedef struct SiFiveEState {/*< public >*/ SiFiveESoCState soc; +bool revb; } SiFiveEState;#define TYPE_RISCV_E_MACHINE MACHINE_TYPE_NAME("sifive_e")
hw/riscv/sifive_e.c +31 -4
@@ -98,10 +98,14 @@ static void riscv_sifive_e_init(MachineState *machine) memmap[SIFIVE_E_DTIM].base, main_mem);/* Mask ROM reset vector */ -uint32_t reset_vec[2 ] = { -0x204002b7 ,/* 0x1000: lui t0,0x20400 */ -0x00028067 ,/* 0x1004: jr t0 */ - }; +uint32_t reset_vec[2 ]; + +if (s->revb) { + reset_vec[0 ] =0x200102b7 ;/* 0x1000: lui t0,0x20010 */ + }else { + reset_vec[0 ] =0x204002b7 ;/* 0x1000: lui t0,0x20400 */ + } + reset_vec[1 ] =0x00028067 ;/* 0x1004: jr t0 */ /* copy in the reset vector in little_endian byte order */ for (i =0 ; i <sizeof (reset_vec) >>2 ; i++) {
@@ -115,8 +119,31 @@ static void riscv_sifive_e_init(MachineState *machine) } } +static bool sifive_e_machine_get_revb (Object *obj,Error **errp) +{ +SiFiveEState *s =RISCV_E_MACHINE (obj); + +return s->revb; +} + +static void sifive_e_machine_set_revb (Object *obj,bool value,Error **errp) +{ +SiFiveEState *s =RISCV_E_MACHINE (obj); + + s->revb = value; +} +static void sifive_e_machine_instance_init (Object *obj) { +SiFiveEState *s =RISCV_E_MACHINE (obj); + + s->revb = false; +object_property_add_bool (obj,"revb" , sifive_e_machine_get_revb, + sifive_e_machine_set_revb,NULL ); +object_property_set_description (obj,"revb" , +"Set on to tell QEMU that it should model " +"the revB HiFive1 board" , +NULL ); }static void sifive_e_machine_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.26.2