浏览代码

[rtl8139] Split debug messages into DBGLVL_LOG and DBGLVL_EXTRA

tags/v0.9.8
Michael Brown 15 年前
父节点
当前提交
ded4d3a703
共有 1 个文件被更改,包括 18 次插入13 次删除
  1. 18
    13
      src/drivers/net/rtl8139.c

+ 18
- 13
src/drivers/net/rtl8139.c 查看文件

@@ -279,10 +279,10 @@ static void rtl_init_eeprom ( struct net_device *netdev ) {
279 279
 	/* Detect EEPROM type and initialise three-wire device */
280 280
 	ee9356 = ( inw ( rtl->ioaddr + RxConfig ) & Eeprom9356 );
281 281
 	if ( ee9356 ) {
282
-		DBG ( "EEPROM is an AT93C56\n" );
282
+		DBGC ( rtl, "rtl8139 %p EEPROM is an AT93C56\n", rtl );
283 283
 		init_at93c56 ( &rtl->eeprom, 16 );
284 284
 	} else {
285
-		DBG ( "EEPROM is an AT93C46\n" );
285
+		DBGC ( rtl, "rtl8139 %p EEPROM is an AT93C46\n", rtl );
286 286
 		init_at93c46 ( &rtl->eeprom, 16 );
287 287
 	}
288 288
 	rtl->eeprom.bus = &rtl->spibit.bus;
@@ -290,7 +290,8 @@ static void rtl_init_eeprom ( struct net_device *netdev ) {
290 290
 	/* Initialise space for non-volatile options, if available */
291 291
 	vpd = ( inw ( rtl->ioaddr + Config1 ) & VPDEnable );
292 292
 	if ( vpd ) {
293
-		DBG ( "EEPROM in use for VPD; cannot use for options\n" );
293
+		DBGC ( rtl, "rtl8139 %p EEPROM in use for VPD; cannot use "
294
+		       "for options\n", rtl );
294 295
 	} else {
295 296
 		nvo_init ( &rtl->nvo, &rtl->eeprom.nvs, rtl_nvo_fragments,
296 297
 			   &netdev->refcnt );
@@ -333,7 +334,8 @@ static int rtl_open ( struct net_device *netdev ) {
333 334
 	if ( ! rtl->rx.ring )
334 335
 		return -ENOMEM;
335 336
 	outl ( virt_to_bus ( rtl->rx.ring ), rtl->ioaddr + RxBuf );
336
-	DBG ( "RX ring at %lx\n", virt_to_bus ( rtl->rx.ring ) );
337
+	DBGC ( rtl, "rtl8139 %p RX ring at %lx\n",
338
+	       rtl, virt_to_bus ( rtl->rx.ring ) );
337 339
 
338 340
 	/* Enable TX and RX */
339 341
 	outb ( ( CmdRxEnb | CmdTxEnb ), rtl->ioaddr + ChipCmd );
@@ -377,7 +379,7 @@ static int rtl_transmit ( struct net_device *netdev,
377 379
 
378 380
 	/* Check for space in TX ring */
379 381
 	if ( rtl->tx.iobuf[rtl->tx.next] != NULL ) {
380
-		DBG ( "TX overflow\n" );
382
+		DBGC ( rtl, "rtl8139 %p TX overflow\n", rtl );
381 383
 		return -ENOBUFS;
382 384
 	}
383 385
 
@@ -385,8 +387,8 @@ static int rtl_transmit ( struct net_device *netdev,
385 387
 	iob_pad ( iobuf, ETH_ZLEN );
386 388
 
387 389
 	/* Add to TX ring */
388
-	DBG ( "TX id %d at %lx+%zx\n", rtl->tx.next,
389
-	      virt_to_bus ( iobuf->data ), iob_len ( iobuf ) );
390
+	DBGC2 ( rtl, "rtl8139 %p TX id %d at %lx+%zx\n", rtl, rtl->tx.next,
391
+		virt_to_bus ( iobuf->data ), iob_len ( iobuf ) );
390 392
 	rtl->tx.iobuf[rtl->tx.next] = iobuf;
391 393
 	outl ( virt_to_bus ( iobuf->data ),
392 394
 	       rtl->ioaddr + TxAddr0 + 4 * rtl->tx.next );
@@ -422,7 +424,8 @@ static void rtl_poll ( struct net_device *netdev ) {
422 424
 	tsad = inw ( rtl->ioaddr + TxSummary );
423 425
 	for ( i = 0 ; i < TX_RING_SIZE ; i++ ) {
424 426
 		if ( ( rtl->tx.iobuf[i] != NULL ) && ( tsad & ( 1 << i ) ) ) {
425
-			DBG ( "TX id %d complete\n", i );
427
+			DBGC2 ( rtl, "rtl8139 %p TX id %d complete\n",
428
+				rtl, i );
426 429
 			netdev_tx_complete ( netdev, rtl->tx.iobuf[i] );
427 430
 			rtl->tx.iobuf[i] = NULL;
428 431
 		}
@@ -435,8 +438,8 @@ static void rtl_poll ( struct net_device *netdev ) {
435 438
 		rx_len = * ( ( uint16_t * )
436 439
 			     ( rtl->rx.ring + rtl->rx.offset + 2 ) );
437 440
 		if ( rx_status & RxOK ) {
438
-			DBG ( "RX packet at offset %x+%x\n", rtl->rx.offset,
439
-			      rx_len );
441
+			DBGC2 ( rtl, "rtl8139 %p RX packet at offset "
442
+				"%x+%x\n", rtl, rtl->rx.offset, rx_len );
440 443
 
441 444
 			rx_iob = alloc_iob ( rx_len );
442 445
 			if ( ! rx_iob ) {
@@ -458,8 +461,8 @@ static void rtl_poll ( struct net_device *netdev ) {
458 461
 
459 462
 			netdev_rx ( netdev, rx_iob );
460 463
 		} else {
461
-			DBG ( "RX bad packet (status %#04x len %d)\n",
462
-			      rx_status, rx_len );
464
+			DBGC ( rtl, "rtl8139 %p RX bad packet (status %#04x "
465
+			       "len %d)\n", rtl, rx_status, rx_len );
463 466
 			netdev_rx_err ( netdev, NULL, -EINVAL );
464 467
 		}
465 468
 		rtl->rx.offset = ( ( ( rtl->rx.offset + 4 + rx_len + 3 ) & ~3 )
@@ -476,7 +479,9 @@ static void rtl_poll ( struct net_device *netdev ) {
476 479
  */
477 480
 static void rtl_irq ( struct net_device *netdev, int enable ) {
478 481
 	struct rtl8139_nic *rtl = netdev->priv;
479
-	
482
+
483
+	DBGC ( rtl, "rtl8139 %p interrupts %s\n",
484
+	       rtl, ( enable ? "enabled" : "disabled" ) );
480 485
 	outw ( ( enable ? ( ROK | RER | TOK | TER ) : 0 ),
481 486
 	       rtl->ioaddr + IntrMask );
482 487
 }

正在加载...
取消
保存