mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
cxgb4: Fix MC1 memory offset calculation
[ Upstream commit7f0b8a56c9] Commit6559a7e829("cxgb4: Cleanup macros so they follow the same style and look consistent") introduced a regression where reading MC1 memory in adapters where MC0 isn't present or MC0 size is not equal to MC1 size caused the adapter to crash due to incorrect computation of memoffset. Fix is to read the size of MC0 instead of MC1 for offset calculation Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
028a33eb80
commit
081025f9c9
@@ -492,7 +492,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr,
|
|||||||
memoffset = (mtype * (edc_size * 1024 * 1024));
|
memoffset = (mtype * (edc_size * 1024 * 1024));
|
||||||
else {
|
else {
|
||||||
mc_size = EXT_MEM0_SIZE_G(t4_read_reg(adap,
|
mc_size = EXT_MEM0_SIZE_G(t4_read_reg(adap,
|
||||||
MA_EXT_MEMORY1_BAR_A));
|
MA_EXT_MEMORY0_BAR_A));
|
||||||
memoffset = (MEM_MC0 * edc_size + mc_size) * 1024 * 1024;
|
memoffset = (MEM_MC0 * edc_size + mc_size) * 1024 * 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user