aboutsummaryrefslogtreecommitdiff
path: root/hw/npu2.c
diff options
context:
space:
mode:
authorReza Arbab <arbab@linux.vnet.ibm.com>2017-11-13 16:19:15 -0600
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-13 17:47:56 -0600
commitd6f2505b15422e3c63932a67278ebdbca67047d5 (patch)
treef7865adeda8347f39bf8f769487f4b4b83437742 /hw/npu2.c
parent2884eeabfd9341c95555c3bd4670e5dbc8a8bb71 (diff)
downloadskiboot-d6f2505b15422e3c63932a67278ebdbca67047d5.zip
skiboot-d6f2505b15422e3c63932a67278ebdbca67047d5.tar.gz
skiboot-d6f2505b15422e3c63932a67278ebdbca67047d5.tar.bz2
npu2: Add npu2_write_mask_4b()
Add a 4-byte version of npu2_write_mask(). Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com> Reviewed-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/npu2.c')
-rw-r--r--hw/npu2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/npu2.c b/hw/npu2.c
index d215b4c..ea0e417 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -145,6 +145,17 @@ void npu2_write_mask(struct npu2 *p, uint64_t reg, uint64_t val, uint64_t mask)
npu2_scom_write(p->chip_id, p->xscom_base, reg, NPU2_MISC_DA_LEN_8B, new_val);
}
+void npu2_write_mask_4b(struct npu2 *p, uint64_t reg, uint32_t val, uint32_t mask)
+{
+ uint32_t new_val;
+
+ new_val = npu2_read_4b(p, reg);
+ new_val &= ~mask;
+ new_val |= val & mask;
+ npu2_scom_write(p->chip_id, p->xscom_base, reg, NPU2_MISC_DA_LEN_4B,
+ (uint64_t)new_val << 32);
+}
+
/* Set a specific flag in the vendor config space */
void npu2_set_link_flag(struct npu2_dev *ndev, uint8_t flag)
{