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 24*c035851aSCédric Le Goater typedef struct PnvChip PnvChip; 25*c035851aSCé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; 41b168a138SCédric Le Goater int (*dt_xscom)(PnvXScomInterface *dev, void *fdt, int offset); 42967b7523SCédric Le Goater } PnvXScomInterfaceClass; 43967b7523SCédric Le Goater 4424ece072SCédric Le Goater /* 45ad521238SCédric Le Goater * Layout of the XSCOM PCB addresses of EX core 1 (POWER 8) 4624ece072SCédric Le Goater * 4724ece072SCédric Le Goater * GPIO 0x1100xxxx 4824ece072SCédric Le Goater * SCOM 0x1101xxxx 4924ece072SCédric Le Goater * OHA 0x1102xxxx 5024ece072SCédric Le Goater * CLOCK CTL 0x1103xxxx 5124ece072SCédric Le Goater * FIR 0x1104xxxx 5224ece072SCédric Le Goater * THERM 0x1105xxxx 5324ece072SCédric Le Goater * <reserved> 0x1106xxxx 5424ece072SCédric Le Goater * .. 5524ece072SCédric Le Goater * 0x110Exxxx 5624ece072SCédric Le Goater * PCB SLAVE 0x110Fxxxx 5724ece072SCédric Le Goater */ 5824ece072SCédric Le Goater 59*c035851aSCédric Le Goater #define PNV_XSCOM_EX_CORE_BASE 0x10000000ull 60*c035851aSCédric Le Goater 61*c035851aSCédric Le Goater #define PNV_XSCOM_EX_BASE(core) \ 62*c035851aSCédric Le Goater (PNV_XSCOM_EX_CORE_BASE | ((uint64_t)(core) << 24)) 63*c035851aSCédric Le Goater #define PNV_XSCOM_EX_SIZE 0x100000 64*c035851aSCédric Le Goater 65*c035851aSCédric Le Goater #define PNV_XSCOM_P9_EC_BASE(core) \ 66*c035851aSCédric Le Goater ((uint64_t)(((core) & 0x1F) + 0x20) << 24) 67*c035851aSCédric Le Goater #define PNV_XSCOM_P9_EC_SIZE 0x100000 6824ece072SCédric Le Goater 69a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_BASE 0xb0020 70a3980bf5SBenjamin Herrenschmidt #define PNV_XSCOM_LPC_SIZE 0x4 71a3980bf5SBenjamin Herrenschmidt 7254f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_BASE 0x2010900 7354f59d78SCédric Le Goater #define PNV_XSCOM_PSIHB_SIZE 0x20 7454f59d78SCédric Le Goater 750722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_BASE 0x0066000 760722d05aSBenjamin Herrenschmidt #define PNV_XSCOM_OCC_SIZE 0x6000 770722d05aSBenjamin Herrenschmidt 78967b7523SCédric Le Goater extern void pnv_xscom_realize(PnvChip *chip, Error **errp); 79b168a138SCédric Le Goater extern int pnv_dt_xscom(PnvChip *chip, void *fdt, int offset); 80967b7523SCédric Le Goater 81967b7523SCédric Le Goater extern void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset, 82967b7523SCédric Le Goater MemoryRegion *mr); 83967b7523SCédric Le Goater extern void pnv_xscom_region_init(MemoryRegion *mr, 84967b7523SCédric Le Goater struct Object *owner, 85967b7523SCédric Le Goater const MemoryRegionOps *ops, 86967b7523SCédric Le Goater void *opaque, 87967b7523SCédric Le Goater const char *name, 88967b7523SCédric Le Goater uint64_t size); 89967b7523SCédric Le Goater 90967b7523SCédric Le Goater #endif /* _PPC_PNV_XSCOM_H */ 91