Browse Source

[rtl8139] Split debug messages into DBGLVL_LOG and DBGLVL_EXTRA

tags/v0.9.8
Michael Brown 15 years ago
parent
commit
ded4d3a703
1 changed files with 18 additions and 13 deletions
  1. 18
    13
      src/drivers/net/rtl8139.c

+ 18
- 13
src/drivers/net/rtl8139.c View File

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

Loading…
Cancel
Save