Sergii Dmytruk has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/57079 )
Change subject: src/mainboard/emulation/qemu-power9/*: add QEMU POWER9 mainboard ......................................................................
src/mainboard/emulation/qemu-power9/*: add QEMU POWER9 mainboard
Add initial implementation for booting on QEMU POWER9 emulation
Change-Id: I079c5b9ad564024dd13296ef75c263bdc40c9d39 Signed-off-by: Yaroslav Kurlaev yaroslav.kurlaev@3mdeb.com --- A configs/config.emulation_qemu_power9 A src/mainboard/emulation/qemu-power9/Kconfig A src/mainboard/emulation/qemu-power9/Kconfig.name A src/mainboard/emulation/qemu-power9/Makefile.inc A src/mainboard/emulation/qemu-power9/board.fmd A src/mainboard/emulation/qemu-power9/board_info.txt A src/mainboard/emulation/qemu-power9/cbmem.c A src/mainboard/emulation/qemu-power9/devicetree.cb A src/mainboard/emulation/qemu-power9/mainboard.c A src/mainboard/emulation/qemu-power9/memlayout.ld A src/mainboard/emulation/qemu-power9/romstage.c 11 files changed, 140 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/79/57079/1
diff --git a/configs/config.emulation_qemu_power9 b/configs/config.emulation_qemu_power9 new file mode 100644 index 0000000..7f64ee8 --- /dev/null +++ b/configs/config.emulation_qemu_power9 @@ -0,0 +1 @@ +CONFIG_BOARD_EMULATION_QEMU_POWER9=y diff --git a/src/mainboard/emulation/qemu-power9/Kconfig b/src/mainboard/emulation/qemu-power9/Kconfig new file mode 100644 index 0000000..67ca4e0 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/Kconfig @@ -0,0 +1,47 @@ +## SPDX-License-Identifier: GPL-2.0-only + +# To execute, do: +# qemu-system-ppc64 -M powernv --cpu power9 --bios 'build/coreboot.rom' + +if BOARD_EMULATION_QEMU_POWER9 + +config BOARD_SPECIFIC_OPTIONS + def_bool y + select CPU_POWER9 + select BOARD_ROMSIZE_KB_512 + select ARCH_BOOTBLOCK_PPC64 + select ARCH_VERSTAGE_PPC64 + select ARCH_ROMSTAGE_PPC64 + select ARCH_RAMSTAGE_PPC64 + select BOOT_DEVICE_NOT_SPI_FLASH + select MISSING_BOARD_RESET + +config MEMLAYOUT_LD_FILE + string + default "src/mainboard/$(CONFIG_MAINBOARD_DIR)/memlayout.ld" + +config FMDFILE + string + default "src/mainboard/$(CONFIG_MAINBOARD_DIR)/board.fmd" + +config MAINBOARD_DIR + string + default "emulation/qemu-power9" + +config MAINBOARD_PART_NUMBER + string + default "QEMU POWER9" + +config MAX_CPUS + int + default 1 + +config MAINBOARD_VENDOR + string + default "Emulation" + +config DRAM_SIZE_MB + int + default 32768 + +endif # BOARD_EMULATION_QEMU_POWER9 diff --git a/src/mainboard/emulation/qemu-power9/Kconfig.name b/src/mainboard/emulation/qemu-power9/Kconfig.name new file mode 100644 index 0000000..1f5d4e1 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/Kconfig.name @@ -0,0 +1,2 @@ +config BOARD_EMULATION_QEMU_POWER9 + bool "QEMU power9" diff --git a/src/mainboard/emulation/qemu-power9/Makefile.inc b/src/mainboard/emulation/qemu-power9/Makefile.inc new file mode 100644 index 0000000..bd905a3 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/Makefile.inc @@ -0,0 +1,4 @@ +## SPDX-License-Identifier: GPL-2.0-only + +romstage-y += cbmem.c +romstage-y += romstage.c diff --git a/src/mainboard/emulation/qemu-power9/board.fmd b/src/mainboard/emulation/qemu-power9/board.fmd new file mode 100644 index 0000000..462cdea --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/board.fmd @@ -0,0 +1,18 @@ +# layout for firmware when flash address space matches used address layout +# +-------------+ <-- 0 +# | unspecified | +# +-------------+ <-- BIOS_BASE +# | bootblock | +# +-------------+ <-- BIOS_BASE + 128K +# | FMAP | +# +-------------+ <-- BIOS_BASE + 128K + FMAP_SIZE +# | CBFS | +# +-------------+ <-- ROM_SIZE + +FLASH@0 CONFIG_ROM_SIZE { + BIOS@0 CONFIG_ROM_SIZE { + BOOTBLOCK 128K + FMAP 0x200 + COREBOOT(CBFS) + } +} diff --git a/src/mainboard/emulation/qemu-power9/board_info.txt b/src/mainboard/emulation/qemu-power9/board_info.txt new file mode 100644 index 0000000..11820e7 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/board_info.txt @@ -0,0 +1,2 @@ +Board name: QEMU POWER9 +Category: emulation diff --git a/src/mainboard/emulation/qemu-power9/cbmem.c b/src/mainboard/emulation/qemu-power9/cbmem.c new file mode 100644 index 0000000..15c20f8 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/cbmem.c @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <cbmem.h> + +void *cbmem_top_chipset(void) +{ + /* Top of cbmem is at lowest usable DRAM address below 4GiB. */ + /* For now, last 1M of 4G */ + void *ptr = (void *) ((1ULL << 32) - 1048576); + return ptr; +} diff --git a/src/mainboard/emulation/qemu-power9/devicetree.cb b/src/mainboard/emulation/qemu-power9/devicetree.cb new file mode 100644 index 0000000..7ea6247 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/devicetree.cb @@ -0,0 +1,5 @@ +## SPDX-License-Identifier: GPL-2.0-only + +chip cpu/power9 + device cpu_cluster 0 on end +end diff --git a/src/mainboard/emulation/qemu-power9/mainboard.c b/src/mainboard/emulation/qemu-power9/mainboard.c new file mode 100644 index 0000000..60c3f8b --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/mainboard.c @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <device/device.h> +#include <cbmem.h> + +static void mainboard_enable(struct device *dev) +{ + + if (!dev) { + die("No dev0; die\n"); + } +} + +struct chip_operations mainboard_ops = { + .enable_dev = mainboard_enable, +}; diff --git a/src/mainboard/emulation/qemu-power9/memlayout.ld b/src/mainboard/emulation/qemu-power9/memlayout.ld new file mode 100644 index 0000000..ebac3c4 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/memlayout.ld @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <memlayout.h> + +#include <arch/header.ld> + +SECTIONS +{ + DRAM_START(0x0) + + BOOTBLOCK(0, 32K) + + STACK(0x8000, 32K) + + PRERAM_CBMEM_CONSOLE(0x10000, 128K) + FMAP_CACHE(0x30000, 4K) + CBFS_MCACHE(0x31000, 8K) + TIMESTAMP(0x33000, 4K) + CBFS_CACHE(0x34000, 512K) + ROMSTAGE(0x100000, 1M) + + RAMSTAGE(0x300000, 5M) +} diff --git a/src/mainboard/emulation/qemu-power9/romstage.c b/src/mainboard/emulation/qemu-power9/romstage.c new file mode 100644 index 0000000..c412315 --- /dev/null +++ b/src/mainboard/emulation/qemu-power9/romstage.c @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <program_loading.h> + +void main(void) +{ + console_init(); + run_ramstage(); +}