xref: /qemu/include/hw/ppc/pnv_xscom.h (revision 24ece072504b8c8b03861168d601d174a7948099)
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 PnvChip PnvChip;
25967b7523SCédric Le Goater 
26967b7523SCédric Le Goater typedef struct PnvXScomInterface {
27967b7523SCédric Le Goater     Object parent;
28967b7523SCédric Le Goater } PnvXScomInterface;
29967b7523SCédric Le Goater 
30967b7523SCédric Le Goater #define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface"
31967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE(obj) \
32967b7523SCédric Le Goater      OBJECT_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE)
33967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE_CLASS(klass)                \
34967b7523SCédric Le Goater     OBJECT_CLASS_CHECK(PnvXScomInterfaceClass, (klass), \
35967b7523SCédric Le Goater                        TYPE_PNV_XSCOM_INTERFACE)
36967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE_GET_CLASS(obj) \
37967b7523SCédric Le Goater      OBJECT_GET_CLASS(PnvXScomInterfaceClass, (obj), TYPE_PNV_XSCOM_INTERFACE)
38967b7523SCédric Le Goater 
39967b7523SCédric Le Goater typedef struct PnvXScomInterfaceClass {
40967b7523SCédric Le Goater     InterfaceClass parent;
41967b7523SCédric Le Goater     int (*populate)(PnvXScomInterface *dev, void *fdt, int offset);
42967b7523SCédric Le Goater } PnvXScomInterfaceClass;
43967b7523SCédric Le Goater 
44*24ece072SCédric Le Goater /*
45*24ece072SCédric Le Goater  * Layout of the XSCOM PCB addresses of EX core 1
46*24ece072SCédric Le Goater  *
47*24ece072SCédric Le Goater  *   GPIO        0x1100xxxx
48*24ece072SCédric Le Goater  *   SCOM        0x1101xxxx
49*24ece072SCédric Le Goater  *   OHA         0x1102xxxx
50*24ece072SCédric Le Goater  *   CLOCK CTL   0x1103xxxx
51*24ece072SCédric Le Goater  *   FIR         0x1104xxxx
52*24ece072SCédric Le Goater  *   THERM       0x1105xxxx
53*24ece072SCédric Le Goater  *   <reserved>  0x1106xxxx
54*24ece072SCédric Le Goater  *               ..
55*24ece072SCédric Le Goater  *               0x110Exxxx
56*24ece072SCédric Le Goater  *   PCB SLAVE   0x110Fxxxx
57*24ece072SCédric Le Goater  */
58*24ece072SCédric Le Goater 
59*24ece072SCédric Le Goater #define PNV_XSCOM_EX_BASE         0x10000000
60*24ece072SCédric Le Goater #define PNV_XSCOM_EX_CORE_BASE(i) (PNV_XSCOM_EX_BASE | (((uint64_t)i) << 24))
61*24ece072SCédric Le Goater #define PNV_XSCOM_EX_CORE_SIZE    0x100000
62*24ece072SCédric Le Goater 
63967b7523SCédric Le Goater extern void pnv_xscom_realize(PnvChip *chip, Error **errp);
64967b7523SCédric Le Goater extern int pnv_xscom_populate(PnvChip *chip, void *fdt, int offset);
65967b7523SCédric Le Goater 
66967b7523SCédric Le Goater extern void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset,
67967b7523SCédric Le Goater                                     MemoryRegion *mr);
68967b7523SCédric Le Goater extern void pnv_xscom_region_init(MemoryRegion *mr,
69967b7523SCédric Le Goater                                   struct Object *owner,
70967b7523SCédric Le Goater                                   const MemoryRegionOps *ops,
71967b7523SCédric Le Goater                                   void *opaque,
72967b7523SCédric Le Goater                                   const char *name,
73967b7523SCédric Le Goater                                   uint64_t size);
74967b7523SCédric Le Goater 
75967b7523SCédric Le Goater #endif /* _PPC_PNV_XSCOM_H */
76