]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[realtek] Add ability to dump all internal registers
authorMichael Brown <mcb30@ipxe.org>
Fri, 14 Mar 2014 12:46:23 +0000 (12:46 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 20 Mar 2014 12:36:14 +0000 (12:36 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/realtek.c

index 41f4ec23b354c804d4e508964f69952e6bd4c4d8..7c6f86895b83417a2e787252d9e81b0b6810587b 100644 (file)
@@ -48,6 +48,33 @@ FILE_LICENCE ( GPL2_OR_LATER );
  *    http://www.datasheetarchive.com/indexdl/Datasheet-028/DSA00494723.pdf
  */
 
+/******************************************************************************
+ *
+ * Debugging
+ *
+ ******************************************************************************
+ */
+
+/**
+ * Dump all registers (for debugging)
+ *
+ * @v rtl              Realtek device
+ */
+static __attribute__ (( unused )) void realtek_dump ( struct realtek_nic *rtl ){
+       uint8_t regs[256];
+       unsigned int i;
+
+       /* Do nothing unless debug output is enabled */
+       if ( ! DBG_LOG )
+               return;
+
+       /* Dump registers (via byte accesses; may not work for all registers) */
+       for ( i = 0 ; i < sizeof ( regs ) ; i++ )
+               regs[i] = readb ( rtl->regs + i );
+       DBGC ( rtl, "REALTEK %p register dump:\n", rtl );
+       DBGC_HDA ( rtl, 0, regs, sizeof ( regs ) );
+}
+
 /******************************************************************************
  *
  * EEPROM interface