Browse Source

Finished by hand

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
9848135950

+ 19
- 15
src/drivers/net/natsemi.c View File

@@ -181,6 +181,9 @@ enum desc_status_bits {
181 181
 
182 182
 /* Globals */
183 183
 
184
+static struct nic_operations natsemi_operations;
185
+static struct pci_driver natsemi_driver;
186
+
184 187
 static int natsemi_debug = 1;			/* 1 normal messages, 0 quiet .. 7 verbose. */
185 188
 
186 189
 const char *nic_name;
@@ -248,31 +251,32 @@ natsemi_probe ( struct dev *dev ) {
248 251
     int i;
249 252
     int prev_eedata;
250 253
     u32 tmp;
254
+    
255
+    if ( ! find_pci_device ( pci, &natsemi_driver ) )
256
+	return 0;
251 257
 
252 258
     if (pci->ioaddr == 0)
253 259
         return 0;
254 260
 
255
-    adjust_pci_device(pci);
256
-
257 261
     /* initialize some commonly used globals */
258 262
 	
259 263
     nic->irqno  = 0;
260
-    nic->ioaddr = pci->ioaddr & ~3;
264
+    nic->ioaddr = pci->ioaddr;
261 265
 
262
-    ioaddr     = pci->ioaddr & ~3;
266
+    ioaddr     = pci->ioaddr;
263 267
     vendor     = pci->vendor;
264 268
     dev_id     = pci->dev_id;
265
-    nic_name   = pci->name;
269
+    nic_name   = dev->name;
266 270
 
267 271
     /* natsemi has a non-standard PM control register
268 272
      * in PCI config space.  Some boards apparently need
269 273
      * to be brought to D0 in this manner.
270 274
      */
271
-    pcibios_read_config_dword(pci->bus, pci->devfn, PCIPM, &tmp);
275
+    pci_read_config_dword(pci, PCIPM, &tmp);
272 276
     if (tmp & (0x03|0x100)) {
273 277
 	/* D0 state, disable PME assertion */
274 278
 	u32 newtmp = tmp & ~(0x03|0x100);
275
-	pcibios_write_config_dword(pci->bus, pci->devfn, PCIPM, newtmp);
279
+	pci_write_config_dword(pci, PCIPM, newtmp);
276 280
     }
277 281
 
278 282
     /* get MAC address */
@@ -316,14 +320,6 @@ natsemi_probe ( struct dev *dev ) {
316 320
 
317 321
     /* initialize device */
318 322
     natsemi_init(nic);
319
-static struct nic_operations natsemi_operations;
320
-static struct nic_operations natsemi_operations = {
321
-	.connect	= dummy_connect,
322
-	.poll		= natsemi_poll,
323
-	.transmit	= natsemi_transmit,
324
-	.irq		= natsemi_irq,
325
-	.disable	= natsemi_disable,
326
-};
327 323
     nic->nic_op	= &natsemi_operations;
328 324
 
329 325
     return 1;
@@ -770,6 +766,14 @@ natsemi_irq(struct nic *nic __unused, irq_action_t action __unused)
770 766
   }
771 767
 }
772 768
 
769
+static struct nic_operations natsemi_operations = {
770
+	.connect	= dummy_connect,
771
+	.poll		= natsemi_poll,
772
+	.transmit	= natsemi_transmit,
773
+	.irq		= natsemi_irq,
774
+	.disable	= natsemi_disable,
775
+};
776
+
773 777
 static struct pci_id natsemi_nics[] = {
774 778
 PCI_ROM(0x100b, 0x0020, "dp83815", "DP83815"),
775 779
 };

+ 23
- 21
src/drivers/net/ns83820.c View File

@@ -774,7 +774,7 @@ static void ns83820_disable ( struct nic *nic ) {
774 774
 
775 775
 	ns->up = 0;
776 776
 
777
-	ns83820_do_reset((struct nic *) dev, CR_RST);
777
+	ns83820_do_reset(nic, CR_RST);
778 778
 
779 779
 	ns->IMR_cache &=
780 780
 	    ~(ISR_RXOK | ISR_RXDESC | ISR_RXERR | ISR_RXEARLY |
@@ -804,6 +804,21 @@ static void ns83820_irq(struct nic *nic __unused, irq_action_t action __unused)
804 804
   }
805 805
 }
806 806
 
807
+static struct nic_operations ns83820_operations = {
808
+	.connect	= dummy_connect,
809
+	.poll		= ns83820_poll,
810
+	.transmit	= ns83820_transmit,
811
+	.irq		= ns83820_irq,
812
+	.disable	= ns83820_disable,
813
+};
814
+
815
+static struct pci_id ns83820_nics[] = {
816
+	PCI_ROM(0x100b, 0x0022, "ns83820", "National Semiconductor 83820"),
817
+};
818
+
819
+static struct pci_driver ns83820_driver =
820
+	PCI_DRIVER ( "NS83820/PCI", ns83820_nics, PCI_NO_CLASS );
821
+
807 822
 /**************************************************************************
808 823
 PROBE - Look for an adapter, this routine's visible to the outside
809 824
 ***************************************************************************/
@@ -811,19 +826,20 @@ PROBE - Look for an adapter, this routine's visible to the outside
811 826
 #define board_found 1
812 827
 #define valid_link 0
813 828
 static int ns83820_probe ( struct dev *dev ) {
814
-
815 829
 	struct nic *nic = nic_device ( dev );
816
-
817 830
 	struct pci_device *pci = pci_device ( dev );
818 831
 	int sz;
819 832
 	long addr;
820 833
 	int using_dac = 0;
821 834
 
835
+	if ( ! find_pci_device ( pci, &ns83820_driver ) )
836
+		return 0;
837
+
822 838
 	if (pci->ioaddr == 0)
823 839
 		return 0;
824 840
 
825 841
 	printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n",
826
-	       pci->name, pci->vendor, pci->dev_id);
842
+	       dev->name, pci->vendor, pci->dev_id);
827 843
 
828 844
 	/* point to private storage */
829 845
 	ns = &nsx;
@@ -863,12 +879,12 @@ static int ns83820_probe ( struct dev *dev ) {
863 879
 	ns->CFG_cache = readl(ns->base + CFG);
864 880
 
865 881
 	if ((ns->CFG_cache & CFG_PCI64_DET)) {
866
-		printf("%s: detected 64 bit PCI data bus.\n", pci->name);
882
+		printf("%s: detected 64 bit PCI data bus.\n", dev->name);
867 883
 		/*dev->CFG_cache |= CFG_DATA64_EN; */
868 884
 		if (!(ns->CFG_cache & CFG_DATA64_EN))
869 885
 			printf
870 886
 			    ("%s: EEPROM did not enable 64 bit bus.  Disabled.\n",
871
-			     pci->name);
887
+			     dev->name);
872 888
 	} else
873 889
 		ns->CFG_cache &= ~(CFG_DATA64_EN);
874 890
 
@@ -1000,22 +1016,8 @@ static int ns83820_probe ( struct dev *dev ) {
1000 1016
 
1001 1017
 	ns83820_reset(nic);
1002 1018
 	/* point to NIC specific routines */
1003
-static struct nic_operations ns83820_operations;
1004
-static struct nic_operations ns83820_operations = {
1005
-	.connect	= dummy_connect,
1006
-	.poll		= ns83820_poll,
1007
-	.transmit	= ns83820_transmit,
1008
-	.irq		= ns83820_irq,
1009
-	.disable	= ns83820_disable,
1010
-};	nic->nic_op	= &ns83820_operations;
1019
+	nic->nic_op	= &ns83820_operations;
1011 1020
 	return 1;
1012 1021
 }
1013 1022
 
1014
-static struct pci_id ns83820_nics[] = {
1015
-	PCI_ROM(0x100b, 0x0022, "ns83820", "National Semiconductor 83820"),
1016
-};
1017
-
1018
-static struct pci_driver ns83820_driver =
1019
-	PCI_DRIVER ( "NS83820/PCI", ns83820_nics, PCI_NO_CLASS );
1020
-
1021 1023
 BOOT_DRIVER ( "NS83820/PCI", ns83820_probe );

+ 17
- 13
src/drivers/net/pcnet32.c View File

@@ -62,6 +62,8 @@ typedef unsigned int u32;
62 62
 typedef signed int s32;
63 63
 
64 64
 static u32 ioaddr;		/* Globally used for the card's io address */
65
+static struct nic_operations pcnet32_operations;
66
+static struct pci_driver pcnet32_driver;
65 67
 
66 68
 #ifdef EDEBUG
67 69
 #define dprintf(x) printf x
@@ -665,9 +667,7 @@ PROBE - Look for an adapter, this routine's visible to the outside
665 667
 You should omit the last argument struct pci_device * for a non-PCI NIC
666 668
 ***************************************************************************/
667 669
 static int pcnet32_probe ( struct dev *dev ) {
668
-
669 670
 	struct nic *nic = nic_device ( dev );
670
-
671 671
 	struct pci_device *pci = pci_device ( dev );
672 672
 	int i, media;
673 673
 	int fdx, mii, fset, dxsuflo, ltint;
@@ -675,15 +675,18 @@ static int pcnet32_probe ( struct dev *dev ) {
675 675
 	char *chipname;
676 676
 	struct pcnet32_access *a = NULL;
677 677
 	u8 promaddr[6];
678
-
679 678
 	int shared = 1;
679
+
680
+	if ( ! find_pci_device ( pci, &pcnet32_driver ) )
681
+		return 0;
682
+
680 683
 	if (pci->ioaddr == 0)
681 684
 		return 0;
682 685
 
683 686
 	/* BASE is used throughout to address the card */
684 687
 	ioaddr = pci->ioaddr;
685 688
 	printf("pcnet32.c: Found %s, Vendor=0x%hX Device=0x%hX\n",
686
-	       pci->name, pci->vendor, pci->dev_id);
689
+	       dev->name, pci->vendor, pci->dev_id);
687 690
 
688 691
 	nic->irqno  = 0;
689 692
 	nic->ioaddr = pci->ioaddr & ~3;
@@ -801,7 +804,7 @@ static int pcnet32_probe ( struct dev *dev ) {
801 804
 		nic->node_addr[i] = promaddr[i];
802 805
 	}
803 806
 	/* Print out some hardware info */
804
-	printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr,
807
+	printf("%s: %! at ioaddr %hX, ", dev->name, nic->node_addr,
805 808
 	       ioaddr);
806 809
 
807 810
 	/* Set to pci bus master */
@@ -945,14 +948,7 @@ static int pcnet32_probe ( struct dev *dev ) {
945 948
 		else
946 949
 			printf("\n");
947 950
 	}
948
-static struct nic_operations pcnet32_operations;
949
-static struct nic_operations pcnet32_operations = {
950
-	.connect	= dummy_connect,
951
-	.poll		= pcnet32_poll,
952
-	.transmit	= pcnet32_transmit,
953
-	.irq		= pcnet32_irq,
954
-	.disable	= pcnet32_disable,
955
-};
951
+
956 952
 	nic->nic_op	= &pcnet32_operations;
957 953
 
958 954
 	return 1;
@@ -993,6 +989,14 @@ static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num,
993 989
 }
994 990
 #endif
995 991
 
992
+static struct nic_operations pcnet32_operations = {
993
+	.connect	= dummy_connect,
994
+	.poll		= pcnet32_poll,
995
+	.transmit	= pcnet32_transmit,
996
+	.irq		= pcnet32_irq,
997
+	.disable	= pcnet32_disable,
998
+};
999
+
996 1000
 static struct pci_id pcnet32_nics[] = {
997 1001
 	PCI_ROM(0x1022, 0x2000, "lancepci", "AMD Lance/PCI"),
998 1002
 	PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD Lance/PCI PCNet/32"),

+ 22
- 20
src/drivers/net/r8169.c View File

@@ -702,6 +702,21 @@ static void r8169_disable ( struct nic *nic __unused ) {
702 702
 	}
703 703
 }
704 704
 
705
+static struct nic_operations r8169_operations = {
706
+	.connect	= dummy_connect,
707
+	.poll		= r8169_poll,
708
+	.transmit	= r8169_transmit,
709
+	.irq		= r8169_irq,
710
+	.disable	= r8169_disable,
711
+};
712
+
713
+static struct pci_id r8169_nics[] = {
714
+	PCI_ROM(0x10ec, 0x8169, "r8169", "RealTek RTL8169 Gigabit Ethernet"),
715
+};
716
+
717
+static struct pci_driver r8169_driver =
718
+	PCI_DRIVER ( "r8169/PCI", r8169_nics, PCI_NO_CLASS );
719
+
705 720
 /**************************************************************************
706 721
 PROBE - Look for an adapter, this routine's visible to the outside
707 722
 ***************************************************************************/
@@ -709,17 +724,18 @@ PROBE - Look for an adapter, this routine's visible to the outside
709 724
 #define board_found 1
710 725
 #define valid_link 0
711 726
 static int r8169_probe ( struct dev *dev ) {
712
-
713 727
 	struct nic *nic = nic_device ( dev );
714
-
715 728
 	struct pci_device *pci = pci_device ( dev );
716 729
 	static int board_idx = -1;
717 730
 	static int printed_version = 0;
718 731
 	int i, rc;
719 732
 	int option = -1, Cap10_100 = 0, Cap1000 = 0;
720 733
 
734
+	if ( ! find_pci_device ( pci, &r8169_driver ) )
735
+		return 0;
736
+
721 737
 	printf("r8169.c: Found %s, Vendor=%hX Device=%hX\n",
722
-	       pci->name, pci->vendor, pci->dev_id);
738
+	       dev->name, pci->vendor, pci->dev_id);
723 739
 
724 740
 	board_idx++;
725 741
 
@@ -737,7 +753,7 @@ static int r8169_probe ( struct dev *dev ) {
737 753
 	dprintf(("%s: Identified chip type is '%s'.\n", pci->name,
738 754
 		 rtl_chip_info[tpc->chipset].name));
739 755
 	/* Print out some hardware info */
740
-	printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr,
756
+	printf("%s: %! at ioaddr %hX, ", dev->name, nic->node_addr,
741 757
 	       ioaddr);
742 758
 
743 759
 	/* if TBI is not endbled */
@@ -824,32 +840,18 @@ static int r8169_probe ( struct dev *dev ) {
824 840
 		udelay(100);
825 841
 		printf
826 842
 		    ("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n",
827
-		     pci->name,
843
+		     dev->name,
828 844
 		     (RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed");
829 845
 
830 846
 	}
831 847
 
832 848
 	r8169_reset(nic);
833 849
 	/* point to NIC specific routines */
834
-static struct nic_operations r8169_operations;
835
-static struct nic_operations r8169_operations = {
836
-	.connect	= dummy_connect,
837
-	.poll		= r8169_poll,
838
-	.transmit	= r8169_transmit,
839
-	.irq		= r8169_irq,
840
-	.disable	= r8169_disable,
841
-};	nic->nic_op	= &r8169_operations;
850
+	nic->nic_op	= &r8169_operations;
842 851
 	nic->irqno = pci->irq;
843 852
 	nic->ioaddr = ioaddr;
844 853
 	return 1;
845 854
 
846 855
 }
847 856
 
848
-static struct pci_id r8169_nics[] = {
849
-	PCI_ROM(0x10ec, 0x8169, "r8169", "RealTek RTL8169 Gigabit Ethernet"),
850
-};
851
-
852
-static struct pci_driver r8169_driver =
853
-	PCI_DRIVER ( "r8169/PCI", r8169_nics, PCI_NO_CLASS );
854
-
855 857
 BOOT_DRIVER ( "r8169/PCI", r8169_probe );

+ 16
- 12
src/drivers/net/sis900.c View File

@@ -52,6 +52,9 @@
52 52
 
53 53
 /* Globals */
54 54
 
55
+static struct nic_operations sis900_operations;
56
+static struct pci_driver sis900_driver;
57
+
55 58
 static int sis900_debug = 0;
56 59
 
57 60
 static unsigned short vendor, dev_id;
@@ -308,9 +311,7 @@ static int sis635_get_mac_addr(struct pci_device * pci_dev __unused, struct nic
308 311
  */
309 312
 
310 313
 static int sis900_probe ( struct dev *dev ) {
311
-
312 314
     struct nic *nic = nic_device ( dev );
313
-
314 315
     struct pci_device *pci = pci_device ( dev );
315 316
     int i;
316 317
     int found=0;
@@ -318,12 +319,15 @@ static int sis900_probe ( struct dev *dev ) {
318 319
     u8 revision;
319 320
     int ret;
320 321
 
322
+    if ( ! find_pci_device ( pci, &sis900_driver ) )
323
+	return 0;
324
+
321 325
     if (pci->ioaddr == 0)
322 326
         return 0;
323 327
 
324 328
     nic->irqno  = 0;
325
-    nic->ioaddr = pci->ioaddr & ~3;
326
-    ioaddr  = pci->ioaddr & ~3;
329
+    nic->ioaddr = pci->ioaddr;
330
+    ioaddr  = pci->ioaddr;
327 331
     vendor  = pci->vendor;
328 332
     dev_id  = pci->dev_id;
329 333
 
@@ -409,14 +413,6 @@ static int sis900_probe ( struct dev *dev ) {
409 413
 
410 414
     /* initialize device */
411 415
     sis900_init(nic);
412
-static struct nic_operations sis900_operations;
413
-static struct nic_operations sis900_operations = {
414
-	.connect	= dummy_connect,
415
-	.poll		= sis900_poll,
416
-	.transmit	= sis900_transmit,
417
-	.irq		= sis900_irq,
418
-	.disable	= sis900_disable,
419
-};
420 416
     nic->nic_op	= &sis900_operations;
421 417
 
422 418
     return 1;
@@ -1253,6 +1249,14 @@ sis900_irq(struct nic *nic __unused, irq_action_t action __unused)
1253 1249
   }
1254 1250
 }
1255 1251
 
1252
+static struct nic_operations sis900_operations = {
1253
+	.connect	= dummy_connect,
1254
+	.poll		= sis900_poll,
1255
+	.transmit	= sis900_transmit,
1256
+	.irq		= sis900_irq,
1257
+	.disable	= sis900_disable,
1258
+};
1259
+
1256 1260
 static struct pci_id sis900_nics[] = {
1257 1261
 PCI_ROM(0x1039, 0x0900, "sis900",  "SIS900"),
1258 1262
 PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016"),

+ 15
- 14
src/drivers/net/sundance.c View File

@@ -571,28 +571,36 @@ static void sundance_disable ( struct nic *nic __unused ) {
571 571
 	outw(TxDisable | RxDisable | StatsDisable, BASE + MACCtrl1);
572 572
 }
573 573
 
574
-
574
+static struct nic_operations sundance_operations = {
575
+	.connect	= dummy_connect,
576
+	.poll		= sundance_poll,
577
+	.transmit	= sundance_transmit,
578
+	.irq		= sundance_irq,
579
+	.disable	= sundance_disable,
580
+};
581
+static struct pci_driver sundance_driver;
575 582
 
576 583
 /**************************************************************************
577 584
 PROBE - Look for an adapter, this routine's visible to the outside
578 585
 ***************************************************************************/
579 586
 static int sundance_probe ( struct dev *dev ) {
580
-
581 587
 	struct nic *nic = nic_device ( dev );
582
-
583 588
 	struct pci_device *pci = pci_device ( dev );
584 589
 	u8 ee_data[EEPROM_SIZE];
585 590
 	u16 mii_ctl;
586 591
 	int i;
587 592
 	int speed;
588 593
 
594
+	if ( ! find_pci_device ( pci, &sundance_driver ) )
595
+		return 0;
596
+
589 597
 	if (pci->ioaddr == 0)
590 598
 		return 0;
591 599
 
592 600
 	/* BASE is used throughout to address the card */
593 601
 	BASE = pci->ioaddr;
594 602
 	printf(" sundance.c: Found %s Vendor=0x%hX Device=0x%hX\n",
595
-	       pci->name, pci->vendor, pci->dev_id);
603
+	       dev->name, pci->vendor, pci->dev_id);
596 604
 
597 605
 	/* Get the MAC Address by reading the EEPROM */
598 606
 	for (i = 0; i < 3; i++) {
@@ -614,13 +622,13 @@ static int sundance_probe ( struct dev *dev ) {
614 622
 	/* point to private storage */
615 623
 	sdc = &sdx;
616 624
 
617
-	sdc->nic_name = pci->name;
625
+	sdc->nic_name = dev->name;
618 626
 	sdc->mtu = mtu;
619 627
 
620 628
 	pci_read_config_byte(pci, PCI_REVISION_ID, &sdc->pci_rev_id);
621 629
 	dprintf(("Device revision id: %hx\n", sdc->pci_rev_id));
622 630
 	/* Print out some hardware info */
623
-	printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr, BASE);
631
+	printf("%s: %! at ioaddr %hX, ", dev->name, nic->node_addr, BASE);
624 632
 	sdc->mii_preamble_required = 0;
625 633
 	if (1) {
626 634
 		int phy, phy_idx = 0;
@@ -735,14 +743,7 @@ static int sundance_probe ( struct dev *dev ) {
735 743
 	       sdc->mii_if.full_duplex ? "Full" : "Half");
736 744
 
737 745
 	/* point to NIC specific routines */
738
-static struct nic_operations sundance_operations;
739
-static struct nic_operations sundance_operations = {
740
-	.connect	= dummy_connect,
741
-	.poll		= sundance_poll,
742
-	.transmit	= sundance_transmit,
743
-	.irq		= sundance_irq,
744
-	.disable	= sundance_disable,
745
-};	nic->nic_op	= &sundance_operations;
746
+	nic->nic_op	= &sundance_operations;
746 747
 	nic->irqno = pci->irq;
747 748
 	nic->ioaddr = BASE;
748 749
 

+ 46
- 48
src/drivers/net/tg3.c View File

@@ -2875,7 +2875,7 @@ static int  tg3_get_device_address(struct tg3 *tp)
2875 2875
 	struct nic *nic = tp->nic;
2876 2876
 	uint32_t hi, lo, mac_offset;
2877 2877
 
2878
-	if (PCI_FUNC(tp->pdev->devfn) == 0)
2878
+	if (PCI_FUNC(tp->pdev->busdevfn) == 0)
2879 2879
 		mac_offset = 0x7c;
2880 2880
 	else
2881 2881
 		mac_offset = 0xcc;
@@ -3219,28 +3219,65 @@ static void tg3_irq(struct nic *nic __unused, irq_action_t action __unused)
3219 3219
   }
3220 3220
 }
3221 3221
 
3222
+static struct nic_operations tg3_operations = {
3223
+	.connect	= dummy_connect,
3224
+	.poll		= tg3_poll,
3225
+	.transmit	= tg3_transmit,
3226
+	.irq		= tg3_irq,
3227
+	.disable	= tg3_disable,
3228
+};
3229
+
3230
+
3231
+static struct pci_id tg3_nics[] = {
3232
+PCI_ROM(0x14e4, 0x1644, "tg3-5700",        "Broadcom Tigon 3 5700"),
3233
+PCI_ROM(0x14e4, 0x1645, "tg3-5701",        "Broadcom Tigon 3 5701"),
3234
+PCI_ROM(0x14e4, 0x1646, "tg3-5702",        "Broadcom Tigon 3 5702"),
3235
+PCI_ROM(0x14e4, 0x1647, "tg3-5703",        "Broadcom Tigon 3 5703"),
3236
+PCI_ROM(0x14e4, 0x1648, "tg3-5704",        "Broadcom Tigon 3 5704"),
3237
+PCI_ROM(0x14e4, 0x164d, "tg3-5702FE",      "Broadcom Tigon 3 5702FE"),
3238
+PCI_ROM(0x14e4, 0x1653, "tg3-5705",        "Broadcom Tigon 3 5705"),
3239
+PCI_ROM(0x14e4, 0x1654, "tg3-5705_2",      "Broadcom Tigon 3 5705_2"),
3240
+PCI_ROM(0x14e4, 0x165d, "tg3-5705M",       "Broadcom Tigon 3 5705M"),
3241
+PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2",     "Broadcom Tigon 3 5705M_2"),
3242
+PCI_ROM(0x14e4, 0x1677, "tg3-5751",        "Broadcom Tigon 3 5751"),
3243
+PCI_ROM(0x14e4, 0x1696, "tg3-5782",        "Broadcom Tigon 3 5782"),
3244
+PCI_ROM(0x14e4, 0x169c, "tg3-5788",        "Broadcom Tigon 3 5788"),
3245
+PCI_ROM(0x14e4, 0x16a6, "tg3-5702X",       "Broadcom Tigon 3 5702X"),
3246
+PCI_ROM(0x14e4, 0x16a7, "tg3-5703X",       "Broadcom Tigon 3 5703X"),
3247
+PCI_ROM(0x14e4, 0x16a8, "tg3-5704S",       "Broadcom Tigon 3 5704S"),
3248
+PCI_ROM(0x14e4, 0x16c6, "tg3-5702A3",      "Broadcom Tigon 3 5702A3"),
3249
+PCI_ROM(0x14e4, 0x16c7, "tg3-5703A3",      "Broadcom Tigon 3 5703A3"),
3250
+PCI_ROM(0x14e4, 0x170d, "tg3-5901",        "Broadcom Tigon 3 5901"),
3251
+PCI_ROM(0x14e4, 0x170e, "tg3-5901_2",      "Broadcom Tigon 3 5901_2"),
3252
+PCI_ROM(0x1148, 0x4400, "tg3-9DXX",        "Syskonnect 9DXX"),
3253
+PCI_ROM(0x1148, 0x4500, "tg3-9MXX",        "Syskonnect 9MXX"),
3254
+PCI_ROM(0x173b, 0x03e8, "tg3-ac1000",      "Altima AC1000"),
3255
+PCI_ROM(0x173b, 0x03e9, "tg3-ac1001",      "Altima AC1001"),
3256
+PCI_ROM(0x173b, 0x03ea, "tg3-ac9100",      "Altima AC9100"),
3257
+PCI_ROM(0x173b, 0x03eb, "tg3-ac1003",      "Altima AC1003"),
3258
+};
3259
+
3260
+static struct pci_driver tg3_driver =
3261
+	PCI_DRIVER ( "TG3", tg3_nics, PCI_NO_CLASS );
3262
+
3222 3263
 /**************************************************************************
3223 3264
 PROBE - Look for an adapter, this routine's visible to the outside
3224 3265
 You should omit the last argument struct pci_device * for a non-PCI NIC
3225 3266
 ***************************************************************************/
3226 3267
 static int tg3_probe ( struct dev *dev ) {
3227
-
3228 3268
 	struct nic *nic = nic_device ( dev );
3229
-
3230 3269
 	struct pci_device *pdev = pci_device ( dev );
3231 3270
 	struct tg3 *tp = &tg3;
3232 3271
 	unsigned long tg3reg_base, tg3reg_len;
3233 3272
 	int i, err, pm_cap;
3234 3273
 
3235
-	if (pdev == 0)
3274
+	if ( ! find_pci_device ( pdev, &tg3_driver ) )
3236 3275
 		return 0;
3237 3276
 
3238 3277
 	memset(tp, 0, sizeof(*tp));
3239 3278
 
3240
-	adjust_pci_device(pdev);
3241
-
3242 3279
 	nic->irqno  = 0;
3243
-	nic->ioaddr = pdev->ioaddr & ~3;
3280
+	nic->ioaddr = pdev->ioaddr;
3244 3281
 
3245 3282
 	/* Find power-management capability. */
3246 3283
 	pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
@@ -3340,14 +3377,7 @@ static int tg3_probe ( struct dev *dev ) {
3340 3377
 		printf("Valid link not established\n");
3341 3378
 		goto err_out_disable;
3342 3379
 	}
3343
-static struct nic_operations tg3_operations;
3344
-static struct nic_operations tg3_operations = {
3345
-	.connect	= dummy_connect,
3346
-	.poll		= tg3_poll,
3347
-	.transmit	= tg3_transmit,
3348
-	.irq		= tg3_irq,
3349
-	.disable	= tg3_disable,
3350
-};
3380
+
3351 3381
 	nic->nic_op	= &tg3_operations;
3352 3382
 
3353 3383
 	return 1;
@@ -3356,40 +3386,8 @@ static struct nic_operations tg3_operations = {
3356 3386
 	iounmap((void *)tp->regs);
3357 3387
 	return 0;
3358 3388
  err_out_disable:
3359
-	tg3_disable(dev);
3389
+	tg3_disable(nic);
3360 3390
 	return 0;
3361 3391
 }
3362 3392
 
3363
-static struct pci_id tg3_nics[] = {
3364
-PCI_ROM(0x14e4, 0x1644, "tg3-5700",        "Broadcom Tigon 3 5700"),
3365
-PCI_ROM(0x14e4, 0x1645, "tg3-5701",        "Broadcom Tigon 3 5701"),
3366
-PCI_ROM(0x14e4, 0x1646, "tg3-5702",        "Broadcom Tigon 3 5702"),
3367
-PCI_ROM(0x14e4, 0x1647, "tg3-5703",        "Broadcom Tigon 3 5703"),
3368
-PCI_ROM(0x14e4, 0x1648, "tg3-5704",        "Broadcom Tigon 3 5704"),
3369
-PCI_ROM(0x14e4, 0x164d, "tg3-5702FE",      "Broadcom Tigon 3 5702FE"),
3370
-PCI_ROM(0x14e4, 0x1653, "tg3-5705",        "Broadcom Tigon 3 5705"),
3371
-PCI_ROM(0x14e4, 0x1654, "tg3-5705_2",      "Broadcom Tigon 3 5705_2"),
3372
-PCI_ROM(0x14e4, 0x165d, "tg3-5705M",       "Broadcom Tigon 3 5705M"),
3373
-PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2",     "Broadcom Tigon 3 5705M_2"),
3374
-PCI_ROM(0x14e4, 0x1677, "tg3-5751",        "Broadcom Tigon 3 5751"),
3375
-PCI_ROM(0x14e4, 0x1696, "tg3-5782",        "Broadcom Tigon 3 5782"),
3376
-PCI_ROM(0x14e4, 0x169c, "tg3-5788",        "Broadcom Tigon 3 5788"),
3377
-PCI_ROM(0x14e4, 0x16a6, "tg3-5702X",       "Broadcom Tigon 3 5702X"),
3378
-PCI_ROM(0x14e4, 0x16a7, "tg3-5703X",       "Broadcom Tigon 3 5703X"),
3379
-PCI_ROM(0x14e4, 0x16a8, "tg3-5704S",       "Broadcom Tigon 3 5704S"),
3380
-PCI_ROM(0x14e4, 0x16c6, "tg3-5702A3",      "Broadcom Tigon 3 5702A3"),
3381
-PCI_ROM(0x14e4, 0x16c7, "tg3-5703A3",      "Broadcom Tigon 3 5703A3"),
3382
-PCI_ROM(0x14e4, 0x170d, "tg3-5901",        "Broadcom Tigon 3 5901"),
3383
-PCI_ROM(0x14e4, 0x170e, "tg3-5901_2",      "Broadcom Tigon 3 5901_2"),
3384
-PCI_ROM(0x1148, 0x4400, "tg3-9DXX",        "Syskonnect 9DXX"),
3385
-PCI_ROM(0x1148, 0x4500, "tg3-9MXX",        "Syskonnect 9MXX"),
3386
-PCI_ROM(0x173b, 0x03e8, "tg3-ac1000",      "Altima AC1000"),
3387
-PCI_ROM(0x173b, 0x03e9, "tg3-ac1001",      "Altima AC1001"),
3388
-PCI_ROM(0x173b, 0x03ea, "tg3-ac9100",      "Altima AC9100"),
3389
-PCI_ROM(0x173b, 0x03eb, "tg3-ac1003",      "Altima AC1003"),
3390
-};
3391
-
3392
-static struct pci_driver tg3_driver =
3393
-	PCI_DRIVER ( "TG3", tg3_nics, PCI_NO_CLASS );
3394
-
3395 3393
 BOOT_DRIVER ( "TG3", tg3_probe );

+ 19
- 21
src/drivers/net/tlan.c View File

@@ -65,6 +65,8 @@
65 65
 #define dprintf(x)
66 66
 #endif
67 67
 
68
+static struct pci_driver tlan_driver;
69
+
68 70
 static void TLan_ResetLists(struct nic *nic __unused);
69 71
 static void TLan_ResetAdapter(struct nic *nic __unused);
70 72
 static void TLan_FinishReset(struct nic *nic __unused);
@@ -438,8 +440,9 @@ void TLan_FinishReset(struct nic *nic)
438 440
 				     "Full" : "Half"));
439 441
 				dprintf(("TLAN: Partner capability: "));
440 442
 				for (i = 5; i <= 10; i++)
441
-					if (partner & (1 << i))
443
+					if (partner & (1 << i)) {
442 444
 						dprintf(("%s", media[i - 5]));
445
+					}
443 446
 				dprintf(("\n"));
444 447
 			}
445 448
 
@@ -748,6 +751,14 @@ static void tlan_irq(struct nic *nic __unused, irq_action_t action __unused)
748 751
   }
749 752
 }
750 753
 
754
+static struct nic_operations tlan_operations = {
755
+	.connect	= dummy_connect,
756
+	.poll		= tlan_poll,
757
+	.transmit	= tlan_transmit,
758
+	.irq		= tlan_irq,
759
+	.disable	= tlan_disable,
760
+};
761
+
751 762
 static void TLan_SetMulticastList(struct nic *nic) {
752 763
 	int i;
753 764
 	u8 tmp;
@@ -771,28 +782,23 @@ PROBE - Look for an adapter, this routine's visible to the outside
771 782
 #define board_found 1
772 783
 #define valid_link 0
773 784
 static int tlan_probe ( struct dev *dev ) {
774
-
775 785
 	struct nic *nic = nic_device ( dev );
776
-
777 786
 	struct pci_device *pci = pci_device ( dev );
778 787
 	u16 data = 0;
779 788
 	int err;
780 789
 	int i;
781 790
 
791
+	if ( ! find_pci_device ( pci, &tlan_driver ) )
792
+		return 0;
793
+
782 794
 	if (pci->ioaddr == 0)
783 795
 		return 0;
784 796
 
785 797
 	nic->irqno  = 0;
786
-	nic->ioaddr = pci->ioaddr & ~3;
798
+	nic->ioaddr = pci->ioaddr;
787 799
 
788 800
 	BASE = pci->ioaddr;
789 801
 	
790
-	printf("tlan.c: Found %s, Vendor 0x%hX, Device 0x%hX\n", 
791
-		pci->name, pci->vendor, pci->dev_id);
792
-
793
-	/* Set nic as PCI bus master */
794
-	adjust_pci_device(pci);
795
-
796 802
 	/* Point to private storage */
797 803
 	priv = &TLanPrivateInfo;
798 804
 
@@ -810,7 +816,7 @@ static int tlan_probe ( struct dev *dev ) {
810 816
 
811 817
 	priv->vendor_id = pci->vendor;
812 818
 	priv->dev_id = pci->dev_id;
813
-	priv->nic_name = pci->name;
819
+	priv->nic_name = dev->name;
814 820
 	priv->eoc = 0;
815 821
 
816 822
 	err = 0;
@@ -821,11 +827,11 @@ static int tlan_probe ( struct dev *dev ) {
821 827
 				       (u8 *) & nic->node_addr[i]);
822 828
 	if (err) {
823 829
 		printf("TLAN: %s: Error reading MAC from eeprom: %d\n",
824
-		       pci->name, err);
830
+		       dev->name, err);
825 831
 	} else 
826 832
 		/* Print out some hardware info */
827 833
 		printf("%s: %! at ioaddr %hX, ", 
828
-			pci->name, nic->node_addr, pci->ioaddr);
834
+			dev->name, nic->node_addr, pci->ioaddr);
829 835
 
830 836
 	priv->tlanRev = TLan_DioRead8(BASE, TLAN_DEF_REVISION);
831 837
 	printf("revision: 0x%hX\n", priv->tlanRev);
@@ -844,14 +850,6 @@ static int tlan_probe ( struct dev *dev ) {
844 850
 /*	if (board_found && valid_link)
845 851
 	{*/
846 852
 	/* point to NIC specific routines */
847
-static struct nic_operations tlan_operations;
848
-static struct nic_operations tlan_operations = {
849
-	.connect	= dummy_connect,
850
-	.poll		= tlan_poll,
851
-	.transmit	= tlan_transmit,
852
-	.irq		= tlan_irq,
853
-	.disable	= tlan_disable,
854
-};
855 853
 	nic->nic_op	= &tlan_operations;
856 854
 	return 1;
857 855
 }

+ 15
- 13
src/drivers/net/tulip.c View File

@@ -1213,13 +1213,20 @@ static void tulip_irq(struct nic *nic __unused, irq_action_t action __unused)
1213 1213
   }
1214 1214
 }
1215 1215
 
1216
+static struct nic_operations tulip_operations = {
1217
+	.connect	= dummy_connect,
1218
+	.poll		= tulip_poll,
1219
+	.transmit	= tulip_transmit,
1220
+	.irq		= tulip_irq,
1221
+	.disable	= tulip_disable,
1222
+};
1223
+static struct pci_driver tulip_driver;
1224
+
1216 1225
 /*********************************************************************/
1217 1226
 /* eth_probe - Look for an adapter                                   */
1218 1227
 /*********************************************************************/
1219 1228
 static int tulip_probe ( struct dev *dev ) {
1220
-
1221 1229
     struct nic *nic = nic_device ( dev );
1222
-
1223 1230
     struct pci_device *pci = pci_device ( dev );
1224 1231
     u32 i;
1225 1232
     u8  chip_rev;
@@ -1228,6 +1235,9 @@ static int tulip_probe ( struct dev *dev ) {
1228 1235
     int chip_idx;
1229 1236
     static unsigned char last_phys_addr[ETH_ALEN] = {0x00, 'L', 'i', 'n', 'u', 'x'};
1230 1237
 
1238
+    if ( ! find_pci_device ( pci, &tulip_driver ) )
1239
+	return 0;
1240
+
1231 1241
     if (pci->ioaddr == 0)
1232 1242
         return 0;
1233 1243
 
@@ -1240,7 +1250,7 @@ static int tulip_probe ( struct dev *dev ) {
1240 1250
 
1241 1251
     tp->vendor_id  = pci->vendor;
1242 1252
     tp->dev_id     = pci->dev_id;
1243
-    tp->nic_name   = pci->name;
1253
+    tp->nic_name   = dev->name;
1244 1254
 
1245 1255
     tp->if_port = 0;
1246 1256
     tp->default_port = 0;
@@ -1301,7 +1311,7 @@ static int tulip_probe ( struct dev *dev ) {
1301 1311
     /* Bring the 21041/21143 out of sleep mode.
1302 1312
        Caution: Snooze mode does not work with some boards! */
1303 1313
     if (tp->flags & HAS_PWRDWN)
1304
-        pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000);
1314
+        pci_write_config_dword(pci, 0x40, 0x00000000);
1305 1315
 
1306 1316
     if (inl(ioaddr + CSR5) == 0xFFFFFFFF) {
1307 1317
         printf("%s: The Tulip chip at %X is not functioning.\n",
@@ -1309,7 +1319,7 @@ static int tulip_probe ( struct dev *dev ) {
1309 1319
         return 0;
1310 1320
     }
1311 1321
    
1312
-    pcibios_read_config_byte(pci->bus, pci->devfn, PCI_REVISION, &chip_rev);
1322
+    pci_read_config_byte(pci, PCI_REVISION, &chip_rev);
1313 1323
 
1314 1324
     printf("%s: [chip: %s] rev %d at %hX\n", tp->nic_name,
1315 1325
            tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr);
@@ -1422,14 +1432,6 @@ static int tulip_probe ( struct dev *dev ) {
1422 1432
 
1423 1433
     /* reset the device and make ready for tx and rx of packets */
1424 1434
     tulip_reset(nic);
1425
-static struct nic_operations tulip_operations;
1426
-static struct nic_operations tulip_operations = {
1427
-	.connect	= dummy_connect,
1428
-	.poll		= tulip_poll,
1429
-	.transmit	= tulip_transmit,
1430
-	.irq		= tulip_irq,
1431
-	.disable	= tulip_disable,
1432
-};
1433 1435
     nic->nic_op	= &tulip_operations;
1434 1436
 
1435 1437
     /* give the board a chance to reset before returning */

Loading…
Cancel
Save