diff options
| author | Matthew N. Dodd <mdodd@FreeBSD.org> | 2002-10-02 04:42:24 +0000 |
|---|---|---|
| committer | Matthew N. Dodd <mdodd@FreeBSD.org> | 2002-10-02 04:42:24 +0000 |
| commit | c12ef98f270ac3c6c8bd294a7038fdf944733724 (patch) | |
| tree | e6b596a8cc365e523fc4edb004608426e9c112dc /sys/dev/hea | |
| parent | c0ec31f93e422786f3a1308b4b05147387a4ec95 (diff) | |
Notes
Diffstat (limited to 'sys/dev/hea')
| -rw-r--r-- | sys/dev/hea/hea_freebsd.c | 62 | ||||
| -rw-r--r-- | sys/dev/hea/hea_pci.c | 1 |
2 files changed, 48 insertions, 15 deletions
diff --git a/sys/dev/hea/hea_freebsd.c b/sys/dev/hea/hea_freebsd.c index 6efabb56e24a1..8640522da806d 100644 --- a/sys/dev/hea/hea_freebsd.c +++ b/sys/dev/hea/hea_freebsd.c @@ -93,6 +93,8 @@ devclass_t hea_devclass; +static int hea_modevent(module_t, int, void *); + int hea_alloc (device_t dev) { @@ -158,18 +160,6 @@ hea_attach (device_t dev) eup = &sc->eup; error = 0; - eni_vcc_zone = uma_zcreate("eni vcc", sizeof(Eni_vcc), NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - if (eni_vcc_zone == NULL) - panic("hea_attach: uma_zcreate vcc"); - uma_zone_set_max(eni_vcc_zone, 100); - - eni_nif_zone = uma_zcreate("eni nif", sizeof(struct atm_nif), NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - if (eni_nif_zone == NULL) - panic("hea_attach: uma_zcreate nif"); - uma_zone_set_max(eni_nif_zone, 52); - /* * Start initializing it */ @@ -342,9 +332,6 @@ hea_detach (device_t dev) hea_free(dev); - uma_zdestroy(eni_vcc_zone); - uma_zdestroy(eni_nif_zone); - return (error); } @@ -391,3 +378,48 @@ hea_reset (device_t dev) return; } + +static int +hea_modevent (module_t mod, int type, void *data) +{ + int error; + + error = 0; + + switch (type) { + case MOD_LOAD: + + eni_nif_zone = uma_zcreate("eni nif", sizeof(struct atm_nif), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + if (eni_nif_zone == NULL) + panic("%s(): uma_zcreate nif", __func__); + uma_zone_set_max(eni_nif_zone, 52); + + eni_vcc_zone = uma_zcreate("eni vcc", sizeof(Eni_vcc), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + if (eni_vcc_zone == NULL) + panic("%s(): uma_zcreate vcc", __func__); + uma_zone_set_max(eni_vcc_zone, 100); + + break; + + case MOD_UNLOAD: + + uma_zdestroy(eni_nif_zone); + uma_zdestroy(eni_vcc_zone); + + break; + default: + break; + } + + return (error); +} + +static moduledata_t hea_moduledata = { + "hea", + hea_modevent, + NULL +}; +DECLARE_MODULE(hea, hea_moduledata, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); +MODULE_VERSION(hea, 1); diff --git a/sys/dev/hea/hea_pci.c b/sys/dev/hea/hea_pci.c index d54a8987a2f13..8432f58da6118 100644 --- a/sys/dev/hea/hea_pci.c +++ b/sys/dev/hea/hea_pci.c @@ -246,3 +246,4 @@ static driver_t hea_pci_driver = { DRIVER_MODULE(hea, pci, hea_pci_driver, hea_devclass, 0, 0); MODULE_DEPEND(hea, pci, 1, 1, 1); +MODULE_DEPEND(hea, hea, 1, 1, 1); |
