xref: /openbmc/qemu/target/ppc/cpu-qom.h (revision a158c63b)
1 /*
2  * QEMU PowerPC CPU QOM header (target agnostic)
3  *
4  * Copyright (c) 2012 SUSE LINUX Products GmbH
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see
18  * <http://www.gnu.org/licenses/lgpl-2.1.html>
19  */
20 #ifndef QEMU_PPC_CPU_QOM_H
21 #define QEMU_PPC_CPU_QOM_H
22 
23 #include "exec/gdbstub.h"
24 #include "hw/core/cpu.h"
25 
26 #ifdef TARGET_PPC64
27 #define TYPE_POWERPC_CPU "powerpc64-cpu"
28 #else
29 #define TYPE_POWERPC_CPU "powerpc-cpu"
30 #endif
31 
32 OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)
33 
34 #define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU
35 #define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX
36 
37 #define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host")
38 
39 #ifndef CONFIG_USER_ONLY
40 typedef struct PPCTimebase {
41     uint64_t guest_timebase;
42     int64_t time_of_the_day_ns;
43     bool runstate_paused;
44 } PPCTimebase;
45 
46 extern const VMStateDescription vmstate_ppc_timebase;
47 
48 #define VMSTATE_PPC_TIMEBASE_V(_field, _state, _version) {            \
49     .name       = (stringify(_field)),                                \
50     .version_id = (_version),                                         \
51     .size       = sizeof(PPCTimebase),                                \
52     .vmsd       = &vmstate_ppc_timebase,                              \
53     .flags      = VMS_STRUCT,                                         \
54     .offset     = vmstate_offset_value(_state, _field, PPCTimebase),  \
55 }
56 
57 void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
58                                    RunState state);
59 #endif
60 
61 #endif
62