bcm2835_property: implement "get board revision" query

Return a valid value from the BCM2835 property mailbox query "get board
revision". This query is used by U-Boot. Implementing it fixes the first
obvious difference between qemu and real HW.

The value returned is currently hard-coded to match the RPi2 I own. Other
values are legal, e.g. different board manufacturer field values are
likely to exist in the wild.

Cc: Andrew Baumann <Andrew.Baumann@microsoft.com>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Message-id: 1454993910-24077-1-git-send-email-swarren@wwwdotorg.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Stephen Warren 2016-02-11 11:17:32 +00:00 committed by Peter Maydell
parent 7ea686f5dd
commit f0afa73164
5 changed files with 9 additions and 2 deletions

View File

@ -58,6 +58,8 @@ static void bcm2835_peripherals_init(Object *obj)
/* Property channel */ /* Property channel */
object_initialize(&s->property, sizeof(s->property), TYPE_BCM2835_PROPERTY); object_initialize(&s->property, sizeof(s->property), TYPE_BCM2835_PROPERTY);
object_property_add_child(obj, "property", OBJECT(&s->property), NULL); object_property_add_child(obj, "property", OBJECT(&s->property), NULL);
object_property_add_alias(obj, "board-rev", OBJECT(&s->property),
"board-rev", &error_abort);
qdev_set_parent_bus(DEVICE(&s->property), sysbus_get_default()); qdev_set_parent_bus(DEVICE(&s->property), sysbus_get_default());
object_property_add_const_link(OBJECT(&s->property), "dma-mr", object_property_add_const_link(OBJECT(&s->property), "dma-mr",

View File

@ -39,6 +39,8 @@ static void bcm2836_init(Object *obj)
TYPE_BCM2835_PERIPHERALS); TYPE_BCM2835_PERIPHERALS);
object_property_add_child(obj, "peripherals", OBJECT(&s->peripherals), object_property_add_child(obj, "peripherals", OBJECT(&s->peripherals),
&error_abort); &error_abort);
object_property_add_alias(obj, "board-rev", OBJECT(&s->peripherals),
"board-rev", &error_abort);
qdev_set_parent_bus(DEVICE(&s->peripherals), sysbus_get_default()); qdev_set_parent_bus(DEVICE(&s->peripherals), sysbus_get_default());
} }

View File

@ -128,6 +128,8 @@ static void raspi2_init(MachineState *machine)
&error_abort); &error_abort);
object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus", object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
&error_abort); &error_abort);
object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev",
&error_abort);
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort);
setup_boot(machine, 2, machine->ram_size); setup_boot(machine, 2, machine->ram_size);

View File

@ -43,8 +43,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
resplen = 4; resplen = 4;
break; break;
case 0x00010002: /* Get board revision */ case 0x00010002: /* Get board revision */
qemu_log_mask(LOG_UNIMP, stl_phys(&s->dma_as, value + 12, s->board_rev);
"bcm2835_property: %x get board revision NYI\n", tag);
resplen = 4; resplen = 4;
break; break;
case 0x00010003: /* Get board MAC address */ case 0x00010003: /* Get board MAC address */
@ -258,6 +257,7 @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp)
} }
static Property bcm2835_property_props[] = { static Property bcm2835_property_props[] = {
DEFINE_PROP_UINT32("board-rev", BCM2835PropertyState, board_rev, 0),
DEFINE_PROP_UINT32("ram-size", BCM2835PropertyState, ram_size, 0), DEFINE_PROP_UINT32("ram-size", BCM2835PropertyState, ram_size, 0),
DEFINE_PROP_END_OF_LIST() DEFINE_PROP_END_OF_LIST()
}; };

View File

@ -23,6 +23,7 @@ typedef struct {
MemoryRegion iomem; MemoryRegion iomem;
qemu_irq mbox_irq; qemu_irq mbox_irq;
MACAddr macaddr; MACAddr macaddr;
uint32_t board_rev;
uint32_t ram_size; uint32_t ram_size;
uint32_t addr; uint32_t addr;
bool pending; bool pending;