提交 cdef10bb 编写于 作者: P Peter Maydell

hw/vexpress: Pass proc_id via VEDBoardInfo

Pass the daughterboard-specific proc_id property to the code that
creates the sysctl device via the VEDBoardInfo struct, rather than
by having the daughterboard init function write to a uint32_t*
argument. This is a cleaner way to pass the info around, and
is in line with the way we are going to handle voltage and
oscillator initialization.
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 dc0b0616
...@@ -147,19 +147,20 @@ typedef struct VEDBoardInfo VEDBoardInfo; ...@@ -147,19 +147,20 @@ typedef struct VEDBoardInfo VEDBoardInfo;
typedef void DBoardInitFn(const VEDBoardInfo *daughterboard, typedef void DBoardInitFn(const VEDBoardInfo *daughterboard,
ram_addr_t ram_size, ram_addr_t ram_size,
const char *cpu_model, const char *cpu_model,
qemu_irq *pic, uint32_t *proc_id); qemu_irq *pic);
struct VEDBoardInfo { struct VEDBoardInfo {
const hwaddr *motherboard_map; const hwaddr *motherboard_map;
hwaddr loader_start; hwaddr loader_start;
const hwaddr gic_cpu_if_addr; const hwaddr gic_cpu_if_addr;
uint32_t proc_id;
DBoardInitFn *init; DBoardInitFn *init;
}; };
static void a9_daughterboard_init(const VEDBoardInfo *daughterboard, static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
ram_addr_t ram_size, ram_addr_t ram_size,
const char *cpu_model, const char *cpu_model,
qemu_irq *pic, uint32_t *proc_id) qemu_irq *pic)
{ {
MemoryRegion *sysmem = get_system_memory(); MemoryRegion *sysmem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *ram = g_new(MemoryRegion, 1);
...@@ -175,8 +176,6 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard, ...@@ -175,8 +176,6 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
cpu_model = "cortex-a9"; cpu_model = "cortex-a9";
} }
*proc_id = 0x0c000191;
for (n = 0; n < smp_cpus; n++) { for (n = 0; n < smp_cpus; n++) {
ARMCPU *cpu = cpu_arm_init(cpu_model); ARMCPU *cpu = cpu_arm_init(cpu_model);
if (!cpu) { if (!cpu) {
...@@ -251,13 +250,14 @@ static const VEDBoardInfo a9_daughterboard = { ...@@ -251,13 +250,14 @@ static const VEDBoardInfo a9_daughterboard = {
.motherboard_map = motherboard_legacy_map, .motherboard_map = motherboard_legacy_map,
.loader_start = 0x60000000, .loader_start = 0x60000000,
.gic_cpu_if_addr = 0x1e000100, .gic_cpu_if_addr = 0x1e000100,
.proc_id = 0x0c000191,
.init = a9_daughterboard_init, .init = a9_daughterboard_init,
}; };
static void a15_daughterboard_init(const VEDBoardInfo *daughterboard, static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,
ram_addr_t ram_size, ram_addr_t ram_size,
const char *cpu_model, const char *cpu_model,
qemu_irq *pic, uint32_t *proc_id) qemu_irq *pic)
{ {
int n; int n;
MemoryRegion *sysmem = get_system_memory(); MemoryRegion *sysmem = get_system_memory();
...@@ -271,8 +271,6 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard, ...@@ -271,8 +271,6 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,
cpu_model = "cortex-a15"; cpu_model = "cortex-a15";
} }
*proc_id = 0x14000237;
for (n = 0; n < smp_cpus; n++) { for (n = 0; n < smp_cpus; n++) {
ARMCPU *cpu; ARMCPU *cpu;
qemu_irq *irqp; qemu_irq *irqp;
...@@ -344,6 +342,7 @@ static const VEDBoardInfo a15_daughterboard = { ...@@ -344,6 +342,7 @@ static const VEDBoardInfo a15_daughterboard = {
.motherboard_map = motherboard_aseries_map, .motherboard_map = motherboard_aseries_map,
.loader_start = 0x80000000, .loader_start = 0x80000000,
.gic_cpu_if_addr = 0x2c002000, .gic_cpu_if_addr = 0x2c002000,
.proc_id = 0x14000237,
.init = a15_daughterboard_init, .init = a15_daughterboard_init,
}; };
...@@ -352,7 +351,6 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, ...@@ -352,7 +351,6 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
{ {
DeviceState *dev, *sysctl, *pl041; DeviceState *dev, *sysctl, *pl041;
qemu_irq pic[64]; qemu_irq pic[64];
uint32_t proc_id;
uint32_t sys_id; uint32_t sys_id;
DriveInfo *dinfo; DriveInfo *dinfo;
ram_addr_t vram_size, sram_size; ram_addr_t vram_size, sram_size;
...@@ -361,8 +359,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, ...@@ -361,8 +359,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
MemoryRegion *sram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1);
const hwaddr *map = daughterboard->motherboard_map; const hwaddr *map = daughterboard->motherboard_map;
daughterboard->init(daughterboard, args->ram_size, args->cpu_model, daughterboard->init(daughterboard, args->ram_size, args->cpu_model, pic);
pic, &proc_id);
/* Motherboard peripherals: the wiring is the same but the /* Motherboard peripherals: the wiring is the same but the
* addresses vary between the legacy and A-Series memory maps. * addresses vary between the legacy and A-Series memory maps.
...@@ -372,7 +369,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, ...@@ -372,7 +369,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
sysctl = qdev_create(NULL, "realview_sysctl"); sysctl = qdev_create(NULL, "realview_sysctl");
qdev_prop_set_uint32(sysctl, "sys_id", sys_id); qdev_prop_set_uint32(sysctl, "sys_id", sys_id);
qdev_prop_set_uint32(sysctl, "proc_id", proc_id); qdev_prop_set_uint32(sysctl, "proc_id", daughterboard->proc_id);
qdev_init_nofail(sysctl); qdev_init_nofail(sysctl);
sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, map[VE_SYSREGS]); sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, map[VE_SYSREGS]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册