|
16 | 16 | #define AQ_A2_FW_READ_TRY_MAX 1000
|
17 | 17 |
|
18 | 18 | #define hw_atl2_shared_buffer_write(HW, ITEM, VARIABLE) \
|
| 19 | +{\ |
| 20 | + BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \ |
| 21 | + sizeof(u32)) != 0,\ |
| 22 | + "Unaligned write " # ITEM);\ |
| 23 | + BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\ |
| 24 | + "Unaligned write length " # ITEM);\ |
19 | 25 | hw_atl2_mif_shared_buf_write(HW,\
|
20 | 26 | (offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
|
21 |
| - (u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32)) |
| 27 | + (u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32));\ |
| 28 | +} |
22 | 29 |
|
23 | 30 | #define hw_atl2_shared_buffer_get(HW, ITEM, VARIABLE) \
|
| 31 | +{\ |
| 32 | + BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \ |
| 33 | + sizeof(u32)) != 0,\ |
| 34 | + "Unaligned get " # ITEM);\ |
| 35 | + BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\ |
| 36 | + "Unaligned get length " # ITEM);\ |
24 | 37 | hw_atl2_mif_shared_buf_get(HW, \
|
25 | 38 | (offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
|
26 | 39 | (u32 *)&(VARIABLE), \
|
27 |
| - sizeof(VARIABLE) / sizeof(u32)) |
| 40 | + sizeof(VARIABLE) / sizeof(u32));\ |
| 41 | +} |
28 | 42 |
|
29 | 43 | /* This should never be used on non atomic fields,
|
30 | 44 | * treat any > u32 read as non atomic.
|
|
33 | 47 | {\
|
34 | 48 | BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \
|
35 | 49 | sizeof(u32)) != 0,\
|
36 |
| - "Non aligned read " # ITEM);\ |
| 50 | + "Unaligned read " # ITEM);\ |
| 51 | + BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\ |
| 52 | + "Unaligned read length " # ITEM);\ |
37 | 53 | BUILD_BUG_ON_MSG(sizeof(VARIABLE) > sizeof(u32),\
|
38 | 54 | "Non atomic read " # ITEM);\
|
39 | 55 | hw_atl2_mif_shared_buf_read(HW, \
|
|
42 | 58 | }
|
43 | 59 |
|
44 | 60 | #define hw_atl2_shared_buffer_read_safe(HW, ITEM, DATA) \
|
| 61 | +({\ |
| 62 | + BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \ |
| 63 | + sizeof(u32)) != 0,\ |
| 64 | + "Unaligned read_safe " # ITEM);\ |
| 65 | + BUILD_BUG_ON_MSG((sizeof(((struct fw_interface_out *)0)->ITEM) % \ |
| 66 | + sizeof(u32)) != 0,\ |
| 67 | + "Unaligned read_safe length " # ITEM);\ |
45 | 68 | hw_atl2_shared_buffer_read_block((HW), \
|
46 | 69 | (offsetof(struct fw_interface_out, ITEM) / sizeof(u32)),\
|
47 | 70 | sizeof(((struct fw_interface_out *)0)->ITEM) / sizeof(u32),\
|
48 |
| - (DATA)) |
| 71 | + (DATA));\ |
| 72 | +}) |
49 | 73 |
|
50 | 74 | static int hw_atl2_shared_buffer_read_block(struct aq_hw_s *self,
|
51 | 75 | u32 offset, u32 dwords, void *data)
|
|
0 commit comments