154f59d78SCédric Le Goater /* 254f59d78SCédric Le Goater * QEMU PowerPC PowerNV Processor Service Interface (PSI) model 354f59d78SCédric Le Goater * 458858759SCédric Le Goater * Copyright (c) 2015-2022, 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 9f70c5966SChetan Pant * version 2.1 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" 267a5951f6SMarkus Armbruster #include "hw/qdev-core.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" 548063396bSEduardo 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" 638063396bSEduardo 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; 82db1015e9SEduardo Habkost }; 83ae856055SCédric Le Goater 8454f59d78SCédric Le Goater /* The PSI and FSP interrupts are muxed on the same IRQ number */ 8554f59d78SCédric Le Goater typedef enum PnvPsiIrq { 8654f59d78SCédric Le Goater PSIHB_IRQ_FSP, /* internal use only */ 8754f59d78SCédric Le Goater PSIHB_IRQ_OCC, 8854f59d78SCédric Le Goater PSIHB_IRQ_FSI, 8954f59d78SCédric Le Goater PSIHB_IRQ_LPC_I2C, 9054f59d78SCédric Le Goater PSIHB_IRQ_LOCAL_ERR, 9154f59d78SCédric Le Goater PSIHB_IRQ_EXTERNAL, 9254f59d78SCédric Le Goater } PnvPsiIrq; 9354f59d78SCédric Le Goater 9454f59d78SCédric Le Goater #define PSI_NUM_INTERRUPTS 6 9554f59d78SCédric Le Goater 96c38536bcSCédric Le Goater /* P9 PSI Interrupts */ 97c38536bcSCédric Le Goater #define PSIHB9_IRQ_PSI 0 98c38536bcSCédric Le Goater #define PSIHB9_IRQ_OCC 1 99c38536bcSCédric Le Goater #define PSIHB9_IRQ_FSI 2 100c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPCHC 3 101c38536bcSCédric Le Goater #define PSIHB9_IRQ_LOCAL_ERR 4 102c38536bcSCédric Le Goater #define PSIHB9_IRQ_GLOBAL_ERR 5 103c38536bcSCédric Le Goater #define PSIHB9_IRQ_TPM 6 104c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ0 7 105c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ1 8 106c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ2 9 107c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ3 10 108c38536bcSCédric Le Goater #define PSIHB9_IRQ_SBE_I2C 11 109c38536bcSCédric Le Goater #define PSIHB9_IRQ_DIO 12 110c38536bcSCédric Le Goater #define PSIHB9_IRQ_PSU 13 111c38536bcSCédric Le Goater #define PSIHB9_NUM_IRQS 14 112c38536bcSCédric Le Goater 113*d88f39dbSPhilippe Mathieu-Daudé void pnv_psi_pic_print_info(Pnv9Psi *psi, GString *buf); 114c38536bcSCédric Le Goater 115a8b991b5SMarkus Armbruster #endif /* PPC_PNV_PSI_H */ 116