Haojian Zhuang | 91f5646 | 2016-07-28 14:19:36 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Haojian Zhuang | 91f5646 | 2016-07-28 14:19:36 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __PARTITION_H__ |
| 8 | #define __PARTITION_H__ |
| 9 | |
| 10 | #include <cassert.h> |
| 11 | #include <types.h> |
| 12 | |
| 13 | #if !PLAT_PARTITION_MAX_ENTRIES |
| 14 | # define PLAT_PARTITION_MAX_ENTRIES 128 |
| 15 | #endif /* PLAT_PARTITION_MAX_ENTRIES */ |
| 16 | |
| 17 | CASSERT(PLAT_PARTITION_MAX_ENTRIES <= 128, assert_plat_partition_max_entries); |
| 18 | |
| 19 | #define PARTITION_BLOCK_SIZE 512 |
| 20 | |
| 21 | #define EFI_NAMELEN 36 |
| 22 | |
| 23 | typedef struct partition_entry { |
| 24 | uint64_t start; |
| 25 | uint64_t length; |
| 26 | char name[EFI_NAMELEN]; |
| 27 | } partition_entry_t; |
| 28 | |
| 29 | typedef struct partition_entry_list { |
| 30 | partition_entry_t list[PLAT_PARTITION_MAX_ENTRIES]; |
| 31 | int entry_count; |
| 32 | } partition_entry_list_t; |
| 33 | |
| 34 | int load_partition_table(unsigned int image_id); |
| 35 | const partition_entry_t *get_partition_entry(const char *name); |
| 36 | const partition_entry_list_t *get_partition_entry_list(void); |
| 37 | void partition_init(unsigned int image_id); |
| 38 | |
| 39 | #endif /* __PARTITION_H__ */ |