- Ignore writes to CNTP_CTL_EL0 on HVF ARM (Alexander)
 - Add '-d invalid_mem' logging option (Zoltan)
 - Create QOM containers explicitly (Peter)
 - Rename sysemu/ -> system/ (Philippe)
 - Re-orderning of include/exec/ headers (Philippe)
   Move a lot of declarations from these legacy mixed bag headers:
     . "exec/cpu-all.h"
     . "exec/cpu-common.h"
     . "exec/cpu-defs.h"
     . "exec/exec-all.h"
     . "exec/translate-all"
   to these more specific ones:
     . "exec/page-protection.h"
     . "exec/translation-block.h"
     . "user/cpu_loop.h"
     . "user/guest-host.h"
     . "user/page-protection.h"
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmdlnyAACgkQ4+MsLN6t
 wN6mBw//QFWi7CrU+bb8KMM53kOU9C507tjn99LLGFb5or73/umDsw6eo/b8DHBt
 KIwGLgATel42oojKfNKavtAzLK5rOrywpboPDpa3SNeF1onW+99NGJ52LQUqIX6K
 A6bS0fPdGG9ZzEuPpbjDXlp++0yhDcdSgZsS42fEsT7Dyj5gzJYlqpqhiXGqpsn8
 4Y0UMxSL21K3HEexlzw2hsoOBFA3tUm2ujNDhNkt8QASr85yQVLCypABJnuoe///
 5Ojl5wTBeDwhANET0rhwHK8eIYaNboiM9fHopJYhvyw1bz6yAu9jQwzF/MrL3s/r
 xa4OBHBy5mq2hQV9Shcl3UfCQdk/vDaYaWpgzJGX8stgMGYfnfej1SIl8haJIfcl
 VMX8/jEFdYbjhO4AeGRYcBzWjEJymkDJZoiSWp2NuEDi6jqIW+7yW1q0Rnlg9lay
 ShAqLK5Pv4zUw3t0Jy3qv9KSW8sbs6PQxtzXjk8p97rTf76BJ2pF8sv1tVzmsidP
 9L92Hv5O34IqzBu2oATOUZYJk89YGmTIUSLkpT7asJZpBLwNM2qLp5jO00WVU0Sd
 +kAn324guYPkko/TVnjC/AY7CMu55EOtD9NU35k3mUAnxXT9oDUeL4NlYtfgrJx6
 x1Nzr2FkS68+wlPAFKNSSU5lTjsjNaFM0bIJ4LCNtenJVP+SnRo=
 =cjz8
 -----END PGP SIGNATURE-----
Merge tag 'exec-20241220' of https://github.com/philmd/qemu into staging
Accel & Exec patch queue
- Ignore writes to CNTP_CTL_EL0 on HVF ARM (Alexander)
- Add '-d invalid_mem' logging option (Zoltan)
- Create QOM containers explicitly (Peter)
- Rename sysemu/ -> system/ (Philippe)
- Re-orderning of include/exec/ headers (Philippe)
  Move a lot of declarations from these legacy mixed bag headers:
    . "exec/cpu-all.h"
    . "exec/cpu-common.h"
    . "exec/cpu-defs.h"
    . "exec/exec-all.h"
    . "exec/translate-all"
  to these more specific ones:
    . "exec/page-protection.h"
    . "exec/translation-block.h"
    . "user/cpu_loop.h"
    . "user/guest-host.h"
    . "user/page-protection.h"
 # -----BEGIN PGP SIGNATURE-----
 #
 # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmdlnyAACgkQ4+MsLN6t
 # wN6mBw//QFWi7CrU+bb8KMM53kOU9C507tjn99LLGFb5or73/umDsw6eo/b8DHBt
 # KIwGLgATel42oojKfNKavtAzLK5rOrywpboPDpa3SNeF1onW+99NGJ52LQUqIX6K
 # A6bS0fPdGG9ZzEuPpbjDXlp++0yhDcdSgZsS42fEsT7Dyj5gzJYlqpqhiXGqpsn8
 # 4Y0UMxSL21K3HEexlzw2hsoOBFA3tUm2ujNDhNkt8QASr85yQVLCypABJnuoe///
 # 5Ojl5wTBeDwhANET0rhwHK8eIYaNboiM9fHopJYhvyw1bz6yAu9jQwzF/MrL3s/r
 # xa4OBHBy5mq2hQV9Shcl3UfCQdk/vDaYaWpgzJGX8stgMGYfnfej1SIl8haJIfcl
 # VMX8/jEFdYbjhO4AeGRYcBzWjEJymkDJZoiSWp2NuEDi6jqIW+7yW1q0Rnlg9lay
 # ShAqLK5Pv4zUw3t0Jy3qv9KSW8sbs6PQxtzXjk8p97rTf76BJ2pF8sv1tVzmsidP
 # 9L92Hv5O34IqzBu2oATOUZYJk89YGmTIUSLkpT7asJZpBLwNM2qLp5jO00WVU0Sd
 # +kAn324guYPkko/TVnjC/AY7CMu55EOtD9NU35k3mUAnxXT9oDUeL4NlYtfgrJx6
 # x1Nzr2FkS68+wlPAFKNSSU5lTjsjNaFM0bIJ4LCNtenJVP+SnRo=
 # =cjz8
 # -----END PGP SIGNATURE-----
 # gpg: Signature made Fri 20 Dec 2024 11:45:20 EST
 # gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
 # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [unknown]
 # gpg: WARNING: This key is not certified with a trusted signature!
 # gpg:          There is no indication that the signature belongs to the owner.
 # Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE
* tag 'exec-20241220' of https://github.com/philmd/qemu: (59 commits)
  util/qemu-timer: fix indentation
  meson: Do not define CONFIG_DEVICES on user emulation
  system/accel-ops: Remove unnecessary 'exec/cpu-common.h' header
  system/numa: Remove unnecessary 'exec/cpu-common.h' header
  hw/xen: Remove unnecessary 'exec/cpu-common.h' header
  target/mips: Drop left-over comment about Jazz machine
  target/mips: Remove tswap() calls in semihosting uhi_fstat_cb()
  target/xtensa: Remove tswap() calls in semihosting simcall() helper
  accel/tcg: Un-inline translator_is_same_page()
  accel/tcg: Include missing 'exec/translation-block.h' header
  accel/tcg: Move tcg_cflags_has/set() to 'exec/translation-block.h'
  accel/tcg: Restrict curr_cflags() declaration to 'internal-common.h'
  qemu/coroutine: Include missing 'qemu/atomic.h' header
  exec/translation-block: Include missing 'qemu/atomic.h' header
  accel/tcg: Declare cpu_loop_exit_requested() in 'exec/cpu-common.h'
  exec/cpu-all: Include 'cpu.h' earlier so MMU_USER_IDX is always defined
  target/sparc: Move sparc_restore_state_to_opc() to cpu.c
  target/sparc: Uninline cpu_get_tb_cpu_state()
  target/loongarch: Declare loongarch_cpu_dump_state() locally
  user: Move various declarations out of 'exec/exec-all.h'
  ...
Conflicts:
	hw/char/riscv_htif.c
	hw/intc/riscv_aplic.c
	target/s390x/cpu.c
	Apply sysemu header path changes to not in the pull request.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
		
	
			
		
			
				
	
	
		
			310 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			310 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * QEMU RISC-V Board Compatible with SiFive Freedom E SDK
 | 
						|
 *
 | 
						|
 * Copyright (c) 2017 SiFive, Inc.
 | 
						|
 *
 | 
						|
 * Provides a board compatible with the SiFive Freedom E SDK:
 | 
						|
 *
 | 
						|
 * 0) UART
 | 
						|
 * 1) CLINT (Core Level Interruptor)
 | 
						|
 * 2) PLIC (Platform Level Interrupt Controller)
 | 
						|
 * 3) PRCI (Power, Reset, Clock, Interrupt)
 | 
						|
 * 4) Registers emulated as RAM: AON, GPIO, QSPI, PWM
 | 
						|
 * 5) Flash memory emulated as RAM
 | 
						|
 *
 | 
						|
 * The Mask ROM reset vector jumps to the flash payload at 0x2040_0000.
 | 
						|
 * The OTP ROM and Flash boot code will be emulated in a future version.
 | 
						|
 *
 | 
						|
 * This program is free software; you can redistribute it and/or modify it
 | 
						|
 * under the terms and conditions of the GNU General Public License,
 | 
						|
 * version 2 or later, as published by the Free Software Foundation.
 | 
						|
 *
 | 
						|
 * This program is distributed in the hope 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.
 | 
						|
 *
 | 
						|
 * You should have received a copy of the GNU General Public License along with
 | 
						|
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
						|
 */
 | 
						|
 | 
						|
#include "qemu/osdep.h"
 | 
						|
#include "qemu/cutils.h"
 | 
						|
#include "qemu/error-report.h"
 | 
						|
#include "qapi/error.h"
 | 
						|
#include "hw/boards.h"
 | 
						|
#include "hw/loader.h"
 | 
						|
#include "hw/sysbus.h"
 | 
						|
#include "hw/misc/unimp.h"
 | 
						|
#include "target/riscv/cpu.h"
 | 
						|
#include "hw/riscv/riscv_hart.h"
 | 
						|
#include "hw/riscv/sifive_e.h"
 | 
						|
#include "hw/riscv/boot.h"
 | 
						|
#include "hw/char/sifive_uart.h"
 | 
						|
#include "hw/intc/riscv_aclint.h"
 | 
						|
#include "hw/intc/sifive_plic.h"
 | 
						|
#include "hw/misc/sifive_e_prci.h"
 | 
						|
#include "hw/misc/sifive_e_aon.h"
 | 
						|
#include "chardev/char.h"
 | 
						|
#include "system/system.h"
 | 
						|
 | 
						|
static const MemMapEntry sifive_e_memmap[] = {
 | 
						|
    [SIFIVE_E_DEV_DEBUG] =    {        0x0,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_MROM] =     {     0x1000,     0x2000 },
 | 
						|
    [SIFIVE_E_DEV_OTP] =      {    0x20000,     0x2000 },
 | 
						|
    [SIFIVE_E_DEV_CLINT] =    {  0x2000000,    0x10000 },
 | 
						|
    [SIFIVE_E_DEV_PLIC] =     {  0xc000000,  0x4000000 },
 | 
						|
    [SIFIVE_E_DEV_AON] =      { 0x10000000,     0x8000 },
 | 
						|
    [SIFIVE_E_DEV_PRCI] =     { 0x10008000,     0x8000 },
 | 
						|
    [SIFIVE_E_DEV_OTP_CTRL] = { 0x10010000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_GPIO0] =    { 0x10012000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_UART0] =    { 0x10013000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_QSPI0] =    { 0x10014000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_PWM0] =     { 0x10015000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_UART1] =    { 0x10023000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_QSPI1] =    { 0x10024000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_PWM1] =     { 0x10025000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_QSPI2] =    { 0x10034000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_PWM2] =     { 0x10035000,     0x1000 },
 | 
						|
    [SIFIVE_E_DEV_XIP] =      { 0x20000000, 0x20000000 },
 | 
						|
    [SIFIVE_E_DEV_DTIM] =     { 0x80000000,     0x4000 }
 | 
						|
};
 | 
						|
 | 
						|
static void sifive_e_machine_init(MachineState *machine)
 | 
						|
{
 | 
						|
    MachineClass *mc = MACHINE_GET_CLASS(machine);
 | 
						|
    const MemMapEntry *memmap = sifive_e_memmap;
 | 
						|
 | 
						|
    SiFiveEState *s = RISCV_E_MACHINE(machine);
 | 
						|
    MemoryRegion *sys_mem = get_system_memory();
 | 
						|
    int i;
 | 
						|
    RISCVBootInfo boot_info;
 | 
						|
 | 
						|
    if (machine->ram_size != mc->default_ram_size) {
 | 
						|
        char *sz = size_to_str(mc->default_ram_size);
 | 
						|
        error_report("Invalid RAM size, should be %s", sz);
 | 
						|
        g_free(sz);
 | 
						|
        exit(EXIT_FAILURE);
 | 
						|
    }
 | 
						|
 | 
						|
    /* Initialize SoC */
 | 
						|
    object_initialize_child(OBJECT(machine), "soc", &s->soc, TYPE_RISCV_E_SOC);
 | 
						|
    qdev_realize(DEVICE(&s->soc), NULL, &error_fatal);
 | 
						|
 | 
						|
    /* Data Tightly Integrated Memory */
 | 
						|
    memory_region_add_subregion(sys_mem,
 | 
						|
        memmap[SIFIVE_E_DEV_DTIM].base, machine->ram);
 | 
						|
 | 
						|
    /* Mask ROM reset vector */
 | 
						|
    uint32_t reset_vec[4];
 | 
						|
 | 
						|
    if (s->revb) {
 | 
						|
        reset_vec[1] = 0x200102b7;  /* 0x1004: lui     t0,0x20010 */
 | 
						|
    } else {
 | 
						|
        reset_vec[1] = 0x204002b7;  /* 0x1004: lui     t0,0x20400 */
 | 
						|
    }
 | 
						|
    reset_vec[2] = 0x00028067;      /* 0x1008: jr      t0 */
 | 
						|
 | 
						|
    reset_vec[0] = reset_vec[3] = 0;
 | 
						|
 | 
						|
    /* copy in the reset vector in little_endian byte order */
 | 
						|
    for (i = 0; i < sizeof(reset_vec) >> 2; i++) {
 | 
						|
        reset_vec[i] = cpu_to_le32(reset_vec[i]);
 | 
						|
    }
 | 
						|
    rom_add_blob_fixed_as("mrom.reset", reset_vec, sizeof(reset_vec),
 | 
						|
                          memmap[SIFIVE_E_DEV_MROM].base, &address_space_memory);
 | 
						|
 | 
						|
    riscv_boot_info_init(&boot_info, &s->soc.cpus);
 | 
						|
    if (machine->kernel_filename) {
 | 
						|
        riscv_load_kernel(machine, &boot_info,
 | 
						|
                          memmap[SIFIVE_E_DEV_DTIM].base,
 | 
						|
                          false, NULL);
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
static bool sifive_e_machine_get_revb(Object *obj, Error **errp)
 | 
						|
{
 | 
						|
    SiFiveEState *s = RISCV_E_MACHINE(obj);
 | 
						|
 | 
						|
    return s->revb;
 | 
						|
}
 | 
						|
 | 
						|
static void sifive_e_machine_set_revb(Object *obj, bool value, Error **errp)
 | 
						|
{
 | 
						|
    SiFiveEState *s = RISCV_E_MACHINE(obj);
 | 
						|
 | 
						|
    s->revb = value;
 | 
						|
}
 | 
						|
 | 
						|
static void sifive_e_machine_instance_init(Object *obj)
 | 
						|
{
 | 
						|
    SiFiveEState *s = RISCV_E_MACHINE(obj);
 | 
						|
 | 
						|
    s->revb = false;
 | 
						|
}
 | 
						|
 | 
						|
static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
 | 
						|
{
 | 
						|
    MachineClass *mc = MACHINE_CLASS(oc);
 | 
						|
 | 
						|
    mc->desc = "RISC-V Board compatible with SiFive E SDK";
 | 
						|
    mc->init = sifive_e_machine_init;
 | 
						|
    mc->max_cpus = 1;
 | 
						|
    mc->default_cpu_type = SIFIVE_E_CPU;
 | 
						|
    mc->default_ram_id = "riscv.sifive.e.ram";
 | 
						|
    mc->default_ram_size = sifive_e_memmap[SIFIVE_E_DEV_DTIM].size;
 | 
						|
 | 
						|
    object_class_property_add_bool(oc, "revb", sifive_e_machine_get_revb,
 | 
						|
                                   sifive_e_machine_set_revb);
 | 
						|
    object_class_property_set_description(oc, "revb",
 | 
						|
                                          "Set on to tell QEMU that it should model "
 | 
						|
                                          "the revB HiFive1 board");
 | 
						|
}
 | 
						|
 | 
						|
static const TypeInfo sifive_e_machine_typeinfo = {
 | 
						|
    .name       = MACHINE_TYPE_NAME("sifive_e"),
 | 
						|
    .parent     = TYPE_MACHINE,
 | 
						|
    .class_init = sifive_e_machine_class_init,
 | 
						|
    .instance_init = sifive_e_machine_instance_init,
 | 
						|
    .instance_size = sizeof(SiFiveEState),
 | 
						|
};
 | 
						|
 | 
						|
static void sifive_e_machine_init_register_types(void)
 | 
						|
{
 | 
						|
    type_register_static(&sifive_e_machine_typeinfo);
 | 
						|
}
 | 
						|
 | 
						|
type_init(sifive_e_machine_init_register_types)
 | 
						|
 | 
						|
static void sifive_e_soc_init(Object *obj)
 | 
						|
{
 | 
						|
    MachineState *ms = MACHINE(qdev_get_machine());
 | 
						|
    SiFiveESoCState *s = RISCV_E_SOC(obj);
 | 
						|
 | 
						|
    object_initialize_child(obj, "cpus", &s->cpus, TYPE_RISCV_HART_ARRAY);
 | 
						|
    object_property_set_int(OBJECT(&s->cpus), "num-harts", ms->smp.cpus,
 | 
						|
                            &error_abort);
 | 
						|
    object_property_set_int(OBJECT(&s->cpus), "resetvec", 0x1004, &error_abort);
 | 
						|
    object_initialize_child(obj, "riscv.sifive.e.gpio0", &s->gpio,
 | 
						|
                            TYPE_SIFIVE_GPIO);
 | 
						|
    object_initialize_child(obj, "riscv.sifive.e.aon", &s->aon,
 | 
						|
                            TYPE_SIFIVE_E_AON);
 | 
						|
}
 | 
						|
 | 
						|
static void sifive_e_soc_realize(DeviceState *dev, Error **errp)
 | 
						|
{
 | 
						|
    MachineState *ms = MACHINE(qdev_get_machine());
 | 
						|
    const MemMapEntry *memmap = sifive_e_memmap;
 | 
						|
    SiFiveESoCState *s = RISCV_E_SOC(dev);
 | 
						|
    MemoryRegion *sys_mem = get_system_memory();
 | 
						|
 | 
						|
    object_property_set_str(OBJECT(&s->cpus), "cpu-type", ms->cpu_type,
 | 
						|
                            &error_abort);
 | 
						|
    sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_fatal);
 | 
						|
 | 
						|
    /* Mask ROM */
 | 
						|
    memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom",
 | 
						|
                           memmap[SIFIVE_E_DEV_MROM].size, &error_fatal);
 | 
						|
    memory_region_add_subregion(sys_mem,
 | 
						|
        memmap[SIFIVE_E_DEV_MROM].base, &s->mask_rom);
 | 
						|
 | 
						|
    /* MMIO */
 | 
						|
    s->plic = sifive_plic_create(memmap[SIFIVE_E_DEV_PLIC].base,
 | 
						|
        (char *)SIFIVE_E_PLIC_HART_CONFIG, ms->smp.cpus, 0,
 | 
						|
        SIFIVE_E_PLIC_NUM_SOURCES,
 | 
						|
        SIFIVE_E_PLIC_NUM_PRIORITIES,
 | 
						|
        SIFIVE_E_PLIC_PRIORITY_BASE,
 | 
						|
        SIFIVE_E_PLIC_PENDING_BASE,
 | 
						|
        SIFIVE_E_PLIC_ENABLE_BASE,
 | 
						|
        SIFIVE_E_PLIC_ENABLE_STRIDE,
 | 
						|
        SIFIVE_E_PLIC_CONTEXT_BASE,
 | 
						|
        SIFIVE_E_PLIC_CONTEXT_STRIDE,
 | 
						|
        memmap[SIFIVE_E_DEV_PLIC].size);
 | 
						|
    riscv_aclint_swi_create(memmap[SIFIVE_E_DEV_CLINT].base,
 | 
						|
        0, ms->smp.cpus, false);
 | 
						|
    riscv_aclint_mtimer_create(memmap[SIFIVE_E_DEV_CLINT].base +
 | 
						|
            RISCV_ACLINT_SWI_SIZE,
 | 
						|
        RISCV_ACLINT_DEFAULT_MTIMER_SIZE, 0, ms->smp.cpus,
 | 
						|
        RISCV_ACLINT_DEFAULT_MTIMECMP, RISCV_ACLINT_DEFAULT_MTIME,
 | 
						|
        SIFIVE_E_LFCLK_DEFAULT_FREQ, false);
 | 
						|
    sifive_e_prci_create(memmap[SIFIVE_E_DEV_PRCI].base);
 | 
						|
 | 
						|
    /* AON */
 | 
						|
 | 
						|
    if (!sysbus_realize(SYS_BUS_DEVICE(&s->aon), errp)) {
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    /* Map AON registers */
 | 
						|
    sysbus_mmio_map(SYS_BUS_DEVICE(&s->aon), 0, memmap[SIFIVE_E_DEV_AON].base);
 | 
						|
 | 
						|
    /* GPIO */
 | 
						|
 | 
						|
    if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) {
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    /* Map GPIO registers */
 | 
						|
    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_E_DEV_GPIO0].base);
 | 
						|
 | 
						|
    /* Pass all GPIOs to the SOC layer so they are available to the board */
 | 
						|
    qdev_pass_gpios(DEVICE(&s->gpio), dev, NULL);
 | 
						|
 | 
						|
    /* Connect GPIO interrupts to the PLIC */
 | 
						|
    for (int i = 0; i < 32; i++) {
 | 
						|
        sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), i,
 | 
						|
                           qdev_get_gpio_in(DEVICE(s->plic),
 | 
						|
                                            SIFIVE_E_GPIO0_IRQ0 + i));
 | 
						|
    }
 | 
						|
    sysbus_connect_irq(SYS_BUS_DEVICE(&s->aon), 0,
 | 
						|
                       qdev_get_gpio_in(DEVICE(s->plic),
 | 
						|
                                        SIFIVE_E_AON_WDT_IRQ));
 | 
						|
 | 
						|
    sifive_uart_create(sys_mem, memmap[SIFIVE_E_DEV_UART0].base,
 | 
						|
        serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART0_IRQ));
 | 
						|
    create_unimplemented_device("riscv.sifive.e.qspi0",
 | 
						|
        memmap[SIFIVE_E_DEV_QSPI0].base, memmap[SIFIVE_E_DEV_QSPI0].size);
 | 
						|
    create_unimplemented_device("riscv.sifive.e.pwm0",
 | 
						|
        memmap[SIFIVE_E_DEV_PWM0].base, memmap[SIFIVE_E_DEV_PWM0].size);
 | 
						|
    sifive_uart_create(sys_mem, memmap[SIFIVE_E_DEV_UART1].base,
 | 
						|
        serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART1_IRQ));
 | 
						|
    create_unimplemented_device("riscv.sifive.e.qspi1",
 | 
						|
        memmap[SIFIVE_E_DEV_QSPI1].base, memmap[SIFIVE_E_DEV_QSPI1].size);
 | 
						|
    create_unimplemented_device("riscv.sifive.e.pwm1",
 | 
						|
        memmap[SIFIVE_E_DEV_PWM1].base, memmap[SIFIVE_E_DEV_PWM1].size);
 | 
						|
    create_unimplemented_device("riscv.sifive.e.qspi2",
 | 
						|
        memmap[SIFIVE_E_DEV_QSPI2].base, memmap[SIFIVE_E_DEV_QSPI2].size);
 | 
						|
    create_unimplemented_device("riscv.sifive.e.pwm2",
 | 
						|
        memmap[SIFIVE_E_DEV_PWM2].base, memmap[SIFIVE_E_DEV_PWM2].size);
 | 
						|
 | 
						|
    /* Flash memory */
 | 
						|
    memory_region_init_rom(&s->xip_mem, OBJECT(dev), "riscv.sifive.e.xip",
 | 
						|
                           memmap[SIFIVE_E_DEV_XIP].size, &error_fatal);
 | 
						|
    memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_DEV_XIP].base,
 | 
						|
        &s->xip_mem);
 | 
						|
}
 | 
						|
 | 
						|
static void sifive_e_soc_class_init(ObjectClass *oc, void *data)
 | 
						|
{
 | 
						|
    DeviceClass *dc = DEVICE_CLASS(oc);
 | 
						|
 | 
						|
    dc->realize = sifive_e_soc_realize;
 | 
						|
    /* Reason: Uses serial_hds in realize function, thus can't be used twice */
 | 
						|
    dc->user_creatable = false;
 | 
						|
}
 | 
						|
 | 
						|
static const TypeInfo sifive_e_soc_type_info = {
 | 
						|
    .name = TYPE_RISCV_E_SOC,
 | 
						|
    .parent = TYPE_DEVICE,
 | 
						|
    .instance_size = sizeof(SiFiveESoCState),
 | 
						|
    .instance_init = sifive_e_soc_init,
 | 
						|
    .class_init = sifive_e_soc_class_init,
 | 
						|
};
 | 
						|
 | 
						|
static void sifive_e_soc_register_types(void)
 | 
						|
{
 | 
						|
    type_register_static(&sifive_e_soc_type_info);
 | 
						|
}
 | 
						|
 | 
						|
type_init(sifive_e_soc_register_types)
 |