154f59d78SCédric Le Goater /* 254f59d78SCédric Le Goater * QEMU PowerPC PowerNV Processor Service Interface (PSI) model 354f59d78SCédric Le Goater * 454f59d78SCédric Le Goater * Copyright (c) 2015-2017, IBM Corporation. 554f59d78SCédric Le Goater * 654f59d78SCédric Le Goater * This library is free software; you can redistribute it and/or 754f59d78SCédric Le Goater * modify it under the terms of the GNU Lesser General Public 854f59d78SCédric Le Goater * License as published by the Free Software Foundation; either 954f59d78SCédric Le Goater * version 2 of the License, or (at your option) any later version. 1054f59d78SCédric Le Goater * 1154f59d78SCédric Le Goater * This library is distributed in the hope that it will be useful, 1254f59d78SCédric Le Goater * but WITHOUT ANY WARRANTY; without even the implied warranty of 1354f59d78SCédric Le Goater * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1454f59d78SCédric Le Goater * Lesser General Public License for more details. 1554f59d78SCédric Le Goater * 1654f59d78SCédric Le Goater * You should have received a copy of the GNU Lesser General Public 1754f59d78SCédric Le Goater * License along with this library; if not, see <http://www.gnu.org/licenses/>. 1854f59d78SCédric Le Goater */ 19a8b991b5SMarkus Armbruster 20a8b991b5SMarkus Armbruster #ifndef PPC_PNV_PSI_H 21a8b991b5SMarkus Armbruster #define PPC_PNV_PSI_H 2254f59d78SCédric Le Goater 2354f59d78SCédric Le Goater #include "hw/sysbus.h" 2454f59d78SCédric Le Goater #include "hw/ppc/xics.h" 25c38536bcSCédric Le Goater #include "hw/ppc/xive.h" 26db1015e9SEduardo Habkost #include "qom/object.h" 2754f59d78SCédric Le Goater 2854f59d78SCédric Le Goater #define TYPE_PNV_PSI "pnv-psi" 29c821774aSEduardo Habkost OBJECT_DECLARE_TYPE(PnvPsi, PnvPsiClass, 3030b5707cSEduardo Habkost PNV_PSI) 3154f59d78SCédric Le Goater 3254f59d78SCédric Le Goater #define PSIHB_XSCOM_MAX 0x20 3354f59d78SCédric Le Goater 34db1015e9SEduardo Habkost struct PnvPsi { 352f35254aSMarkus Armbruster DeviceState parent; 3654f59d78SCédric Le Goater 3754f59d78SCédric Le Goater MemoryRegion regs_mr; 3854f59d78SCédric Le Goater uint64_t bar; 3954f59d78SCédric Le Goater 4054f59d78SCédric Le Goater /* FSP region not supported */ 4154f59d78SCédric Le Goater /* MemoryRegion fsp_mr; */ 4254f59d78SCédric Le Goater uint64_t fsp_bar; 4354f59d78SCédric Le Goater 4454f59d78SCédric Le Goater /* Interrupt generation */ 45f8df9003SCédric Le Goater qemu_irq *qirqs; 4654f59d78SCédric Le Goater 4754f59d78SCédric Le Goater /* Registers */ 4854f59d78SCédric Le Goater uint64_t regs[PSIHB_XSCOM_MAX]; 4954f59d78SCédric Le Goater 5054f59d78SCédric Le Goater MemoryRegion xscom_regs; 51db1015e9SEduardo Habkost }; 5254f59d78SCédric Le Goater 53ae856055SCédric Le Goater #define TYPE_PNV8_PSI TYPE_PNV_PSI "-POWER8" 54*8063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(Pnv8Psi, PNV8_PSI) 55ae856055SCédric Le Goater 56db1015e9SEduardo Habkost struct Pnv8Psi { 57ae856055SCédric Le Goater PnvPsi parent; 58ae856055SCédric Le Goater 59ae856055SCédric Le Goater ICSState ics; 60db1015e9SEduardo Habkost }; 61ae856055SCédric Le Goater 62c38536bcSCédric Le Goater #define TYPE_PNV9_PSI TYPE_PNV_PSI "-POWER9" 63*8063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(Pnv9Psi, PNV9_PSI) 64c38536bcSCédric Le Goater 65db1015e9SEduardo Habkost struct Pnv9Psi { 66c38536bcSCédric Le Goater PnvPsi parent; 67c38536bcSCédric Le Goater 68c38536bcSCédric Le Goater XiveSource source; 69db1015e9SEduardo Habkost }; 70c38536bcSCédric Le Goater 718b50ce85SCédric Le Goater #define TYPE_PNV10_PSI TYPE_PNV_PSI "-POWER10" 728b50ce85SCédric Le Goater 73ae856055SCédric Le Goater 74db1015e9SEduardo Habkost struct PnvPsiClass { 75ae856055SCédric Le Goater SysBusDeviceClass parent_class; 76ae856055SCédric Le Goater 77ae856055SCédric Le Goater uint32_t xscom_pcba; 78ae856055SCédric Le Goater uint32_t xscom_size; 79ae856055SCédric Le Goater uint64_t bar_mask; 8041c4ef70SGreg Kurz const char *compat; 8141c4ef70SGreg Kurz int compat_size; 82ae856055SCédric Le Goater 83ae856055SCédric Le Goater void (*irq_set)(PnvPsi *psi, int, bool state); 84db1015e9SEduardo Habkost }; 85ae856055SCédric Le Goater 8654f59d78SCédric Le Goater /* The PSI and FSP interrupts are muxed on the same IRQ number */ 8754f59d78SCédric Le Goater typedef enum PnvPsiIrq { 8854f59d78SCédric Le Goater PSIHB_IRQ_PSI, /* internal use only */ 8954f59d78SCédric Le Goater PSIHB_IRQ_FSP, /* internal use only */ 9054f59d78SCédric Le Goater PSIHB_IRQ_OCC, 9154f59d78SCédric Le Goater PSIHB_IRQ_FSI, 9254f59d78SCédric Le Goater PSIHB_IRQ_LPC_I2C, 9354f59d78SCédric Le Goater PSIHB_IRQ_LOCAL_ERR, 9454f59d78SCédric Le Goater PSIHB_IRQ_EXTERNAL, 9554f59d78SCédric Le Goater } PnvPsiIrq; 9654f59d78SCédric Le Goater 9754f59d78SCédric Le Goater #define PSI_NUM_INTERRUPTS 6 9854f59d78SCédric Le Goater 99ae856055SCédric Le Goater void pnv_psi_irq_set(PnvPsi *psi, int irq, bool state); 10054f59d78SCédric Le Goater 101c38536bcSCédric Le Goater /* P9 PSI Interrupts */ 102c38536bcSCédric Le Goater #define PSIHB9_IRQ_PSI 0 103c38536bcSCédric Le Goater #define PSIHB9_IRQ_OCC 1 104c38536bcSCédric Le Goater #define PSIHB9_IRQ_FSI 2 105c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPCHC 3 106c38536bcSCédric Le Goater #define PSIHB9_IRQ_LOCAL_ERR 4 107c38536bcSCédric Le Goater #define PSIHB9_IRQ_GLOBAL_ERR 5 108c38536bcSCédric Le Goater #define PSIHB9_IRQ_TPM 6 109c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ0 7 110c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ1 8 111c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ2 9 112c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ3 10 113c38536bcSCédric Le Goater #define PSIHB9_IRQ_SBE_I2C 11 114c38536bcSCédric Le Goater #define PSIHB9_IRQ_DIO 12 115c38536bcSCédric Le Goater #define PSIHB9_IRQ_PSU 13 116c38536bcSCédric Le Goater #define PSIHB9_NUM_IRQS 14 117c38536bcSCédric Le Goater 118c38536bcSCédric Le Goater void pnv_psi_pic_print_info(Pnv9Psi *psi, Monitor *mon); 119c38536bcSCédric Le Goater 120a8b991b5SMarkus Armbruster #endif /* PPC_PNV_PSI_H */ 121