2 * QEMU PowerPC PowerNV XSCOM bus definitions
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/>.
20 #ifndef PPC_PNV_XSCOM_H
21 #define PPC_PNV_XSCOM_H
23 #include "qom/object.h"
25 typedef struct PnvXScomInterface PnvXScomInterface
;
27 #define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface"
28 #define PNV_XSCOM_INTERFACE(obj) \
29 INTERFACE_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE)
30 #define PNV_XSCOM_INTERFACE_CLASS(klass) \
31 OBJECT_CLASS_CHECK(PnvXScomInterfaceClass, (klass), \
32 TYPE_PNV_XSCOM_INTERFACE)
33 #define PNV_XSCOM_INTERFACE_GET_CLASS(obj) \
34 OBJECT_GET_CLASS(PnvXScomInterfaceClass, (obj), TYPE_PNV_XSCOM_INTERFACE)
36 typedef struct PnvXScomInterfaceClass
{
37 InterfaceClass parent
;
38 int (*dt_xscom
)(PnvXScomInterface
*dev
, void *fdt
, int offset
);
39 } PnvXScomInterfaceClass
;
42 * Layout of the XSCOM PCB addresses of EX core 1 (POWER 8)
47 * CLOCK CTL 0x1103xxxx
50 * <reserved> 0x1106xxxx
53 * PCB SLAVE 0x110Fxxxx
56 #define PNV_XSCOM_EX_CORE_BASE 0x10000000ull
58 #define PNV_XSCOM_EX_BASE(core) \
59 (PNV_XSCOM_EX_CORE_BASE | ((uint64_t)(core) << 24))
60 #define PNV_XSCOM_EX_SIZE 0x100000
62 #define PNV_XSCOM_LPC_BASE 0xb0020
63 #define PNV_XSCOM_LPC_SIZE 0x4
65 #define PNV_XSCOM_PSIHB_BASE 0x2010900
66 #define PNV_XSCOM_PSIHB_SIZE 0x20
68 #define PNV_XSCOM_OCC_BASE 0x0066000
69 #define PNV_XSCOM_OCC_SIZE 0x6000
71 #define PNV_XSCOM_PBA_BASE 0x2013f00
72 #define PNV_XSCOM_PBA_SIZE 0x40
74 #define PNV_XSCOM_PBCQ_NEST_BASE 0x2012000
75 #define PNV_XSCOM_PBCQ_NEST_SIZE 0x46
77 #define PNV_XSCOM_PBCQ_PCI_BASE 0x9012000
78 #define PNV_XSCOM_PBCQ_PCI_SIZE 0x15
80 #define PNV_XSCOM_PBCQ_SPCI_BASE 0x9013c00
81 #define PNV_XSCOM_PBCQ_SPCI_SIZE 0x5
84 * Layout of the XSCOM PCB addresses (POWER 9)
86 #define PNV9_XSCOM_EC_BASE(core) \
87 ((uint64_t)(((core) & 0x1F) + 0x20) << 24)
88 #define PNV9_XSCOM_EC_SIZE 0x100000
90 #define PNV9_XSCOM_EQ_BASE(core) \
91 ((uint64_t)(((core) & 0x1C) + 0x40) << 22)
92 #define PNV9_XSCOM_EQ_SIZE 0x100000
94 #define PNV9_XSCOM_OCC_BASE PNV_XSCOM_OCC_BASE
95 #define PNV9_XSCOM_OCC_SIZE 0x8000
97 #define PNV9_XSCOM_PBA_BASE 0x5012b00
98 #define PNV9_XSCOM_PBA_SIZE 0x40
100 #define PNV9_XSCOM_PSIHB_BASE 0x5012900
101 #define PNV9_XSCOM_PSIHB_SIZE 0x100
103 #define PNV9_XSCOM_XIVE_BASE 0x5013000
104 #define PNV9_XSCOM_XIVE_SIZE 0x300
106 #define PNV9_XSCOM_PEC_NEST_BASE 0x4010c00
107 #define PNV9_XSCOM_PEC_NEST_SIZE 0x100
109 #define PNV9_XSCOM_PEC_PCI_BASE 0xd010800
110 #define PNV9_XSCOM_PEC_PCI_SIZE 0x200
112 /* XSCOM PCI "pass-through" window to PHB SCOM */
113 #define PNV9_XSCOM_PEC_PCI_STK0 0x100
114 #define PNV9_XSCOM_PEC_PCI_STK1 0x140
115 #define PNV9_XSCOM_PEC_PCI_STK2 0x180
118 * Layout of the XSCOM PCB addresses (POWER 10)
120 #define PNV10_XSCOM_EQ_CHIPLET(core) (0x20 + ((core) >> 2))
121 #define PNV10_XSCOM_EQ(chiplet) ((chiplet) << 24)
122 #define PNV10_XSCOM_EC(proc) \
123 ((0x2 << 16) | ((1 << (3 - (proc))) << 12))
125 #define PNV10_XSCOM_EQ_BASE(core) \
126 ((uint64_t) PNV10_XSCOM_EQ(PNV10_XSCOM_EQ_CHIPLET(core)))
127 #define PNV10_XSCOM_EQ_SIZE 0x100000
129 #define PNV10_XSCOM_EC_BASE(core) \
130 ((uint64_t) PNV10_XSCOM_EQ_BASE(core) | PNV10_XSCOM_EC(core & 0x3))
131 #define PNV10_XSCOM_EC_SIZE 0x100000
133 #define PNV10_XSCOM_PSIHB_BASE 0x3011D00
134 #define PNV10_XSCOM_PSIHB_SIZE 0x100
136 void pnv_xscom_realize(PnvChip
*chip
, uint64_t size
, Error
**errp
);
137 int pnv_dt_xscom(PnvChip
*chip
, void *fdt
, int root_offset
,
138 uint64_t xscom_base
, uint64_t xscom_size
,
139 const char *compat
, int compat_size
);
141 void pnv_xscom_add_subregion(PnvChip
*chip
, hwaddr offset
,
143 void pnv_xscom_region_init(MemoryRegion
*mr
,
144 struct Object
*owner
,
145 const MemoryRegionOps
*ops
,
150 #endif /* PPC_PNV_XSCOM_H */