mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
In the original model, each subsystem (PSP, SSP, and TSP) created its own
set of 13 UART devices, resulting in a total of 39 UART instances. However,
on real AST2700 hardware, there is only one set of 13 UARTs shared among
all processors.
This commit reworks the UART handling to correctly model the shared
hardware design. The PSP now creates the full set of 13 UART instances,
while the SSP and TSP link to the corresponding shared UART device
through object properties.
Changes include:
- Add "DEFINE_PROP_LINK("uart", ...)" and "DEFINE_PROP_INT32("uart-dev", ...)"
to allow each coprocessor to reference a specific shared UART instance.
- Modify SSP to link to PSP’s UART4, and TSP to link to PSP’s UART7.
- Introduce "uart_alias" to remap the UART’s MMIO region into the coprocessor’s
memory space.
- Redirect the UART interrupt to the coprocessor’s NVIC, replacing the
default routing to the PSP’s GIC.
With this change, only one set of 13 UART devices is instantiated by the PSP,
while the SSP and TSP reuse them via aliasing and shared interrupt routing,
matching the real AST2700 hardware behavior.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20251015062210.3128710-7-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
64 lines
1.6 KiB
C
64 lines
1.6 KiB
C
/*
|
|
* ASPEED Coprocessor
|
|
*
|
|
* Copyright (C) 2025 ASPEED Technology Inc.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef ASPEED_COPROCESSOR_H
|
|
#define ASPEED_COPROCESSOR_H
|
|
|
|
#include "qom/object.h"
|
|
#include "hw/arm/aspeed_soc.h"
|
|
|
|
struct AspeedCoprocessorState {
|
|
DeviceState parent;
|
|
|
|
MemoryRegion *memory;
|
|
MemoryRegion sdram;
|
|
MemoryRegion *sram;
|
|
MemoryRegion sram_alias;
|
|
MemoryRegion uart_alias;
|
|
MemoryRegion scu_alias;
|
|
Clock *sysclk;
|
|
|
|
AspeedSCUState *scu;
|
|
AspeedSCUState scuio;
|
|
AspeedTimerCtrlState timerctrl;
|
|
SerialMM *uart;
|
|
int uart_dev;
|
|
};
|
|
|
|
#define TYPE_ASPEED_COPROCESSOR "aspeed-coprocessor"
|
|
OBJECT_DECLARE_TYPE(AspeedCoprocessorState, AspeedCoprocessorClass,
|
|
ASPEED_COPROCESSOR)
|
|
|
|
struct AspeedCoprocessorClass {
|
|
DeviceClass parent_class;
|
|
|
|
/** valid_cpu_types: NULL terminated array of a single CPU type. */
|
|
const char * const *valid_cpu_types;
|
|
const hwaddr *memmap;
|
|
const int *irqmap;
|
|
};
|
|
|
|
struct Aspeed27x0CoprocessorState {
|
|
AspeedCoprocessorState parent;
|
|
AspeedINTCState intc[2];
|
|
UnimplementedDeviceState ipc[2];
|
|
UnimplementedDeviceState scuio;
|
|
|
|
ARMv7MState armv7m;
|
|
};
|
|
|
|
#define TYPE_ASPEED27X0SSP_COPROCESSOR "aspeed27x0ssp-coprocessor"
|
|
OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0CoprocessorState,
|
|
ASPEED27X0SSP_COPROCESSOR)
|
|
|
|
#define TYPE_ASPEED27X0TSP_COPROCESSOR "aspeed27x0tsp-coprocessor"
|
|
DECLARE_OBJ_CHECKERS(Aspeed27x0CoprocessorState, AspeedCoprocessorClass,
|
|
ASPEED27X0TSP_COPROCESSOR, TYPE_ASPEED27X0TSP_COPROCESSOR)
|
|
|
|
#endif /* ASPEED_COPROCESSOR_H */
|