ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
/*
|
|
|
|
* QEMU PowerPC PowerNV XSCOM bus
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016, IBM Corporation.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2019-05-23 17:35:07 +03:00
|
|
|
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
#include "qemu/osdep.h"
|
|
|
|
#include "qemu/log.h"
|
2019-05-23 17:35:07 +03:00
|
|
|
#include "qemu/module.h"
|
2017-01-10 13:59:55 +03:00
|
|
|
#include "sysemu/hw_accel.h"
|
2016-10-11 09:56:52 +03:00
|
|
|
#include "target/ppc/cpu.h"
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
#include "hw/sysbus.h"
|
|
|
|
|
|
|
|
#include "hw/ppc/fdt.h"
|
|
|
|
#include "hw/ppc/pnv.h"
|
2016-11-07 21:03:02 +03:00
|
|
|
#include "hw/ppc/pnv_xscom.h"
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
|
|
|
|
#include <libfdt.h>
|
|
|
|
|
2019-05-27 10:17:22 +03:00
|
|
|
/* PRD registers */
|
|
|
|
#define PRD_P8_IPOLL_REG_MASK 0x01020013
|
|
|
|
#define PRD_P8_IPOLL_REG_STATUS 0x01020014
|
|
|
|
#define PRD_P9_IPOLL_REG_MASK 0x000F0033
|
|
|
|
#define PRD_P9_IPOLL_REG_STATUS 0x000F0034
|
|
|
|
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
static void xscom_complete(CPUState *cs, uint64_t hmer_bits)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* TODO: When the read/write comes from the monitor, NULL is
|
|
|
|
* passed for the cpu, and no CPU completion is generated.
|
|
|
|
*/
|
|
|
|
if (cs) {
|
|
|
|
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
|
|
|
CPUPPCState *env = &cpu->env;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO: Need a CPU helper to set HMER, also handle generation
|
|
|
|
* of HMIs
|
|
|
|
*/
|
|
|
|
cpu_synchronize_state(cs);
|
|
|
|
env->spr[SPR_HMER] |= hmer_bits;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t pnv_xscom_pcba(PnvChip *chip, uint64_t addr)
|
|
|
|
{
|
|
|
|
addr &= (PNV_XSCOM_SIZE - 1);
|
2018-01-15 21:04:03 +03:00
|
|
|
|
|
|
|
if (pnv_chip_is_power9(chip)) {
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
return addr >> 3;
|
|
|
|
} else {
|
|
|
|
return ((addr >> 4) & ~0xfull) | ((addr >> 3) & 0xf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint64_t xscom_read_default(PnvChip *chip, uint32_t pcba)
|
|
|
|
{
|
|
|
|
switch (pcba) {
|
|
|
|
case 0xf000f:
|
|
|
|
return PNV_CHIP_GET_CLASS(chip)->chip_cfam_id;
|
2019-03-08 01:35:46 +03:00
|
|
|
case 0x18002: /* ECID2 */
|
|
|
|
return 0;
|
|
|
|
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
case 0x1010c00: /* PIBAM FIR */
|
|
|
|
case 0x1010c03: /* PIBAM FIR MASK */
|
2019-03-08 01:35:46 +03:00
|
|
|
|
2019-05-27 10:17:22 +03:00
|
|
|
/* PRD registers */
|
|
|
|
case PRD_P8_IPOLL_REG_MASK:
|
|
|
|
case PRD_P8_IPOLL_REG_STATUS:
|
|
|
|
case PRD_P9_IPOLL_REG_MASK:
|
|
|
|
case PRD_P9_IPOLL_REG_STATUS:
|
|
|
|
|
2019-03-08 01:35:46 +03:00
|
|
|
/* P9 xscom reset */
|
|
|
|
case 0x0090018: /* Receive status reg */
|
|
|
|
case 0x0090012: /* log register */
|
|
|
|
case 0x0090013: /* error register */
|
|
|
|
|
|
|
|
/* P8 xscom reset */
|
|
|
|
case 0x2020007: /* ADU stuff, log register */
|
|
|
|
case 0x2020009: /* ADU stuff, error register */
|
|
|
|
case 0x202000f: /* ADU stuff, receive status register*/
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
return 0;
|
|
|
|
case 0x2013f00: /* PBA stuff */
|
|
|
|
case 0x2013f01: /* PBA stuff */
|
|
|
|
case 0x2013f02: /* PBA stuff */
|
|
|
|
case 0x2013f03: /* PBA stuff */
|
|
|
|
case 0x2013f04: /* PBA stuff */
|
|
|
|
case 0x2013f05: /* PBA stuff */
|
|
|
|
case 0x2013f06: /* PBA stuff */
|
|
|
|
case 0x2013f07: /* PBA stuff */
|
|
|
|
return 0;
|
|
|
|
case 0x2013028: /* CAPP stuff */
|
|
|
|
case 0x201302a: /* CAPP stuff */
|
|
|
|
case 0x2013801: /* CAPP stuff */
|
|
|
|
case 0x2013802: /* CAPP stuff */
|
2019-07-18 14:54:05 +03:00
|
|
|
|
|
|
|
/* P9 CAPP regs */
|
|
|
|
case 0x2010841:
|
|
|
|
case 0x2010842:
|
|
|
|
case 0x201082a:
|
|
|
|
case 0x2010828:
|
|
|
|
case 0x4010841:
|
|
|
|
case 0x4010842:
|
|
|
|
case 0x401082a:
|
|
|
|
case 0x4010828:
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
return 0;
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool xscom_write_default(PnvChip *chip, uint32_t pcba, uint64_t val)
|
|
|
|
{
|
|
|
|
/* We ignore writes to these */
|
|
|
|
switch (pcba) {
|
|
|
|
case 0xf000f: /* chip id is RO */
|
|
|
|
case 0x1010c00: /* PIBAM FIR */
|
|
|
|
case 0x1010c01: /* PIBAM FIR */
|
|
|
|
case 0x1010c02: /* PIBAM FIR */
|
|
|
|
case 0x1010c03: /* PIBAM FIR MASK */
|
|
|
|
case 0x1010c04: /* PIBAM FIR MASK */
|
|
|
|
case 0x1010c05: /* PIBAM FIR MASK */
|
2019-03-08 01:35:46 +03:00
|
|
|
/* P9 xscom reset */
|
|
|
|
case 0x0090018: /* Receive status reg */
|
|
|
|
case 0x0090012: /* log register */
|
|
|
|
case 0x0090013: /* error register */
|
|
|
|
|
|
|
|
/* P8 xscom reset */
|
|
|
|
case 0x2020007: /* ADU stuff, log register */
|
|
|
|
case 0x2020009: /* ADU stuff, error register */
|
|
|
|
case 0x202000f: /* ADU stuff, receive status register*/
|
|
|
|
|
|
|
|
case 0x2013028: /* CAPP stuff */
|
|
|
|
case 0x201302a: /* CAPP stuff */
|
|
|
|
case 0x2013801: /* CAPP stuff */
|
|
|
|
case 0x2013802: /* CAPP stuff */
|
2019-05-27 10:17:22 +03:00
|
|
|
|
2019-07-18 14:54:05 +03:00
|
|
|
/* P9 CAPP regs */
|
|
|
|
case 0x2010841:
|
|
|
|
case 0x2010842:
|
|
|
|
case 0x201082a:
|
|
|
|
case 0x2010828:
|
|
|
|
case 0x4010841:
|
|
|
|
case 0x4010842:
|
|
|
|
case 0x401082a:
|
|
|
|
case 0x4010828:
|
|
|
|
|
2019-05-27 10:17:22 +03:00
|
|
|
/* P8 PRD registers */
|
|
|
|
case PRD_P8_IPOLL_REG_MASK:
|
|
|
|
case PRD_P8_IPOLL_REG_STATUS:
|
|
|
|
case PRD_P9_IPOLL_REG_MASK:
|
|
|
|
case PRD_P9_IPOLL_REG_STATUS:
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint64_t xscom_read(void *opaque, hwaddr addr, unsigned width)
|
|
|
|
{
|
|
|
|
PnvChip *chip = opaque;
|
|
|
|
uint32_t pcba = pnv_xscom_pcba(chip, addr);
|
|
|
|
uint64_t val = 0;
|
|
|
|
MemTxResult result;
|
|
|
|
|
|
|
|
/* Handle some SCOMs here before dispatch */
|
|
|
|
val = xscom_read_default(chip, pcba);
|
|
|
|
if (val != -1) {
|
|
|
|
goto complete;
|
|
|
|
}
|
|
|
|
|
2016-11-14 12:12:56 +03:00
|
|
|
val = address_space_ldq(&chip->xscom_as, (uint64_t) pcba << 3,
|
|
|
|
MEMTXATTRS_UNSPECIFIED, &result);
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
if (result != MEMTX_OK) {
|
|
|
|
qemu_log_mask(LOG_GUEST_ERROR, "XSCOM read failed at @0x%"
|
|
|
|
HWADDR_PRIx " pcba=0x%08x\n", addr, pcba);
|
|
|
|
xscom_complete(current_cpu, HMER_XSCOM_FAIL | HMER_XSCOM_DONE);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
complete:
|
|
|
|
xscom_complete(current_cpu, HMER_XSCOM_DONE);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xscom_write(void *opaque, hwaddr addr, uint64_t val,
|
|
|
|
unsigned width)
|
|
|
|
{
|
|
|
|
PnvChip *chip = opaque;
|
|
|
|
uint32_t pcba = pnv_xscom_pcba(chip, addr);
|
|
|
|
MemTxResult result;
|
|
|
|
|
|
|
|
/* Handle some SCOMs here before dispatch */
|
|
|
|
if (xscom_write_default(chip, pcba, val)) {
|
|
|
|
goto complete;
|
|
|
|
}
|
|
|
|
|
2016-11-14 12:12:56 +03:00
|
|
|
address_space_stq(&chip->xscom_as, (uint64_t) pcba << 3, val,
|
|
|
|
MEMTXATTRS_UNSPECIFIED, &result);
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
if (result != MEMTX_OK) {
|
|
|
|
qemu_log_mask(LOG_GUEST_ERROR, "XSCOM write failed at @0x%"
|
|
|
|
HWADDR_PRIx " pcba=0x%08x data=0x%" PRIx64 "\n",
|
|
|
|
addr, pcba, val);
|
|
|
|
xscom_complete(current_cpu, HMER_XSCOM_FAIL | HMER_XSCOM_DONE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
complete:
|
|
|
|
xscom_complete(current_cpu, HMER_XSCOM_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
const MemoryRegionOps pnv_xscom_ops = {
|
|
|
|
.read = xscom_read,
|
|
|
|
.write = xscom_write,
|
|
|
|
.valid.min_access_size = 8,
|
|
|
|
.valid.max_access_size = 8,
|
|
|
|
.impl.min_access_size = 8,
|
|
|
|
.impl.max_access_size = 8,
|
|
|
|
.endianness = DEVICE_BIG_ENDIAN,
|
|
|
|
};
|
|
|
|
|
2019-06-12 20:43:44 +03:00
|
|
|
void pnv_xscom_realize(PnvChip *chip, uint64_t size, Error **errp)
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
{
|
|
|
|
SysBusDevice *sbd = SYS_BUS_DEVICE(chip);
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
name = g_strdup_printf("xscom-%x", chip->chip_id);
|
|
|
|
memory_region_init_io(&chip->xscom_mmio, OBJECT(chip), &pnv_xscom_ops,
|
2019-06-12 20:43:44 +03:00
|
|
|
chip, name, size);
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
sysbus_init_mmio(sbd, &chip->xscom_mmio);
|
|
|
|
|
2019-06-12 20:43:44 +03:00
|
|
|
memory_region_init(&chip->xscom, OBJECT(chip), name, size);
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
address_space_init(&chip->xscom_as, &chip->xscom, name);
|
|
|
|
g_free(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const TypeInfo pnv_xscom_interface_info = {
|
|
|
|
.name = TYPE_PNV_XSCOM_INTERFACE,
|
|
|
|
.parent = TYPE_INTERFACE,
|
|
|
|
.class_size = sizeof(PnvXScomInterfaceClass),
|
|
|
|
};
|
|
|
|
|
|
|
|
static void pnv_xscom_register_types(void)
|
|
|
|
{
|
|
|
|
type_register_static(&pnv_xscom_interface_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
type_init(pnv_xscom_register_types)
|
|
|
|
|
|
|
|
typedef struct ForeachPopulateArgs {
|
|
|
|
void *fdt;
|
|
|
|
int xscom_offset;
|
|
|
|
} ForeachPopulateArgs;
|
|
|
|
|
2017-12-15 16:56:01 +03:00
|
|
|
static int xscom_dt_child(Object *child, void *opaque)
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
{
|
|
|
|
if (object_dynamic_cast(child, TYPE_PNV_XSCOM_INTERFACE)) {
|
|
|
|
ForeachPopulateArgs *args = opaque;
|
|
|
|
PnvXScomInterface *xd = PNV_XSCOM_INTERFACE(child);
|
|
|
|
PnvXScomInterfaceClass *xc = PNV_XSCOM_INTERFACE_GET_CLASS(xd);
|
|
|
|
|
2017-12-15 16:56:01 +03:00
|
|
|
if (xc->dt_xscom) {
|
|
|
|
_FDT((xc->dt_xscom(xd, args->fdt, args->xscom_offset)));
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char compat_p8[] = "ibm,power8-xscom\0ibm,xscom";
|
|
|
|
static const char compat_p9[] = "ibm,power9-xscom\0ibm,xscom";
|
|
|
|
|
2017-12-15 16:56:01 +03:00
|
|
|
int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
{
|
2019-06-12 20:43:44 +03:00
|
|
|
uint64_t reg[2];
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
int xscom_offset;
|
|
|
|
ForeachPopulateArgs args;
|
|
|
|
char *name;
|
|
|
|
|
2019-06-12 20:43:44 +03:00
|
|
|
if (pnv_chip_is_power9(chip)) {
|
|
|
|
reg[0] = cpu_to_be64(PNV9_XSCOM_BASE(chip));
|
|
|
|
reg[1] = cpu_to_be64(PNV9_XSCOM_SIZE);
|
|
|
|
} else {
|
|
|
|
reg[0] = cpu_to_be64(PNV_XSCOM_BASE(chip));
|
|
|
|
reg[1] = cpu_to_be64(PNV_XSCOM_SIZE);
|
|
|
|
}
|
|
|
|
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
name = g_strdup_printf("xscom@%" PRIx64, be64_to_cpu(reg[0]));
|
|
|
|
xscom_offset = fdt_add_subnode(fdt, root_offset, name);
|
|
|
|
_FDT(xscom_offset);
|
|
|
|
g_free(name);
|
|
|
|
_FDT((fdt_setprop_cell(fdt, xscom_offset, "ibm,chip-id", chip->chip_id)));
|
|
|
|
_FDT((fdt_setprop_cell(fdt, xscom_offset, "#address-cells", 1)));
|
|
|
|
_FDT((fdt_setprop_cell(fdt, xscom_offset, "#size-cells", 1)));
|
|
|
|
_FDT((fdt_setprop(fdt, xscom_offset, "reg", reg, sizeof(reg))));
|
|
|
|
|
2018-01-15 21:04:03 +03:00
|
|
|
if (pnv_chip_is_power9(chip)) {
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
_FDT((fdt_setprop(fdt, xscom_offset, "compatible", compat_p9,
|
|
|
|
sizeof(compat_p9))));
|
|
|
|
} else {
|
|
|
|
_FDT((fdt_setprop(fdt, xscom_offset, "compatible", compat_p8,
|
|
|
|
sizeof(compat_p8))));
|
|
|
|
}
|
|
|
|
|
|
|
|
_FDT((fdt_setprop(fdt, xscom_offset, "scom-controller", NULL, 0)));
|
|
|
|
|
|
|
|
args.fdt = fdt;
|
|
|
|
args.xscom_offset = xscom_offset;
|
|
|
|
|
2017-12-15 16:56:01 +03:00
|
|
|
object_child_foreach(OBJECT(chip), xscom_dt_child, &args);
|
ppc/pnv: add XSCOM infrastructure
On a real POWER8 system, the Pervasive Interconnect Bus (PIB) serves
as a backbone to connect different units of the system. The host
firmware connects to the PIB through a bridge unit, the
Alter-Display-Unit (ADU), which gives him access to all the chiplets
on the PCB network (Pervasive Connect Bus), the PIB acting as the root
of this network.
XSCOM (serial communication) is the interface to the sideband bus
provided by the POWER8 pervasive unit to read and write to chiplets
resources. This is needed by the host firmware, OPAL and to a lesser
extent, Linux. This is among others how the PCI Host bridges get
configured at boot or how the LPC bus is accessed.
To represent the ADU of a real system, we introduce a specific
AddressSpace to dispatch XSCOM accesses to the targeted chiplets. The
translation of an XSCOM address into a PCB register address is
slightly different between the P9 and the P8. This is handled before
the dispatch using a 8byte alignment for all.
To customize the device tree, a QOM InterfaceClass, PnvXScomInterface,
is provided with a populate() handler. The chip populates the device
tree by simply looping on its children. Therefore, each model needing
custom nodes should not forget to declare itself as a child at
instantiation time.
Based on previous work done by :
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[dwg: Added cpu parameter to xscom_complete()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-22 12:46:40 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pnv_xscom_add_subregion(PnvChip *chip, hwaddr offset, MemoryRegion *mr)
|
|
|
|
{
|
|
|
|
memory_region_add_subregion(&chip->xscom, offset << 3, mr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pnv_xscom_region_init(MemoryRegion *mr,
|
|
|
|
struct Object *owner,
|
|
|
|
const MemoryRegionOps *ops,
|
|
|
|
void *opaque,
|
|
|
|
const char *name,
|
|
|
|
uint64_t size)
|
|
|
|
{
|
|
|
|
memory_region_init_io(mr, owner, ops, opaque, name, size << 3);
|
|
|
|
}
|