xref: /qemu/include/hw/ppc/pnv_core.h (revision e5b6353c)
1 /*
2  * QEMU PowerPC PowerNV CPU Core model
3  *
4  * Copyright (c) 2016, IBM Corporation.
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 License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * 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 <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef PPC_PNV_CORE_H
21 #define PPC_PNV_CORE_H
22 
23 #include "hw/cpu/core.h"
24 #include "target/ppc/cpu.h"
25 
26 #define TYPE_PNV_CORE "powernv-cpu-core"
27 #define PNV_CORE(obj) \
28     OBJECT_CHECK(PnvCore, (obj), TYPE_PNV_CORE)
29 #define PNV_CORE_CLASS(klass) \
30      OBJECT_CLASS_CHECK(PnvCoreClass, (klass), TYPE_PNV_CORE)
31 #define PNV_CORE_GET_CLASS(obj) \
32      OBJECT_GET_CLASS(PnvCoreClass, (obj), TYPE_PNV_CORE)
33 
34 typedef struct PnvCore {
35     /*< private >*/
36     CPUCore parent_obj;
37 
38     /*< public >*/
39     PowerPCCPU **threads;
40     uint32_t pir;
41 
42     MemoryRegion xscom_regs;
43 } PnvCore;
44 
45 typedef struct PnvCoreClass {
46     DeviceClass parent_class;
47 
48     const MemoryRegionOps *xscom_ops;
49 } PnvCoreClass;
50 
51 #define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE
52 #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX
53 
54 typedef struct PnvCPUState {
55     Object *intc;
56 } PnvCPUState;
57 
58 static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
59 {
60     return (PnvCPUState *)cpu->machine_data;
61 }
62 
63 #define TYPE_PNV_QUAD "powernv-cpu-quad"
64 #define PNV_QUAD(obj) \
65     OBJECT_CHECK(PnvQuad, (obj), TYPE_PNV_QUAD)
66 
67 typedef struct PnvQuad {
68     DeviceState parent_obj;
69 
70     uint32_t id;
71     MemoryRegion xscom_regs;
72 } PnvQuad;
73 #endif /* PPC_PNV_CORE_H */
74