4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
31 * 1394 Services Layer Initialization and Cleanup Routines
32 * The routines do all initialization and cleanup for the Sevices Layer
37 #include <sys/sunddi.h>
38 #include <sys/types.h>
40 #include <sys/tnf_probe.h>
42 #include <sys/1394/t1394.h>
43 #include <sys/1394/s1394.h>
44 #include <sys/1394/h1394.h>
46 /* Driver State Pointer */
47 s1394_state_t
*s1394_statep
;
49 /* Module Driver Info */
50 static struct modlmisc s1394_modlmisc
= {
52 "IEEE 1394 Services Library 1.0"
56 static struct modlinkage s1394_modlinkage
= {
62 static int s1394_init();
63 static void s1394_fini();
66 extern int tnf_mod_load(void);
67 extern int tnf_mod_unload(struct modlinkage
*mlp
);
76 (void) tnf_mod_load();
78 status
= s1394_init();
81 (void) tnf_mod_unload(&s1394_modlinkage
);
86 status
= mod_install(&s1394_modlinkage
);
89 (void) tnf_mod_unload(&s1394_modlinkage
);
96 _info(struct modinfo
*modinfop
)
98 return (mod_info(&s1394_modlinkage
, modinfop
));
106 status
= mod_remove(&s1394_modlinkage
);
113 (void) tnf_mod_unload(&s1394_modlinkage
);
120 * initializes the 1394 Software Framework's structures, i.e. the HAL list
121 * and associated mutex.
126 s1394_statep
= kmem_zalloc(sizeof (s1394_state_t
), KM_SLEEP
);
128 s1394_statep
->hal_head
= NULL
;
129 s1394_statep
->hal_tail
= NULL
;
130 mutex_init(&s1394_statep
->hal_list_mutex
, NULL
, MUTEX_DRIVER
, NULL
);
137 * cleans up the 1394 Software Framework's structures that were allocated
143 mutex_destroy(&s1394_statep
->hal_list_mutex
);
145 kmem_free(s1394_statep
, sizeof (s1394_state_t
));