xref: /qemu/include/hw/ppc/pnv_core.h (revision 060e61436794d13ede9a1d0eb2b1d0cf3b7cfcfd)
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
8f70c5966SChetan Pant  * as published by the Free Software Foundation; either version 2.1 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"
25b6c80037SMarkus Armbruster #include "hw/ppc/pnv.h"
26db1015e9SEduardo Habkost #include "qom/object.h"
27d2fd9612SCédric Le Goater 
28d2fd9612SCédric Le Goater #define TYPE_PNV_CORE "powernv-cpu-core"
29c821774aSEduardo Habkost OBJECT_DECLARE_TYPE(PnvCore, PnvCoreClass,
3030b5707cSEduardo Habkost                     PNV_CORE)
31d2fd9612SCédric Le Goater 
32db1015e9SEduardo Habkost struct PnvCore {
33d2fd9612SCédric Le Goater     /*< private >*/
34d2fd9612SCédric Le Goater     CPUCore parent_obj;
35d2fd9612SCédric Le Goater 
36d2fd9612SCédric Le Goater     /*< public >*/
3708304a86SDavid Gibson     PowerPCCPU **threads;
38d2fd9612SCédric Le Goater     uint32_t pir;
399940412aSCaleb Schlossin     uint32_t hwid;
4008c3f3a7SCédric Le Goater     uint64_t hrmor;
41aa5ac64bSCédric Le Goater     PnvChip *chip;
4224ece072SCédric Le Goater 
4324ece072SCédric Le Goater     MemoryRegion xscom_regs;
44db1015e9SEduardo Habkost };
45d2fd9612SCédric Le Goater 
46db1015e9SEduardo Habkost struct PnvCoreClass {
47d2fd9612SCédric Le Goater     DeviceClass parent_class;
4890ef386cSCédric Le Goater 
4990ef386cSCédric Le Goater     const MemoryRegionOps *xscom_ops;
50aa2addf9SNicholas Piggin     uint64_t xscom_size;
51db1015e9SEduardo Habkost };
52d2fd9612SCédric Le Goater 
537fd544d8SIgor Mammedov #define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE
547fd544d8SIgor Mammedov #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX
55d2fd9612SCédric Le Goater 
568907fc25SCédric Le Goater typedef struct PnvCPUState {
57*060e6143SNicholas Piggin     PnvCore *pnv_core;
58956b8f46SCédric Le Goater     Object *intc;
598907fc25SCédric Le Goater } PnvCPUState;
608907fc25SCédric Le Goater 
618907fc25SCédric Le Goater static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
628907fc25SCédric Le Goater {
638907fc25SCédric Le Goater     return (PnvCPUState *)cpu->machine_data;
648907fc25SCédric Le Goater }
658907fc25SCédric Le Goater 
66fdc2b46aSJoel Stanley struct PnvQuadClass {
67fdc2b46aSJoel Stanley     DeviceClass parent_class;
68fdc2b46aSJoel Stanley 
69fdc2b46aSJoel Stanley     const MemoryRegionOps *xscom_ops;
70fdc2b46aSJoel Stanley     uint64_t xscom_size;
71bdb97596SJoel Stanley 
72bdb97596SJoel Stanley     const MemoryRegionOps *xscom_qme_ops;
73bdb97596SJoel Stanley     uint64_t xscom_qme_size;
74fdc2b46aSJoel Stanley };
75fdc2b46aSJoel Stanley 
765dad902cSCédric Le Goater #define TYPE_PNV_QUAD "powernv-cpu-quad"
77fdc2b46aSJoel Stanley 
78fdc2b46aSJoel Stanley #define PNV_QUAD_TYPE_SUFFIX "-" TYPE_PNV_QUAD
79fdc2b46aSJoel Stanley #define PNV_QUAD_TYPE_NAME(cpu_model) cpu_model PNV_QUAD_TYPE_SUFFIX
80fdc2b46aSJoel Stanley 
81fdc2b46aSJoel Stanley OBJECT_DECLARE_TYPE(PnvQuad, PnvQuadClass, PNV_QUAD)
825dad902cSCédric Le Goater 
83db1015e9SEduardo Habkost struct PnvQuad {
845dad902cSCédric Le Goater     DeviceState parent_obj;
855dad902cSCédric Le Goater 
8692612f15SCédric Le Goater     uint32_t quad_id;
875dad902cSCédric Le Goater     MemoryRegion xscom_regs;
88bdb97596SJoel Stanley     MemoryRegion xscom_qme_regs;
89db1015e9SEduardo Habkost };
90a8b991b5SMarkus Armbruster #endif /* PPC_PNV_CORE_H */
91