aboutsummaryrefslogtreecommitdiff
path: root/tools/mtk_image.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-09-30 15:52:10 -0400
committerTom Rini <trini@konsulko.com>2022-09-30 15:52:10 -0400
commit6ee6e15975cad3c99fad3a66223f3fd9287a369b (patch)
tree2a1798758c85d3010640cf6bacb1ad7caaa29133 /tools/mtk_image.c
parent01c88e3dcd667281cf3aa6f6b47f90900177aff9 (diff)
parentdb1ef1e12b993275e09f116ebc3d23d675c7e28c (diff)
Merge branch '2022-09-29-dm-core-support-multiple-device-trees-in-ofnode' into next
To quote the author: At present the ofnode interface is somewhat limited, in that it cannot access the device tree provided by the OS, only the one used by U-Boot itself (assuming these are separate). This prevents using ofnode functions to handle device tree fixups, i.e. ft_board_setup() and the like. The ofnode interface was introduced to allow a consistent API to access the device tree, whether a flat tree or a live tree (OF_LIVE) is in use. With the flat tree, adding nodes and properties at the start of the tree (as often happens when writing to the /chosen node) requires copying a lot of data for each operation. With live tree, such operations are quite a bit faster, since there is no memory copying required. This has to be weighed against the required memory allocation with OF_LIVE, as well as the cost of unflattening and flattening the device tree which U-Boot is running. This series enables support for access to multiple device trees with the ofnode interface. This is already available to some extent with OF_LIVE, but some of the ofnode functions need changes to allow the tree to be specified. The mechanism works by using the top 1-4 bits of the device tree offset. The sign bit is not affected, since negative values must be supported. With this implemented, it becomes possible to use the ofnode interface to do device tree fixups. The only current user is the EVT_FT_FIXUP event. This has two main benefits: - ofnode can now be used everywhere, in preference to the libfdt calls - live tree can eventually be used everywhere, with potential speed improvements when larger number of fixups are used This series is only a step along the way. Firstly, while it is possible to access the 'fix-up' tree using OF_LIVE, most of the fixup functions use flat tree directly, rather than the ofnode interface. These need to be updated. Also the tree must be flattened again before it is passed to the OS. This is not currently implemented. With OFNODE_MULTI_TREE disabled this has almost no effect on code size: around 4 bytes if EVENT is enabled, 0 if not. With the feature enabled, the increase is around 700 bytes, e.g. on venice2: $ buildman -b ofn2a venice2 -sS --step 0 Summary of 2 commits for 1 boards (1 thread, 64 jobs per thread) 01: image: Drop some other #ifdefs in image-board.c arm: w+ venice2 48: wip arm: (for 1/1 boards) all +668.0 text +668.0 This size increase is not too bad, considering the extra functionality, but is too large to enable everywhere. So for now this features needs to be opt-in only, based on EVENT.
Diffstat (limited to 'tools/mtk_image.c')
-rw-r--r--tools/mtk_image.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/mtk_image.c b/tools/mtk_image.c
index 9b3136afa3..5ef9334163 100644
--- a/tools/mtk_image.c
+++ b/tools/mtk_image.c
@@ -427,10 +427,10 @@ static uint32_t crc32be_cal(const void *data, size_t length)
static int mtk_image_verify_mt7621_header(const uint8_t *ptr, int print)
{
- const image_header_t *hdr = (const image_header_t *)ptr;
+ const struct legacy_img_hdr *hdr = (const struct legacy_img_hdr *)ptr;
struct mt7621_nand_header *nhdr;
uint32_t spl_size, crcval;
- image_header_t header;
+ struct legacy_img_hdr header;
int ret;
spl_size = image_get_size(hdr);
@@ -490,7 +490,7 @@ static int mtk_image_verify_mt7621_header(const uint8_t *ptr, int print)
static int mtk_image_verify_header(unsigned char *ptr, int image_size,
struct image_tool_params *params)
{
- image_header_t *hdr = (image_header_t *)ptr;
+ struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
union lk_hdr *lk = (union lk_hdr *)ptr;
/* nothing to verify for LK image header */
@@ -512,7 +512,7 @@ static int mtk_image_verify_header(unsigned char *ptr, int image_size,
static void mtk_image_print_header(const void *ptr)
{
- image_header_t *hdr = (image_header_t *)ptr;
+ struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
union lk_hdr *lk = (union lk_hdr *)ptr;
if (le32_to_cpu(lk->magic) == LK_PART_MAGIC) {
@@ -691,7 +691,7 @@ static void mtk_image_set_nand_header(void *ptr, off_t filesize,
static void mtk_image_set_mt7621_header(void *ptr, off_t filesize,
uint32_t loadaddr)
{
- image_header_t *hdr = (image_header_t *)ptr;
+ struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
struct mt7621_stage1_header *shdr;
struct mt7621_nand_header *nhdr;
uint32_t datasize, crcval;