mirror of https://github.com/xemu-project/xemu.git
sifive_e: Support the revB machine
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
354908cee1
commit
5a842062b9
|
@ -95,10 +95,14 @@ static void riscv_sifive_e_init(MachineState *machine)
|
||||||
memmap[SIFIVE_E_DTIM].base, main_mem);
|
memmap[SIFIVE_E_DTIM].base, main_mem);
|
||||||
|
|
||||||
/* Mask ROM reset vector */
|
/* Mask ROM reset vector */
|
||||||
uint32_t reset_vec[2] = {
|
uint32_t reset_vec[2];
|
||||||
0x204002b7, /* 0x1000: lui t0,0x20400 */
|
|
||||||
0x00028067, /* 0x1004: jr t0 */
|
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 */
|
/* copy in the reset vector in little_endian byte order */
|
||||||
for (i = 0; i < sizeof(reset_vec) >> 2; i++) {
|
for (i = 0; i < sizeof(reset_vec) >> 2; i++) {
|
||||||
|
@ -112,8 +116,30 @@ 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)
|
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);
|
||||||
|
object_property_set_description(obj, "revb",
|
||||||
|
"Set on to tell QEMU that it should model "
|
||||||
|
"the revB HiFive1 board");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
|
static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
|
||||||
|
|
|
@ -45,6 +45,7 @@ typedef struct SiFiveEState {
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
SiFiveESoCState soc;
|
SiFiveESoCState soc;
|
||||||
|
bool revb;
|
||||||
} SiFiveEState;
|
} SiFiveEState;
|
||||||
|
|
||||||
#define TYPE_RISCV_E_MACHINE MACHINE_TYPE_NAME("sifive_e")
|
#define TYPE_RISCV_E_MACHINE MACHINE_TYPE_NAME("sifive_e")
|
||||||
|
|
Loading…
Reference in New Issue