Kaynağa Gözat

[linda] Use standard readq() and writeq() implementations

This driver is the original source of the current readq() and writeq()
implementations for 32-bit iPXE.  Switch to using the now-centralised
definitions, to avoid including architecture-specific code in an
otherwise architecture-independent driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 yıl önce
ebeveyn
işleme
5229662b7f
1 değiştirilmiş dosya ile 8 ekleme ve 26 silme
  1. 8
    26
      src/drivers/infiniband/linda.c

+ 8
- 26
src/drivers/infiniband/linda.c Dosyayı Görüntüle

@@ -112,32 +112,21 @@ struct linda {
112 112
  * This card requires atomic 64-bit accesses.  Strange things happen
113 113
  * if you try to use 32-bit accesses; sometimes they work, sometimes
114 114
  * they don't, sometimes you get random data.
115
- *
116
- * These accessors use the "movq" MMX instruction, and so won't work
117
- * on really old Pentiums (which won't have PCIe anyway, so this is
118
- * something of a moot point).
119 115
  */
120 116
 
121 117
 /**
122 118
  * Read Linda qword register
123 119
  *
124 120
  * @v linda		Linda device
125
- * @v dwords		Register buffer to read into
121
+ * @v qword		Register buffer to read into
126 122
  * @v offset		Register offset
127 123
  */
128
-static void linda_readq ( struct linda *linda, uint32_t *dwords,
124
+static void linda_readq ( struct linda *linda, uint64_t *qword,
129 125
 			  unsigned long offset ) {
130
-	void *addr = ( linda->regs + offset );
131
-
132
-	__asm__ __volatile__ ( "movq (%1), %%mm0\n\t"
133
-			       "movq %%mm0, (%0)\n\t"
134
-			       : : "r" ( dwords ), "r" ( addr ) : "memory" );
135
-
136
-	DBGIO ( "[%08lx] => %08x%08x\n",
137
-		virt_to_phys ( addr ), dwords[1], dwords[0] );
126
+	*qword = readq ( linda->regs + offset );
138 127
 }
139 128
 #define linda_readq( _linda, _ptr, _offset ) \
140
-	linda_readq ( (_linda), (_ptr)->u.dwords, (_offset) )
129
+	linda_readq ( (_linda), (_ptr)->u.qwords, (_offset) )
141 130
 #define linda_readq_array8b( _linda, _ptr, _offset, _idx ) \
142 131
 	linda_readq ( (_linda), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )
143 132
 #define linda_readq_array64k( _linda, _ptr, _offset, _idx ) \
@@ -147,22 +136,15 @@ static void linda_readq ( struct linda *linda, uint32_t *dwords,
147 136
  * Write Linda qword register
148 137
  *
149 138
  * @v linda		Linda device
150
- * @v dwords		Register buffer to write
139
+ * @v qword		Register buffer to write
151 140
  * @v offset		Register offset
152 141
  */
153
-static void linda_writeq ( struct linda *linda, const uint32_t *dwords,
142
+static void linda_writeq ( struct linda *linda, const uint64_t *qword,
154 143
 			   unsigned long offset ) {
155
-	void *addr = ( linda->regs + offset );
156
-
157
-	DBGIO ( "[%08lx] <= %08x%08x\n",
158
-		virt_to_phys ( addr ), dwords[1], dwords[0] );
159
-
160
-	__asm__ __volatile__ ( "movq (%0), %%mm0\n\t"
161
-			       "movq %%mm0, (%1)\n\t"
162
-			       : : "r" ( dwords ), "r" ( addr ) : "memory" );
144
+	writeq ( *qword, ( linda->regs + offset ) );
163 145
 }
164 146
 #define linda_writeq( _linda, _ptr, _offset ) \
165
-	linda_writeq ( (_linda), (_ptr)->u.dwords, (_offset) )
147
+	linda_writeq ( (_linda), (_ptr)->u.qwords, (_offset) )
166 148
 #define linda_writeq_array8b( _linda, _ptr, _offset, _idx ) \
167 149
 	linda_writeq ( (_linda), (_ptr), ( (_offset) + ( (_idx) * 8 ) ) )
168 150
 #define linda_writeq_array64k( _linda, _ptr, _offset, _idx ) \

Loading…
İptal
Kaydet