aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRajesh Borundia <rajesh.borundia@qlogic.com>2014-08-18 09:31:54 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-21 20:43:15 -0400
commitd874df58ff2eefadd22623d4e53ff92e38117b40 (patch)
tree7c285dd4f8599451af20beeef78c7e7416a03d67 /drivers/net
parent26acc712526e9a8a849c819ffb8fe2d4e1f7c063 (diff)
qlcnic: Fix endianess issue in FW dump template header
Firmware dump template header is read from adapter using readl() which swaps the data. So, adjust structure element on the boundary of 32bit dword. Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
index e46fc39d425d..c9f57fb84b9e 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
@@ -47,15 +47,26 @@ struct qlcnic_common_entry_hdr {
47 u32 type; 47 u32 type;
48 u32 offset; 48 u32 offset;
49 u32 cap_size; 49 u32 cap_size;
50#if defined(__LITTLE_ENDIAN)
50 u8 mask; 51 u8 mask;
51 u8 rsvd[2]; 52 u8 rsvd[2];
52 u8 flags; 53 u8 flags;
54#else
55 u8 flags;
56 u8 rsvd[2];
57 u8 mask;
58#endif
53} __packed; 59} __packed;
54 60
55struct __crb { 61struct __crb {
56 u32 addr; 62 u32 addr;
63#if defined(__LITTLE_ENDIAN)
57 u8 stride; 64 u8 stride;
58 u8 rsvd1[3]; 65 u8 rsvd1[3];
66#else
67 u8 rsvd1[3];
68 u8 stride;
69#endif
59 u32 data_size; 70 u32 data_size;
60 u32 no_ops; 71 u32 no_ops;
61 u32 rsvd2[4]; 72 u32 rsvd2[4];
@@ -63,15 +74,28 @@ struct __crb {
63 74
64struct __ctrl { 75struct __ctrl {
65 u32 addr; 76 u32 addr;
77#if defined(__LITTLE_ENDIAN)
66 u8 stride; 78 u8 stride;
67 u8 index_a; 79 u8 index_a;
68 u16 timeout; 80 u16 timeout;
81#else
82 u16 timeout;
83 u8 index_a;
84 u8 stride;
85#endif
69 u32 data_size; 86 u32 data_size;
70 u32 no_ops; 87 u32 no_ops;
88#if defined(__LITTLE_ENDIAN)
71 u8 opcode; 89 u8 opcode;
72 u8 index_v; 90 u8 index_v;
73 u8 shl_val; 91 u8 shl_val;
74 u8 shr_val; 92 u8 shr_val;
93#else
94 u8 shr_val;
95 u8 shl_val;
96 u8 index_v;
97 u8 opcode;
98#endif
75 u32 val1; 99 u32 val1;
76 u32 val2; 100 u32 val2;
77 u32 val3; 101 u32 val3;
@@ -79,16 +103,27 @@ struct __ctrl {
79 103
80struct __cache { 104struct __cache {
81 u32 addr; 105 u32 addr;
106#if defined(__LITTLE_ENDIAN)
82 u16 stride; 107 u16 stride;
83 u16 init_tag_val; 108 u16 init_tag_val;
109#else
110 u16 init_tag_val;
111 u16 stride;
112#endif
84 u32 size; 113 u32 size;
85 u32 no_ops; 114 u32 no_ops;
86 u32 ctrl_addr; 115 u32 ctrl_addr;
87 u32 ctrl_val; 116 u32 ctrl_val;
88 u32 read_addr; 117 u32 read_addr;
118#if defined(__LITTLE_ENDIAN)
89 u8 read_addr_stride; 119 u8 read_addr_stride;
90 u8 read_addr_num; 120 u8 read_addr_num;
91 u8 rsvd1[2]; 121 u8 rsvd1[2];
122#else
123 u8 rsvd1[2];
124 u8 read_addr_num;
125 u8 read_addr_stride;
126#endif
92} __packed; 127} __packed;
93 128
94struct __ocm { 129struct __ocm {
@@ -122,23 +157,39 @@ struct __mux {
122 157
123struct __queue { 158struct __queue {
124 u32 sel_addr; 159 u32 sel_addr;
160#if defined(__LITTLE_ENDIAN)
125 u16 stride; 161 u16 stride;
126 u8 rsvd[2]; 162 u8 rsvd[2];
163#else
164 u8 rsvd[2];
165 u16 stride;
166#endif
127 u32 size; 167 u32 size;
128 u32 no_ops; 168 u32 no_ops;
129 u8 rsvd2[8]; 169 u8 rsvd2[8];
130 u32 read_addr; 170 u32 read_addr;
171#if defined(__LITTLE_ENDIAN)
131 u8 read_addr_stride; 172 u8 read_addr_stride;
132 u8 read_addr_cnt; 173 u8 read_addr_cnt;
133 u8 rsvd3[2]; 174 u8 rsvd3[2];
175#else
176 u8 rsvd3[2];
177 u8 read_addr_cnt;
178 u8 read_addr_stride;
179#endif
134} __packed; 180} __packed;
135 181
136struct __pollrd { 182struct __pollrd {
137 u32 sel_addr; 183 u32 sel_addr;
138 u32 read_addr; 184 u32 read_addr;
139 u32 sel_val; 185 u32 sel_val;
186#if defined(__LITTLE_ENDIAN)
140 u16 sel_val_stride; 187 u16 sel_val_stride;
141 u16 no_ops; 188 u16 no_ops;
189#else
190 u16 no_ops;
191 u16 sel_val_stride;
192#endif
142 u32 poll_wait; 193 u32 poll_wait;
143 u32 poll_mask; 194 u32 poll_mask;
144 u32 data_size; 195 u32 data_size;
@@ -153,9 +204,15 @@ struct __mux2 {
153 u32 no_ops; 204 u32 no_ops;
154 u32 sel_val_mask; 205 u32 sel_val_mask;
155 u32 read_addr; 206 u32 read_addr;
207#if defined(__LITTLE_ENDIAN)
156 u8 sel_val_stride; 208 u8 sel_val_stride;
157 u8 data_size; 209 u8 data_size;
158 u8 rsvd[2]; 210 u8 rsvd[2];
211#else
212 u8 rsvd[2];
213 u8 data_size;
214 u8 sel_val_stride;
215#endif
159} __packed; 216} __packed;
160 217
161struct __pollrdmwr { 218struct __pollrdmwr {