qemu/hw/watchdog
Philippe Mathieu-Daudé 4ef247661e hw/watchdog/wdt_aspeed: Extend MMIO range to cover more registers
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>
2023-02-07 09:02:05 +01:00
..
cmsdk-apb-watchdog.c clock: Add ClockEvent parameter to callbacks 2021-03-08 17:20:01 +00:00
Kconfig hw/watchdog: Implement SBSA watchdog device 2020-10-27 11:10:44 +00:00
meson.build ppc/spapr: Implement H_WATCHDOG 2022-07-06 10:22:38 -03:00
sbsa_gwdt.c watchdog: remove -watchdog option 2022-09-29 11:40:28 +02:00
spapr_watchdog.c ppc/spapr: Implement H_WATCHDOG 2022-07-06 10:22:38 -03:00
trace-events hw/watchdog: add trace events for watchdog action handling 2022-12-21 06:35:28 -05:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
watchdog.c hw/watchdog: add trace events for watchdog action handling 2022-12-21 06:35:28 -05:00
wdt_aspeed.c hw/watchdog/wdt_aspeed: Extend MMIO range to cover more registers 2023-02-07 09:02:05 +01:00
wdt_diag288.c watchdog: remove -watchdog option 2022-09-29 11:40:28 +02:00
wdt_i6300esb.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
wdt_ib700.c watchdog: remove -watchdog option 2022-09-29 11:40:28 +02:00
wdt_imx2.c watchdog: remove -watchdog option 2022-09-29 11:40:28 +02:00