From eec2f9cc69ba68c09dfba6812f58e550c1e83d68 Mon Sep 17 00:00:00 2001 From: Jamin Lin Date: Thu, 4 Jul 2024 16:29:15 +0800 Subject: hw/net:ftgmac100: update memory region size to 64KB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the datasheet of ASPEED SOCs, one MAC controller owns 128KB of register space for AST2500. However, one MAC controller only owns 64KB of register space for AST2600 and AST2700. It set the memory region size 128KB and it occupied another controllers Address Spaces. Update one MAC controller memory region size to 0x1000 because AST2500 did not use register spaces over than 64KB. Introduce a new container region size to 0x1000 and its range is from 0 to 0xfff. This container is mapped a sub region for the current set of register. This sub region range is from 0 to 0xff. Signed-off-by: Jamin Lin Reviewed-by: Cédric Le Goater --- hw/net/ftgmac100.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'hw') diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index 25e4c0c..9e1f12c 100644 --- a/hw/net/ftgmac100.c +++ b/hw/net/ftgmac100.c @@ -1107,9 +1107,14 @@ static void ftgmac100_realize(DeviceState *dev, Error **errp) s->rxdes0_edorr = FTGMAC100_RXDES0_EDORR; } - memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops, s, - TYPE_FTGMAC100, 0x2000); - sysbus_init_mmio(sbd, &s->iomem); + memory_region_init(&s->iomem_container, OBJECT(s), + TYPE_FTGMAC100 ".container", FTGMAC100_MEM_SIZE); + sysbus_init_mmio(sbd, &s->iomem_container); + + memory_region_init_io(&s->iomem, OBJECT(s), &ftgmac100_ops, s, + TYPE_FTGMAC100 ".regs", FTGMAC100_REG_MEM_SIZE); + memory_region_add_subregion(&s->iomem_container, 0x0, &s->iomem); + sysbus_init_irq(sbd, &s->irq); qemu_macaddr_default_if_unset(&s->conf.macaddr); -- cgit v1.1