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 */ 1954f59d78SCédric Le Goater #ifndef _PPC_PNV_PSI_H 2054f59d78SCédric Le Goater #define _PPC_PNV_PSI_H 2154f59d78SCédric Le Goater 2254f59d78SCédric Le Goater #include "hw/sysbus.h" 2354f59d78SCédric Le Goater #include "hw/ppc/xics.h" 2454f59d78SCédric Le Goater 2554f59d78SCédric Le Goater #define TYPE_PNV_PSI "pnv-psi" 2654f59d78SCédric Le Goater #define PNV_PSI(obj) \ 2754f59d78SCédric Le Goater OBJECT_CHECK(PnvPsi, (obj), TYPE_PNV_PSI) 2854f59d78SCédric Le Goater 2954f59d78SCédric Le Goater #define PSIHB_XSCOM_MAX 0x20 3054f59d78SCédric Le Goater 3154f59d78SCédric Le Goater typedef struct PnvPsi { 3254f59d78SCédric Le Goater SysBusDevice parent; 3354f59d78SCédric Le Goater 3454f59d78SCédric Le Goater MemoryRegion regs_mr; 3554f59d78SCédric Le Goater uint64_t bar; 3654f59d78SCédric Le Goater 3754f59d78SCédric Le Goater /* FSP region not supported */ 3854f59d78SCédric Le Goater /* MemoryRegion fsp_mr; */ 3954f59d78SCédric Le Goater uint64_t fsp_bar; 4054f59d78SCédric Le Goater 4154f59d78SCédric Le Goater /* Interrupt generation */ 42f8df9003SCédric Le Goater qemu_irq *qirqs; 4354f59d78SCédric Le Goater 4454f59d78SCédric Le Goater /* Registers */ 4554f59d78SCédric Le Goater uint64_t regs[PSIHB_XSCOM_MAX]; 4654f59d78SCédric Le Goater 4754f59d78SCédric Le Goater MemoryRegion xscom_regs; 4854f59d78SCédric Le Goater } PnvPsi; 4954f59d78SCédric Le Goater 50*ae856055SCédric Le Goater #define TYPE_PNV8_PSI TYPE_PNV_PSI "-POWER8" 51*ae856055SCédric Le Goater #define PNV8_PSI(obj) \ 52*ae856055SCédric Le Goater OBJECT_CHECK(Pnv8Psi, (obj), TYPE_PNV8_PSI) 53*ae856055SCédric Le Goater 54*ae856055SCédric Le Goater typedef struct Pnv8Psi { 55*ae856055SCédric Le Goater PnvPsi parent; 56*ae856055SCédric Le Goater 57*ae856055SCédric Le Goater ICSState ics; 58*ae856055SCédric Le Goater } Pnv8Psi; 59*ae856055SCédric Le Goater 60*ae856055SCédric Le Goater #define PNV_PSI_CLASS(klass) \ 61*ae856055SCédric Le Goater OBJECT_CLASS_CHECK(PnvPsiClass, (klass), TYPE_PNV_PSI) 62*ae856055SCédric Le Goater #define PNV_PSI_GET_CLASS(obj) \ 63*ae856055SCédric Le Goater OBJECT_GET_CLASS(PnvPsiClass, (obj), TYPE_PNV_PSI) 64*ae856055SCédric Le Goater 65*ae856055SCédric Le Goater typedef struct PnvPsiClass { 66*ae856055SCédric Le Goater SysBusDeviceClass parent_class; 67*ae856055SCédric Le Goater 68*ae856055SCédric Le Goater int chip_type; 69*ae856055SCédric Le Goater uint32_t xscom_pcba; 70*ae856055SCédric Le Goater uint32_t xscom_size; 71*ae856055SCédric Le Goater uint64_t bar_mask; 72*ae856055SCédric Le Goater 73*ae856055SCédric Le Goater void (*irq_set)(PnvPsi *psi, int, bool state); 74*ae856055SCédric Le Goater } PnvPsiClass; 75*ae856055SCédric Le Goater 7654f59d78SCédric Le Goater /* The PSI and FSP interrupts are muxed on the same IRQ number */ 7754f59d78SCédric Le Goater typedef enum PnvPsiIrq { 7854f59d78SCédric Le Goater PSIHB_IRQ_PSI, /* internal use only */ 7954f59d78SCédric Le Goater PSIHB_IRQ_FSP, /* internal use only */ 8054f59d78SCédric Le Goater PSIHB_IRQ_OCC, 8154f59d78SCédric Le Goater PSIHB_IRQ_FSI, 8254f59d78SCédric Le Goater PSIHB_IRQ_LPC_I2C, 8354f59d78SCédric Le Goater PSIHB_IRQ_LOCAL_ERR, 8454f59d78SCédric Le Goater PSIHB_IRQ_EXTERNAL, 8554f59d78SCédric Le Goater } PnvPsiIrq; 8654f59d78SCédric Le Goater 8754f59d78SCédric Le Goater #define PSI_NUM_INTERRUPTS 6 8854f59d78SCédric Le Goater 89*ae856055SCédric Le Goater void pnv_psi_irq_set(PnvPsi *psi, int irq, bool state); 9054f59d78SCédric Le Goater 9154f59d78SCédric Le Goater #endif /* _PPC_PNV_PSI_H */ 92