aboutsummaryrefslogtreecommitdiff
path: root/hw/rtc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-09-11 19:26:51 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-09-11 19:26:51 +0100
commitf4ef8c9cc10b3bee829b9775879d4ff9f77c2442 (patch)
tree8245341c3ebfe98b9673bf7a8cb818b6d494c76f /hw/rtc
parent2499453eb1cbb68a45d7562a180afd7659007fd4 (diff)
parentb84bf23c88699098973de3bdec316c796f1b3794 (diff)
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging
QOM boilerplate cleanup Documentation build fix: * memory: Remove kernel-doc comment marker (Eduardo Habkost) QOM cleanups: * Rename QOM macros for consistency between TYPE_* and type checking constants (Eduardo Habkost) QOM new macros: * OBJECT_DECLARE_* and OBJECT_DEFINE_* macros (Daniel P. Berrangé) * DECLARE_*_CHECKER macros (Eduardo Habkost) Automated QOM boilerplate changes: * Automated changes to use DECLARE_*_CHECKER (Eduardo Habkost * Automated changes to use OBJECT_DECLARE* (Eduardo Habkost) # gpg: Signature made Thu 10 Sep 2020 19:17:49 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: (33 commits) virtio-vga: Use typedef name for instance_size vhost-user-vga: Use typedef name for instance_size xilinx_axienet: Use typedef name for instance_size lpc_ich9: Use typedef name for instance_size omap_intc: Use typedef name for instance_size xilinx_axidma: Use typedef name for instance_size tusb6010: Rename TUSB to TUSB6010 pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312 vfio: Rename PCI_VFIO to VFIO_PCI usb: Rename USB_SERIAL_DEV to USB_SERIAL sabre: Rename SABRE_DEVICE to SABRE rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER esp: Rename ESP_STATE to ESP ahci: Rename ICH_AHCI to ICH9_AHCI vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE gpex: Fix type checking function name ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/rtc')
-rw-r--r--hw/rtc/ds1338.c9
-rw-r--r--hw/rtc/exynos4210_rtc.c10
-rw-r--r--hw/rtc/m41t80.c9
-rw-r--r--hw/rtc/m48t59-isa.c21
-rw-r--r--hw/rtc/m48t59.c19
-rw-r--r--hw/rtc/sun4v-rtc.c9
-rw-r--r--hw/rtc/twl92230.c9
7 files changed, 49 insertions, 37 deletions
diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c
index 588a9ba9be..10fac3d9c9 100644
--- a/hw/rtc/ds1338.c
+++ b/hw/rtc/ds1338.c
@@ -16,6 +16,7 @@
#include "migration/vmstate.h"
#include "qemu/bcd.h"
#include "qemu/module.h"
+#include "qom/object.h"
/* Size of NVRAM including both the user-accessible area and the
* secondary register area.
@@ -29,9 +30,11 @@
#define CTRL_OSF 0x20
#define TYPE_DS1338 "ds1338"
-#define DS1338(obj) OBJECT_CHECK(DS1338State, (obj), TYPE_DS1338)
+typedef struct DS1338State DS1338State;
+DECLARE_INSTANCE_CHECKER(DS1338State, DS1338,
+ TYPE_DS1338)
-typedef struct DS1338State {
+struct DS1338State {
I2CSlave parent_obj;
int64_t offset;
@@ -39,7 +42,7 @@ typedef struct DS1338State {
uint8_t nvram[NVRAM_SIZE];
int32_t ptr;
bool addr_byte;
-} DS1338State;
+};
static const VMStateDescription vmstate_ds1338 = {
.name = "ds1338",
diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c
index f85483a07f..f8a4fe8a47 100644
--- a/hw/rtc/exynos4210_rtc.c
+++ b/hw/rtc/exynos4210_rtc.c
@@ -38,6 +38,7 @@
#include "hw/irq.h"
#include "hw/arm/exynos4210.h"
+#include "qom/object.h"
#define DEBUG_RTC 0
@@ -84,10 +85,11 @@
#define RTC_BASE_FREQ 32768
#define TYPE_EXYNOS4210_RTC "exynos4210.rtc"
-#define EXYNOS4210_RTC(obj) \
- OBJECT_CHECK(Exynos4210RTCState, (obj), TYPE_EXYNOS4210_RTC)
+typedef struct Exynos4210RTCState Exynos4210RTCState;
+DECLARE_INSTANCE_CHECKER(Exynos4210RTCState, EXYNOS4210_RTC,
+ TYPE_EXYNOS4210_RTC)
-typedef struct Exynos4210RTCState {
+struct Exynos4210RTCState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -113,7 +115,7 @@ typedef struct Exynos4210RTCState {
qemu_irq alm_irq; /* alarm irq */
struct tm current_tm; /* current time */
-} Exynos4210RTCState;
+};
#define TICCKSEL(value) ((value & (0x0F << 4)) >> 4)
diff --git a/hw/rtc/m41t80.c b/hw/rtc/m41t80.c
index 914ecac8f4..0b7048c3f4 100644
--- a/hw/rtc/m41t80.c
+++ b/hw/rtc/m41t80.c
@@ -14,14 +14,17 @@
#include "qemu/timer.h"
#include "qemu/bcd.h"
#include "hw/i2c/i2c.h"
+#include "qom/object.h"
#define TYPE_M41T80 "m41t80"
-#define M41T80(obj) OBJECT_CHECK(M41t80State, (obj), TYPE_M41T80)
+typedef struct M41t80State M41t80State;
+DECLARE_INSTANCE_CHECKER(M41t80State, M41T80,
+ TYPE_M41T80)
-typedef struct M41t80State {
+struct M41t80State {
I2CSlave parent_obj;
int8_t addr;
-} M41t80State;
+};
static void m41t80_realize(DeviceState *dev, Error **errp)
{
diff --git a/hw/rtc/m48t59-isa.c b/hw/rtc/m48t59-isa.c
index 50430b7a85..cae315e488 100644
--- a/hw/rtc/m48t59-isa.c
+++ b/hw/rtc/m48t59-isa.c
@@ -30,26 +30,25 @@
#include "m48t59-internal.h"
#include "qapi/error.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define TYPE_M48TXX_ISA "isa-m48txx"
-#define M48TXX_ISA_GET_CLASS(obj) \
- OBJECT_GET_CLASS(M48txxISADeviceClass, (obj), TYPE_M48TXX_ISA)
-#define M48TXX_ISA_CLASS(klass) \
- OBJECT_CLASS_CHECK(M48txxISADeviceClass, (klass), TYPE_M48TXX_ISA)
-#define M48TXX_ISA(obj) \
- OBJECT_CHECK(M48txxISAState, (obj), TYPE_M48TXX_ISA)
-
-typedef struct M48txxISAState {
+typedef struct M48txxISADeviceClass M48txxISADeviceClass;
+typedef struct M48txxISAState M48txxISAState;
+DECLARE_OBJ_CHECKERS(M48txxISAState, M48txxISADeviceClass,
+ M48TXX_ISA, TYPE_M48TXX_ISA)
+
+struct M48txxISAState {
ISADevice parent_obj;
M48t59State state;
uint32_t io_base;
MemoryRegion io;
-} M48txxISAState;
+};
-typedef struct M48txxISADeviceClass {
+struct M48txxISADeviceClass {
ISADeviceClass parent_class;
M48txxInfo info;
-} M48txxISADeviceClass;
+};
static M48txxInfo m48txx_isa_info[] = {
{
diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c
index b428a06045..6525206976 100644
--- a/hw/rtc/m48t59.c
+++ b/hw/rtc/m48t59.c
@@ -40,14 +40,13 @@
#include "m48t59-internal.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
#define TYPE_M48TXX_SYS_BUS "sysbus-m48txx"
-#define M48TXX_SYS_BUS_GET_CLASS(obj) \
- OBJECT_GET_CLASS(M48txxSysBusDeviceClass, (obj), TYPE_M48TXX_SYS_BUS)
-#define M48TXX_SYS_BUS_CLASS(klass) \
- OBJECT_CLASS_CHECK(M48txxSysBusDeviceClass, (klass), TYPE_M48TXX_SYS_BUS)
-#define M48TXX_SYS_BUS(obj) \
- OBJECT_CHECK(M48txxSysBusState, (obj), TYPE_M48TXX_SYS_BUS)
+typedef struct M48txxSysBusDeviceClass M48txxSysBusDeviceClass;
+typedef struct M48txxSysBusState M48txxSysBusState;
+DECLARE_OBJ_CHECKERS(M48txxSysBusState, M48txxSysBusDeviceClass,
+ M48TXX_SYS_BUS, TYPE_M48TXX_SYS_BUS)
/*
* Chipset docs:
@@ -56,16 +55,16 @@
* http://www.st.com/stonline/products/literature/od/7001/m48t59y.pdf
*/
-typedef struct M48txxSysBusState {
+struct M48txxSysBusState {
SysBusDevice parent_obj;
M48t59State state;
MemoryRegion io;
-} M48txxSysBusState;
+};
-typedef struct M48txxSysBusDeviceClass {
+struct M48txxSysBusDeviceClass {
SysBusDeviceClass parent_class;
M48txxInfo info;
-} M48txxSysBusDeviceClass;
+};
static M48txxInfo m48txx_sysbus_info[] = {
{
diff --git a/hw/rtc/sun4v-rtc.c b/hw/rtc/sun4v-rtc.c
index 52caea8654..18979d25d0 100644
--- a/hw/rtc/sun4v-rtc.c
+++ b/hw/rtc/sun4v-rtc.c
@@ -16,16 +16,19 @@
#include "qemu/timer.h"
#include "hw/rtc/sun4v-rtc.h"
#include "trace.h"
+#include "qom/object.h"
#define TYPE_SUN4V_RTC "sun4v_rtc"
-#define SUN4V_RTC(obj) OBJECT_CHECK(Sun4vRtc, (obj), TYPE_SUN4V_RTC)
+typedef struct Sun4vRtc Sun4vRtc;
+DECLARE_INSTANCE_CHECKER(Sun4vRtc, SUN4V_RTC,
+ TYPE_SUN4V_RTC)
-typedef struct Sun4vRtc {
+struct Sun4vRtc {
SysBusDevice parent_obj;
MemoryRegion iomem;
-} Sun4vRtc;
+};
static uint64_t sun4v_rtc_read(void *opaque, hwaddr addr,
unsigned size)
diff --git a/hw/rtc/twl92230.c b/hw/rtc/twl92230.c
index d0011be89e..4f83eff5c3 100644
--- a/hw/rtc/twl92230.c
+++ b/hw/rtc/twl92230.c
@@ -29,13 +29,16 @@
#include "sysemu/sysemu.h"
#include "qemu/bcd.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define VERBOSE 1
#define TYPE_TWL92230 "twl92230"
-#define TWL92230(obj) OBJECT_CHECK(MenelausState, (obj), TYPE_TWL92230)
+typedef struct MenelausState MenelausState;
+DECLARE_INSTANCE_CHECKER(MenelausState, TWL92230,
+ TYPE_TWL92230)
-typedef struct MenelausState {
+struct MenelausState {
I2CSlave parent_obj;
int firstbyte;
@@ -71,7 +74,7 @@ typedef struct MenelausState {
uint16_t rtc_next_vmstate;
qemu_irq out[4];
uint8_t pwrbtn_state;
-} MenelausState;
+};
static inline void menelaus_update(MenelausState *s)
{