Просмотр исходного кода

[realtek] Include link status register details in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 лет назад
Родитель
Сommit
ac5c2e851b
2 измененных файлов: 39 добавлений и 2 удалений
  1. 26
    2
      src/drivers/net/realtek.c
  2. 13
    0
      src/drivers/net/realtek.h

+ 26
- 2
src/drivers/net/realtek.c Просмотреть файл

@@ -415,11 +415,35 @@ static void realtek_check_link ( struct net_device *netdev ) {
415 415
 	if ( rtl->have_phy_regs ) {
416 416
 		phystatus = readb ( rtl->regs + RTL_PHYSTATUS );
417 417
 		link_up = ( phystatus & RTL_PHYSTATUS_LINKSTS );
418
-		DBGC ( rtl, "REALTEK %p PHY status is %02x\n", rtl, phystatus );
418
+		DBGC ( rtl, "REALTEK %p PHY status is %02x (%s%s%s%s%s%s, "
419
+		       "Link%s, %sDuplex)\n", rtl, phystatus,
420
+		       ( ( phystatus & RTL_PHYSTATUS_ENTBI ) ? "TBI" : "GMII" ),
421
+		       ( ( phystatus & RTL_PHYSTATUS_TXFLOW ) ?
422
+			 ", TxFlow" : "" ),
423
+		       ( ( phystatus & RTL_PHYSTATUS_RXFLOW ) ?
424
+			 ", RxFlow" : "" ),
425
+		       ( ( phystatus & RTL_PHYSTATUS_1000MF ) ?
426
+			 ", 1000Mbps" : "" ),
427
+		       ( ( phystatus & RTL_PHYSTATUS_100M ) ?
428
+			 ", 100Mbps" : "" ),
429
+		       ( ( phystatus & RTL_PHYSTATUS_10M ) ?
430
+			 ", 10Mbps" : "" ),
431
+		       ( ( phystatus & RTL_PHYSTATUS_LINKSTS ) ?
432
+			 "Up" : "Down" ),
433
+		       ( ( phystatus & RTL_PHYSTATUS_FULLDUP ) ?
434
+			 "Full" : "Half" ) );
419 435
 	} else {
420 436
 		msr = readb ( rtl->regs + RTL_MSR );
421 437
 		link_up = ( ! ( msr & RTL_MSR_LINKB ) );
422
-		DBGC ( rtl, "REALTEK %p media status is %02x\n", rtl, msr );
438
+		DBGC ( rtl, "REALTEK %p media status is %02x (Link%s, "
439
+		       "%dMbps%s%s%s%s%s)\n", rtl, msr,
440
+		       ( ( msr & RTL_MSR_LINKB ) ? "Down" : "Up" ),
441
+		       ( ( msr & RTL_MSR_SPEED_10 ) ? 10 : 100 ),
442
+		       ( ( msr & RTL_MSR_TXFCE ) ? ", TxFlow" : "" ),
443
+		       ( ( msr & RTL_MSR_RXFCE ) ? ", RxFlow" : "" ),
444
+		       ( ( msr & RTL_MSR_AUX_STATUS ) ? ", AuxPwr" : "" ),
445
+		       ( ( msr & RTL_MSR_TXPF ) ? ", TxPause" : "" ),
446
+		       ( ( msr & RTL_MSR_RXPF ) ? ", RxPause" : "" ) );
423 447
 	}
424 448
 
425 449
 	/* Report link state */

+ 13
- 0
src/drivers/net/realtek.h Просмотреть файл

@@ -187,7 +187,13 @@ enum realtek_legacy_status {
187 187
 
188 188
 /** Media Status Register (byte, 8139 only) */
189 189
 #define RTL_MSR 0x58
190
+#define RTL_MSR_TXFCE		0x80	/**< TX flow control enabled */
191
+#define RTL_MSR_RXFCE		0x40	/**< RX flow control enabled */
192
+#define RTL_MSR_AUX_STATUS	0x10	/**< Aux power present */
193
+#define RTL_MSR_SPEED_10	0x08	/**< 10Mbps */
190 194
 #define RTL_MSR_LINKB		0x04	/**< Inverse of link status */
195
+#define RTL_MSR_TXPF		0x02	/**< TX pause flag */
196
+#define RTL_MSR_RXPF		0x01	/**< RX pause flag */
191 197
 
192 198
 /** PHY Access Register (dword, 8169 only) */
193 199
 #define RTL_PHYAR 0x60
@@ -204,7 +210,14 @@ enum realtek_legacy_status {
204 210
 
205 211
 /** PHY (GMII, MII, or TBI) Status Register (byte, 8169 only) */
206 212
 #define RTL_PHYSTATUS 0x6c
213
+#define RTL_PHYSTATUS_ENTBI	0x80	/**< TBI / GMII mode */
214
+#define RTL_PHYSTATUS_TXFLOW	0x40	/**< TX flow control enabled */
215
+#define RTL_PHYSTATUS_RXFLOW	0x20	/**< RX flow control enabled */
216
+#define RTL_PHYSTATUS_1000MF	0x10	/**< 1000Mbps full-duplex */
217
+#define RTL_PHYSTATUS_100M	0x08	/**< 100Mbps */
218
+#define RTL_PHYSTATUS_10M	0x04	/**< 10Mbps */
207 219
 #define RTL_PHYSTATUS_LINKSTS	0x02	/**< Link ok */
220
+#define RTL_PHYSTATUS_FULLDUP	0x01	/**< Full duplex */
208 221
 
209 222
 /** Transmit Priority Polling Register (byte, 8139C+ only) */
210 223
 #define RTL_TPPOLL_8139CP 0xd9

Загрузка…
Отмена
Сохранить