From: Bernhard Beschow <[email protected]> As indicated in the comments, the `mb[]` a.k.a. `mbs []` views should cover 0x400 (1024) bytes. However, the `mb[]` array covers four times the size since `sizeof(FlexcanRegsMessageBuffer)` returns the size in bytes instead of counting the number of uint32_t fields. This shifts the subsequent register offsets by 0xc00 which is not intended. Fix the size and thus the offsets by dropping the now unused `mb[]` view.
Note that the different size changes the migration layout. Since the device model is new, no change in the version fields is needed. Signed-off-by: Bernhard Beschow <[email protected]> Tested-by: Pavel Pisa <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-id: [email protected] Signed-off-by: Peter Maydell <[email protected]> --- include/hw/net/flexcan.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/hw/net/flexcan.h b/include/hw/net/flexcan.h index d8159475e04..9affdff8372 100644 --- a/include/hw/net/flexcan.h +++ b/include/hw/net/flexcan.h @@ -65,10 +65,8 @@ typedef struct FlexcanRegs { uint32_t dbg1; /* 0x58, unused */ uint32_t dbg2; /* 0x5C, unused */ uint32_t _reserved3[8]; /* 0x60 */ - union { /* 0x80 - not affected by soft reset */ - uint32_t mb[sizeof(FlexcanRegsMessageBuffer) * FLEXCAN_MAILBOX_COUNT]; - FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT]; - }; + /* 0x80 - not affected by soft reset */ + FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT]; uint32_t _reserved4[256]; /* 0x480 */ uint32_t rximr[64]; /* 0x880 - not affected by soft reset */ uint32_t _reserved5[24]; /* 0x980 */ -- 2.43.0
