Skip to content

Commit

Permalink
[review] core: add support for transfer list
Browse files Browse the repository at this point in the history
Address review comments.

Signed-off-by: Raymond Mao <[email protected]>
  • Loading branch information
raymo200915 committed Oct 3, 2023
1 parent c4507db commit e336d14
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
19 changes: 13 additions & 6 deletions core/arch/arm/kernel/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void *manifest_dt __nex_bss;
static uint32_t cntfrq;
#endif

static unsigned long pa_tl;
static unsigned long transfer_list_pa;

/* May be overridden in plat-$(PLATFORM)/main.c */
__weak void plat_primary_init_early(void)
Expand Down Expand Up @@ -1266,9 +1266,11 @@ void __weak boot_init_primary_early(unsigned long pageable_part,
#if !defined(CFG_WITH_ARM_TRUSTED_FW)
e = nsec_entry;
#endif
if (IS_ENABLED(CFG_TRANSFER_LIST) && pa_tl && !pageable_part) {
/* When a TL is passed in, pageable_part has been forced to 0 */
if (IS_ENABLED(CFG_TRANSFER_LIST) && transfer_list_pa &&
!pageable_part) {
/* map the TL */
tl = transfer_list_map(pa_tl);
tl = transfer_list_map(transfer_list_pa);
if (!tl)
panic("Failed to map transfer list");
dt->tl = tl; /* save the mapped TL */
Expand All @@ -1289,14 +1291,19 @@ void __weak boot_init_primary_early(unsigned long pageable_part,
void __weak boot_save_transfer_list(unsigned long transfer_list,
unsigned long fdt)
{
if (transfer_list_check_header((void *)transfer_list) == TL_OPS_NON)
struct transfer_list_header *tl = (void *)transfer_list;

if (!IS_ALIGNED(transfer_list, TL_ALIGNMENT(tl->alignment)))
panic("Transfer list base address is not aligned");

if (transfer_list_check_header(tl) == TL_OPS_NON)
panic("Invalid transfer list");

if (fdt != (unsigned long)transfer_list_entry_data
(transfer_list_find((void *)transfer_list, TL_TAG_FDT)))
(transfer_list_find(tl, TL_TAG_FDT)))
panic("DT does not match to the DT entry of the TL");

pa_tl = transfer_list;
transfer_list_pa = transfer_list;
}
#endif

Expand Down
17 changes: 7 additions & 10 deletions core/kernel/dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,16 +629,13 @@ static TEE_Result release_external_dt(void)
panic();
}

if (IS_ENABLED(CFG_TRANSFER_LIST)) {
if (tl) {
te = transfer_list_find(tl, TL_TAG_FDT);
assert(external_dt.blob ==
transfer_list_entry_data(te));
transfer_list_set_data_size
(tl, te, fdt_totalsize(external_dt.blob));

transfer_list_unmap_sync(tl);
}
if (IS_ENABLED(CFG_TRANSFER_LIST) && tl) {
te = transfer_list_find(tl, TL_TAG_FDT);
assert(external_dt.blob ==
transfer_list_entry_data(te));
transfer_list_set_data_size
(tl, te, fdt_totalsize(external_dt.blob));
transfer_list_unmap_sync(tl);
} else if (core_mmu_remove_mapping(MEM_AREA_EXT_DT, external_dt.blob,
CFG_DTB_MAX_SIZE)) {
panic("Failed to remove temporary Device Tree mapping");
Expand Down

0 comments on commit e336d14

Please sign in to comment.