aboutsummaryrefslogtreecommitdiff
path: root/hw/npu2-hw-procedures.c
diff options
context:
space:
mode:
authorReza Arbab <arbab@linux.vnet.ibm.com>2017-11-27 18:10:52 -0600
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-28 15:00:51 -0600
commite6b5867adb7fa18f9f04bfc4c4dde3b7769bf0e4 (patch)
tree2aa709b66722bf159641969ea52390d5c8ba2f3a /hw/npu2-hw-procedures.c
parent2be4422dace9960b56f27cc611644ca5fdd292d9 (diff)
downloadskiboot-e6b5867adb7fa18f9f04bfc4c4dde3b7769bf0e4.zip
skiboot-e6b5867adb7fa18f9f04bfc4c4dde3b7769bf0e4.tar.gz
skiboot-e6b5867adb7fa18f9f04bfc4c4dde3b7769bf0e4.tar.bz2
npu2: hw-procedures: Add obus_brick_index()
We have code in reset_ntl() which finds the index number of our brick within its obus chiplet. Move that logic to a separate function for reuse. No functional change. Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com> Acked-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/npu2-hw-procedures.c')
-rw-r--r--hw/npu2-hw-procedures.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c
index bb8534b..4c9d843 100644
--- a/hw/npu2-hw-procedures.c
+++ b/hw/npu2-hw-procedures.c
@@ -191,6 +191,18 @@ static uint32_t nop(struct npu2_dev *npu_dev __unused)
}
DEFINE_PROCEDURE(nop);
+/* Return the brick number (0-2) within an obus chiplet */
+static int obus_brick_index(struct npu2_dev *ndev)
+{
+ int index = ndev->index % 3;
+
+ /* On the second obus chiplet, index is reversed */
+ if ((ndev->pl_xscom_base & 0x3F000000) != 0x09000000)
+ return 2 - index;
+
+ return index;
+}
+
static bool poll_fence_status(struct npu2_dev *ndev, uint64_t val)
{
uint64_t fs;
@@ -212,22 +224,7 @@ static uint32_t reset_ntl(struct npu2_dev *ndev)
uint64_t val;
/* Write PRI */
- if ((ndev->pl_xscom_base & 0xFFFFFFFF) == 0x9010C3F)
- val = SETFIELD(PPC_BITMASK(0,1), 0ull, ndev->index % 3);
- else {
- switch (ndev->index % 3) {
- case 0:
- val = SETFIELD(PPC_BITMASK(0,1), 0ull, 2);
- break;
- case 1:
- val = SETFIELD(PPC_BITMASK(0,1), 0ull, 1);
- break;
- case 2:
- val = SETFIELD(PPC_BITMASK(0,1), 0ull, 0);
- break;
- }
- }
-
+ val = SETFIELD(PPC_BITMASK(0,1), 0ull, obus_brick_index(ndev));
npu2_write_mask(ndev->npu, NPU2_NTL_PRI_CFG(ndev), val, -1ULL);
/* NTL Reset */