U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
March 2021
- 196 participants
- 648 discussions
dfu_free_entities() invoking dfu_free_entity_sf() has let to segementation
faults due to double freeing the same device.
spi_flash_free() is not relevant for the driver model but exists only for
compatibility with old drivers.
We must not remove any device here:
* The device may still be referenced.
* We don't want to have to probe again.
Signed-off-by: Heinrich Schuchardt <xypron.glpk(a)gmx.de>
---
drivers/mtd/spi/sf-uclass.c | 5 -----
include/spi_flash.h | 4 +++-
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c
index 12d132152d..fd1bec80d6 100644
--- a/drivers/mtd/spi/sf-uclass.c
+++ b/drivers/mtd/spi/sf-uclass.c
@@ -46,11 +46,6 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
return dev_get_uclass_priv(dev);
}
-void spi_flash_free(struct spi_flash *flash)
-{
- device_remove(flash->spi->dev, DM_REMOVE_NORMAL);
-}
-
int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode,
struct udevice **devp)
diff --git a/include/spi_flash.h b/include/spi_flash.h
index 85cae32cc7..478c543b06 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -97,7 +97,9 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode);
/* Compatibility function - this is the old U-Boot API */
-void spi_flash_free(struct spi_flash *flash);
+static inline void spi_flash_free(struct spi_flash *flash)
+{
+}
static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
size_t len, void *buf)
--
2.30.1
2
1
This series contains various changes to improve U-Boots Coreboot
Filesystem (CBFS) implementation and the overall booting of U-Boot from
coreboot:
- CBFS compression, bare CBFSs
- More coreboot sysinfo parsing
- Command to display coreboot sysinfo
- Various other minor things
- Additional features for booting a coral image from coreboot
These core changes are required to allow the 'coral' U-Boot to run on top
of coreboot and complete the Chromium OS verified boot flow.
Simon Glass (34):
x86: coral: Free the ACPI GPIOs after using them
x86: coral: Add information about building / running
x86: p2sb: Drop LOG_DEBUG
x86: Probe device if needed in intel_gpio_xlate()
x86: coral: Put the eMMC first
x86: coral: Update the SD card-detect GPIO
tegra: i2c: Drop LOG_DEBUG
mmc: pci_mmc: Set up the card detect
cbfs: Add support for attributes
cbfs: Rename new_node to node
smbios: Allow writing to the coreboot version string
cbfs: Allow access to CBFS without a header
cbfs: Allow file traversal with any CBFS
cbfs: Factor out filling a cache node into a new function
cbfs: Simplify file iteration
cbfs: Support reading compression information
cbfs: Drop unnecessary cast in file_cbfs_fill_cache()
x86: Make coreboot sysinfo available to any x86 board
x86: Move coreboot timestamp info into coreboot_tables.h
x86: coreboot: Sync up timestamp codes
x86: Move coreboot sysinfo parsing into generic x86 code
x86: coreboot: Update parsing of the latest sysinfo
x86: Allow installing an e820 when booting from coreboot
x86: Add a command to display coreboot sysinfo
cmd: Add missing check for CONFIG_SYS_LONGHELP
video: Fix video on coreboot with the copy buffer
x86: video: Allow coreboot video to be used on any x86 board
x86: fsp: Don't enable FSP graphics if booted from coreboot
dm: core: Add CBFS support to flashmap
x86: coral: Avoid build error with !CONFIG_ACPIGEN
x86: coral: Allow init of debug UART in U-Boot proper
x86: coral: Fall back to coreboot video when FSP missing
x86: fsp: Don't notify if booted from coreboot
x86: coreboot: Don't setup MTRR when booting from coreboot
arch/x86/Kconfig | 21 +
arch/x86/cpu/apollolake/cpu.c | 14 +-
arch/x86/cpu/apollolake/cpu_common.c | 60 +++
arch/x86/cpu/apollolake/cpu_spl.c | 58 ---
arch/x86/cpu/coreboot/Makefile | 1 -
arch/x86/cpu/coreboot/coreboot.c | 2 +-
arch/x86/cpu/coreboot/sdram.c | 29 +-
arch/x86/cpu/coreboot/tables.c | 255 ----------
arch/x86/cpu/coreboot/timestamp.c | 14 +-
arch/x86/cpu/start_from_spl.S | 4 +
arch/x86/dts/chromebook_coral.dts | 8 +-
arch/x86/include/asm/arch-apollolake/uart.h | 1 +
arch/x86/include/asm/arch-coreboot/sysinfo.h | 62 ---
.../x86/include/asm/arch-coreboot/timestamp.h | 25 +-
arch/x86/include/asm/cb_sysinfo.h | 220 ++++++++
arch/x86/include/asm/coreboot_tables.h | 261 ++++++++--
arch/x86/include/asm/e820.h | 16 +-
arch/x86/lib/Makefile | 1 +
arch/x86/lib/bootm.c | 2 +-
arch/x86/lib/coreboot/Makefile | 7 +
arch/x86/lib/coreboot/cb_support.c | 41 ++
arch/x86/lib/coreboot/cb_sysinfo.c | 468 ++++++++++++++++++
arch/x86/lib/fsp/fsp_graphics.c | 2 +-
arch/x86/lib/fsp2/fsp_init.c | 3 +-
arch/x86/lib/fsp2/fsp_support.c | 4 +
arch/x86/lib/init_helpers.c | 6 +-
arch/x86/lib/zimage.c | 12 +-
board/coreboot/coreboot/coreboot.c | 2 +-
board/google/chromebook_coral/coral.c | 2 +
cmd/Kconfig | 9 +
cmd/acpi.c | 2 +
cmd/bloblist.c | 2 +
cmd/version.c | 2 +-
cmd/x86/Makefile | 1 +
cmd/x86/cbsysinfo.c | 394 +++++++++++++++
doc/board/google/chromebook_coral.rst | 234 ++++++++-
doc/usage/index.rst | 1 +
doc/usage/x86/cbsysinfo.rst | 25 +
drivers/gpio/intel_gpio.c | 14 +-
drivers/misc/cbmem_console.c | 2 +-
drivers/misc/p2sb_emul.c | 1 -
drivers/mmc/pci_mmc.c | 6 +-
drivers/pci/pci_rom.c | 7 +-
drivers/serial/serial_coreboot.c | 2 +-
drivers/sound/tegra_i2s.c | 1 -
drivers/video/Kconfig | 2 +-
drivers/video/coreboot.c | 18 +-
fs/cbfs/cbfs.c | 124 +++--
include/cbfs.h | 77 ++-
include/configs/chromebook_coral.h | 6 +-
include/dm/of_extra.h | 8 +
include/smbios.h | 20 +
lib/smbios-parser.c | 38 ++
lib/smbios.c | 4 -
54 files changed, 2031 insertions(+), 570 deletions(-)
delete mode 100644 arch/x86/cpu/coreboot/tables.c
delete mode 100644 arch/x86/include/asm/arch-coreboot/sysinfo.h
create mode 100644 arch/x86/include/asm/cb_sysinfo.h
create mode 100644 arch/x86/lib/coreboot/Makefile
create mode 100644 arch/x86/lib/coreboot/cb_support.c
create mode 100644 arch/x86/lib/coreboot/cb_sysinfo.c
create mode 100644 cmd/x86/cbsysinfo.c
create mode 100644 doc/usage/x86/cbsysinfo.rst
--
2.31.0.rc2.261.g7f71774620-goog
2
66
When passing a data buffer back from a function, it is not always clear
who owns the buffer, i.e. who is responsible for freeing the memory used.
An example of this is where multiple files are decompressed from the
firmware image, using a temporary buffer for reading (since the
compressed data has to live somewhere) and producing a temporary or
permanent buffer with the resuilts.
Where the firmware image can be memory-mapped, as on x86, the compressed
data does not need to be buffered, but the complexity of having a buffer
which is either allocated or not, makes the code hard to understand.
Introduce a new 'abuf' which supports simple buffer operations:
- encapsulating a buffer and its size
- either allocated with malloc() or not
- able to be reliably freed if necessary
- able to be converted to an allocated buffer if needed
This simple API makes it easier to deal with allocated and memory-mapped
buffers.
Signed-off-by: Simon Glass <sjg(a)chromium.org>
---
include/abuf.h | 137 +++++++++++++++++++++++
lib/Makefile | 1 +
lib/abuf.c | 97 ++++++++++++++++
test/lib/Makefile | 1 +
test/lib/abuf.c | 280 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 516 insertions(+)
create mode 100644 include/abuf.h
create mode 100644 lib/abuf.c
create mode 100644 test/lib/abuf.c
diff --git a/include/abuf.h b/include/abuf.h
new file mode 100644
index 00000000000..90b6c9695d0
--- /dev/null
+++ b/include/abuf.h
@@ -0,0 +1,137 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Handles a buffer that can be allocated and freed
+ *
+ * Copyright 2021 Google LLC
+ * Written by Simon Glass <sjg(a)chromium.org>
+ */
+
+#ifndef __ABUF_H
+#define __ABUF_H
+
+#include <linux/types.h>
+
+/**
+ * struct abuf - buffer that can be allocated and freed
+ *
+ * This is useful for a block of data which may be allocated with malloc(), or
+ * not, so that it needs to be freed correctly when finished with.
+ *
+ * For now it has a very simple purpose.
+ *
+ * Using memset() to zero all fields is guaranteed to be equivalent to
+ * abuf_init().
+ *
+ * @data: Pointer to data
+ * @size: Size of data in bytes
+ * @alloced: true if allocated with malloc(), so must be freed after use
+ */
+struct abuf {
+ void *data;
+ size_t size;
+ bool alloced;
+};
+
+static inline void *abuf_data(struct abuf *abuf)
+{
+ return abuf->data;
+}
+
+static inline size_t abuf_size(struct abuf *abuf)
+{
+ return abuf->size;
+}
+
+/**
+ * abuf_set() - set the (unallocated) data in a buffer
+ *
+ * This simply makes the abuf point to the supplied data, which must be live
+ * for the lifetime of the abuf. It is not alloced.
+ *
+ * Any existing data in the abuf is freed and the alloced member is set to
+ * false.
+ *
+ * @abuf: abuf to adjust
+ * @data: New contents of abuf
+ * @size: New size of abuf
+ */
+void abuf_set(struct abuf *abuf, void *data, size_t size);
+
+/**
+ * abuf_map_sysmem() - calls map_sysmem() to set up an abuf
+ *
+ * This is equivalent to abuf_set(abuf, map_sysmem(addr, size), size)
+ *
+ * Any existing data in the abuf is freed and the alloced member is set to
+ * false.
+ *
+ * @abuf: abuf to adjust
+ * @addr: Address to set the abuf to
+ * @size: New size of abuf
+ */
+void abuf_map_sysmem(struct abuf *abuf, ulong addr, size_t size);
+
+/**
+ * abuf_realloc() - Change the size of a buffer
+ *
+ * This uses realloc() to change the size of the buffer, with the same semantics
+ * as that function. If the abuf is not currently alloced, then it will alloc
+ * it if the size needs to increase (i.e. set the alloced member to true)
+ *
+ * @abuf: abuf to adjust
+ * @new_size: new size in bytes.
+ * if 0, the abuf is freed
+ * if greater than the current size, the abuf is extended and the new
+ * space is not inited. The alloced member is set to true
+ * if less than the current size, the abuf is contracted and the data at
+ * the end is lost. If @new_size is 0, this sets the alloced member to
+ * false
+ * @return true if OK, false if out of memory
+ */
+bool abuf_realloc(struct abuf *abuf, size_t new_size);
+
+/**
+ * abuf_uninit_move() - Return the allocated contents and uninit the abuf
+ *
+ * This returns the abuf data to the caller, allocating it if necessary, so that
+ * the caller receives data that it can be sure will hang around. The caller is
+ * responsible for freeing the data.
+ *
+ * If the abuf has allocated data, it is returned. If the abuf has data but it
+ * is not allocated, then it is first allocated, then returned.
+ *
+ * If the abuf size is 0, this returns NULL
+ *
+ * The abuf is uninited as part of this, except if the allocation fails, in
+ * which NULL is returned and the abuf remains untouched.
+ *
+ * The abuf must be inited before this can be called.
+ *
+ * @abuf: abuf to uninit
+ * @sizep: if non-NULL, returns the size of the returned data
+ * @return data contents, allocated with malloc(), or NULL if the data could not
+ * be allocated, or the data size is 0
+ */
+void *abuf_uninit_move(struct abuf *abuf, size_t *sizep);
+
+/**
+ * abuf_uninit() - Free any memory used by an abuf
+ *
+ * The buffer must be inited before this can be called.
+ *
+ * @abuf: abuf to uninit
+ */
+void abuf_uninit(struct abuf *abuf);
+
+/**
+ * abuf_init() - Set up a new abuf
+ *
+ * This initially has no data and alloced is set to false. This is equivalent to
+ * setting all fields to 0, e.g. with memset(), so callers can do that instead
+ * if desired.
+ *
+ * @abuf: abuf to set up
+ */
+void abuf_init(struct abuf *abuf);
+
+#endif
diff --git a/lib/Makefile b/lib/Makefile
index c42d4e12335..abb9b3c935c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -131,6 +131,7 @@ obj-$(CONFIG_OID_REGISTRY) += oid_registry.o
obj-$(CONFIG_SSCANF) += sscanf.o
endif
+obj-y += abuf.o
obj-y += date.o
obj-$(CONFIG_LIB_ELF) += elf.o
diff --git a/lib/abuf.c b/lib/abuf.c
new file mode 100644
index 00000000000..b6bde3053e8
--- /dev/null
+++ b/lib/abuf.c
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Handles a buffer that can be allocated and freed
+ *
+ * Copyright 2021 Google LLC
+ * Written by Simon Glass <sjg(a)chromium.org>
+ */
+
+#include <common.h>
+#include <abuf.h>
+#include <malloc.h>
+#include <mapmem.h>
+#include <string.h>
+
+void abuf_set(struct abuf *abuf, void *data, size_t size)
+{
+ abuf_uninit(abuf);
+ abuf->data = data;
+ abuf->size = size;
+}
+
+void abuf_map_sysmem(struct abuf *abuf, ulong addr, size_t size)
+{
+ abuf_set(abuf, map_sysmem(addr, size), size);
+}
+
+bool abuf_realloc(struct abuf *abuf, size_t new_size)
+{
+ void *ptr;
+
+ if (!new_size) {
+ /* easy case, just need to uninit, freeing any allocation */
+ abuf_uninit(abuf);
+ } else if (abuf->alloced) {
+ /* currently allocated, so need to reallocate */
+ ptr = realloc(abuf->data, new_size);
+ if (!ptr)
+ return false;
+ abuf->data = ptr;
+ abuf->size = new_size;
+ } else if (new_size <= abuf->size) {
+ /*
+ * not currently alloced and new size is no larger. Just update
+ * it. Data is lost off the end if new_size < abuf->size
+ */
+ abuf->size = new_size;
+ } else {
+ /* not currently allocated and new size is larger. Alloc and
+ * copy in data. The new space is not inited.
+ */
+ ptr = malloc(new_size);
+ if (!ptr)
+ return false;
+ memcpy(ptr, abuf->data, min(new_size, abuf->size));
+ abuf->data = ptr;
+ abuf->size = new_size;
+ abuf->alloced = true;
+ }
+
+ return true;
+}
+
+void *abuf_uninit_move(struct abuf *abuf, size_t *sizep)
+{
+ void *ptr;
+
+ if (sizep)
+ *sizep = abuf->size;
+ if (!abuf->size)
+ return NULL;
+ if (abuf->alloced) {
+ ptr = abuf->data;
+ } else {
+ ptr = malloc(abuf->size);
+ if (!ptr)
+ return NULL;
+ memcpy(ptr, abuf->data, abuf->size);
+ }
+ /* Clear everything out so there is no record of the data */
+ abuf_init(abuf);
+
+ return ptr;
+}
+
+void abuf_uninit(struct abuf *abuf)
+{
+ if (abuf->alloced)
+ free(abuf->data);
+ abuf_init(abuf);
+}
+
+void abuf_init(struct abuf *abuf)
+{
+ abuf->data = NULL;
+ abuf->size = 0;
+ abuf->alloced = false;
+}
diff --git a/test/lib/Makefile b/test/lib/Makefile
index 97c11e35a88..cc885afbbc0 100644
--- a/test/lib/Makefile
+++ b/test/lib/Makefile
@@ -3,6 +3,7 @@
# (C) Copyright 2018
# Mario Six, Guntermann & Drunck GmbH, mario.six(a)gdsys.cc
obj-y += cmd_ut_lib.o
+obj-y += abuf.o
obj-$(CONFIG_EFI_LOADER) += efi_device_path.o
obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o
obj-y += hexdump.o
diff --git a/test/lib/abuf.c b/test/lib/abuf.c
new file mode 100644
index 00000000000..b1424ab2a94
--- /dev/null
+++ b/test/lib/abuf.c
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Google LLC
+ * Written by Simon Glass <sjg(a)chromium.org>
+ */
+
+#include <common.h>
+#include <abuf.h>
+#include <mapmem.h>
+#include <test/lib.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+static char test_data[] = "1234";
+#define TEST_DATA_LEN sizeof(test_data)
+
+/* Test abuf_set() */
+static int lib_test_abuf_set(struct unit_test_state *uts)
+{
+ struct abuf buf;
+ ulong start;
+
+ start = ut_check_free();
+
+ abuf_init(&buf);
+ abuf_set(&buf, test_data, TEST_DATA_LEN);
+ ut_asserteq_ptr(test_data, buf.data);
+ ut_asserteq(TEST_DATA_LEN, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Force it to allocate */
+ ut_asserteq(true, abuf_realloc(&buf, TEST_DATA_LEN + 1));
+ ut_assertnonnull(buf.data);
+ ut_asserteq(TEST_DATA_LEN + 1, buf.size);
+ ut_asserteq(true, buf.alloced);
+
+ /* Now set it again, to force it to free */
+ abuf_set(&buf, test_data, TEST_DATA_LEN);
+ ut_asserteq_ptr(test_data, buf.data);
+ ut_asserteq(TEST_DATA_LEN, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Check for memory leaks */
+ ut_assertok(ut_check_delta(start));
+
+ return 0;
+}
+LIB_TEST(lib_test_abuf_set, 0);
+
+/* Test abuf_map_sysmem() */
+static int lib_test_abuf_map_sysmem(struct unit_test_state *uts)
+{
+ struct abuf buf;
+ ulong addr;
+
+ abuf_init(&buf);
+ addr = 0x100;
+ abuf_map_sysmem(&buf, addr, TEST_DATA_LEN);
+
+ ut_asserteq_ptr(map_sysmem(0x100, 0), buf.data);
+ ut_asserteq(TEST_DATA_LEN, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ return 0;
+}
+LIB_TEST(lib_test_abuf_map_sysmem, 0);
+
+/* Test abuf_realloc() */
+static int lib_test_abuf_realloc(struct unit_test_state *uts)
+{
+ struct abuf buf;
+ ulong start;
+ void *ptr;
+
+ start = ut_check_free();
+
+ abuf_init(&buf);
+
+ /* Allocate an empty buffer */
+ ut_asserteq(true, abuf_realloc(&buf, 0));
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Allocate a non-empty abuf */
+ ut_asserteq(true, abuf_realloc(&buf, TEST_DATA_LEN));
+ ut_assertnonnull(buf.data);
+ ut_asserteq(TEST_DATA_LEN, buf.size);
+ ut_asserteq(true, buf.alloced);
+ ptr = buf.data;
+
+ /* Make it smaller; the pointer should remain the same */
+ ut_asserteq(true, abuf_realloc(&buf, TEST_DATA_LEN - 1));
+ ut_asserteq(TEST_DATA_LEN - 1, buf.size);
+ ut_asserteq(true, buf.alloced);
+ ut_asserteq_ptr(ptr, buf.data);
+
+ /* Make it larger, forcing reallocation */
+ ut_asserteq(true, abuf_realloc(&buf, 0x1000));
+ ut_assert(buf.data != ptr);
+ ut_asserteq(0x1000, buf.size);
+ ut_asserteq(true, buf.alloced);
+
+ /* Free it */
+ ut_asserteq(true, abuf_realloc(&buf, 0));
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Check for memory leaks */
+ ut_assertok(ut_check_delta(start));
+
+ return 0;
+}
+LIB_TEST(lib_test_abuf_realloc, 0);
+
+/* Test handling of buffers that are too large */
+static int lib_test_abuf_large(struct unit_test_state *uts)
+{
+ struct abuf buf;
+ ulong start;
+ size_t size;
+ int delta;
+ void *ptr;
+
+ start = ut_check_free();
+
+ /* Try an impossible size */
+ abuf_init(&buf);
+ ut_asserteq(false, abuf_realloc(&buf, CONFIG_SYS_MALLOC_LEN));
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ abuf_uninit(&buf);
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Start with a normal size then try to increase it, to check realloc */
+ ut_asserteq(true, abuf_realloc(&buf, TEST_DATA_LEN));
+ ut_assertnonnull(buf.data);
+ ut_asserteq(TEST_DATA_LEN, buf.size);
+ ut_asserteq(true, buf.alloced);
+ ptr = buf.data;
+ delta = ut_check_delta(start);
+ ut_assert(delta > 0);
+
+ /* try to increase it */
+ ut_asserteq(false, abuf_realloc(&buf, CONFIG_SYS_MALLOC_LEN));
+ ut_asserteq_ptr(ptr, buf.data);
+ ut_asserteq(TEST_DATA_LEN, buf.size);
+ ut_asserteq(true, buf.alloced);
+ ut_asserteq(delta, ut_check_delta(start));
+
+ /* Check for memory leaks */
+ abuf_uninit(&buf);
+ ut_assertok(ut_check_delta(start));
+
+ /* Start with a huge unallocated buf and try to move it */
+ abuf_init(&buf);
+ abuf_map_sysmem(&buf, 0, CONFIG_SYS_MALLOC_LEN);
+ ut_asserteq(CONFIG_SYS_MALLOC_LEN, buf.size);
+ ut_asserteq(false, buf.alloced);
+ ut_assertnull(abuf_uninit_move(&buf, &size));
+
+ /* Check for memory leaks */
+ abuf_uninit(&buf);
+ ut_assertok(ut_check_delta(start));
+
+ return 0;
+}
+LIB_TEST(lib_test_abuf_large, 0);
+
+/* Test abuf_uninit_move() */
+static int lib_test_abuf_uninit_move(struct unit_test_state *uts)
+{
+ void *ptr, *orig_ptr;
+ struct abuf buf;
+ size_t size;
+ ulong start;
+ int delta;
+
+ start = ut_check_free();
+
+ /* Move an empty buffer */
+ abuf_init(&buf);
+ ut_assertnull(abuf_uninit_move(&buf, &size));
+ ut_asserteq(0, size);
+ ut_assertnull(abuf_uninit_move(&buf, NULL));
+
+ /* Move an unallocated buffer */
+ abuf_set(&buf, test_data, TEST_DATA_LEN);
+ ut_assertok(ut_check_delta(start));
+ ptr = abuf_uninit_move(&buf, &size);
+ ut_asserteq(TEST_DATA_LEN, size);
+ ut_asserteq_str(ptr, test_data);
+ ut_assertnonnull(ptr);
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Check that freeing it frees the only allocation */
+ delta = ut_check_delta(start);
+ ut_assert(delta > 0);
+ free(ptr);
+ ut_assertok(ut_check_delta(start));
+
+ /* Move an allocated buffer */
+ ut_asserteq(true, abuf_realloc(&buf, TEST_DATA_LEN));
+ orig_ptr = buf.data;
+ strcpy(orig_ptr, test_data);
+
+ delta = ut_check_delta(start);
+ ut_assert(delta > 0);
+ ptr = abuf_uninit_move(&buf, &size);
+ ut_asserteq(TEST_DATA_LEN, size);
+ ut_assertnonnull(ptr);
+ ut_asserteq_ptr(ptr, orig_ptr);
+ ut_asserteq_str(ptr, test_data);
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Check there was no new allocation */
+ ut_asserteq(delta, ut_check_delta(start));
+
+ /* Check that freeing it frees the only allocation */
+ free(ptr);
+ ut_assertok(ut_check_delta(start));
+
+ /* Move an unallocated buffer, without the size */
+ abuf_set(&buf, test_data, TEST_DATA_LEN);
+ ut_assertok(ut_check_delta(start));
+ ptr = abuf_uninit_move(&buf, NULL);
+ ut_asserteq_str(ptr, test_data);
+
+ return 0;
+}
+LIB_TEST(lib_test_abuf_uninit_move, 0);
+
+/* Test abuf_uninit() */
+static int lib_test_abuf_uninit(struct unit_test_state *uts)
+{
+ struct abuf buf;
+
+ /* Nothing in the buffer */
+ abuf_init(&buf);
+ abuf_uninit(&buf);
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ /* Not allocated */
+ abuf_set(&buf, test_data, TEST_DATA_LEN);
+ abuf_uninit(&buf);
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ return 0;
+}
+LIB_TEST(lib_test_abuf_uninit, 0);
+
+/* Test abuf_init() */
+static int lib_test_abuf_init(struct unit_test_state *uts)
+{
+ struct abuf buf;
+
+ buf.data = &buf;
+ buf.size = 123;
+ buf.alloced = true;
+ abuf_init(&buf);
+ ut_assertnull(buf.data);
+ ut_asserteq(0, buf.size);
+ ut_asserteq(false, buf.alloced);
+
+ return 0;
+}
+LIB_TEST(lib_test_abuf_init, 0);
--
2.31.0.291.g576ba9dcdaf-goog
1
0
Hi Tom,
Well here we are again...let's see how this one fares.
This is for the -next branch.
https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/6933
The following changes since commit 874dcedee92a828b03c8d3146dccfaa8b709618b:
Merge branch '2021-03-20-mediatek-updates' into next (2021-03-20
19:27:22 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git tags/dm-pull-26mar21-take2
for you to fetch changes up to fcae6682a7929abf88d9f0b756f9d5f9725e4d14:
binman: Update various pieces of the documentation (2021-03-26 17:03:10 +1300)
----------------------------------------------------------------
dtoc support for of-platdata-inst
driver model support for of-platdata-inst
support of-platdata-inst on x86 / coral
binman support for exapanded entries
binman convert docs to reST
ti-sysc fix for duplicate uclass driver
patman minor improvements
pylibfdt build only if needed
correct obscure CI error with OF_PLATDATA_INST
----------------------------------------------------------------
Bin Meng (3):
mmc: pci: Fix Kconfig dependency
test: cmd: setexpr: Fix a typo
test: print_ut: Fix potential build error
Dario Binacchi (1):
bus: ti-sysc: change in a normal driver
Heinrich Schuchardt (4):
sandbox: allow cross-compiling sandbox
sandbox: enable cros-ec-keyb in test.dtb
dm: error handling dev_get_dma_range()
sandbox: add FAT to the list of usable env drivers
Nicolas Boichat (1):
patman: Use less for help file, if available
Samuel Dionne-Riel (1):
tools: fdtgrep: Use unsigned chars for arrays
Simon Glass (110):
azure: Use --board flag with sandbox_spl
patman: Update documentation to match new usage
patman: Quieten down the alias checking
dtoc: Scan drivers for available information
dtoc: Save scan information across test runs
dtoc: Ignore unwanted files when scanning for drivers
dtoc: Collect priv/plat struct info from drivers
dtoc: Support scanning of uclasses
dtoc: Support scanning of structs in header files
dtoc: Move test files into a test/ directory
dtoc: Rename sandbox_i2c_test and sandbox_pmic_test
dtoc: Add some extra properties to nodes
dtoc: Make use of node properties
dtoc: Process nodes to set up required properties
dtoc: Track nodes which are actually used
dtoc: Support tracking the phase of U-Boot
Makefile: Pass the U-Boot phase to dtoc
dtoc: Support headers needed for drivers
dtoc: Process driver aliases along with drivers
dtoc: Warn of duplicate drivers
dtoc: Read aliases for uclasses
dtoc: Detect drivers only at the start of start of line
dtoc: Assign a sequence number to each node
dtoc: Set up the uclasses that are used
dtoc: Support processing the root node
dtoc: Add an option for device instantiation
dm: of-platadata: Add option for device instantiation
dtoc: Add support for decl file
dtoc: Don't generate platform data with instantiation
sandbox: Make sandbox,emul more conventional
sandbox: i2c: Rename driver names to work with of-platdata
dtoc: Tidy up the list of supported phandle properties
dtoc: Generate a summary in the dt-plat.c file
dtoc: Generate uclass devices
dtoc: Generate device instances
dtoc: Drop use of DECL() macros
sandbox: Drop debug message in os_spl_to_uboot()
linker_lists: Allow use in data structures
dm: core: Add macros to access the new linker lists
dm: core: Allow dropping run-time binding of devices
dm: core: Adjust uclass setup with of-platdata
dm: core: Set up driver model for OF_PLATDATA_INST
dm: core: Skip adding uclasses with OF_PLATDATA_INST
dm: Add the new dtoc-generated files to the build
libfdt: Tidy up pylibfdt build rule
Makefile: Avoid running dtoc every time
Makefile: Depend only on required of-platdata files
dtoc: Only generate the required files
Makefile: Use a variable for generated of-platdata headers
Makefile: Remove old of-platdata files before regenerating
dm: core: Include dt-decl.h automatically
dm: test: Avoid destroying uclasses with of-platdata-inst
clk: sandbox: Move priv/plat data to a header file
clk: fixed-rate: Export driver parts for OF_PLATDATA_INST
clk: sandbox: Create a special fixed-rate driver
dm: core: Drop device_get_by_driver_info()
dm: core: Drop uclass_find_device_by_phandle() with of-platdata
sandbox: i2c: Move platdata structs to header files
dm: Rename device_get_by_driver_info_idx()
sandbox_spl: Increase SPL malloc() size
sandbox: i2c: Support i2c emulation with of-platdata
Revert "sandbox: Disable I2C emulators in SPL"
sandbox: Create a new sandbox_noinst build
test: Run sandbox_spl tests on sandbox_noinst
azure/gitlab: Add tests for sandbox_noinst
dm: core: Add an option to support SPL in read-only memory
dm: core: Create a struct for device runtime info
dm: core: Move flags to device-runtime info
dm: core: Allow storing priv/plat data separately
sandbox: Define a region for device priv/plat data
dm: core: Use separate priv/plat data region
dm: core: Add warnings to private / platform setters
dm: doc: Tidy up of-platdata docs
dm: doc: Add documentation for of-platdata-inst
x86: Define a region for device priv/plat data
x86: apl: Fix the header order in pmc
x86: apl: Tell of-platdata about a required header file
x86: itss: Tidy up bind() for of-platdata-inst
x86: Support a fake PCI device with of-platdata-inst
x86: Don't include reset driver in SPL
x86: coral: Drop ACPI properties from of-platdata
x86: coral: Drop TPM and ACPI interrupts from TPL
x86: apl: Use read-only SPL and new of-platdata
binman: Allow extracting to current directory
binman: Document ExpandEntries() in the base class
binman: Update entry help for files-align
binman: Tidy up underscores in entry documentation
binman: Correct the documentation for u-boot-spl-bss-pad
binman: Support symbols in u-boot-spl-nodtb
binman: Add support for u-boot-tpl-nodtb
binman: Add support for u-boot-tpl-bss-bad
binman: Drop unnecessary 'type' property in tests
binman: Use the fake SPL/TPL only if requested
binman: Drop unnecessary field in output_fdt_info
binman: Move the comment for GetFdts() to the base class
binman: Use standard filenames for SPL/TPL devicetree
binman: Allow using an an 'expanded' entry type
binman: Allow a way to select expanded entries
binman: Plumb expanded entries through fully
binman: Automatically expand phase binaries into sections
Makefile: Pass new entry args to binman
x86: Make use of binman expanded entries
x86: dts: Drop unused CONFIG_SPL
doc: Move UEFI under develop/
doc: Move driver model docs under develop/
binman: doc: Add documentation to htmldocs
binman: Rearrange documentation into headings
binman: Incorporate entry documentation
binman: Drop repetitive heading for each entry
binman: Update various pieces of the documentation
.azure-pipelines.yml | 5 +-
.gitlab-ci.yml | 10 +-
Makefile | 18 +-
arch/sandbox/cpu/os.c | 1 -
arch/sandbox/cpu/u-boot-spl.lds | 8 +
arch/sandbox/dts/sandbox.dtsi | 18 +-
arch/sandbox/dts/test.dts | 5 +-
arch/sandbox/include/asm/clk.h | 24 +
arch/sandbox/include/asm/i2c.h | 15 +
arch/sandbox/include/asm/rtc.h | 24 +
arch/x86/cpu/apollolake/Kconfig | 2 +
arch/x86/cpu/apollolake/pmc.c | 2 +-
arch/x86/cpu/apollolake/punit.c | 1 +
arch/x86/cpu/intel_common/itss.c | 5 +-
arch/x86/cpu/u-boot-spl.lds | 8 +
arch/x86/dts/chromebook_coral.dts | 10 +-
arch/x86/dts/reset.dtsi | 2 +-
arch/x86/dts/u-boot.dtsi | 17 +-
arch/x86/lib/tpl.c | 1 +
board/sandbox/MAINTAINERS | 7 +
board/sandbox/sandbox.c | 1 +
common/spl/Kconfig | 24 +
configs/chromebook_coral_defconfig | 1 +
configs/sandbox_noinst_defconfig | 231 ++++++++++
configs/sandbox_spl_defconfig | 3 +
doc/arch/x86.rst | 4 +-
doc/{ => develop}/driver-model/bind.rst | 0
doc/{ => develop}/driver-model/debugging.rst | 0
doc/{ => develop}/driver-model/design.rst | 0
doc/{ => develop}/driver-model/ethernet.rst | 0
doc/{ => develop}/driver-model/fdt-fixup.rst | 0
doc/{ => develop}/driver-model/fs_firmware_loader.rst | 0
doc/{ => develop}/driver-model/i2c-howto.rst | 0
doc/{ => develop}/driver-model/index.rst | 4 +
doc/{ => develop}/driver-model/livetree.rst | 0
doc/{ => develop}/driver-model/migration.rst | 0
doc/develop/driver-model/of-plat.rst | 913
++++++++++++++++++++++++++++++++++++++
doc/{ => develop}/driver-model/pci-info.rst | 1 +
doc/{ => develop}/driver-model/pmic-framework.rst | 0
doc/{ => develop}/driver-model/remoteproc-framework.rst | 0
doc/{ => develop}/driver-model/serial-howto.rst | 0
doc/{ => develop}/driver-model/soc-framework.rst | 0
doc/{ => develop}/driver-model/spi-howto.rst | 0
doc/{ => develop}/driver-model/usb-info.rst | 0
doc/develop/index.rst | 10 +
doc/develop/package/binman.rst | 1 +
doc/develop/package/entries.rst | 1 +
doc/develop/package/index.rst | 19 +
doc/{ => develop}/uefi/index.rst | 4 +
doc/{ => develop}/uefi/iscsi.rst | 0
doc/{ => develop}/uefi/u-boot_on_efi.rst | 0
doc/{ => develop}/uefi/uefi.rst | 0
doc/driver-model/of-plat.rst | 359 ---------------
doc/index.rst | 23 -
doc/usage/fit.rst | 8 +
doc/usage/index.rst | 1 +
drivers/bus/ti-sysc.c | 6 -
drivers/clk/clk-uclass.c | 2 +-
drivers/clk/clk_fixed_rate.c | 14 +-
drivers/clk/clk_sandbox.c | 40 +-
drivers/clk/clk_sandbox_test.c | 6 -
drivers/core/device.c | 111 +++--
drivers/core/of_addr.c | 4 +-
drivers/core/root.c | 85 +++-
drivers/core/uclass.c | 7 +-
drivers/i2c/Makefile | 2 -
drivers/i2c/i2c-emul-uclass.c | 34 +-
drivers/misc/irq-uclass.c | 2 +-
drivers/misc/test_drv.c | 11 +-
drivers/mmc/Kconfig | 1 +
drivers/mmc/fsl_esdhc_imx.c | 3 +-
drivers/rtc/i2c_rtc_emul.c | 21 +-
drivers/rtc/sandbox_rtc.c | 13 +
dts/Kconfig | 83 +++-
include/asm-generic/global_data.h | 26 +-
include/asm-generic/sections.h | 3 +
include/dm/device-internal.h | 93 ++++
include/dm/device.h | 108 ++++-
include/dm/platdata.h | 15 -
include/dm/root.h | 3 +
include/dm/test.h | 5 +
include/dm/uclass-internal.h | 52 +++
include/dm/uclass.h | 31 ++
include/dm/util.h | 9 +
include/dt-structs.h | 2 +
include/i2c.h | 15 +
include/linker_lists.h | 12 +
include/linux/clk-provider.h | 5 +
scripts/Makefile.spl | 48 +-
scripts/dtc/pylibfdt/Makefile | 12 +-
test/cmd/setexpr.c | 2 +-
test/dm/of_platdata.c | 32 +-
test/dm/test-fdt.c | 6 +-
test/print_ut.c | 2 +-
test/run | 4 +
test/test-main.c | 30 +-
tools/binman/README.rst | 1 +
tools/binman/{README => binman.rst} | 959
++++++++++++++++++++++------------------
tools/binman/cmdline.py | 5 +-
tools/binman/control.py | 28 +-
tools/binman/{README.entries => entries.rst} | 336 ++++++++++----
tools/binman/entry.py | 73 ++-
tools/binman/entry_test.py | 12 +
tools/binman/etype/atf_bl31.py | 2 +-
tools/binman/etype/blob.py | 4 +-
tools/binman/etype/blob_dtb.py | 9 -
tools/binman/etype/blob_ext.py | 2 +-
tools/binman/etype/blob_phase.py | 51 +++
tools/binman/etype/cbfs.py | 12 +-
tools/binman/etype/fdtmap.py | 30 +-
tools/binman/etype/files.py | 2 +-
tools/binman/etype/fit.py | 21 +-
tools/binman/etype/intel_cmc.py | 2 +-
tools/binman/etype/intel_fsp.py | 2 +-
tools/binman/etype/intel_fsp_m.py | 2 +-
tools/binman/etype/intel_fsp_s.py | 2 +-
tools/binman/etype/intel_fsp_t.py | 2 +-
tools/binman/etype/intel_ifwi.py | 10 +-
tools/binman/etype/intel_me.py | 2 +-
tools/binman/etype/intel_mrc.py | 2 +-
tools/binman/etype/intel_refcode.py | 2 +-
tools/binman/etype/intel_vbt.py | 2 +-
tools/binman/etype/intel_vga.py | 2 +-
tools/binman/etype/mkimage.py | 4 +-
tools/binman/etype/scp.py | 2 +-
tools/binman/etype/section.py | 15 +-
tools/binman/etype/text.py | 6 +-
tools/binman/etype/u_boot.py | 8 +-
tools/binman/etype/u_boot_dtb_with_ucode.py | 4 +-
tools/binman/etype/u_boot_expanded.py | 24 +
tools/binman/etype/u_boot_nodtb.py | 8 +-
tools/binman/etype/u_boot_spl.py | 3 +
tools/binman/etype/u_boot_spl_bss_pad.py | 17 +-
tools/binman/etype/u_boot_spl_expanded.py | 45 ++
tools/binman/etype/u_boot_spl_nodtb.py | 24 +-
tools/binman/etype/u_boot_tpl.py | 3 +
tools/binman/etype/u_boot_tpl_bss_pad.py | 44 ++
tools/binman/etype/u_boot_tpl_expanded.py | 45 ++
tools/binman/etype/u_boot_tpl_nodtb.py | 42 ++
tools/binman/etype/u_boot_with_ucode_ptr.py | 2 +-
tools/binman/ftest.py | 268 ++++++++++--
tools/binman/image.py | 17 +-
tools/binman/index.rst | 9 +
tools/binman/setup.py | 2 +-
tools/binman/state.py | 71 +--
tools/binman/test/053_symbols.dts | 2 +-
tools/binman/test/149_symbols_tpl.dts | 1 -
tools/binman/test/155_symbols_tpl_x86.dts | 1 -
tools/binman/test/192_symbols_nodtb.dts | 26 ++
tools/binman/test/192_u_boot_tpl_nodtb.dts | 13 +
tools/binman/test/193_tpl_bss_pad.dts | 19 +
tools/binman/test/194_fdt_incl.dts | 17 +
tools/binman/test/195_fdt_incl_tpl.dts | 13 +
tools/binman/test/u_boot_binman_syms.c | 2 +-
tools/dtoc/dtb_platdata.py | 643
++++++++++++++++++++++++---
tools/dtoc/dtoc_test_scan_drivers.cxx | 1 -
tools/dtoc/main.py | 9 +-
tools/dtoc/src_scan.py | 597
++++++++++++++++++++++++-
tools/dtoc/{ => test}/dtoc_test.dts | 0
tools/dtoc/{ => test}/dtoc_test_add_prop.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr32.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr32_64.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr64.dts | 0
tools/dtoc/{ => test}/dtoc_test_addr64_32.dts | 0
tools/dtoc/test/dtoc_test_alias_bad.dts | 58 +++
tools/dtoc/test/dtoc_test_alias_bad_path.dts | 58 +++
tools/dtoc/test/dtoc_test_alias_bad_uc.dts | 58 +++
tools/dtoc/{ => test}/dtoc_test_aliases.dts | 0
tools/dtoc/{ => test}/dtoc_test_bad_reg.dts | 0
tools/dtoc/{ => test}/dtoc_test_bad_reg2.dts | 0
tools/dtoc/{ => test}/dtoc_test_driver_alias.dts | 0
tools/dtoc/{ => test}/dtoc_test_empty.dts | 0
tools/dtoc/test/dtoc_test_inst.dts | 58 +++
tools/dtoc/{ => test}/dtoc_test_invalid_driver.dts | 0
tools/dtoc/{ => test}/dtoc_test_phandle.dts | 0
tools/dtoc/{ => test}/dtoc_test_phandle_bad.dts | 0
tools/dtoc/{ => test}/dtoc_test_phandle_bad2.dts | 0
tools/dtoc/{ => test}/dtoc_test_phandle_cd_gpios.dts | 0
tools/dtoc/{ => test}/dtoc_test_phandle_reorder.dts | 0
tools/dtoc/{ => test}/dtoc_test_phandle_single.dts | 0
tools/dtoc/test/dtoc_test_scan_drivers.cxx | 5 +
tools/dtoc/{ => test}/dtoc_test_simple.dts | 4 +-
tools/dtoc/test_dtoc.py | 1023
++++++++++++++++++++++++++++++++++++++++---
tools/dtoc/test_fdt.py | 31 +-
tools/dtoc/test_src_scan.py | 397
++++++++++++++++-
tools/fdtgrep.c | 2 +-
tools/patman/README | 14 +-
tools/patman/func_test.py | 2 +-
tools/patman/gitutil.py | 45 +-
tools/patman/main.py | 9 +-
tools/patman/series.py | 10 +-
tools/patman/tools.py | 8 +-
192 files changed, 6566 insertions(+), 1551 deletions(-)
create mode 100644 configs/sandbox_noinst_defconfig
rename doc/{ => develop}/driver-model/bind.rst (100%)
rename doc/{ => develop}/driver-model/debugging.rst (100%)
rename doc/{ => develop}/driver-model/design.rst (100%)
rename doc/{ => develop}/driver-model/ethernet.rst (100%)
rename doc/{ => develop}/driver-model/fdt-fixup.rst (100%)
rename doc/{ => develop}/driver-model/fs_firmware_loader.rst (100%)
rename doc/{ => develop}/driver-model/i2c-howto.rst (100%)
rename doc/{ => develop}/driver-model/index.rst (68%)
rename doc/{ => develop}/driver-model/livetree.rst (100%)
rename doc/{ => develop}/driver-model/migration.rst (100%)
create mode 100644 doc/develop/driver-model/of-plat.rst
rename doc/{ => develop}/driver-model/pci-info.rst (99%)
rename doc/{ => develop}/driver-model/pmic-framework.rst (100%)
rename doc/{ => develop}/driver-model/remoteproc-framework.rst (100%)
rename doc/{ => develop}/driver-model/serial-howto.rst (100%)
rename doc/{ => develop}/driver-model/soc-framework.rst (100%)
rename doc/{ => develop}/driver-model/spi-howto.rst (100%)
rename doc/{ => develop}/driver-model/usb-info.rst (100%)
create mode 120000 doc/develop/package/binman.rst
create mode 120000 doc/develop/package/entries.rst
create mode 100644 doc/develop/package/index.rst
rename doc/{ => develop}/uefi/index.rst (51%)
rename doc/{ => develop}/uefi/iscsi.rst (100%)
rename doc/{ => develop}/uefi/u-boot_on_efi.rst (100%)
rename doc/{ => develop}/uefi/uefi.rst (100%)
delete mode 100644 doc/driver-model/of-plat.rst
create mode 100644 doc/usage/fit.rst
create mode 120000 tools/binman/README.rst
rename tools/binman/{README => binman.rst} (64%)
rename tools/binman/{README.entries => entries.rst} (82%)
create mode 100644 tools/binman/etype/blob_phase.py
create mode 100644 tools/binman/etype/u_boot_expanded.py
create mode 100644 tools/binman/etype/u_boot_spl_expanded.py
create mode 100644 tools/binman/etype/u_boot_tpl_bss_pad.py
create mode 100644 tools/binman/etype/u_boot_tpl_expanded.py
create mode 100644 tools/binman/etype/u_boot_tpl_nodtb.py
create mode 100644 tools/binman/index.rst
create mode 100644 tools/binman/test/192_symbols_nodtb.dts
create mode 100644 tools/binman/test/192_u_boot_tpl_nodtb.dts
create mode 100644 tools/binman/test/193_tpl_bss_pad.dts
create mode 100644 tools/binman/test/194_fdt_incl.dts
create mode 100644 tools/binman/test/195_fdt_incl_tpl.dts
delete mode 100644 tools/dtoc/dtoc_test_scan_drivers.cxx
rename tools/dtoc/{ => test}/dtoc_test.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_add_prop.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr32.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr32_64.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr64.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_addr64_32.dts (100%)
create mode 100644 tools/dtoc/test/dtoc_test_alias_bad.dts
create mode 100644 tools/dtoc/test/dtoc_test_alias_bad_path.dts
create mode 100644 tools/dtoc/test/dtoc_test_alias_bad_uc.dts
rename tools/dtoc/{ => test}/dtoc_test_aliases.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_bad_reg.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_bad_reg2.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_driver_alias.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_empty.dts (100%)
create mode 100644 tools/dtoc/test/dtoc_test_inst.dts
rename tools/dtoc/{ => test}/dtoc_test_invalid_driver.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_bad.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_bad2.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_cd_gpios.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_reorder.dts (100%)
rename tools/dtoc/{ => test}/dtoc_test_phandle_single.dts (100%)
create mode 100644 tools/dtoc/test/dtoc_test_scan_drivers.cxx
rename tools/dtoc/{ => test}/dtoc_test_simple.dts (93%)
Regards,
Simon
2
1
Enable DM_SERIAL for this board. For this to work, we first need to make
DM_SERIAL work on LS1028A SoCs, which just means we have to properly call
spl_early_init(). After this, clean up the board config by moving the
CONFIG_DM_* macros to Kconfig. Now we can switch to DM_SERIAL. As the last
patch, provide a configuration option to switch the output to the first
serial line on this board, which is not possible because we can enable
LPUART support (which needs DM_SERIAL).
Please note, the first patch is not really required but helps a lot in
debugging early startup on Layerscape SoCs.
Michael Walle (5):
armv8: fsl-layerscape: spl: add debug UART support
armv8: fsl-layerscape: spl: call spl_early_init()
board: sl28: move DM_* configs to Kconfig
board: sl28: enable DM_SERIAL
board: sl28: add config to enable console output on SER0
arch/arm/Kconfig | 20 +++++++++++++++++++
arch/arm/cpu/armv8/fsl-layerscape/spl.c | 11 ++++++++++
.../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi | 12 +++++++++++
board/kontron/sl28/Kconfig | 10 ++++++++++
board/kontron/sl28/Makefile | 2 +-
board/kontron/sl28/common.c | 11 ++++++++++
configs/kontron_sl28_defconfig | 17 ----------------
include/configs/kontron_sl28.h | 2 --
8 files changed, 65 insertions(+), 20 deletions(-)
create mode 100644 board/kontron/sl28/common.c
--
2.20.1
1
5

26 Mar '21
From: "Ying-Chun Liu (PaulLiu)" <paul.liu(a)linaro.org>
Anatop is an integrated regulator inside i.MX6 SoC.
There are 3 digital regulators which controls PU, CORE (ARM), and SOC.
And 3 analog regulators which controls 1P1, 2P5, 3P0 (USB).
This patch adds the Anatop regulator driver.
Ying-Chun Liu (PaulLiu) (2):
power: regulator: add driver for ANATOP regulator
doc: device-tree-bindings: regulator: anatop regulator
v2: add functions for set selector and delay. Define ANATOP_REGULATOR_STEP
v3: add vin-supply. move regmap retrival to probe
v4: check control_reg and return -ENOSYS if error. check vin-supply error
.../regulator/fsl,anatop-regulator.txt | 45 +++
drivers/power/regulator/Kconfig | 10 +
drivers/power/regulator/Makefile | 1 +
drivers/power/regulator/anatop_regulator.c | 278 ++++++++++++++++++
4 files changed, 334 insertions(+)
create mode 100644 doc/device-tree-bindings/regulator/fsl,anatop-regulator.txt
create mode 100644 drivers/power/regulator/anatop_regulator.c
--
2.30.2
2
3
Dear Tom,
a lot of patches in this pull-request are already in origin/master. The
rest is summarized in the tag description.
Gitlab CI showed no issues:
https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/6913
Please, merge into the *next* branch:
The following changes since commit 874dcedee92a828b03c8d3146dccfaa8b709618b:
Merge branch '2021-03-20-mediatek-updates' into next (2021-03-20
19:27:22 -0400)
are available in the Git repository at:
https://source.denx.de/u-boot/custodians/u-boot-efi.git tags/efi-next
for you to fetch changes up to ac30aad21076e9eeb460af2865b863f3ae3d2eaa:
efi_loader: Clean up file size calculations (2021-03-25 21:03:51 +0100)
----------------------------------------------------------------
Pull request for efi-next
New:
provide EFI ESRT table
initrd via Load_File2_Protocol uses boot options
create an S-CRTM event for measured boot
Bug fixes:
avoid double free of SPI device in dfu_free_entity()
avoid memory leak in TCG2 protocol
----------------------------------------------------------------
Heinrich Schuchardt (7):
efi_loader: disable GRUB_ARM32_WORKAROUND on ARCH_SUNXI
efi_selftest: illegal cast to pointer in initrddump
efi_loader: NULL dereference in EFI console
efi_loader: Uart device path
cmd/load: support uploading EFI binary via UART
dfu: dfu_sf: avoid double free of SPI device
efi_selfest: redefine enum efi_test_phase
Ilias Apalodimas (8):
efi_selftest: Remove loadfile2 for initrd selftests
efi_loader: Add device path related functions for initrd via Boot####
efi_loader: Add helper functions for EFI
efi_loader: Replace config option for initrd loading
efidebug: add multiple device path instances on Boot####
efi_loader: EFI TCG2 free efi memory on protocol failure
efi_loader: Add an S-CRTM even for firmware version
efi_loader: Clean up file size calculations
Jose Marinho (4):
efi: Add ESRT to the EFI system table
cmd: efi: ESRT table debug print
efi: ESRT creation tests
test: test the ESRT creation
Mark Kettenis (1):
efi_loader: fix memory type for memory reservation block
Simon Glass (1):
efi: Fix compiler warnings
cmd/bootefi.c | 3 +
cmd/efidebug.c | 281 ++++++++++--
cmd/load.c | 10 +-
doc/board/emulation/qemu_capsule_update.rst | 4 +-
doc/uefi/uefi.rst | 2 +-
drivers/dfu/dfu_sf.c | 18 +-
include/efi_api.h | 31 ++
include/efi_loader.h | 36 ++
include/efi_selftest.h | 7 +-
lib/efi_loader/Kconfig | 26 +-
lib/efi_loader/Makefile | 2 +
lib/efi_loader/efi_bootmgr.c | 19 +-
lib/efi_loader/efi_boottime.c | 23 +-
lib/efi_loader/efi_capsule.c | 12 +-
lib/efi_loader/efi_console.c | 51 ++-
lib/efi_loader/efi_device_path.c | 151 +++++-
lib/efi_loader/efi_device_path_to_text.c | 13 +
lib/efi_loader/efi_dt_fixup.c | 2 +-
lib/efi_loader/efi_esrt.c | 510
+++++++++++++++++++++
lib/efi_loader/efi_file.c | 39 ++
lib/efi_loader/efi_firmware.c | 4 +-
lib/efi_loader/efi_helper.c | 98 ++++
lib/efi_loader/efi_load_initrd.c | 202 ++++----
lib/efi_loader/efi_setup.c | 6 +
lib/efi_loader/efi_tcg2.c | 75 ++-
lib/efi_loader/efi_var_common.c | 33 ++
lib/efi_selftest/Makefile | 3 +-
lib/efi_selftest/efi_selftest.c | 11 +-
lib/efi_selftest/efi_selftest_esrt.c | 291 ++++++++++++
lib/efi_selftest/efi_selftest_load_initrd.c | 221 ---------
.../efi_selftest_set_virtual_address_map.c | 2 +-
lib/efi_selftest/initrddump.c | 2 +-
.../test_efi_capsule/test_capsule_firmware.py | 14 +-
test/py/tests/test_efi_secboot/test_signed.py | 16 +-
.../py/tests/test_efi_secboot/test_signed_intca.py | 8 +-
test/py/tests/test_efi_secboot/test_unsigned.py | 8 +-
36 files changed, 1781 insertions(+), 453 deletions(-)
create mode 100644 lib/efi_loader/efi_esrt.c
create mode 100644 lib/efi_loader/efi_helper.c
create mode 100644 lib/efi_selftest/efi_selftest_esrt.c
delete mode 100644 lib/efi_selftest/efi_selftest_load_initrd.c
2
1
From: dillon min <dillon.minfei(a)gmail.com>
These patches aim to adds u-boot support on art-pi board.
the board resources:
- stm32h750xbh6 128k flash, 1024k sram
- 32MiB sdram
- 16MiB spi flash
- 8MiB qspi flash
- onboard wifi, bt, fm
the detail board information can be found at:
https://art-pi.gitee.io/website/
dillon min (4):
ARM: dts: stm32: split sdram pin & timing parameter into specific
board dts
ARM: dts: stm32: Add RT-Thread art-pi board support
board: Add rt-thread art-pi board support
ram: stm32: fix strsep failed on read only memory
arch/arm/dts/Makefile | 3 +-
arch/arm/dts/stm32h7-u-boot.dtsi | 95 --------
arch/arm/dts/stm32h743.dtsi | 8 +
arch/arm/dts/stm32h743i-disco-u-boot.dtsi | 98 ++++++++
arch/arm/dts/stm32h743i-eval-u-boot.dtsi | 98 ++++++++
arch/arm/dts/stm32h750-pinctrl.dtsi | 319 +++++++++++++++++++++++++++
arch/arm/dts/stm32h750.dtsi | 5 +
arch/arm/dts/stm32h750i-art-pi-u-boot.dtsi | 81 +++++++
arch/arm/dts/stm32h750i-art-pi.dts | 75 +++++++
arch/arm/mach-stm32/stm32h7/Kconfig | 4 +
board/st/stm32h750-art-pi/Kconfig | 19 ++
board/st/stm32h750-art-pi/MAINTAINERS | 7 +
board/st/stm32h750-art-pi/Makefile | 6 +
board/st/stm32h750-art-pi/stm32h750-art-pi.c | 58 +++++
configs/stm32h750-art-pi_defconfig | 51 +++++
drivers/ram/stm32_sdram.c | 3 +
include/configs/stm32h750-art-pi.h | 48 ++++
include/dt-bindings/memory/stm32-sdram.h | 2 +
18 files changed, 884 insertions(+), 96 deletions(-)
create mode 100644 arch/arm/dts/stm32h750-pinctrl.dtsi
create mode 100644 arch/arm/dts/stm32h750.dtsi
create mode 100644 arch/arm/dts/stm32h750i-art-pi-u-boot.dtsi
create mode 100644 arch/arm/dts/stm32h750i-art-pi.dts
create mode 100644 board/st/stm32h750-art-pi/Kconfig
create mode 100644 board/st/stm32h750-art-pi/MAINTAINERS
create mode 100644 board/st/stm32h750-art-pi/Makefile
create mode 100644 board/st/stm32h750-art-pi/stm32h750-art-pi.c
create mode 100644 configs/stm32h750-art-pi_defconfig
create mode 100644 include/configs/stm32h750-art-pi.h
--
2.7.4
3
11
This is a straightforward conversion of the old, non-dm driver. It was
done in-place as the deadline for non-dm MMC has passed. Previous
commits ensured that no board depends on the old, non-dm variant.
Tested
on a Kirkwood based board with eMMC.
Signed-off-by: Harm Berntsen <harm.berntsen(a)nedap.com>
Tested-by: Harm Berntsen <harm.berntsen(a)nedap.com>
CC: Pantelis Antoniou <panto(a)antoniou-consulting.com>
CC: Stefan Roese <sr(a)denx.de>
CC: Gerald Kerma <drEagle(a)doukki.net>
CC: Simon Glass <sjg(a)chromium.org>
---
drivers/mmc/Kconfig | 9 ++
drivers/mmc/mvebu_mmc.c | 309 +++++++++++++++++++++++-----------------
include/mvebu_mmc.h | 13 +-
3 files changed, 194 insertions(+), 137 deletions(-)
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f8ca52efb6..de9ab8a387 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -326,6 +326,15 @@ config MMC_OCTEONTX
If unsure, say N.
+config MVEBU_MMC
+ bool "Kirkwood MMC controller support"
+ depends on DM_MMC && BLK && ARCH_KIRKWOOD
+ help
+ Support for MMC host controller on Kirkwood SoCs.
+ If you are on a Kirkwood architecture, say Y here.
+
+ If unsure, say N.
+
config PXA_MMC_GENERIC
bool "Support for MMC controllers on PXA"
help
diff --git a/drivers/mmc/mvebu_mmc.c b/drivers/mmc/mvebu_mmc.c
index 8ec1f57a1b..fea55c61ed 100644
--- a/drivers/mmc/mvebu_mmc.c
+++ b/drivers/mmc/mvebu_mmc.c
@@ -11,60 +11,67 @@
#include <errno.h>
#include <log.h>
#include <malloc.h>
+#include <dm.h>
+#include <fdtdec.h>
#include <part.h>
#include <mmc.h>
-#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <mvebu_mmc.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define DRIVER_NAME "MVEBU_MMC"
+#include <dm/device_compat.h>
#define MVEBU_TARGET_DRAM 0
#define TIMEOUT_DELAY 5*CONFIG_SYS_HZ /* wait 5 seconds */
-static void mvebu_mmc_write(u32 offs, u32 val)
+static inline void *get_regbase(const struct mmc *mmc)
{
- writel(val, CONFIG_SYS_MMC_BASE + (offs));
+ struct mvebu_mmc_plat *pdata = mmc->priv;
+
+ return pdata->iobase;
}
-static u32 mvebu_mmc_read(u32 offs)
+static void mvebu_mmc_write(const struct mmc *mmc, u32 offs, u32 val)
{
- return readl(CONFIG_SYS_MMC_BASE + (offs));
+ writel(val, get_regbase(mmc) + (offs));
}
-static int mvebu_mmc_setup_data(struct mmc_data *data)
+static u32 mvebu_mmc_read(const struct mmc *mmc, u32 offs)
{
+ return readl(get_regbase(mmc) + (offs));
+}
+
+static int mvebu_mmc_setup_data(struct udevice *dev, struct mmc_data
*data)
+{
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc *mmc = &pdata->mmc;
u32 ctrl_reg;
- debug("%s, data %s : blocks=%d blksz=%d\n", DRIVER_NAME,
- (data->flags & MMC_DATA_READ) ? "read" : "write",
- data->blocks, data->blocksize);
+ dev_dbg(dev, "data %s : blocks=%d blksz=%d\n",
+ (data->flags & MMC_DATA_READ) ? "read" : "write",
+ data->blocks, data->blocksize);
/* default to maximum timeout */
- ctrl_reg = mvebu_mmc_read(SDIO_HOST_CTRL);
+ ctrl_reg = mvebu_mmc_read(mmc, SDIO_HOST_CTRL);
ctrl_reg |= SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX);
- mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg);
+ mvebu_mmc_write(mmc, SDIO_HOST_CTRL, ctrl_reg);
if (data->flags & MMC_DATA_READ) {
- mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data->dest &
0xffff);
- mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data->dest >>
16);
+ mvebu_mmc_write(mmc, SDIO_SYS_ADDR_LOW, (u32)data->dest
& 0xffff);
+ mvebu_mmc_write(mmc, SDIO_SYS_ADDR_HI, (u32)data->dest
>> 16);
} else {
- mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data->src &
0xffff);
- mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data->src >>
16);
+ mvebu_mmc_write(mmc, SDIO_SYS_ADDR_LOW, (u32)data->src
& 0xffff);
+ mvebu_mmc_write(mmc, SDIO_SYS_ADDR_HI, (u32)data->src
>> 16);
}
- mvebu_mmc_write(SDIO_BLK_COUNT, data->blocks);
- mvebu_mmc_write(SDIO_BLK_SIZE, data->blocksize);
+ mvebu_mmc_write(mmc, SDIO_BLK_COUNT, data->blocks);
+ mvebu_mmc_write(mmc, SDIO_BLK_SIZE, data->blocksize);
return 0;
}
-static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
+static int mvebu_mmc_send_cmd(struct udevice *dev, struct mmc_cmd
*cmd,
struct mmc_data *data)
{
ulong start;
@@ -72,12 +79,14 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc,
struct mmc_cmd *cmd,
ushort resptype = 0;
ushort xfertype = 0;
ushort resp_indx = 0;
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc *mmc = &pdata->mmc;
- debug("%s: cmdidx [0x%x] resp_type[0x%x] cmdarg[0x%x]\n",
- DRIVER_NAME, cmd->cmdidx, cmd->resp_type, cmd->cmdarg);
+ dev_dbg(dev, "cmdidx [0x%x] resp_type[0x%x] cmdarg[0x%x]\n",
+ cmd->cmdidx, cmd->resp_type, cmd->cmdarg);
- debug("%s: cmd %d (hw state 0x%04x)\n", DRIVER_NAME,
- cmd->cmdidx, mvebu_mmc_read(SDIO_HW_STATE));
+ dev_dbg(dev, "cmd %d (hw state 0x%04x)\n",
+ cmd->cmdidx, mvebu_mmc_read(mmc, SDIO_HW_STATE));
/*
* Hardware weirdness. The FIFO_EMPTY bit of the HW_STATE
@@ -88,26 +97,26 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc,
struct mmc_cmd *cmd,
* this bit comes to good sense (which eventually happens by
* itself) then the new transfer simply fails with a timeout.
*/
- if (!(mvebu_mmc_read(SDIO_HW_STATE) & CMD_FIFO_EMPTY)) {
+ if (!(mvebu_mmc_read(mmc, SDIO_HW_STATE) & CMD_FIFO_EMPTY)) {
ushort hw_state, count = 0;
start = get_timer(0);
do {
- hw_state = mvebu_mmc_read(SDIO_HW_STATE);
+ hw_state = mvebu_mmc_read(mmc, SDIO_HW_STATE);
if ((get_timer(0) - start) > TIMEOUT_DELAY) {
printf("%s : FIFO_EMPTY bit missing\n",
- DRIVER_NAME);
+ dev->name);
break;
}
count++;
} while (!(hw_state & CMD_FIFO_EMPTY));
- debug("%s *** wait for FIFO_EMPTY bit (hw=0x%04x,
count=%d, jiffies=%ld)\n",
- DRIVER_NAME, hw_state, count, (get_timer(0) -
(start)));
+ dev_dbg(dev, "*** wait for FIFO_EMPTY bit (hw=0x%04x,
count=%d, jiffies=%ld)\n",
+ hw_state, count, (get_timer(0) - (start)));
}
/* Clear status */
- mvebu_mmc_write(SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
- mvebu_mmc_write(SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
resptype = SDIO_CMD_INDEX(cmd->cmdidx);
@@ -133,11 +142,10 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc,
struct mmc_cmd *cmd,
}
if (data) {
- int err = mvebu_mmc_setup_data(data);
+ int err = mvebu_mmc_setup_data(dev, data);
if (err) {
- debug("%s: command DATA error :%x\n",
- DRIVER_NAME, err);
+ dev_dbg(dev, "command DATA error :%x\n", err);
return err;
}
@@ -154,34 +162,33 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc,
struct mmc_cmd *cmd,
}
/* Setting cmd arguments */
- mvebu_mmc_write(SDIO_ARG_LOW, cmd->cmdarg & 0xffff);
- mvebu_mmc_write(SDIO_ARG_HI, cmd->cmdarg >> 16);
+ mvebu_mmc_write(mmc, SDIO_ARG_LOW, cmd->cmdarg & 0xffff);
+ mvebu_mmc_write(mmc, SDIO_ARG_HI, cmd->cmdarg >> 16);
/* Setting Xfer mode */
- mvebu_mmc_write(SDIO_XFER_MODE, xfertype);
+ mvebu_mmc_write(mmc, SDIO_XFER_MODE, xfertype);
/* Sending command */
- mvebu_mmc_write(SDIO_CMD, resptype);
+ mvebu_mmc_write(mmc, SDIO_CMD, resptype);
start = get_timer(0);
- while (!((mvebu_mmc_read(SDIO_NOR_INTR_STATUS)) & waittype)) {
- if (mvebu_mmc_read(SDIO_NOR_INTR_STATUS) &
SDIO_NOR_ERROR) {
- debug("%s: error! cmdidx : %d, err reg:
%04x\n",
- DRIVER_NAME, cmd->cmdidx,
- mvebu_mmc_read(SDIO_ERR_INTR_STATUS));
- if (mvebu_mmc_read(SDIO_ERR_INTR_STATUS) &
+ while (!((mvebu_mmc_read(mmc, SDIO_NOR_INTR_STATUS)) &
waittype)) {
+ if (mvebu_mmc_read(mmc, SDIO_NOR_INTR_STATUS) &
SDIO_NOR_ERROR) {
+ dev_dbg(dev, "error! cmdidx : %d, err reg:
%04x\n",
+ cmd->cmdidx,
+ mvebu_mmc_read(mmc,
SDIO_ERR_INTR_STATUS));
+ if (mvebu_mmc_read(mmc, SDIO_ERR_INTR_STATUS) &
(SDIO_ERR_CMD_TIMEOUT |
SDIO_ERR_DATA_TIMEOUT)) {
- debug("%s: command READ timed out\n",
- DRIVER_NAME);
+ dev_dbg(dev, "command READ timed
out\n");
return -ETIMEDOUT;
}
- debug("%s: command READ error\n", DRIVER_NAME);
+ dev_dbg(dev, "command READ error\n");
return -ECOMM;
}
if ((get_timer(0) - start) > TIMEOUT_DELAY) {
- debug("%s: command timed out\n", DRIVER_NAME);
+ dev_dbg(dev, "command timed out\n");
return -ETIMEDOUT;
}
}
@@ -191,8 +198,7 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc,
struct mmc_cmd *cmd,
uint response[8];
for (resp_indx = 0; resp_indx < 8; resp_indx++)
- response[resp_indx]
- = mvebu_mmc_read(SDIO_RSP(resp_indx));
+ response[resp_indx] = mvebu_mmc_read(mmc,
SDIO_RSP(resp_indx));
cmd->response[0] = ((response[0] & 0x03ff) << 22)
|
((response[1] & 0xffff) << 6) |
@@ -209,8 +215,7 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc,
struct mmc_cmd *cmd,
uint response[3];
for (resp_indx = 0; resp_indx < 3; resp_indx++)
- response[resp_indx]
- = mvebu_mmc_read(SDIO_RSP(resp_indx));
+ response[resp_indx] = mvebu_mmc_read(mmc,
SDIO_RSP(resp_indx));
cmd->response[0] = ((response[2] & 0x003f) << (8 -
8)) |
((response[1] & 0xffff) << (14
- 8)) |
@@ -225,64 +230,71 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc,
struct mmc_cmd *cmd,
cmd->response[3] = 0;
}
- debug("%s: resp[0x%x] ", DRIVER_NAME, cmd->resp_type);
+ dev_dbg(dev, "resp[0x%x] ", cmd->resp_type);
debug("[0x%x] ", cmd->response[0]);
debug("[0x%x] ", cmd->response[1]);
debug("[0x%x] ", cmd->response[2]);
debug("[0x%x] ", cmd->response[3]);
debug("\n");
- if (mvebu_mmc_read(SDIO_ERR_INTR_STATUS) &
+ if (mvebu_mmc_read(mmc, SDIO_ERR_INTR_STATUS) &
(SDIO_ERR_CMD_TIMEOUT | SDIO_ERR_DATA_TIMEOUT))
return -ETIMEDOUT;
return 0;
}
-static void mvebu_mmc_power_up(void)
+static void mvebu_mmc_power_up(struct udevice *dev)
{
- debug("%s: power up\n", DRIVER_NAME);
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc *mmc = &pdata->mmc;
+
+ dev_dbg(dev, "power up\n");
/* disable interrupts */
- mvebu_mmc_write(SDIO_NOR_INTR_EN, 0);
- mvebu_mmc_write(SDIO_ERR_INTR_EN, 0);
+ mvebu_mmc_write(mmc, SDIO_NOR_INTR_EN, 0);
+ mvebu_mmc_write(mmc, SDIO_ERR_INTR_EN, 0);
/* SW reset */
- mvebu_mmc_write(SDIO_SW_RESET, SDIO_SW_RESET_NOW);
+ mvebu_mmc_write(mmc, SDIO_SW_RESET, SDIO_SW_RESET_NOW);
- mvebu_mmc_write(SDIO_XFER_MODE, 0);
+ mvebu_mmc_write(mmc, SDIO_XFER_MODE, 0);
/* enable status */
- mvebu_mmc_write(SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
- mvebu_mmc_write(SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
/* enable interrupts status */
- mvebu_mmc_write(SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
- mvebu_mmc_write(SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
}
-static void mvebu_mmc_set_clk(unsigned int clock)
+static void mvebu_mmc_set_clk(struct udevice *dev, unsigned int clock)
{
unsigned int m;
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc *mmc = &pdata->mmc;
if (clock == 0) {
- debug("%s: clock off\n", DRIVER_NAME);
- mvebu_mmc_write(SDIO_XFER_MODE,
SDIO_XFER_MODE_STOP_CLK);
- mvebu_mmc_write(SDIO_CLK_DIV, MVEBU_MMC_BASE_DIV_MAX);
+ dev_dbg(dev, "clock off\n");
+ mvebu_mmc_write(mmc, SDIO_XFER_MODE,
SDIO_XFER_MODE_STOP_CLK);
+ mvebu_mmc_write(mmc, SDIO_CLK_DIV,
MVEBU_MMC_BASE_DIV_MAX);
} else {
m = MVEBU_MMC_BASE_FAST_CLOCK/(2*clock) - 1;
if (m > MVEBU_MMC_BASE_DIV_MAX)
m = MVEBU_MMC_BASE_DIV_MAX;
- mvebu_mmc_write(SDIO_CLK_DIV, m &
MVEBU_MMC_BASE_DIV_MAX);
- debug("%s: clock (%d) div : %d\n", DRIVER_NAME, clock,
m);
+ mvebu_mmc_write(mmc, SDIO_CLK_DIV, m &
MVEBU_MMC_BASE_DIV_MAX);
+ dev_dbg(dev, "clock (%d) div : %d\n", clock, m);
}
}
-static void mvebu_mmc_set_bus(unsigned int bus)
+static void mvebu_mmc_set_bus(struct udevice *dev, unsigned int bus)
{
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc *mmc = &pdata->mmc;
u32 ctrl_reg = 0;
- ctrl_reg = mvebu_mmc_read(SDIO_HOST_CTRL);
+ ctrl_reg = mvebu_mmc_read(mmc, SDIO_HOST_CTRL);
ctrl_reg &= ~SDIO_HOST_CTRL_DATA_WIDTH_4_BITS;
switch (bus) {
@@ -306,23 +318,26 @@ static void mvebu_mmc_set_bus(unsigned int bus)
ctrl_reg |= SDIO_HOST_CTRL_CARD_TYPE_MEM_ONLY;
- debug("%s: ctrl 0x%04x: %s %s %s\n", DRIVER_NAME, ctrl_reg,
- (ctrl_reg & SDIO_HOST_CTRL_PUSH_PULL_EN) ?
- "push-pull" : "open-drain",
- (ctrl_reg & SDIO_HOST_CTRL_DATA_WIDTH_4_BITS) ?
- "4bit-width" : "1bit-width",
- (ctrl_reg & SDIO_HOST_CTRL_HI_SPEED_EN) ?
- "high-speed" : "");
+ dev_dbg(dev, "ctrl 0x%04x: %s %s %s\n", ctrl_reg,
+ (ctrl_reg & SDIO_HOST_CTRL_PUSH_PULL_EN) ?
+ "push-pull" : "open-drain",
+ (ctrl_reg & SDIO_HOST_CTRL_DATA_WIDTH_4_BITS) ?
+ "4bit-width" : "1bit-width",
+ (ctrl_reg & SDIO_HOST_CTRL_HI_SPEED_EN) ?
+ "high-speed" : "");
- mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg);
+ mvebu_mmc_write(mmc, SDIO_HOST_CTRL, ctrl_reg);
}
-static int mvebu_mmc_set_ios(struct mmc *mmc)
+static int mvebu_mmc_set_ios(struct udevice *dev)
{
- debug("%s: bus[%d] clock[%d]\n", DRIVER_NAME,
- mmc->bus_width, mmc->clock);
- mvebu_mmc_set_bus(mmc->bus_width);
- mvebu_mmc_set_clk(mmc->clock);
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc *mmc = &pdata->mmc;
+
+ dev_dbg(dev, "bus[%d] clock[%d]\n",
+ mmc->bus_width, mmc->clock);
+ mvebu_mmc_set_bus(dev, mmc->bus_width);
+ mvebu_mmc_set_clk(dev, mmc->clock);
return 0;
}
@@ -330,13 +345,13 @@ static int mvebu_mmc_set_ios(struct mmc *mmc)
/*
* Set window register.
*/
-static void mvebu_window_setup(void)
+static void mvebu_window_setup(const struct mmc *mmc)
{
int i;
for (i = 0; i < 4; i++) {
- mvebu_mmc_write(WINDOW_CTRL(i), 0);
- mvebu_mmc_write(WINDOW_BASE(i), 0);
+ mvebu_mmc_write(mmc, WINDOW_CTRL(i), 0);
+ mvebu_mmc_write(mmc, WINDOW_BASE(i), 0);
}
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
u32 size, base, attrib;
@@ -364,79 +379,119 @@ static void mvebu_window_setup(void)
size = gd->bd->bi_dram[i].size;
base = gd->bd->bi_dram[i].start;
if (size && attrib) {
- mvebu_mmc_write(WINDOW_CTRL(i),
+ mvebu_mmc_write(mmc, WINDOW_CTRL(i),
MVCPU_WIN_CTRL_DATA(size,
MVEBU_TARGET_DRAM,
attrib,
MVCPU_WIN_ENABLE));
} else {
- mvebu_mmc_write(WINDOW_CTRL(i),
MVCPU_WIN_DISABLE);
+ mvebu_mmc_write(mmc, WINDOW_CTRL(i),
MVCPU_WIN_DISABLE);
}
- mvebu_mmc_write(WINDOW_BASE(i), base);
+ mvebu_mmc_write(mmc, WINDOW_BASE(i), base);
}
}
-static int mvebu_mmc_initialize(struct mmc *mmc)
+static int mvebu_mmc_initialize(struct udevice *dev)
{
- debug("%s: mvebu_mmc_initialize\n", DRIVER_NAME);
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc *mmc = &pdata->mmc;
+
+ dev_dbg(dev, "%s\n", __func__);
/*
* Setting host parameters
* Initial Host Ctrl : Timeout : max , Normal Speed mode,
* 4-bit data mode, Big Endian, SD memory Card, Push_pull CMD
Line
*/
- mvebu_mmc_write(SDIO_HOST_CTRL,
+ mvebu_mmc_write(mmc, SDIO_HOST_CTRL,
SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX)
|
SDIO_HOST_CTRL_DATA_WIDTH_4_BITS |
SDIO_HOST_CTRL_BIG_ENDIAN |
SDIO_HOST_CTRL_PUSH_PULL_EN |
SDIO_HOST_CTRL_CARD_TYPE_MEM_ONLY);
- mvebu_mmc_write(SDIO_CLK_CTRL, 0);
+ mvebu_mmc_write(mmc, SDIO_CLK_CTRL, 0);
/* enable status */
- mvebu_mmc_write(SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
- mvebu_mmc_write(SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
+ mvebu_mmc_write(mmc, SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
/* disable interrupts */
- mvebu_mmc_write(SDIO_NOR_INTR_EN, 0);
- mvebu_mmc_write(SDIO_ERR_INTR_EN, 0);
+ mvebu_mmc_write(mmc, SDIO_NOR_INTR_EN, 0);
+ mvebu_mmc_write(mmc, SDIO_ERR_INTR_EN, 0);
- mvebu_window_setup();
+ mvebu_window_setup(mmc);
/* SW reset */
- mvebu_mmc_write(SDIO_SW_RESET, SDIO_SW_RESET_NOW);
+ mvebu_mmc_write(mmc, SDIO_SW_RESET, SDIO_SW_RESET_NOW);
return 0;
}
-static const struct mmc_ops mvebu_mmc_ops = {
- .send_cmd = mvebu_mmc_send_cmd,
- .set_ios = mvebu_mmc_set_ios,
- .init = mvebu_mmc_initialize,
-};
-
-static struct mmc_config mvebu_mmc_cfg = {
- .name = DRIVER_NAME,
- .ops = &mvebu_mmc_ops,
- .f_min = MVEBU_MMC_BASE_FAST_CLOCK /
MVEBU_MMC_BASE_DIV_MAX,
- .f_max = MVEBU_MMC_CLOCKRATE_MAX,
- .voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
- .host_caps = MMC_MODE_4BIT | MMC_MODE_HS |
- MMC_MODE_HS_52MHz,
- .part_type = PART_TYPE_DOS,
- .b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
-
-int mvebu_mmc_init(struct bd_info *bis)
+static int mvebu_mmc_of_to_plat(struct udevice *dev)
{
- struct mmc *mmc;
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ fdt_addr_t addr;
- mvebu_mmc_power_up();
+ addr = dev_read_addr(dev);
+ if (addr == FDT_ADDR_T_NONE)
+ return -EINVAL;
- mmc = mmc_create(&mvebu_mmc_cfg, bis);
- if (mmc == NULL)
- return -1;
+ pdata->iobase = (void *)addr;
return 0;
}
+
+static int mvebu_mmc_probe(struct udevice *dev)
+{
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+ struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+ struct mmc *mmc = &pdata->mmc;
+ struct mmc_config *cfg = &pdata->cfg;
+
+ cfg->name = dev->name;
+ cfg->f_min = MVEBU_MMC_BASE_FAST_CLOCK /
MVEBU_MMC_BASE_DIV_MAX;
+ cfg->f_max = MVEBU_MMC_CLOCKRATE_MAX;
+ cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
+ cfg->host_caps = MMC_MODE_4BIT | MMC_MODE_HS |
MMC_MODE_HS_52MHz;
+ cfg->part_type = PART_TYPE_DOS;
+ cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+
+ mmc->cfg = cfg;
+ mmc->priv = pdata;
+ mmc->dev = dev;
+ upriv->mmc = mmc;
+
+ mvebu_mmc_power_up(dev);
+ mvebu_mmc_initialize(dev);
+
+ return 0;
+}
+
+static const struct dm_mmc_ops mvebu_dm_mmc_ops = {
+ .send_cmd = mvebu_mmc_send_cmd,
+ .set_ios = mvebu_mmc_set_ios,
+};
+
+static int mvebu_mmc_bind(struct udevice *dev)
+{
+ struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+
+ return mmc_bind(dev, &pdata->mmc, &pdata->cfg);
+}
+
+static const struct udevice_id mvebu_mmc_match[] = {
+ { .compatible = "marvell,orion-sdio" },
+ { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(mvebu_mmc) = {
+ .name = "mvebu_mmc",
+ .id = UCLASS_MMC,
+ .of_match = mvebu_mmc_match,
+ .ops = &mvebu_dm_mmc_ops,
+ .probe = mvebu_mmc_probe,
+ .bind = mvebu_mmc_bind,
+ .of_to_plat = mvebu_mmc_of_to_plat,
+ .plat_auto = sizeof(struct mvebu_mmc_plat),
+};
diff --git a/include/mvebu_mmc.h b/include/mvebu_mmc.h
index a35e5a12ce..e75c3fa328 100644
--- a/include/mvebu_mmc.h
+++ b/include/mvebu_mmc.h
@@ -258,17 +258,10 @@
/* Hardware reset */
#define MMC_CAP_HW_RESET (1 << 31)
-struct mvebu_mmc_cfg {
- u32 mvebu_mmc_base;
- u32 mvebu_mmc_clk;
- u8 max_bus_width;
+struct mvebu_mmc_plat {
+ void *iobase;
struct mmc_config cfg;
+ struct mmc mmc;
};
-/*
- * Functions prototypes
- */
-
-int mvebu_mmc_init(struct bd_info *bis);
-
#endif /* __MVEBU_MMC_H__ */
4
4

26 Mar '21
Add signature with crc32 value for all images in binman node for FIT
image in device tree. And, enable FIT signature checking for Stratix10
and Agilex ATF and VAB sdmmc boot.
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim(a)intel.com>
---
arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi | 30 +++++++++++++++++++++++++-----
configs/socfpga_agilex_atf_defconfig | 4 ++++
configs/socfpga_agilex_vab_defconfig | 4 ++++
configs/socfpga_stratix10_atf_defconfig | 4 ++++
4 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi b/arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi
index 4b30473743..84b91e8df0 100644
--- a/arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi
+++ b/arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi
@@ -29,10 +29,12 @@
arch = "arm64";
compression = "none";
load = <0x00200000>;
-
uboot_blob: blob-ext {
filename = "u-boot-nodtb.bin";
};
+ hash {
+ algo = "crc32";
+ };
};
atf {
@@ -43,20 +45,24 @@
compression = "none";
load = <0x00001000>;
entry = <0x00001000>;
-
atf_blob: blob-ext {
filename = "bl31.bin";
};
+ hash {
+ algo = "crc32";
+ };
};
fdt {
description = "U-Boot SoC64 flat device-tree";
type = "flat_dt";
compression = "none";
-
uboot_fdt_blob: blob-ext {
filename = "u-boot.dtb";
};
+ hash {
+ algo = "crc32";
+ };
};
};
@@ -67,6 +73,11 @@
firmware = "atf";
loadables = "uboot";
fdt = "fdt";
+ signature {
+ algo = "crc32";
+ key-name-hint = "dev";
+ sign-images = "atf", "fdt", "uboot";
+ };
};
};
};
@@ -87,10 +98,12 @@
compression = "none";
load = <0x4080000>;
entry = <0x4080000>;
-
kernel_blob: blob-ext {
filename = "Image";
};
+ hash {
+ algo = "crc32";
+ };
};
fdt {
@@ -98,10 +111,12 @@
type = "flat_dt";
arch = "arm64";
compression = "none";
-
kernel_fdt_blob: blob-ext {
filename = "linux.dtb";
};
+ hash {
+ algo = "crc32";
+ };
};
};
@@ -111,6 +126,11 @@
description = "Intel SoC64 FPGA";
kernel = "kernel";
fdt = "fdt";
+ signature {
+ algo = "crc32";
+ key-name-hint = "dev";
+ sign-images = "fdt", "kernel";
+ };
};
};
};
diff --git a/configs/socfpga_agilex_atf_defconfig b/configs/socfpga_agilex_atf_defconfig
index 7adda02b00..e5b7f4b52a 100644
--- a/configs/socfpga_agilex_atf_defconfig
+++ b/configs/socfpga_agilex_atf_defconfig
@@ -14,6 +14,10 @@ CONFIG_IDENT_STRING="socfpga_agilex"
CONFIG_SPL_FS_FAT=y
CONFIG_DEFAULT_DEVICE_TREE="socfpga_agilex_socdk"
CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000
+CONFIG_SPL_FIT_SIGNATURE=y
+CONFIG_SPL_CRC32_SUPPORT=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
# CONFIG_USE_SPL_FIT_GENERATOR is not set
diff --git a/configs/socfpga_agilex_vab_defconfig b/configs/socfpga_agilex_vab_defconfig
index bca663ed61..fac9cf72e5 100644
--- a/configs/socfpga_agilex_vab_defconfig
+++ b/configs/socfpga_agilex_vab_defconfig
@@ -15,6 +15,10 @@ CONFIG_IDENT_STRING="socfpga_agilex"
CONFIG_SPL_FS_FAT=y
CONFIG_DEFAULT_DEVICE_TREE="socfpga_agilex_socdk"
CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000
+CONFIG_SPL_FIT_SIGNATURE=y
+CONFIG_SPL_CRC32_SUPPORT=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
# CONFIG_USE_SPL_FIT_GENERATOR is not set
diff --git a/configs/socfpga_stratix10_atf_defconfig b/configs/socfpga_stratix10_atf_defconfig
index 8dbb7424ba..7466025bc0 100644
--- a/configs/socfpga_stratix10_atf_defconfig
+++ b/configs/socfpga_stratix10_atf_defconfig
@@ -14,6 +14,10 @@ CONFIG_IDENT_STRING="socfpga_stratix10"
CONFIG_SPL_FS_FAT=y
CONFIG_DEFAULT_DEVICE_TREE="socfpga_stratix10_socdk"
CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000
+CONFIG_SPL_FIT_SIGNATURE=y
+CONFIG_SPL_CRC32_SUPPORT=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
# CONFIG_USE_SPL_FIT_GENERATOR is not set
--
2.13.0
2
1