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" 2654f59d78SCédric Le Goater 2754f59d78SCédric Le Goater #define TYPE_PNV_PSI "pnv-psi" 2854f59d78SCédric Le Goater #define PNV_PSI(obj) \ 2954f59d78SCédric Le Goater OBJECT_CHECK(PnvPsi, (obj), TYPE_PNV_PSI) 3054f59d78SCédric Le Goater 3154f59d78SCédric Le Goater #define PSIHB_XSCOM_MAX 0x20 3254f59d78SCédric Le Goater 3354f59d78SCédric Le Goater typedef struct PnvPsi { 34*2f35254aSMarkus Armbruster DeviceState parent; 3554f59d78SCédric Le Goater 3654f59d78SCédric Le Goater MemoryRegion regs_mr; 3754f59d78SCédric Le Goater uint64_t bar; 3854f59d78SCédric Le Goater 3954f59d78SCédric Le Goater /* FSP region not supported */ 4054f59d78SCédric Le Goater /* MemoryRegion fsp_mr; */ 4154f59d78SCédric Le Goater uint64_t fsp_bar; 4254f59d78SCédric Le Goater 4354f59d78SCédric Le Goater /* Interrupt generation */ 44f8df9003SCédric Le Goater qemu_irq *qirqs; 4554f59d78SCédric Le Goater 4654f59d78SCédric Le Goater /* Registers */ 4754f59d78SCédric Le Goater uint64_t regs[PSIHB_XSCOM_MAX]; 4854f59d78SCédric Le Goater 4954f59d78SCédric Le Goater MemoryRegion xscom_regs; 5054f59d78SCédric Le Goater } PnvPsi; 5154f59d78SCédric Le Goater 52ae856055SCédric Le Goater #define TYPE_PNV8_PSI TYPE_PNV_PSI "-POWER8" 53ae856055SCédric Le Goater #define PNV8_PSI(obj) \ 54ae856055SCédric Le Goater OBJECT_CHECK(Pnv8Psi, (obj), TYPE_PNV8_PSI) 55ae856055SCédric Le Goater 56ae856055SCédric Le Goater typedef struct Pnv8Psi { 57ae856055SCédric Le Goater PnvPsi parent; 58ae856055SCédric Le Goater 59ae856055SCédric Le Goater ICSState ics; 60ae856055SCédric Le Goater } Pnv8Psi; 61ae856055SCédric Le Goater 62c38536bcSCédric Le Goater #define TYPE_PNV9_PSI TYPE_PNV_PSI "-POWER9" 63c38536bcSCédric Le Goater #define PNV9_PSI(obj) \ 64c38536bcSCédric Le Goater OBJECT_CHECK(Pnv9Psi, (obj), TYPE_PNV9_PSI) 65c38536bcSCédric Le Goater 66c38536bcSCédric Le Goater typedef struct Pnv9Psi { 67c38536bcSCédric Le Goater PnvPsi parent; 68c38536bcSCédric Le Goater 69c38536bcSCédric Le Goater XiveSource source; 70c38536bcSCédric Le Goater } Pnv9Psi; 71c38536bcSCédric Le Goater 728b50ce85SCédric Le Goater #define TYPE_PNV10_PSI TYPE_PNV_PSI "-POWER10" 738b50ce85SCédric Le Goater 74ae856055SCédric Le Goater #define PNV_PSI_CLASS(klass) \ 75ae856055SCédric Le Goater OBJECT_CLASS_CHECK(PnvPsiClass, (klass), TYPE_PNV_PSI) 76ae856055SCédric Le Goater #define PNV_PSI_GET_CLASS(obj) \ 77ae856055SCédric Le Goater OBJECT_GET_CLASS(PnvPsiClass, (obj), TYPE_PNV_PSI) 78ae856055SCédric Le Goater 79ae856055SCédric Le Goater typedef struct PnvPsiClass { 80ae856055SCédric Le Goater SysBusDeviceClass parent_class; 81ae856055SCédric Le Goater 82ae856055SCédric Le Goater uint32_t xscom_pcba; 83ae856055SCédric Le Goater uint32_t xscom_size; 84ae856055SCédric Le Goater uint64_t bar_mask; 8541c4ef70SGreg Kurz const char *compat; 8641c4ef70SGreg Kurz int compat_size; 87ae856055SCédric Le Goater 88ae856055SCédric Le Goater void (*irq_set)(PnvPsi *psi, int, bool state); 89ae856055SCédric Le Goater } PnvPsiClass; 90ae856055SCédric Le Goater 9154f59d78SCédric Le Goater /* The PSI and FSP interrupts are muxed on the same IRQ number */ 9254f59d78SCédric Le Goater typedef enum PnvPsiIrq { 9354f59d78SCédric Le Goater PSIHB_IRQ_PSI, /* internal use only */ 9454f59d78SCédric Le Goater PSIHB_IRQ_FSP, /* internal use only */ 9554f59d78SCédric Le Goater PSIHB_IRQ_OCC, 9654f59d78SCédric Le Goater PSIHB_IRQ_FSI, 9754f59d78SCédric Le Goater PSIHB_IRQ_LPC_I2C, 9854f59d78SCédric Le Goater PSIHB_IRQ_LOCAL_ERR, 9954f59d78SCédric Le Goater PSIHB_IRQ_EXTERNAL, 10054f59d78SCédric Le Goater } PnvPsiIrq; 10154f59d78SCédric Le Goater 10254f59d78SCédric Le Goater #define PSI_NUM_INTERRUPTS 6 10354f59d78SCédric Le Goater 104ae856055SCédric Le Goater void pnv_psi_irq_set(PnvPsi *psi, int irq, bool state); 10554f59d78SCédric Le Goater 106c38536bcSCédric Le Goater /* P9 PSI Interrupts */ 107c38536bcSCédric Le Goater #define PSIHB9_IRQ_PSI 0 108c38536bcSCédric Le Goater #define PSIHB9_IRQ_OCC 1 109c38536bcSCédric Le Goater #define PSIHB9_IRQ_FSI 2 110c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPCHC 3 111c38536bcSCédric Le Goater #define PSIHB9_IRQ_LOCAL_ERR 4 112c38536bcSCédric Le Goater #define PSIHB9_IRQ_GLOBAL_ERR 5 113c38536bcSCédric Le Goater #define PSIHB9_IRQ_TPM 6 114c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ0 7 115c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ1 8 116c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ2 9 117c38536bcSCédric Le Goater #define PSIHB9_IRQ_LPC_SIRQ3 10 118c38536bcSCédric Le Goater #define PSIHB9_IRQ_SBE_I2C 11 119c38536bcSCédric Le Goater #define PSIHB9_IRQ_DIO 12 120c38536bcSCédric Le Goater #define PSIHB9_IRQ_PSU 13 121c38536bcSCédric Le Goater #define PSIHB9_NUM_IRQS 14 122c38536bcSCédric Le Goater 123c38536bcSCédric Le Goater void pnv_psi_pic_print_info(Pnv9Psi *psi, Monitor *mon); 124c38536bcSCédric Le Goater 125a8b991b5SMarkus Armbruster #endif /* PPC_PNV_PSI_H */ 126