xref: /openbmc/qemu/include/hw/ppc/pnv_core.h (revision 060e61436794d13ede9a1d0eb2b1d0cf3b7cfcfd)
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.1 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 #include "hw/ppc/pnv.h"
26 #include "qom/object.h"
27 
28 #define TYPE_PNV_CORE "powernv-cpu-core"
29 OBJECT_DECLARE_TYPE(PnvCore, PnvCoreClass,
30                     PNV_CORE)
31 
32 struct PnvCore {
33     /*< private >*/
34     CPUCore parent_obj;
35 
36     /*< public >*/
37     PowerPCCPU **threads;
38     uint32_t pir;
39     uint32_t hwid;
40     uint64_t hrmor;
41     PnvChip *chip;
42 
43     MemoryRegion xscom_regs;
44 };
45 
46 struct PnvCoreClass {
47     DeviceClass parent_class;
48 
49     const MemoryRegionOps *xscom_ops;
50     uint64_t xscom_size;
51 };
52 
53 #define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE
54 #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX
55 
56 typedef struct PnvCPUState {
57     PnvCore *pnv_core;
58     Object *intc;
59 } PnvCPUState;
60 
61 static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
62 {
63     return (PnvCPUState *)cpu->machine_data;
64 }
65 
66 struct PnvQuadClass {
67     DeviceClass parent_class;
68 
69     const MemoryRegionOps *xscom_ops;
70     uint64_t xscom_size;
71 
72     const MemoryRegionOps *xscom_qme_ops;
73     uint64_t xscom_qme_size;
74 };
75 
76 #define TYPE_PNV_QUAD "powernv-cpu-quad"
77 
78 #define PNV_QUAD_TYPE_SUFFIX "-" TYPE_PNV_QUAD
79 #define PNV_QUAD_TYPE_NAME(cpu_model) cpu_model PNV_QUAD_TYPE_SUFFIX
80 
81 OBJECT_DECLARE_TYPE(PnvQuad, PnvQuadClass, PNV_QUAD)
82 
83 struct PnvQuad {
84     DeviceState parent_obj;
85 
86     uint32_t quad_id;
87     MemoryRegion xscom_regs;
88     MemoryRegion xscom_qme_regs;
89 };
90 #endif /* PPC_PNV_CORE_H */
91