aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/pnv_xscom.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2019-12-13 13:00:35 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2019-12-17 10:59:11 +1100
commit70c059e9266fc7d79e40c9d297722ccb717ec386 (patch)
tree34d3199b03255b0dd1455282099d36284e1de8ab /hw/ppc/pnv_xscom.c
parent3caf7bd0a2874717c5cf052a9840efe9c7774f2e (diff)
ppc/pnv: Introduce PnvChipClass::xscom_pcba() method
The XSCOM bus is implemented with a QOM interface, which is mostly generic from a CPU type standpoint, except for the computation of addresses on the Pervasive Connect Bus (PCB) network. This is handled by the pnv_xscom_pcba() function with a switch statement based on the chip_type class level attribute of the CPU chip. This can be achieved using QOM. Also the address argument is masked with PNV_XSCOM_SIZE - 1, which is for POWER8 only. Addresses may have different sizes with other CPU types. Have each CPU chip type handle the appropriate computation with a QOM xscom_pcba() method. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <157623843543.360005.13996472463887521794.stgit@bahia.lan> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/pnv_xscom.c')
-rw-r--r--hw/ppc/pnv_xscom.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
index 5ae9dfbb88..b681c72575 100644
--- a/hw/ppc/pnv_xscom.c
+++ b/hw/ppc/pnv_xscom.c
@@ -57,19 +57,7 @@ static void xscom_complete(CPUState *cs, uint64_t hmer_bits)
static uint32_t pnv_xscom_pcba(PnvChip *chip, uint64_t addr)
{
- addr &= (PNV_XSCOM_SIZE - 1);
-
- switch (PNV_CHIP_GET_CLASS(chip)->chip_type) {
- case PNV_CHIP_POWER8E:
- case PNV_CHIP_POWER8:
- case PNV_CHIP_POWER8NVL:
- return ((addr >> 4) & ~0xfull) | ((addr >> 3) & 0xf);
- case PNV_CHIP_POWER9:
- case PNV_CHIP_POWER10:
- return addr >> 3;
- default:
- g_assert_not_reached();
- }
+ return PNV_CHIP_GET_CLASS(chip)->xscom_pcba(chip, addr);
}
static uint64_t xscom_read_default(PnvChip *chip, uint32_t pcba)