2011-02-17 23:45:14 +01:00
|
|
|
/*
|
|
|
|
* QEMU models for LatticeMico32 uclinux and evr32 boards.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010 Michael Walle <michael@walle.cc>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-01-26 19:16:57 +01:00
|
|
|
#include "qemu/osdep.h"
|
2018-06-25 14:42:19 +02:00
|
|
|
#include "qemu/units.h"
|
hw/lm32: 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 where then manually tweaked to pass checkpatch.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: Michael Walle <michael@walle.cc>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-5-armbru@redhat.com>
2018-02-03 09:43:05 +01:00
|
|
|
#include "qemu/error-report.h"
|
2016-01-19 21:51:44 +01:00
|
|
|
#include "qemu-common.h"
|
|
|
|
#include "cpu.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/sysbus.h"
|
|
|
|
#include "hw/hw.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/block/flash.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/boards.h"
|
|
|
|
#include "hw/loader.h"
|
2011-02-17 23:45:14 +01:00
|
|
|
#include "elf.h"
|
2013-03-18 17:36:02 +01:00
|
|
|
#include "lm32_hwsetup.h"
|
|
|
|
#include "lm32.h"
|
2012-12-17 18:19:49 +01:00
|
|
|
#include "exec/address-spaces.h"
|
2016-05-25 08:39:02 +02:00
|
|
|
#include "sysemu/sysemu.h"
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
typedef struct {
|
2012-05-04 19:00:34 +02:00
|
|
|
LM32CPU *cpu;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr bootstrap_pc;
|
|
|
|
hwaddr flash_base;
|
|
|
|
hwaddr hwsetup_base;
|
|
|
|
hwaddr initrd_base;
|
2011-02-17 23:45:14 +01:00
|
|
|
size_t initrd_size;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr cmdline_base;
|
2011-02-17 23:45:14 +01:00
|
|
|
} ResetInfo;
|
|
|
|
|
|
|
|
static void cpu_irq_handler(void *opaque, int irq, int level)
|
|
|
|
{
|
2013-01-17 22:30:20 +01:00
|
|
|
LM32CPU *cpu = opaque;
|
|
|
|
CPUState *cs = CPU(cpu);
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
if (level) {
|
2013-01-18 15:03:43 +01:00
|
|
|
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
|
2011-02-17 23:45:14 +01:00
|
|
|
} else {
|
2013-01-17 22:30:20 +01:00
|
|
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
2011-02-17 23:45:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_cpu_reset(void *opaque)
|
|
|
|
{
|
|
|
|
ResetInfo *reset_info = opaque;
|
2012-05-04 19:00:34 +02:00
|
|
|
CPULM32State *env = &reset_info->cpu->env;
|
2011-02-17 23:45:14 +01:00
|
|
|
|
2012-05-04 19:00:34 +02:00
|
|
|
cpu_reset(CPU(reset_info->cpu));
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
/* init defaults */
|
|
|
|
env->pc = (uint32_t)reset_info->bootstrap_pc;
|
|
|
|
env->regs[R_R1] = (uint32_t)reset_info->hwsetup_base;
|
|
|
|
env->regs[R_R2] = (uint32_t)reset_info->cmdline_base;
|
|
|
|
env->regs[R_R3] = (uint32_t)reset_info->initrd_base;
|
|
|
|
env->regs[R_R4] = (uint32_t)(reset_info->initrd_base +
|
|
|
|
reset_info->initrd_size);
|
|
|
|
env->eba = reset_info->flash_base;
|
|
|
|
env->deba = reset_info->flash_base;
|
|
|
|
}
|
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
static void lm32_evr_init(MachineState *machine)
|
2011-02-17 23:45:14 +01:00
|
|
|
{
|
2014-05-07 16:42:57 +02:00
|
|
|
const char *kernel_filename = machine->kernel_filename;
|
2012-05-04 18:55:25 +02:00
|
|
|
LM32CPU *cpu;
|
2012-03-14 01:38:23 +01:00
|
|
|
CPULM32State *env;
|
2011-02-17 23:45:14 +01:00
|
|
|
DriveInfo *dinfo;
|
2011-08-08 20:05:07 +02:00
|
|
|
MemoryRegion *address_space_mem = get_system_memory();
|
|
|
|
MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
|
2015-05-29 07:27:06 +02:00
|
|
|
qemu_irq irq[32];
|
2011-02-17 23:45:14 +01:00
|
|
|
ResetInfo *reset_info;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* memory map */
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr flash_base = 0x04000000;
|
2018-06-25 14:42:19 +02:00
|
|
|
size_t flash_sector_size = 256 * KiB;
|
|
|
|
size_t flash_size = 32 * MiB;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr ram_base = 0x08000000;
|
2018-06-25 14:42:19 +02:00
|
|
|
size_t ram_size = 64 * MiB;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr timer0_base = 0x80002000;
|
|
|
|
hwaddr uart0_base = 0x80006000;
|
|
|
|
hwaddr timer1_base = 0x8000a000;
|
2011-02-17 23:45:14 +01:00
|
|
|
int uart0_irq = 0;
|
|
|
|
int timer0_irq = 1;
|
|
|
|
int timer1_irq = 3;
|
|
|
|
|
2011-08-21 05:09:37 +02:00
|
|
|
reset_info = g_malloc0(sizeof(ResetInfo));
|
2011-02-17 23:45:14 +01:00
|
|
|
|
2017-10-05 15:50:44 +02:00
|
|
|
cpu = LM32_CPU(cpu_create(machine->cpu_type));
|
2013-11-28 19:09:33 +01:00
|
|
|
|
2012-05-04 18:55:25 +02:00
|
|
|
env = &cpu->env;
|
2012-05-04 19:00:34 +02:00
|
|
|
reset_info->cpu = cpu;
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
reset_info->flash_base = flash_base;
|
|
|
|
|
2015-04-04 14:16:18 +02:00
|
|
|
memory_region_allocate_system_memory(phys_ram, NULL, "lm32_evr.sdram",
|
|
|
|
ram_size);
|
2011-08-08 20:05:07 +02:00
|
|
|
memory_region_add_subregion(address_space_mem, ram_base, phys_ram);
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
dinfo = drive_get(IF_PFLASH, 0, 0);
|
|
|
|
/* Spansion S29NS128P */
|
2019-03-08 10:46:09 +01:00
|
|
|
pflash_cfi02_register(flash_base, "lm32_evr.flash", flash_size,
|
2014-10-07 13:59:18 +02:00
|
|
|
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
|
2019-03-08 10:46:10 +01:00
|
|
|
flash_sector_size,
|
2014-10-07 13:59:13 +02:00
|
|
|
1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
/* create irq lines */
|
2015-05-29 07:27:06 +02:00
|
|
|
env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0));
|
2011-02-17 23:45:14 +01:00
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
irq[i] = qdev_get_gpio_in(env->pic_state, i);
|
|
|
|
}
|
|
|
|
|
2018-04-20 16:52:43 +02:00
|
|
|
lm32_uart_create(uart0_base, irq[uart0_irq], serial_hd(0));
|
2011-02-17 23:45:14 +01:00
|
|
|
sysbus_create_simple("lm32-timer", timer0_base, irq[timer0_irq]);
|
|
|
|
sysbus_create_simple("lm32-timer", timer1_base, irq[timer1_irq]);
|
|
|
|
|
|
|
|
/* make sure juart isn't the first chardev */
|
2018-04-20 16:52:43 +02:00
|
|
|
env->juart_state = lm32_juart_init(serial_hd(1));
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
reset_info->bootstrap_pc = flash_base;
|
|
|
|
|
|
|
|
if (kernel_filename) {
|
|
|
|
uint64_t entry;
|
|
|
|
int kernel_size;
|
|
|
|
|
2019-01-15 13:18:03 +01:00
|
|
|
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
|
|
|
&entry, NULL, NULL,
|
2016-03-04 12:30:21 +01:00
|
|
|
1, EM_LATTICEMICO32, 0, 0);
|
2011-02-17 23:45:14 +01:00
|
|
|
reset_info->bootstrap_pc = entry;
|
|
|
|
|
|
|
|
if (kernel_size < 0) {
|
|
|
|
kernel_size = load_image_targphys(kernel_filename, ram_base,
|
|
|
|
ram_size);
|
|
|
|
reset_info->bootstrap_pc = ram_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kernel_size < 0) {
|
hw/lm32: 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 where then manually tweaked to pass checkpatch.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: Michael Walle <michael@walle.cc>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-5-armbru@redhat.com>
2018-02-03 09:43:05 +01:00
|
|
|
error_report("could not load kernel '%s'", kernel_filename);
|
2011-02-17 23:45:14 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qemu_register_reset(main_cpu_reset, reset_info);
|
|
|
|
}
|
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
static void lm32_uclinux_init(MachineState *machine)
|
2011-02-17 23:45:14 +01:00
|
|
|
{
|
2014-05-07 16:42:57 +02:00
|
|
|
const char *kernel_filename = machine->kernel_filename;
|
|
|
|
const char *kernel_cmdline = machine->kernel_cmdline;
|
|
|
|
const char *initrd_filename = machine->initrd_filename;
|
2012-05-04 18:55:25 +02:00
|
|
|
LM32CPU *cpu;
|
2012-03-14 01:38:23 +01:00
|
|
|
CPULM32State *env;
|
2011-02-17 23:45:14 +01:00
|
|
|
DriveInfo *dinfo;
|
2011-08-08 20:05:07 +02:00
|
|
|
MemoryRegion *address_space_mem = get_system_memory();
|
|
|
|
MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
|
2015-05-29 07:27:06 +02:00
|
|
|
qemu_irq irq[32];
|
2011-02-17 23:45:14 +01:00
|
|
|
HWSetup *hw;
|
|
|
|
ResetInfo *reset_info;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* memory map */
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr flash_base = 0x04000000;
|
2018-06-25 14:42:19 +02:00
|
|
|
size_t flash_sector_size = 256 * KiB;
|
|
|
|
size_t flash_size = 32 * MiB;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr ram_base = 0x08000000;
|
2018-06-25 14:42:19 +02:00
|
|
|
size_t ram_size = 64 * MiB;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr uart0_base = 0x80000000;
|
|
|
|
hwaddr timer0_base = 0x80002000;
|
|
|
|
hwaddr timer1_base = 0x80010000;
|
|
|
|
hwaddr timer2_base = 0x80012000;
|
2011-02-17 23:45:14 +01:00
|
|
|
int uart0_irq = 0;
|
|
|
|
int timer0_irq = 1;
|
|
|
|
int timer1_irq = 20;
|
|
|
|
int timer2_irq = 21;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr hwsetup_base = 0x0bffe000;
|
|
|
|
hwaddr cmdline_base = 0x0bfff000;
|
|
|
|
hwaddr initrd_base = 0x08400000;
|
2011-02-17 23:45:14 +01:00
|
|
|
size_t initrd_max = 0x01000000;
|
|
|
|
|
2011-08-21 05:09:37 +02:00
|
|
|
reset_info = g_malloc0(sizeof(ResetInfo));
|
2011-02-17 23:45:14 +01:00
|
|
|
|
2017-10-05 15:50:44 +02:00
|
|
|
cpu = LM32_CPU(cpu_create(machine->cpu_type));
|
2013-11-28 19:09:33 +01:00
|
|
|
|
2012-05-04 18:55:25 +02:00
|
|
|
env = &cpu->env;
|
2012-05-04 19:00:34 +02:00
|
|
|
reset_info->cpu = cpu;
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
reset_info->flash_base = flash_base;
|
|
|
|
|
2015-04-04 14:16:18 +02:00
|
|
|
memory_region_allocate_system_memory(phys_ram, NULL,
|
|
|
|
"lm32_uclinux.sdram", ram_size);
|
2011-08-08 20:05:07 +02:00
|
|
|
memory_region_add_subregion(address_space_mem, ram_base, phys_ram);
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
dinfo = drive_get(IF_PFLASH, 0, 0);
|
|
|
|
/* Spansion S29NS128P */
|
2019-03-08 10:46:09 +01:00
|
|
|
pflash_cfi02_register(flash_base, "lm32_uclinux.flash", flash_size,
|
2014-10-07 13:59:18 +02:00
|
|
|
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
|
2019-03-08 10:46:10 +01:00
|
|
|
flash_sector_size,
|
2014-10-07 13:59:13 +02:00
|
|
|
1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
/* create irq lines */
|
2015-05-29 07:27:06 +02:00
|
|
|
env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, env, 0));
|
2011-02-17 23:45:14 +01:00
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
irq[i] = qdev_get_gpio_in(env->pic_state, i);
|
|
|
|
}
|
|
|
|
|
2018-04-20 16:52:43 +02:00
|
|
|
lm32_uart_create(uart0_base, irq[uart0_irq], serial_hd(0));
|
2011-02-17 23:45:14 +01:00
|
|
|
sysbus_create_simple("lm32-timer", timer0_base, irq[timer0_irq]);
|
|
|
|
sysbus_create_simple("lm32-timer", timer1_base, irq[timer1_irq]);
|
|
|
|
sysbus_create_simple("lm32-timer", timer2_base, irq[timer2_irq]);
|
|
|
|
|
|
|
|
/* make sure juart isn't the first chardev */
|
2018-04-20 16:52:43 +02:00
|
|
|
env->juart_state = lm32_juart_init(serial_hd(1));
|
2011-02-17 23:45:14 +01:00
|
|
|
|
|
|
|
reset_info->bootstrap_pc = flash_base;
|
|
|
|
|
|
|
|
if (kernel_filename) {
|
|
|
|
uint64_t entry;
|
|
|
|
int kernel_size;
|
|
|
|
|
2019-01-15 13:18:03 +01:00
|
|
|
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
|
|
|
&entry, NULL, NULL,
|
2016-03-04 12:30:21 +01:00
|
|
|
1, EM_LATTICEMICO32, 0, 0);
|
2011-02-17 23:45:14 +01:00
|
|
|
reset_info->bootstrap_pc = entry;
|
|
|
|
|
|
|
|
if (kernel_size < 0) {
|
|
|
|
kernel_size = load_image_targphys(kernel_filename, ram_base,
|
|
|
|
ram_size);
|
|
|
|
reset_info->bootstrap_pc = ram_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kernel_size < 0) {
|
hw/lm32: 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 where then manually tweaked to pass checkpatch.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: Michael Walle <michael@walle.cc>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-5-armbru@redhat.com>
2018-02-03 09:43:05 +01:00
|
|
|
error_report("could not load kernel '%s'", kernel_filename);
|
2011-02-17 23:45:14 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* generate a rom with the hardware description */
|
|
|
|
hw = hwsetup_init();
|
|
|
|
hwsetup_add_cpu(hw, "LM32", 75000000);
|
|
|
|
hwsetup_add_flash(hw, "flash", flash_base, flash_size);
|
|
|
|
hwsetup_add_ddr_sdram(hw, "ddr_sdram", ram_base, ram_size);
|
|
|
|
hwsetup_add_timer(hw, "timer0", timer0_base, timer0_irq);
|
|
|
|
hwsetup_add_timer(hw, "timer1_dev_only", timer1_base, timer1_irq);
|
|
|
|
hwsetup_add_timer(hw, "timer2_dev_only", timer2_base, timer2_irq);
|
|
|
|
hwsetup_add_uart(hw, "uart", uart0_base, uart0_irq);
|
|
|
|
hwsetup_add_trailer(hw);
|
|
|
|
hwsetup_create_rom(hw, hwsetup_base);
|
|
|
|
hwsetup_free(hw);
|
|
|
|
|
|
|
|
reset_info->hwsetup_base = hwsetup_base;
|
|
|
|
|
|
|
|
if (kernel_cmdline && strlen(kernel_cmdline)) {
|
|
|
|
pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE,
|
|
|
|
kernel_cmdline);
|
|
|
|
reset_info->cmdline_base = cmdline_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (initrd_filename) {
|
|
|
|
size_t initrd_size;
|
|
|
|
initrd_size = load_image_targphys(initrd_filename, initrd_base,
|
|
|
|
initrd_max);
|
|
|
|
reset_info->initrd_base = initrd_base;
|
|
|
|
reset_info->initrd_size = initrd_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
qemu_register_reset(main_cpu_reset, reset_info);
|
|
|
|
}
|
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static void lm32_evr_class_init(ObjectClass *oc, void *data)
|
2011-02-17 23:45:14 +01:00
|
|
|
{
|
2015-09-19 10:49:44 +02:00
|
|
|
MachineClass *mc = MACHINE_CLASS(oc);
|
|
|
|
|
2015-09-04 20:37:08 +02:00
|
|
|
mc->desc = "LatticeMico32 EVR32 eval system";
|
|
|
|
mc->init = lm32_evr_init;
|
|
|
|
mc->is_default = 1;
|
2017-10-05 15:50:44 +02:00
|
|
|
mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
|
2011-02-17 23:45:14 +01:00
|
|
|
}
|
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static const TypeInfo lm32_evr_type = {
|
|
|
|
.name = MACHINE_TYPE_NAME("lm32-evr"),
|
|
|
|
.parent = TYPE_MACHINE,
|
|
|
|
.class_init = lm32_evr_class_init,
|
|
|
|
};
|
2015-09-04 20:37:08 +02:00
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static void lm32_uclinux_class_init(ObjectClass *oc, void *data)
|
2015-09-04 20:37:08 +02:00
|
|
|
{
|
2015-09-19 10:49:44 +02:00
|
|
|
MachineClass *mc = MACHINE_CLASS(oc);
|
|
|
|
|
2015-09-04 20:37:08 +02:00
|
|
|
mc->desc = "lm32 platform for uClinux and u-boot by Theobroma Systems";
|
|
|
|
mc->init = lm32_uclinux_init;
|
|
|
|
mc->is_default = 0;
|
2017-10-05 15:50:44 +02:00
|
|
|
mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full");
|
2015-09-04 20:37:08 +02:00
|
|
|
}
|
|
|
|
|
2015-09-19 10:49:44 +02:00
|
|
|
static const TypeInfo lm32_uclinux_type = {
|
|
|
|
.name = MACHINE_TYPE_NAME("lm32-uclinux"),
|
|
|
|
.parent = TYPE_MACHINE,
|
|
|
|
.class_init = lm32_uclinux_class_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void lm32_machine_init(void)
|
|
|
|
{
|
|
|
|
type_register_static(&lm32_evr_type);
|
|
|
|
type_register_static(&lm32_uclinux_type);
|
|
|
|
}
|
|
|
|
|
2016-02-16 21:59:04 +01:00
|
|
|
type_init(lm32_machine_init)
|