xref: /qemu/include/hw/ppc/pnv_psi.h (revision f8df900316666f55dd82b1576e57f7650db682a6)
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 */
4254f59d78SCédric Le Goater     ICSState ics;
43*f8df9003SCédric Le Goater     qemu_irq *qirqs;
4454f59d78SCédric Le Goater 
4554f59d78SCédric Le Goater     /* Registers */
4654f59d78SCédric Le Goater     uint64_t regs[PSIHB_XSCOM_MAX];
4754f59d78SCédric Le Goater 
4854f59d78SCédric Le Goater     MemoryRegion xscom_regs;
4954f59d78SCédric Le Goater } PnvPsi;
5054f59d78SCédric Le Goater 
5154f59d78SCédric Le Goater /* The PSI and FSP interrupts are muxed on the same IRQ number */
5254f59d78SCédric Le Goater typedef enum PnvPsiIrq {
5354f59d78SCédric Le Goater     PSIHB_IRQ_PSI, /* internal use only */
5454f59d78SCédric Le Goater     PSIHB_IRQ_FSP, /* internal use only */
5554f59d78SCédric Le Goater     PSIHB_IRQ_OCC,
5654f59d78SCédric Le Goater     PSIHB_IRQ_FSI,
5754f59d78SCédric Le Goater     PSIHB_IRQ_LPC_I2C,
5854f59d78SCédric Le Goater     PSIHB_IRQ_LOCAL_ERR,
5954f59d78SCédric Le Goater     PSIHB_IRQ_EXTERNAL,
6054f59d78SCédric Le Goater } PnvPsiIrq;
6154f59d78SCédric Le Goater 
6254f59d78SCédric Le Goater #define PSI_NUM_INTERRUPTS 6
6354f59d78SCédric Le Goater 
6454f59d78SCédric Le Goater extern void pnv_psi_irq_set(PnvPsi *psi, PnvPsiIrq irq, bool state);
6554f59d78SCédric Le Goater 
6654f59d78SCédric Le Goater #endif /* _PPC_PNV_PSI_H */
67