| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * INET		An implementation of the TCP/IP protocol suite for the LINUX | 
					
						
							|  |  |  |  *		operating system.  INET is implemented using the  BSD Socket | 
					
						
							|  |  |  |  *		interface as the means of communication with the user level. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *		Holds initial configuration information for devices. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Version:	@(#)Space.c	1.0.7	08/12/93 | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-05-05 16:16:16 -07:00
										 |  |  |  * Authors:	Ross Biro | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 
					
						
							|  |  |  |  *		Donald J. Becker, <becker@scyld.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Changelog: | 
					
						
							|  |  |  |  *		Stephen Hemminger (09/2003) | 
					
						
							|  |  |  |  *		- get rid of pre-linked dev list, dynamic device allocation | 
					
						
							|  |  |  |  *		Paul Gortmaker (03/2002) | 
					
						
							|  |  |  |  *		- struct init cleanup, enable multiple ISA autoprobes. | 
					
						
							|  |  |  |  *		Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999 | 
					
						
							|  |  |  |  *		- fix sbni: s/device/net_device/ | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  |  *		Paul Gortmaker (06/98): | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  *		 - sort probes in a sane way, make sure all (safe) probes | 
					
						
							|  |  |  |  *		   get run once & failed autoprobes don't autoprobe again. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *		This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  *		modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  *		as published by the Free Software Foundation; either version | 
					
						
							|  |  |  |  *		2 of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #include <linux/netdevice.h>
 | 
					
						
							|  |  |  | #include <linux/etherdevice.h>
 | 
					
						
							|  |  |  | #include <linux/errno.h>
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/netlink.h>
 | 
					
						
							| 
									
										
										
										
											2013-12-19 14:22:37 +05:30
										 |  |  | #include <net/Space.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* A unified ethernet device probe.  This is the easiest way to have every
 | 
					
						
							|  |  |  |    ethernet adaptor have the name "eth[0123...]". | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct devprobe2 { | 
					
						
							|  |  |  | 	struct net_device *(*probe)(int unit); | 
					
						
							|  |  |  | 	int status;	/* non-zero if autoprobe has failed */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int __init probe_list2(int unit, struct devprobe2 *p, int autoprobe) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct net_device *dev; | 
					
						
							|  |  |  | 	for (; p->probe; p++) { | 
					
						
							|  |  |  | 		if (autoprobe && p->status) | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		dev = p->probe(unit); | 
					
						
							|  |  |  | 		if (!IS_ERR(dev)) | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		if (autoprobe) | 
					
						
							|  |  |  | 			p->status = PTR_ERR(dev); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return -ENODEV; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * ISA probes that touch addresses < 0x400 (including those that also | 
					
						
							| 
									
										
										
										
											2012-05-16 19:48:42 -04:00
										 |  |  |  * look for EISA/PCI cards in addition to ISA cards). | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							|  |  |  | static struct devprobe2 isa_probes[] __initdata = { | 
					
						
							| 
									
										
										
										
											2006-10-02 21:08:22 -04:00
										 |  |  | #if defined(CONFIG_HP100) && defined(CONFIG_ISA)	/* ISA, EISA */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	{hp100_probe, 0}, | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #ifdef CONFIG_3C515
 | 
					
						
							|  |  |  | 	{tc515_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  | #ifdef CONFIG_ULTRA
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	{ultra_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  | #ifdef CONFIG_WD80x3
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	{wd_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-08-30 06:04:57 -07:00
										 |  |  | #if defined(CONFIG_NE2000) /* ISA (use ne2k-pci for PCI cards) */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	{ne_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_LANCE		/* ISA/VLB (use pcnet32 for PCI cards) */
 | 
					
						
							|  |  |  | 	{lance_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_SMC9194
 | 
					
						
							|  |  |  | 	{smc_init, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_CS89x0
 | 
					
						
							| 
									
										
										
										
											2012-01-26 21:46:15 +01:00
										 |  |  | #ifndef CONFIG_CS89x0_PLATFORM
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  	{cs89x0_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-01-26 21:46:15 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-01-08 22:00:39 -05:00
										 |  |  | #if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET)	/* Intel I82596 */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	{i82596_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_NI65
 | 
					
						
							|  |  |  | 	{ni65_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	{NULL, 0}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct devprobe2 m68k_probes[] __initdata = { | 
					
						
							|  |  |  | #ifdef CONFIG_ATARILANCE	/* Lance-based Atari ethernet boards */
 | 
					
						
							|  |  |  | 	{atarilance_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_SUN3LANCE         /* sun3 onboard Lance chip */
 | 
					
						
							|  |  |  | 	{sun3lance_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_SUN3_82586        /* sun3 onboard Intel 82586 chip */
 | 
					
						
							|  |  |  | 	{sun3_82586_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_APNE		/* A1200 PCMCIA NE2000 */
 | 
					
						
							|  |  |  | 	{apne_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_MVME147_NET	/* MVME147 internal Ethernet */
 | 
					
						
							|  |  |  | 	{mvme147lance_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_MAC8390           /* NuBus NS8390-based cards */
 | 
					
						
							|  |  |  | 	{mac8390_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_MAC89x0
 | 
					
						
							|  |  |  |  	{mac89x0_probe, 0}, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	{NULL, 0}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Unified ethernet device probe, segmented per architecture and | 
					
						
							|  |  |  |  * per bus interface. This drives the legacy devices only for now. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2006-09-13 13:24:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | static void __init ethif_probe2(int unit) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long base_addr = netdev_boot_base("eth", unit); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (base_addr == 1) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	(void)(	probe_list2(unit, m68k_probes, base_addr == 0) && | 
					
						
							| 
									
										
										
										
											2013-01-09 20:30:26 -05:00
										 |  |  | 		probe_list2(unit, isa_probes, base_addr == 0)); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*  Statically configured drivers -- order matters here. */ | 
					
						
							|  |  |  | static int __init net_olddevs_init(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int num; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_SBNI
 | 
					
						
							|  |  |  | 	for (num = 0; num < 8; ++num) | 
					
						
							|  |  |  | 		sbni_probe(num); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	for (num = 0; num < 8; ++num) | 
					
						
							|  |  |  | 		ethif_probe2(num); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_COPS
 | 
					
						
							|  |  |  | 	cops_probe(0); | 
					
						
							|  |  |  | 	cops_probe(1); | 
					
						
							|  |  |  | 	cops_probe(2); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_LTPC
 | 
					
						
							|  |  |  | 	ltpc_probe(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | device_initcall(net_olddevs_init); |