diff options
author | nate <nate@FreeBSD.org> | 1997-10-26 21:08:42 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1997-10-26 21:08:42 +0000 |
commit | fa55951ed537b4c4f68482e66fc7123eab0cf3fc (patch) | |
tree | 0439bf497279cd9e48c661b7d3e61a65cd486efb | |
parent | c76c50d092e899d58a0c957da71951be8e875d62 (diff) | |
download | FreeBSD-src-fa55951ed537b4c4f68482e66fc7123eab0cf3fc.zip FreeBSD-src-fa55951ed537b4c4f68482e66fc7123eab0cf3fc.tar.gz |
- Instead of relying on a functional call to register PCARD-capable drivers,
use a Linker Set. Note, if a driver is loaded as an LKM if will have
to use the function call, but since none of the existing drivers
are loadable, this made things cleaner and boot messages nicer.
Obtained from: PAO-970616
-rw-r--r-- | sys/dev/ed/if_ed.c | 12 | ||||
-rw-r--r-- | sys/dev/ep/if_ep.c | 9 | ||||
-rw-r--r-- | sys/dev/fe/if_fe.c | 18 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 11 | ||||
-rw-r--r-- | sys/i386/isa/aic6360.c | 11 | ||||
-rw-r--r-- | sys/i386/isa/if_ed.c | 12 | ||||
-rw-r--r-- | sys/i386/isa/if_ep.c | 9 | ||||
-rw-r--r-- | sys/i386/isa/if_fe.c | 18 | ||||
-rw-r--r-- | sys/i386/isa/sio.c | 11 | ||||
-rw-r--r-- | sys/isa/sio.c | 11 | ||||
-rw-r--r-- | sys/pccard/driver.h | 1 | ||||
-rw-r--r-- | sys/pccard/pccard.c | 12 | ||||
-rw-r--r-- | sys/pccard/skel.c | 2 |
13 files changed, 45 insertions, 92 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 83e16bc..72871d8 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ed.c,v 1.122 1997/10/03 16:26:15 davidg Exp $ + * $Id: if_ed.c,v 1.124 1997/10/26 04:53:51 nate Exp $ */ /* @@ -205,6 +205,8 @@ static struct pccard_device ed_info = { /* XXX - Should this also include net_imask? */ }; +DATA_SET(pccarddrv_set, ed_info); + /* * Initialize the device - called from Slot manager. */ @@ -340,14 +342,6 @@ ed_probe(isa_dev) { int nports; -#if NCARD > 0 - /* - * If PC-Card probe required, then register driver with - * slot manager. - */ - pccard_add_driver(&ed_info); -#endif - nports = ed_probe_WD80x3(isa_dev); if (nports) return (nports); diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index d840c53..e5db617 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -38,7 +38,7 @@ */ /* - * $Id: if_ep.c,v 1.61 1997/10/14 06:56:08 itojun Exp $ + * $Id: if_ep.c,v 1.63 1997/10/26 04:53:53 nate Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -63,6 +63,7 @@ #include <sys/param.h> #if defined(__FreeBSD__) +#include <sys/kernel.h> #include <sys/systm.h> #include <sys/conf.h> #endif @@ -167,6 +168,8 @@ static struct pccard_device ep_info = { &net_imask }; +DATA_SET(pccarddrv_set, ep_info); + /* * Initialize the device - called from Slot manager. */ @@ -473,10 +476,6 @@ ep_isa_probe(is) struct ep_board *epb; u_short k; -#if NCARD > 0 - pccard_add_driver(&ep_info); -#endif - if ((epb = ep_look_for_board_at(is)) == 0) return (0); diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 41d10ed..a41e4bc 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -21,7 +21,7 @@ */ /* - * $Id: if_fe.c,v 1.29 1997/07/20 14:09:59 bde Exp $ + * $Id: if_fe.c,v 1.31 1997/10/26 04:53:54 nate Exp $ * * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. * To be used with FreeBSD 2.x @@ -336,6 +336,8 @@ static struct pccard_device fe_info = { /* XXX - Should this also include net_imask? */ }; +DATA_SET(pccarddrv_set, fe_info); + /* * Initialize the device - called from Slot manager. */ @@ -451,9 +453,6 @@ static struct fe_probe_list const fe_probe_list [] = static int fe_probe ( DEVICE * dev ) { -#if NCARD > 0 - static int fe_already_init; -#endif struct fe_softc * sc; int u; int nports; @@ -465,17 +464,6 @@ fe_probe ( DEVICE * dev ) sc = &fe_softc[ dev->id_unit ]; sc->sc_unit = dev->id_unit; -#if NCARD > 0 - /* - * If PC-Card probe required, then register driver with - * slot manager. - */ - if (fe_already_init != 1) { - pccard_add_driver(&fe_info); - fe_already_init = 1; - } -#endif - /* Probe each possibility, one at a time. */ for ( list = fe_probe_list; list->probe != NULL; list++ ) { diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 93d147d..db9afb2 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.184 1997/10/12 20:23:30 phk Exp $ + * $Id: sio.c,v 1.186 1997/10/26 04:53:56 nate Exp $ */ #include "opt_comconsole.h" @@ -488,6 +488,8 @@ static struct pccard_device sio_info = { /* XXX - Should this also include net_imask? */ }; +DATA_SET(pccarddrv_set, sio_info); + /* * Initialize the device - called from Slot manager. */ @@ -587,13 +589,6 @@ sioprobe(dev) for (xdev = isa_devtab_tty; xdev->id_driver != NULL; xdev++) if (xdev->id_driver == &siodriver && xdev->id_enabled) outb(xdev->id_iobase + com_mcr, 0); -#if NCARD > 0 - /* - * If PC-Card probe required, then register driver with - * slot manager. - */ - pccard_add_driver(&sio_info); -#endif already_init = TRUE; } diff --git a/sys/i386/isa/aic6360.c b/sys/i386/isa/aic6360.c index 93da5a6..fb2dd6c 100644 --- a/sys/i386/isa/aic6360.c +++ b/sys/i386/isa/aic6360.c @@ -31,7 +31,7 @@ */ /* - * $Id: aic6360.c,v 1.32 1997/10/21 17:57:31 nate Exp $ + * $Id: aic6360.c,v 1.34 1997/10/26 04:53:49 nate Exp $ * * Acknowledgements: Many of the algorithms used in this driver are * inspired by the work of Julian Elischer (julian@tfs.com) and @@ -718,6 +718,8 @@ static struct pccard_device aic_info = { &bio_imask /* Interrupt mask for device */ }; +DATA_SET(pccarddrv_set, aic_info); + /* * Initialize the device - called from Slot manager. */ @@ -796,7 +798,6 @@ aicprobe(dev) #if NCARD > 0 int unit = dev->id_unit; int aic_reg_drv[NAIC]; - static int aic_already_init; #else int unit = aicunit; #endif @@ -810,12 +811,6 @@ aicprobe(dev) #if NCARD > 0 if (!aic_reg_drv[unit]) aic_reg_drv[unit] = 1; - - /* If PC-Card probe required, then register with slot manager. */ - if (!aic_already_init) { - pccard_add_driver(&aic_info); - aic_already_init = 1; - } #endif /* diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index 83e16bc..72871d8 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/if_ed.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ed.c,v 1.122 1997/10/03 16:26:15 davidg Exp $ + * $Id: if_ed.c,v 1.124 1997/10/26 04:53:51 nate Exp $ */ /* @@ -205,6 +205,8 @@ static struct pccard_device ed_info = { /* XXX - Should this also include net_imask? */ }; +DATA_SET(pccarddrv_set, ed_info); + /* * Initialize the device - called from Slot manager. */ @@ -340,14 +342,6 @@ ed_probe(isa_dev) { int nports; -#if NCARD > 0 - /* - * If PC-Card probe required, then register driver with - * slot manager. - */ - pccard_add_driver(&ed_info); -#endif - nports = ed_probe_WD80x3(isa_dev); if (nports) return (nports); diff --git a/sys/i386/isa/if_ep.c b/sys/i386/isa/if_ep.c index d840c53..e5db617 100644 --- a/sys/i386/isa/if_ep.c +++ b/sys/i386/isa/if_ep.c @@ -38,7 +38,7 @@ */ /* - * $Id: if_ep.c,v 1.61 1997/10/14 06:56:08 itojun Exp $ + * $Id: if_ep.c,v 1.63 1997/10/26 04:53:53 nate Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -63,6 +63,7 @@ #include <sys/param.h> #if defined(__FreeBSD__) +#include <sys/kernel.h> #include <sys/systm.h> #include <sys/conf.h> #endif @@ -167,6 +168,8 @@ static struct pccard_device ep_info = { &net_imask }; +DATA_SET(pccarddrv_set, ep_info); + /* * Initialize the device - called from Slot manager. */ @@ -473,10 +476,6 @@ ep_isa_probe(is) struct ep_board *epb; u_short k; -#if NCARD > 0 - pccard_add_driver(&ep_info); -#endif - if ((epb = ep_look_for_board_at(is)) == 0) return (0); diff --git a/sys/i386/isa/if_fe.c b/sys/i386/isa/if_fe.c index 41d10ed..a41e4bc 100644 --- a/sys/i386/isa/if_fe.c +++ b/sys/i386/isa/if_fe.c @@ -21,7 +21,7 @@ */ /* - * $Id: if_fe.c,v 1.29 1997/07/20 14:09:59 bde Exp $ + * $Id: if_fe.c,v 1.31 1997/10/26 04:53:54 nate Exp $ * * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. * To be used with FreeBSD 2.x @@ -336,6 +336,8 @@ static struct pccard_device fe_info = { /* XXX - Should this also include net_imask? */ }; +DATA_SET(pccarddrv_set, fe_info); + /* * Initialize the device - called from Slot manager. */ @@ -451,9 +453,6 @@ static struct fe_probe_list const fe_probe_list [] = static int fe_probe ( DEVICE * dev ) { -#if NCARD > 0 - static int fe_already_init; -#endif struct fe_softc * sc; int u; int nports; @@ -465,17 +464,6 @@ fe_probe ( DEVICE * dev ) sc = &fe_softc[ dev->id_unit ]; sc->sc_unit = dev->id_unit; -#if NCARD > 0 - /* - * If PC-Card probe required, then register driver with - * slot manager. - */ - if (fe_already_init != 1) { - pccard_add_driver(&fe_info); - fe_already_init = 1; - } -#endif - /* Probe each possibility, one at a time. */ for ( list = fe_probe_list; list->probe != NULL; list++ ) { diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 93d147d..db9afb2 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.184 1997/10/12 20:23:30 phk Exp $ + * $Id: sio.c,v 1.186 1997/10/26 04:53:56 nate Exp $ */ #include "opt_comconsole.h" @@ -488,6 +488,8 @@ static struct pccard_device sio_info = { /* XXX - Should this also include net_imask? */ }; +DATA_SET(pccarddrv_set, sio_info); + /* * Initialize the device - called from Slot manager. */ @@ -587,13 +589,6 @@ sioprobe(dev) for (xdev = isa_devtab_tty; xdev->id_driver != NULL; xdev++) if (xdev->id_driver == &siodriver && xdev->id_enabled) outb(xdev->id_iobase + com_mcr, 0); -#if NCARD > 0 - /* - * If PC-Card probe required, then register driver with - * slot manager. - */ - pccard_add_driver(&sio_info); -#endif already_init = TRUE; } diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 93d147d..db9afb2 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.184 1997/10/12 20:23:30 phk Exp $ + * $Id: sio.c,v 1.186 1997/10/26 04:53:56 nate Exp $ */ #include "opt_comconsole.h" @@ -488,6 +488,8 @@ static struct pccard_device sio_info = { /* XXX - Should this also include net_imask? */ }; +DATA_SET(pccarddrv_set, sio_info); + /* * Initialize the device - called from Slot manager. */ @@ -587,13 +589,6 @@ sioprobe(dev) for (xdev = isa_devtab_tty; xdev->id_driver != NULL; xdev++) if (xdev->id_driver == &siodriver && xdev->id_enabled) outb(xdev->id_iobase + com_mcr, 0); -#if NCARD > 0 - /* - * If PC-Card probe required, then register driver with - * slot manager. - */ - pccard_add_driver(&sio_info); -#endif already_init = TRUE; } diff --git a/sys/pccard/driver.h b/sys/pccard/driver.h index ee6942d..5e3a693 100644 --- a/sys/pccard/driver.h +++ b/sys/pccard/driver.h @@ -9,6 +9,7 @@ struct lkm_table; struct pccard_device; +extern struct linker_set pccarddrv_set; void pccard_add_driver __P((struct pccard_device *)); #ifdef _I386_ISA_ISA_DEVICE_H_ /* XXX actually if inthand2_t is declared */ diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index cf6f62d..549f215 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -141,13 +141,22 @@ static struct cdevsw crd_cdevsw = * slot number accessed via the character device entries. */ void -pccard_configure() +pccard_configure(void) { + struct pccard_device **drivers, *drv; #include "pcic.h" #if NPCIC > 0 pcic_probe(); #endif + + drivers = (struct pccard_device **)pccarddrv_set.ls_items; + printf("Initializing PC-card drivers:"); + while ((drv = *drivers++)) { + printf(" %s", drv->name); + pccard_add_driver(drv); + } + printf("\n"); } /* @@ -164,7 +173,6 @@ pccard_add_driver(struct pccard_device *drv) printf("Driver %s already loaded\n", drv->name); return; } - printf("pccard driver %s added\n", drv->name); drv->next = drivers; drivers = drv; } diff --git a/sys/pccard/skel.c b/sys/pccard/skel.c index d0e7d6e..38daba4 100644 --- a/sys/pccard/skel.c +++ b/sys/pccard/skel.c @@ -63,6 +63,8 @@ static struct pccard_device skel_info = { &net_imask /* Interrupt mask for device */ }; +DATA_SET(pccarddrv_set, skel_info); + static int opened; /* Rather minimal device state... */ /* |