Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / s390x / tod.h
blob0935e850891014fa247c6788ea23908428ce31ac
1 /*
2 * TOD (Time Of Day) clock
4 * Copyright 2018 Red Hat, Inc.
5 * Author(s): David Hildenbrand <david@redhat.com>
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.
9 */
11 #ifndef HW_S390_TOD_H
12 #define HW_S390_TOD_H
14 #include "hw/qdev-core.h"
15 #include "tcg/s390-tod.h"
16 #include "qom/object.h"
18 typedef struct S390TOD {
19 uint8_t high;
20 uint64_t low;
21 } S390TOD;
23 #define TYPE_S390_TOD "s390-tod"
24 OBJECT_DECLARE_TYPE(S390TODState, S390TODClass, S390_TOD)
25 #define TYPE_KVM_S390_TOD TYPE_S390_TOD "-kvm"
26 #define TYPE_QEMU_S390_TOD TYPE_S390_TOD "-qemu"
28 struct S390TODState {
29 /* private */
30 DeviceState parent_obj;
33 * Used by TCG to remember the time base. Used by KVM to backup the TOD
34 * while the TOD is stopped.
36 S390TOD base;
37 /* Used by KVM to remember if the TOD is stopped and base is valid. */
38 bool stopped;
41 struct S390TODClass {
42 /* private */
43 DeviceClass parent_class;
44 void (*parent_realize)(DeviceState *dev, Error **errp);
46 /* public */
47 void (*get)(const S390TODState *td, S390TOD *tod, Error **errp);
48 void (*set)(S390TODState *td, const S390TOD *tod, Error **errp);
51 void s390_init_tod(void);
52 S390TODState *s390_get_todstate(void);
54 #endif