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 $
27 * @(#) $DragonFly: src/sys/netproto/atm/uni/uni_load.c,v 1.2 2003/06/17 04:28:49 dillon Exp $
31 * ATM Forum UNI Support
32 * ---------------------
34 * Loadable kernel module support
38 #ifndef ATM_UNI_MODULE
42 #include <netatm/kern_include.h>
47 int sscop_start __P((void));
48 int sscop_stop __P((void));
49 int sscf_uni_start __P((void));
50 int sscf_uni_stop __P((void));
51 int uniip_start __P((void));
52 int uniip_stop __P((void));
53 int unisig_start __P((void));
54 int unisig_stop __P((void));
59 static int uni_start __P((void));
60 static int uni_stop __P((void));
64 * Initialize uni processing
66 * This will be called during module loading. We just notify all of our
67 * sub-services to initialize.
73 * 0 startup was successful
74 * errno startup failed - reason indicated
83 * Verify software version
85 if (atm_version != ATM_VERSION) {
86 log(LOG_ERR, "version mismatch: uni=%d.%d kernel=%d.%d\n",
87 ATM_VERS_MAJ(ATM_VERSION), ATM_VERS_MIN(ATM_VERSION),
88 ATM_VERS_MAJ(atm_version), ATM_VERS_MIN(atm_version));
93 * Initialize uni sub-services
99 err = sscf_uni_start();
103 err = unisig_start();
117 * Halt uni processing
119 * This will be called just prior to unloading the module from
120 * memory. All sub-services will be notified of the termination.
126 * 0 shutdown was successful
127 * errno shutdown failed - reason indicated
133 int err, s = splnet();
136 * Terminate uni sub-services
146 err = sscf_uni_stop();
160 #ifdef ATM_UNI_MODULE
162 *******************************************************************
164 * Loadable Module Support
166 *******************************************************************
168 static int uni_doload __P((void));
169 static int uni_dounload __P((void));
172 * Generic module load processing
174 * This function is called by an OS-specific function when this
175 * module is being loaded.
181 * 0 load was successful
182 * errno load failed - reason indicated
195 /* Problems, clean up */
203 * Generic module unload processing
205 * This function is called by an OS-specific function when this
206 * module is being unloaded.
212 * 0 unload was successful
213 * errno unload failed - reason indicated
222 * OK, try to clean up our mess
232 * Loadable driver description
234 struct vdldrv uni_drv = {
235 VDMAGIC_PSEUDO, /* Pseudo Driver */
236 "uni_mod", /* name */
246 * Loadable module support entry point
248 * This is the routine called by the vd driver for all loadable module
249 * functions for this pseudo driver. This routine name must be specified
250 * on the modload(1) command. This routine will be called whenever the
251 * modload(1), modunload(1) or modstat(1) commands are issued for this
255 * cmd vd command code
256 * vdp pointer to vd driver's structure
257 * vdi pointer to command-specific vdioctl_* structure
258 * vds pointer to status structure (VDSTAT only)
261 * 0 command was successful
262 * errno command failed - reason indicated
266 uni_mod(cmd, vdp, vdi, vds)
280 * We dont support any user configuration
284 /* Let vd driver know about us */
285 vdp->vdd_vdtab = (struct vdlinkage *)&uni_drv;
292 err = uni_dounload();
300 /* Not much to say at the moment */
305 log(LOG_ERR, "uni_mod: Unknown vd command 0x%x\n", cmd);
315 #include <sys/exec.h>
316 #include <sys/sysent.h>
320 * Loadable miscellaneous module description
326 * Loadable module support "load" entry point
328 * This is the routine called by the lkm driver whenever the
329 * modload(1) command is issued for this module.
332 * lkmtp pointer to lkm drivers's structure
333 * cmd lkm command code
336 * 0 command was successful
337 * errno command failed - reason indicated
342 struct lkm_table *lkmtp;
345 return(uni_doload());
350 * Loadable module support "unload" entry point
352 * This is the routine called by the lkm driver whenever the
353 * modunload(1) command is issued for this module.
356 * lkmtp pointer to lkm drivers's structure
357 * cmd lkm command code
360 * 0 command was successful
361 * errno command failed - reason indicated
365 uni_unload(lkmtp, cmd)
366 struct lkm_table *lkmtp;
369 return(uni_dounload());
374 * Loadable module support entry point
376 * This is the routine called by the lkm driver for all loadable module
377 * functions for this driver. This routine name must be specified
378 * on the modload(1) command. This routine will be called whenever the
379 * modload(1), modunload(1) or modstat(1) commands are issued for this
383 * lkmtp pointer to lkm drivers's structure
384 * cmd lkm command code
388 * 0 command was successful
389 * errno command failed - reason indicated
393 uni_mod(lkmtp, cmd, ver)
394 struct lkm_table *lkmtp;
398 MOD_DISPATCH(uni, lkmtp, cmd, ver,
399 uni_load, uni_unload, lkm_nullcmd);
401 #endif /* __FreeBSD__ */
403 #else /* !ATM_UNI_MODULE */
406 *******************************************************************
408 * Kernel Compiled Module Support
410 *******************************************************************
412 static void uni_doload __P((void *));
414 SYSINIT(atmuni, SI_SUB_PROTO_END, SI_ORDER_ANY, uni_doload, NULL)
417 * Kernel initialization
427 uni_doload(void *arg)
436 /* Problems, clean up */
439 log(LOG_ERR, "ATM UNI unable to initialize (%d)!!\n", err);
443 #endif /* ATM_UNI_MODULE */