Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 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 | |
AlexeiFedorov | 037add6 | 2024-10-30 15:53:05 +0000 | [diff] [blame] | 8 | #include <dev_type.h> |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 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 | /* |
AlexeiFedorov | 037add6 | 2024-10-30 15:53:05 +0000 | [diff] [blame] | 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 |
| 28 | * page address and returns device granule type if the addr is valid. |
| 29 | */ |
AlexeiFedorov | fb1d40b | 2025-04-04 14:37:45 +0100 | [diff] [blame^] | 30 | unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_coh_type *type); |
AlexeiFedorov | 037add6 | 2024-10-30 15:53:05 +0000 | [diff] [blame] | 31 | |
| 32 | /* |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 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 | |
AlexeiFedorov | 037add6 | 2024-10-30 15:53:05 +0000 | [diff] [blame] | 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 | */ |
AlexeiFedorov | fb1d40b | 2025-04-04 14:37:45 +0100 | [diff] [blame^] | 44 | unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_coh_type type); |
AlexeiFedorov | 037add6 | 2024-10-30 15:53:05 +0000 | [diff] [blame] | 45 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 46 | #endif /* PLATFORM_API_H */ |