refactor(qemu-sbsa): move DT related structures to their own header

Move structure declaration related to the DT to their own header.  That
way they can be reused by other files.  At the same time, typedefs are
removed and structure names prepended with "platform_" to avoid clashing
with other structure declarations available in the system.

No change in functionality.

Change-Id: If67a141cc7441b0636af774d7edfe51cf8034a11
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
Mathieu Poirier 2024-09-26 17:04:26 -06:00
parent 5ad3c97a5c
commit b386c6e61d
2 changed files with 48 additions and 33 deletions

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2024-2025, Linaro Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef SBSA_PLATFORM_H
#define SBSA_PLATFORM_H
#include <stdint.h>
#include <platform_def.h>
struct platform_cpu_data {
uint32_t nodeid;
uint32_t mpidr;
};
struct platform_memory_data {
uint32_t nodeid;
uint64_t addr_base;
uint64_t addr_size;
};
/*
* sockets: the number of sockets on sbsa-ref platform.
* clusters: the number of clusters in one socket.
* cores: the number of cores in one cluster.
* threads: the number of threads in one core.
*/
struct platform_cpu_topology {
uint32_t sockets;
uint32_t clusters;
uint32_t cores;
uint32_t threads;
};
struct qemu_platform_info {
uint32_t num_cpus;
uint32_t num_memnodes;
struct platform_cpu_data cpu[PLATFORM_CORE_COUNT];
struct platform_cpu_topology cpu_topo;
struct platform_memory_data memory[PLAT_MAX_MEM_NODES];
};
#endif /* SBSA_PLATFORM_H */

View file

@ -11,6 +11,8 @@
#include <libfdt.h>
#include <smccc_helpers.h>
#include <sbsa_platform.h>
/* default platform version is 0.0 */
static int platform_version_major;
static int platform_version_minor;
@ -35,39 +37,6 @@ static int platform_version_minor;
#define SIP_SVC_GET_MEMORY_NODE SIP_FUNCTION_ID(301)
static uint64_t gic_its_addr;
typedef struct {
uint32_t nodeid;
uint32_t mpidr;
} cpu_data;
typedef struct{
uint32_t nodeid;
uint64_t addr_base;
uint64_t addr_size;
} memory_data;
/*
* sockets: the number of sockets on sbsa-ref platform.
* clusters: the number of clusters in one socket.
* cores: the number of cores in one cluster.
* threads: the number of threads in one core.
*/
typedef struct {
uint32_t sockets;
uint32_t clusters;
uint32_t cores;
uint32_t threads;
} cpu_topology;
struct qemu_platform_info {
uint32_t num_cpus;
uint32_t num_memnodes;
cpu_data cpu[PLATFORM_CORE_COUNT];
cpu_topology cpu_topo;
memory_data memory[PLAT_MAX_MEM_NODES];
};
static struct qemu_platform_info dynamic_platform_info;
void sbsa_set_gic_bases(const uintptr_t gicd_base, const uintptr_t gicr_base);