[Skiboot] [PATCH 1/3] npu2: Add npu2_write_mask_4b()
alistair at popple.id.au
alistair at popple.id.au
Tue Nov 14 10:02:23 AEDT 2017
Reviewed-by: Alistair Popple <alistair at popple.id.au>
> Add a 4-byte version of npu2_write_mask().
>
> Signed-off-by: Reza Arbab <arbab at linux.vnet.ibm.com>
> ---
> hw/npu2.c | 11 +++++++++++
> include/npu2.h | 1 +
> 2 files changed, 12 insertions(+)
>
> 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)
> {
> diff --git a/include/npu2.h b/include/npu2.h
> index f11a13a..d30a91f 100644
> --- a/include/npu2.h
> +++ b/include/npu2.h
> @@ -152,6 +152,7 @@ uint32_t npu2_read_4b(struct npu2 *p, uint64_t reg);
> void npu2_write(struct npu2 *p, uint64_t reg, uint64_t val);
> uint64_t npu2_read(struct npu2 *p, uint64_t reg);
> void npu2_write_mask(struct npu2 *p, uint64_t reg, uint64_t val, uint64_t
> mask);
> +void npu2_write_mask_4b(struct npu2 *p, uint64_t reg, uint32_t val,
> uint32_t mask);
> int64_t npu2_dev_procedure(void *dev, struct pci_cfg_reg_filter *pcrf,
> uint32_t offset, uint32_t len, uint32_t *data,
> bool write);
> --
> 1.8.3.1
>
>
More information about the Skiboot
mailing list