Kangheui Won has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44751 )
Change subject: soc/amd/picasso: copy local info to transfer buf
......................................................................
soc/amd/picasso: copy local info to transfer buf
buffer_info is local variable, we need to copy it to _transfer_buffer
before we hand it over to PSP.
BUG=b:159220781
TEST=check transfer_info_struct is correctly populated on romstage
Signed-off-by: Kangheui Won <khwon(a)chromium.org>
Change-Id: I14bc34e6af501240a6f633db3999a7759e88d60b
---
M src/soc/amd/picasso/psp_verstage/psp_verstage.c
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/44751/1
diff --git a/src/soc/amd/picasso/psp_verstage/psp_verstage.c b/src/soc/amd/picasso/psp_verstage/psp_verstage.c
index 005c8b0..ef4884f 100644
--- a/src/soc/amd/picasso/psp_verstage/psp_verstage.c
+++ b/src/soc/amd/picasso/psp_verstage/psp_verstage.c
@@ -186,6 +186,8 @@
buffer_info.workbuf_offset = (uint32_t)((uintptr_t)_fmap_cache -
(uintptr_t)_vboot2_work);
+ memcpy(_transfer_buffer, &buffer_info, sizeof(buffer_info));
+
retval = svc_save_uapp_data(UAPP_COPYBUF_CHROME_WORKBUF, (void *)_transfer_buffer,
buffer_size);
if (retval) {
--
To view, visit https://review.coreboot.org/c/coreboot/+/44751
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I14bc34e6af501240a6f633db3999a7759e88d60b
Gerrit-Change-Number: 44751
Gerrit-PatchSet: 1
Gerrit-Owner: Kangheui Won <khwon(a)chromium.org>
Gerrit-MessageType: newchange
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45226 )
Change subject: include/superio/hwm5_conf.h: Fix copy-pasted comments
......................................................................
include/superio/hwm5_conf.h: Fix copy-pasted comments
Comments say `port, but the actual function signature uses `base`.
Change-Id: I28a2f24a9701aec2fb990ca2f38e5f2794e15f0c
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M src/include/superio/hwm5_conf.h
1 file changed, 8 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/26/45226/1
diff --git a/src/include/superio/hwm5_conf.h b/src/include/superio/hwm5_conf.h
index 9102de2..2cf13c6 100644
--- a/src/include/superio/hwm5_conf.h
+++ b/src/include/superio/hwm5_conf.h
@@ -12,14 +12,14 @@
* of the corresponding IO address region, but at offset 5 and 6. */
/*
- * u8 pnp_read_hwm5_index(u16 port, u8 reg)
+ * u8 pnp_read_hwm5_index(u16 base, u8 reg)
* Description:
* This routine reads indexed I/O registers. The reg byte is written
- * to the index register at I/O address = port + 5. The result is then
- * read from the data register at I/O address = port + 6.
+ * to the index register at I/O address = base + 5. The result is then
+ * read from the data register at I/O address = base + 6.
*
* Parameters:
- * @param[in] u16 base = The I/O address of the port index register.
+ * @param[in] u16 base = The I/O address of the base index register.
* @param[in] u8 reg = The offset within the indexed space.
* @param[out] u8 result = The value read back from the data register.
*/
@@ -29,14 +29,14 @@
}
/*
- * void pnp_write_hwm5_index(u16 port, u8 reg, u8 value)
+ * void pnp_write_hwm5_index(u16 base, u8 reg, u8 value)
* Description:
* This routine writes indexed I/O registers. The reg byte is written
- * to the index register at I/O address = port + 5. The value byte is then
- * written to the data register at I/O address = port + 6.
+ * to the index register at I/O address = base + 5. The value byte is then
+ * written to the data register at I/O address = base + 6.
*
* Parameters:
- * @param[in] u16 base = The address of the port index register.
+ * @param[in] u16 base = The address of the base index register.
* @param[in] u8 reg = The offset within the indexed space.
* @param[in] u8 value = The value to be written to the data register.
*/
--
To view, visit https://review.coreboot.org/c/coreboot/+/45226
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I28a2f24a9701aec2fb990ca2f38e5f2794e15f0c
Gerrit-Change-Number: 45226
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newchange
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35410 )
Change subject: [WIP]arch/arm: Implement FIT support
......................................................................
[WIP]arch/arm: Implement FIT support
Untested
Change-Id: Ifae3cbae85bcd1c35f31278f76f4d97700979da3
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M payloads/Kconfig
M src/arch/arm/Makefile.inc
A src/arch/arm/fit_payload.c
3 files changed, 152 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/35410/1
diff --git a/payloads/Kconfig b/payloads/Kconfig
index 46cfaf5..04566cc 100644
--- a/payloads/Kconfig
+++ b/payloads/Kconfig
@@ -30,7 +30,7 @@
config PAYLOAD_FIT
bool "A FIT payload"
- depends on ARCH_ARM64 || ARCH_RISCV
+ depends on ARCH_ARM || ARCH_ARM64 || ARCH_RISCV
select PAYLOAD_FIT_SUPPORT
help
Select this option if you have a payload image (a FIT file) which
@@ -100,7 +100,7 @@
bool "FIT support"
default n
default y if PAYLOAD_LINUX && (ARCH_ARM || ARCH_ARM64 || ARCH_RISCV)
- depends on ARCH_ARM64 || ARCH_RISCV
+ depends on ARCH_ARM || ARCH_ARM64 || ARCH_RISCV
select FLATTENED_DEVICE_TREE
help
Select this option if your payload is of type FIT.
diff --git a/src/arch/arm/Makefile.inc b/src/arch/arm/Makefile.inc
index 508b0a8..83c698a 100644
--- a/src/arch/arm/Makefile.inc
+++ b/src/arch/arm/Makefile.inc
@@ -131,6 +131,7 @@
ramstage-y += memcpy.S
ramstage-y += memmove.S
ramstage-y += clock.c
+ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
rmodules_arm-y += memset.S
rmodules_arm-y += memcpy.S
diff --git a/src/arch/arm/fit_payload.c b/src/arch/arm/fit_payload.c
new file mode 100644
index 0000000..5792dfb
--- /dev/null
+++ b/src/arch/arm/fit_payload.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2013 Google Inc.
+ * Copyright 2018 Facebook, Inc.
+ * Copyright 2019 9elements Agency GmbH <patrick.rudolph(a)9elements.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; 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)
+#define SECTION_ALIGN 64
+
+static size_t get_kernel_size(const struct fit_image_node *node)
+{
+ /*
+ * Since we don't have a way to determine the uncompressed size of the
+ * kernel, we have to keep as much memory as possible free for use by
+ * the kernel immediately after the end of the kernel image. The amount
+ * of space required will vary depending on selected features, and is
+ * effectively unbound.
+ */
+
+ printk(BIOS_INFO,
+ "FIT: Leaving additional %u MiB of free space after kernel.\n",
+ MAX_KERNEL_SIZE >> 20);
+
+ return node->size + MAX_KERNEL_SIZE;
+}
+
+/**
+ * Place the region in free memory range.
+ *
+ * The caller has to set region->offset to the minimum allowed address.
+ */
+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;
+
+ /* Section must be aligned at page boundary */
+ start = ALIGN_UP(MAX(region->offset, range_entry_base(r)), SECTION_ALIGN);
+
+ if (start + region->size < range_entry_end(r)) {
+ region->offset = (size_t)start;
+ return false;
+ }
+
+ return true;
+}
+
+static uint32_t arm_kernel_args[3];
+
+bool fit_payload_arch(struct prog *payload, struct fit_config_node *config,
+ struct region *kernel,
+ struct region *fdt,
+ struct region *initrd)
+{
+ size_t lower_mem;
+
+ if (!config->fdt || !fdt) {
+ printk(BIOS_CRIT, "CRIT: Providing a valid FDT is mandatory to "
+ "boot a RISC-V kernel!\n");
+ return false;
+ /* TODO: Fall back to the ROM FDT? */
+ }
+
+ /* Update kernel size from image header, if possible */
+ kernel->size = get_kernel_size(config->kernel);
+ 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.
+ */
+ kernel->offset = 0;
+ if (!bootmem_walk(fit_place_mem, kernel))
+ return false;
+
+ /*
+ * The kernel documentation recommends place the image 32M above to avoid
+ * the need to relocate prior to compression.
+ */
+ lower_mem = kernel->offset;
+ kernel->offset += 32 * MiB;
+
+ /* Mark as reserved for future allocations. */
+ bootmem_add_range(kernel->offset, kernel->size, BM_MEM_PAYLOAD);
+
+ /* Place FDT and INITRD after kernel. */
+
+ /* Place INITRD and FDT:
+ * The Kernel documentation recommends the safe location of 128M above
+ * the start of ram to avoid being overwritten by the kernel
+ * decompressor.
+ */
+ if (config->ramdisk) {
+ initrd->offset = lower_mem + 128 * MiB;
+
+ 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 */
+ fdt->offset = lower_mem + 128 * MiB;
+
+ 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 */
+ arm_kernel_args[0] = 0;
+ /* All ones for FDT */
+ arm_kernel_args[1] = ~0;
+ arm_kernel_args[2] = fdt->offset;
+
+ prog_set_entry(payload, (void *)kernel->offset, (void *)arm_kernel_args);
+
+ bootmem_dump_ranges();
+
+ return true;
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/35410
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ifae3cbae85bcd1c35f31278f76f4d97700979da3
Gerrit-Change-Number: 35410
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange