Commit 0a6e5008a9df678b48f8d4e57601aa4270df6c14
1 parent
9724a8504c
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
sfc: Fix MCDI structure field lookup
The least significant bit number (LBN) of a field within an MCDI structure is counted from the start of the structure, not the containing dword. In MCDI_ARRAY_FIELD() we need to mask it rather than using the usual EFX_DWORD_FIELD() macro. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
drivers/net/ethernet/sfc/mcdi.h
... | ... | @@ -113,11 +113,13 @@ |
113 | 113 | #define MCDI_EVENT_FIELD(_ev, _field) \ |
114 | 114 | EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) |
115 | 115 | #define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2) \ |
116 | - EFX_DWORD_FIELD( \ | |
116 | + EFX_EXTRACT_DWORD( \ | |
117 | 117 | *((efx_dword_t *) \ |
118 | 118 | (MCDI_ARRAY_PTR(_buf, _field1, _type, _index) + \ |
119 | 119 | (MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _OFST & ~3))), \ |
120 | - MC_CMD_ ## _type ## _TYPEDEF_ ## _field2) | |
120 | + MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _LBN & 0x1f, \ | |
121 | + (MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _LBN & 0x1f) + \ | |
122 | + MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _WIDTH - 1) | |
121 | 123 | |
122 | 124 | extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); |
123 | 125 | extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, |