Commit efa1c818 authored by Matthew R. Ochs's avatar Matthew R. Ochs Committed by Martin K. Petersen

scsi: cxlflash: Refactor AFU capability checking

The existing AFU capability checking infrastructure is closely tied to
the command mode capability bits. In order to support new capabilities,
refactor the existing infrastructure to be more generic.
Signed-off-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d6e32f53
...@@ -255,21 +255,21 @@ static inline bool afu_is_irqpoll_enabled(struct afu *afu) ...@@ -255,21 +255,21 @@ static inline bool afu_is_irqpoll_enabled(struct afu *afu)
return !!afu->irqpoll_weight; return !!afu->irqpoll_weight;
} }
static inline bool afu_is_cmd_mode(struct afu *afu, u64 cmd_mode) static inline bool afu_has_cap(struct afu *afu, u64 cap)
{ {
u64 afu_cap = afu->interface_version >> SISL_INTVER_CAP_SHIFT; u64 afu_cap = afu->interface_version >> SISL_INTVER_CAP_SHIFT;
return afu_cap & cmd_mode; return afu_cap & cap;
} }
static inline bool afu_is_sq_cmd_mode(struct afu *afu) static inline bool afu_is_sq_cmd_mode(struct afu *afu)
{ {
return afu_is_cmd_mode(afu, SISL_INTVER_CAP_SQ_CMD_MODE); return afu_has_cap(afu, SISL_INTVER_CAP_SQ_CMD_MODE);
} }
static inline bool afu_is_ioarrin_cmd_mode(struct afu *afu) static inline bool afu_is_ioarrin_cmd_mode(struct afu *afu)
{ {
return afu_is_cmd_mode(afu, SISL_INTVER_CAP_IOARRIN_CMD_MODE); return afu_has_cap(afu, SISL_INTVER_CAP_IOARRIN_CMD_MODE);
} }
static inline u64 lun_to_lunid(u64 lun) static inline u64 lun_to_lunid(u64 lun)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment