blob: 02643e1dd4b4f2d2e4d48ef048bcc1bee3211625 [file] [log] [blame]
Soby Mathewb4c6df42022-11-09 11:13:29 +00001/*
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
AlexeiFedorov037add62024-10-30 15:53:05 +00008#include <dev_type.h>
Soby Mathewb4c6df42022-11-09 11:13:29 +00009#include <stdint.h>
10
11void plat_warmboot_setup(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3);
12void 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 */
21unsigned long plat_granule_addr_to_idx(unsigned long addr);
22
23/*
AlexeiFedorov037add62024-10-30 15:53:05 +000024 * 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 *
AlexeiFedorovd2e93932025-01-13 17:24:37 +000027 * 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.
AlexeiFedorov037add62024-10-30 15:53:05 +000029 */
AlexeiFedorovfb1d40b2025-04-04 14:37:45 +010030unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_coh_type *type);
AlexeiFedorov037add62024-10-30 15:53:05 +000031
32/*
Soby Mathewb4c6df42022-11-09 11:13:29 +000033 * 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 */
37unsigned long plat_granule_idx_to_addr(unsigned long idx);
38
AlexeiFedorov037add62024-10-30 15:53:05 +000039/*
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 */
AlexeiFedorovfb1d40b2025-04-04 14:37:45 +010044unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_coh_type type);
AlexeiFedorov037add62024-10-30 15:53:05 +000045
Soby Mathewb4c6df42022-11-09 11:13:29 +000046#endif /* PLATFORM_API_H */