1 /* 2 * SPDX-License-Identifier: BSD-3-Clause 3 * SPDX-FileCopyrightText: Copyright TF-RMM Contributors. 4 */ 5 #ifndef PLATFORM_API_H 6 #define PLATFORM_API_H 7 8 #include <dev_type.h> 9 #include <stdint.h> 10 11 void plat_warmboot_setup(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3); 12 void plat_setup(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3); 13 14 /* 15 * Takes an aligned granule address, validates it and if valid returns the 16 * index in the struct granules array or UINT64_MAX in case of an error. 17 * 18 * This function also validates that the granule address is a valid 19 * page address. 20 */ 21 unsigned long plat_granule_addr_to_idx(unsigned long addr); 22 23 /* 24 * Takes an aligned dev_granule address, validates it and if valid returns the 25 * index in the struct dev_granules array or UINT64_MAX in case of an error. 26 * 27 * This function also validates that the dev_granule address is a valid page 28 * address and returns device granule coherency type if the addr is valid. 29 */ 30 unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_coh_type *type); 31 32 /* 33 * Takes an index in the struct granules array and returns the aligned granule 34 * address. The index must be within the number of granules expected by the 35 * platform. 36 */ 37 unsigned long plat_granule_idx_to_addr(unsigned long idx); 38 39 /* 40 * Takes an index in the struct dev_granules array and returns the aligned 41 * dev_granule address of the specified device type. The index must be within 42 * the number of dev_granules expected by the platform. 43 */ 44 unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_coh_type type); 45 46 #endif /* PLATFORM_API_H */ 47