Project

General

Profile

Bug #8870 » 0001-Explicitly-treat-timeouts-when-waiting-for-IBF-or-OB.patch

Benjamin MONTHOUËL, 2017-11-30 09:33 AM

View differences:

sys/dev/ipmi/ipmi_kcs.c
184 184
	for (retry = 0; retry < 10; retry++) {
185 185
		/* Wait for IBF = 0 */
186 186
		status = kcs_wait_for_ibf(sc, 0);
187
		if (status & KCS_STATUS_IBF)
188
			return (0);
187 189

  
188 190
		/* Clear OBF */
189 191
		kcs_clear_obf(sc, status);
......
193 195

  
194 196
		/* Wait for IBF = 0 */
195 197
		status = kcs_wait_for_ibf(sc, 0);
198
		if (status & KCS_STATUS_IBF)
199
			return (0);
200

  
196 201
		if (KCS_STATUS_STATE(status) == KCS_STATUS_STATE_WRITE)
197 202
			break;
198 203
		DELAY(1000000);
......
222 227

  
223 228
	/* Wait for IBF = 0 */
224 229
	status = kcs_wait_for_ibf(sc, 0);
230
	if (status & KCS_STATUS_IBF)
231
		return (0);
225 232

  
226 233
	if (KCS_STATUS_STATE(status) != KCS_STATUS_STATE_WRITE)
227 234
		return (0);
......
244 251

  
245 252
	/* Wait for IBF = 0 */
246 253
	status = kcs_wait_for_ibf(sc, 0);
254
	if (status & KCS_STATUS_IBF)
255
		return (0);
247 256

  
248 257
	if (KCS_STATUS_STATE(status) != KCS_STATUS_STATE_WRITE)
249 258
		/* error state */
......
274 283

  
275 284
		/* Wait for OBF = 1 */
276 285
		status = kcs_wait_for_obf(sc, 1);
286
		if ((status & KCS_STATUS_OBF) == 0)
287
			return (0);
277 288

  
278 289
		/* Read Data_out */
279 290
		*data = INB(sc, KCS_DATA);
......
288 299

  
289 300
		/* Wait for OBF = 1*/
290 301
		status = kcs_wait_for_obf(sc, 1);
302
		if ((status & KCS_STATUS_OBF) == 0)
303
			return (0);
291 304

  
292 305
		/* Read Dummy */
293 306
		dummy = INB(sc, KCS_DATA);
294
- 
(3-3/3)