mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 10:04:26 +00:00
feat(guid-partition): allow to find partition by type UUID
Add function to return the partition by type. Signed-off-by: Lionel Debieve <lionel.debieve@foss.st.com> Change-Id: I87729dc5e68fbc45a523c894b67595b0079dd8fb
This commit is contained in:
parent
8fc6fb5cae
commit
564f5d4776
3 changed files with 17 additions and 1 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);
|
||||
|
|
Loading…
Add table
Reference in a new issue