Martin Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32415
Change subject: soc/amd/picasso: Add code to support Romstage in RAM
......................................................................
soc/amd/picasso: Add code to support Romstage in RAM
AMD's Picasso SOC brings up memory before releasing the X86 processor,
and jumps directly to Romstage. This adds the platform support for that.
TEST=None
BUG=b:130804851
Signed-off-by: Martin Roth <martinroth(a)chromium.org>
Change-Id: I5ac62f6f3edb0c903fdc880fa655727ad2bc86bb
---
M src/soc/amd/picasso/Kconfig
A src/soc/amd/picasso/include/soc/romstage.ld
A src/soc/amd/picasso/reset_vector.S
3 files changed, 187 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/32415/1
diff --git a/src/soc/amd/picasso/Kconfig b/src/soc/amd/picasso/Kconfig
index 129dedf..3d30b46b 100644
--- a/src/soc/amd/picasso/Kconfig
+++ b/src/soc/amd/picasso/Kconfig
@@ -26,6 +26,7 @@
select ARCH_VERSTAGE_X86_32
select ARCH_ROMSTAGE_X86_32
select ARCH_RAMSTAGE_X86_32
+ select ROMSTAGE_IN_RAM
select X86_AMD_FIXED_MTRRS
select ACPI_AMD_HARDWARE_SLEEP_VALUES
select COLLECT_TIMESTAMPS_NO_TSC
diff --git a/src/soc/amd/picasso/include/soc/romstage.ld b/src/soc/amd/picasso/include/soc/romstage.ld
new file mode 100644
index 0000000..4be3340
--- /dev/null
+++ b/src/soc/amd/picasso/include/soc/romstage.ld
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#if ENV_ROMSTAGE && CONFIG(ROMSTAGE_IN_RAM)
+SECTIONS {
+ _JMP_IN_RAM = CONFIG_ROMSTAGE_ADDR + CONFIG_ROMSTAGE_MAX_SIZE - 0x1000;
+ . = _JMP_IN_RAM;
+ .resetram . : { *(.resetram) }
+ _RST_IN_RAM = CONFIG_ROMSTAGE_ADDR + CONFIG_ROMSTAGE_MAX_SIZE - 0x10;
+ . = _RST_IN_RAM;
+ .reset . : {
+ *(.reset);
+ . = 15;
+ BYTE(0x00);
+ }
+}
+#endif
diff --git a/src/soc/amd/picasso/reset_vector.S b/src/soc/amd/picasso/reset_vector.S
new file mode 100644
index 0000000..6a3bbfa
--- /dev/null
+++ b/src/soc/amd/picasso/reset_vector.S
@@ -0,0 +1,157 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2000, Ron Minnich rminnich(a)lanl.gov
+ * Advanced Computing Lab, LANL
+ * Copyright (C) 2019 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <cpu/x86/cr.h>
+#include <cpu/x86/post_code.h>
+#include <arch/rom_segs.h>
+
+/* The resetram section keeps this code within reach of the first jmp to
+ * _start16bit. This functionality is contained within bootblock on most
+ * other systems, however this file is part of romstage which isn't subject
+ * to the same size limitations.
+ */
+.section ".resetram", "ax", %progbits
+
+.align 4096
+.code16
+.globl _start16bit
+.type _start16bit, @function
+
+_start16bit:
+ cli
+ /* Save the BIST result */
+ movl %eax, %ebp
+
+ post_code(POST_RESET_VECTOR_CORRECT)
+
+ /* IMMEDIATELY invalidate the translation lookaside buffer (TLB) before
+ * executing any further code. Even though paging is disabled we
+ * could still get false address translations due to the TLB if we
+ * didn't invalidate it. Thanks to kmliu(a)sis.com.tw for this TLB fix.
+ */
+
+ xorl %eax, %eax
+ movl %eax, %cr3 /* Invalidate TLB*/
+
+ /*
+ * Load an IDT with NULL limit to prevent the 16bit IDT being used
+ * in protected mode before c_start.S sets up a 32bit IDT when entering
+ * RAM stage. In practise: CPU will shutdown on any exception.
+ * See IA32 manual Vol 3A 19.26 Interrupts.
+ */
+ movl $nullidt_amd, %ebx
+ lidt %cs:(%bx)
+
+ movl $fseg_gdt, %ebx
+ lgdtl %cs:(%bx)
+
+ movl %cr0, %eax
+ andl $0x7FFAFFD1, %eax /* PG,AM,WP,NE,TS,EM,MP = 0 */
+ orl $0x60000001, %eax /* CD, NW, PE = 1 */
+ movl %eax, %cr0
+
+ /* Until now, the processor was executing in DRAM however the CS
+ * register's base and limit looked more like what you see after a
+ * traditional x86 reset. The value in CS has been 0xf000. Now that
+ * the GDT is loaded with flat descriptors, try to jump to
+ * 0x8:$__protected_start at its physical address in DRAM.
+ */
+ ljmpl $ROM_CODE_SEG, $__protected_start
+
+.align 4
+.globl nullidt_amd
+nullidt_amd:
+ .word 0 /* limit */
+ .long 0
+ .word 0
+
+ .align 4
+
+gdt:
+fseg_gdt:
+ .word gdt_end - gdt -1
+ .long gdt
+ .word 0
+
+ /* selgdt 0x08, flat code segment */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes
+ for limit */
+
+ /* selgdt 0x10,flat data segment */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x93, 0xcf, 0x00
+
+ /* selgdt 0x18, flat code segment (64-bit) */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x9b, 0xaf, 0x00
+gdt_end:
+
+.code32
+.align 4
+
+__protected_start:
+ post_code(POST_ENTER_PROTECTED_MODE)
+
+ movw $ROM_DATA_SEG, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %ss
+ movw %ax, %fs
+ movw %ax, %gs
+
+#if CONFIG(SSE)
+enable_sse:
+ mov %cr4, %eax
+ or $CR4_OSFXSR, %ax
+ mov %eax, %cr4
+#endif /* CONFIG(SSE) */
+
+ cld
+ xor %eax, %eax
+ movl $(_car_region_end), %ecx
+ movl $(_car_region_start), %edi
+ sub %edi, %ecx
+ rep stosl
+
+ mov $_car_stack_end, %esp
+
+ /* Store BIST and an early timestamp at the top of the stack. See
+ * structure in soc/romstage.h for layout.
+ */
+ rdtsc /* timestamp */
+ push %edx
+ push %eax
+ push %ebp /* BIST */
+
+ and $0xfffffff0, %esp
+ sub $8, %esp
+
+ jmp _romstage_in_ram_continue
+
+.section ".reset", "ax", %progbits
+.code16
+.globl _start
+_start:
+ .byte 0xe9
+ .int _start16bit - ( . + 2 )
+ /* Note: The above jump is hand coded to work around bugs in binutils.
+ * 5 byte are used for a 3 byte instruction. This works because x86
+ * is little endian and allows us to use supported 32bit relocations
+ * instead of the weird 16 bit relocations that binutils does not
+ * handle consistently between versions because they are used so rarely.
+ */
--
To view, visit https://review.coreboot.org/c/coreboot/+/32415
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5ac62f6f3edb0c903fdc880fa655727ad2bc86bb
Gerrit-Change-Number: 32415
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-MessageType: newchange
Sumeet R Pawnikar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33131
Change subject: mb/google/sarien/variants/sarien: Set PCH Thermal Trip point to 75 degree C
......................................................................
mb/google/sarien/variants/sarien: Set PCH Thermal Trip point to 75 degree C
PMC logic shuts down the PCH thermal sensor when CPU is in a C-state and
DTS Temp <= Low Temp Threshold (LTT) in case of Dynamic Thermal Shutdown
when S0ix is enabled.
BUG=None
BRANCH=None
TEST=Verified Thermal Device (B0: D20: F2) TSPM offset 0x1c [LTT (8:0)]
value is 0xFA.
Change-Id: Ibc336be0523ff4e65a818474907faf20fc417ff4
Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar(a)intel.com>
---
M src/mainboard/google/sarien/variants/sarien/devicetree.cb
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/33131/1
diff --git a/src/mainboard/google/sarien/variants/sarien/devicetree.cb b/src/mainboard/google/sarien/variants/sarien/devicetree.cb
index c96423c..595fcf5 100644
--- a/src/mainboard/google/sarien/variants/sarien/devicetree.cb
+++ b/src/mainboard/google/sarien/variants/sarien/devicetree.cb
@@ -163,6 +163,9 @@
register "tcc_offset" = "10"
+ # PCH Trip Temperature in degree C
+ register "pch_trip_temp" = "75"
+
register "common_soc_config" = "{
.chipset_lockdown = CHIPSET_LOCKDOWN_COREBOOT,
.i2c[0] = {
--
To view, visit https://review.coreboot.org/c/coreboot/+/33131
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ibc336be0523ff4e65a818474907faf20fc417ff4
Gerrit-Change-Number: 33131
Gerrit-PatchSet: 1
Gerrit-Owner: Sumeet R Pawnikar <sumeet.r.pawnikar(a)intel.com>
Gerrit-MessageType: newchange
Sumeet R Pawnikar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33130
Change subject: mb/google/sarien/variants/arcada: Set PCH Thermal Trip point to 75 degree C
......................................................................
mb/google/sarien/variants/arcada: Set PCH Thermal Trip point to 75 degree C
PMC logic shuts down the PCH thermal sensor when CPU is in a C-state and
DTS Temp <= Low Temp Threshold (LTT) in case of Dynamic Thermal shutdown
when S0ix is enabled.
BUG=None
BRANCH=None
TEST=Verified Thermal Device(B0: D18: F0) TSPM offset 0x1c [LTT (8:0)]
value is 0xFA.
Change-Id: I1915b974b10638b0f6ab97c6fb9b7a58d2cabc59
Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar(a)intel.com>
---
M src/mainboard/google/sarien/variants/arcada/devicetree.cb
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/33130/1
diff --git a/src/mainboard/google/sarien/variants/arcada/devicetree.cb b/src/mainboard/google/sarien/variants/arcada/devicetree.cb
index 767df1f..b6aa041 100644
--- a/src/mainboard/google/sarien/variants/arcada/devicetree.cb
+++ b/src/mainboard/google/sarien/variants/arcada/devicetree.cb
@@ -164,6 +164,9 @@
register "tcc_offset" = "1"
+ # PCH Trip Temperature in degree C
+ register "pch_trip_temp" = "75"
+
register "common_soc_config" = "{
.chipset_lockdown = CHIPSET_LOCKDOWN_COREBOOT,
.i2c[0] = {
--
To view, visit https://review.coreboot.org/c/coreboot/+/33130
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I1915b974b10638b0f6ab97c6fb9b7a58d2cabc59
Gerrit-Change-Number: 33130
Gerrit-PatchSet: 1
Gerrit-Owner: Sumeet R Pawnikar <sumeet.r.pawnikar(a)intel.com>
Gerrit-MessageType: newchange
Philipp Hug has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31215
Change subject: WIP: riscv: Implement FIT for RISC-V
......................................................................
WIP: riscv: Implement FIT for RISC-V
Change-Id: Ic50f14a4f483d904db590ecd53bb1fc5bdeb06d6
---
M payloads/Kconfig
M src/arch/riscv/Makefile.inc
A src/arch/riscv/fit_payload.c
M src/soc/sifive/fu540/Kconfig
4 files changed, 171 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/31215/1
diff --git a/payloads/Kconfig b/payloads/Kconfig
index c7a7ba6..0c5ce8f 100644
--- a/payloads/Kconfig
+++ b/payloads/Kconfig
@@ -30,7 +30,7 @@
config PAYLOAD_FIT
bool "A FIT payload"
- depends on ARCH_ARM64
+ depends on ARCH_ARM64 || ARCH_RISCV
select PAYLOAD_FIT_SUPPORT
help
Select this option if you have a payload image (a FIT file) which
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index e4c8468..12609d4 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -139,6 +139,7 @@
ramstage-y += tables.c
ramstage-y += payload.S
ramstage-$(ARCH_RISCV_PMP) += pmp.c
+ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
ramstage-y += \
$(top)/src/lib/memchr.c \
$(top)/src/lib/memcmp.c \
diff --git a/src/arch/riscv/fit_payload.c b/src/arch/riscv/fit_payload.c
new file mode 100644
index 0000000..2176095
--- /dev/null
+++ b/src/arch/riscv/fit_payload.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2013 Google Inc.
+ * Copyright 2018 Facebook, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <console/console.h>
+#include <bootmem.h>
+#include <stdlib.h>
+#include <program_loading.h>
+#include <string.h>
+#include <commonlib/compression.h>
+#include <commonlib/cbfs_serialized.h>
+#include <lib.h>
+#include <fit.h>
+#include <endian.h>
+
+#define MAX_KERNEL_SIZE (64*MiB)
+
+static bool fit_place_kernel(const struct range_entry *r, void *arg)
+{
+ struct region *region = arg;
+ resource_t start;
+
+ if (range_entry_tag(r) != BM_MEM_RAM)
+ return true;
+
+ /**
+ * The Image must be placed text_offset bytes from a 2MB aligned base
+ * address anywhere in usable system RAM and called there. The region
+ * between the 2 MB aligned base address and the start of the image has
+ * no special significance to the kernel, and may be used for other
+ * purposes.
+ *
+ * If the reserved memory (BL31 for example) is smaller than text_offset
+ * we can use the 2 MiB base address, otherwise use the next 2 MiB page.
+ * It's not mandatory, but wastes less memory below the kernel.
+ */
+ start = ALIGN_DOWN(range_entry_base(r), 2 * MiB);
+
+ if (start < range_entry_base(r))
+ start += 2 * MiB;
+ /**
+ * At least image_size bytes from the start of the image must be free
+ * for use by the kernel.
+ */
+ if (start + region->size < range_entry_end(r)) {
+ region->offset = (size_t)start;
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Place the region in free memory range.
+ *
+ * The caller has to set region->offset to the minimum allowed address.
+ * The region->offset is usually 0 on kernel >v4.6 and kernel_base + kernel_size
+ * on kernel <v4.6.
+ */
+static bool fit_place_mem(const struct range_entry *r, void *arg)
+{
+ struct region *region = arg;
+ resource_t start;
+
+ if (range_entry_tag(r) != BM_MEM_RAM)
+ return true;
+
+ /* Linux 4.15 doesn't like 4KiB alignment. Align to 1 MiB for now. */
+ start = ALIGN_UP(MAX(region->offset, range_entry_base(r)), 1 * MiB);
+
+ if (start + region->size < range_entry_end(r)) {
+ region->offset = (size_t)start;
+ return false;
+ }
+
+ return true;
+}
+
+bool fit_payload_arch(struct prog *payload, struct fit_config_node *config,
+ struct region *kernel,
+ struct region *fdt,
+ struct region *initrd)
+{
+ bool place_anywhere;
+ void *arg = NULL;
+
+ if (!config->fdt || !fdt) {
+ printk(BIOS_CRIT, "CRIT: Providing a valid FDT is mandatory to "
+ "boot an RISCV kernel!\n");
+ return false;
+ }
+
+ /* Update kernel size from image header, if possible */
+ kernel->size = 0x2000000; //get_kernel_size(config->kernel_node);
+ printk(BIOS_DEBUG, "FIT: Using kernel size of 0x%zx bytes\n",
+ kernel->size);
+
+
+ /**
+ * The code assumes that bootmem_walk provides a sorted list of memory
+ * regions, starting from the lowest address.
+ * The order of the calls here doesn't matter, as the placement is
+ * enforced in the called functions.
+ * For details check code on top.
+ */
+
+ if (!bootmem_walk(fit_place_kernel, kernel))
+ return false;
+
+ /* Mark as reserved for future allocations. */
+ bootmem_add_range(kernel->offset, kernel->size, BM_MEM_PAYLOAD);
+
+ /**
+ * NOTE: versions prior to v4.6 cannot make use of memory below the
+ * physical offset of the Image so it is recommended that the Image be
+ * placed as close as possible to the start of system RAM.
+ *
+ * For kernel <v4.6 the INITRD and FDT can't be placed below the kernel.
+ * In that case set region offset to an address on top of kernel.
+ */
+
+ place_anywhere = false;
+ printk(BIOS_DEBUG, "FIT: Placing FDT and INITRD %s\n",
+ place_anywhere ? "anywhere" : "on top of kernel");
+
+ /* Place INITRD */
+ if (config->ramdisk) {
+ initrd->offset = 0;
+
+ if (!bootmem_walk(fit_place_mem, initrd))
+ return false;
+ /* Mark as reserved for future allocations. */
+ bootmem_add_range(initrd->offset, initrd->size, BM_MEM_PAYLOAD);
+ }
+
+ /* Place FDT */
+ if (place_anywhere)
+ fdt->offset = 0;
+ else
+ fdt->offset = kernel->offset + kernel->size;
+
+ if (!bootmem_walk(fit_place_mem, fdt))
+ return false;
+ /* Mark as reserved for future allocations. */
+ bootmem_add_range(fdt->offset, fdt->size, BM_MEM_PAYLOAD);
+
+ /* Kernel expects FDT as argument */
+ arg = (void *)fdt->offset;
+
+ prog_set_entry(payload, (void *)kernel->offset, arg);
+
+ bootmem_dump_ranges();
+
+ return true;
+}
diff --git a/src/soc/sifive/fu540/Kconfig b/src/soc/sifive/fu540/Kconfig
index 6ebde33..20645da 100644
--- a/src/soc/sifive/fu540/Kconfig
+++ b/src/soc/sifive/fu540/Kconfig
@@ -49,4 +49,7 @@
int
default 0
+config HEAP_SIZE
+ default 0x10000
+
endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/31215
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ic50f14a4f483d904db590ecd53bb1fc5bdeb06d6
Gerrit-Change-Number: 31215
Gerrit-PatchSet: 1
Gerrit-Owner: Philipp Hug <philipp(a)hug.cx>
Gerrit-MessageType: newchange
Asami Doi has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33387
Change subject: mainboard/emulation/qemu-aarch64: Add new board for ARMv8
......................................................................
mainboard/emulation/qemu-aarch64: Add new board for ARMv8
This CL adds new board, QEMU/AArch64, for ARMv8. The machine supported
is virt which is a QEMU 2.8 ARM virtual machine. The default CPU of
qemu-system-aarch64 is Cortex-a15, so you need to specify a 64-bit cpu
via a flag.
To execute:
$ qemu-system-aarch64 -M virt -cpu cortex-a53 \
-bios build/coreboot.rom -nographic
Change-Id: Id7c0831b1ecf08785b4ec8139d809bad9b3e1eec
Signed-off-by: Asami Doi <doiasami1219(a)gmail.com>
---
M src/cpu/armltd/Kconfig
M src/cpu/armltd/Makefile.inc
A src/cpu/armltd/cortex-a53/Kconfig
A src/mainboard/emulation/qemu-aarch64/Kconfig
A src/mainboard/emulation/qemu-aarch64/Kconfig.name
A src/mainboard/emulation/qemu-aarch64/Makefile.inc
A src/mainboard/emulation/qemu-aarch64/board_info.txt
A src/mainboard/emulation/qemu-aarch64/cbmem.c
A src/mainboard/emulation/qemu-aarch64/devicetree.cb
A src/mainboard/emulation/qemu-aarch64/mainboard.c
A src/mainboard/emulation/qemu-aarch64/mainboard.h
A src/mainboard/emulation/qemu-aarch64/media.c
A src/mainboard/emulation/qemu-aarch64/memlayout.ld
A src/mainboard/emulation/qemu-aarch64/mmio.c
A src/mainboard/emulation/qemu-aarch64/timer.c
15 files changed, 408 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/33387/1
diff --git a/src/cpu/armltd/Kconfig b/src/cpu/armltd/Kconfig
index af0c5c5..fc01735 100644
--- a/src/cpu/armltd/Kconfig
+++ b/src/cpu/armltd/Kconfig
@@ -1 +1,2 @@
source src/cpu/armltd/cortex-a9/Kconfig
+source src/cpu/armltd/cortex-a53/Kconfig
diff --git a/src/cpu/armltd/Makefile.inc b/src/cpu/armltd/Makefile.inc
index 014742f..cd6acf1 100644
--- a/src/cpu/armltd/Makefile.inc
+++ b/src/cpu/armltd/Makefile.inc
@@ -1 +1,2 @@
subdirs-$(CONFIG_CPU_ARMLTD_CORTEX_A9) += cortex-a9
+subdirs-$(CONFIG_CPU_ARMLTD_CORTEX_A53) += cortex-a53
diff --git a/src/cpu/armltd/cortex-a53/Kconfig b/src/cpu/armltd/cortex-a53/Kconfig
new file mode 100644
index 0000000..1cbfc33
--- /dev/null
+++ b/src/cpu/armltd/cortex-a53/Kconfig
@@ -0,0 +1,10 @@
+config CPU_ARMLTD_CORTEX_A53
+ bool
+ select ARCH_BOOTBLOCK_ARMV8_64
+ select ARCH_ROMSTAGE_ARMV8_64
+ select ARCH_RAMSTAGE_ARMV8_64
+ default n
+
+if CPU_ARMLTD_CORTEX_A53
+
+endif
diff --git a/src/mainboard/emulation/qemu-aarch64/Kconfig b/src/mainboard/emulation/qemu-aarch64/Kconfig
new file mode 100644
index 0000000..9fda646
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/Kconfig
@@ -0,0 +1,56 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2019 Asami Doi <d0iasm.pub(a)gmail.com>.
+##
+## This software is licensed under the terms of the GNU General Public
+## License version 2, as published by the Free Software Foundation, and
+## may be copied, distributed, and modified under those terms.
+##
+## This program 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 General Public License for more details.
+
+# Emulation for QEMU 2.8 ARM Virtual Machine (alias of virt-2.8)
+# https://wiki.qemu.org/Documentation/Platforms/ARM
+
+# To execute, do:
+# export QEMU_AUDIO_DRV = none
+# qemu-system-aarch64 -M virt -m 1024M -cpu cortex-a53 -nographic -bios build/coreboot.rom
+
+if BOARD_EMULATION_QEMU_AARCH64
+
+config BOARD_SPECIFIC_OPTIONS
+ def_bool y
+ select CPU_ARMLTD_CORTEX_A53
+ select DRIVERS_UART_PL011
+ select CONSOLE_SERIAL
+ select MAINBOARD_HAS_NATIVE_VGA_INIT
+ select MAINBOARD_FORCE_NATIVE_VGA_INIT
+ select HAVE_LINEAR_FRAMEBUFFER
+ select ARCH_BOOTBLOCK_ARMV8_64
+ select ARCH_VERSTAGE_ARMV8_64
+ select ARCH_ROMSTAGE_ARMV8_64
+ select ARCH_RAMSTAGE_ARMV8_64
+ select BOARD_ROMSIZE_KB_4096
+ select BOOT_DEVICE_NOT_SPI_FLASH
+ select MISSING_BOARD_RESET
+
+config MAINBOARD_DIR
+ string
+ default emulation/qemu-aarch64
+
+config MAINBOARD_PART_NUMBER
+ string
+ default "QEMU AArch64"
+
+config MAX_CPUS
+ int
+ default 2
+
+config MAINBOARD_VENDOR
+ string
+ default "ARM Ltd."
+
+endif # BOARD_EMULATION_QEMU_AARCH64
diff --git a/src/mainboard/emulation/qemu-aarch64/Kconfig.name b/src/mainboard/emulation/qemu-aarch64/Kconfig.name
new file mode 100644
index 0000000..9789823
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/Kconfig.name
@@ -0,0 +1,2 @@
+config BOARD_EMULATION_QEMU_AARCH64
+ bool "QEMU AArch64 (virt)"
diff --git a/src/mainboard/emulation/qemu-aarch64/Makefile.inc b/src/mainboard/emulation/qemu-aarch64/Makefile.inc
new file mode 100644
index 0000000..e120bec
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/Makefile.inc
@@ -0,0 +1,32 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2019 Asami Doi <d0iasm.pub(a)gmail.com>
+##
+## This software is licensed under the terms of the GNU General Public
+## License version 2, as published by the Free Software Foundation, and
+## may be copied, distributed, and modified under those terms.
+##
+## This program 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 General Public License for more details.
+
+romstage-y += cbmem.c
+ramstage-y += cbmem.c
+
+bootblock-y += media.c
+romstage-y += media.c
+ramstage-y += media.c
+
+bootblock-y += timer.c
+romstage-y += timer.c
+ramstage-y += timer.c
+
+bootblock-y += mmio.c
+romstage-y += mmio.c
+ramstage-y += mmio.c
+
+bootblock-y += memlayout.ld
+romstage-y += memlayout.ld
+ramstage-y += memlayout.ld
diff --git a/src/mainboard/emulation/qemu-aarch64/board_info.txt b/src/mainboard/emulation/qemu-aarch64/board_info.txt
new file mode 100644
index 0000000..e3ecc19
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/board_info.txt
@@ -0,0 +1,3 @@
+Board name: QEMU AArch64 (virt)
+Category: emulation
+Board URL: https://wiki.qemu.org/Documentation/Platforms/ARM
diff --git a/src/mainboard/emulation/qemu-aarch64/cbmem.c b/src/mainboard/emulation/qemu-aarch64/cbmem.c
new file mode 100644
index 0000000..635fe4b
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/cbmem.c
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <stddef.h>
+#include <cbmem.h>
+#include <symbols.h>
+#include <device/mmio.h>
+#include "mainboard.h"
+
+#define PATTERN1 0x55
+#define PATTERN2 0xaa
+
+/* Returns 1 if mebibyte mb is present and 0 otherwise. */
+static int probe_mb(int mb)
+{
+ char *ptr = (char *)0x60000000 + (mb << 20) + 0xfffff;
+ char old;
+ if (ptr < (char *)&_eprogram) {
+ /* Don't probe below _end to avoid accidentally clobering
+ oneself. */
+ return 1;
+ }
+
+ old = read8(ptr);
+ write8(ptr, PATTERN1);
+ if (read8(ptr) != PATTERN1)
+ return 0;
+ write8(ptr, PATTERN2);
+ if (read8(ptr) != PATTERN2)
+ return 0;
+ write8(ptr, old);
+ return 1;
+}
+
+int probe_ramsize(void)
+{
+ int i;
+ int discovered = 0;
+ static int saved_result;
+ if (saved_result)
+ return saved_result;
+ /* Compact binary search. */
+ /* 1 GiB is the largest supported RAM by this machine. */
+ for (i = 9; i >= 0; i--)
+ if (probe_mb(discovered | (1 << i)))
+ discovered |= (1 << i);
+ discovered++;
+ saved_result = discovered;
+ return discovered;
+}
+
+void *cbmem_top(void)
+{
+ return _dram + (probe_ramsize() << 20);
+}
diff --git a/src/mainboard/emulation/qemu-aarch64/devicetree.cb b/src/mainboard/emulation/qemu-aarch64/devicetree.cb
new file mode 100644
index 0000000..258d7ba
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/devicetree.cb
@@ -0,0 +1,19 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2019 Asami Doi <d0iasm.pub(a)gmail.com>.
+##
+## This software is licensed under the terms of the GNU General Public
+## License version 2, as published by the Free Software Foundation, and
+## may be copied, distributed, and modified under those terms.
+##
+## This program 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 General Public License for more details.
+
+chip cpu/armltd/cortex-a53
+ chip drivers/generic/generic # I2C0 controller
+ device i2c 6 on end # Fake component for testing
+ end
+end
diff --git a/src/mainboard/emulation/qemu-aarch64/mainboard.c b/src/mainboard/emulation/qemu-aarch64/mainboard.c
new file mode 100644
index 0000000..f0b90f1
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/mainboard.c
@@ -0,0 +1,69 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Asami Doi <d0iasm.pub(a)gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 or, at your option, any later
+ * version of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <cbmem.h>
+#include <halt.h>
+#include "mainboard.h"
+#include <edid.h>
+#include <device/mmio.h>
+
+static void init_gfx(void)
+{
+ uint32_t *pl111;
+ struct edid edid;
+ /* width is at most 4096 */
+ /* height is at most 1024 */
+ int width = 800, height = 600;
+ uint32_t framebuffer = 0x4c000000;
+ pl111 = (uint32_t *)0x10020000;
+ write32(pl111, (width / 4) - 4);
+ write32(pl111 + 1, height - 1);
+ /* registers 2, 3 and 5 are ignored by qemu. Set them correctly if
+ we ever go for real hw. */
+ /* framebuffer address offset. Has to be in vram. */
+ write32(pl111 + 4, framebuffer);
+ write32(pl111 + 7, 0);
+ write32(pl111 + 10, 0xff);
+ write32(pl111 + 6, (5 << 1) | 0x801);
+
+ edid.framebuffer_bits_per_pixel = 32;
+ edid.bytes_per_line = width * 4;
+ edid.x_resolution = width;
+ edid.y_resolution = height;
+
+ set_vbe_mode_info_valid(&edid, framebuffer);
+}
+
+static void mainboard_enable(struct device *dev)
+{
+ int discovered;
+ if (!dev) {
+ printk(BIOS_EMERG, "No dev0; die\n");
+ halt();
+ }
+
+ discovered = probe_ramsize();
+ printk(BIOS_DEBUG, "%d MiB of RAM discovered\n", discovered);
+ ram_resource(dev, 0, 0x60000000 >> 10, discovered << 10);
+ cbmem_recovery(0);
+ init_gfx();
+}
+
+struct chip_operations mainboard_ops = {
+ .enable_dev = mainboard_enable,
+};
diff --git a/src/mainboard/emulation/qemu-aarch64/mainboard.h b/src/mainboard/emulation/qemu-aarch64/mainboard.h
new file mode 100644
index 0000000..b6927ea
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/mainboard.h
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Asami Doi <d0iasm.pub(a)gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 or, at your option, any later
+ * version of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef QEMU_AARCH64_MAINBOARD_H
+#define QEMU_AARCH64_MAINBOARD_H
+
+/* Returns RAM size in mebibytes. */
+int probe_ramsize(void);
+
+#endif
diff --git a/src/mainboard/emulation/qemu-aarch64/media.c b/src/mainboard/emulation/qemu-aarch64/media.c
new file mode 100644
index 0000000..c9c3a34
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/media.c
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Asami Doi <d0iasm.pub(a)gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <boot_device.h>
+
+/* Maps directly to NOR flash up to ROM size. */
+static const struct mem_region_device boot_dev =
+ MEM_REGION_DEV_RO_INIT((void *)0x0, CONFIG_ROM_SIZE);
+
+const struct region_device *boot_device_ro(void)
+{
+ return &boot_dev.rdev;
+}
diff --git a/src/mainboard/emulation/qemu-aarch64/memlayout.ld b/src/mainboard/emulation/qemu-aarch64/memlayout.ld
new file mode 100644
index 0000000..03db138
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/memlayout.ld
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Asami Doi <d0iasm.pub(a)gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <memlayout.h>
+
+#include <arch/header.ld>
+
+/*
+ * Memory map for QEMU virt machine since
+ * a578cdfbdd8f9beff5ced52b7826ddb1669abbbf (June 2019):
+ *
+ * 0x0000_0000: Flash memory
+ * 0x0800_0000: I/O map address
+ * 0x6000_0000: RAM
+ */
+
+#define VIRT_FLASH_START 0x00000000
+#define VIRT_IO_START 0x08000000
+#define VIRT_DRAM_START 0x60000000
+
+/*
+ * This map is designed to work with new qemu virt memory layout and
+ * with -bios option which neatly puts coreboot into flash and so payloads
+ * can find CBFS and we don't risk overwriting CBFS.
+ *
+ * Prior to Jul 2014 qemu aliased 0 to begining of RAM instead of flash
+ * and -bios was unusable as $pc pointed to 0 which was zero-filled as a
+ * workaround we suggested using -kernel but this still had all the issues
+ * of having fake-ROM in RAM. In fact it was even worse as fake ROM ends
+ * up exactly at addresses needed to load Linux.
+ */
+SECTIONS
+{
+ BOOTBLOCK(VIRT_FLASH_START, 64K)
+
+ DRAM_START(VIRT_DRAM_START)
+ STACK(VIRT_DRAM_START, 64K)
+ ROMSTAGE(VIRT_DRAM_START + 0x10000, 128K)
+ RAMSTAGE(VIRT_DRAM_START + 0x30000, 16M)
+
+ /* TODO: Implement MMU support and move TTB to a better location. */
+ TTB(0x61030000, 16K)
+}
diff --git a/src/mainboard/emulation/qemu-aarch64/mmio.c b/src/mainboard/emulation/qemu-aarch64/mmio.c
new file mode 100644
index 0000000..1b9a669
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/mmio.c
@@ -0,0 +1,21 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <console/uart.h>
+
+#define VIRT_UART_IO_ADDRESS (0x09000000)
+
+uintptr_t uart_platform_base(int idx)
+{
+ return VIRT_UART_IO_ADDRESS;
+}
diff --git a/src/mainboard/emulation/qemu-aarch64/timer.c b/src/mainboard/emulation/qemu-aarch64/timer.c
new file mode 100644
index 0000000..599a872
--- /dev/null
+++ b/src/mainboard/emulation/qemu-aarch64/timer.c
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Asami Doi <d0iasm.pub(a)gmail.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+void udelay(unsigned int n);
+void udelay(unsigned int n)
+{
+ /* TODO provide delay here. */
+}
+
+int init_timer(void);
+int init_timer(void)
+{
+ return 0;
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/33387
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id7c0831b1ecf08785b4ec8139d809bad9b3e1eec
Gerrit-Change-Number: 33387
Gerrit-PatchSet: 1
Gerrit-Owner: Asami Doi <d0iasm.pub(a)gmail.com>
Gerrit-MessageType: newchange
Christian Walter has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33250
Change subject: src/superio/aspeed/common: Add ACPI Template for Autogen Feature
......................................................................
src/superio/aspeed/common: Add ACPI Template for Autogen Feature
Add ACPI Template for Autogen Feature.
Change-Id: Ic356af269e381bd5310d9be057bc16f9d5186934
Signed-off-by: Christian Walter <christian.walter(a)9elements.com>
---
A src/superio/aspeed/common/acpi/superio.asl
1 file changed, 21 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/33250/1
diff --git a/src/superio/aspeed/common/acpi/superio.asl b/src/superio/aspeed/common/acpi/superio.asl
new file mode 100644
index 0000000..6b8b8f6
--- /dev/null
+++ b/src/superio/aspeed/common/acpi/superio.asl
@@ -0,0 +1,21 @@
+##
+## This file is part of the coreboot project.
+##
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program 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 General Public License for more details.
+##
+
+Device (SIO0)
+{
+ Name (_HID, EisaId ("PNP0C02") /* PNP Motherboard Resources */) // _HID: Hardware ID
+ Name (_UID, Zero) // _UID: Unique ID
+
+}
\ No newline at end of file
--
To view, visit https://review.coreboot.org/c/coreboot/+/33250
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ic356af269e381bd5310d9be057bc16f9d5186934
Gerrit-Change-Number: 33250
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Walter <christian.walter(a)9elements.com>
Gerrit-MessageType: newchange