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 */ 19a8b991b5SMarkus Armbruster 20a8b991b5SMarkus Armbruster #ifndef PPC_PNV_XSCOM_H 21a8b991b5SMarkus Armbruster #define PPC_PNV_XSCOM_H 22967b7523SCédric Le Goater 23967b7523SCédric Le Goater #include "qom/object.h" 24967b7523SCédric Le Goater 2590cce00cSGreg Kurz typedef struct PnvXScomInterface PnvXScomInterface; 26967b7523SCédric Le Goater 27967b7523SCédric Le Goater #define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface" 28967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE(obj) \ 2990cce00cSGreg Kurz INTERFACE_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE) 30967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE_CLASS(klass) \ 31967b7523SCédric Le Goater OBJECT_CLASS_CHECK(PnvXScomInterfaceClass, (klass), \ 32967b7523SCédric Le Goater TYPE_PNV_XSCOM_INTERFACE) 33967b7523SCédric Le Goater #define PNV_XSCOM_INTERFACE_GET_CLASS(obj) \ 34967b7523SCédric Le Goater OBJECT_GET_CLASS(PnvXScomInterfaceClass, (obj), TYPE_PNV_XSCOM_INTERFACE) 35967b7523SCédric Le Goater 36967b7523SCédric Le Goater typedef struct PnvXScomInterfaceClass { 37967b7523SCédric Le Goater InterfaceClass parent; 38b168a138SCédric Le Goater int (*dt_xscom)(PnvXScomInterface *dev, void *fdt, int offset); 39967b7523SCédric Le Goater } PnvXScomInterfaceClass; 40967b7523SCédric Le Goater 4124ece072SCédric Le Goater /* 42ad521238SCédric Le Goater * Layout of the XSCOM PCB addresses of EX core 1 (POWER 8) 4324ece072SCédric Le Goater * 4424ece072SCédric Le Goater * GPIO 0x1100xxxx 4524ece072SCédric Le Goater * SCOM 0x1101xxxx 4624ece072SCédric Le Goater * OHA 0x1102xxxx 4724ece072SCédric Le Goater * CLOCK CTL 0x1103xxxx 4824ece072SCédric Le Goater * FIR 0x1104xxxx 4924ece072SCédric Le Goater * THERM 0x1105xxxx 5024ece072SCédric Le Goater * <reserved> 0x1106xxxx 5124ece072SCédric Le Goater * .. 5224ece072SCédric Le Goater * 0x110Exxxx 5324ece072SCédric Le Goater * PCB SLAVE 0x110Fxxxx 5424ece072SCédric Le Goater */ 5524ece072SCédric Le Goater 56c035851aSCédric Le Goater #define PNV_XSCOM_EX_CORE_BASE 0x10000000ull 57c035851aSCédric Le Goater 58c035851aSCédric Le Goater #define PNV_XSCOM_EX_BASE(core) \ 59c035851aSCédric Le Goater (PNV_XSCOM_EX_CORE_BASE | ((uint64_t)(core) << 24)) 60c035851aSCédric Le Goater #define PNV_XSCOM_EX_SIZE 0x100000 61c035851aSCédric Le Goater 62a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_BASE 0xb0020 63a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_SIZE 0x4 64a3980bf5SBenjamin Herrenschmidt 6554f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_BASE 0x2010900 6654f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_SIZE 0x20 6754f59d78SCédric Le Goater 680722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_BASE 0x0066000 690722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_SIZE 0x6000 700722d05aSBenjamin Herrenschmidt 718f092316SCédric Le Goater #define PNV_XSCOM_PBA_BASE 0x2013f00 728f092316SCédric Le Goater #define PNV_XSCOM_PBA_SIZE 0x40 738f092316SCédric Le Goater 74*9ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_NEST_BASE 0x2012000 75*9ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_NEST_SIZE 0x46 76*9ae1329eSCédric Le Goater 77*9ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_PCI_BASE 0x9012000 78*9ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_PCI_SIZE 0x15 79*9ae1329eSCédric Le Goater 80*9ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_SPCI_BASE 0x9013c00 81*9ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_SPCI_SIZE 0x5 82*9ae1329eSCédric Le Goater 832b548a42SCédric Le Goater /* 842b548a42SCédric Le Goater * Layout of the XSCOM PCB addresses (POWER 9) 852b548a42SCédric Le Goater */ 865dad902cSCédric Le Goater #define PNV9_XSCOM_EC_BASE(core) \ 875dad902cSCédric Le Goater ((uint64_t)(((core) & 0x1F) + 0x20) << 24) 885dad902cSCédric Le Goater #define PNV9_XSCOM_EC_SIZE 0x100000 895dad902cSCédric Le Goater 905dad902cSCédric Le Goater #define PNV9_XSCOM_EQ_BASE(core) \ 915dad902cSCédric Le Goater ((uint64_t)(((core) & 0x1C) + 0x40) << 22) 925dad902cSCédric Le Goater #define PNV9_XSCOM_EQ_SIZE 0x100000 935dad902cSCédric Le Goater 946598a70dSCédric Le Goater #define PNV9_XSCOM_OCC_BASE PNV_XSCOM_OCC_BASE 956598a70dSCédric Le Goater #define PNV9_XSCOM_OCC_SIZE 0x8000 966598a70dSCédric Le Goater 978f092316SCédric Le Goater #define PNV9_XSCOM_PBA_BASE 0x5012b00 988f092316SCédric Le Goater #define PNV9_XSCOM_PBA_SIZE 0x40 998f092316SCédric Le Goater 100c38536bcSCédric Le Goater #define PNV9_XSCOM_PSIHB_BASE 0x5012900 101c38536bcSCédric Le Goater #define PNV9_XSCOM_PSIHB_SIZE 0x100 102c38536bcSCédric Le Goater 1032dfa91a2SCédric Le Goater #define PNV9_XSCOM_XIVE_BASE 0x5013000 1042dfa91a2SCédric Le Goater #define PNV9_XSCOM_XIVE_SIZE 0x300 1052dfa91a2SCédric Le Goater 1064f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_NEST_BASE 0x4010c00 1074f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_NEST_SIZE 0x100 1084f9924c4SBenjamin Herrenschmidt 1094f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_BASE 0xd010800 1104f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_SIZE 0x200 1114f9924c4SBenjamin Herrenschmidt 1124f9924c4SBenjamin Herrenschmidt /* XSCOM PCI "pass-through" window to PHB SCOM */ 1134f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_STK0 0x100 1144f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_STK1 0x140 1154f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_STK2 0x180 1164f9924c4SBenjamin Herrenschmidt 1172b548a42SCédric Le Goater /* 1182b548a42SCédric Le Goater * Layout of the XSCOM PCB addresses (POWER 10) 1192b548a42SCédric Le Goater */ 1202b548a42SCédric Le Goater #define PNV10_XSCOM_EQ_CHIPLET(core) (0x20 + ((core) >> 2)) 1212b548a42SCédric Le Goater #define PNV10_XSCOM_EQ(chiplet) ((chiplet) << 24) 1222b548a42SCédric Le Goater #define PNV10_XSCOM_EC(proc) \ 1232b548a42SCédric Le Goater ((0x2 << 16) | ((1 << (3 - (proc))) << 12)) 1242b548a42SCédric Le Goater 1252b548a42SCédric Le Goater #define PNV10_XSCOM_EQ_BASE(core) \ 1262b548a42SCédric Le Goater ((uint64_t) PNV10_XSCOM_EQ(PNV10_XSCOM_EQ_CHIPLET(core))) 1272b548a42SCédric Le Goater #define PNV10_XSCOM_EQ_SIZE 0x100000 1282b548a42SCédric Le Goater 1292b548a42SCédric Le Goater #define PNV10_XSCOM_EC_BASE(core) \ 1302b548a42SCédric Le Goater ((uint64_t) PNV10_XSCOM_EQ_BASE(core) | PNV10_XSCOM_EC(core & 0x3)) 1312b548a42SCédric Le Goater #define PNV10_XSCOM_EC_SIZE 0x100000 1322b548a42SCédric Le Goater 1338b50ce85SCédric Le Goater #define PNV10_XSCOM_PSIHB_BASE 0x3011D00 1348b50ce85SCédric Le Goater #define PNV10_XSCOM_PSIHB_SIZE 0x100 1358b50ce85SCédric Le Goater 136aeb7a330SGreg Kurz void pnv_xscom_realize(PnvChip *chip, uint64_t size, Error **errp); 1373f5b45caSGreg Kurz int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset, 138c396c58aSGreg Kurz uint64_t xscom_base, uint64_t xscom_size, 139c396c58aSGreg Kurz const char *compat, int compat_size); 140967b7523SCédric Le Goater 141aeb7a330SGreg Kurz void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset, 142967b7523SCédric Le Goater MemoryRegion *mr); 143aeb7a330SGreg Kurz void pnv_xscom_region_init(MemoryRegion *mr, 144967b7523SCédric Le Goater struct Object *owner, 145967b7523SCédric Le Goater const MemoryRegionOps *ops, 146967b7523SCédric Le Goater void *opaque, 147967b7523SCédric Le Goater const char *name, 148967b7523SCédric Le Goater uint64_t size); 149967b7523SCédric Le Goater 150a8b991b5SMarkus Armbruster #endif /* PPC_PNV_XSCOM_H */ 151