|
@@ -137,32 +137,21 @@ struct qib7322 {
|
137
|
137
|
* This card requires atomic 64-bit accesses. Strange things happen
|
138
|
138
|
* if you try to use 32-bit accesses; sometimes they work, sometimes
|
139
|
139
|
* they don't, sometimes you get random data.
|
140
|
|
- *
|
141
|
|
- * These accessors use the "movq" MMX instruction, and so won't work
|
142
|
|
- * on really old Pentiums (which won't have PCIe anyway, so this is
|
143
|
|
- * something of a moot point).
|
144
|
140
|
*/
|
145
|
141
|
|
146
|
142
|
/**
|
147
|
143
|
* Read QIB7322 qword register
|
148
|
144
|
*
|
149
|
145
|
* @v qib7322 QIB7322 device
|
150
|
|
- * @v dwords Register buffer to read into
|
|
146
|
+ * @v qword Register buffer to read into
|
151
|
147
|
* @v offset Register offset
|
152
|
148
|
*/
|
153
|
|
-static void qib7322_readq ( struct qib7322 *qib7322, uint32_t *dwords,
|
|
149
|
+static void qib7322_readq ( struct qib7322 *qib7322, uint64_t *qword,
|
154
|
150
|
unsigned long offset ) {
|
155
|
|
- void *addr = ( qib7322->regs + offset );
|
156
|
|
-
|
157
|
|
- __asm__ __volatile__ ( "movq (%1), %%mm0\n\t"
|
158
|
|
- "movq %%mm0, (%0)\n\t"
|
159
|
|
- : : "r" ( dwords ), "r" ( addr ) : "memory" );
|
160
|
|
-
|
161
|
|
- DBGIO ( "[%08lx] => %08x%08x\n",
|
162
|
|
- virt_to_phys ( addr ), dwords[1], dwords[0] );
|
|
151
|
+ *qword = readq ( qib7322->regs + offset );
|
163
|
152
|
}
|
164
|
153
|
#define qib7322_readq( _qib7322, _ptr, _offset ) \
|
165
|
|
- qib7322_readq ( (_qib7322), (_ptr)->u.dwords, (_offset) )
|
|
154
|
+ qib7322_readq ( (_qib7322), (_ptr)->u.qwords, (_offset) )
|
166
|
155
|
#define qib7322_readq_array8b( _qib7322, _ptr, _offset, _idx ) \
|
167
|
156
|
qib7322_readq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )
|
168
|
157
|
#define qib7322_readq_array64k( _qib7322, _ptr, _offset, _idx ) \
|
|
@@ -174,22 +163,15 @@ static void qib7322_readq ( struct qib7322 *qib7322, uint32_t *dwords,
|
174
|
163
|
* Write QIB7322 qword register
|
175
|
164
|
*
|
176
|
165
|
* @v qib7322 QIB7322 device
|
177
|
|
- * @v dwords Register buffer to write
|
|
166
|
+ * @v qword Register buffer to write
|
178
|
167
|
* @v offset Register offset
|
179
|
168
|
*/
|
180
|
|
-static void qib7322_writeq ( struct qib7322 *qib7322, const uint32_t *dwords,
|
|
169
|
+static void qib7322_writeq ( struct qib7322 *qib7322, const uint64_t *qword,
|
181
|
170
|
unsigned long offset ) {
|
182
|
|
- void *addr = ( qib7322->regs + offset );
|
183
|
|
-
|
184
|
|
- DBGIO ( "[%08lx] <= %08x%08x\n",
|
185
|
|
- virt_to_phys ( addr ), dwords[1], dwords[0] );
|
186
|
|
-
|
187
|
|
- __asm__ __volatile__ ( "movq (%0), %%mm0\n\t"
|
188
|
|
- "movq %%mm0, (%1)\n\t"
|
189
|
|
- : : "r" ( dwords ), "r" ( addr ) : "memory" );
|
|
171
|
+ writeq ( *qword, ( qib7322->regs + offset ) );
|
190
|
172
|
}
|
191
|
173
|
#define qib7322_writeq( _qib7322, _ptr, _offset ) \
|
192
|
|
- qib7322_writeq ( (_qib7322), (_ptr)->u.dwords, (_offset) )
|
|
174
|
+ qib7322_writeq ( (_qib7322), (_ptr)->u.qwords, (_offset) )
|
193
|
175
|
#define qib7322_writeq_array8b( _qib7322, _ptr, _offset, _idx ) \
|
194
|
176
|
qib7322_writeq ( (_qib7322), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )
|
195
|
177
|
#define qib7322_writeq_array64k( _qib7322, _ptr, _offset, _idx ) \
|