2008-12-16 13:44:14 +03:00
|
|
|
/*
|
2012-04-07 11:23:39 +04:00
|
|
|
* QEMU PowerPC 440 Bamboo board emulation
|
2008-12-16 13:44:14 +03:00
|
|
|
*
|
|
|
|
* Copyright 2007 IBM Corporation.
|
|
|
|
* Authors:
|
2022-04-12 05:12:41 +03:00
|
|
|
* Jerone Young <jyoung5@us.ibm.com>
|
|
|
|
* Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
|
|
|
|
* Hollis Blanchard <hollisb@us.ibm.com>
|
2008-12-16 13:44:14 +03:00
|
|
|
*
|
|
|
|
* This work is licensed under the GNU GPL license version 2 or later.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-01-26 21:16:58 +03:00
|
|
|
#include "qemu/osdep.h"
|
2018-06-25 15:42:24 +03:00
|
|
|
#include "qemu/units.h"
|
2020-10-28 14:36:57 +03:00
|
|
|
#include "qemu/datadir.h"
|
2018-01-22 00:57:58 +03:00
|
|
|
#include "qemu/error-report.h"
|
2012-10-24 10:43:34 +04:00
|
|
|
#include "net/net.h"
|
2013-02-04 18:40:22 +04:00
|
|
|
#include "hw/pci/pci.h"
|
|
|
|
#include "hw/boards.h"
|
2012-12-17 21:20:04 +04:00
|
|
|
#include "sysemu/kvm.h"
|
|
|
|
#include "sysemu/device_tree.h"
|
2013-02-04 18:40:22 +04:00
|
|
|
#include "hw/loader.h"
|
2009-09-20 18:58:02 +04:00
|
|
|
#include "elf.h"
|
2013-02-05 20:06:20 +04:00
|
|
|
#include "hw/char/serial.h"
|
|
|
|
#include "hw/ppc/ppc.h"
|
2012-12-17 21:20:04 +04:00
|
|
|
#include "sysemu/sysemu.h"
|
2019-08-12 08:23:38 +03:00
|
|
|
#include "sysemu/reset.h"
|
2013-02-04 18:40:22 +04:00
|
|
|
#include "hw/sysbus.h"
|
2020-12-12 03:15:33 +03:00
|
|
|
#include "hw/intc/ppc-uic.h"
|
|
|
|
#include "hw/qdev-properties.h"
|
|
|
|
#include "qapi/error.h"
|
2008-12-16 13:44:14 +03:00
|
|
|
|
2022-09-26 20:38:47 +03:00
|
|
|
#include <libfdt.h>
|
|
|
|
|
2008-12-16 13:44:14 +03:00
|
|
|
#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
|
|
|
|
|
2010-08-05 04:21:37 +04:00
|
|
|
/* from u-boot */
|
|
|
|
#define KERNEL_ADDR 0x1000000
|
|
|
|
#define FDT_ADDR 0x1800000
|
|
|
|
#define RAMDISK_ADDR 0x1900000
|
|
|
|
|
2012-01-10 22:39:38 +04:00
|
|
|
#define PPC440EP_PCI_CONFIG 0xeec00000
|
|
|
|
#define PPC440EP_PCI_INTACK 0xeed00000
|
|
|
|
#define PPC440EP_PCI_SPECIAL 0xeed00000
|
|
|
|
#define PPC440EP_PCI_REGS 0xef400000
|
|
|
|
#define PPC440EP_PCI_IO 0xe8000000
|
|
|
|
#define PPC440EP_PCI_IOLEN 0x00010000
|
|
|
|
|
2012-10-23 14:30:10 +04:00
|
|
|
static hwaddr entry;
|
2012-01-03 22:10:02 +04:00
|
|
|
|
2022-09-26 20:38:47 +03:00
|
|
|
static int bamboo_load_device_tree(MachineState *machine,
|
|
|
|
hwaddr addr,
|
|
|
|
hwaddr initrd_base,
|
|
|
|
hwaddr initrd_size)
|
2008-12-16 13:44:14 +03:00
|
|
|
{
|
2010-02-27 21:47:22 +03:00
|
|
|
int ret = -1;
|
2022-09-26 20:38:47 +03:00
|
|
|
uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(machine->ram_size) };
|
2009-05-30 03:52:44 +04:00
|
|
|
char *filename;
|
2009-04-10 20:23:59 +04:00
|
|
|
int fdt_size;
|
2010-02-27 21:47:22 +03:00
|
|
|
void *fdt;
|
2011-07-21 04:44:53 +04:00
|
|
|
uint32_t tb_freq = 400000000;
|
|
|
|
uint32_t clock_freq = 400000000;
|
2008-12-16 13:44:14 +03:00
|
|
|
|
2009-05-30 03:52:44 +04:00
|
|
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
|
|
|
|
if (!filename) {
|
2020-01-06 21:23:28 +03:00
|
|
|
return -1;
|
2009-05-30 03:52:44 +04:00
|
|
|
}
|
|
|
|
fdt = load_device_tree(filename, &fdt_size);
|
2011-08-21 07:09:37 +04:00
|
|
|
g_free(filename);
|
2009-05-30 03:52:44 +04:00
|
|
|
if (fdt == NULL) {
|
2020-01-06 21:23:28 +03:00
|
|
|
return -1;
|
2009-05-30 03:52:44 +04:00
|
|
|
}
|
2008-12-16 13:44:14 +03:00
|
|
|
|
|
|
|
/* Manipulate device tree in memory. */
|
|
|
|
|
2013-11-11 12:14:41 +04:00
|
|
|
ret = qemu_fdt_setprop(fdt, "/memory", "reg", mem_reg_property,
|
|
|
|
sizeof(mem_reg_property));
|
2022-08-17 18:08:43 +03:00
|
|
|
if (ret < 0) {
|
2008-12-16 13:44:14 +03:00
|
|
|
fprintf(stderr, "couldn't set /memory/reg\n");
|
2022-08-17 18:08:43 +03:00
|
|
|
}
|
2013-11-11 12:14:41 +04:00
|
|
|
ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start",
|
|
|
|
initrd_base);
|
2022-08-17 18:08:43 +03:00
|
|
|
if (ret < 0) {
|
2008-12-16 13:44:14 +03:00
|
|
|
fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n");
|
2022-08-17 18:08:43 +03:00
|
|
|
}
|
2013-11-11 12:14:41 +04:00
|
|
|
ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
|
|
|
|
(initrd_base + initrd_size));
|
2022-08-17 18:08:43 +03:00
|
|
|
if (ret < 0) {
|
2008-12-16 13:44:14 +03:00
|
|
|
fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n");
|
2022-08-17 18:08:43 +03:00
|
|
|
}
|
2013-11-11 12:14:41 +04:00
|
|
|
ret = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
|
2022-09-26 20:38:47 +03:00
|
|
|
machine->kernel_cmdline);
|
2022-08-17 18:08:43 +03:00
|
|
|
if (ret < 0) {
|
2008-12-16 13:44:14 +03:00
|
|
|
fprintf(stderr, "couldn't set /chosen/bootargs\n");
|
2022-08-17 18:08:43 +03:00
|
|
|
}
|
2008-12-16 13:44:14 +03:00
|
|
|
|
2013-11-11 12:14:41 +04:00
|
|
|
qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency",
|
|
|
|
clock_freq);
|
|
|
|
qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "timebase-frequency",
|
|
|
|
tb_freq);
|
2008-12-16 13:44:14 +03:00
|
|
|
|
2013-11-10 13:53:30 +04:00
|
|
|
rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr);
|
2022-09-26 20:38:47 +03:00
|
|
|
|
|
|
|
/* Set ms->fdt for 'dumpdtb' QMP/HMP command */
|
|
|
|
machine->fdt = fdt;
|
|
|
|
|
2013-11-10 13:53:30 +04:00
|
|
|
return 0;
|
2008-12-16 13:44:14 +03:00
|
|
|
}
|
|
|
|
|
2012-01-03 22:12:47 +04:00
|
|
|
/* Create reset TLB entries for BookE, spanning the 32bit addr space. */
|
2012-03-14 04:38:23 +04:00
|
|
|
static void mmubooke_create_initial_mapping(CPUPPCState *env,
|
2012-01-03 22:12:47 +04:00
|
|
|
target_ulong va,
|
2012-10-23 14:30:10 +04:00
|
|
|
hwaddr pa)
|
2012-01-03 22:12:47 +04:00
|
|
|
{
|
|
|
|
ppcemb_tlb_t *tlb = &env->tlb.tlbe[0];
|
|
|
|
|
|
|
|
tlb->attr = 0;
|
|
|
|
tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4);
|
2014-03-17 20:00:37 +04:00
|
|
|
tlb->size = 1U << 31; /* up to 0x80000000 */
|
2012-01-03 22:12:47 +04:00
|
|
|
tlb->EPN = va & TARGET_PAGE_MASK;
|
|
|
|
tlb->RPN = pa & TARGET_PAGE_MASK;
|
|
|
|
tlb->PID = 0;
|
|
|
|
|
|
|
|
tlb = &env->tlb.tlbe[1];
|
|
|
|
tlb->attr = 0;
|
|
|
|
tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4);
|
2014-03-17 20:00:37 +04:00
|
|
|
tlb->size = 1U << 31; /* up to 0xffffffff */
|
2012-01-03 22:12:47 +04:00
|
|
|
tlb->EPN = 0x80000000 & TARGET_PAGE_MASK;
|
|
|
|
tlb->RPN = 0x80000000 & TARGET_PAGE_MASK;
|
|
|
|
tlb->PID = 0;
|
|
|
|
}
|
|
|
|
|
2012-01-03 22:10:02 +04:00
|
|
|
static void main_cpu_reset(void *opaque)
|
|
|
|
{
|
2012-05-04 18:39:39 +04:00
|
|
|
PowerPCCPU *cpu = opaque;
|
|
|
|
CPUPPCState *env = &cpu->env;
|
2012-01-03 22:10:02 +04:00
|
|
|
|
2012-05-04 18:39:39 +04:00
|
|
|
cpu_reset(CPU(cpu));
|
2018-06-25 15:42:24 +03:00
|
|
|
env->gpr[1] = (16 * MiB) - 8;
|
2012-01-03 22:10:02 +04:00
|
|
|
env->gpr[3] = FDT_ADDR;
|
|
|
|
env->nip = entry;
|
2012-01-03 22:12:47 +04:00
|
|
|
|
|
|
|
/* Create a mapping for the kernel. */
|
|
|
|
mmubooke_create_initial_mapping(env, 0, 0);
|
2012-01-03 22:10:02 +04:00
|
|
|
}
|
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
static void bamboo_init(MachineState *machine)
|
2008-12-16 13:44:14 +03:00
|
|
|
{
|
2014-05-07 18:42:57 +04:00
|
|
|
const char *kernel_filename = machine->kernel_filename;
|
|
|
|
const char *initrd_filename = machine->initrd_filename;
|
2023-05-12 15:40:20 +03:00
|
|
|
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
2008-12-16 13:44:14 +03:00
|
|
|
unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 };
|
2011-08-12 03:07:18 +04:00
|
|
|
MemoryRegion *address_space_mem = get_system_memory();
|
2013-07-22 17:54:19 +04:00
|
|
|
MemoryRegion *isa = g_new(MemoryRegion, 1);
|
2008-12-16 13:44:14 +03:00
|
|
|
PCIBus *pcibus;
|
2012-05-04 18:35:51 +04:00
|
|
|
PowerPCCPU *cpu;
|
2012-03-14 04:38:23 +04:00
|
|
|
CPUPPCState *env;
|
2008-12-16 13:44:14 +03:00
|
|
|
target_long initrd_size = 0;
|
2012-01-10 23:11:25 +04:00
|
|
|
DeviceState *dev;
|
2020-12-12 03:15:33 +03:00
|
|
|
DeviceState *uicdev;
|
|
|
|
SysBusDevice *uicsbd;
|
2010-08-05 04:21:37 +04:00
|
|
|
int success;
|
2008-12-16 13:44:14 +03:00
|
|
|
|
2023-06-20 08:59:09 +03:00
|
|
|
if (kvm_enabled()) {
|
|
|
|
error_report("machine %s does not support the KVM accelerator",
|
|
|
|
MACHINE_GET_CLASS(machine)->name);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
2017-10-09 22:50:54 +03:00
|
|
|
cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
|
2012-05-04 18:35:51 +04:00
|
|
|
env = &cpu->env;
|
2012-01-10 23:11:25 +04:00
|
|
|
|
2017-01-26 13:15:59 +03:00
|
|
|
if (env->mmu_model != POWERPC_MMU_BOOKE) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 11:43:10 +03:00
|
|
|
error_report("MMU model %i not supported by this machine",
|
|
|
|
env->mmu_model);
|
2017-01-26 13:15:59 +03:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2012-05-04 18:39:39 +04:00
|
|
|
qemu_register_reset(main_cpu_reset, cpu);
|
2012-12-01 07:43:18 +04:00
|
|
|
ppc_booke_timers_init(cpu, 400000000, 0);
|
2012-01-10 23:11:25 +04:00
|
|
|
ppc_dcr_init(env, NULL, NULL);
|
|
|
|
|
|
|
|
/* interrupt controller */
|
2020-12-12 03:15:33 +03:00
|
|
|
uicdev = qdev_new(TYPE_PPC_UIC);
|
2022-08-17 18:08:35 +03:00
|
|
|
ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(uicdev), cpu, &error_fatal);
|
|
|
|
object_unref(OBJECT(uicdev));
|
2020-12-12 03:15:33 +03:00
|
|
|
uicsbd = SYS_BUS_DEVICE(uicdev);
|
|
|
|
sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_INT,
|
2022-07-05 17:58:11 +03:00
|
|
|
qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_INT));
|
2020-12-12 03:15:33 +03:00
|
|
|
sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT,
|
2022-07-05 17:58:11 +03:00
|
|
|
qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_CINT));
|
2012-01-10 23:11:25 +04:00
|
|
|
|
|
|
|
/* SDRAM controller */
|
2022-09-24 15:27:56 +03:00
|
|
|
dev = qdev_new(TYPE_PPC4xx_SDRAM_DDR);
|
|
|
|
object_property_set_link(OBJECT(dev), "dram", OBJECT(machine->ram),
|
|
|
|
&error_abort);
|
|
|
|
ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(dev), cpu, &error_fatal);
|
|
|
|
object_unref(OBJECT(dev));
|
2012-01-10 23:11:25 +04:00
|
|
|
/* XXX 440EP's ECC interrupts are on UIC1, but we've only created UIC0. */
|
2022-09-24 15:27:56 +03:00
|
|
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(uicdev, 14));
|
2022-09-24 15:27:52 +03:00
|
|
|
/* Enable SDRAM memory regions, this should be done by the firmware */
|
2022-09-24 15:28:02 +03:00
|
|
|
ppc4xx_sdram_ddr_enable(PPC4xx_SDRAM_DDR(dev));
|
2012-01-10 23:11:25 +04:00
|
|
|
|
|
|
|
/* PCI */
|
2023-07-06 14:16:43 +03:00
|
|
|
dev = sysbus_create_varargs(TYPE_PPC4xx_PCI_HOST, PPC440EP_PCI_CONFIG,
|
2020-12-12 03:15:33 +03:00
|
|
|
qdev_get_gpio_in(uicdev, pci_irq_nrs[0]),
|
|
|
|
qdev_get_gpio_in(uicdev, pci_irq_nrs[1]),
|
|
|
|
qdev_get_gpio_in(uicdev, pci_irq_nrs[2]),
|
|
|
|
qdev_get_gpio_in(uicdev, pci_irq_nrs[3]),
|
2012-01-10 23:11:25 +04:00
|
|
|
NULL);
|
|
|
|
pcibus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
|
|
|
|
if (!pcibus) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 11:43:10 +03:00
|
|
|
error_report("couldn't create PCI controller");
|
2012-01-10 23:11:25 +04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2013-07-22 17:54:19 +04:00
|
|
|
memory_region_init_alias(isa, NULL, "isa_mmio",
|
|
|
|
get_system_io(), 0, PPC440EP_PCI_IOLEN);
|
|
|
|
memory_region_add_subregion(get_system_memory(), PPC440EP_PCI_IO, isa);
|
2012-01-10 23:11:25 +04:00
|
|
|
|
2018-04-20 17:52:43 +03:00
|
|
|
if (serial_hd(0) != NULL) {
|
2020-12-12 03:15:33 +03:00
|
|
|
serial_mm_init(address_space_mem, 0xef600300, 0,
|
|
|
|
qdev_get_gpio_in(uicdev, 0),
|
2018-04-20 17:52:43 +03:00
|
|
|
PPC_SERIAL_MM_BAUDBASE, serial_hd(0),
|
2012-01-10 23:11:25 +04:00
|
|
|
DEVICE_BIG_ENDIAN);
|
|
|
|
}
|
2018-04-20 17:52:43 +03:00
|
|
|
if (serial_hd(1) != NULL) {
|
2020-12-12 03:15:33 +03:00
|
|
|
serial_mm_init(address_space_mem, 0xef600400, 0,
|
|
|
|
qdev_get_gpio_in(uicdev, 1),
|
2018-04-20 17:52:43 +03:00
|
|
|
PPC_SERIAL_MM_BAUDBASE, serial_hd(1),
|
2012-01-10 23:11:25 +04:00
|
|
|
DEVICE_BIG_ENDIAN);
|
|
|
|
}
|
2008-12-16 13:44:14 +03:00
|
|
|
|
|
|
|
if (pcibus) {
|
2023-10-23 11:37:19 +03:00
|
|
|
/*
|
|
|
|
* There are no PCI NICs on the Bamboo board, but there are
|
|
|
|
* PCI slots, so we can pick whatever default model we want.
|
|
|
|
*/
|
|
|
|
pci_init_nic_devices(pcibus, mc->default_nic);
|
2008-12-16 13:44:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Load kernel. */
|
|
|
|
if (kernel_filename) {
|
2020-07-05 20:22:11 +03:00
|
|
|
hwaddr loadaddr = LOAD_UIMAGE_LOADADDR_INVALID;
|
2014-10-19 07:42:22 +04:00
|
|
|
success = load_uimage(kernel_filename, &entry, &loadaddr, NULL,
|
|
|
|
NULL, NULL);
|
2010-08-05 04:21:37 +04:00
|
|
|
if (success < 0) {
|
2020-07-05 20:22:11 +03:00
|
|
|
uint64_t elf_entry;
|
2019-01-15 15:18:03 +03:00
|
|
|
success = load_elf(kernel_filename, NULL, NULL, NULL, &elf_entry,
|
2020-07-05 20:22:11 +03:00
|
|
|
NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
2008-12-16 13:44:14 +03:00
|
|
|
entry = elf_entry;
|
|
|
|
}
|
|
|
|
/* XXX try again as binary */
|
2010-08-05 04:21:37 +04:00
|
|
|
if (success < 0) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 11:43:10 +03:00
|
|
|
error_report("could not load kernel '%s'", kernel_filename);
|
2008-12-16 13:44:14 +03:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load initrd. */
|
|
|
|
if (initrd_filename) {
|
2010-08-05 04:21:37 +04:00
|
|
|
initrd_size = load_image_targphys(initrd_filename, RAMDISK_ADDR,
|
2020-02-19 19:09:39 +03:00
|
|
|
machine->ram_size - RAMDISK_ADDR);
|
2008-12-16 13:44:14 +03:00
|
|
|
|
|
|
|
if (initrd_size < 0) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 11:43:10 +03:00
|
|
|
error_report("could not load ram disk '%s' at %x",
|
|
|
|
initrd_filename, RAMDISK_ADDR);
|
2008-12-16 13:44:14 +03:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we're loading a kernel directly, we must load the device tree too. */
|
|
|
|
if (kernel_filename) {
|
2022-09-26 20:38:47 +03:00
|
|
|
if (bamboo_load_device_tree(machine, FDT_ADDR,
|
|
|
|
RAMDISK_ADDR, initrd_size) < 0) {
|
hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
Some lines were then manually tweaked to pass checkpatch and some curly
braces were added to match QEMU style.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-ppc@nongnu.org
Conversions that aren't followed by exit() dropped, because they might
be inappropriate.
Also trim trailing punctuation from error messages.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-10-armbru@redhat.com>
2018-02-03 11:43:10 +03:00
|
|
|
error_report("couldn't load device tree");
|
2008-12-16 13:44:14 +03:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-04 21:37:08 +03:00
|
|
|
static void bamboo_machine_init(MachineClass *mc)
|
2009-05-21 03:38:09 +04:00
|
|
|
{
|
2015-09-04 21:37:08 +03:00
|
|
|
mc->desc = "bamboo";
|
|
|
|
mc->init = bamboo_init;
|
2017-10-09 22:50:54 +03:00
|
|
|
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440epb");
|
2020-02-19 19:09:40 +03:00
|
|
|
mc->default_ram_id = "ppc4xx.sdram";
|
2023-05-12 15:40:20 +03:00
|
|
|
mc->default_nic = "e1000";
|
2009-05-21 03:38:09 +04:00
|
|
|
}
|
|
|
|
|
2015-09-04 21:37:08 +03:00
|
|
|
DEFINE_MACHINE("bamboo", bamboo_machine_init)
|