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 #include "qom/object.h" 26 27 #define TYPE_PNV_CORE "powernv-cpu-core" 28 typedef struct PnvCore PnvCore; 29 typedef struct PnvCoreClass PnvCoreClass; 30 #define PNV_CORE(obj) \ 31 OBJECT_CHECK(PnvCore, (obj), TYPE_PNV_CORE) 32 #define PNV_CORE_CLASS(klass) \ 33 OBJECT_CLASS_CHECK(PnvCoreClass, (klass), TYPE_PNV_CORE) 34 #define PNV_CORE_GET_CLASS(obj) \ 35 OBJECT_GET_CLASS(PnvCoreClass, (obj), TYPE_PNV_CORE) 36 37 typedef struct PnvChip PnvChip; 38 39 struct PnvCore { 40 /*< private >*/ 41 CPUCore parent_obj; 42 43 /*< public >*/ 44 PowerPCCPU **threads; 45 uint32_t pir; 46 uint64_t hrmor; 47 PnvChip *chip; 48 49 MemoryRegion xscom_regs; 50 }; 51 52 struct PnvCoreClass { 53 DeviceClass parent_class; 54 55 const MemoryRegionOps *xscom_ops; 56 }; 57 58 #define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE 59 #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX 60 61 typedef struct PnvCPUState { 62 Object *intc; 63 } PnvCPUState; 64 65 static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu) 66 { 67 return (PnvCPUState *)cpu->machine_data; 68 } 69 70 #define TYPE_PNV_QUAD "powernv-cpu-quad" 71 typedef struct PnvQuad PnvQuad; 72 #define PNV_QUAD(obj) \ 73 OBJECT_CHECK(PnvQuad, (obj), TYPE_PNV_QUAD) 74 75 struct PnvQuad { 76 DeviceState parent_obj; 77 78 uint32_t id; 79 MemoryRegion xscom_regs; 80 }; 81 #endif /* PPC_PNV_CORE_H */ 82