diff options
author | Alex Elder | 2022-09-26 17:09:22 -0500 |
---|---|---|
committer | Jakub Kicinski | 2022-09-27 18:42:50 -0700 |
commit | a5ad8956f97ae1b97a3dd4923c8972573f2fc028 (patch) | |
tree | bc128ae2cbd546e4979e055a967b37fe379e550c /drivers/net/ipa/ipa_gsi.h | |
parent | 6a244b75cfab95ddd505fc9a80af76bf36071784 (diff) |
net: ipa: introduce ipa_reg field masks
Add register field descriptors to the ipa_reg structure. A field in
a register is defined by a field mask, which is a 32-bit mask having
a single contiguous range of bits set.
For each register that has at least one field defined, an enumerated
type will identify the register's fields. The ipa_reg structure for
that register will include an array fmask[] of field masks, indexed
by that enumerated type. Each field mask defines the position and
bit width of a field. An additional "fcount" records how many
fields (masks) are defined for a given register.
Introduce two macros to be used to define registers that have at
least one field.
Introduce a few new functions related to field masks. The first
simply returns a field mask, given an IPA register pointer and field
mask ID. A variant of that is meant to be used for the special case
of single-bit field masks.
Next, ipa_reg_encode(), identifies a field with an IPA register
pointer and a field ID, and takes a value to represent in that
field. The result encodes the value in the appropriate place to be
stored in the register. This is roughly modeled after the bitmask
operations (like u32_encode_bits()).
Another function (ipa_reg_decode()) similarly identifies a register
field, but the value supplied to it represents a full register
value. The value encoded in the field is extracted from the value
and returned. This is also roughly modeled after bitmask operations
(such as u32_get_bits()).
Finally, ipa_reg_field_max() returns the maximum value representable
by a field.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ipa/ipa_gsi.h')
0 files changed, 0 insertions, 0 deletions