|
@@ -18,6 +18,7 @@
|
|
#include "qemu/osdep.h"
|
|
#include "qemu/osdep.h"
|
|
#include "sysemu/reset.h"
|
|
#include "sysemu/reset.h"
|
|
#include "sysemu/watchdog.h"
|
|
#include "sysemu/watchdog.h"
|
|
|
|
+#include "hw/qdev-properties.h"
|
|
#include "hw/watchdog/sbsa_gwdt.h"
|
|
#include "hw/watchdog/sbsa_gwdt.h"
|
|
#include "qemu/timer.h"
|
|
#include "qemu/timer.h"
|
|
#include "migration/vmstate.h"
|
|
#include "migration/vmstate.h"
|
|
@@ -109,7 +110,7 @@ static void sbsa_gwdt_update_timer(SBSA_GWDTState *s, WdtRefreshType rtype)
|
|
timeout = s->woru;
|
|
timeout = s->woru;
|
|
timeout <<= 32;
|
|
timeout <<= 32;
|
|
timeout |= s->worl;
|
|
timeout |= s->worl;
|
|
- timeout = muldiv64(timeout, NANOSECONDS_PER_SECOND, SBSA_TIMER_FREQ);
|
|
|
|
|
|
+ timeout = muldiv64(timeout, NANOSECONDS_PER_SECOND, s->freq);
|
|
timeout += qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
|
timeout += qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
|
|
|
|
|
if ((rtype == EXPLICIT_REFRESH) || ((rtype == TIMEOUT_REFRESH) &&
|
|
if ((rtype == EXPLICIT_REFRESH) || ((rtype == TIMEOUT_REFRESH) &&
|
|
@@ -261,6 +262,17 @@ static void wdt_sbsa_gwdt_realize(DeviceState *dev, Error **errp)
|
|
dev);
|
|
dev);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static Property wdt_sbsa_gwdt_props[] = {
|
|
|
|
+ /*
|
|
|
|
+ * Timer frequency in Hz. This must match the frequency used by
|
|
|
|
+ * the CPU's generic timer. Default 62.5Hz matches QEMU's legacy
|
|
|
|
+ * CPU timer frequency default.
|
|
|
|
+ */
|
|
|
|
+ DEFINE_PROP_UINT64("clock-frequency", struct SBSA_GWDTState, freq,
|
|
|
|
+ 62500000),
|
|
|
|
+ DEFINE_PROP_END_OF_LIST(),
|
|
|
|
+};
|
|
|
|
+
|
|
static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, void *data)
|
|
static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, void *data)
|
|
{
|
|
{
|
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
@@ -271,6 +283,7 @@ static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, void *data)
|
|
set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
|
|
set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
|
|
dc->vmsd = &vmstate_sbsa_gwdt;
|
|
dc->vmsd = &vmstate_sbsa_gwdt;
|
|
dc->desc = "SBSA-compliant generic watchdog device";
|
|
dc->desc = "SBSA-compliant generic watchdog device";
|
|
|
|
+ device_class_set_props(dc, wdt_sbsa_gwdt_props);
|
|
}
|
|
}
|
|
|
|
|
|
static const TypeInfo wdt_sbsa_gwdt_info = {
|
|
static const TypeInfo wdt_sbsa_gwdt_info = {
|