ppc/pnv: add a LPC Controller model for POWER9
[qemu/ar7.git] / include / hw / ppc / pnv_lpc.h
blob242b18081caae2d75b079de6b8f17fda20ac2550
1 /*
2 * QEMU PowerPC PowerNV LPC controller
4 * Copyright (c) 2016, IBM Corporation.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #ifndef _PPC_PNV_LPC_H
20 #define _PPC_PNV_LPC_H
22 #include "hw/ppc/pnv_psi.h"
24 #define TYPE_PNV_LPC "pnv-lpc"
25 #define PNV_LPC(obj) \
26 OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV_LPC)
27 #define TYPE_PNV8_LPC TYPE_PNV_LPC "-POWER8"
28 #define PNV8_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV8_LPC)
30 #define TYPE_PNV9_LPC TYPE_PNV_LPC "-POWER9"
31 #define PNV9_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV9_LPC)
33 typedef struct PnvLpcController {
34 DeviceState parent;
36 uint64_t eccb_stat_reg;
37 uint32_t eccb_data_reg;
39 /* OPB bus */
40 MemoryRegion opb_mr;
41 AddressSpace opb_as;
43 /* ISA IO and Memory space */
44 MemoryRegion isa_io;
45 MemoryRegion isa_mem;
46 MemoryRegion isa_fw;
48 /* Windows from OPB to ISA (aliases) */
49 MemoryRegion opb_isa_io;
50 MemoryRegion opb_isa_mem;
51 MemoryRegion opb_isa_fw;
53 /* Registers */
54 MemoryRegion lpc_hc_regs;
55 MemoryRegion opb_master_regs;
57 /* OPB Master LS registers */
58 uint32_t opb_irq_stat;
59 uint32_t opb_irq_mask;
60 uint32_t opb_irq_pol;
61 uint32_t opb_irq_input;
63 /* LPC HC registers */
64 uint32_t lpc_hc_fw_seg_idsel;
65 uint32_t lpc_hc_fw_rd_acc_size;
66 uint32_t lpc_hc_irqser_ctrl;
67 uint32_t lpc_hc_irqmask;
68 uint32_t lpc_hc_irqstat;
69 uint32_t lpc_hc_error_addr;
71 /* XSCOM registers */
72 MemoryRegion xscom_regs;
74 /* PSI to generate interrupts */
75 PnvPsi *psi;
76 } PnvLpcController;
78 #define PNV_LPC_CLASS(klass) \
79 OBJECT_CLASS_CHECK(PnvLpcClass, (klass), TYPE_PNV_LPC)
80 #define PNV_LPC_GET_CLASS(obj) \
81 OBJECT_GET_CLASS(PnvLpcClass, (obj), TYPE_PNV_LPC)
83 typedef struct PnvLpcClass {
84 DeviceClass parent_class;
86 int psi_irq;
88 DeviceRealize parent_realize;
89 } PnvLpcClass;
92 * Old compilers error on typdef forward declarations. Keep them happy.
94 struct PnvChip;
96 ISABus *pnv_lpc_isa_create(PnvLpcController *lpc, bool use_cpld, Error **errp);
97 int pnv_dt_lpc(struct PnvChip *chip, void *fdt, int root_offset);
99 #endif /* _PPC_PNV_LPC_H */