Haojian Zhuang | 91f5646 | 2016-07-28 14:19:36 +0800 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 4b32e62 | 2018-08-16 16:52:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. |
Haojian Zhuang | 91f5646 | 2016-07-28 14:19:36 +0800 | [diff] [blame] | 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 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef PARTITION_H |
| 8 | #define PARTITION_H |
Haojian Zhuang | 91f5646 | 2016-07-28 14:19:36 +0800 | [diff] [blame] | 9 | |
Antonio Nino Diaz | 4b32e62 | 2018-08-16 16:52:57 +0100 | [diff] [blame] | 10 | #include <stdint.h> |
Haojian Zhuang | 91f5646 | 2016-07-28 14:19:36 +0800 | [diff] [blame] | 11 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 12 | #include <lib/cassert.h> |
| 13 | |
Haojian Zhuang | 91f5646 | 2016-07-28 14:19:36 +0800 | [diff] [blame] | 14 | #if !PLAT_PARTITION_MAX_ENTRIES |
| 15 | # define PLAT_PARTITION_MAX_ENTRIES 128 |
| 16 | #endif /* PLAT_PARTITION_MAX_ENTRIES */ |
| 17 | |
| 18 | CASSERT(PLAT_PARTITION_MAX_ENTRIES <= 128, assert_plat_partition_max_entries); |
| 19 | |
| 20 | #define PARTITION_BLOCK_SIZE 512 |
| 21 | |
| 22 | #define EFI_NAMELEN 36 |
| 23 | |
| 24 | typedef struct partition_entry { |
| 25 | uint64_t start; |
| 26 | uint64_t length; |
| 27 | char name[EFI_NAMELEN]; |
| 28 | } partition_entry_t; |
| 29 | |
| 30 | typedef struct partition_entry_list { |
| 31 | partition_entry_t list[PLAT_PARTITION_MAX_ENTRIES]; |
| 32 | int entry_count; |
| 33 | } partition_entry_list_t; |
| 34 | |
| 35 | int load_partition_table(unsigned int image_id); |
| 36 | const partition_entry_t *get_partition_entry(const char *name); |
| 37 | const partition_entry_list_t *get_partition_entry_list(void); |
| 38 | void partition_init(unsigned int image_id); |
| 39 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 40 | #endif /* PARTITION_H */ |