]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/s390x/tod.h
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into...
[mirror_qemu.git] / include / hw / s390x / tod.h
CommitLineData
8046f374
DH
1/*
2 * TOD (Time Of Day) clock
3 *
4 * Copyright 2018 Red Hat, Inc.
5 * Author(s): David Hildenbrand <david@redhat.com>
6 *
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 */
10
11#ifndef HW_S390_TOD_H
12#define HW_S390_TOD_H
13
14#include "hw/qdev.h"
4037c39b 15#include "s390-tod.h"
8046f374
DH
16
17typedef struct S390TOD {
18 uint8_t high;
19 uint64_t low;
20} S390TOD;
21
22#define TYPE_S390_TOD "s390-tod"
23#define S390_TOD(obj) OBJECT_CHECK(S390TODState, (obj), TYPE_S390_TOD)
24#define S390_TOD_CLASS(oc) OBJECT_CLASS_CHECK(S390TODClass, (oc), \
25 TYPE_S390_TOD)
26#define S390_TOD_GET_CLASS(obj) OBJECT_GET_CLASS(S390TODClass, (obj), \
27 TYPE_S390_TOD)
28#define TYPE_KVM_S390_TOD TYPE_S390_TOD "-kvm"
29#define TYPE_QEMU_S390_TOD TYPE_S390_TOD "-qemu"
30
31typedef struct S390TODState {
32 /* private */
33 DeviceState parent_obj;
7de3b1cd 34
9bc9d3d1
DH
35 /*
36 * Used by TCG to remember the time base. Used by KVM to backup the TOD
37 * while the TOD is stopped.
38 */
7de3b1cd 39 S390TOD base;
9bc9d3d1
DH
40 /* Used by KVM to remember if the TOD is stopped and base is valid. */
41 bool stopped;
8046f374
DH
42} S390TODState;
43
44typedef struct S390TODClass {
45 /* private */
46 DeviceClass parent_class;
9bc9d3d1 47 void (*parent_realize)(DeviceState *dev, Error **errp);
8046f374
DH
48
49 /* public */
50 void (*get)(const S390TODState *td, S390TOD *tod, Error **errp);
51 void (*set)(S390TODState *td, const S390TOD *tod, Error **errp);
52} S390TODClass;
53
54void s390_init_tod(void);
7de3b1cd 55S390TODState *s390_get_todstate(void);
8046f374
DH
56
57#endif