xref: /openbmc/qemu/include/hw/ppc/pnv_xscom.h (revision 6598a70d)
1967b7523SCédric Le Goater /*
2967b7523SCédric Le Goater  * QEMU PowerPC PowerNV XSCOM bus definitions
3967b7523SCédric Le Goater  *
4967b7523SCédric Le Goater  * Copyright (c) 2016, IBM Corporation.
5967b7523SCédric Le Goater  *
6967b7523SCédric Le Goater  * This library is free software; you can redistribute it and/or
7967b7523SCédric Le Goater  * modify it under the terms of the GNU Lesser General Public
8967b7523SCédric Le Goater  * License as published by the Free Software Foundation; either
9967b7523SCédric Le Goater  * version 2 of the License, or (at your option) any later version.
10967b7523SCédric Le Goater  *
11967b7523SCédric Le Goater  * This library is distributed in the hope that it will be useful,
12967b7523SCédric Le Goater  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13967b7523SCédric Le Goater  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14967b7523SCédric Le Goater  * Lesser General Public License for more details.
15967b7523SCédric Le Goater  *
16967b7523SCédric Le Goater  * You should have received a copy of the GNU Lesser General Public
17967b7523SCédric Le Goater  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18967b7523SCédric Le Goater  */
19967b7523SCédric Le Goater #ifndef _PPC_PNV_XSCOM_H
20967b7523SCédric Le Goater #define _PPC_PNV_XSCOM_H
21967b7523SCédric Le Goater 
22967b7523SCédric Le Goater #include "qom/object.h"
23967b7523SCédric Le Goater 
24967b7523SCédric Le Goater typedef struct PnvXScomInterface {
25967b7523SCédric Le Goater     Object parent;
26967b7523SCédric Le Goater } PnvXScomInterface;
27967b7523SCédric Le Goater 
28967b7523SCédric Le Goater #define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface"
29967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE(obj) \
30967b7523SCédric Le Goater      OBJECT_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE)
31967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE_CLASS(klass)                \
32967b7523SCédric Le Goater     OBJECT_CLASS_CHECK(PnvXScomInterfaceClass, (klass), \
33967b7523SCédric Le Goater                        TYPE_PNV_XSCOM_INTERFACE)
34967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE_GET_CLASS(obj) \
35967b7523SCédric Le Goater      OBJECT_GET_CLASS(PnvXScomInterfaceClass, (obj), TYPE_PNV_XSCOM_INTERFACE)
36967b7523SCédric Le Goater 
37967b7523SCédric Le Goater typedef struct PnvXScomInterfaceClass {
38967b7523SCédric Le Goater     InterfaceClass parent;
39b168a138SCédric Le Goater     int (*dt_xscom)(PnvXScomInterface *dev, void *fdt, int offset);
40967b7523SCédric Le Goater } PnvXScomInterfaceClass;
41967b7523SCédric Le Goater 
4224ece072SCédric Le Goater /*
43ad521238SCédric Le Goater  * Layout of the XSCOM PCB addresses of EX core 1 (POWER 8)
4424ece072SCédric Le Goater  *
4524ece072SCédric Le Goater  *   GPIO        0x1100xxxx
4624ece072SCédric Le Goater  *   SCOM        0x1101xxxx
4724ece072SCédric Le Goater  *   OHA         0x1102xxxx
4824ece072SCédric Le Goater  *   CLOCK CTL   0x1103xxxx
4924ece072SCédric Le Goater  *   FIR         0x1104xxxx
5024ece072SCédric Le Goater  *   THERM       0x1105xxxx
5124ece072SCédric Le Goater  *   <reserved>  0x1106xxxx
5224ece072SCédric Le Goater  *               ..
5324ece072SCédric Le Goater  *               0x110Exxxx
5424ece072SCédric Le Goater  *   PCB SLAVE   0x110Fxxxx
5524ece072SCédric Le Goater  */
5624ece072SCédric Le Goater 
57c035851aSCédric Le Goater #define PNV_XSCOM_EX_CORE_BASE    0x10000000ull
58c035851aSCédric Le Goater 
59c035851aSCédric Le Goater #define PNV_XSCOM_EX_BASE(core) \
60c035851aSCédric Le Goater     (PNV_XSCOM_EX_CORE_BASE | ((uint64_t)(core) << 24))
61c035851aSCédric Le Goater #define PNV_XSCOM_EX_SIZE         0x100000
62c035851aSCédric Le Goater 
63c035851aSCédric Le Goater #define PNV_XSCOM_P9_EC_BASE(core) \
64c035851aSCédric Le Goater     ((uint64_t)(((core) & 0x1F) + 0x20) << 24)
65c035851aSCédric Le Goater #define PNV_XSCOM_P9_EC_SIZE      0x100000
6624ece072SCédric Le Goater 
67a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_BASE        0xb0020
68a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_SIZE        0x4
69a3980bf5SBenjamin Herrenschmidt 
7054f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_BASE      0x2010900
7154f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_SIZE      0x20
7254f59d78SCédric Le Goater 
730722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_BASE        0x0066000
740722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_SIZE        0x6000
750722d05aSBenjamin Herrenschmidt 
76*6598a70dSCédric Le Goater #define PNV9_XSCOM_OCC_BASE       PNV_XSCOM_OCC_BASE
77*6598a70dSCédric Le Goater #define PNV9_XSCOM_OCC_SIZE       0x8000
78*6598a70dSCédric Le Goater 
79c38536bcSCédric Le Goater #define PNV9_XSCOM_PSIHB_BASE     0x5012900
80c38536bcSCédric Le Goater #define PNV9_XSCOM_PSIHB_SIZE     0x100
81c38536bcSCédric Le Goater 
822dfa91a2SCédric Le Goater #define PNV9_XSCOM_XIVE_BASE      0x5013000
832dfa91a2SCédric Le Goater #define PNV9_XSCOM_XIVE_SIZE      0x300
842dfa91a2SCédric Le Goater 
85967b7523SCédric Le Goater extern void pnv_xscom_realize(PnvChip *chip, Error **errp);
86b168a138SCédric Le Goater extern int pnv_dt_xscom(PnvChip *chip, void *fdt, int offset);
87967b7523SCédric Le Goater 
88967b7523SCédric Le Goater extern void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset,
89967b7523SCédric Le Goater                                     MemoryRegion *mr);
90967b7523SCédric Le Goater extern void pnv_xscom_region_init(MemoryRegion *mr,
91967b7523SCédric Le Goater                                   struct Object *owner,
92967b7523SCédric Le Goater                                   const MemoryRegionOps *ops,
93967b7523SCédric Le Goater                                   void *opaque,
94967b7523SCédric Le Goater                                   const char *name,
95967b7523SCédric Le Goater                                   uint64_t size);
96967b7523SCédric Le Goater 
97967b7523SCédric Le Goater #endif /* _PPC_PNV_XSCOM_H */
98