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 9f70c5966SChetan Pant * version 2.1 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 2314f11a20SMarkus Armbruster #include "exec/memory.h" 24967b7523SCédric Le Goater 2590cce00cSGreg Kurz typedef struct PnvXScomInterface PnvXScomInterface; 26117664a1SChalapathi V typedef struct PnvChip PnvChip; 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) \ 3090cce00cSGreg Kurz INTERFACE_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE) 31db1015e9SEduardo Habkost typedef struct PnvXScomInterfaceClass PnvXScomInterfaceClass; 328110fa1dSEduardo Habkost DECLARE_CLASS_CHECKERS(PnvXScomInterfaceClass, PNV_XSCOM_INTERFACE, 33967b7523SCédric Le Goater TYPE_PNV_XSCOM_INTERFACE) 34967b7523SCédric Le Goater 35db1015e9SEduardo Habkost struct PnvXScomInterfaceClass { 36967b7523SCédric Le Goater InterfaceClass parent; 37b168a138SCédric Le Goater int (*dt_xscom)(PnvXScomInterface *dev, void *fdt, int offset); 38db1015e9SEduardo Habkost }; 39967b7523SCédric Le Goater 4024ece072SCédric Le Goater /* 41ad521238SCédric Le Goater * Layout of the XSCOM PCB addresses of EX core 1 (POWER 8) 4224ece072SCédric Le Goater * 4324ece072SCédric Le Goater * GPIO 0x1100xxxx 4424ece072SCédric Le Goater * SCOM 0x1101xxxx 4524ece072SCédric Le Goater * OHA 0x1102xxxx 4624ece072SCédric Le Goater * CLOCK CTL 0x1103xxxx 4724ece072SCédric Le Goater * FIR 0x1104xxxx 4824ece072SCédric Le Goater * THERM 0x1105xxxx 4924ece072SCédric Le Goater * <reserved> 0x1106xxxx 5024ece072SCédric Le Goater * .. 5124ece072SCédric Le Goater * 0x110Exxxx 5224ece072SCédric Le Goater * PCB SLAVE 0x110Fxxxx 5324ece072SCédric Le Goater */ 5424ece072SCédric Le Goater 55c035851aSCédric Le Goater #define PNV_XSCOM_EX_CORE_BASE 0x10000000ull 56c035851aSCédric Le Goater 57c035851aSCédric Le Goater #define PNV_XSCOM_EX_BASE(core) \ 58c035851aSCédric Le Goater (PNV_XSCOM_EX_CORE_BASE | ((uint64_t)(core) << 24)) 59c035851aSCédric Le Goater #define PNV_XSCOM_EX_SIZE 0x100000 60c035851aSCédric Le Goater 61a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_BASE 0xb0020 62a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_SIZE 0x4 63a3980bf5SBenjamin Herrenschmidt 6454f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_BASE 0x2010900 6554f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_SIZE 0x20 6654f59d78SCédric Le Goater 679a69950fSNicholas Piggin #define PNV_XSCOM_CHIPTOD_BASE 0x0040000 689a69950fSNicholas Piggin #define PNV_XSCOM_CHIPTOD_SIZE 0x31 699a69950fSNicholas Piggin 700722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_BASE 0x0066000 710722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_SIZE 0x6000 720722d05aSBenjamin Herrenschmidt 738f092316SCédric Le Goater #define PNV_XSCOM_PBA_BASE 0x2013f00 748f092316SCédric Le Goater #define PNV_XSCOM_PBA_SIZE 0x40 758f092316SCédric Le Goater 769ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_NEST_BASE 0x2012000 779ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_NEST_SIZE 0x46 789ae1329eSCédric Le Goater 799ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_PCI_BASE 0x9012000 809ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_PCI_SIZE 0x15 819ae1329eSCédric Le Goater 829ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_SPCI_BASE 0x9013c00 839ae1329eSCédric Le Goater #define PNV_XSCOM_PBCQ_SPCI_SIZE 0x5 849ae1329eSCédric Le Goater 8553f18b3eSNicholas Piggin #define PNV9_XSCOM_ADU_BASE 0x0090000 8653f18b3eSNicholas Piggin #define PNV9_XSCOM_ADU_SIZE 0x55 8753f18b3eSNicholas Piggin 882b548a42SCédric Le Goater /* 892b548a42SCédric Le Goater * Layout of the XSCOM PCB addresses (POWER 9) 902b548a42SCédric Le Goater */ 915dad902cSCédric Le Goater #define PNV9_XSCOM_EC_BASE(core) \ 925dad902cSCédric Le Goater ((uint64_t)(((core) & 0x1F) + 0x20) << 24) 935dad902cSCédric Le Goater #define PNV9_XSCOM_EC_SIZE 0x100000 945dad902cSCédric Le Goater 955dad902cSCédric Le Goater #define PNV9_XSCOM_EQ_BASE(core) \ 965dad902cSCédric Le Goater ((uint64_t)(((core) & 0x1C) + 0x40) << 22) 975dad902cSCédric Le Goater #define PNV9_XSCOM_EQ_SIZE 0x100000 985dad902cSCédric Le Goater 99263b81eeSCédric Le Goater #define PNV9_XSCOM_I2CM_BASE 0xa0000 100263b81eeSCédric Le Goater #define PNV9_XSCOM_I2CM_SIZE 0x1000 101263b81eeSCédric Le Goater 1029a69950fSNicholas Piggin #define PNV9_XSCOM_CHIPTOD_BASE PNV_XSCOM_CHIPTOD_BASE 1039a69950fSNicholas Piggin #define PNV9_XSCOM_CHIPTOD_SIZE PNV_XSCOM_CHIPTOD_SIZE 1049a69950fSNicholas Piggin 1056598a70dSCédric Le Goater #define PNV9_XSCOM_OCC_BASE PNV_XSCOM_OCC_BASE 1066598a70dSCédric Le Goater #define PNV9_XSCOM_OCC_SIZE 0x8000 1076598a70dSCédric Le Goater 1080bf4d77eSNicholas Piggin #define PNV9_XSCOM_SBE_CTRL_BASE 0x00050008 1090bf4d77eSNicholas Piggin #define PNV9_XSCOM_SBE_CTRL_SIZE 0x1 1100bf4d77eSNicholas Piggin 1110bf4d77eSNicholas Piggin #define PNV9_XSCOM_SBE_MBOX_BASE 0x000D0050 1120bf4d77eSNicholas Piggin #define PNV9_XSCOM_SBE_MBOX_SIZE 0x16 1130bf4d77eSNicholas Piggin 1148f092316SCédric Le Goater #define PNV9_XSCOM_PBA_BASE 0x5012b00 1158f092316SCédric Le Goater #define PNV9_XSCOM_PBA_SIZE 0x40 1168f092316SCédric Le Goater 117c38536bcSCédric Le Goater #define PNV9_XSCOM_PSIHB_BASE 0x5012900 118c38536bcSCédric Le Goater #define PNV9_XSCOM_PSIHB_SIZE 0x100 119c38536bcSCédric Le Goater 1202dfa91a2SCédric Le Goater #define PNV9_XSCOM_XIVE_BASE 0x5013000 1212dfa91a2SCédric Le Goater #define PNV9_XSCOM_XIVE_SIZE 0x300 1222dfa91a2SCédric Le Goater 1234f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_NEST_BASE 0x4010c00 1244f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_NEST_SIZE 0x100 1254f9924c4SBenjamin Herrenschmidt 1264f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_BASE 0xd010800 1274f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_SIZE 0x200 1284f9924c4SBenjamin Herrenschmidt 1294f9924c4SBenjamin Herrenschmidt /* XSCOM PCI "pass-through" window to PHB SCOM */ 1304f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_STK0 0x100 1314f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_STK1 0x140 1324f9924c4SBenjamin Herrenschmidt #define PNV9_XSCOM_PEC_PCI_STK2 0x180 1334f9924c4SBenjamin Herrenschmidt 13453f18b3eSNicholas Piggin #define PNV10_XSCOM_ADU_BASE 0x0090000 13553f18b3eSNicholas Piggin #define PNV10_XSCOM_ADU_SIZE 0x55 13653f18b3eSNicholas Piggin 1372b548a42SCédric Le Goater /* 1382b548a42SCédric Le Goater * Layout of the XSCOM PCB addresses (POWER 10) 1392b548a42SCédric Le Goater */ 1402b548a42SCédric Le Goater #define PNV10_XSCOM_EQ_CHIPLET(core) (0x20 + ((core) >> 2)) 1412b548a42SCédric Le Goater #define PNV10_XSCOM_EQ(chiplet) ((chiplet) << 24) 1422b548a42SCédric Le Goater #define PNV10_XSCOM_EC(proc) \ 1432b548a42SCédric Le Goater ((0x2 << 16) | ((1 << (3 - (proc))) << 12)) 1442b548a42SCédric Le Goater 145bdb97596SJoel Stanley #define PNV10_XSCOM_QME(chiplet) \ 146bdb97596SJoel Stanley (PNV10_XSCOM_EQ(chiplet) | (0xE << 16)) 147bdb97596SJoel Stanley 148bdb97596SJoel Stanley /* 149bdb97596SJoel Stanley * Make the region larger by 0x1000 (instead of starting at an offset) so the 150bdb97596SJoel Stanley * modelled addresses start from 0 151bdb97596SJoel Stanley */ 152bdb97596SJoel Stanley #define PNV10_XSCOM_QME_BASE(core) \ 153bdb97596SJoel Stanley ((uint64_t) PNV10_XSCOM_QME(PNV10_XSCOM_EQ_CHIPLET(core))) 154bdb97596SJoel Stanley #define PNV10_XSCOM_QME_SIZE (0x8000 + 0x1000) 155bdb97596SJoel Stanley 1562b548a42SCédric Le Goater #define PNV10_XSCOM_EQ_BASE(core) \ 1572b548a42SCédric Le Goater ((uint64_t) PNV10_XSCOM_EQ(PNV10_XSCOM_EQ_CHIPLET(core))) 158a1d64b9eSJoel Stanley #define PNV10_XSCOM_EQ_SIZE 0x20000 1592b548a42SCédric Le Goater 1602b548a42SCédric Le Goater #define PNV10_XSCOM_EC_BASE(core) \ 1612b548a42SCédric Le Goater ((uint64_t) PNV10_XSCOM_EQ_BASE(core) | PNV10_XSCOM_EC(core & 0x3)) 162aa2addf9SNicholas Piggin #define PNV10_XSCOM_EC_SIZE 0x1000 1632b548a42SCédric Le Goater 1648b50ce85SCédric Le Goater #define PNV10_XSCOM_PSIHB_BASE 0x3011D00 1658b50ce85SCédric Le Goater #define PNV10_XSCOM_PSIHB_SIZE 0x100 1668b50ce85SCédric Le Goater 1671ceda19cSGlenn Miles #define PNV10_XSCOM_I2CM_BASE PNV9_XSCOM_I2CM_BASE 1681ceda19cSGlenn Miles #define PNV10_XSCOM_I2CM_SIZE PNV9_XSCOM_I2CM_SIZE 1691ceda19cSGlenn Miles 1709a69950fSNicholas Piggin #define PNV10_XSCOM_CHIPTOD_BASE PNV9_XSCOM_CHIPTOD_BASE 1719a69950fSNicholas Piggin #define PNV10_XSCOM_CHIPTOD_SIZE PNV9_XSCOM_CHIPTOD_SIZE 1729a69950fSNicholas Piggin 1738bf682a3SCédric Le Goater #define PNV10_XSCOM_OCC_BASE PNV9_XSCOM_OCC_BASE 1748bf682a3SCédric Le Goater #define PNV10_XSCOM_OCC_SIZE PNV9_XSCOM_OCC_SIZE 1758bf682a3SCédric Le Goater 1760bf4d77eSNicholas Piggin #define PNV10_XSCOM_SBE_CTRL_BASE PNV9_XSCOM_SBE_CTRL_BASE 1770bf4d77eSNicholas Piggin #define PNV10_XSCOM_SBE_CTRL_SIZE PNV9_XSCOM_SBE_CTRL_SIZE 1780bf4d77eSNicholas Piggin 1790bf4d77eSNicholas Piggin #define PNV10_XSCOM_SBE_MBOX_BASE PNV9_XSCOM_SBE_MBOX_BASE 1800bf4d77eSNicholas Piggin #define PNV10_XSCOM_SBE_MBOX_SIZE PNV9_XSCOM_SBE_MBOX_SIZE 1810bf4d77eSNicholas Piggin 18292499676SCédric Le Goater #define PNV10_XSCOM_PBA_BASE 0x01010CDA 18392499676SCédric Le Goater #define PNV10_XSCOM_PBA_SIZE 0x40 18492499676SCédric Le Goater 185da71b7e3SCédric Le Goater #define PNV10_XSCOM_XIVE2_BASE 0x2010800 186da71b7e3SCédric Le Goater #define PNV10_XSCOM_XIVE2_SIZE 0x400 187da71b7e3SCédric Le Goater 1881adf2470SChalapathi V #define PNV10_XSCOM_N1_CHIPLET_CTRL_REGS_BASE 0x3000000 1891adf2470SChalapathi V #define PNV10_XSCOM_CHIPLET_CTRL_REGS_SIZE 0x400 1901adf2470SChalapathi V 1915706b006SChalapathi V #define PNV10_XSCOM_N1_PB_SCOM_EQ_BASE 0x3011000 1925706b006SChalapathi V #define PNV10_XSCOM_N1_PB_SCOM_EQ_SIZE 0x200 1935706b006SChalapathi V 1945706b006SChalapathi V #define PNV10_XSCOM_N1_PB_SCOM_ES_BASE 0x3011300 1955706b006SChalapathi V #define PNV10_XSCOM_N1_PB_SCOM_ES_SIZE 0x100 1965706b006SChalapathi V 197623575e1SCédric Le Goater #define PNV10_XSCOM_PEC_NEST_BASE 0x3011800 /* index goes downwards ... */ 198623575e1SCédric Le Goater #define PNV10_XSCOM_PEC_NEST_SIZE 0x100 199623575e1SCédric Le Goater 200623575e1SCédric Le Goater #define PNV10_XSCOM_PEC_PCI_BASE 0x8010800 /* index goes upwards ... */ 201623575e1SCédric Le Goater #define PNV10_XSCOM_PEC_PCI_SIZE 0x200 202623575e1SCédric Le Goater 203*29318db1SChalapathi V #define PNV10_XSCOM_PIB_SPIC_BASE 0xc0000 204*29318db1SChalapathi V #define PNV10_XSCOM_PIB_SPIC_SIZE 0x20 205*29318db1SChalapathi V 206326f7acbSPhilippe Mathieu-Daudé void pnv_xscom_init(PnvChip *chip, uint64_t size, hwaddr addr); 2073f5b45caSGreg Kurz int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset, 208c396c58aSGreg Kurz uint64_t xscom_base, uint64_t xscom_size, 209c396c58aSGreg Kurz const char *compat, int compat_size); 210967b7523SCédric Le Goater 211aeb7a330SGreg Kurz void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset, 212967b7523SCédric Le Goater MemoryRegion *mr); 213aeb7a330SGreg Kurz void pnv_xscom_region_init(MemoryRegion *mr, 214d32335e8SPhilippe Mathieu-Daudé Object *owner, 215967b7523SCédric Le Goater const MemoryRegionOps *ops, 216967b7523SCédric Le Goater void *opaque, 217967b7523SCédric Le Goater const char *name, 218967b7523SCédric Le Goater uint64_t size); 219967b7523SCédric Le Goater 220a8b991b5SMarkus Armbruster #endif /* PPC_PNV_XSCOM_H */ 221