mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/pci-host/aspeed: Add AST2600 PCIe Root Port and make address configurable
Introduce an ASPEED PCIe Root Port and wire it under the RC. The root port is modeled as TYPE_ASPEED_PCIE_ROOT_PORT (subclass of TYPE_PCIE_ROOT_PORT). Key changes: - Add TYPE_ASPEED_PCIE_ROOT_PORT (PCIESlot-based) with vendor/device IDs and AER capability offset. - Extend AspeedPCIERcState to embed a root_port instance and a configurable rp_addr. - Add "rp-addr" property to the RC to place the root port at a specific devfn on the root bus. - Set the root port's "chassis" property to ensure a unique chassis per RC. - Extend AspeedPCIECfgClass with rc_rp_addr defaulting to PCI_DEVFN(8,0). Rationale: - AST2600 places the root port at 80:08.0 (bus 0x80, dev 8, fn 0). - AST2700 must place the root port at 00:00.0, and it supports three RCs. Each root port must therefore be uniquely identifiable; uses the PCIe "chassis" ID for that. - Providing a configurable "rp-addr" lets platforms select the correct devfn per SoC family, while the "chassis" property ensures uniqueness across multiple RC instances on AST2700. 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/20250919093017.338309-6-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
committed by
Cédric Le Goater
parent
cac2f08293
commit
2af56518fa
@@ -20,6 +20,7 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/pci/pci_bridge.h"
|
||||
#include "hw/pci/pcie_host.h"
|
||||
#include "hw/pci/pcie_port.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct AspeedPCIECfgTxDesc {
|
||||
@@ -40,6 +41,13 @@ typedef struct AspeedPCIERegMap {
|
||||
AspeedPCIERcRegs rc;
|
||||
} AspeedPCIERegMap;
|
||||
|
||||
#define TYPE_ASPEED_PCIE_ROOT_PORT "aspeed.pcie-root-port"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(AspeedPCIERootPortState, ASPEED_PCIE_ROOT_PORT)
|
||||
|
||||
typedef struct AspeedPCIERootPortState {
|
||||
PCIESlot parent_obj;
|
||||
} AspeedPCIERootPortState;
|
||||
|
||||
#define TYPE_ASPEED_PCIE_ROOT_DEVICE "aspeed.pcie-root-device"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(AspeedPCIERootDeviceState, ASPEED_PCIE_ROOT_DEVICE);
|
||||
|
||||
@@ -58,12 +66,14 @@ struct AspeedPCIERcState {
|
||||
MemoryRegion mmio;
|
||||
MemoryRegion io;
|
||||
|
||||
uint32_t rp_addr;
|
||||
uint32_t bus_nr;
|
||||
char name[16];
|
||||
bool has_rd;
|
||||
qemu_irq irq;
|
||||
|
||||
AspeedPCIERootDeviceState root_device;
|
||||
AspeedPCIERootPortState root_port;
|
||||
};
|
||||
|
||||
/* Bridge between AHB bus and PCIe RC. */
|
||||
@@ -87,6 +97,7 @@ struct AspeedPCIECfgClass {
|
||||
const AspeedPCIERegMap *reg_map;
|
||||
const MemoryRegionOps *reg_ops;
|
||||
|
||||
uint32_t rc_rp_addr;
|
||||
uint64_t rc_bus_nr;
|
||||
uint64_t nr_regs;
|
||||
bool rc_has_rd;
|
||||
|
||||
Reference in New Issue
Block a user