Browse Source

[intel] Show original CTRL and STATUS values in debugging output

In situations where iPXE fails to reach link-up as expected, it is
useful to know the original values of the CTRL and STATUS registers
prior to our reset attempt.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
e6616da8b8
1 changed files with 12 additions and 4 deletions
  1. 12
    4
      src/drivers/net/intel.c

+ 12
- 4
src/drivers/net/intel.c View File

268
 	uint32_t pba;
268
 	uint32_t pba;
269
 	uint32_t ctrl;
269
 	uint32_t ctrl;
270
 	uint32_t status;
270
 	uint32_t status;
271
+	uint32_t orig_ctrl;
272
+	uint32_t orig_status;
273
+
274
+	/* Record initial control and status register values */
275
+	orig_ctrl = ctrl = readl ( intel->regs + INTEL_CTRL );
276
+	orig_status = readl ( intel->regs + INTEL_STATUS );
271
 
277
 
272
 	/* Force RX and TX packet buffer allocation, to work around an
278
 	/* Force RX and TX packet buffer allocation, to work around an
273
 	 * errata in ICH devices.
279
 	 * errata in ICH devices.
285
 	}
291
 	}
286
 
292
 
287
 	/* Always reset MAC.  Required to reset the TX and RX rings. */
293
 	/* Always reset MAC.  Required to reset the TX and RX rings. */
288
-	ctrl = readl ( intel->regs + INTEL_CTRL );
289
 	writel ( ( ctrl | INTEL_CTRL_RST ), intel->regs + INTEL_CTRL );
294
 	writel ( ( ctrl | INTEL_CTRL_RST ), intel->regs + INTEL_CTRL );
290
 	mdelay ( INTEL_RESET_DELAY_MS );
295
 	mdelay ( INTEL_RESET_DELAY_MS );
291
 
296
 
309
 	status = readl ( intel->regs + INTEL_STATUS );
314
 	status = readl ( intel->regs + INTEL_STATUS );
310
 	if ( ( intel->flags & INTEL_NO_PHY_RST ) ||
315
 	if ( ( intel->flags & INTEL_NO_PHY_RST ) ||
311
 	     ( status & INTEL_STATUS_LU ) ) {
316
 	     ( status & INTEL_STATUS_LU ) ) {
312
-		DBGC ( intel, "INTEL %p %sMAC reset (ctrl %08x)\n", intel,
317
+		DBGC ( intel, "INTEL %p %sMAC reset (%08x/%08x was "
318
+		       "%08x/%08x)\n", intel,
313
 		       ( ( intel->flags & INTEL_NO_PHY_RST ) ? "forced " : "" ),
319
 		       ( ( intel->flags & INTEL_NO_PHY_RST ) ? "forced " : "" ),
314
-		       ctrl );
320
+		       ctrl, status, orig_ctrl, orig_status );
315
 		return 0;
321
 		return 0;
316
 	}
322
 	}
317
 
323
 
323
 	/* PHY reset is not self-clearing on all models */
329
 	/* PHY reset is not self-clearing on all models */
324
 	writel ( ctrl, intel->regs + INTEL_CTRL );
330
 	writel ( ctrl, intel->regs + INTEL_CTRL );
325
 	mdelay ( INTEL_RESET_DELAY_MS );
331
 	mdelay ( INTEL_RESET_DELAY_MS );
332
+	status = readl ( intel->regs + INTEL_STATUS );
326
 
333
 
327
-	DBGC ( intel, "INTEL %p MAC+PHY reset (ctrl %08x)\n", intel, ctrl );
334
+	DBGC ( intel, "INTEL %p MAC+PHY reset (%08x/%08x was %08x/%08x)\n",
335
+	       intel, ctrl, status, orig_ctrl, orig_status );
328
 	return 0;
336
 	return 0;
329
 }
337
 }
330
 
338
 

Loading…
Cancel
Save