2013-12-17 23:42:38 +04:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2015-12-07 19:23:45 +03:00
|
|
|
#include "qemu/osdep.h"
|
include/qemu/osdep.h: Don't include qapi/error.h
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.
Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.
Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.
This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-14 11:01:28 +03:00
|
|
|
#include "qapi/error.h"
|
2016-01-19 23:51:44 +03:00
|
|
|
#include "qemu-common.h"
|
|
|
|
#include "cpu.h"
|
2013-12-17 23:42:38 +04:00
|
|
|
#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;
|
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
static void cubieboard_init(MachineState *machine)
|
2013-12-17 23:42:38 +04:00
|
|
|
{
|
|
|
|
CubieBoardState *s = g_new(CubieBoardState, 1);
|
|
|
|
Error *err = NULL;
|
|
|
|
|
|
|
|
s->a10 = AW_A10(object_new(TYPE_AW_A10));
|
2014-01-31 02:02:07 +04:00
|
|
|
|
|
|
|
object_property_set_int(OBJECT(&s->a10->emac), 1, "phy-addr", &err);
|
|
|
|
if (err != NULL) {
|
2015-12-18 18:35:14 +03:00
|
|
|
error_reportf_err(err, "Couldn't set phy address: ");
|
2014-01-31 02:02:07 +04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2014-03-25 22:22:08 +04:00
|
|
|
object_property_set_int(OBJECT(&s->a10->timer), 32768, "clk0-freq", &err);
|
|
|
|
if (err != NULL) {
|
2015-12-18 18:35:14 +03:00
|
|
|
error_reportf_err(err, "Couldn't set clk0 frequency: ");
|
2014-03-25 22:22:08 +04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
object_property_set_int(OBJECT(&s->a10->timer), 24000000, "clk1-freq",
|
|
|
|
&err);
|
|
|
|
if (err != NULL) {
|
2015-12-18 18:35:14 +03:00
|
|
|
error_reportf_err(err, "Couldn't set clk1 frequency: ");
|
2014-03-25 22:22:08 +04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2013-12-17 23:42:38 +04:00
|
|
|
object_property_set_bool(OBJECT(s->a10), true, "realized", &err);
|
|
|
|
if (err != NULL) {
|
2015-12-18 18:35:14 +03:00
|
|
|
error_reportf_err(err, "Couldn't realize Allwinner A10: ");
|
2013-12-17 23:42:38 +04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2015-04-04 15:24:38 +03:00
|
|
|
memory_region_allocate_system_memory(&s->sdram, NULL, "cubieboard.ram",
|
|
|
|
machine->ram_size);
|
2013-12-17 23:42:38 +04:00
|
|
|
memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
|
|
|
|
&s->sdram);
|
|
|
|
|
hw/arm/cubieboard hw/arm/xlnx-ep108: Fix units_per_default_bus
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>
2017-02-15 13:05:41 +03:00
|
|
|
/* TODO create and connect IDE devices for ide_drive_get() */
|
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
cubieboard_binfo.ram_size = machine->ram_size;
|
|
|
|
cubieboard_binfo.kernel_filename = machine->kernel_filename;
|
|
|
|
cubieboard_binfo.kernel_cmdline = machine->kernel_cmdline;
|
2016-10-28 16:12:31 +03:00
|
|
|
cubieboard_binfo.initrd_filename = machine->initrd_filename;
|
2013-12-17 23:42:38 +04:00
|
|
|
arm_load_kernel(&s->a10->cpu, &cubieboard_binfo);
|
|
|
|
}
|
|
|
|
|
2015-09-04 21:37:08 +03:00
|
|
|
static void cubieboard_machine_init(MachineClass *mc)
|
2013-12-17 23:42:38 +04:00
|
|
|
{
|
2015-09-04 21:37:08 +03:00
|
|
|
mc->desc = "cubietech cubieboard";
|
|
|
|
mc->init = cubieboard_init;
|
hw/arm/cubieboard hw/arm/xlnx-ep108: Fix units_per_default_bus
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>
2017-02-15 13:05:41 +03:00
|
|
|
mc->block_default_type = IF_IDE;
|
|
|
|
mc->units_per_default_bus = 1;
|
2013-12-17 23:42:38 +04:00
|
|
|
}
|
|
|
|
|
2015-09-04 21:37:08 +03:00
|
|
|
DEFINE_MACHINE("cubieboard", cubieboard_machine_init)
|