mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
Merge changes from topic "st_fip_uuid" into integration
* changes: feat(stm32mp1): retrieve FIP partition by type UUID feat(guid-partition): allow to find partition by type UUID refactor(stm32mp1): update PLAT_PARTITION_MAX_ENTRIES
This commit is contained in:
commit
c152276829
5 changed files with 41 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -59,6 +59,7 @@ int parse_gpt_entry(gpt_entry_t *gpt_entry, partition_entry_t *entry)
|
|||
gpt_entry->first_lba + 1) *
|
||||
PLAT_PARTITION_BLOCK_SIZE;
|
||||
guidcpy(&entry->part_guid, &gpt_entry->unique_uuid);
|
||||
guidcpy(&entry->type_guid, &gpt_entry->type_uuid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -266,6 +266,19 @@ const partition_entry_t *get_partition_entry(const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const partition_entry_t *get_partition_entry_by_type(const uuid_t *type_uuid)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < list.entry_count; i++) {
|
||||
if (guidcmp(type_uuid, &list.list[i].type_guid) == 0) {
|
||||
return &list.list[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const partition_entry_t *get_partition_entry_by_uuid(const uuid_t *part_uuid)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -36,6 +36,7 @@ typedef struct partition_entry {
|
|||
uint64_t length;
|
||||
char name[EFI_NAMELEN];
|
||||
struct efi_guid part_guid;
|
||||
struct efi_guid type_guid;
|
||||
} partition_entry_t;
|
||||
|
||||
typedef struct partition_entry_list {
|
||||
|
@ -45,6 +46,7 @@ typedef struct partition_entry_list {
|
|||
|
||||
int load_partition_table(unsigned int image_id);
|
||||
const partition_entry_t *get_partition_entry(const char *name);
|
||||
const partition_entry_t *get_partition_entry_by_type(const uuid_t *type_guid);
|
||||
const partition_entry_t *get_partition_entry_by_uuid(const uuid_t *part_uuid);
|
||||
const partition_entry_list_t *get_partition_entry_list(void);
|
||||
void partition_init(unsigned int image_id);
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include <platform_def.h>
|
||||
#include <stm32cubeprogrammer.h>
|
||||
#include <stm32mp_efi.h>
|
||||
#include <stm32mp_fconf_getter.h>
|
||||
#include <stm32mp_io_storage.h>
|
||||
#include <usb_dfu.h>
|
||||
|
@ -451,13 +452,20 @@ int bl2_plat_handle_pre_image_load(unsigned int image_id)
|
|||
*/
|
||||
#if !PSA_FWU_SUPPORT
|
||||
const partition_entry_t *entry;
|
||||
const struct efi_guid img_type_guid = STM32MP_FIP_GUID;
|
||||
uuid_t img_type_uuid;
|
||||
|
||||
guidcpy(&img_type_uuid, &img_type_guid);
|
||||
partition_init(GPT_IMAGE_ID);
|
||||
entry = get_partition_entry(FIP_IMAGE_NAME);
|
||||
entry = get_partition_entry_by_type(&img_type_uuid);
|
||||
if (entry == NULL) {
|
||||
ERROR("Could NOT find the %s partition!\n",
|
||||
FIP_IMAGE_NAME);
|
||||
return -ENOENT;
|
||||
entry = get_partition_entry(FIP_IMAGE_NAME);
|
||||
if (entry == NULL) {
|
||||
ERROR("Could NOT find the %s partition!\n",
|
||||
FIP_IMAGE_NAME);
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
}
|
||||
|
||||
image_block_spec.offset = entry->start;
|
||||
|
|
|
@ -86,34 +86,28 @@ TF_CFLAGS += -Wformat-signedness
|
|||
WORKAROUND_CVE_2017_5715:= 0
|
||||
WORKAROUND_CVE_2022_23960:= 0
|
||||
|
||||
# Number of TF-A copies in the device
|
||||
STM32_TF_A_COPIES := 2
|
||||
|
||||
# PLAT_PARTITION_MAX_ENTRIES must take care of STM32_TF-A_COPIES and other partitions
|
||||
# such as metadata (2) to find all the FIP partitions (default is 2).
|
||||
PLAT_PARTITION_MAX_ENTRIES := $(shell echo $$(($(STM32_TF_A_COPIES) + 4)))
|
||||
|
||||
ifeq (${PSA_FWU_SUPPORT},1)
|
||||
ifneq (${STM32MP_USE_STM32IMAGE},1)
|
||||
# Number of banks of updatable firmware
|
||||
NR_OF_FW_BANKS := 2
|
||||
NR_OF_IMAGES_IN_FW_BANK := 1
|
||||
|
||||
# Number of TF-A copies in the device
|
||||
STM32_TF_A_COPIES := 2
|
||||
STM32_BL33_PARTS_NUM := 2
|
||||
STM32_RUNTIME_PARTS_NUM := 4
|
||||
FWU_MAX_PART = $(shell echo $$(($(STM32_TF_A_COPIES) + 2 + $(NR_OF_FW_BANKS))))
|
||||
ifeq ($(shell test $(FWU_MAX_PART) -gt $(PLAT_PARTITION_MAX_ENTRIES); echo $$?),0)
|
||||
$(error "Required partition number is $(FWU_MAX_PART) where PLAT_PARTITION_MAX_ENTRIES is only \
|
||||
$(PLAT_PARTITION_MAX_ENTRIES)")
|
||||
endif
|
||||
else
|
||||
$(error FWU Feature enabled only with FIP images)
|
||||
endif
|
||||
else
|
||||
# Number of TF-A copies in the device
|
||||
STM32_TF_A_COPIES := 2
|
||||
STM32_BL33_PARTS_NUM := 1
|
||||
ifeq ($(AARCH32_SP),optee)
|
||||
STM32_RUNTIME_PARTS_NUM := 3
|
||||
else ifeq ($(STM32MP_USE_STM32IMAGE),1)
|
||||
STM32_RUNTIME_PARTS_NUM := 0
|
||||
else
|
||||
STM32_RUNTIME_PARTS_NUM := 1
|
||||
endif
|
||||
endif
|
||||
PLAT_PARTITION_MAX_ENTRIES := $(shell echo $$(($(STM32_TF_A_COPIES) + \
|
||||
$(STM32_BL33_PARTS_NUM) + \
|
||||
$(STM32_RUNTIME_PARTS_NUM))))
|
||||
|
||||
# Boot devices
|
||||
STM32MP_EMMC ?= 0
|
||||
|
|
Loading…
Add table
Reference in a new issue