2008-12-16 11:44:14 +01:00
|
|
|
/*
|
2012-04-07 09:23:39 +02:00
|
|
|
* QEMU PowerPC 440 Bamboo board emulation
|
2008-12-16 11:44:14 +01:00
|
|
|
*
|
|
|
|
* Copyright 2007 IBM Corporation.
|
|
|
|
* Authors:
|
2012-01-10 16:49:22 +01:00
|
|
|
* Jerone Young <jyoung5@us.ibm.com>
|
|
|
|
* Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
|
|
|
|
* Hollis Blanchard <hollisb@us.ibm.com>
|
2008-12-16 11:44:14 +01:00
|
|
|
*
|
|
|
|
* This work is licensed under the GNU GPL license version 2 or later.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-01-26 19:16:58 +01:00
|
|
|
#include "qemu/osdep.h"
|
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 09:43:10 +01:00
|
|
|
#include "qemu/error-report.h"
|
2008-12-16 11:44:14 +01:00
|
|
|
#include "qemu-common.h"
|
2018-01-21 22:57:58 +01:00
|
|
|
#include "qemu/error-report.h"
|
2012-10-24 08:43:34 +02:00
|
|
|
#include "net/net.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/hw.h"
|
|
|
|
#include "hw/pci/pci.h"
|
|
|
|
#include "hw/boards.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/kvm.h"
|
2008-12-16 11:44:14 +01:00
|
|
|
#include "kvm_ppc.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/device_tree.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/loader.h"
|
2009-09-20 16:58:02 +02:00
|
|
|
#include "elf.h"
|
2012-12-17 18:19:49 +01:00
|
|
|
#include "exec/address-spaces.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/char/serial.h"
|
|
|
|
#include "hw/ppc/ppc.h"
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "ppc405.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/sysemu.h"
|
2018-01-21 22:57:58 +01:00
|
|
|
#include "sysemu/qtest.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/sysbus.h"
|
2008-12-16 11:44:14 +01:00
|
|
|
|
|
|
|
#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
|
|
|
|
|
2010-08-05 02:21:37 +02:00
|
|
|
/* from u-boot */
|
|
|
|
#define KERNEL_ADDR 0x1000000
|
|
|
|
#define FDT_ADDR 0x1800000
|
|
|
|
#define RAMDISK_ADDR 0x1900000
|
|
|
|
|
2012-01-10 19:39:38 +01: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
|
|
|
|
|
|
|
|
#define PPC440EP_SDRAM_NR_BANKS 4
|
|
|
|
|
|
|
|
static const unsigned int ppc440ep_sdram_bank_sizes[] = {
|
|
|
|
256<<20, 128<<20, 64<<20, 32<<20, 16<<20, 8<<20, 0
|
|
|
|
};
|
|
|
|
|
2012-10-23 12:30:10 +02:00
|
|
|
static hwaddr entry;
|
2012-01-03 19:10:02 +01:00
|
|
|
|
2012-10-23 12:30:10 +02:00
|
|
|
static int bamboo_load_device_tree(hwaddr addr,
|
2008-12-16 11:44:14 +01:00
|
|
|
uint32_t ramsize,
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr initrd_base,
|
|
|
|
hwaddr initrd_size,
|
2008-12-16 11:44:14 +01:00
|
|
|
const char *kernel_cmdline)
|
|
|
|
{
|
2010-02-27 19:47:22 +01:00
|
|
|
int ret = -1;
|
2012-10-06 02:02:05 +02:00
|
|
|
uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(ramsize) };
|
2009-05-30 01:52:44 +02:00
|
|
|
char *filename;
|
2009-04-10 18:23:59 +02:00
|
|
|
int fdt_size;
|
2010-02-27 19:47:22 +01:00
|
|
|
void *fdt;
|
2011-07-21 02:44:53 +02:00
|
|
|
uint32_t tb_freq = 400000000;
|
|
|
|
uint32_t clock_freq = 400000000;
|
2008-12-16 11:44:14 +01:00
|
|
|
|
2009-05-30 01:52:44 +02:00
|
|
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
|
|
|
|
if (!filename) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
fdt = load_device_tree(filename, &fdt_size);
|
2011-08-21 05:09:37 +02:00
|
|
|
g_free(filename);
|
2009-05-30 01:52:44 +02:00
|
|
|
if (fdt == NULL) {
|
2008-12-16 11:44:14 +01:00
|
|
|
goto out;
|
2009-05-30 01:52:44 +02:00
|
|
|
}
|
2008-12-16 11:44:14 +01:00
|
|
|
|
|
|
|
/* Manipulate device tree in memory. */
|
|
|
|
|
2013-11-11 09:14:41 +01:00
|
|
|
ret = qemu_fdt_setprop(fdt, "/memory", "reg", mem_reg_property,
|
|
|
|
sizeof(mem_reg_property));
|
2008-12-16 11:44:14 +01:00
|
|
|
if (ret < 0)
|
|
|
|
fprintf(stderr, "couldn't set /memory/reg\n");
|
|
|
|
|
2013-11-11 09:14:41 +01:00
|
|
|
ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start",
|
|
|
|
initrd_base);
|
2008-12-16 11:44:14 +01:00
|
|
|
if (ret < 0)
|
|
|
|
fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n");
|
|
|
|
|
2013-11-11 09:14:41 +01:00
|
|
|
ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
|
|
|
|
(initrd_base + initrd_size));
|
2008-12-16 11:44:14 +01:00
|
|
|
if (ret < 0)
|
|
|
|
fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n");
|
|
|
|
|
2013-11-11 09:14:41 +01:00
|
|
|
ret = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
|
|
|
|
kernel_cmdline);
|
2008-12-16 11:44:14 +01:00
|
|
|
if (ret < 0)
|
|
|
|
fprintf(stderr, "couldn't set /chosen/bootargs\n");
|
|
|
|
|
2011-07-21 02:44:53 +02:00
|
|
|
/* Copy data from the host device tree into the guest. Since the guest can
|
|
|
|
* directly access the timebase without host involvement, we must expose
|
|
|
|
* the correct frequencies. */
|
2011-07-21 02:08:10 +02:00
|
|
|
if (kvm_enabled()) {
|
2011-07-21 02:44:53 +02:00
|
|
|
tb_freq = kvmppc_get_tbfreq();
|
|
|
|
clock_freq = kvmppc_get_clockfreq();
|
2011-07-21 02:08:10 +02:00
|
|
|
}
|
2008-12-16 11:44:14 +01:00
|
|
|
|
2013-11-11 09:14:41 +01: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 11:44:14 +01:00
|
|
|
|
2013-11-10 10:53:30 +01:00
|
|
|
rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr);
|
2011-08-21 05:09:37 +02:00
|
|
|
g_free(fdt);
|
2013-11-10 10:53:30 +01:00
|
|
|
return 0;
|
2009-04-10 18:23:59 +02:00
|
|
|
|
2008-12-16 11:44:14 +01:00
|
|
|
out:
|
|
|
|
|
2010-02-02 09:49:02 +01:00
|
|
|
return ret;
|
2008-12-16 11:44:14 +01:00
|
|
|
}
|
|
|
|
|
2012-01-03 19:12:47 +01:00
|
|
|
/* Create reset TLB entries for BookE, spanning the 32bit addr space. */
|
2012-03-14 01:38:23 +01:00
|
|
|
static void mmubooke_create_initial_mapping(CPUPPCState *env,
|
2012-01-03 19:12:47 +01:00
|
|
|
target_ulong va,
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr pa)
|
2012-01-03 19:12:47 +01: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 17:00:37 +01:00
|
|
|
tlb->size = 1U << 31; /* up to 0x80000000 */
|
2012-01-03 19:12:47 +01: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 17:00:37 +01:00
|
|
|
tlb->size = 1U << 31; /* up to 0xffffffff */
|
2012-01-03 19:12:47 +01:00
|
|
|
tlb->EPN = 0x80000000 & TARGET_PAGE_MASK;
|
|
|
|
tlb->RPN = 0x80000000 & TARGET_PAGE_MASK;
|
|
|
|
tlb->PID = 0;
|
|
|
|
}
|
|
|
|
|
2012-01-03 19:10:02 +01:00
|
|
|
static void main_cpu_reset(void *opaque)
|
|
|
|
{
|
2012-05-04 16:39:39 +02:00
|
|
|
PowerPCCPU *cpu = opaque;
|
|
|
|
CPUPPCState *env = &cpu->env;
|
2012-01-03 19:10:02 +01:00
|
|
|
|
2012-05-04 16:39:39 +02:00
|
|
|
cpu_reset(CPU(cpu));
|
2012-01-03 19:10:02 +01:00
|
|
|
env->gpr[1] = (16<<20) - 8;
|
|
|
|
env->gpr[3] = FDT_ADDR;
|
|
|
|
env->nip = entry;
|
2012-01-03 19:12:47 +01:00
|
|
|
|
|
|
|
/* Create a mapping for the kernel. */
|
|
|
|
mmubooke_create_initial_mapping(env, 0, 0);
|
2012-01-03 19:10:02 +01:00
|
|
|
}
|
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
static void bamboo_init(MachineState *machine)
|
2008-12-16 11:44:14 +01:00
|
|
|
{
|
2014-05-07 16:42:57 +02:00
|
|
|
ram_addr_t ram_size = machine->ram_size;
|
|
|
|
const char *kernel_filename = machine->kernel_filename;
|
|
|
|
const char *kernel_cmdline = machine->kernel_cmdline;
|
|
|
|
const char *initrd_filename = machine->initrd_filename;
|
2008-12-16 11:44:14 +01:00
|
|
|
unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 };
|
2011-08-12 01:07:18 +02:00
|
|
|
MemoryRegion *address_space_mem = get_system_memory();
|
2013-07-22 15:54:19 +02:00
|
|
|
MemoryRegion *isa = g_new(MemoryRegion, 1);
|
2012-01-10 20:11:25 +01:00
|
|
|
MemoryRegion *ram_memories
|
|
|
|
= g_malloc(PPC440EP_SDRAM_NR_BANKS * sizeof(*ram_memories));
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr ram_bases[PPC440EP_SDRAM_NR_BANKS];
|
|
|
|
hwaddr ram_sizes[PPC440EP_SDRAM_NR_BANKS];
|
2012-01-10 20:11:25 +01:00
|
|
|
qemu_irq *pic;
|
|
|
|
qemu_irq *irqs;
|
2008-12-16 11:44:14 +01:00
|
|
|
PCIBus *pcibus;
|
2012-05-04 16:35:51 +02:00
|
|
|
PowerPCCPU *cpu;
|
2012-03-14 01:38:23 +01:00
|
|
|
CPUPPCState *env;
|
2008-12-16 11:44:14 +01:00
|
|
|
uint64_t elf_entry;
|
|
|
|
uint64_t elf_lowaddr;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr loadaddr = 0;
|
2008-12-16 11:44:14 +01:00
|
|
|
target_long initrd_size = 0;
|
2012-01-10 20:11:25 +01:00
|
|
|
DeviceState *dev;
|
2010-08-05 02:21:37 +02:00
|
|
|
int success;
|
2008-12-16 11:44:14 +01:00
|
|
|
int i;
|
|
|
|
|
2017-10-09 21:50:54 +02:00
|
|
|
cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
|
2012-05-04 16:35:51 +02:00
|
|
|
env = &cpu->env;
|
2012-01-10 20:11:25 +01:00
|
|
|
|
2017-01-26 11:15:59 +01: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 09:43:10 +01:00
|
|
|
error_report("MMU model %i not supported by this machine",
|
|
|
|
env->mmu_model);
|
2017-01-26 11:15:59 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2018-01-21 22:57:58 +01:00
|
|
|
#ifdef TARGET_PPCEMB
|
|
|
|
if (!qtest_enabled()) {
|
|
|
|
warn_report("qemu-system-ppcemb is deprecated, "
|
|
|
|
"please use qemu-system-ppc instead.");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-05-04 16:39:39 +02:00
|
|
|
qemu_register_reset(main_cpu_reset, cpu);
|
2012-12-01 04:43:18 +01:00
|
|
|
ppc_booke_timers_init(cpu, 400000000, 0);
|
2012-01-10 20:11:25 +01:00
|
|
|
ppc_dcr_init(env, NULL, NULL);
|
|
|
|
|
|
|
|
/* interrupt controller */
|
|
|
|
irqs = g_malloc0(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB);
|
|
|
|
irqs[PPCUIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT];
|
|
|
|
irqs[PPCUIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT];
|
|
|
|
pic = ppcuic_init(env, irqs, 0x0C0, 0, 1);
|
|
|
|
|
|
|
|
/* SDRAM controller */
|
|
|
|
memset(ram_bases, 0, sizeof(ram_bases));
|
|
|
|
memset(ram_sizes, 0, sizeof(ram_sizes));
|
|
|
|
ram_size = ppc4xx_sdram_adjust(ram_size, PPC440EP_SDRAM_NR_BANKS,
|
|
|
|
ram_memories,
|
|
|
|
ram_bases, ram_sizes,
|
|
|
|
ppc440ep_sdram_bank_sizes);
|
|
|
|
/* XXX 440EP's ECC interrupts are on UIC1, but we've only created UIC0. */
|
|
|
|
ppc4xx_sdram_init(env, pic[14], PPC440EP_SDRAM_NR_BANKS, ram_memories,
|
|
|
|
ram_bases, ram_sizes, 1);
|
|
|
|
|
|
|
|
/* PCI */
|
2012-08-20 19:08:02 +02:00
|
|
|
dev = sysbus_create_varargs(TYPE_PPC4xx_PCI_HOST_BRIDGE,
|
|
|
|
PPC440EP_PCI_CONFIG,
|
2012-01-10 20:11:25 +01:00
|
|
|
pic[pci_irq_nrs[0]], pic[pci_irq_nrs[1]],
|
|
|
|
pic[pci_irq_nrs[2]], pic[pci_irq_nrs[3]],
|
|
|
|
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 09:43:10 +01:00
|
|
|
error_report("couldn't create PCI controller");
|
2012-01-10 20:11:25 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2013-07-22 15:54:19 +02: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 20:11:25 +01:00
|
|
|
|
2018-04-20 16:52:43 +02:00
|
|
|
if (serial_hd(0) != NULL) {
|
2012-01-10 20:11:25 +01:00
|
|
|
serial_mm_init(address_space_mem, 0xef600300, 0, pic[0],
|
2018-04-20 16:52:43 +02:00
|
|
|
PPC_SERIAL_MM_BAUDBASE, serial_hd(0),
|
2012-01-10 20:11:25 +01:00
|
|
|
DEVICE_BIG_ENDIAN);
|
|
|
|
}
|
2018-04-20 16:52:43 +02:00
|
|
|
if (serial_hd(1) != NULL) {
|
2012-01-10 20:11:25 +01:00
|
|
|
serial_mm_init(address_space_mem, 0xef600400, 0, pic[1],
|
2018-04-20 16:52:43 +02:00
|
|
|
PPC_SERIAL_MM_BAUDBASE, serial_hd(1),
|
2012-01-10 20:11:25 +01:00
|
|
|
DEVICE_BIG_ENDIAN);
|
|
|
|
}
|
2008-12-16 11:44:14 +01:00
|
|
|
|
|
|
|
if (pcibus) {
|
|
|
|
/* Register network interfaces. */
|
|
|
|
for (i = 0; i < nb_nics; i++) {
|
2009-01-13 20:47:10 +01:00
|
|
|
/* There are no PCI NICs on the Bamboo board, but there are
|
|
|
|
* PCI slots, so we can pick whatever default model we want. */
|
2013-06-06 10:48:51 +02:00
|
|
|
pci_nic_init_nofail(&nd_table[i], pcibus, "e1000", NULL);
|
2008-12-16 11:44:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load kernel. */
|
|
|
|
if (kernel_filename) {
|
2014-10-19 05:42:22 +02:00
|
|
|
success = load_uimage(kernel_filename, &entry, &loadaddr, NULL,
|
|
|
|
NULL, NULL);
|
2010-08-05 02:21:37 +02:00
|
|
|
if (success < 0) {
|
|
|
|
success = load_elf(kernel_filename, NULL, NULL, &elf_entry,
|
2016-03-04 12:30:21 +01:00
|
|
|
&elf_lowaddr, NULL, 1, PPC_ELF_MACHINE,
|
|
|
|
0, 0);
|
2008-12-16 11:44:14 +01:00
|
|
|
entry = elf_entry;
|
|
|
|
loadaddr = elf_lowaddr;
|
|
|
|
}
|
|
|
|
/* XXX try again as binary */
|
2010-08-05 02:21:37 +02: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 09:43:10 +01:00
|
|
|
error_report("could not load kernel '%s'", kernel_filename);
|
2008-12-16 11:44:14 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load initrd. */
|
|
|
|
if (initrd_filename) {
|
2010-08-05 02:21:37 +02:00
|
|
|
initrd_size = load_image_targphys(initrd_filename, RAMDISK_ADDR,
|
|
|
|
ram_size - RAMDISK_ADDR);
|
2008-12-16 11:44:14 +01: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 09:43:10 +01:00
|
|
|
error_report("could not load ram disk '%s' at %x",
|
|
|
|
initrd_filename, RAMDISK_ADDR);
|
2008-12-16 11:44:14 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we're loading a kernel directly, we must load the device tree too. */
|
|
|
|
if (kernel_filename) {
|
2010-08-05 02:21:37 +02:00
|
|
|
if (bamboo_load_device_tree(FDT_ADDR, ram_size, RAMDISK_ADDR,
|
|
|
|
initrd_size, kernel_cmdline) < 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 09:43:10 +01:00
|
|
|
error_report("couldn't load device tree");
|
2008-12-16 11:44:14 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-04 20:37:08 +02:00
|
|
|
static void bamboo_machine_init(MachineClass *mc)
|
2009-05-21 01:38:09 +02:00
|
|
|
{
|
2015-09-04 20:37:08 +02:00
|
|
|
mc->desc = "bamboo";
|
|
|
|
mc->init = bamboo_init;
|
2017-10-09 21:50:54 +02:00
|
|
|
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440epb");
|
2009-05-21 01:38:09 +02:00
|
|
|
}
|
|
|
|
|
2015-09-04 20:37:08 +02:00
|
|
|
DEFINE_MACHINE("bamboo", bamboo_machine_init)
|