xref: /openbmc/qemu/include/hw/ppc/pnv_sbe.h (revision ffe98631)
1 /*
2  * QEMU PowerPC PowerNV Emulation of some SBE behaviour
3  *
4  * Copyright (c) 2022, 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
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but 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_SBE_H
21 #define PPC_PNV_SBE_H
22 
23 #include "exec/memory.h"
24 #include "hw/qdev-core.h"
25 
26 #define TYPE_PNV_SBE "pnv-sbe"
27 OBJECT_DECLARE_TYPE(PnvSBE, PnvSBEClass, PNV_SBE)
28 #define TYPE_PNV9_SBE TYPE_PNV_SBE "-POWER9"
29 DECLARE_INSTANCE_CHECKER(PnvSBE, PNV9_SBE, TYPE_PNV9_SBE)
30 #define TYPE_PNV10_SBE TYPE_PNV_SBE "-POWER10"
31 DECLARE_INSTANCE_CHECKER(PnvSBE, PNV10_SBE, TYPE_PNV10_SBE)
32 
33 struct PnvSBE {
34     DeviceState xd;
35 
36     uint64_t mbox[8];
37     uint64_t sbe_doorbell;
38     uint64_t host_doorbell;
39 
40     qemu_irq psi_irq;
41     QEMUTimer *timer;
42 
43     MemoryRegion xscom_mbox_regs;
44     MemoryRegion xscom_ctrl_regs;
45 };
46 
47 struct PnvSBEClass {
48     DeviceClass parent_class;
49 
50     int xscom_ctrl_size;
51     int xscom_mbox_size;
52     const MemoryRegionOps *xscom_ctrl_ops;
53     const MemoryRegionOps *xscom_mbox_ops;
54 };
55 
56 #endif /* PPC_PNV_SBE_H */
57