1*54f59d78SCédric Le Goater /* 2*54f59d78SCédric Le Goater * QEMU PowerPC PowerNV Processor Service Interface (PSI) model 3*54f59d78SCédric Le Goater * 4*54f59d78SCédric Le Goater * Copyright (c) 2015-2017, IBM Corporation. 5*54f59d78SCédric Le Goater * 6*54f59d78SCédric Le Goater * This library is free software; you can redistribute it and/or 7*54f59d78SCédric Le Goater * modify it under the terms of the GNU Lesser General Public 8*54f59d78SCédric Le Goater * License as published by the Free Software Foundation; either 9*54f59d78SCédric Le Goater * version 2 of the License, or (at your option) any later version. 10*54f59d78SCédric Le Goater * 11*54f59d78SCédric Le Goater * This library is distributed in the hope that it will be useful, 12*54f59d78SCédric Le Goater * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*54f59d78SCédric Le Goater * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14*54f59d78SCédric Le Goater * Lesser General Public License for more details. 15*54f59d78SCédric Le Goater * 16*54f59d78SCédric Le Goater * You should have received a copy of the GNU Lesser General Public 17*54f59d78SCédric Le Goater * License along with this library; if not, see <http://www.gnu.org/licenses/>. 18*54f59d78SCédric Le Goater */ 19*54f59d78SCédric Le Goater #ifndef _PPC_PNV_PSI_H 20*54f59d78SCédric Le Goater #define _PPC_PNV_PSI_H 21*54f59d78SCédric Le Goater 22*54f59d78SCédric Le Goater #include "hw/sysbus.h" 23*54f59d78SCédric Le Goater #include "hw/ppc/xics.h" 24*54f59d78SCédric Le Goater 25*54f59d78SCédric Le Goater #define TYPE_PNV_PSI "pnv-psi" 26*54f59d78SCédric Le Goater #define PNV_PSI(obj) \ 27*54f59d78SCédric Le Goater OBJECT_CHECK(PnvPsi, (obj), TYPE_PNV_PSI) 28*54f59d78SCédric Le Goater 29*54f59d78SCédric Le Goater #define PSIHB_XSCOM_MAX 0x20 30*54f59d78SCédric Le Goater 31*54f59d78SCédric Le Goater typedef struct XICSState XICSState; 32*54f59d78SCédric Le Goater 33*54f59d78SCédric Le Goater typedef struct PnvPsi { 34*54f59d78SCédric Le Goater SysBusDevice parent; 35*54f59d78SCédric Le Goater 36*54f59d78SCédric Le Goater MemoryRegion regs_mr; 37*54f59d78SCédric Le Goater uint64_t bar; 38*54f59d78SCédric Le Goater 39*54f59d78SCédric Le Goater /* FSP region not supported */ 40*54f59d78SCédric Le Goater /* MemoryRegion fsp_mr; */ 41*54f59d78SCédric Le Goater uint64_t fsp_bar; 42*54f59d78SCédric Le Goater 43*54f59d78SCédric Le Goater /* Interrupt generation */ 44*54f59d78SCédric Le Goater ICSState ics; 45*54f59d78SCédric Le Goater 46*54f59d78SCédric Le Goater /* Registers */ 47*54f59d78SCédric Le Goater uint64_t regs[PSIHB_XSCOM_MAX]; 48*54f59d78SCédric Le Goater 49*54f59d78SCédric Le Goater MemoryRegion xscom_regs; 50*54f59d78SCédric Le Goater } PnvPsi; 51*54f59d78SCédric Le Goater 52*54f59d78SCédric Le Goater /* The PSI and FSP interrupts are muxed on the same IRQ number */ 53*54f59d78SCédric Le Goater typedef enum PnvPsiIrq { 54*54f59d78SCédric Le Goater PSIHB_IRQ_PSI, /* internal use only */ 55*54f59d78SCédric Le Goater PSIHB_IRQ_FSP, /* internal use only */ 56*54f59d78SCédric Le Goater PSIHB_IRQ_OCC, 57*54f59d78SCédric Le Goater PSIHB_IRQ_FSI, 58*54f59d78SCédric Le Goater PSIHB_IRQ_LPC_I2C, 59*54f59d78SCédric Le Goater PSIHB_IRQ_LOCAL_ERR, 60*54f59d78SCédric Le Goater PSIHB_IRQ_EXTERNAL, 61*54f59d78SCédric Le Goater } PnvPsiIrq; 62*54f59d78SCédric Le Goater 63*54f59d78SCédric Le Goater #define PSI_NUM_INTERRUPTS 6 64*54f59d78SCédric Le Goater 65*54f59d78SCédric Le Goater extern void pnv_psi_irq_set(PnvPsi *psi, PnvPsiIrq irq, bool state); 66*54f59d78SCédric Le Goater 67*54f59d78SCédric Le Goater #endif /* _PPC_PNV_PSI_H */ 68