arm-trusted-firmware/include/drivers/partition/partition.h
Haojian Zhuang f8631f5139 drivers: partition: support different block size
The block size of some storage device is 4096-byte long, such as UFS. But
PARTITION_BLOCK_SIZE is defined as 512-byte long. So replace it by
PLAT_PARTITION_BLOCK_SIZE. Make it configurable in platform.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Change-Id: Iada05f7c646d0a0f2c0d3b8545540b3cb7153de3
2019-09-18 18:18:20 +08:00

48 lines
1.2 KiB
C

/*
* Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PARTITION_H
#define PARTITION_H
#include <stdint.h>
#include <lib/cassert.h>
#if !PLAT_PARTITION_MAX_ENTRIES
# define PLAT_PARTITION_MAX_ENTRIES 128
#endif /* PLAT_PARTITION_MAX_ENTRIES */
CASSERT(PLAT_PARTITION_MAX_ENTRIES <= 128, assert_plat_partition_max_entries);
#if !PLAT_PARTITION_BLOCK_SIZE
# define PLAT_PARTITION_BLOCK_SIZE 512
#endif /* PLAT_PARTITION_BLOCK_SIZE */
CASSERT((PLAT_PARTITION_BLOCK_SIZE == 512) ||
(PLAT_PARTITION_BLOCK_SIZE == 4096),
assert_plat_partition_block_size);
#define LEGACY_PARTITION_BLOCK_SIZE 512
#define EFI_NAMELEN 36
typedef struct partition_entry {
uint64_t start;
uint64_t length;
char name[EFI_NAMELEN];
} partition_entry_t;
typedef struct partition_entry_list {
partition_entry_t list[PLAT_PARTITION_MAX_ENTRIES];
int entry_count;
} partition_entry_list_t;
int load_partition_table(unsigned int image_id);
const partition_entry_t *get_partition_entry(const char *name);
const partition_entry_list_t *get_partition_entry_list(void);
void partition_init(unsigned int image_id);
#endif /* PARTITION_H */