[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/25] hw/watchdog/wdt_aspeed: Extend MMIO range to cover more reg
From: |
Cédric Le Goater |
Subject: |
[PULL 16/25] hw/watchdog/wdt_aspeed: Extend MMIO range to cover more registers |
Date: |
Tue, 7 Feb 2023 11:07:35 +0100 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
When booting the Zephyr demo in [1] we get:
aspeed.io: unimplemented device write (size 4, offset 0x185128, value
0x030f1ff1) <--
aspeed.io: unimplemented device write (size 4, offset 0x18512c, value
0x03fffff1)
This corresponds to this Zephyr code [2]:
static int aspeed_wdt_init(const struct device *dev)
{
const struct aspeed_wdt_config *config = dev->config;
struct aspeed_wdt_data *const data = dev->data;
uint32_t reg_val;
/* disable WDT by default */
reg_val = sys_read32(config->ctrl_base + WDT_CTRL_REG);
reg_val &= ~WDT_CTRL_ENABLE;
sys_write32(reg_val, config->ctrl_base + WDT_CTRL_REG);
sys_write32(data->rst_mask1,
config->ctrl_base + WDT_SW_RESET_MASK1_REG); <------
sys_write32(data->rst_mask2,
config->ctrl_base + WDT_SW_RESET_MASK2_REG);
return 0;
}
The register definitions are [3]:
#define WDT_RELOAD_VAL_REG 0x0004
#define WDT_RESTART_REG 0x0008
#define WDT_CTRL_REG 0x000C
#define WDT_TIMEOUT_STATUS_REG 0x0010
#define WDT_TIMEOUT_STATUS_CLR_REG 0x0014
#define WDT_RESET_MASK1_REG 0x001C
#define WDT_RESET_MASK2_REG 0x0020
#define WDT_SW_RESET_MASK1_REG 0x0028 <------
#define WDT_SW_RESET_MASK2_REG 0x002C
#define WDT_SW_RESET_CTRL_REG 0x0024
Currently QEMU only cover a MMIO region of size 0x20:
#define ASPEED_WDT_REGS_MAX (0x20 / 4)
Change to map the whole 'iosize' which might be bigger, covering
the other registers. The MemoryRegionOps read/write handlers will
report the accesses as out-of-bounds guest-errors, but the next
commit will report them as unimplemented.
[1] https://github.com/AspeedTech-BMC/zephyr/releases/tag/v00.01.07
[2] https://github.com/AspeedTech-BMC/zephyr/commit/2e99f10ac27b
[3]
https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/drivers/watchdog/wdt_aspeed.c#L31
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/watchdog/wdt_aspeed.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
index 958725a1b5..eefca31ae4 100644
--- a/hw/watchdog/wdt_aspeed.c
+++ b/hw/watchdog/wdt_aspeed.c
@@ -260,6 +260,7 @@ static void aspeed_wdt_realize(DeviceState *dev, Error
**errp)
{
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
AspeedWDTState *s = ASPEED_WDT(dev);
+ AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(dev);
assert(s->scu);
@@ -271,7 +272,7 @@ static void aspeed_wdt_realize(DeviceState *dev, Error
**errp)
s->pclk_freq = PCLK_HZ;
memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_wdt_ops, s,
- TYPE_ASPEED_WDT, ASPEED_WDT_REGS_MAX * 4);
+ TYPE_ASPEED_WDT, awc->iosize);
sysbus_init_mmio(sbd, &s->iomem);
}
--
2.39.1
- [PULL 00/25] aspeed queue, Cédric Le Goater, 2023/02/07
- [PULL 02/25] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB, Cédric Le Goater, 2023/02/07
- [PULL 04/25] hw/net: Fix read of uninitialized memory in ftgmac100, Cédric Le Goater, 2023/02/07
- [PULL 03/25] aspeed: Add Supermicro X11 SPI machine type, Cédric Le Goater, 2023/02/07
- [PULL 01/25] tests/avocado: Introduce file_truncate(), Cédric Le Goater, 2023/02/07
- [PULL 06/25] m25p80: Add the is25wp256 SFPD table, Cédric Le Goater, 2023/02/07
- [PULL 13/25] hw/arm/aspeed: Add aspeed_eeprom.c, Cédric Le Goater, 2023/02/07
- [PULL 11/25] hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init, Cédric Le Goater, 2023/02/07
- [PULL 07/25] tests/avocado/machine_aspeed.py: update buildroot tests, Cédric Le Goater, 2023/02/07
- [PULL 10/25] hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards, Cédric Le Goater, 2023/02/07
- [PULL 16/25] hw/watchdog/wdt_aspeed: Extend MMIO range to cover more registers,
Cédric Le Goater <=
- [PULL 18/25] hw/misc/aspeed_hace: Do not crash if address_space_map() failed, Cédric Le Goater, 2023/02/07
- [PULL 14/25] hw/nvram/eeprom_at24c: Make reset behavior more like hardware, Cédric Le Goater, 2023/02/07
- [PULL 17/25] hw/watchdog/wdt_aspeed: Log unimplemented registers as UNIMP level, Cédric Le Goater, 2023/02/07
- [PULL 20/25] hw/arm/aspeed_ast10x0: Map I3C peripheral, Cédric Le Goater, 2023/02/07
- [PULL 21/25] hw/arm/aspeed_ast10x0: Map the secure SRAM, Cédric Le Goater, 2023/02/07
- [PULL 09/25] hw/core/loader: Remove declarations of option_rom_has_mr/rom_file_has_mr, Cédric Le Goater, 2023/02/07
- [PULL 05/25] avocado/boot_linux_console.py: Update ast2600 test, Cédric Le Goater, 2023/02/07
- [PULL 08/25] tests/avocado/machine_aspeed.py: Mask systemd services to speed up SDK boot, Cédric Le Goater, 2023/02/07
- [PULL 12/25] hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper, Cédric Le Goater, 2023/02/07
- [PULL 15/25] hw/watchdog/wdt_aspeed: Rename MMIO region size as 'iosize', Cédric Le Goater, 2023/02/07