xref: /qemu/include/hw/ppc/pnv_lpc.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
1a3980bf5SBenjamin Herrenschmidt /*
2a3980bf5SBenjamin Herrenschmidt  * QEMU PowerPC PowerNV LPC controller
3a3980bf5SBenjamin Herrenschmidt  *
4a3980bf5SBenjamin Herrenschmidt  * Copyright (c) 2016, IBM Corporation.
5a3980bf5SBenjamin Herrenschmidt  *
6a3980bf5SBenjamin Herrenschmidt  * This library is free software; you can redistribute it and/or
7a3980bf5SBenjamin Herrenschmidt  * modify it under the terms of the GNU Lesser General Public
8a3980bf5SBenjamin Herrenschmidt  * License as published by the Free Software Foundation; either
9a3980bf5SBenjamin Herrenschmidt  * version 2 of the License, or (at your option) any later version.
10a3980bf5SBenjamin Herrenschmidt  *
11a3980bf5SBenjamin Herrenschmidt  * This library is distributed in the hope that it will be useful,
12a3980bf5SBenjamin Herrenschmidt  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13a3980bf5SBenjamin Herrenschmidt  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14a3980bf5SBenjamin Herrenschmidt  * Lesser General Public License for more details.
15a3980bf5SBenjamin Herrenschmidt  *
16a3980bf5SBenjamin Herrenschmidt  * You should have received a copy of the GNU Lesser General Public
17a3980bf5SBenjamin Herrenschmidt  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18a3980bf5SBenjamin Herrenschmidt  */
19a8b991b5SMarkus Armbruster 
20a8b991b5SMarkus Armbruster #ifndef PPC_PNV_LPC_H
21a8b991b5SMarkus Armbruster #define PPC_PNV_LPC_H
22a3980bf5SBenjamin Herrenschmidt 
23eaf87a39SDavid Gibson #include "hw/ppc/pnv_psi.h"
24*db1015e9SEduardo Habkost #include "qom/object.h"
25eaf87a39SDavid Gibson 
26a3980bf5SBenjamin Herrenschmidt #define TYPE_PNV_LPC "pnv-lpc"
27*db1015e9SEduardo Habkost typedef struct PnvLpcClass PnvLpcClass;
28*db1015e9SEduardo Habkost typedef struct PnvLpcController PnvLpcController;
29a3980bf5SBenjamin Herrenschmidt #define PNV_LPC(obj) \
30a3980bf5SBenjamin Herrenschmidt      OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV_LPC)
3182514be2SCédric Le Goater #define TYPE_PNV8_LPC TYPE_PNV_LPC "-POWER8"
3282514be2SCédric Le Goater #define PNV8_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV8_LPC)
33a3980bf5SBenjamin Herrenschmidt 
3415376c66SCédric Le Goater #define TYPE_PNV9_LPC TYPE_PNV_LPC "-POWER9"
3515376c66SCédric Le Goater #define PNV9_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV9_LPC)
3615376c66SCédric Le Goater 
372661f6abSCédric Le Goater #define TYPE_PNV10_LPC TYPE_PNV_LPC "-POWER10"
382661f6abSCédric Le Goater #define PNV10_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV10_LPC)
392661f6abSCédric Le Goater 
40*db1015e9SEduardo Habkost struct PnvLpcController {
41a3980bf5SBenjamin Herrenschmidt     DeviceState parent;
42a3980bf5SBenjamin Herrenschmidt 
43a3980bf5SBenjamin Herrenschmidt     uint64_t eccb_stat_reg;
44a3980bf5SBenjamin Herrenschmidt     uint32_t eccb_data_reg;
45a3980bf5SBenjamin Herrenschmidt 
46a3980bf5SBenjamin Herrenschmidt     /* OPB bus */
47a3980bf5SBenjamin Herrenschmidt     MemoryRegion opb_mr;
48a3980bf5SBenjamin Herrenschmidt     AddressSpace opb_as;
49a3980bf5SBenjamin Herrenschmidt 
50a3980bf5SBenjamin Herrenschmidt     /* ISA IO and Memory space */
51a3980bf5SBenjamin Herrenschmidt     MemoryRegion isa_io;
52a3980bf5SBenjamin Herrenschmidt     MemoryRegion isa_mem;
53d61c2857SCédric Le Goater     MemoryRegion isa_fw;
54a3980bf5SBenjamin Herrenschmidt 
55a3980bf5SBenjamin Herrenschmidt     /* Windows from OPB to ISA (aliases) */
56a3980bf5SBenjamin Herrenschmidt     MemoryRegion opb_isa_io;
57a3980bf5SBenjamin Herrenschmidt     MemoryRegion opb_isa_mem;
58a3980bf5SBenjamin Herrenschmidt     MemoryRegion opb_isa_fw;
59a3980bf5SBenjamin Herrenschmidt 
60a3980bf5SBenjamin Herrenschmidt     /* Registers */
61a3980bf5SBenjamin Herrenschmidt     MemoryRegion lpc_hc_regs;
62a3980bf5SBenjamin Herrenschmidt     MemoryRegion opb_master_regs;
63a3980bf5SBenjamin Herrenschmidt 
64a3980bf5SBenjamin Herrenschmidt     /* OPB Master LS registers */
658207b906SCédric Le Goater     uint32_t opb_irq_route0;
668207b906SCédric Le Goater     uint32_t opb_irq_route1;
67a3980bf5SBenjamin Herrenschmidt     uint32_t opb_irq_stat;
68a3980bf5SBenjamin Herrenschmidt     uint32_t opb_irq_mask;
69a3980bf5SBenjamin Herrenschmidt     uint32_t opb_irq_pol;
70a3980bf5SBenjamin Herrenschmidt     uint32_t opb_irq_input;
71a3980bf5SBenjamin Herrenschmidt 
72a3980bf5SBenjamin Herrenschmidt     /* LPC HC registers */
73a3980bf5SBenjamin Herrenschmidt     uint32_t lpc_hc_fw_seg_idsel;
74a3980bf5SBenjamin Herrenschmidt     uint32_t lpc_hc_fw_rd_acc_size;
75a3980bf5SBenjamin Herrenschmidt     uint32_t lpc_hc_irqser_ctrl;
76a3980bf5SBenjamin Herrenschmidt     uint32_t lpc_hc_irqmask;
77a3980bf5SBenjamin Herrenschmidt     uint32_t lpc_hc_irqstat;
78a3980bf5SBenjamin Herrenschmidt     uint32_t lpc_hc_error_addr;
79a3980bf5SBenjamin Herrenschmidt 
80a3980bf5SBenjamin Herrenschmidt     /* XSCOM registers */
81a3980bf5SBenjamin Herrenschmidt     MemoryRegion xscom_regs;
824d1df88bSBenjamin Herrenschmidt 
834d1df88bSBenjamin Herrenschmidt     /* PSI to generate interrupts */
844d1df88bSBenjamin Herrenschmidt     PnvPsi *psi;
85*db1015e9SEduardo Habkost };
86a3980bf5SBenjamin Herrenschmidt 
8782514be2SCédric Le Goater #define PNV_LPC_CLASS(klass) \
8882514be2SCédric Le Goater      OBJECT_CLASS_CHECK(PnvLpcClass, (klass), TYPE_PNV_LPC)
8982514be2SCédric Le Goater #define PNV_LPC_GET_CLASS(obj) \
9082514be2SCédric Le Goater      OBJECT_GET_CLASS(PnvLpcClass, (obj), TYPE_PNV_LPC)
9182514be2SCédric Le Goater 
92*db1015e9SEduardo Habkost struct PnvLpcClass {
9382514be2SCédric Le Goater     DeviceClass parent_class;
9482514be2SCédric Le Goater 
9582514be2SCédric Le Goater     int psi_irq;
9682514be2SCédric Le Goater 
9782514be2SCédric Le Goater     DeviceRealize parent_realize;
98*db1015e9SEduardo Habkost };
9982514be2SCédric Le Goater 
10015376c66SCédric Le Goater /*
10115376c66SCédric Le Goater  * Old compilers error on typdef forward declarations. Keep them happy.
10215376c66SCédric Le Goater  */
10315376c66SCédric Le Goater struct PnvChip;
10415376c66SCédric Le Goater 
10504026890SCédric Le Goater ISABus *pnv_lpc_isa_create(PnvLpcController *lpc, bool use_cpld, Error **errp);
1062661f6abSCédric Le Goater int pnv_dt_lpc(struct PnvChip *chip, void *fdt, int root_offset,
1072661f6abSCédric Le Goater                uint64_t lpcm_addr, uint64_t lpcm_size);
1084d1df88bSBenjamin Herrenschmidt 
109a8b991b5SMarkus Armbruster #endif /* PPC_PNV_LPC_H */
110