-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmware/fw_payload: reduce the size by getting rid of padding
Signed-off-by: Tekkaman Ninja <tekkamanninja@163.com>
- Loading branch information
1 parent
fb50238
commit 2524b0e
Showing
5 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
* | ||
* Copyright (c) 2021 | ||
* Authors: Tekkaman Ninja <tekkamanninja@163.com> | ||
* | ||
* t0 --> payload text base addr | ||
* t1 --> payload end addr in fw_payload.bin | ||
* t2 --> payload start addr in fw_payload.bin | ||
* t3 --> payload text end addr (ti - t2 + t0) | ||
* t4 --> _relocate_payload_done | ||
* t2 t1 t0 t3 | ||
* +-----------+-----------+----------+-------------+-------+ | ||
* | fw_base + fw_payload| -------> |*fw_payload* | | | ||
* +-----------+-----------+----------+-------------+-------+ | ||
* | ||
*/ | ||
|
||
_relocate_payload: | ||
li t0, (FW_TEXT_START + FW_PAYLOAD_OFFSET) | ||
lla t1, _pl_end | ||
REG_L t1, 0(t1) | ||
lla t2, _pl_start | ||
REG_L t2, 0(t2) | ||
|
||
sub t3, t1, t2 | ||
add t3, t3, t0 | ||
|
||
beq t0, t2, _relocate_payload_done | ||
|
||
lla t4, _relocate_payload_done | ||
|
||
lla t5, _load_start | ||
REG_L t5, 0(t5) | ||
sub t4, t4, t5 | ||
|
||
lla t5, _link_start | ||
REG_L t5, 0(t5) | ||
add t4, t4, t5 | ||
|
||
blt t2, t0, _relocate_payload_copy_to_upper_loop | ||
|
||
_relocate_payload_copy_to_lower_loop: | ||
REG_L t3, 0(t2) | ||
REG_S t3, 0(t0) | ||
add t0, t0, __SIZEOF_POINTER__ | ||
add t2, t2, __SIZEOF_POINTER__ | ||
blt t2, t1, _relocate_payload_copy_to_lower_loop | ||
jr t4 | ||
|
||
_relocate_payload_copy_to_upper_loop: | ||
add t3, t3, -__SIZEOF_POINTER__ | ||
add t1, t1, -__SIZEOF_POINTER__ | ||
REG_L t0, 0(t1) | ||
REG_S t0, 0(t3) | ||
blt t2, t1, _relocate_payload_copy_to_upper_loop | ||
jr t4 | ||
|
||
.align 3 | ||
_pl_end: | ||
RISCV_PTR _payload_end | ||
_pl_start: | ||
RISCV_PTR _payload_start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,5 @@ FW_PAYLOAD=y | |
FW_PAYLOAD_FDT_ADDR=0x88000000 | ||
|
||
FW_PAYLOAD_ALIGN=0x1000 | ||
|
||
FW_PAYLOAD_NOPAD=y |
2524b0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will not require this patch if you have U-Boot SPL support because U-Boot SPL loads fw_dynamic.bin and U-Boot.bin separately.
Regards,
Anup
2524b0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am agree with you.
I added this temporarily, because the firmware(ddrinit from starfive) has a 1MB size limitation of next stage firmware before(it seems they expand the size to 10MB now for uefi).
If we can do SPL->opensbi+uboot(fw_payload.bin), we don't need this patch
I guess some one is working on SPL.