diff options
author | Michael Brown | 2014-03-10 13:21:54 +0100 |
---|---|---|
committer | Michael Brown | 2014-03-10 13:21:54 +0100 |
commit | 9d615539f0b450884dd8a090bc96dee604a6d008 (patch) | |
tree | afd9a70e31ea0ecb526403bf31bb41c61e92ad83 | |
parent | [http] Automatically retry request on a 503 Service Unavailable (diff) | |
download | ipxe-9d615539f0b450884dd8a090bc96dee604a6d008.tar.gz ipxe-9d615539f0b450884dd8a090bc96dee604a6d008.tar.xz ipxe-9d615539f0b450884dd8a090bc96dee604a6d008.zip |
[mii] Add mii_dump() to dump all MII registers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/include/ipxe/mii.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/include/ipxe/mii.h b/src/include/ipxe/mii.h index cf462418..f53ad4a6 100644 --- a/src/include/ipxe/mii.h +++ b/src/include/ipxe/mii.h @@ -78,6 +78,37 @@ mii_write ( struct mii_interface *mii, unsigned int reg, unsigned int data ) { return mii->op->write ( mii, reg, data ); } +/** + * Dump MII registers (for debugging) + * + * @v mii MII interface + */ +static inline void +mii_dump ( struct mii_interface *mii ) { + unsigned int i; + int data; + + /* Do nothing unless debug output is enabled */ + if ( ! DBG_LOG ) + return; + + /* Dump basic MII register set */ + for ( i = 0 ; i < 16 ; i++ ) { + if ( ( i % 8 ) == 0 ) { + DBGC ( mii, "MII %p registers %02x-%02x:", + mii, i, ( i + 7 ) ); + } + data = mii_read ( mii, i ); + if ( data >= 0 ) { + DBGC ( mii, " %04x", data ); + } else { + DBGC ( mii, " XXXX" ); + } + if ( ( i % 8 ) == 7 ) + DBGC ( mii, "\n" ); + } +} + /** Maximum time to wait for a reset, in milliseconds */ #define MII_RESET_MAX_WAIT_MS 500 |