xref: /openbmc/qemu/include/hw/ppc/pnv_sbe.h (revision 6c187695)
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 "qom/object.h"
24 
25 #define TYPE_PNV_SBE "pnv-sbe"
26 OBJECT_DECLARE_TYPE(PnvSBE, PnvSBEClass, PNV_SBE)
27 #define TYPE_PNV9_SBE TYPE_PNV_SBE "-POWER9"
28 DECLARE_INSTANCE_CHECKER(PnvSBE, PNV9_SBE, TYPE_PNV9_SBE)
29 #define TYPE_PNV10_SBE TYPE_PNV_SBE "-POWER10"
30 DECLARE_INSTANCE_CHECKER(PnvSBE, PNV10_SBE, TYPE_PNV10_SBE)
31 
32 struct PnvSBE {
33     DeviceState xd;
34 
35     uint64_t mbox[8];
36     uint64_t sbe_doorbell;
37     uint64_t host_doorbell;
38 
39     qemu_irq psi_irq;
40     QEMUTimer *timer;
41 
42     MemoryRegion xscom_mbox_regs;
43     MemoryRegion xscom_ctrl_regs;
44 };
45 
46 struct PnvSBEClass {
47     DeviceClass parent_class;
48 
49     int xscom_ctrl_size;
50     int xscom_mbox_size;
51     const MemoryRegionOps *xscom_ctrl_ops;
52     const MemoryRegionOps *xscom_mbox_ops;
53 };
54 
55 #endif /* PPC_PNV_SBE_H */
56