<p>Patrick Rudolph has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/23812">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mb/emulation/qemu-armv8: Add new board for ARMv8<br><br>Ported the ARMv7 board to ARMv8.<br>Added custom bootblock, as the memory mapped NOR flash shouldn't be<br>written to. The bootblock relocates itself to SRAM.<br><br>Tested on QEMU:<br>qemu-system-aarch64 -M vexpress-a9 -cpu cortex-a53 -m 1024 \<br> -bios build/coreboot.rom -nographic<br><br>Change-Id: Ib4f2fd43afb855c2ae5760d9ee6ae1478b09104c<br>Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com><br>---<br>M src/cpu/armltd/Kconfig<br>M src/cpu/armltd/Makefile.inc<br>A src/cpu/armltd/cortex-a53/Kconfig<br>A src/mainboard/emulation/qemu-armv8/Kconfig<br>A src/mainboard/emulation/qemu-armv8/Kconfig.name<br>A src/mainboard/emulation/qemu-armv8/Makefile.inc<br>A src/mainboard/emulation/qemu-armv8/board_info.txt<br>A src/mainboard/emulation/qemu-armv8/bootblock_custom.S<br>A src/mainboard/emulation/qemu-armv8/cbmem.c<br>A src/mainboard/emulation/qemu-armv8/devicetree.cb<br>A src/mainboard/emulation/qemu-armv8/mainboard.c<br>A src/mainboard/emulation/qemu-armv8/mainboard.h<br>A src/mainboard/emulation/qemu-armv8/media.c<br>A src/mainboard/emulation/qemu-armv8/memlayout.ld<br>A src/mainboard/emulation/qemu-armv8/memorymap.h<br>A src/mainboard/emulation/qemu-armv8/mmio.c<br>A src/mainboard/emulation/qemu-armv8/romstage.c<br>A src/mainboard/emulation/qemu-armv8/timer.c<br>18 files changed, 546 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/23812/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/cpu/armltd/Kconfig b/src/cpu/armltd/Kconfig</span><br><span>index af0c5c5..fc01735 100644</span><br><span>--- a/src/cpu/armltd/Kconfig</span><br><span>+++ b/src/cpu/armltd/Kconfig</span><br><span>@@ -1 +1,2 @@</span><br><span> source src/cpu/armltd/cortex-a9/Kconfig</span><br><span style="color: hsl(120, 100%, 40%);">+source src/cpu/armltd/cortex-a53/Kconfig</span><br><span>diff --git a/src/cpu/armltd/Makefile.inc b/src/cpu/armltd/Makefile.inc</span><br><span>index 014742f..cd6acf1 100644</span><br><span>--- a/src/cpu/armltd/Makefile.inc</span><br><span>+++ b/src/cpu/armltd/Makefile.inc</span><br><span>@@ -1 +1,2 @@</span><br><span> subdirs-$(CONFIG_CPU_ARMLTD_CORTEX_A9) += cortex-a9</span><br><span style="color: hsl(120, 100%, 40%);">+subdirs-$(CONFIG_CPU_ARMLTD_CORTEX_A53) += cortex-a53</span><br><span>diff --git a/src/cpu/armltd/cortex-a53/Kconfig b/src/cpu/armltd/cortex-a53/Kconfig</span><br><span>new file mode 100644</span><br><span>index 0000000..67d6476</span><br><span>--- /dev/null</span><br><span>+++ b/src/cpu/armltd/cortex-a53/Kconfig</span><br><span>@@ -0,0 +1,12 @@</span><br><span style="color: hsl(120, 100%, 40%);">+config CPU_ARMLTD_CORTEX_A53</span><br><span style="color: hsl(120, 100%, 40%);">+       bool</span><br><span style="color: hsl(120, 100%, 40%);">+  select ARCH_ARMV8_1</span><br><span style="color: hsl(120, 100%, 40%);">+   select ARCH_BOOTBLOCK_ARMV8_64</span><br><span style="color: hsl(120, 100%, 40%);">+        select ARCH_RAMSTAGE_ARMV8_64</span><br><span style="color: hsl(120, 100%, 40%);">+ select ARCH_ROMSTAGE_ARMV8_64</span><br><span style="color: hsl(120, 100%, 40%);">+ select ARCH_VERSTAGE_ARMV8_64</span><br><span style="color: hsl(120, 100%, 40%);">+ default n</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if CPU_ARMLTD_CORTEX_A53</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+endif</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/Kconfig b/src/mainboard/emulation/qemu-armv8/Kconfig</span><br><span>new file mode 100644</span><br><span>index 0000000..00c02e0</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/Kconfig</span><br><span>@@ -0,0 +1,55 @@</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## Copyright (C) 2013 Google Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This software is licensed under the terms of the GNU General Public</span><br><span style="color: hsl(120, 100%, 40%);">+## License version 2, as published by the Free Software Foundation, and</span><br><span style="color: hsl(120, 100%, 40%);">+## may be copied, distributed, and modified under those terms.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+## but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+## GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Emulation for ARM Ltd Versatile Express Cortex-A53</span><br><span style="color: hsl(120, 100%, 40%);">+#  http://www.arm.com/products/tools/development-boards/versatile-express</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# To execute, do:</span><br><span style="color: hsl(120, 100%, 40%);">+# export QEMU_AUDIO_DRV = none</span><br><span style="color: hsl(120, 100%, 40%);">+# qemu-system-aarch64 -M vexpress-a9 -cpu cortex-a53 -m 1024 -bios build/coreboot.rom -nographic</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if BOARD_EMULATION_QEMU_ARMV8</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+config BOARD_SPECIFIC_OPTIONS # dummy</span><br><span style="color: hsl(120, 100%, 40%);">+  def_bool y</span><br><span style="color: hsl(120, 100%, 40%);">+    select CPU_ARMLTD_CORTEX_A53</span><br><span style="color: hsl(120, 100%, 40%);">+  select DRIVERS_UART_PL011</span><br><span style="color: hsl(120, 100%, 40%);">+     select BOOTBLOCK_CONSOLE</span><br><span style="color: hsl(120, 100%, 40%);">+      select CONSOLE_SERIAL</span><br><span style="color: hsl(120, 100%, 40%);">+ select MAINBOARD_HAS_NATIVE_VGA_INIT</span><br><span style="color: hsl(120, 100%, 40%);">+  select MAINBOARD_FORCE_NATIVE_VGA_INIT</span><br><span style="color: hsl(120, 100%, 40%);">+        select HAVE_LINEAR_FRAMEBUFFER</span><br><span style="color: hsl(120, 100%, 40%);">+        select BOARD_ROMSIZE_KB_4096</span><br><span style="color: hsl(120, 100%, 40%);">+  select BOOT_DEVICE_NOT_SPI_FLASH</span><br><span style="color: hsl(120, 100%, 40%);">+      select BOOTBLOCK_CUSTOM</span><br><span style="color: hsl(120, 100%, 40%);">+       select DRIVERS_ARM_SP804</span><br><span style="color: hsl(120, 100%, 40%);">+      select GENERIC_UDELAY</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+config MAINBOARD_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+ string</span><br><span style="color: hsl(120, 100%, 40%);">+        default emulation/qemu-armv8</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+config MAINBOARD_PART_NUMBER</span><br><span style="color: hsl(120, 100%, 40%);">+  string</span><br><span style="color: hsl(120, 100%, 40%);">+        default "QEMU ARMv8"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+config MAX_CPUS</span><br><span style="color: hsl(120, 100%, 40%);">+     int</span><br><span style="color: hsl(120, 100%, 40%);">+   default 2</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+config MAINBOARD_VENDOR</span><br><span style="color: hsl(120, 100%, 40%);">+  string</span><br><span style="color: hsl(120, 100%, 40%);">+        default "ARM Ltd."</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+endif #  BOARD_EMULATION_QEMU_ARMV8</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/Kconfig.name b/src/mainboard/emulation/qemu-armv8/Kconfig.name</span><br><span>new file mode 100644</span><br><span>index 0000000..ed1c343</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/Kconfig.name</span><br><span>@@ -0,0 +1,2 @@</span><br><span style="color: hsl(120, 100%, 40%);">+config BOARD_EMULATION_QEMU_ARMV8</span><br><span style="color: hsl(120, 100%, 40%);">+     bool "QEMU armv8 (vexpress-a9)"</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/Makefile.inc b/src/mainboard/emulation/qemu-armv8/Makefile.inc</span><br><span>new file mode 100644</span><br><span>index 0000000..ccbd3de</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/Makefile.inc</span><br><span>@@ -0,0 +1,38 @@</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## Copyright (C) 2013 Google Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This software is licensed under the terms of the GNU General Public</span><br><span style="color: hsl(120, 100%, 40%);">+## License version 2, as published by the Free Software Foundation, and</span><br><span style="color: hsl(120, 100%, 40%);">+## may be copied, distributed, and modified under those terms.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+## but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+## GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += romstage.c</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += cbmem.c</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-y += cbmem.c</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-y += media.c</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += media.c</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-y += media.c</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-y += timer.c</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += timer.c</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-y += timer.c</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-y += mmio.c</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += mmio.c</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-y += mmio.c</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-y += memlayout.ld</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += memlayout.ld</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-y += memlayout.ld</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-y += bootblock_custom.S</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-y += ../../../lib/bootblock.c</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/board_info.txt b/src/mainboard/emulation/qemu-armv8/board_info.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..0301be5</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/board_info.txt</span><br><span>@@ -0,0 +1,3 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Board name: QEMU armv8 (vexpress-a9)</span><br><span style="color: hsl(120, 100%, 40%);">+Category: emulation</span><br><span style="color: hsl(120, 100%, 40%);">+Board URL: http://wiki.qemu.org/Main_Page</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/bootblock_custom.S b/src/mainboard/emulation/qemu-armv8/bootblock_custom.S</span><br><span>new file mode 100644</span><br><span>index 0000000..1c1230d</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/bootblock_custom.S</span><br><span>@@ -0,0 +1,61 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Early initialization code for aarch64 (a.k.a. armv8)</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(120, 100%, 40%);">+ * modify it under the terms of the GNU General Public License as</span><br><span style="color: hsl(120, 100%, 40%);">+ * published by the Free Software Foundation; version 2 of</span><br><span style="color: hsl(120, 100%, 40%);">+ * the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <arch/asm.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include "memorymap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ENTRY(_start)</span><br><span style="color: hsl(120, 100%, 40%);">+    .org 0</span><br><span style="color: hsl(120, 100%, 40%);">+    ic      ialluis</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+relocate:</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Get code position */</span><br><span style="color: hsl(120, 100%, 40%);">+    mov     x1, #VEXPRESS_NORFLASH_START</span><br><span style="color: hsl(120, 100%, 40%);">+    mov     x0, #VEXPRESS_SRAM_START</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* FIXME: Don't hardcode bootblock length */</span><br><span style="color: hsl(120, 100%, 40%);">+    mov     x2, #0x10000</span><br><span style="color: hsl(120, 100%, 40%);">+    b       copy_code</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+.align 7</span><br><span style="color: hsl(120, 100%, 40%);">+copy_code:</span><br><span style="color: hsl(120, 100%, 40%);">+    ldp     q0, q1, [x1], 32    /* Load 32 bytes */</span><br><span style="color: hsl(120, 100%, 40%);">+    subs    w2, w2, 32          /* Subtract 32 from length, setting flags */</span><br><span style="color: hsl(120, 100%, 40%);">+    stp     q0, q1, [x0], 32    /* Store 32 bytes */</span><br><span style="color: hsl(120, 100%, 40%);">+    b.gt    copy_code           /* Repeat if length is still positive */</span><br><span style="color: hsl(120, 100%, 40%);">+    dmb     sy</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Load the actual location we're suppose to be at */</span><br><span style="color: hsl(120, 100%, 40%);">+    adr     x0, after_relocate  /* Relative address */</span><br><span style="color: hsl(120, 100%, 40%);">+    adr     x1, _start          /* Relative address */</span><br><span style="color: hsl(120, 100%, 40%);">+    sub     x0, x0, x1     /* This only works if _start is suppose to be zero */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    mov x1, #VEXPRESS_SRAM_START</span><br><span style="color: hsl(120, 100%, 40%);">+    add     x0, x1, x0</span><br><span style="color: hsl(120, 100%, 40%);">+    br      x0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+after_relocate:</span><br><span style="color: hsl(120, 100%, 40%);">+     bl start</span><br><span style="color: hsl(120, 100%, 40%);">+ENDPROC(_start)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ENTRY(start)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    bl      arm64_init_cpu</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Call C entry */</span><br><span style="color: hsl(120, 100%, 40%);">+    bl      main</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ENDPROC(start)</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/cbmem.c b/src/mainboard/emulation/qemu-armv8/cbmem.c</span><br><span>new file mode 100644</span><br><span>index 0000000..e35e016</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/cbmem.c</span><br><span>@@ -0,0 +1,69 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2016 Vladimir Serbinenko <phcoder@gmail.com></span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <stddef.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <cbmem.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <symbols.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <arch/io.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include "mainboard.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "memorymap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define PATTERN1 0x55</span><br><span style="color: hsl(120, 100%, 40%);">+#define PATTERN2 0xaa</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Returns 1 if mebibyte mb is present and 0 otherwise.  */</span><br><span style="color: hsl(120, 100%, 40%);">+static int probe_mb(int mb)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        char *ptr = (char *) VEXPRESS_DRAM_START + (mb << 20) + 0xfffff;</span><br><span style="color: hsl(120, 100%, 40%);">+        char old;</span><br><span style="color: hsl(120, 100%, 40%);">+     if (ptr < (char *) &_eprogram) {</span><br><span style="color: hsl(120, 100%, 40%);">+               /* Don't probe below _end to avoid accidentally clobering</span><br><span style="color: hsl(120, 100%, 40%);">+            oneself.  */</span><br><span style="color: hsl(120, 100%, 40%);">+               return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   old = read8(ptr);</span><br><span style="color: hsl(120, 100%, 40%);">+     write8(ptr, PATTERN1);</span><br><span style="color: hsl(120, 100%, 40%);">+        if (read8(ptr) != PATTERN1)</span><br><span style="color: hsl(120, 100%, 40%);">+           return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     write8(ptr, PATTERN2);</span><br><span style="color: hsl(120, 100%, 40%);">+        if (read8(ptr) != PATTERN2)</span><br><span style="color: hsl(120, 100%, 40%);">+           return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     write8(ptr, old);</span><br><span style="color: hsl(120, 100%, 40%);">+     return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+int probe_ramsize(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    int i;</span><br><span style="color: hsl(120, 100%, 40%);">+        int discovered = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+   static int saved_result;</span><br><span style="color: hsl(120, 100%, 40%);">+      if (saved_result)</span><br><span style="color: hsl(120, 100%, 40%);">+             return saved_result;</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Compact binary search.  */</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 1 GiB is the largest supported RAM by this machine.  */</span><br><span style="color: hsl(120, 100%, 40%);">+    for (i = 9; i >= 0; i--)</span><br><span style="color: hsl(120, 100%, 40%);">+           if (probe_mb(discovered | (1 << i)))</span><br><span style="color: hsl(120, 100%, 40%);">+                    discovered |= (1 << i);</span><br><span style="color: hsl(120, 100%, 40%);">+ discovered++;</span><br><span style="color: hsl(120, 100%, 40%);">+ saved_result = discovered;</span><br><span style="color: hsl(120, 100%, 40%);">+    return discovered;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void *cbmem_top(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     return _dram + (probe_ramsize() << 20);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/devicetree.cb b/src/mainboard/emulation/qemu-armv8/devicetree.cb</span><br><span>new file mode 100644</span><br><span>index 0000000..19a9bad</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/devicetree.cb</span><br><span>@@ -0,0 +1,20 @@</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## Copyright (C) 2013 Google, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This software is licensed under the terms of the GNU General Public</span><br><span style="color: hsl(120, 100%, 40%);">+## License version 2, as published by the Free Software Foundation, and</span><br><span style="color: hsl(120, 100%, 40%);">+## may be copied, distributed, and modified under those terms.</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+## This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+## but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+## GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# TODO fill with Versatile Express board data in QEMU.</span><br><span style="color: hsl(120, 100%, 40%);">+chip cpu/armltd/cortex-a53</span><br><span style="color: hsl(120, 100%, 40%);">+   chip drivers/generic/generic # I2C0 controller</span><br><span style="color: hsl(120, 100%, 40%);">+                device i2c 6 on end # Fake component for testing</span><br><span style="color: hsl(120, 100%, 40%);">+      end</span><br><span style="color: hsl(120, 100%, 40%);">+end</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/mainboard.c b/src/mainboard/emulation/qemu-armv8/mainboard.c</span><br><span>new file mode 100644</span><br><span>index 0000000..c53aec9</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/mainboard.c</span><br><span>@@ -0,0 +1,72 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2016 Vladimir Serbinenko <phcoder@gmail.com></span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 or, at your option, any later</span><br><span style="color: hsl(120, 100%, 40%);">+ * version of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <console/console.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <device/device.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <cbmem.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <string.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <halt.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include "mainboard.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "memorymap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include <edid.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <arch/io.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void init_gfx(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       uint32_t *pl111;</span><br><span style="color: hsl(120, 100%, 40%);">+      struct edid edid;</span><br><span style="color: hsl(120, 100%, 40%);">+     /* width is at most 4096 */</span><br><span style="color: hsl(120, 100%, 40%);">+   /* height is at most 1024 */</span><br><span style="color: hsl(120, 100%, 40%);">+  int width = 800, height = 600;</span><br><span style="color: hsl(120, 100%, 40%);">+        uint32_t framebuffer = VEXPRESS_FRAMEBUFFER_START;</span><br><span style="color: hsl(120, 100%, 40%);">+    pl111 = (uint32_t *) VEXPRESS_PL111;</span><br><span style="color: hsl(120, 100%, 40%);">+  write32(pl111, (width / 4) - 4);</span><br><span style="color: hsl(120, 100%, 40%);">+      write32(pl111 + 1, height - 1);</span><br><span style="color: hsl(120, 100%, 40%);">+       /* registers 2, 3 and 5 are ignored by qemu. Set them correctly if</span><br><span style="color: hsl(120, 100%, 40%);">+       we ever go for real hw.  */</span><br><span style="color: hsl(120, 100%, 40%);">+        /* framebuffer adress offset. Has to be in vram.  */</span><br><span style="color: hsl(120, 100%, 40%);">+  write32(pl111 + 4, framebuffer);</span><br><span style="color: hsl(120, 100%, 40%);">+      write32(pl111 + 7, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+        write32(pl111 + 10, 0xff);</span><br><span style="color: hsl(120, 100%, 40%);">+    write32(pl111 + 6, (5 << 1) | 0x801);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ edid.framebuffer_bits_per_pixel = 32;</span><br><span style="color: hsl(120, 100%, 40%);">+ edid.bytes_per_line = width * 4;</span><br><span style="color: hsl(120, 100%, 40%);">+      edid.x_resolution = width;</span><br><span style="color: hsl(120, 100%, 40%);">+    edid.y_resolution = height;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ set_vbe_mode_info_valid(&edid, framebuffer);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void mainboard_enable(device_t dev)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  int discovered;</span><br><span style="color: hsl(120, 100%, 40%);">+       if (!dev) {</span><br><span style="color: hsl(120, 100%, 40%);">+           printk(BIOS_EMERG, "No dev0; die\n");</span><br><span style="color: hsl(120, 100%, 40%);">+               halt();</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   discovered = probe_ramsize();</span><br><span style="color: hsl(120, 100%, 40%);">+ printk(BIOS_DEBUG, "%d MiB of RAM discovered\n", discovered);</span><br><span style="color: hsl(120, 100%, 40%);">+       ram_resource(dev, 0, VEXPRESS_DRAM_START >> 10, discovered << 10);</span><br><span style="color: hsl(120, 100%, 40%);">+        cbmem_recovery(0);</span><br><span style="color: hsl(120, 100%, 40%);">+    init_gfx();</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+struct chip_operations mainboard_ops = {</span><br><span style="color: hsl(120, 100%, 40%);">+    .enable_dev = mainboard_enable,</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/mainboard.h b/src/mainboard/emulation/qemu-armv8/mainboard.h</span><br><span>new file mode 100644</span><br><span>index 0000000..ce46f17</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/mainboard.h</span><br><span>@@ -0,0 +1,24 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2016 Vladimir Serbinenko <phcoder@gmail.com></span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 or, at your option, any later</span><br><span style="color: hsl(120, 100%, 40%);">+ * version of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef QEMU_ARMV8_MAINBOARD_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define QEMU_ARMV8_MAINBOARD_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Returns RAM size in mebibytes.  */</span><br><span style="color: hsl(120, 100%, 40%);">+int probe_ramsize(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/media.c b/src/mainboard/emulation/qemu-armv8/media.c</span><br><span>new file mode 100644</span><br><span>index 0000000..be1ca4b</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/media.c</span><br><span>@@ -0,0 +1,26 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2013 Google, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This software is licensed under the terms of the GNU General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License version 2, as published by the Free Software Foundation, and</span><br><span style="color: hsl(120, 100%, 40%);">+ * may be copied, distributed, and modified under those terms.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#include <boot_device.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include "memorymap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Maps directly to NOR flash up to ROM size. */</span><br><span style="color: hsl(120, 100%, 40%);">+static const struct mem_region_device boot_dev =</span><br><span style="color: hsl(120, 100%, 40%);">+    MEM_REGION_DEV_RO_INIT((void *)VEXPRESS_NORFLASH_START, CONFIG_ROM_SIZE);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+const struct region_device *boot_device_ro(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    return &boot_dev.rdev;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/memlayout.ld b/src/mainboard/emulation/qemu-armv8/memlayout.ld</span><br><span>new file mode 100644</span><br><span>index 0000000..9c3351f</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/memlayout.ld</span><br><span>@@ -0,0 +1,42 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2014 Google Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <memlayout.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <arch/header.ld></span><br><span style="color: hsl(120, 100%, 40%);">+#include "memorymap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This map is designed to work with new qemu vexpress memory layout and</span><br><span style="color: hsl(120, 100%, 40%);">+ * with -bios option which neatly puts coreboot into flash and so payloads</span><br><span style="color: hsl(120, 100%, 40%);">+ * can find CBFS and we don't risk overwriting CBFS.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Prior to Jul 2014 qemu aliased 0 to begining of RAM instead of flash</span><br><span style="color: hsl(120, 100%, 40%);">+ * and -bios was unusable as $pc pointed to 0 which was zero-filled as a</span><br><span style="color: hsl(120, 100%, 40%);">+ * workaround we suggested using -kernel but this still had all the issues</span><br><span style="color: hsl(120, 100%, 40%);">+ * of having fake-ROM in RAM. In fact it was even worse as fake ROM ends</span><br><span style="color: hsl(120, 100%, 40%);">+ * up exactly at addresses needed to load Linux.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+SECTIONS</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      SRAM_START(VEXPRESS_SRAM_START)</span><br><span style="color: hsl(120, 100%, 40%);">+       BOOTBLOCK(VEXPRESS_SRAM_START, 64K)</span><br><span style="color: hsl(120, 100%, 40%);">+   SRAM_END(VEXPRESS_SRAM_START + 0x200000)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    DRAM_START(VEXPRESS_DRAM_START)</span><br><span style="color: hsl(120, 100%, 40%);">+       STACK(VEXPRESS_DRAM_START, 64K)</span><br><span style="color: hsl(120, 100%, 40%);">+       ROMSTAGE(VEXPRESS_DRAM_START + 0x10000, 128K)</span><br><span style="color: hsl(120, 100%, 40%);">+ RAMSTAGE(VEXPRESS_DRAM_START + 0x30000, 16M)</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/memorymap.h b/src/mainboard/emulation/qemu-armv8/memorymap.h</span><br><span>new file mode 100644</span><br><span>index 0000000..f9a9ef3</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/memorymap.h</span><br><span>@@ -0,0 +1,32 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This software is licensed under the terms of the GNU General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License version 2, as published by the Free Software Foundation, and</span><br><span style="color: hsl(120, 100%, 40%);">+ * may be copied, distributed, and modified under those terms.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef QEMU_ARMV8_MEMORYMAP_H_</span><br><span style="color: hsl(120, 100%, 40%);">+#define QEMU_ARMV8_MEMORYMAP_H_</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Memory map for qemu vexpress-a9 since</span><br><span style="color: hsl(120, 100%, 40%);">+ * 6ec1588e09770ac7e9c60194faff6101111fc7f0 (Jul 2014):</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define VEXPRESS_NORFLASH_START        (0x00000000)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VEXPRESS_UART0_IO_ADDRESS      (0x10009000)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VEXPRESS_TIMER01               (0x10011000)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VEXPRESS_PL111                 (0x10020000)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VEXPRESS_SRAM_START            (0x48000000)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VEXPRESS_FRAMEBUFFER_START     (0x4c000000)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VEXPRESS_DRAM_START            (0x60000000)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* QEMU_ARMV8_MEMORYMAP_H_ */</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/mmio.c b/src/mainboard/emulation/qemu-armv8/mmio.c</span><br><span>new file mode 100644</span><br><span>index 0000000..8d3eaef</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/mmio.c</span><br><span>@@ -0,0 +1,35 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2016 Vladimir Serbinenko <phcoder@gmail.com></span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 or, at your option, any later</span><br><span style="color: hsl(120, 100%, 40%);">+ * version of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#include <console/uart.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <drivers/arm/sp804/sp804.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include "memorymap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+uintptr_t uart_platform_base(int idx)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  if (idx == 0)</span><br><span style="color: hsl(120, 100%, 40%);">+         return VEXPRESS_UART0_IO_ADDRESS;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+uintptr_t timer_platform_baseptr(const size_t idx)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ if (idx == 0)</span><br><span style="color: hsl(120, 100%, 40%);">+         return VEXPRESS_TIMER01;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/romstage.c b/src/mainboard/emulation/qemu-armv8/romstage.c</span><br><span>new file mode 100644</span><br><span>index 0000000..b6314ccd</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/romstage.c</span><br><span>@@ -0,0 +1,23 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2013 Google, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This software is licensed under the terms of the GNU General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License version 2, as published by the Free Software Foundation, and</span><br><span style="color: hsl(120, 100%, 40%);">+ * may be copied, distributed, and modified under those terms.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <console/console.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <program_loading.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void main(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        console_init();</span><br><span style="color: hsl(120, 100%, 40%);">+       run_ramstage();</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/mainboard/emulation/qemu-armv8/timer.c b/src/mainboard/emulation/qemu-armv8/timer.c</span><br><span>new file mode 100644</span><br><span>index 0000000..8163200</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/emulation/qemu-armv8/timer.c</span><br><span>@@ -0,0 +1,30 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2013 Google, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018-present  Facebook, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This software is licensed under the terms of the GNU General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License version 2, as published by the Free Software Foundation, and</span><br><span style="color: hsl(120, 100%, 40%);">+ * may be copied, distributed, and modified under those terms.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <drivers/arm/sp804/sp804.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <delay.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <timer.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void init_timer(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   sp804_init(0);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void timer_monotonic_get(struct mono_time *mt)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        /* QEMU's timer runs at 1MHz, no need to change the raw value */</span><br><span style="color: hsl(120, 100%, 40%);">+  mono_time_set_usecs(mt, sp804_timer_raw_value(0));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/23812">change 23812</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/23812"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib4f2fd43afb855c2ae5760d9ee6ae1478b09104c </div>
<div style="display:none"> Gerrit-Change-Number: 23812 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com> </div>