xref: /qemu/include/hw/ppc/pnv_core.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
1d2fd9612SCédric Le Goater /*
2d2fd9612SCédric Le Goater  * QEMU PowerPC PowerNV CPU Core model
3d2fd9612SCédric Le Goater  *
4d2fd9612SCédric Le Goater  * Copyright (c) 2016, IBM Corporation.
5d2fd9612SCédric Le Goater  *
6d2fd9612SCédric Le Goater  * This library is free software; you can redistribute it and/or
7d2fd9612SCédric Le Goater  * modify it under the terms of the GNU Lesser General Public License
8d2fd9612SCédric Le Goater  * as published by the Free Software Foundation; either version 2 of
9d2fd9612SCédric Le Goater  * the License, or (at your option) any later version.
10d2fd9612SCédric Le Goater  *
11d2fd9612SCédric Le Goater  * This library is distributed in the hope that it will be useful, but
12d2fd9612SCédric Le Goater  * WITHOUT ANY WARRANTY; without even the implied warranty of
13d2fd9612SCédric Le Goater  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14d2fd9612SCédric Le Goater  * Lesser General Public License for more details.
15d2fd9612SCédric Le Goater  *
16d2fd9612SCédric Le Goater  * You should have received a copy of the GNU Lesser General Public
17d2fd9612SCédric Le Goater  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18d2fd9612SCédric Le Goater  */
19a8b991b5SMarkus Armbruster 
20a8b991b5SMarkus Armbruster #ifndef PPC_PNV_CORE_H
21a8b991b5SMarkus Armbruster #define PPC_PNV_CORE_H
22d2fd9612SCédric Le Goater 
23d2fd9612SCédric Le Goater #include "hw/cpu/core.h"
24ec150c7eSMarkus Armbruster #include "target/ppc/cpu.h"
25*db1015e9SEduardo Habkost #include "qom/object.h"
26d2fd9612SCédric Le Goater 
27d2fd9612SCédric Le Goater #define TYPE_PNV_CORE "powernv-cpu-core"
28*db1015e9SEduardo Habkost typedef struct PnvCore PnvCore;
29*db1015e9SEduardo Habkost typedef struct PnvCoreClass PnvCoreClass;
30d2fd9612SCédric Le Goater #define PNV_CORE(obj) \
31d2fd9612SCédric Le Goater     OBJECT_CHECK(PnvCore, (obj), TYPE_PNV_CORE)
32d2fd9612SCédric Le Goater #define PNV_CORE_CLASS(klass) \
33d2fd9612SCédric Le Goater      OBJECT_CLASS_CHECK(PnvCoreClass, (klass), TYPE_PNV_CORE)
34d2fd9612SCédric Le Goater #define PNV_CORE_GET_CLASS(obj) \
35d2fd9612SCédric Le Goater      OBJECT_GET_CLASS(PnvCoreClass, (obj), TYPE_PNV_CORE)
36d2fd9612SCédric Le Goater 
37aa5ac64bSCédric Le Goater typedef struct PnvChip PnvChip;
38aa5ac64bSCédric Le Goater 
39*db1015e9SEduardo Habkost struct PnvCore {
40d2fd9612SCédric Le Goater     /*< private >*/
41d2fd9612SCédric Le Goater     CPUCore parent_obj;
42d2fd9612SCédric Le Goater 
43d2fd9612SCédric Le Goater     /*< public >*/
4408304a86SDavid Gibson     PowerPCCPU **threads;
45d2fd9612SCédric Le Goater     uint32_t pir;
4608c3f3a7SCédric Le Goater     uint64_t hrmor;
47aa5ac64bSCédric Le Goater     PnvChip *chip;
4824ece072SCédric Le Goater 
4924ece072SCédric Le Goater     MemoryRegion xscom_regs;
50*db1015e9SEduardo Habkost };
51d2fd9612SCédric Le Goater 
52*db1015e9SEduardo Habkost struct PnvCoreClass {
53d2fd9612SCédric Le Goater     DeviceClass parent_class;
5490ef386cSCédric Le Goater 
5590ef386cSCédric Le Goater     const MemoryRegionOps *xscom_ops;
56*db1015e9SEduardo Habkost };
57d2fd9612SCédric Le Goater 
587fd544d8SIgor Mammedov #define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE
597fd544d8SIgor Mammedov #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX
60d2fd9612SCédric Le Goater 
618907fc25SCédric Le Goater typedef struct PnvCPUState {
62956b8f46SCédric Le Goater     Object *intc;
638907fc25SCédric Le Goater } PnvCPUState;
648907fc25SCédric Le Goater 
658907fc25SCédric Le Goater static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
668907fc25SCédric Le Goater {
678907fc25SCédric Le Goater     return (PnvCPUState *)cpu->machine_data;
688907fc25SCédric Le Goater }
698907fc25SCédric Le Goater 
705dad902cSCédric Le Goater #define TYPE_PNV_QUAD "powernv-cpu-quad"
71*db1015e9SEduardo Habkost typedef struct PnvQuad PnvQuad;
725dad902cSCédric Le Goater #define PNV_QUAD(obj) \
735dad902cSCédric Le Goater     OBJECT_CHECK(PnvQuad, (obj), TYPE_PNV_QUAD)
745dad902cSCédric Le Goater 
75*db1015e9SEduardo Habkost struct PnvQuad {
765dad902cSCédric Le Goater     DeviceState parent_obj;
775dad902cSCédric Le Goater 
785dad902cSCédric Le Goater     uint32_t id;
795dad902cSCédric Le Goater     MemoryRegion xscom_regs;
80*db1015e9SEduardo Habkost };
81a8b991b5SMarkus Armbruster #endif /* PPC_PNV_CORE_H */
82