Skip to content

Commit

Permalink
npu2: Add NPU2_SM_REG_OFFSET()
Browse files Browse the repository at this point in the history
Add a register offset calculation macro using SM block index, similar to
the other NPU2_*_REG_OFFSET() macros.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
[arbab@linux.ibm.com: Rebase/refactor original changes]
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-By: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
rarbab authored and stewartsmith committed Aug 6, 2018
1 parent 77f2650 commit 06e9970
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/npu2-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ void npu2_scom_write(uint64_t gcid, uint64_t scom_base,
NPU2_REG_OFFSET(((ndev)->index >> 1), \
8 + ((ndev)->index % 2)*2, offset)

#define NPU2_SM_REG_OFFSET(ndev, sm, offset) \
NPU2_REG_OFFSET(NPU2_STACK_STCK_0 + ((ndev)->index >> 1), \
NPU2_BLOCK_SM_0 + (sm), offset)

/* Get the offset for this register */
#define NPU2_REG(reg) \
((reg) & 0xffff)
Expand Down

0 comments on commit 06e9970

Please sign in to comment.