mirror of
https://github.com/qemu/qemu.git
synced 2024-12-02 08:13:34 +08:00
e0319b0302
Machine types cubieboard, xlnx-ep108, xlnx-zcu102 have an onboard AHCI controller, but neglect to set their MachineClass member units_per_default_bus = 1. This permits -drive if=ide,unit=1, which makes no sense for AHCI. It also screws up index=N for odd N, because it gets desugared to unit=1,bus=N/2 Doesn't really matter, because these machine types fail to honor -drive if=ide. Add the missing units_per_default_bus = 1 anyway, along with a TODO comment on what needs to be done for -drive if=ide. Also set block_default_type = IF_IDE explicitly. It's currently the default, but the next commit will change it to something more sensible, and we want to keep the IF_IDE default for these three machines. See also the previous commit. Cc: Beniamino Galvani <b.galvani@gmail.com> Cc: Alistair Francis <alistair.francis@xilinx.com> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Alistair Francis <alistair.francis@xilinx.com> Message-Id: <1487153147-11530-3-git-send-email-armbru@redhat.com>
92 lines
2.8 KiB
C
92 lines
2.8 KiB
C
/*
|
|
* cubieboard emulation
|
|
*
|
|
* Copyright (C) 2013 Li Guang
|
|
* Written by Li Guang <lig.fnst@cn.fujitsu.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* for more details.
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "qapi/error.h"
|
|
#include "qemu-common.h"
|
|
#include "cpu.h"
|
|
#include "hw/sysbus.h"
|
|
#include "hw/devices.h"
|
|
#include "hw/boards.h"
|
|
#include "hw/arm/allwinner-a10.h"
|
|
|
|
static struct arm_boot_info cubieboard_binfo = {
|
|
.loader_start = AW_A10_SDRAM_BASE,
|
|
.board_id = 0x1008,
|
|
};
|
|
|
|
typedef struct CubieBoardState {
|
|
AwA10State *a10;
|
|
MemoryRegion sdram;
|
|
} CubieBoardState;
|
|
|
|
static void cubieboard_init(MachineState *machine)
|
|
{
|
|
CubieBoardState *s = g_new(CubieBoardState, 1);
|
|
Error *err = NULL;
|
|
|
|
s->a10 = AW_A10(object_new(TYPE_AW_A10));
|
|
|
|
object_property_set_int(OBJECT(&s->a10->emac), 1, "phy-addr", &err);
|
|
if (err != NULL) {
|
|
error_reportf_err(err, "Couldn't set phy address: ");
|
|
exit(1);
|
|
}
|
|
|
|
object_property_set_int(OBJECT(&s->a10->timer), 32768, "clk0-freq", &err);
|
|
if (err != NULL) {
|
|
error_reportf_err(err, "Couldn't set clk0 frequency: ");
|
|
exit(1);
|
|
}
|
|
|
|
object_property_set_int(OBJECT(&s->a10->timer), 24000000, "clk1-freq",
|
|
&err);
|
|
if (err != NULL) {
|
|
error_reportf_err(err, "Couldn't set clk1 frequency: ");
|
|
exit(1);
|
|
}
|
|
|
|
object_property_set_bool(OBJECT(s->a10), true, "realized", &err);
|
|
if (err != NULL) {
|
|
error_reportf_err(err, "Couldn't realize Allwinner A10: ");
|
|
exit(1);
|
|
}
|
|
|
|
memory_region_allocate_system_memory(&s->sdram, NULL, "cubieboard.ram",
|
|
machine->ram_size);
|
|
memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
|
|
&s->sdram);
|
|
|
|
/* TODO create and connect IDE devices for ide_drive_get() */
|
|
|
|
cubieboard_binfo.ram_size = machine->ram_size;
|
|
cubieboard_binfo.kernel_filename = machine->kernel_filename;
|
|
cubieboard_binfo.kernel_cmdline = machine->kernel_cmdline;
|
|
cubieboard_binfo.initrd_filename = machine->initrd_filename;
|
|
arm_load_kernel(&s->a10->cpu, &cubieboard_binfo);
|
|
}
|
|
|
|
static void cubieboard_machine_init(MachineClass *mc)
|
|
{
|
|
mc->desc = "cubietech cubieboard";
|
|
mc->init = cubieboard_init;
|
|
mc->block_default_type = IF_IDE;
|
|
mc->units_per_default_bus = 1;
|
|
}
|
|
|
|
DEFINE_MACHINE("cubieboard", cubieboard_machine_init)
|