12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * INET An implementation of the TCP/IP protocol suite for the LINUX 41da177e4SLinus Torvalds * operating system. INET is implemented using the BSD Socket 51da177e4SLinus Torvalds * interface as the means of communication with the user level. 61da177e4SLinus Torvalds * 71da177e4SLinus Torvalds * Holds initial configuration information for devices. 81da177e4SLinus Torvalds * 91da177e4SLinus Torvalds * Version: @(#)Space.c 1.0.7 08/12/93 101da177e4SLinus Torvalds * 1102c30a84SJesper Juhl * Authors: Ross Biro 121da177e4SLinus Torvalds * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 131da177e4SLinus Torvalds * Donald J. Becker, <becker@scyld.com> 141da177e4SLinus Torvalds * 151da177e4SLinus Torvalds * Changelog: 161da177e4SLinus Torvalds * Stephen Hemminger (09/2003) 171da177e4SLinus Torvalds * - get rid of pre-linked dev list, dynamic device allocation 181da177e4SLinus Torvalds * Paul Gortmaker (03/2002) 191da177e4SLinus Torvalds * - struct init cleanup, enable multiple ISA autoprobes. 201da177e4SLinus Torvalds * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999 211da177e4SLinus Torvalds * - fix sbni: s/device/net_device/ 221da177e4SLinus Torvalds * Paul Gortmaker (06/98): 231da177e4SLinus Torvalds * - sort probes in a sane way, make sure all (safe) probes 241da177e4SLinus Torvalds * get run once & failed autoprobes don't autoprobe again. 251da177e4SLinus Torvalds */ 261da177e4SLinus Torvalds #include <linux/netdevice.h> 271da177e4SLinus Torvalds #include <linux/etherdevice.h> 281da177e4SLinus Torvalds #include <linux/errno.h> 291da177e4SLinus Torvalds #include <linux/init.h> 301da177e4SLinus Torvalds #include <linux/netlink.h> 31b6835f9cSRashika Kheria #include <net/Space.h> 321da177e4SLinus Torvalds 331da177e4SLinus Torvalds /* A unified ethernet device probe. This is the easiest way to have every 346104503cSAmit Ghadge * ethernet adaptor have the name "eth[0123...]". 351da177e4SLinus Torvalds */ 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds struct devprobe2 { 381da177e4SLinus Torvalds struct net_device *(*probe)(int unit); 391da177e4SLinus Torvalds int status; /* non-zero if autoprobe has failed */ 401da177e4SLinus Torvalds }; 411da177e4SLinus Torvalds 421da177e4SLinus Torvalds static int __init probe_list2(int unit, struct devprobe2 *p, int autoprobe) 431da177e4SLinus Torvalds { 441da177e4SLinus Torvalds struct net_device *dev; 456104503cSAmit Ghadge 461da177e4SLinus Torvalds for (; p->probe; p++) { 471da177e4SLinus Torvalds if (autoprobe && p->status) 481da177e4SLinus Torvalds continue; 491da177e4SLinus Torvalds dev = p->probe(unit); 501da177e4SLinus Torvalds if (!IS_ERR(dev)) 511da177e4SLinus Torvalds return 0; 521da177e4SLinus Torvalds if (autoprobe) 531da177e4SLinus Torvalds p->status = PTR_ERR(dev); 541da177e4SLinus Torvalds } 551da177e4SLinus Torvalds return -ENODEV; 561da177e4SLinus Torvalds } 571da177e4SLinus Torvalds 586104503cSAmit Ghadge /* ISA probes that touch addresses < 0x400 (including those that also 59a5e371f6SPaul Gortmaker * look for EISA/PCI cards in addition to ISA cards). 601da177e4SLinus Torvalds */ 611da177e4SLinus Torvalds static struct devprobe2 isa_probes[] __initdata = { 621da177e4SLinus Torvalds #ifdef CONFIG_3C515 631da177e4SLinus Torvalds {tc515_probe, 0}, 641da177e4SLinus Torvalds #endif 651da177e4SLinus Torvalds #ifdef CONFIG_ULTRA 661da177e4SLinus Torvalds {ultra_probe, 0}, 671da177e4SLinus Torvalds #endif 681da177e4SLinus Torvalds #ifdef CONFIG_WD80x3 691da177e4SLinus Torvalds {wd_probe, 0}, 701da177e4SLinus Torvalds #endif 71dd9589c7SGuenter Roeck #if defined(CONFIG_NE2000) /* ISA (use ne2k-pci for PCI cards) */ 721da177e4SLinus Torvalds {ne_probe, 0}, 731da177e4SLinus Torvalds #endif 741da177e4SLinus Torvalds #ifdef CONFIG_LANCE /* ISA/VLB (use pcnet32 for PCI cards) */ 751da177e4SLinus Torvalds {lance_probe, 0}, 761da177e4SLinus Torvalds #endif 771da177e4SLinus Torvalds #ifdef CONFIG_SMC9194 781da177e4SLinus Torvalds {smc_init, 0}, 791da177e4SLinus Torvalds #endif 8047fd22f2SArnd Bergmann #ifdef CONFIG_CS89x0_ISA 811da177e4SLinus Torvalds {cs89x0_probe, 0}, 821da177e4SLinus Torvalds #endif 831da177e4SLinus Torvalds #ifdef CONFIG_NI65 841da177e4SLinus Torvalds {ni65_probe, 0}, 851da177e4SLinus Torvalds #endif 861da177e4SLinus Torvalds {NULL, 0}, 871da177e4SLinus Torvalds }; 881da177e4SLinus Torvalds 896104503cSAmit Ghadge /* Unified ethernet device probe, segmented per architecture and 901da177e4SLinus Torvalds * per bus interface. This drives the legacy devices only for now. 911da177e4SLinus Torvalds */ 921da177e4SLinus Torvalds 931da177e4SLinus Torvalds static void __init ethif_probe2(int unit) 941da177e4SLinus Torvalds { 951da177e4SLinus Torvalds unsigned long base_addr = netdev_boot_base("eth", unit); 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds if (base_addr == 1) 981da177e4SLinus Torvalds return; 991da177e4SLinus Torvalds 100*e179d78eSArnd Bergmann probe_list2(unit, isa_probes, base_addr == 0); 1011da177e4SLinus Torvalds } 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds /* Statically configured drivers -- order matters here. */ 1041da177e4SLinus Torvalds static int __init net_olddevs_init(void) 1051da177e4SLinus Torvalds { 1061da177e4SLinus Torvalds int num; 1071da177e4SLinus Torvalds 1081da177e4SLinus Torvalds #ifdef CONFIG_SBNI 1091da177e4SLinus Torvalds for (num = 0; num < 8; ++num) 1101da177e4SLinus Torvalds sbni_probe(num); 1111da177e4SLinus Torvalds #endif 1121da177e4SLinus Torvalds for (num = 0; num < 8; ++num) 1131da177e4SLinus Torvalds ethif_probe2(num); 1141da177e4SLinus Torvalds 1151da177e4SLinus Torvalds #ifdef CONFIG_COPS 1161da177e4SLinus Torvalds cops_probe(0); 1171da177e4SLinus Torvalds cops_probe(1); 1181da177e4SLinus Torvalds cops_probe(2); 1191da177e4SLinus Torvalds #endif 1201da177e4SLinus Torvalds 1211da177e4SLinus Torvalds return 0; 1221da177e4SLinus Torvalds } 1231da177e4SLinus Torvalds 1241da177e4SLinus Torvalds device_initcall(net_olddevs_init); 125