Browse Source

[ns83820] Update to standard debugging infrastructure

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
fde62b235f
1 changed files with 19 additions and 26 deletions
  1. 19
    26
      src/drivers/net/ns83820.c

+ 19
- 26
src/drivers/net/ns83820.c View File

48
 #define USE_64BIT_ADDR
48
 #define USE_64BIT_ADDR
49
 #endif
49
 #endif
50
 
50
 
51
-//#define DDEBUG
52
-#ifdef DDEBUG
53
-#define dprintf(x) printf x
54
-#else
55
-#define dprintf(x)
56
-#endif
57
-
58
 #define HZ 100
51
 #define HZ 100
59
 
52
 
60
 /* Condensed operations for readability. */
53
 /* Condensed operations for readability. */
322
 #define __kick_rx()	writel(CR_RXE, ns->base + CR)
315
 #define __kick_rx()	writel(CR_RXE, ns->base + CR)
323
 
316
 
324
 #define kick_rx() do { \
317
 #define kick_rx() do { \
325
-	dprintf(("kick_rx: maybe kicking\n")); \
318
+	DBG("kick_rx: maybe kicking\n"); \
326
 		writel(virt_to_le32desc(&rx_ring[ns->cur_rx]), ns->base + RXDP); \
319
 		writel(virt_to_le32desc(&rx_ring[ns->cur_rx]), ns->base + RXDP); \
327
 		if (ns->next_rx == ns->next_empty) \
320
 		if (ns->next_rx == ns->next_empty) \
328
 			printf("uh-oh: next_rx == next_empty???\n"); \
321
 			printf("uh-oh: next_rx == next_empty???\n"); \
415
 		tbisr = readl(ns->base + TBISR);
408
 		tbisr = readl(ns->base + TBISR);
416
 		tanar = readl(ns->base + TANAR);
409
 		tanar = readl(ns->base + TANAR);
417
 		tanlpar = readl(ns->base + TANLPAR);
410
 		tanlpar = readl(ns->base + TANLPAR);
418
-		dprintf(("phy_intr: tbisr=%hX, tanar=%hX, tanlpar=%hX\n",
419
-			 tbisr, tanar, tanlpar));
411
+		DBG("phy_intr: tbisr=%hX, tanar=%hX, tanlpar=%hX\n",
412
+		    tbisr, tanar, tanlpar);
420
 
413
 
421
 		if ((fullduplex = (tanlpar & TANAR_FULL_DUP)
414
 		if ((fullduplex = (tanlpar & TANAR_FULL_DUP)
422
 		     && (tanar & TANAR_FULL_DUP))) {
415
 		     && (tanar & TANAR_FULL_DUP))) {
511
 	writel(0, ns->base + RXDP_HI);
504
 	writel(0, ns->base + RXDP_HI);
512
 	writel(virt_to_le32desc(&rx_ring[0]), ns->base + RXDP);
505
 	writel(virt_to_le32desc(&rx_ring[0]), ns->base + RXDP);
513
 
506
 
514
-	dprintf(("starting receiver\n"));
507
+	DBG("starting receiver\n");
515
 
508
 
516
 	writel(0x0001, ns->base + CCSR);
509
 	writel(0x0001, ns->base + CCSR);
517
 	writel(0, ns->base + RFCR);
510
 	writel(0, ns->base + RFCR);
544
 
537
 
545
 static void ns83820_do_reset(struct nic *nic __unused, u32 which)
538
 static void ns83820_do_reset(struct nic *nic __unused, u32 which)
546
 {
539
 {
547
-	dprintf(("resetting chip...\n"));
540
+	DBG("resetting chip...\n");
548
 	writel(which, ns->base + CR);
541
 	writel(which, ns->base + CR);
549
 	do {
542
 	do {
550
 
543
 
551
 	} while (readl(ns->base + CR) & which);
544
 	} while (readl(ns->base + CR) & which);
552
-	dprintf(("okay!\n"));
545
+	DBG("okay!\n");
553
 }
546
 }
554
 
547
 
555
 static void ns83820_reset(struct nic *nic)
548
 static void ns83820_reset(struct nic *nic)
556
 {
549
 {
557
 	unsigned i;
550
 	unsigned i;
558
-	dprintf(("ns83820_reset\n"));
551
+	DBG("ns83820_reset\n");
559
 
552
 
560
 	writel(0, ns->base + PQCR);
553
 	writel(0, ns->base + PQCR);
561
 
554
 
612
 	u32 status;
605
 	u32 status;
613
 	int loops = 0;
606
 	int loops = 0;
614
 
607
 
615
-	dprintf(("start %s\n", name))
608
+	DBG("start %s\n", name);
616
 
609
 
617
 	    start = currticks();
610
 	    start = currticks();
618
 
611
 
637
 		 (unsigned int) fail);
630
 		 (unsigned int) fail);
638
 	else if (timed_out)
631
 	else if (timed_out)
639
 		printf("run_bist %s timed out! (%hX)\n", name, (unsigned int) status);
632
 		printf("run_bist %s timed out! (%hX)\n", name, (unsigned int) status);
640
-	dprintf(("done %s in %d loops\n", name, loops));
633
+	DBG("done %s in %d loops\n", name, loops);
641
 }
634
 }
642
 
635
 
643
 /*************************************
636
 /*************************************
697
 
690
 
698
 static inline void kick_tx(struct nic *nic __unused)
691
 static inline void kick_tx(struct nic *nic __unused)
699
 {
692
 {
700
-	dprintf(("kick_tx\n"));
693
+	DBG("kick_tx\n");
701
 	writel(CR_TXE, ns->base + CR);
694
 	writel(CR_TXE, ns->base + CR);
702
 }
695
 }
703
 
696
 
897
 
890
 
898
 	/* setup optical transceiver if we have one */
891
 	/* setup optical transceiver if we have one */
899
 	if (ns->CFG_cache & CFG_TBI_EN) {
892
 	if (ns->CFG_cache & CFG_TBI_EN) {
900
-		dprintf(("%s: enabling optical transceiver\n", pci->driver_name));
893
+		DBG("%s: enabling optical transceiver\n", pci->id->name);
901
 		writel(readl(ns->base + GPIOR) | 0x3e8, ns->base + GPIOR);
894
 		writel(readl(ns->base + GPIOR) | 0x3e8, ns->base + GPIOR);
902
 
895
 
903
 		/* setup auto negotiation feature advertisement */
896
 		/* setup auto negotiation feature advertisement */
914
 		ns->CFG_cache |= CFG_MODE_1000;
907
 		ns->CFG_cache |= CFG_MODE_1000;
915
 	}
908
 	}
916
 	writel(ns->CFG_cache, ns->base + CFG);
909
 	writel(ns->CFG_cache, ns->base + CFG);
917
-	dprintf(("CFG: %hX\n", ns->CFG_cache));
910
+	DBG("CFG: %hX\n", ns->CFG_cache);
918
 
911
 
919
 	/* FIXME: reset_phy is defaulted to 0, should we reset anyway? */
912
 	/* FIXME: reset_phy is defaulted to 0, should we reset anyway? */
920
 	if (reset_phy) {
913
 	if (reset_phy) {
921
-		dprintf(("%s: resetting phy\n", pci->driver_name));
914
+		DBG("%s: resetting phy\n", pci->id->name);
922
 		writel(ns->CFG_cache | CFG_PHY_RST, ns->base + CFG);
915
 		writel(ns->CFG_cache | CFG_PHY_RST, ns->base + CFG);
923
 		writel(ns->CFG_cache, ns->base + CFG);
916
 		writel(ns->CFG_cache, ns->base + CFG);
924
 	}
917
 	}
983
 	ns83820_getmac(nic, nic->node_addr);
976
 	ns83820_getmac(nic, nic->node_addr);
984
 
977
 
985
 	if (using_dac) {
978
 	if (using_dac) {
986
-		dprintf(("%s: using 64 bit addressing.\n", pci->driver_name));
979
+		DBG("%s: using 64 bit addressing.\n", pci->id->name);
987
 	}
980
 	}
988
 
981
 
989
-	dprintf(("%s: DP83820 %d.%d: %! io=0x%hX\n",
990
-		 pci->driver_name,
991
-		 (unsigned) readl(ns->base + SRR) >> 8,
992
-		 (unsigned) readl(ns->base + SRR) & 0xff,
993
-		 nic->node_addr, pci->ioaddr));
982
+	DBG("%s: DP83820 %d.%d: io=%#04lx\n",
983
+	    pci->id->name,
984
+	    (unsigned) readl(ns->base + SRR) >> 8,
985
+	    (unsigned) readl(ns->base + SRR) & 0xff,
986
+	    pci->ioaddr);
994
 
987
 
995
 #ifdef PHY_CODE_IS_FINISHED
988
 #ifdef PHY_CODE_IS_FINISHED
996
 	ns83820_probe_phy(dev);
989
 	ns83820_probe_phy(dev);

Loading…
Cancel
Save