1 /* 2 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef PARTITION_H 8 #define PARTITION_H 9 10 #include <stdint.h> 11 12 #include <lib/cassert.h> 13 #include <drivers/partition/efi.h> 14 15 #if !PLAT_PARTITION_MAX_ENTRIES 16 # define PLAT_PARTITION_MAX_ENTRIES 128 17 #endif /* PLAT_PARTITION_MAX_ENTRIES */ 18 19 CASSERT(PLAT_PARTITION_MAX_ENTRIES <= 128, assert_plat_partition_max_entries); 20 21 #if !PLAT_PARTITION_BLOCK_SIZE 22 # define PLAT_PARTITION_BLOCK_SIZE 512 23 #endif /* PLAT_PARTITION_BLOCK_SIZE */ 24 25 CASSERT((PLAT_PARTITION_BLOCK_SIZE == 512) || 26 (PLAT_PARTITION_BLOCK_SIZE == 4096), 27 assert_plat_partition_block_size); 28 29 #define LEGACY_PARTITION_BLOCK_SIZE 512 30 31 typedef struct partition_entry { 32 uint64_t start; 33 uint64_t length; 34 char name[EFI_NAMELEN]; 35 } partition_entry_t; 36 37 typedef struct partition_entry_list { 38 partition_entry_t list[PLAT_PARTITION_MAX_ENTRIES]; 39 int entry_count; 40 } partition_entry_list_t; 41 42 int load_partition_table(unsigned int image_id); 43 const partition_entry_t *get_partition_entry(const char *name); 44 const partition_entry_list_t *get_partition_entry_list(void); 45 void partition_init(unsigned int image_id); 46 47 #endif /* PARTITION_H */ 48