3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/sys/netatm/uni/uni_load.c,v 1.4 2000/01/17 20:49:54 mks Exp $
31 * ATM Forum UNI Support
32 * ---------------------
34 * Loadable kernel module support
38 #ifndef ATM_UNI_MODULE
42 #include <netatm/kern_include.h>
45 __RCSID("@(#) $FreeBSD: src/sys/netatm/uni/uni_load.c,v 1.4 2000/01/17 20:49:54 mks Exp $");
51 int sscop_start __P((void));
52 int sscop_stop __P((void));
53 int sscf_uni_start __P((void));
54 int sscf_uni_stop __P((void));
55 int uniip_start __P((void));
56 int uniip_stop __P((void));
57 int unisig_start __P((void));
58 int unisig_stop __P((void));
63 static int uni_start __P((void));
64 static int uni_stop __P((void));
68 * Initialize uni processing
70 * This will be called during module loading. We just notify all of our
71 * sub-services to initialize.
77 * 0 startup was successful
78 * errno startup failed - reason indicated
87 * Verify software version
89 if (atm_version != ATM_VERSION) {
90 log(LOG_ERR, "version mismatch: uni=%d.%d kernel=%d.%d\n",
91 ATM_VERS_MAJ(ATM_VERSION), ATM_VERS_MIN(ATM_VERSION),
92 ATM_VERS_MAJ(atm_version), ATM_VERS_MIN(atm_version));
97 * Initialize uni sub-services
103 err = sscf_uni_start();
107 err = unisig_start();
121 * Halt uni processing
123 * This will be called just prior to unloading the module from
124 * memory. All sub-services will be notified of the termination.
130 * 0 shutdown was successful
131 * errno shutdown failed - reason indicated
137 int err, s = splnet();
140 * Terminate uni sub-services
150 err = sscf_uni_stop();
164 #ifdef ATM_UNI_MODULE
166 *******************************************************************
168 * Loadable Module Support
170 *******************************************************************
172 static int uni_doload __P((void));
173 static int uni_dounload __P((void));
176 * Generic module load processing
178 * This function is called by an OS-specific function when this
179 * module is being loaded.
185 * 0 load was successful
186 * errno load failed - reason indicated
199 /* Problems, clean up */
207 * Generic module unload processing
209 * This function is called by an OS-specific function when this
210 * module is being unloaded.
216 * 0 unload was successful
217 * errno unload failed - reason indicated
226 * OK, try to clean up our mess
236 * Loadable driver description
238 struct vdldrv uni_drv = {
239 VDMAGIC_PSEUDO, /* Pseudo Driver */
240 "uni_mod", /* name */
250 * Loadable module support entry point
252 * This is the routine called by the vd driver for all loadable module
253 * functions for this pseudo driver. This routine name must be specified
254 * on the modload(1) command. This routine will be called whenever the
255 * modload(1), modunload(1) or modstat(1) commands are issued for this
259 * cmd vd command code
260 * vdp pointer to vd driver's structure
261 * vdi pointer to command-specific vdioctl_* structure
262 * vds pointer to status structure (VDSTAT only)
265 * 0 command was successful
266 * errno command failed - reason indicated
270 uni_mod(cmd, vdp, vdi, vds)
284 * We dont support any user configuration
288 /* Let vd driver know about us */
289 vdp->vdd_vdtab = (struct vdlinkage *)&uni_drv;
296 err = uni_dounload();
304 /* Not much to say at the moment */
309 log(LOG_ERR, "uni_mod: Unknown vd command 0x%x\n", cmd);
319 #include <sys/exec.h>
320 #include <sys/sysent.h>
324 * Loadable miscellaneous module description
330 * Loadable module support "load" entry point
332 * This is the routine called by the lkm driver whenever the
333 * modload(1) command is issued for this module.
336 * lkmtp pointer to lkm drivers's structure
337 * cmd lkm command code
340 * 0 command was successful
341 * errno command failed - reason indicated
346 struct lkm_table *lkmtp;
349 return(uni_doload());
354 * Loadable module support "unload" entry point
356 * This is the routine called by the lkm driver whenever the
357 * modunload(1) command is issued for this module.
360 * lkmtp pointer to lkm drivers's structure
361 * cmd lkm command code
364 * 0 command was successful
365 * errno command failed - reason indicated
369 uni_unload(lkmtp, cmd)
370 struct lkm_table *lkmtp;
373 return(uni_dounload());
378 * Loadable module support entry point
380 * This is the routine called by the lkm driver for all loadable module
381 * functions for this driver. This routine name must be specified
382 * on the modload(1) command. This routine will be called whenever the
383 * modload(1), modunload(1) or modstat(1) commands are issued for this
387 * lkmtp pointer to lkm drivers's structure
388 * cmd lkm command code
392 * 0 command was successful
393 * errno command failed - reason indicated
397 uni_mod(lkmtp, cmd, ver)
398 struct lkm_table *lkmtp;
402 MOD_DISPATCH(uni, lkmtp, cmd, ver,
403 uni_load, uni_unload, lkm_nullcmd);
405 #endif /* __FreeBSD__ */
407 #else /* !ATM_UNI_MODULE */
410 *******************************************************************
412 * Kernel Compiled Module Support
414 *******************************************************************
416 static void uni_doload __P((void *));
418 SYSINIT(atmuni, SI_SUB_PROTO_END, SI_ORDER_ANY, uni_doload, NULL)
421 * Kernel initialization
431 uni_doload(void *arg)
440 /* Problems, clean up */
443 log(LOG_ERR, "ATM UNI unable to initialize (%d)!!\n", err);
447 #endif /* ATM_UNI_MODULE */