xref: /openbmc/qemu/target/ppc/cpu-qom.h (revision 55abfc1f)
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 "hw/core/cpu.h"
24 
25 #ifdef TARGET_PPC64
26 #define TYPE_POWERPC_CPU "powerpc64-cpu"
27 #else
28 #define TYPE_POWERPC_CPU "powerpc-cpu"
29 #endif
30 
31 OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)
32 
33 #define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU
34 #define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX
35 
36 #define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host")
37 
38 #ifndef CONFIG_USER_ONLY
39 typedef struct PPCTimebase {
40     uint64_t guest_timebase;
41     int64_t time_of_the_day_ns;
42     bool runstate_paused;
43 } PPCTimebase;
44 
45 extern const VMStateDescription vmstate_ppc_timebase;
46 
47 #define VMSTATE_PPC_TIMEBASE_V(_field, _state, _version) {            \
48     .name       = (stringify(_field)),                                \
49     .version_id = (_version),                                         \
50     .size       = sizeof(PPCTimebase),                                \
51     .vmsd       = &vmstate_ppc_timebase,                              \
52     .flags      = VMS_STRUCT,                                         \
53     .offset     = vmstate_offset_value(_state, _field, PPCTimebase),  \
54 }
55 
56 void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
57                                    RunState state);
58 #endif
59 
60 #endif
61