xref: /rk3399_ARM-atf/plat/qemu/qemu_sbsa/include/sbsa_platform.h (revision 95977c2e4dd7fd7ccce83d2b836bd54c3c60b425)
1b386c6e6SMathieu Poirier /*
2b386c6e6SMathieu Poirier  * Copyright (c) 2024-2025, Linaro Limited. All rights reserved.
3b386c6e6SMathieu Poirier  *
4b386c6e6SMathieu Poirier  * SPDX-License-Identifier: BSD-3-Clause
5b386c6e6SMathieu Poirier  */
6b386c6e6SMathieu Poirier 
7b386c6e6SMathieu Poirier #ifndef SBSA_PLATFORM_H
8b386c6e6SMathieu Poirier #define SBSA_PLATFORM_H
9b386c6e6SMathieu Poirier 
10b386c6e6SMathieu Poirier #include <stdint.h>
11b386c6e6SMathieu Poirier 
12b386c6e6SMathieu Poirier #include <platform_def.h>
13b386c6e6SMathieu Poirier 
14b386c6e6SMathieu Poirier struct platform_cpu_data {
15b386c6e6SMathieu Poirier 	uint32_t nodeid;
16b386c6e6SMathieu Poirier 	uint32_t mpidr;
17b386c6e6SMathieu Poirier };
18b386c6e6SMathieu Poirier 
19b386c6e6SMathieu Poirier struct platform_memory_data {
20b386c6e6SMathieu Poirier 	uint32_t nodeid;
21b386c6e6SMathieu Poirier 	uint64_t addr_base;
22b386c6e6SMathieu Poirier 	uint64_t addr_size;
23b386c6e6SMathieu Poirier };
24b386c6e6SMathieu Poirier 
25b386c6e6SMathieu Poirier /*
26b386c6e6SMathieu Poirier  * sockets: the number of sockets on sbsa-ref platform.
27b386c6e6SMathieu Poirier  * clusters: the number of clusters in one socket.
28b386c6e6SMathieu Poirier  * cores: the number of cores in one cluster.
29b386c6e6SMathieu Poirier  * threads: the number of threads in one core.
30b386c6e6SMathieu Poirier  */
31b386c6e6SMathieu Poirier struct platform_cpu_topology {
32b386c6e6SMathieu Poirier 	uint32_t sockets;
33b386c6e6SMathieu Poirier 	uint32_t clusters;
34b386c6e6SMathieu Poirier 	uint32_t cores;
35b386c6e6SMathieu Poirier 	uint32_t threads;
36b386c6e6SMathieu Poirier };
37b386c6e6SMathieu Poirier 
38b386c6e6SMathieu Poirier struct qemu_platform_info {
39b386c6e6SMathieu Poirier 	uint32_t num_cpus;
40b386c6e6SMathieu Poirier 	uint32_t num_memnodes;
41b386c6e6SMathieu Poirier 	struct platform_cpu_data cpu[PLATFORM_CORE_COUNT];
42b386c6e6SMathieu Poirier 	struct platform_cpu_topology cpu_topo;
43b386c6e6SMathieu Poirier 	struct platform_memory_data memory[PLAT_MAX_MEM_NODES];
44b386c6e6SMathieu Poirier };
45b386c6e6SMathieu Poirier 
466d59413bSMathieu Poirier void sbsa_platform_init(void);
47*d564e084SMathieu Poirier int sbsa_platform_version_major(void);
48*d564e084SMathieu Poirier int sbsa_platform_version_minor(void);
49*d564e084SMathieu Poirier uint32_t sbsa_platform_num_cpus(void);
50*d564e084SMathieu Poirier uint32_t sbsa_platform_num_memnodes(void);
51*d564e084SMathieu Poirier uint64_t sbsa_platform_gic_its_addr(void);
52*d564e084SMathieu Poirier struct platform_cpu_data sbsa_platform_cpu_node(uint64_t index);
53*d564e084SMathieu Poirier struct platform_memory_data sbsa_platform_memory_node(uint64_t index);
54*d564e084SMathieu Poirier struct platform_cpu_topology sbsa_platform_cpu_topology(void);
556d59413bSMathieu Poirier 
56b386c6e6SMathieu Poirier #endif /* SBSA_PLATFORM_H */
57